diff options
author | Dr. Matthias St. Pierre <matthias.st.pierre@ncp-e.com> | 2020-07-13 02:02:15 +0200 |
---|---|---|
committer | Dr. Matthias St. Pierre <matthias.st.pierre@ncp-e.com> | 2020-07-23 01:12:48 +0200 |
commit | d1768e8298a35fcd8e6e19575e4a9b2e93e4d788 (patch) | |
tree | c44a4c276913135430263675ba522fa6b4fcd09d | |
parent | 8e3e1dfeaaa4130e2bf1951d21a0615b7ce72c8f (diff) |
test/drbgtest.c: set the correct counter to trigger reseeding
It's the generate counter (drbg->reseed_gen_counter), not the
reseed counter which needs to be raised above the reseed_interval.
This mix-up was partially caused by some recent renamings of DRBG
members variables, but that will be dealt with in a separate commit.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11195)
-rw-r--r-- | test/drbgtest.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/drbgtest.c b/test/drbgtest.c index 058b0a4050..3107ccaaf4 100644 --- a/test/drbgtest.c +++ b/test/drbgtest.c @@ -190,6 +190,13 @@ static PROV_DRBG *prov_rand(RAND_DRBG *drbg) return (PROV_DRBG *)drbg->rand->data; } +static void set_generate_counter(RAND_DRBG *drbg, unsigned int n) +{ + PROV_DRBG *p = prov_rand(drbg); + + p->reseed_gen_counter = n; +} + static void set_reseed_counter(RAND_DRBG *drbg, unsigned int n) { PROV_DRBG *p = prov_rand(drbg); @@ -509,7 +516,7 @@ static int error_check(DRBG_SELFTEST_DATA *td) if (!instantiate(drbg, td, &t)) goto err; reseed_counter_tmp = reseed_counter(drbg); - set_reseed_counter(drbg, reseed_requests(drbg)); + set_generate_counter(drbg, reseed_requests(drbg)); /* Generate output and check entropy has been requested for reseed */ t.entropycnt = 0; @@ -534,7 +541,7 @@ static int error_check(DRBG_SELFTEST_DATA *td) if (!instantiate(drbg, td, &t)) goto err; reseed_counter_tmp = reseed_counter(drbg); - set_reseed_counter(drbg, reseed_requests(drbg)); + set_generate_counter(drbg, reseed_requests(drbg)); /* Generate output and check entropy has been requested for reseed */ t.entropycnt = 0; |