diff --git a/crypto/comp/c_zlib.c b/crypto/comp/c_zlib.c index c3167fcea..7553a2d10 100644 --- a/crypto/comp/c_zlib.c +++ b/crypto/comp/c_zlib.c @@ -178,9 +178,12 @@ static int zlib_stateful_init(COMP_CTX *ctx) CRYPTO_new_ex_data(CRYPTO_EX_INDEX_COMP,ctx,&ctx->ex_data); if (zlib_stateful_ex_idx == -1) { - zlib_stateful_ex_idx = - CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_COMP, - 0,NULL,NULL,NULL,zlib_stateful_free_ex_data); + CRYPTO_w_lock(CRYPTO_LOCK_COMP); + if (zlib_stateful_ex_idx == -1) + zlib_stateful_ex_idx = + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_COMP, + 0,NULL,NULL,NULL,zlib_stateful_free_ex_data); + CRYPTO_w_unlock(CRYPTO_LOCK_COMP); if (zlib_stateful_ex_idx == -1) goto err; } diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index 9c38f15ab..009c3be4c 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -168,7 +168,8 @@ static const char* lock_names[CRYPTO_NUM_LOCKS] = "bn", "ec_pre_comp", "store", -#if CRYPTO_NUM_LOCKS != 38 + "comp", +#if CRYPTO_NUM_LOCKS != 39 # error "Inconsistency between crypto.h and cryptlib.c" #endif }; diff --git a/crypto/crypto.h b/crypto/crypto.h index dd90cfa55..5238e5306 100644 --- a/crypto/crypto.h +++ b/crypto/crypto.h @@ -203,7 +203,8 @@ typedef struct openssl_item_st #define CRYPTO_LOCK_BN 35 #define CRYPTO_LOCK_EC_PRE_COMP 36 #define CRYPTO_LOCK_STORE 37 -#define CRYPTO_NUM_LOCKS 38 +#define CRYPTO_LOCK_COMP 38 +#define CRYPTO_NUM_LOCKS 39 #define CRYPTO_LOCK 1 #define CRYPTO_UNLOCK 2