File openssl-fips_fix_deadlock.patch of Package openssl-1_1.14217
Index: openssl-1.1.0i/crypto/fips/fips_drbg_rand.c
===================================================================
--- openssl-1.1.0i.orig/crypto/fips/fips_drbg_rand.c 2020-01-18 16:33:49.459601832 +0100
+++ openssl-1.1.0i/crypto/fips/fips_drbg_rand.c 2020-03-02 09:42:10.132317728 +0100
@@ -156,21 +156,23 @@ static void fips_drbg_cleanup(void)
static int fips_drbg_seed(const void *seed, int seedlen)
{
DRBG_CTX *dctx = &ossl_dctx;
+ int ret = 1;
CRYPTO_THREAD_write_lock(fips_rand_lock);
if (dctx->rand_seed_cb)
- return dctx->rand_seed_cb(dctx, seed, seedlen);
+ ret = dctx->rand_seed_cb(dctx, seed, seedlen);
CRYPTO_THREAD_unlock(fips_rand_lock);
- return 1;
+ return ret;
}
static int fips_drbg_add(const void *seed, int seedlen, double add_entropy)
{
DRBG_CTX *dctx = &ossl_dctx;
+ int ret = 1;
CRYPTO_THREAD_write_lock(fips_rand_lock);
if (dctx->rand_add_cb)
- return dctx->rand_add_cb(dctx, seed, seedlen, add_entropy);
+ ret = dctx->rand_add_cb(dctx, seed, seedlen, add_entropy);
CRYPTO_THREAD_unlock(fips_rand_lock);
- return 1;
+ return ret;
}
static const RAND_METHOD rand_drbg_meth = {