diff options
author | Bodo Möller <bodo@openssl.org> | 2002-09-25 15:36:21 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2002-09-25 15:36:21 +0000 |
commit | af4396e589eb09a6eea7096782668d3d897d49d0 (patch) | |
tree | 20deced511daeb9e66d376b1750ee3e95a262ced | |
parent | 9c4d0c68bd448be9d95672c1eb510e2a56bbe01e (diff) |
really fix race conditions
Submitted by: "Patrick McCormick" <patrick@tellme.com>
PR: 262
PR: 291
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | ssl/s23_clnt.c | 13 | ||||
-rw-r--r-- | ssl/s23_srvr.c | 13 | ||||
-rw-r--r-- | ssl/s2_clnt.c | 13 | ||||
-rw-r--r-- | ssl/s2_lib.c | 16 | ||||
-rw-r--r-- | ssl/s2_srvr.c | 13 | ||||
-rw-r--r-- | ssl/s3_clnt.c | 13 | ||||
-rw-r--r-- | ssl/s3_lib.c | 17 | ||||
-rw-r--r-- | ssl/s3_srvr.c | 15 | ||||
-rw-r--r-- | ssl/t1_clnt.c | 15 | ||||
-rw-r--r-- | ssl/t1_srvr.c | 15 |
11 files changed, 90 insertions, 57 deletions
@@ -12,7 +12,9 @@ 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 <patrick@tellme.com>, 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 df9ed02ddd..105e16aeae 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 94198750f9..40ffb65efd 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 c59fa6e429..3f56f6480b 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 01d1e97d60..0c96064675 100644 --- a/ssl/s2_lib.c +++ b/ssl/s2_lib.c @@ -376,15 +376,19 @@ SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p) { CRYPTO_w_lock(CRYPTO_LOCK_SSL); - for (i=0; i<SSL2_NUM_CIPHERS; i++) - sorted[i]= &(ssl2_ciphers[i]); + if (init) + { + for (i=0; i<SSL2_NUM_CIPHERS; i++) + sorted[i]= &(ssl2_ciphers[i]); - qsort( (char *)sorted, - SSL2_NUM_CIPHERS,sizeof(SSL_CIPHER *), - FP_ICC ssl_cipher_ptr_id_cmp); + qsort((char *)sorted, + SSL2_NUM_CIPHERS,sizeof(SSL_CIPHER *), + FP_ICC ssl_cipher_ptr_id_cmp); + init=0; + } + CRYPTO_w_unlock(CRYPTO_LOCK_SSL); - init=0; } id=0x02000000L|((unsigned long)p[0]<<16L)| diff --git a/ssl/s2_srvr.c b/ssl/s2_srvr.c index 48fff175d4..4ba8fb6534 100644 --- a/ssl/s2_srvr.c +++ b/ssl/s2_srvr.c @@ -147,11 +147,14 @@ SSL_METHOD *SSLv2_server_method(void) { CRYPTO_w_lock(CRYPTO_LOCK_SSL_METHOD); - memcpy((char *)&SSLv2_server_data,(char *)sslv2_base_method(), - sizeof(SSL_METHOD)); - SSLv2_server_data.ssl_accept=ssl2_accept; - SSLv2_server_data.get_ssl_method=ssl2_get_server_method; - init=0; + if (init) + { + memcpy((char *)&SSLv2_server_data,(char *)sslv2_base_method(), + sizeof(SSL_METHOD)); + SSLv2_server_data.ssl_accept=ssl2_accept; + SSLv2_server_data.get_ssl_method=ssl2_get_server_method; + init=0; + } CRYPTO_w_unlock(CRYPTO_LOCK_SSL_METHOD); } diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c index a55acd1975..5927a2842c 100644 --- a/ssl/s3_clnt.c +++ b/ssl/s3_clnt.c @@ -148,11 +148,14 @@ SSL_METHOD *SSLv3_client_method(void) { CRYPTO_w_lock(CRYPTO_LOCK_SSL_METHOD); - memcpy((char *)&SSLv3_client_data,(char *)sslv3_base_method(), - sizeof(SSL_METHOD)); - SSLv3_client_data.ssl_connect=ssl3_connect; - SSLv3_client_data.get_ssl_method=ssl3_get_client_method; - init=0; + if (init) + { + memcpy((char *)&SSLv3_client_data,(char *)sslv3_base_method(), + sizeof(SSL_METHOD)); + SSLv3_client_data.ssl_connect=ssl3_connect; + SSLv3_client_data.get_ssl_method=ssl3_get_client_method; + init=0; + } CRYPTO_w_unlock(CRYPTO_LOCK_SSL_METHOD); } diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 9951ebb419..c231d9d06f 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -1084,16 +1084,19 @@ SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p) { CRYPTO_w_lock(CRYPTO_LOCK_SSL); - for (i=0; i<SSL3_NUM_CIPHERS; i++) - sorted[i]= &(ssl3_ciphers[i]); + if (init) + { + for (i=0; i<SSL3_NUM_CIPHERS; i++) + sorted[i]= &(ssl3_ciphers[i]); - qsort( (char *)sorted, - SSL3_NUM_CIPHERS,sizeof(SSL_CIPHER *), - FP_ICC ssl_cipher_ptr_id_cmp); + qsort(sorted, + SSL3_NUM_CIPHERS,sizeof(SSL_CIPHER *), + FP_ICC ssl_cipher_ptr_id_cmp); + init=0; + } + CRYPTO_w_unlock(CRYPTO_LOCK_SSL); - - init=0; } id=0x03000000L|((unsigned long)p[0]<<8L)|(unsigned long)p[1]; diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c index 50913ae8e4..e4451e2bc7 100644 --- a/ssl/s3_srvr.c +++ b/ssl/s3_srvr.c @@ -153,12 +153,15 @@ SSL_METHOD *SSLv3_server_method(void) { CRYPTO_w_lock(CRYPTO_LOCK_SSL_METHOD); - memcpy((char *)&SSLv3_server_data,(char *)sslv3_base_method(), - sizeof(SSL_METHOD)); - SSLv3_server_data.ssl_accept=ssl3_accept; - SSLv3_server_data.get_ssl_method=ssl3_get_server_method; - init=0; - + if (init) + { + memcpy((char *)&SSLv3_server_data,(char *)sslv3_base_method(), + sizeof(SSL_METHOD)); + SSLv3_server_data.ssl_accept=ssl3_accept; + SSLv3_server_data.get_ssl_method=ssl3_get_server_method; + init=0; + } + CRYPTO_w_unlock(CRYPTO_LOCK_SSL_METHOD); } return(&SSLv3_server_data); diff --git a/ssl/t1_clnt.c b/ssl/t1_clnt.c index df00a1215a..f68b9cc085 100644 --- a/ssl/t1_clnt.c +++ b/ssl/t1_clnt.c @@ -81,12 +81,15 @@ SSL_METHOD *TLSv1_client_method(void) { CRYPTO_w_lock(CRYPTO_LOCK_SSL_METHOD); - memcpy((char *)&TLSv1_client_data,(char *)tlsv1_base_method(), - sizeof(SSL_METHOD)); - TLSv1_client_data.ssl_connect=ssl3_connect; - TLSv1_client_data.get_ssl_method=tls1_get_client_method; - init=0; - + if (init) + { + memcpy((char *)&TLSv1_client_data,(char *)tlsv1_base_method(), + sizeof(SSL_METHOD)); + TLSv1_client_data.ssl_connect=ssl3_connect; + TLSv1_client_data.get_ssl_method=tls1_get_client_method; + init=0; + } + CRYPTO_w_unlock(CRYPTO_LOCK_SSL_METHOD); } return(&TLSv1_client_data); diff --git a/ssl/t1_srvr.c b/ssl/t1_srvr.c index e62275c6f8..7486c553de 100644 --- a/ssl/t1_srvr.c +++ b/ssl/t1_srvr.c @@ -82,12 +82,15 @@ SSL_METHOD *TLSv1_server_method(void) { CRYPTO_w_lock(CRYPTO_LOCK_SSL_METHOD); - memcpy((char *)&TLSv1_server_data,(char *)tlsv1_base_method(), - sizeof(SSL_METHOD)); - TLSv1_server_data.ssl_accept=ssl3_accept; - TLSv1_server_data.get_ssl_method=tls1_get_server_method; - init=0; - + if (init) + { + memcpy((char *)&TLSv1_server_data,(char *)tlsv1_base_method(), + sizeof(SSL_METHOD)); + TLSv1_server_data.ssl_accept=ssl3_accept; + TLSv1_server_data.get_ssl_method=tls1_get_server_method; + init=0; + } + CRYPTO_w_unlock(CRYPTO_LOCK_SSL_METHOD); } return(&TLSv1_server_data); |