Import OpenSSL 1.1.0h
This commit is contained in:
@@ -76,7 +76,7 @@ int BIO_ADDR_make(BIO_ADDR *ap, const struct sockaddr *sa)
|
||||
}
|
||||
#endif
|
||||
#ifdef AF_UNIX
|
||||
if (ap->sa.sa_family == AF_UNIX) {
|
||||
if (sa->sa_family == AF_UNIX) {
|
||||
ap->s_un = *(const struct sockaddr_un *)sa;
|
||||
return 1;
|
||||
}
|
||||
@@ -668,7 +668,7 @@ int BIO_lookup(const char *host, const char *service,
|
||||
int gai_ret = 0;
|
||||
struct addrinfo hints;
|
||||
|
||||
memset(&hints, 0, sizeof hints);
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
|
||||
hints.ai_family = family;
|
||||
hints.ai_socktype = socktype;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <stdio.h>
|
||||
#include "bio_lcl.h"
|
||||
|
||||
#define TRUNCATE
|
||||
#define DUMP_WIDTH 16
|
||||
#define DUMP_WIDTH_LESS_INDENT(i) (DUMP_WIDTH-((i-(i>6?6:i)+3)/4))
|
||||
|
||||
@@ -29,17 +28,10 @@ int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u),
|
||||
{
|
||||
int ret = 0;
|
||||
char buf[288 + 1], tmp[20], str[128 + 1];
|
||||
int i, j, rows, trc;
|
||||
int i, j, rows;
|
||||
unsigned char ch;
|
||||
int dump_width;
|
||||
|
||||
trc = 0;
|
||||
|
||||
#ifdef TRUNCATE
|
||||
for (; (len > 0) && ((s[len - 1] == ' ') || (s[len - 1] == '\0')); len--)
|
||||
trc++;
|
||||
#endif
|
||||
|
||||
if (indent < 0)
|
||||
indent = 0;
|
||||
if (indent) {
|
||||
@@ -54,50 +46,43 @@ int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u),
|
||||
if ((rows * dump_width) < len)
|
||||
rows++;
|
||||
for (i = 0; i < rows; i++) {
|
||||
OPENSSL_strlcpy(buf, str, sizeof buf);
|
||||
BIO_snprintf(tmp, sizeof tmp, "%04x - ", i * dump_width);
|
||||
OPENSSL_strlcat(buf, tmp, sizeof buf);
|
||||
OPENSSL_strlcpy(buf, str, sizeof(buf));
|
||||
BIO_snprintf(tmp, sizeof(tmp), "%04x - ", i * dump_width);
|
||||
OPENSSL_strlcat(buf, tmp, sizeof(buf));
|
||||
for (j = 0; j < dump_width; j++) {
|
||||
if (((i * dump_width) + j) >= len) {
|
||||
OPENSSL_strlcat(buf, " ", sizeof buf);
|
||||
OPENSSL_strlcat(buf, " ", sizeof(buf));
|
||||
} else {
|
||||
ch = ((unsigned char)*(s + i * dump_width + j)) & 0xff;
|
||||
BIO_snprintf(tmp, sizeof tmp, "%02x%c", ch,
|
||||
BIO_snprintf(tmp, sizeof(tmp), "%02x%c", ch,
|
||||
j == 7 ? '-' : ' ');
|
||||
OPENSSL_strlcat(buf, tmp, sizeof buf);
|
||||
OPENSSL_strlcat(buf, tmp, sizeof(buf));
|
||||
}
|
||||
}
|
||||
OPENSSL_strlcat(buf, " ", sizeof buf);
|
||||
OPENSSL_strlcat(buf, " ", sizeof(buf));
|
||||
for (j = 0; j < dump_width; j++) {
|
||||
if (((i * dump_width) + j) >= len)
|
||||
break;
|
||||
ch = ((unsigned char)*(s + i * dump_width + j)) & 0xff;
|
||||
#ifndef CHARSET_EBCDIC
|
||||
BIO_snprintf(tmp, sizeof tmp, "%c",
|
||||
BIO_snprintf(tmp, sizeof(tmp), "%c",
|
||||
((ch >= ' ') && (ch <= '~')) ? ch : '.');
|
||||
#else
|
||||
BIO_snprintf(tmp, sizeof tmp, "%c",
|
||||
BIO_snprintf(tmp, sizeof(tmp), "%c",
|
||||
((ch >= os_toascii[' ']) && (ch <= os_toascii['~']))
|
||||
? os_toebcdic[ch]
|
||||
: '.');
|
||||
#endif
|
||||
OPENSSL_strlcat(buf, tmp, sizeof buf);
|
||||
OPENSSL_strlcat(buf, tmp, sizeof(buf));
|
||||
}
|
||||
OPENSSL_strlcat(buf, "\n", sizeof buf);
|
||||
OPENSSL_strlcat(buf, "\n", sizeof(buf));
|
||||
/*
|
||||
* if this is the last call then update the ddt_dump thing so that we
|
||||
* will move the selection point in the debug window
|
||||
*/
|
||||
ret += cb((void *)buf, strlen(buf), u);
|
||||
}
|
||||
#ifdef TRUNCATE
|
||||
if (trc > 0) {
|
||||
BIO_snprintf(buf, sizeof buf, "%s%04x - <SPACES/NULS>\n", str,
|
||||
len + trc);
|
||||
ret += cb((void *)buf, strlen(buf), u);
|
||||
}
|
||||
#endif
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
|
||||
@@ -258,6 +258,7 @@ _dopr(char **sbuffer,
|
||||
break;
|
||||
case 'E':
|
||||
flags |= DP_F_UP;
|
||||
/* fall thru */
|
||||
case 'e':
|
||||
if (cflags == DP_C_LDOUBLE)
|
||||
fvalue = va_arg(args, LDOUBLE);
|
||||
@@ -269,6 +270,7 @@ _dopr(char **sbuffer,
|
||||
break;
|
||||
case 'G':
|
||||
flags |= DP_F_UP;
|
||||
/* fall thru */
|
||||
case 'g':
|
||||
if (cflags == DP_C_LDOUBLE)
|
||||
fvalue = va_arg(args, LDOUBLE);
|
||||
@@ -663,7 +665,7 @@ fmtfp(char **sbuffer,
|
||||
iconvert[iplace++] = "0123456789"[intpart % 10];
|
||||
intpart = (intpart / 10);
|
||||
} while (intpart && (iplace < (int)sizeof(iconvert)));
|
||||
if (iplace == sizeof iconvert)
|
||||
if (iplace == sizeof(iconvert))
|
||||
iplace--;
|
||||
iconvert[iplace] = 0;
|
||||
|
||||
@@ -681,7 +683,7 @@ fmtfp(char **sbuffer,
|
||||
fracpart = (fracpart / 10);
|
||||
}
|
||||
|
||||
if (fplace == sizeof fconvert)
|
||||
if (fplace == sizeof(fconvert))
|
||||
fplace--;
|
||||
fconvert[fplace] = 0;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -172,8 +172,10 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
|
||||
return 0;
|
||||
|
||||
# ifndef OPENSSL_SYS_WINDOWS
|
||||
/* SO_REUSEADDR has different behavior on Windows than on
|
||||
* other operating systems, don't set it there. */
|
||||
/*
|
||||
* SO_REUSEADDR has different behavior on Windows than on
|
||||
* other operating systems, don't set it there.
|
||||
*/
|
||||
if (options & BIO_SOCK_REUSEADDR) {
|
||||
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) != 0) {
|
||||
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
|
||||
@@ -200,7 +202,12 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
|
||||
}
|
||||
|
||||
# ifdef IPV6_V6ONLY
|
||||
if ((options & BIO_SOCK_V6_ONLY) && BIO_ADDR_family(addr) == AF_INET6) {
|
||||
if (BIO_ADDR_family(addr) == AF_INET6) {
|
||||
/*
|
||||
* Note: Windows default of IPV6_V6ONLY is ON, and Linux is OFF.
|
||||
* Therefore we always have to use setsockopt here.
|
||||
*/
|
||||
on = options & BIO_SOCK_V6_ONLY ? 1 : 0;
|
||||
if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) != 0) {
|
||||
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
|
||||
BIOerr(BIO_F_BIO_LISTEN, BIO_R_LISTEN_V6_ONLY);
|
||||
|
||||
@@ -19,7 +19,7 @@ static int buffer_gets(BIO *h, char *str, int size);
|
||||
static long buffer_ctrl(BIO *h, int cmd, long arg1, void *arg2);
|
||||
static int buffer_new(BIO *h);
|
||||
static int buffer_free(BIO *data);
|
||||
static long buffer_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
|
||||
static long buffer_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp);
|
||||
#define DEFAULT_BUFFER_SIZE 4096
|
||||
|
||||
static const BIO_METHOD methods_buffer = {
|
||||
@@ -388,7 +388,7 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static long buffer_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
|
||||
static long buffer_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
|
||||
{
|
||||
long ret = 1;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -20,7 +20,7 @@ static int linebuffer_gets(BIO *h, char *str, int size);
|
||||
static long linebuffer_ctrl(BIO *h, int cmd, long arg1, void *arg2);
|
||||
static int linebuffer_new(BIO *h);
|
||||
static int linebuffer_free(BIO *data);
|
||||
static long linebuffer_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
|
||||
static long linebuffer_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp);
|
||||
|
||||
/* A 10k maximum should be enough for most purposes */
|
||||
#define DEFAULT_LINEBUFFER_SIZE 1024*10
|
||||
@@ -116,9 +116,10 @@ static int linebuffer_write(BIO *b, const char *in, int inl)
|
||||
|
||||
do {
|
||||
const char *p;
|
||||
char c;
|
||||
|
||||
for (p = in; p < in + inl && *p != '\n'; p++) ;
|
||||
if (*p == '\n') {
|
||||
for (p = in, c = '\0'; p < in + inl && (c = *p) != '\n'; p++) ;
|
||||
if (c == '\n') {
|
||||
p++;
|
||||
foundnl = 1;
|
||||
} else
|
||||
@@ -292,7 +293,7 @@ static long linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static long linebuffer_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
|
||||
static long linebuffer_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
|
||||
{
|
||||
long ret = 1;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ static int nbiof_gets(BIO *h, char *str, int size);
|
||||
static long nbiof_ctrl(BIO *h, int cmd, long arg1, void *arg2);
|
||||
static int nbiof_new(BIO *h);
|
||||
static int nbiof_free(BIO *data);
|
||||
static long nbiof_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
|
||||
static long nbiof_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp);
|
||||
typedef struct nbio_test_st {
|
||||
/* only set if we sent a 'should retry' error */
|
||||
int lrn;
|
||||
@@ -165,7 +165,7 @@ static long nbiof_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
static long nbiof_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
|
||||
static long nbiof_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
|
||||
{
|
||||
long ret = 1;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -21,9 +21,7 @@ static int nullf_read(BIO *h, char *buf, int size);
|
||||
static int nullf_puts(BIO *h, const char *str);
|
||||
static int nullf_gets(BIO *h, char *str, int size);
|
||||
static long nullf_ctrl(BIO *h, int cmd, long arg1, void *arg2);
|
||||
static int nullf_new(BIO *h);
|
||||
static int nullf_free(BIO *data);
|
||||
static long nullf_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
|
||||
static long nullf_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp);
|
||||
static const BIO_METHOD methods_nullf = {
|
||||
BIO_TYPE_NULL_FILTER,
|
||||
"NULL filter",
|
||||
@@ -32,8 +30,8 @@ static const BIO_METHOD methods_nullf = {
|
||||
nullf_puts,
|
||||
nullf_gets,
|
||||
nullf_ctrl,
|
||||
nullf_new,
|
||||
nullf_free,
|
||||
NULL,
|
||||
NULL,
|
||||
nullf_callback_ctrl,
|
||||
};
|
||||
|
||||
@@ -42,26 +40,6 @@ const BIO_METHOD *BIO_f_null(void)
|
||||
return (&methods_nullf);
|
||||
}
|
||||
|
||||
static int nullf_new(BIO *bi)
|
||||
{
|
||||
bi->init = 1;
|
||||
bi->ptr = NULL;
|
||||
bi->flags = 0;
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int nullf_free(BIO *a)
|
||||
{
|
||||
if (a == NULL)
|
||||
return (0);
|
||||
/*-
|
||||
a->ptr=NULL;
|
||||
a->init=0;
|
||||
a->flags=0;
|
||||
*/
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int nullf_read(BIO *b, char *out, int outl)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -111,7 +89,7 @@ static long nullf_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
static long nullf_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
|
||||
static long nullf_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
|
||||
{
|
||||
long ret = 1;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ long BIO_debug_callback(BIO *bio, int cmd, const char *argp,
|
||||
if (BIO_CB_RETURN & cmd)
|
||||
r = ret;
|
||||
|
||||
len = BIO_snprintf(buf, sizeof buf, "BIO[%p]: ", (void *)bio);
|
||||
len = BIO_snprintf(buf, sizeof(buf), "BIO[%p]: ", (void *)bio);
|
||||
|
||||
/* Ignore errors and continue printing the other information. */
|
||||
if (len < 0)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -34,6 +34,7 @@ static ERR_STRING_DATA BIO_str_functs[] = {
|
||||
{ERR_FUNC(BIO_F_BIO_LISTEN), "BIO_listen"},
|
||||
{ERR_FUNC(BIO_F_BIO_LOOKUP), "BIO_lookup"},
|
||||
{ERR_FUNC(BIO_F_BIO_MAKE_PAIR), "bio_make_pair"},
|
||||
{ERR_FUNC(BIO_F_BIO_METH_NEW), "BIO_meth_new"},
|
||||
{ERR_FUNC(BIO_F_BIO_NEW), "BIO_new"},
|
||||
{ERR_FUNC(BIO_F_BIO_NEW_FILE), "BIO_new_file"},
|
||||
{ERR_FUNC(BIO_F_BIO_NEW_MEM_BUF), "BIO_new_mem_buf"},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -42,6 +42,8 @@ BIO *BIO_new(const BIO_METHOD *method)
|
||||
CRYPTO_THREAD_lock_free(bio->lock);
|
||||
goto err;
|
||||
}
|
||||
if (method->create == NULL)
|
||||
bio->init = 1;
|
||||
|
||||
return bio;
|
||||
|
||||
@@ -350,9 +352,7 @@ long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
long BIO_callback_ctrl(BIO *b, int cmd,
|
||||
void (*fp) (struct bio_st *, int, const char *, int,
|
||||
long, long))
|
||||
long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
|
||||
{
|
||||
long ret;
|
||||
long (*cb) (BIO *, int, const char *, int, long, long);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -37,16 +37,21 @@ BIO_METHOD *BIO_meth_new(int type, const char *name)
|
||||
{
|
||||
BIO_METHOD *biom = OPENSSL_zalloc(sizeof(BIO_METHOD));
|
||||
|
||||
if (biom != NULL) {
|
||||
biom->type = type;
|
||||
biom->name = name;
|
||||
if (biom == NULL
|
||||
|| (biom->name = OPENSSL_strdup(name)) == NULL) {
|
||||
OPENSSL_free(biom);
|
||||
BIOerr(BIO_F_BIO_METH_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
return biom;
|
||||
}
|
||||
|
||||
void BIO_meth_free(BIO_METHOD *biom)
|
||||
{
|
||||
OPENSSL_free(biom);
|
||||
if (biom != NULL) {
|
||||
OPENSSL_free(biom->name);
|
||||
OPENSSL_free(biom);
|
||||
}
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_write(BIO_METHOD *biom)) (BIO *, const char *, int)
|
||||
@@ -131,14 +136,14 @@ int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *))
|
||||
return 1;
|
||||
}
|
||||
|
||||
long (*BIO_meth_get_callback_ctrl(BIO_METHOD *biom)) (BIO *, int, bio_info_cb *)
|
||||
long (*BIO_meth_get_callback_ctrl(BIO_METHOD *biom)) (BIO *, int, BIO_info_cb *)
|
||||
{
|
||||
return biom->callback_ctrl;
|
||||
}
|
||||
|
||||
int BIO_meth_set_callback_ctrl(BIO_METHOD *biom,
|
||||
long (*callback_ctrl) (BIO *, int,
|
||||
bio_info_cb *))
|
||||
BIO_info_cb *))
|
||||
{
|
||||
biom->callback_ctrl = callback_ctrl;
|
||||
return 1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -57,11 +57,11 @@ static const BIO_METHOD methods_acceptp = {
|
||||
acpt_write,
|
||||
acpt_read,
|
||||
acpt_puts,
|
||||
NULL, /* connect_gets, */
|
||||
NULL, /* connect_gets, */
|
||||
acpt_ctrl,
|
||||
acpt_new,
|
||||
acpt_free,
|
||||
NULL,
|
||||
NULL, /* connect_callback_ctrl */
|
||||
};
|
||||
|
||||
const BIO_METHOD *BIO_s_accept(void)
|
||||
@@ -271,6 +271,11 @@ static int acpt_state(BIO *b, BIO_ACCEPT *c)
|
||||
BIO_clear_retry_flags(b);
|
||||
b->retry_reason = 0;
|
||||
|
||||
OPENSSL_free(c->cache_peer_name);
|
||||
c->cache_peer_name = NULL;
|
||||
OPENSSL_free(c->cache_peer_serv);
|
||||
c->cache_peer_serv = NULL;
|
||||
|
||||
s = BIO_accept_ex(c->accept_sock, &c->cache_peer_addr,
|
||||
c->accepted_mode);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ typedef struct bio_connect_st {
|
||||
* The callback should return 'ret'. state is for compatibility with the
|
||||
* ssl info_callback
|
||||
*/
|
||||
int (*info_callback) (const BIO *bio, int state, int ret);
|
||||
BIO_info_cb *info_callback;
|
||||
} BIO_CONNECT;
|
||||
|
||||
static int conn_write(BIO *h, const char *buf, int num);
|
||||
@@ -41,7 +41,7 @@ static int conn_puts(BIO *h, const char *str);
|
||||
static long conn_ctrl(BIO *h, int cmd, long arg1, void *arg2);
|
||||
static int conn_new(BIO *h);
|
||||
static int conn_free(BIO *data);
|
||||
static long conn_callback_ctrl(BIO *h, int cmd, bio_info_cb *);
|
||||
static long conn_callback_ctrl(BIO *h, int cmd, BIO_info_cb *);
|
||||
|
||||
static int conn_state(BIO *b, BIO_CONNECT *c);
|
||||
static void conn_close_socket(BIO *data);
|
||||
@@ -61,7 +61,7 @@ static const BIO_METHOD methods_connectp = {
|
||||
conn_write,
|
||||
conn_read,
|
||||
conn_puts,
|
||||
NULL, /* connect_gets, */
|
||||
NULL, /* conn_gets, */
|
||||
conn_ctrl,
|
||||
conn_new,
|
||||
conn_free,
|
||||
@@ -71,7 +71,7 @@ static const BIO_METHOD methods_connectp = {
|
||||
static int conn_state(BIO *b, BIO_CONNECT *c)
|
||||
{
|
||||
int ret = -1, i;
|
||||
int (*cb) (const BIO *, int, int) = NULL;
|
||||
BIO_info_cb *cb = NULL;
|
||||
|
||||
if (c->info_callback != NULL)
|
||||
cb = c->info_callback;
|
||||
@@ -469,8 +469,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
* FIXME: the cast of the function seems unlikely to be a good
|
||||
* idea
|
||||
*/
|
||||
(void)BIO_set_info_callback(dbio,
|
||||
(bio_info_cb *)data->info_callback);
|
||||
(void)BIO_set_info_callback(dbio, data->info_callback);
|
||||
}
|
||||
break;
|
||||
case BIO_CTRL_SET_CALLBACK:
|
||||
@@ -486,9 +485,9 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
break;
|
||||
case BIO_CTRL_GET_CALLBACK:
|
||||
{
|
||||
int (**fptr) (const BIO *bio, int state, int xret);
|
||||
BIO_info_cb **fptr;
|
||||
|
||||
fptr = (int (**)(const BIO *bio, int state, int xret))ptr;
|
||||
fptr = (BIO_info_cb **)ptr;
|
||||
*fptr = data->info_callback;
|
||||
}
|
||||
break;
|
||||
@@ -499,7 +498,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
static long conn_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
|
||||
static long conn_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
|
||||
{
|
||||
long ret = 1;
|
||||
BIO_CONNECT *data;
|
||||
@@ -509,8 +508,7 @@ static long conn_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
|
||||
switch (cmd) {
|
||||
case BIO_CTRL_SET_CALLBACK:
|
||||
{
|
||||
data->info_callback =
|
||||
(int (*)(const struct bio_st *, int, int))fp;
|
||||
data->info_callback = fp;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -76,11 +76,11 @@ static const BIO_METHOD methods_dgramp = {
|
||||
dgram_write,
|
||||
dgram_read,
|
||||
dgram_puts,
|
||||
NULL, /* dgram_gets, */
|
||||
NULL, /* dgram_gets, */
|
||||
dgram_ctrl,
|
||||
dgram_new,
|
||||
dgram_free,
|
||||
NULL,
|
||||
NULL, /* dgram_callback_ctrl */
|
||||
};
|
||||
|
||||
# ifndef OPENSSL_NO_SCTP
|
||||
@@ -90,11 +90,11 @@ static const BIO_METHOD methods_dgramp_sctp = {
|
||||
dgram_sctp_write,
|
||||
dgram_sctp_read,
|
||||
dgram_sctp_puts,
|
||||
NULL, /* dgram_gets, */
|
||||
NULL, /* dgram_gets, */
|
||||
dgram_sctp_ctrl,
|
||||
dgram_sctp_new,
|
||||
dgram_sctp_free,
|
||||
NULL,
|
||||
NULL, /* dgram_callback_ctrl */
|
||||
};
|
||||
# endif
|
||||
|
||||
@@ -782,6 +782,15 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
case BIO_CTRL_DGRAM_GET_MTU_OVERHEAD:
|
||||
ret = dgram_get_mtu_overhead(data);
|
||||
break;
|
||||
|
||||
/*
|
||||
* BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE is used here for compatibility
|
||||
* reasons. When BIO_CTRL_DGRAM_SET_PEEK_MODE was first defined its value
|
||||
* was incorrectly clashing with BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE. The
|
||||
* value has been updated to a non-clashing value. However to preserve
|
||||
* binary compatiblity we now respond to both the old value and the new one
|
||||
*/
|
||||
case BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE:
|
||||
case BIO_CTRL_DGRAM_SET_PEEK_MODE:
|
||||
data->peekmode = (unsigned int)num;
|
||||
break;
|
||||
@@ -1442,6 +1451,7 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
* we need to deactivate an old key
|
||||
*/
|
||||
data->ccs_sent = 1;
|
||||
/* fall-through */
|
||||
|
||||
case BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD:
|
||||
/* Returns 0 on success, -1 otherwise. */
|
||||
|
||||
@@ -58,7 +58,8 @@ static int fd_free(BIO *data);
|
||||
int BIO_fd_should_retry(int s);
|
||||
|
||||
static const BIO_METHOD methods_fdp = {
|
||||
BIO_TYPE_FD, "file descriptor",
|
||||
BIO_TYPE_FD,
|
||||
"file descriptor",
|
||||
fd_write,
|
||||
fd_read,
|
||||
fd_puts,
|
||||
@@ -66,7 +67,7 @@ static const BIO_METHOD methods_fdp = {
|
||||
fd_ctrl,
|
||||
fd_new,
|
||||
fd_free,
|
||||
NULL,
|
||||
NULL, /* fd_callback_ctrl */
|
||||
};
|
||||
|
||||
const BIO_METHOD *BIO_s_fd(void)
|
||||
@@ -144,6 +145,7 @@ static long fd_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
switch (cmd) {
|
||||
case BIO_CTRL_RESET:
|
||||
num = 0;
|
||||
/* fall thru */
|
||||
case BIO_C_FILE_SEEK:
|
||||
ret = (long)UP_lseek(b->num, num, 0);
|
||||
break;
|
||||
|
||||
@@ -58,7 +58,7 @@ static const BIO_METHOD methods_filep = {
|
||||
file_ctrl,
|
||||
file_new,
|
||||
file_free,
|
||||
NULL,
|
||||
NULL, /* file_callback_ctrl */
|
||||
};
|
||||
|
||||
BIO *BIO_new_file(const char *filename, const char *mode)
|
||||
@@ -267,15 +267,15 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
b->shutdown = (int)num & BIO_CLOSE;
|
||||
if (num & BIO_FP_APPEND) {
|
||||
if (num & BIO_FP_READ)
|
||||
OPENSSL_strlcpy(p, "a+", sizeof p);
|
||||
OPENSSL_strlcpy(p, "a+", sizeof(p));
|
||||
else
|
||||
OPENSSL_strlcpy(p, "a", sizeof p);
|
||||
OPENSSL_strlcpy(p, "a", sizeof(p));
|
||||
} else if ((num & BIO_FP_READ) && (num & BIO_FP_WRITE))
|
||||
OPENSSL_strlcpy(p, "r+", sizeof p);
|
||||
OPENSSL_strlcpy(p, "r+", sizeof(p));
|
||||
else if (num & BIO_FP_WRITE)
|
||||
OPENSSL_strlcpy(p, "w", sizeof p);
|
||||
OPENSSL_strlcpy(p, "w", sizeof(p));
|
||||
else if (num & BIO_FP_READ)
|
||||
OPENSSL_strlcpy(p, "r", sizeof p);
|
||||
OPENSSL_strlcpy(p, "r", sizeof(p));
|
||||
else {
|
||||
BIOerr(BIO_F_FILE_CTRL, BIO_R_BAD_FOPEN_MODE);
|
||||
ret = 0;
|
||||
@@ -406,7 +406,7 @@ static const BIO_METHOD methods_filep = {
|
||||
file_ctrl,
|
||||
file_new,
|
||||
file_free,
|
||||
NULL,
|
||||
NULL, /* file_callback_ctrl */
|
||||
};
|
||||
|
||||
const BIO_METHOD *BIO_s_file(void)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -85,15 +85,16 @@ static void xsyslog(BIO *bp, int priority, const char *string);
|
||||
static void xcloselog(BIO *bp);
|
||||
|
||||
static const BIO_METHOD methods_slg = {
|
||||
BIO_TYPE_MEM, "syslog",
|
||||
BIO_TYPE_MEM,
|
||||
"syslog",
|
||||
slg_write,
|
||||
NULL,
|
||||
NULL, /* slg_read, */
|
||||
slg_puts,
|
||||
NULL,
|
||||
NULL, /* slg_gets, */
|
||||
slg_ctrl,
|
||||
slg_new,
|
||||
slg_free,
|
||||
NULL,
|
||||
NULL, /* slg_callback_ctrl */
|
||||
};
|
||||
|
||||
const BIO_METHOD *BIO_s_log(void)
|
||||
|
||||
@@ -33,7 +33,7 @@ static const BIO_METHOD mem_method = {
|
||||
mem_ctrl,
|
||||
mem_new,
|
||||
mem_free,
|
||||
NULL,
|
||||
NULL, /* mem_callback_ctrl */
|
||||
};
|
||||
|
||||
static const BIO_METHOD secmem_method = {
|
||||
@@ -46,7 +46,7 @@ static const BIO_METHOD secmem_method = {
|
||||
mem_ctrl,
|
||||
secmem_new,
|
||||
mem_free,
|
||||
NULL,
|
||||
NULL, /* mem_callback_ctrl */
|
||||
};
|
||||
|
||||
/* BIO memory stores buffer and read pointer */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -17,8 +17,6 @@ static int null_read(BIO *h, char *buf, int size);
|
||||
static int null_puts(BIO *h, const char *str);
|
||||
static int null_gets(BIO *h, char *str, int size);
|
||||
static long null_ctrl(BIO *h, int cmd, long arg1, void *arg2);
|
||||
static int null_new(BIO *h);
|
||||
static int null_free(BIO *data);
|
||||
static const BIO_METHOD null_method = {
|
||||
BIO_TYPE_NULL,
|
||||
"NULL",
|
||||
@@ -27,9 +25,9 @@ static const BIO_METHOD null_method = {
|
||||
null_puts,
|
||||
null_gets,
|
||||
null_ctrl,
|
||||
null_new,
|
||||
null_free,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL, /* null_callback_ctrl */
|
||||
};
|
||||
|
||||
const BIO_METHOD *BIO_s_null(void)
|
||||
@@ -37,21 +35,6 @@ const BIO_METHOD *BIO_s_null(void)
|
||||
return (&null_method);
|
||||
}
|
||||
|
||||
static int null_new(BIO *bi)
|
||||
{
|
||||
bi->init = 1;
|
||||
bi->num = 0;
|
||||
bi->ptr = (NULL);
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int null_free(BIO *a)
|
||||
{
|
||||
if (a == NULL)
|
||||
return (0);
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int null_read(BIO *b, char *out, int outl)
|
||||
{
|
||||
return (0);
|
||||
|
||||
@@ -41,11 +41,11 @@ static const BIO_METHOD methods_sockp = {
|
||||
sock_write,
|
||||
sock_read,
|
||||
sock_puts,
|
||||
NULL, /* sock_gets, */
|
||||
NULL, /* sock_gets, */
|
||||
sock_ctrl,
|
||||
sock_new,
|
||||
sock_free,
|
||||
NULL,
|
||||
NULL, /* sock_callback_ctrl */
|
||||
};
|
||||
|
||||
const BIO_METHOD *BIO_s_socket(void)
|
||||
|
||||
Reference in New Issue
Block a user