Import OpenSSL 1.1.1f
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
@@ -22,7 +22,7 @@ CRYPTO_RWLOCK *bio_lookup_lock;
|
||||
static CRYPTO_ONCE bio_lookup_init = CRYPTO_ONCE_STATIC_INIT;
|
||||
|
||||
/*
|
||||
* Throughout this file and bio_lcl.h, the existence of the macro
|
||||
* Throughout this file and bio_local.h, the existence of the macro
|
||||
* AI_PASSIVE is used to detect the availability of struct addrinfo,
|
||||
* getnameinfo() and getaddrinfo(). If that macro doesn't exist,
|
||||
* we use our own implementation instead, using gethostbyname,
|
||||
@@ -694,9 +694,11 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
|
||||
hints.ai_flags |= AI_PASSIVE;
|
||||
|
||||
/* Note that |res| SHOULD be a 'struct addrinfo **' thanks to
|
||||
* macro magic in bio_lcl.h
|
||||
* macro magic in bio_local.h
|
||||
*/
|
||||
# if defined(AI_ADDRCONFIG) && defined(AI_NUMERICHOST)
|
||||
retry:
|
||||
# endif
|
||||
switch ((gai_ret = getaddrinfo(host, service, &hints, res))) {
|
||||
# ifdef EAI_SYSTEM
|
||||
case EAI_SYSTEM:
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
|
||||
#define DUMP_WIDTH 16
|
||||
#define DUMP_WIDTH_LESS_INDENT(i) (DUMP_WIDTH - ((i - (i > 6 ? 6 : i) + 3) / 4))
|
||||
@@ -36,8 +36,8 @@ int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u),
|
||||
|
||||
if (indent < 0)
|
||||
indent = 0;
|
||||
else if (indent > 128)
|
||||
indent = 128;
|
||||
else if (indent > 64)
|
||||
indent = 64;
|
||||
|
||||
dump_width = DUMP_WIDTH_LESS_INDENT(indent);
|
||||
rows = len / dump_width;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include "internal/numbers.h"
|
||||
#include <openssl/bio.h>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
# define SOCKET_PROTOCOL IPPROTO_TCP
|
||||
# ifdef SO_MAXCONN
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
|
||||
#include <openssl/err.h>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#include "internal/cryptlib.h"
|
||||
|
||||
static int buffer_write(BIO *h, const char *buf, int num);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/rand.h>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#include "internal/cryptlib.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/err.h>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#include "internal/cryptlib.h"
|
||||
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
* For clarity, we check for internal/cryptlib.h since it's a common header
|
||||
* that also includes bio.h.
|
||||
*/
|
||||
# ifdef HEADER_CRYPTLIB_H
|
||||
# error internal/cryptlib.h included before bio_lcl.h
|
||||
# ifdef OSSL_INTERNAL_CRYPTLIB_H
|
||||
# error internal/cryptlib.h included before bio_local.h
|
||||
# endif
|
||||
# ifdef HEADER_BIO_H
|
||||
# error openssl/bio.h included before bio_lcl.h
|
||||
# error openssl/bio.h included before bio_local.h
|
||||
# endif
|
||||
|
||||
/*
|
||||
@@ -7,7 +7,7 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#include "internal/thread_once.h"
|
||||
|
||||
CRYPTO_RWLOCK *bio_type_lock = NULL;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
|
||||
@@ -527,7 +527,12 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
break;
|
||||
case BIO_CTRL_DUP:
|
||||
break;
|
||||
|
||||
case BIO_CTRL_EOF:
|
||||
if (b->next_bio == NULL)
|
||||
ret = 0;
|
||||
else
|
||||
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
|
||||
break;
|
||||
default:
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
|
||||
@@ -54,6 +54,7 @@ void BIO_CONNECT_free(BIO_CONNECT *a);
|
||||
#define BIO_CONN_S_CONNECT 4
|
||||
#define BIO_CONN_S_OK 5
|
||||
#define BIO_CONN_S_BLOCKED_CONNECT 6
|
||||
#define BIO_CONN_S_CONNECT_ERROR 7
|
||||
|
||||
static const BIO_METHOD methods_connectp = {
|
||||
BIO_TYPE_CONNECT,
|
||||
@@ -174,7 +175,8 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
|
||||
ERR_add_error_data(4,
|
||||
"hostname=", c->param_hostname,
|
||||
" service=", c->param_service);
|
||||
BIOerr(BIO_F_CONN_STATE, BIO_R_CONNECT_ERROR);
|
||||
c->state = BIO_CONN_S_CONNECT_ERROR;
|
||||
break;
|
||||
}
|
||||
goto exit_loop;
|
||||
} else {
|
||||
@@ -197,6 +199,11 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
|
||||
c->state = BIO_CONN_S_OK;
|
||||
break;
|
||||
|
||||
case BIO_CONN_S_CONNECT_ERROR:
|
||||
BIOerr(BIO_F_CONN_STATE, BIO_R_CONNECT_ERROR);
|
||||
ret = 0;
|
||||
goto exit_loop;
|
||||
|
||||
case BIO_CONN_S_OK:
|
||||
ret = 1;
|
||||
goto exit_loop;
|
||||
@@ -309,6 +316,8 @@ static int conn_read(BIO *b, char *out, int outl)
|
||||
if (ret <= 0) {
|
||||
if (BIO_sock_should_retry(ret))
|
||||
BIO_set_retry_read(b);
|
||||
else if (ret == 0)
|
||||
b->flags |= BIO_FLAGS_IN_EOF;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -488,6 +497,9 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
*fptr = data->info_callback;
|
||||
}
|
||||
break;
|
||||
case BIO_CTRL_EOF:
|
||||
ret = (b->flags & BIO_FLAGS_IN_EOF) != 0 ? 1 : 0;
|
||||
break;
|
||||
default:
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#ifndef OPENSSL_NO_DGRAM
|
||||
|
||||
# ifndef OPENSSL_NO_SCTP
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
|
||||
#if defined(OPENSSL_NO_POSIX_IO)
|
||||
/*
|
||||
@@ -123,6 +123,8 @@ static int fd_read(BIO *b, char *out, int outl)
|
||||
if (ret <= 0) {
|
||||
if (BIO_fd_should_retry(ret))
|
||||
BIO_set_retry_read(b);
|
||||
else if (ret == 0)
|
||||
b->flags |= BIO_FLAGS_IN_EOF;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -186,6 +188,9 @@ static long fd_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
case BIO_CTRL_FLUSH:
|
||||
ret = 1;
|
||||
break;
|
||||
case BIO_CTRL_EOF:
|
||||
ret = (b->flags & BIO_FLAGS_IN_EOF) != 0 ? 1 : 0;
|
||||
break;
|
||||
default:
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#include <openssl/err.h>
|
||||
|
||||
#if !defined(OPENSSL_NO_STDIO)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#include "internal/cryptlib.h"
|
||||
|
||||
#if defined(OPENSSL_SYS_WINCE)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#include "internal/cryptlib.h"
|
||||
|
||||
static int mem_write(BIO *h, const char *buf, int num);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#include "internal/cryptlib.h"
|
||||
|
||||
static int null_write(BIO *h, const char *buf, int num);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 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
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "bio_lcl.h"
|
||||
#include "bio_local.h"
|
||||
#include "internal/cryptlib.h"
|
||||
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
@@ -101,6 +101,8 @@ static int sock_read(BIO *b, char *out, int outl)
|
||||
if (ret <= 0) {
|
||||
if (BIO_sock_should_retry(ret))
|
||||
BIO_set_retry_read(b);
|
||||
else if (ret == 0)
|
||||
b->flags |= BIO_FLAGS_IN_EOF;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -151,6 +153,9 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
case BIO_CTRL_FLUSH:
|
||||
ret = 1;
|
||||
break;
|
||||
case BIO_CTRL_EOF:
|
||||
ret = (b->flags & BIO_FLAGS_IN_EOF) != 0 ? 1 : 0;
|
||||
break;
|
||||
default:
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user