diff options
author | Pauli <ppzgs1@gmail.com> | 2024-09-23 06:18:22 +0200 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2024-10-09 04:53:10 +0200 |
commit | 348c928d66e099f9814e7a63e4618e3aecf7286c (patch) | |
tree | d2f1507f472c03ebe46ce8f73866eb08f0cf074d /providers | |
parent | test: add test for fips-jitter (diff) | |
download | openssl-348c928d66e099f9814e7a63e4618e3aecf7286c.tar.xz openssl-348c928d66e099f9814e7a63e4618e3aecf7286c.zip |
fips: fix locking issues
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/25498)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/implementations/rands/fips_crng_test.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/providers/implementations/rands/fips_crng_test.c b/providers/implementations/rands/fips_crng_test.c index 057ae6e35e..209a1adb27 100644 --- a/providers/implementations/rands/fips_crng_test.c +++ b/providers/implementations/rands/fips_crng_test.c @@ -302,24 +302,18 @@ static size_t crng_test_get_seed(void *vcrngt, unsigned char **pout, } /* Grab seed from our parent */ - if (!crng_test_lock(crngt)) + if (!lock_parent(crngt)) return 0; - if (!lock_parent(crngt)) { - crng_test_unlock(crngt); - return 0; - } + n = crngt->parent_get_seed(crngt->parent, pout, entropy, min_len, max_len, prediction_resistance, adin, adin_len); - unlock_parent(crngt); - if (n > 0) - r = crng_test(crngt, *pout, n); - crng_test_unlock(crngt); - if (n > 0 && r > 0) - return n; - if (crngt->parent_clear_seed != NULL) + if (n > 0 && crng_test(crngt, *pout, n) > 0) + r = n; + else if (crngt->parent_clear_seed != NULL) crngt->parent_clear_seed(crngt->parent, *pout, n); - return 0; + unlock_parent(crngt); + return r; } static void crng_test_clear_seed(void *vcrngt, |