mirror of
https://github.com/openssl/openssl.git
synced 2025-04-06 20:20:50 +08:00
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)
This commit is contained in:
parent
8e3e1dfeaa
commit
d1768e8298
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user