Update - OpenSSL 1.1.1-pre7-dev
This commit is contained in:
+8
-6
@@ -66,18 +66,18 @@ void BIO_ADDR_clear(BIO_ADDR *ap)
|
||||
int BIO_ADDR_make(BIO_ADDR *ap, const struct sockaddr *sa)
|
||||
{
|
||||
if (sa->sa_family == AF_INET) {
|
||||
ap->s_in = *(const struct sockaddr_in *)sa;
|
||||
memcpy(&(ap->s_in), sa, sizeof(struct sockaddr_in));
|
||||
return 1;
|
||||
}
|
||||
#ifdef AF_INET6
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
ap->s_in6 = *(const struct sockaddr_in6 *)sa;
|
||||
memcpy(&(ap->s_in6), sa, sizeof(struct sockaddr_in6));
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef AF_UNIX
|
||||
if (sa->sa_family == AF_UNIX) {
|
||||
ap->s_un = *(const struct sockaddr_un *)sa;
|
||||
memcpy(&(ap->s_un), sa, sizeof(struct sockaddr_un));
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@@ -565,9 +565,10 @@ static int addrinfo_wrap(int family, int socktype,
|
||||
unsigned short port,
|
||||
BIO_ADDRINFO **bai)
|
||||
{
|
||||
*bai = OPENSSL_zalloc(sizeof(**bai));
|
||||
if (*bai == NULL)
|
||||
if ((*bai = OPENSSL_zalloc(sizeof(**bai))) == NULL) {
|
||||
BIOerr(BIO_F_ADDRINFO_WRAP, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
(*bai)->bai_family = family;
|
||||
(*bai)->bai_socktype = socktype;
|
||||
@@ -602,7 +603,8 @@ static int addrinfo_wrap(int family, int socktype,
|
||||
|
||||
DEFINE_RUN_ONCE_STATIC(do_bio_lookup_init)
|
||||
{
|
||||
OPENSSL_init_crypto(0, NULL);
|
||||
if (!OPENSSL_init_crypto(0, NULL))
|
||||
return 0;
|
||||
bio_lookup_lock = CRYPTO_THREAD_lock_new();
|
||||
return bio_lookup_lock != NULL;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2017 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
|
||||
@@ -819,9 +819,10 @@ doapr_outch(char **sbuffer,
|
||||
|
||||
*maxlen += BUFFER_INC;
|
||||
if (*buffer == NULL) {
|
||||
*buffer = OPENSSL_malloc(*maxlen);
|
||||
if (*buffer == NULL)
|
||||
if ((*buffer = OPENSSL_malloc(*maxlen)) == NULL) {
|
||||
BIOerr(BIO_F_DOAPR_OUTCH, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
if (*currlen > 0) {
|
||||
if (!ossl_assert(*sbuffer != NULL))
|
||||
return 0;
|
||||
|
||||
+2
-2
@@ -308,7 +308,7 @@ int BIO_socket_nbio(int s, int mode)
|
||||
|
||||
l = fcntl(s, F_GETFL, 0);
|
||||
if (l == -1) {
|
||||
SYSerr(SYS_F_FCNTL, get_last_rtl_error());
|
||||
SYSerr(SYS_F_FCNTL, get_last_sys_error());
|
||||
ret = -1;
|
||||
} else {
|
||||
# if defined(O_NONBLOCK)
|
||||
@@ -326,7 +326,7 @@ int BIO_socket_nbio(int s, int mode)
|
||||
ret = fcntl(s, F_SETFL, l);
|
||||
|
||||
if (ret < 0) {
|
||||
SYSerr(SYS_F_FCNTL, get_last_rtl_error());
|
||||
SYSerr(SYS_F_FCNTL, get_last_sys_error());
|
||||
}
|
||||
}
|
||||
# else
|
||||
|
||||
@@ -59,11 +59,13 @@ static int linebuffer_new(BIO *bi)
|
||||
{
|
||||
BIO_LINEBUFFER_CTX *ctx;
|
||||
|
||||
ctx = OPENSSL_malloc(sizeof(*ctx));
|
||||
if (ctx == NULL)
|
||||
if ((ctx = OPENSSL_malloc(sizeof(*ctx))) == NULL) {
|
||||
BIOerr(BIO_F_LINEBUFFER_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
ctx->obuf = OPENSSL_malloc(DEFAULT_LINEBUFFER_SIZE);
|
||||
if (ctx->obuf == NULL) {
|
||||
BIOerr(BIO_F_LINEBUFFER_NEW, ERR_R_MALLOC_FAILURE);
|
||||
OPENSSL_free(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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,8 +57,10 @@ static int nbiof_new(BIO *bi)
|
||||
{
|
||||
NBIO_TEST *nt;
|
||||
|
||||
if ((nt = OPENSSL_zalloc(sizeof(*nt))) == NULL)
|
||||
if ((nt = OPENSSL_zalloc(sizeof(*nt))) == NULL) {
|
||||
BIOerr(BIO_F_NBIOF_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
nt->lrn = -1;
|
||||
nt->lwn = -1;
|
||||
bi->ptr = (char *)nt;
|
||||
@@ -89,7 +91,7 @@ static int nbiof_read(BIO *b, char *out, int outl)
|
||||
return 0;
|
||||
|
||||
BIO_clear_retry_flags(b);
|
||||
if (RAND_bytes(&n, 1) <= 0)
|
||||
if (RAND_priv_bytes(&n, 1) <= 0)
|
||||
return -1;
|
||||
num = (n & 0x07);
|
||||
|
||||
@@ -126,7 +128,7 @@ static int nbiof_write(BIO *b, const char *in, int inl)
|
||||
num = nt->lwn;
|
||||
nt->lwn = 0;
|
||||
} else {
|
||||
if (RAND_bytes(&n, 1) <= 0)
|
||||
if (RAND_priv_bytes(&n, 1) <= 0)
|
||||
return -1;
|
||||
num = (n & 7);
|
||||
}
|
||||
|
||||
@@ -15,13 +15,16 @@
|
||||
|
||||
static const ERR_STRING_DATA BIO_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_ACPT_STATE, 0), "acpt_state"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_ADDRINFO_WRAP, 0), "addrinfo_wrap"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_ADDR_STRINGS, 0), "addr_strings"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT, 0), "BIO_accept"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT_EX, 0), "BIO_accept_ex"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT_NEW, 0), "BIO_ACCEPT_new"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ADDR_NEW, 0), "BIO_ADDR_new"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_BIND, 0), "BIO_bind"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CALLBACK_CTRL, 0), "BIO_callback_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CONNECT, 0), "BIO_connect"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CONNECT_NEW, 0), "BIO_CONNECT_new"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CTRL, 0), "BIO_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_GETS, 0), "BIO_gets"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_GET_HOST_IP, 0), "BIO_get_host_ip"},
|
||||
@@ -55,12 +58,17 @@ static const ERR_STRING_DATA BIO_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_BUFFER_CTRL, 0), "buffer_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_CONN_CTRL, 0), "conn_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_CONN_STATE, 0), "conn_state"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_DGRAM_SCTP_NEW, 0), "dgram_sctp_new"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_DGRAM_SCTP_READ, 0), "dgram_sctp_read"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_DGRAM_SCTP_WRITE, 0), "dgram_sctp_write"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_DOAPR_OUTCH, 0), "doapr_outch"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_FILE_CTRL, 0), "file_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_FILE_READ, 0), "file_read"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_LINEBUFFER_CTRL, 0), "linebuffer_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_LINEBUFFER_NEW, 0), "linebuffer_new"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_MEM_WRITE, 0), "mem_write"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_NBIOF_NEW, 0), "nbiof_new"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_SLG_WRITE, 0), "slg_write"},
|
||||
{ERR_PACK(ERR_LIB_BIO, BIO_F_SSL_NEW, 0), "SSL_new"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
+11
-11
@@ -34,9 +34,8 @@ static long bio_call_callback(BIO *b, int oper, const char *argp, size_t len,
|
||||
long ret;
|
||||
int bareoper;
|
||||
|
||||
if (b->callback_ex != NULL) {
|
||||
if (b->callback_ex != NULL)
|
||||
return b->callback_ex(b, oper, argp, len, argi, argl, inret, processed);
|
||||
}
|
||||
|
||||
/* Strip off any BIO_CB_RETURN flag */
|
||||
bareoper = oper & ~BIO_CB_RETURN;
|
||||
@@ -51,17 +50,17 @@ static long bio_call_callback(BIO *b, int oper, const char *argp, size_t len,
|
||||
return -1;
|
||||
|
||||
argi = (int)len;
|
||||
}
|
||||
|
||||
if (inret && (oper & BIO_CB_RETURN)) {
|
||||
if (*processed > INT_MAX)
|
||||
return -1;
|
||||
inret = *processed;
|
||||
}
|
||||
if (inret && (oper & BIO_CB_RETURN) && bareoper != BIO_CB_CTRL) {
|
||||
if (*processed > INT_MAX)
|
||||
return -1;
|
||||
inret = *processed;
|
||||
}
|
||||
|
||||
ret = b->callback(b, oper, argp, argi, argl, inret);
|
||||
|
||||
if (ret >= 0 && (HAS_LEN_OPER(bareoper) || bareoper == BIO_CB_PUTS)) {
|
||||
if (ret >= 0 && (oper & BIO_CB_RETURN) && bareoper != BIO_CB_CTRL) {
|
||||
*processed = (size_t)ret;
|
||||
ret = 1;
|
||||
}
|
||||
@@ -260,7 +259,7 @@ static int bio_read_intern(BIO *b, void *data, size_t dlen, size_t *readbytes)
|
||||
|
||||
if ((b->callback != NULL || b->callback_ex != NULL) &&
|
||||
((ret = (int)bio_call_callback(b, BIO_CB_READ, data, dlen, 0, 0L, 1L,
|
||||
readbytes)) <= 0))
|
||||
NULL)) <= 0))
|
||||
return ret;
|
||||
|
||||
if (!b->init) {
|
||||
@@ -333,7 +332,7 @@ static int bio_write_intern(BIO *b, const void *data, size_t dlen,
|
||||
|
||||
if ((b->callback != NULL || b->callback_ex != NULL) &&
|
||||
((ret = (int)bio_call_callback(b, BIO_CB_WRITE, data, dlen, 0, 0L, 1L,
|
||||
written)) <= 0))
|
||||
NULL)) <= 0))
|
||||
return ret;
|
||||
|
||||
if (!b->init) {
|
||||
@@ -542,7 +541,8 @@ long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
|
||||
if (b == NULL)
|
||||
return 0;
|
||||
|
||||
if ((b->method == NULL) || (b->method->callback_ctrl == NULL)) {
|
||||
if ((b->method == NULL) || (b->method->callback_ctrl == NULL)
|
||||
|| (cmd != BIO_CTRL_SET_CALLBACK)) {
|
||||
BIOerr(BIO_F_BIO_CALLBACK_CTRL, BIO_R_UNSUPPORTED_METHOD);
|
||||
return -2;
|
||||
}
|
||||
|
||||
+11
-11
@@ -19,7 +19,7 @@ DEFINE_RUN_ONCE_STATIC(do_bio_type_init)
|
||||
return bio_type_lock != NULL;
|
||||
}
|
||||
|
||||
int BIO_get_new_index()
|
||||
int BIO_get_new_index(void)
|
||||
{
|
||||
static CRYPTO_REF_COUNT bio_count = BIO_TYPE_START;
|
||||
int newval;
|
||||
@@ -55,12 +55,12 @@ void BIO_meth_free(BIO_METHOD *biom)
|
||||
}
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_write(BIO_METHOD *biom)) (BIO *, const char *, int)
|
||||
int (*BIO_meth_get_write(const BIO_METHOD *biom)) (BIO *, const char *, int)
|
||||
{
|
||||
return biom->bwrite_old;
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_write_ex(BIO_METHOD *biom)) (BIO *, const char *, size_t,
|
||||
int (*BIO_meth_get_write_ex(const BIO_METHOD *biom)) (BIO *, const char *, size_t,
|
||||
size_t *)
|
||||
{
|
||||
return biom->bwrite;
|
||||
@@ -102,12 +102,12 @@ int BIO_meth_set_write_ex(BIO_METHOD *biom,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_read(BIO_METHOD *biom)) (BIO *, char *, int)
|
||||
int (*BIO_meth_get_read(const BIO_METHOD *biom)) (BIO *, char *, int)
|
||||
{
|
||||
return biom->bread_old;
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_read_ex(BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *)
|
||||
int (*BIO_meth_get_read_ex(const BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *)
|
||||
{
|
||||
return biom->bread;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ int BIO_meth_set_read_ex(BIO_METHOD *biom,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_puts(BIO_METHOD *biom)) (BIO *, const char *)
|
||||
int (*BIO_meth_get_puts(const BIO_METHOD *biom)) (BIO *, const char *)
|
||||
{
|
||||
return biom->bputs;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ int BIO_meth_set_puts(BIO_METHOD *biom,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_gets(BIO_METHOD *biom)) (BIO *, char *, int)
|
||||
int (*BIO_meth_get_gets(const BIO_METHOD *biom)) (BIO *, char *, int)
|
||||
{
|
||||
return biom->bgets;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ int BIO_meth_set_gets(BIO_METHOD *biom,
|
||||
return 1;
|
||||
}
|
||||
|
||||
long (*BIO_meth_get_ctrl(BIO_METHOD *biom)) (BIO *, int, long, void *)
|
||||
long (*BIO_meth_get_ctrl(const BIO_METHOD *biom)) (BIO *, int, long, void *)
|
||||
{
|
||||
return biom->ctrl;
|
||||
}
|
||||
@@ -184,7 +184,7 @@ int BIO_meth_set_ctrl(BIO_METHOD *biom,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_create(BIO_METHOD *biom)) (BIO *)
|
||||
int (*BIO_meth_get_create(const BIO_METHOD *biom)) (BIO *)
|
||||
{
|
||||
return biom->create;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *))
|
||||
return 1;
|
||||
}
|
||||
|
||||
int (*BIO_meth_get_destroy(BIO_METHOD *biom)) (BIO *)
|
||||
int (*BIO_meth_get_destroy(const BIO_METHOD *biom)) (BIO *)
|
||||
{
|
||||
return biom->destroy;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ 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(const BIO_METHOD *biom)) (BIO *, int, BIO_info_cb *)
|
||||
{
|
||||
return biom->callback_ctrl;
|
||||
}
|
||||
|
||||
@@ -92,8 +92,10 @@ static BIO_ACCEPT *BIO_ACCEPT_new(void)
|
||||
{
|
||||
BIO_ACCEPT *ret;
|
||||
|
||||
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
|
||||
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
|
||||
BIOerr(BIO_F_BIO_ACCEPT_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
ret->accept_family = BIO_FAMILY_IPANY;
|
||||
ret->accept_sock = (int)INVALID_SOCKET;
|
||||
return ret;
|
||||
@@ -103,7 +105,6 @@ static void BIO_ACCEPT_free(BIO_ACCEPT *a)
|
||||
{
|
||||
if (a == NULL)
|
||||
return;
|
||||
|
||||
OPENSSL_free(a->param_addr);
|
||||
OPENSSL_free(a->param_serv);
|
||||
BIO_ADDRINFO_free(a->addr_first);
|
||||
|
||||
@@ -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
|
||||
@@ -223,8 +223,10 @@ BIO_CONNECT *BIO_CONNECT_new(void)
|
||||
{
|
||||
BIO_CONNECT *ret;
|
||||
|
||||
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
|
||||
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
|
||||
BIOerr(BIO_F_BIO_CONNECT_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return NULL;
|
||||
}
|
||||
ret->state = BIO_CONN_S_BEFORE;
|
||||
ret->connect_family = BIO_FAMILY_IPANY;
|
||||
return ret;
|
||||
@@ -234,7 +236,6 @@ void BIO_CONNECT_free(BIO_CONNECT *a)
|
||||
{
|
||||
if (a == NULL)
|
||||
return;
|
||||
|
||||
OPENSSL_free(a->param_hostname);
|
||||
OPENSSL_free(a->param_service);
|
||||
BIO_ADDRINFO_free(a->addr_first);
|
||||
|
||||
@@ -955,9 +955,10 @@ static int dgram_sctp_new(BIO *bi)
|
||||
|
||||
bi->init = 0;
|
||||
bi->num = 0;
|
||||
data = OPENSSL_zalloc(sizeof(*data));
|
||||
if (data == NULL)
|
||||
if ((data = OPENSSL_zalloc(sizeof(*data))) == NULL) {
|
||||
BIOerr(BIO_F_DGRAM_SCTP_NEW, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
# ifdef SCTP_PR_SCTP_NONE
|
||||
data->prinfo.pr_policy = SCTP_PR_SCTP_NONE;
|
||||
# endif
|
||||
|
||||
@@ -39,6 +39,8 @@ void *_malloc32(__size_t);
|
||||
# endif /* __INITIAL_POINTER_SIZE == 64 */
|
||||
# endif /* __INITIAL_POINTER_SIZE && defined
|
||||
* _ANSI_C_SOURCE */
|
||||
#elif defined(__DJGPP__) && defined(OPENSSL_NO_SOCK)
|
||||
# define NO_SYSLOG
|
||||
#elif (!defined(MSDOS) || defined(WATT32)) && !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG)
|
||||
# include <syslog.h>
|
||||
#endif
|
||||
@@ -195,6 +197,7 @@ static int slg_write(BIO *b, const char *in, int inl)
|
||||
};
|
||||
|
||||
if ((buf = OPENSSL_malloc(inl + 1)) == NULL) {
|
||||
BIOerr(BIO_F_SLG_WRITE, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
strncpy(buf, in, inl);
|
||||
|
||||
@@ -216,6 +216,8 @@ static int mem_write(BIO *b, const char *in, int inl)
|
||||
goto end;
|
||||
}
|
||||
BIO_clear_retry_flags(b);
|
||||
if (inl == 0)
|
||||
return 0;
|
||||
blen = bbm->readp->length;
|
||||
mem_buf_sync(b);
|
||||
if (BUF_MEM_grow_clean(bbm->buf, blen + inl) == 0)
|
||||
|
||||
Reference in New Issue
Block a user