diff --git a/src/we_dh.c b/src/we_dh.c index 98163cd9..6b83a45a 100644 --- a/src/we_dh.c +++ b/src/we_dh.c @@ -447,10 +447,10 @@ static int we_dh_generate_key_int(DH *dh, we_Dh *engineDh) rc); ret = 0; } - } #if defined(WE_DH_USE_GLOBAL_RNG) && !defined(WE_SINGLE_THREADED) - wc_UnLockMutex(we_rng_mutex); + wc_UnLockMutex(we_rng_mutex); #endif + } } } diff --git a/src/we_ecc.c b/src/we_ecc.c index c39bb3ac..fcbb7ba5 100644 --- a/src/we_ecc.c +++ b/src/we_ecc.c @@ -1193,11 +1193,11 @@ static int we_ecdh_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keyLen) } } } - } #if defined(WE_ECC_USE_GLOBAL_RNG) && defined(ECC_TIMING_RESISTANT) \ && !defined(WE_SINGLE_THREADED) - wc_UnLockMutex(we_rng_mutex); + wc_UnLockMutex(we_rng_mutex); #endif + } } if (ret == 1) { /* Return length of secret. */ @@ -1981,11 +1981,11 @@ static int we_ec_key_compute_key(unsigned char **psec, size_t *pseclen, WOLFENGINE_ERROR_FUNC(WE_LOG_PK, "wc_ecc_shared_secret", rc); ret = 0; } - } #if defined(WE_ECC_USE_GLOBAL_RNG) && defined(ECC_TIMING_RESISTANT) \ && !defined(WE_SINGLE_THREADED) - wc_UnLockMutex(we_rng_mutex); + wc_UnLockMutex(we_rng_mutex); #endif + } } if (ret == 1) { WOLFENGINE_MSG(WE_LOG_PK, "Calculated ECDH shared secret");