"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "apps/s_server.c" between
openssl-1.1.1o.tar.gz and openssl-1.1.1p.tar.gz

About: OpenSSL is a toolkit implementing the Transport Layer Security (TLS) protocols (including SSLv3) as well as a full-strength general purpose cryptographic library. Long Term Support (LTS) version (includes support for TLSv1.3).

s_server.c  (openssl-1.1.1o):s_server.c  (openssl-1.1.1p)
/* /*
* Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
* Copyright 2005 Nokia. All rights reserved. * Copyright 2005 Nokia. All rights reserved.
* *
* Licensed under the OpenSSL license (the "License"). You may not use * Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy * this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at * in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html * https://www.openssl.org/source/license.html
*/ */
#include <ctype.h> #include <ctype.h>
skipping to change at line 2239 skipping to change at line 2239
SSL_CTX_sess_misses(ssl_ctx)); SSL_CTX_sess_misses(ssl_ctx));
BIO_printf(bio, "%4ld session cache timeouts\n", BIO_printf(bio, "%4ld session cache timeouts\n",
SSL_CTX_sess_timeouts(ssl_ctx)); SSL_CTX_sess_timeouts(ssl_ctx));
BIO_printf(bio, "%4ld callback cache hits\n", BIO_printf(bio, "%4ld callback cache hits\n",
SSL_CTX_sess_cb_hits(ssl_ctx)); SSL_CTX_sess_cb_hits(ssl_ctx));
BIO_printf(bio, "%4ld cache full overflows (%ld allowed)\n", BIO_printf(bio, "%4ld cache full overflows (%ld allowed)\n",
SSL_CTX_sess_cache_full(ssl_ctx), SSL_CTX_sess_cache_full(ssl_ctx),
SSL_CTX_sess_get_cache_size(ssl_ctx)); SSL_CTX_sess_get_cache_size(ssl_ctx));
} }
static long int count_reads_callback(BIO *bio, int cmd, const char *argp,
int argi, long int argl, long int ret)
{
unsigned int *p_counter = (unsigned int *)BIO_get_callback_arg(bio);
switch (cmd) {
case BIO_CB_READ: /* No break here */
case BIO_CB_GETS:
if (p_counter != NULL)
++*p_counter;
break;
default:
break;
}
if (s_debug) {
BIO_set_callback_arg(bio, (char *)bio_s_out);
ret = bio_dump_callback(bio, cmd, argp, argi, argl, ret);
BIO_set_callback_arg(bio, (char *)p_counter);
}
return ret;
}
static int sv_body(int s, int stype, int prot, unsigned char *context) static int sv_body(int s, int stype, int prot, unsigned char *context)
{ {
char *buf = NULL; char *buf = NULL;
fd_set readfds; fd_set readfds;
int ret = 1, width; int ret = 1, width;
int k, i; int k, i;
unsigned long l; unsigned long l;
SSL *con = NULL; SSL *con = NULL;
BIO *sbio; BIO *sbio;
struct timeval timeout; struct timeval timeout;
skipping to change at line 2356 skipping to change at line 2380
BIO *test; BIO *test;
test = BIO_new(BIO_f_nbio_test()); test = BIO_new(BIO_f_nbio_test());
sbio = BIO_push(test, sbio); sbio = BIO_push(test, sbio);
} }
SSL_set_bio(con, sbio, sbio); SSL_set_bio(con, sbio, sbio);
SSL_set_accept_state(con); SSL_set_accept_state(con);
/* SSL_set_fd(con,s); */ /* SSL_set_fd(con,s); */
if (s_debug) { BIO_set_callback(SSL_get_rbio(con), count_reads_callback);
BIO_set_callback(SSL_get_rbio(con), bio_dump_callback);
BIO_set_callback_arg(SSL_get_rbio(con), (char *)bio_s_out);
}
if (s_msg) { if (s_msg) {
#ifndef OPENSSL_NO_SSL_TRACE #ifndef OPENSSL_NO_SSL_TRACE
if (s_msg == 2) if (s_msg == 2)
SSL_set_msg_callback(con, SSL_trace); SSL_set_msg_callback(con, SSL_trace);
else else
#endif #endif
SSL_set_msg_callback(con, msg_cb); SSL_set_msg_callback(con, msg_cb);
SSL_set_msg_callback_arg(con, bio_s_msg ? bio_s_msg : bio_s_out); SSL_set_msg_callback_arg(con, bio_s_msg ? bio_s_msg : bio_s_out);
} }
skipping to change at line 2651 skipping to change at line 2672
} }
} }
if (read_from_sslcon) { if (read_from_sslcon) {
/* /*
* init_ssl_connection handles all async events itself so if we're * init_ssl_connection handles all async events itself so if we're
* waiting for async then we shouldn't go back into * waiting for async then we shouldn't go back into
* init_ssl_connection * init_ssl_connection
*/ */
if ((!async || !SSL_waiting_for_async(con)) if ((!async || !SSL_waiting_for_async(con))
&& !SSL_is_init_finished(con)) { && !SSL_is_init_finished(con)) {
/*
* Count number of reads during init_ssl_connection.
* It helps us to distinguish configuration errors from errors
* caused by a client.
*/
unsigned int read_counter = 0;
BIO_set_callback_arg(SSL_get_rbio(con), (char *)&read_counter);
i = init_ssl_connection(con); i = init_ssl_connection(con);
BIO_set_callback_arg(SSL_get_rbio(con), NULL);
/*
* If initialization fails without reads, then
* there was a fatal error in configuration.
*/
if (i <= 0 && read_counter == 0) {
ret = -1;
goto err;
}
if (i < 0) { if (i < 0) {
ret = 0; ret = 0;
goto err; goto err;
} else if (i == 0) { } else if (i == 0) {
ret = 1; ret = 1;
goto err; goto err;
} }
} else { } else {
again: again:
 End of changes. 5 change blocks. 
5 lines changed or deleted 44 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)