From fbf4c7b4f12fe9c4974403f422f494effcbb1d1f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bodo=20M=C3=B6ller?= Date: Wed, 25 Sep 2002 15:38:17 +0000 Subject: [PATCH] really fix race conditions Submitted by: "Patrick McCormick" PR: 262 PR: 291 --- CHANGES | 4 +++- ssl/s23_clnt.c | 13 ++++++++----- ssl/s23_srvr.c | 13 ++++++++----- ssl/s2_clnt.c | 13 ++++++++----- ssl/s2_lib.c | 16 ++++++++++------ ssl/s2_srvr.c | 13 ++++++++----- ssl/s3_clnt.c | 13 ++++++++----- ssl/s3_lib.c | 17 ++++++++++------- ssl/s3_srvr.c | 15 +++++++++------ ssl/t1_clnt.c | 15 +++++++++------ ssl/t1_srvr.c | 15 +++++++++------ 11 files changed, 90 insertions(+), 57 deletions(-) diff --git a/CHANGES b/CHANGES index 001fd6e5c9..09e6bc9e19 100644 --- a/CHANGES +++ b/CHANGES @@ -1683,7 +1683,9 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k SSLv23_client_method(), SSLv23_server_method(), SSLv2_client_method(), SSLv2_server_method(), SSLv3_client_method(), SSLv3_server_method(), - TLSv1_client_method(), TLSv1_server_method(). + TLSv1_client_method(), TLSv1_server_method(), + ssl2_get_cipher_by_char(), + ssl3_get_cipher_by_char(). [Patrick McCormick , Bodo Moeller] *) Reorder cleanup sequence in SSL_CTX_free(): only remove the ex_data after diff --git a/ssl/s23_clnt.c b/ssl/s23_clnt.c index 9c02cb49a1..99230890a9 100644 --- a/ssl/s23_clnt.c +++ b/ssl/s23_clnt.c @@ -89,11 +89,14 @@ SSL_METHOD *SSLv23_client_method(void) { CRYPTO_w_lock(CRYPTO_LOCK_SSL_METHOD); - memcpy((char *)&SSLv23_client_data, - (char *)sslv23_base_method(),sizeof(SSL_METHOD)); - SSLv23_client_data.ssl_connect=ssl23_connect; - SSLv23_client_data.get_ssl_method=ssl23_get_client_method; - init=0; + if (init) + { + memcpy((char *)&SSLv23_client_data, + (char *)sslv23_base_method(),sizeof(SSL_METHOD)); + SSLv23_client_data.ssl_connect=ssl23_connect; + SSLv23_client_data.get_ssl_method=ssl23_get_client_method; + init=0; + } CRYPTO_w_unlock(CRYPTO_LOCK_SSL_METHOD); } diff --git a/ssl/s23_srvr.c b/ssl/s23_srvr.c index 5c7e9fa97f..442c95aa9b 100644 --- a/ssl/s23_srvr.c +++ b/ssl/s23_srvr.c @@ -141,11 +141,14 @@ SSL_METHOD *SSLv23_server_method(void) { CRYPTO_w_lock(CRYPTO_LOCK_SSL_METHOD); - memcpy((char *)&SSLv23_server_data, - (char *)sslv23_base_method(),sizeof(SSL_METHOD)); - SSLv23_server_data.ssl_accept=ssl23_accept; - SSLv23_server_data.get_ssl_method=ssl23_get_server_method; - init=0; + if (init) + { + memcpy((char *)&SSLv23_server_data, + (char *)sslv23_base_method(),sizeof(SSL_METHOD)); + SSLv23_server_data.ssl_accept=ssl23_accept; + SSLv23_server_data.get_ssl_method=ssl23_get_server_method; + init=0; + } CRYPTO_w_unlock(CRYPTO_LOCK_SSL_METHOD); } diff --git a/ssl/s2_clnt.c b/ssl/s2_clnt.c index 0d29039828..be03e9c630 100644 --- a/ssl/s2_clnt.c +++ b/ssl/s2_clnt.c @@ -147,11 +147,14 @@ SSL_METHOD *SSLv2_client_method(void) { CRYPTO_w_lock(CRYPTO_LOCK_SSL_METHOD); - memcpy((char *)&SSLv2_client_data,(char *)sslv2_base_method(), - sizeof(SSL_METHOD)); - SSLv2_client_data.ssl_connect=ssl2_connect; - SSLv2_client_data.get_ssl_method=ssl2_get_client_method; - init=0; + if (init) + { + memcpy((char *)&SSLv2_client_data,(char *)sslv2_base_method(), + sizeof(SSL_METHOD)); + SSLv2_client_data.ssl_connect=ssl2_connect; + SSLv2_client_data.get_ssl_method=ssl2_get_client_method; + init=0; + } CRYPTO_w_unlock(CRYPTO_LOCK_SSL_METHOD); } diff --git a/ssl/s2_lib.c b/ssl/s2_lib.c index cc0dcfa956..0cbbb066fd 100644 --- a/ssl/s2_lib.c +++ b/ssl/s2_lib.c @@ -377,15 +377,19 @@ SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p) { CRYPTO_w_lock(CRYPTO_LOCK_SSL); - for (i=0; i