diff options
author | Bodo Möller <bodo@openssl.org> | 2002-09-25 15:38:17 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2002-09-25 15:38:17 +0000 |
commit | fbf4c7b4f12fe9c4974403f422f494effcbb1d1f (patch) | |
tree | d3d7ccb6c7e5005c04685e24562453db375cd497 /ssl/s2_lib.c | |
parent | 99542d876300de147e97ed00f3c26113aacc49ae (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)| |