diff options
author | Bodo Möller <bodo@openssl.org> | 2002-09-25 15:38:57 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2002-09-25 15:38:57 +0000 |
commit | b8565a9af9c6a4113b11764d2f79e799266a33c0 (patch) | |
tree | c784d28d5213a900b0783b8bff9efbe24c1950fd /ssl/s2_lib.c | |
parent | 94960c84215f89cc7f655ad13418fbb38e597ed2 (diff) |
really fix race conditions
Submitted by: "Patrick McCormick" <patrick@tellme.com>
PR: 262
PR: 291
Diffstat (limited to 'ssl/s2_lib.c')
-rw-r--r-- | ssl/s2_lib.c | 16 |
1 files changed, 10 insertions, 6 deletions
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<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)| |