Import OpenSSL 1.1.0h
This commit is contained in:
@@ -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
|
||||
@@ -1370,11 +1370,13 @@ int s_client_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef AF_UNIX
|
||||
if (socket_family == AF_UNIX && socket_type != SOCK_STREAM) {
|
||||
BIO_printf(bio_err,
|
||||
"Can't use unix sockets and datagrams together\n");
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (split_send_fragment > SSL3_RT_MAX_PLAIN_LENGTH) {
|
||||
BIO_printf(bio_err, "Bad split send fragment size\n");
|
||||
@@ -1484,6 +1486,9 @@ int s_client_main(int argc, char **argv)
|
||||
if (sdebug)
|
||||
ssl_ctx_security_debug(ctx, sdebug);
|
||||
|
||||
if (!config_ctx(cctx, ssl_args, ctx))
|
||||
goto end;
|
||||
|
||||
if (ssl_config) {
|
||||
if (SSL_CTX_config(ctx, ssl_config) == 0) {
|
||||
BIO_printf(bio_err, "Error using configuration \"%s\"\n",
|
||||
@@ -1493,9 +1498,11 @@ int s_client_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (SSL_CTX_set_min_proto_version(ctx, min_version) == 0)
|
||||
if (min_version != 0
|
||||
&& SSL_CTX_set_min_proto_version(ctx, min_version) == 0)
|
||||
goto end;
|
||||
if (SSL_CTX_set_max_proto_version(ctx, max_version) == 0)
|
||||
if (max_version != 0
|
||||
&& SSL_CTX_set_max_proto_version(ctx, max_version) == 0)
|
||||
goto end;
|
||||
|
||||
if (vpmtouched && !SSL_CTX_set1_param(ctx, vpm)) {
|
||||
@@ -1518,9 +1525,6 @@ int s_client_main(int argc, char **argv)
|
||||
SSL_CTX_set_default_read_buffer_len(ctx, read_buf_len);
|
||||
}
|
||||
|
||||
if (!config_ctx(cctx, ssl_args, ctx))
|
||||
goto end;
|
||||
|
||||
if (!ssl_load_stores(ctx, vfyCApath, vfyCAfile, chCApath, chCAfile,
|
||||
crls, crl_download)) {
|
||||
BIO_printf(bio_err, "Error loading store locations\n");
|
||||
@@ -2459,7 +2463,7 @@ int s_client_main(int argc, char **argv)
|
||||
if (in_init)
|
||||
print_stuff(bio_c_out, con, full_log);
|
||||
do_ssl_shutdown(con);
|
||||
#if defined(OPENSSL_SYS_WINDOWS)
|
||||
|
||||
/*
|
||||
* Give the socket time to send its last data before we close it.
|
||||
* No amount of setting SO_LINGER etc on the socket seems to persuade
|
||||
@@ -2467,8 +2471,23 @@ int s_client_main(int argc, char **argv)
|
||||
* for a short time seems to do it (units in ms)
|
||||
* TODO: Find a better way to do this
|
||||
*/
|
||||
#if defined(OPENSSL_SYS_WINDOWS)
|
||||
Sleep(50);
|
||||
#elif defined(OPENSSL_SYS_CYGWIN)
|
||||
usleep(50000);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If we ended with an alert being sent, but still with data in the
|
||||
* network buffer to be read, then calling BIO_closesocket() will
|
||||
* result in a TCP-RST being sent. On some platforms (notably
|
||||
* Windows) then this will result in the peer immediately abandoning
|
||||
* the connection including any buffered alert data before it has
|
||||
* had a chance to be read. Shutting down the sending side first,
|
||||
* and then closing the socket sends TCP-FIN first followed by
|
||||
* TCP-RST. This seems to allow the peer to read the alert data.
|
||||
*/
|
||||
shutdown(SSL_get_fd(con), 1); /* SHUT_WR */
|
||||
BIO_closesocket(SSL_get_fd(con));
|
||||
end:
|
||||
if (con != NULL) {
|
||||
@@ -2534,10 +2553,10 @@ static void print_stuff(BIO *bio, SSL *s, int full)
|
||||
BIO_printf(bio, "---\nCertificate chain\n");
|
||||
for (i = 0; i < sk_X509_num(sk); i++) {
|
||||
X509_NAME_oneline(X509_get_subject_name(sk_X509_value(sk, i)),
|
||||
buf, sizeof buf);
|
||||
buf, sizeof(buf));
|
||||
BIO_printf(bio, "%2d s:%s\n", i, buf);
|
||||
X509_NAME_oneline(X509_get_issuer_name(sk_X509_value(sk, i)),
|
||||
buf, sizeof buf);
|
||||
buf, sizeof(buf));
|
||||
BIO_printf(bio, " i:%s\n", buf);
|
||||
if (c_showcerts)
|
||||
PEM_write_bio_X509(bio, sk_X509_value(sk, i));
|
||||
@@ -2552,9 +2571,9 @@ static void print_stuff(BIO *bio, SSL *s, int full)
|
||||
/* Redundant if we showed the whole chain */
|
||||
if (!(c_showcerts && got_a_chain))
|
||||
PEM_write_bio_X509(bio, peer);
|
||||
X509_NAME_oneline(X509_get_subject_name(peer), buf, sizeof buf);
|
||||
X509_NAME_oneline(X509_get_subject_name(peer), buf, sizeof(buf));
|
||||
BIO_printf(bio, "subject=%s\n", buf);
|
||||
X509_NAME_oneline(X509_get_issuer_name(peer), buf, sizeof buf);
|
||||
X509_NAME_oneline(X509_get_issuer_name(peer), buf, sizeof(buf));
|
||||
BIO_printf(bio, "issuer=%s\n", buf);
|
||||
} else
|
||||
BIO_printf(bio, "no peer certificate available\n");
|
||||
|
||||
Reference in New Issue
Block a user