}
drbg->state = DRBG_READY;
- drbg->reseed_gen_counter = 1;
+ drbg->generate_counter = 1;
drbg->reseed_time = time(NULL);
if (drbg->enable_reseed_propagation) {
if (drbg->parent == NULL)
- tsan_counter(&drbg->reseed_prop_counter);
+ tsan_counter(&drbg->reseed_counter);
else
- tsan_store(&drbg->reseed_prop_counter,
- tsan_load(&drbg->parent->reseed_prop_counter));
+ tsan_store(&drbg->reseed_counter,
+ tsan_load(&drbg->parent->reseed_counter));
}
end:
goto end;
drbg->state = DRBG_READY;
- drbg->reseed_gen_counter = 1;
+ drbg->generate_counter = 1;
drbg->reseed_time = time(NULL);
if (drbg->enable_reseed_propagation) {
if (drbg->parent == NULL)
- tsan_counter(&drbg->reseed_prop_counter);
+ tsan_counter(&drbg->reseed_counter);
else
- tsan_store(&drbg->reseed_prop_counter,
- tsan_load(&drbg->parent->reseed_prop_counter));
+ tsan_store(&drbg->reseed_counter,
+ tsan_load(&drbg->parent->reseed_counter));
}
end:
}
if (drbg->reseed_interval > 0) {
- if (drbg->reseed_gen_counter >= drbg->reseed_interval)
+ if (drbg->generate_counter >= drbg->reseed_interval)
reseed_required = 1;
}
if (drbg->reseed_time_interval > 0) {
reseed_required = 1;
}
if (drbg->enable_reseed_propagation && drbg->parent != NULL) {
- if (drbg->reseed_prop_counter != tsan_load(&drbg->parent->reseed_prop_counter))
+ if (drbg->reseed_counter != tsan_load(&drbg->parent->reseed_counter))
reseed_required = 1;
}
return 0;
}
- drbg->reseed_gen_counter++;
+ drbg->generate_counter++;
return 1;
}
/* enable reseed propagation */
drbg->enable_reseed_propagation = 1;
- drbg->reseed_prop_counter = 1;
+ drbg->reseed_counter = 1;
/*
* Ignore instantiation error to support just-in-time instantiation.
/* Instantiate again with valid data */
if (!instantiate(drbg, td, &t))
goto err;
- reseed_counter_tmp = drbg->reseed_gen_counter;
- drbg->reseed_gen_counter = drbg->reseed_interval;
+ reseed_counter_tmp = drbg->generate_counter;
+ drbg->generate_counter = drbg->reseed_interval;
/* Generate output and check entropy has been requested for reseed */
t.entropycnt = 0;
if (!TEST_true(RAND_DRBG_generate(drbg, buff, td->exlen, 0,
td->adin, td->adinlen))
|| !TEST_int_eq(t.entropycnt, 1)
- || !TEST_int_eq(drbg->reseed_gen_counter, reseed_counter_tmp + 1)
+ || !TEST_int_eq(drbg->generate_counter, reseed_counter_tmp + 1)
|| !uninstantiate(drbg))
goto err;
/* Test reseed counter works */
if (!instantiate(drbg, td, &t))
goto err;
- reseed_counter_tmp = drbg->reseed_gen_counter;
- drbg->reseed_gen_counter = drbg->reseed_interval;
+ reseed_counter_tmp = drbg->generate_counter;
+ drbg->generate_counter = drbg->reseed_interval;
/* Generate output and check entropy has been requested for reseed */
t.entropycnt = 0;
if (!TEST_true(RAND_DRBG_generate(drbg, buff, td->exlen, 0,
td->adin, td->adinlen))
|| !TEST_int_eq(t.entropycnt, 1)
- || !TEST_int_eq(drbg->reseed_gen_counter, reseed_counter_tmp + 1)
+ || !TEST_int_eq(drbg->generate_counter, reseed_counter_tmp + 1)
|| !uninstantiate(drbg))
goto err;
*/
/* Test whether seed propagation is enabled */
- if (!TEST_int_ne(master->reseed_prop_counter, 0)
- || !TEST_int_ne(public->reseed_prop_counter, 0)
- || !TEST_int_ne(private->reseed_prop_counter, 0))
+ if (!TEST_int_ne(master->reseed_counter, 0)
+ || !TEST_int_ne(public->reseed_counter, 0)
+ || !TEST_int_ne(private->reseed_counter, 0))
return 0;
/* Check whether the master DRBG's reseed counter is the largest one */
- if (!TEST_int_le(public->reseed_prop_counter, master->reseed_prop_counter)
- || !TEST_int_le(private->reseed_prop_counter, master->reseed_prop_counter))
+ if (!TEST_int_le(public->reseed_counter, master->reseed_counter)
+ || !TEST_int_le(private->reseed_counter, master->reseed_counter))
return 0;
/*
if (expect_success == 1) {
/* Test whether all three reseed counters are synchronized */
- if (!TEST_int_eq(public->reseed_prop_counter, master->reseed_prop_counter)
- || !TEST_int_eq(private->reseed_prop_counter, master->reseed_prop_counter))
+ if (!TEST_int_eq(public->reseed_counter, master->reseed_counter)
+ || !TEST_int_eq(private->reseed_counter, master->reseed_counter))
return 0;
/* Test whether reseed time of master DRBG is set correctly */
* Test whether the public and private DRBG are both reseeded when their
* reseed counters differ from the master's reseed counter.
*/
- master->reseed_prop_counter++;
+ master->reseed_counter++;
if (!TEST_true(test_drbg_reseed(1, master, public, private, 0, 1, 1, 0)))
goto error;
reset_drbg_hook_ctx();
* Test whether the public DRBG is reseeded when its reseed counter differs
* from the master's reseed counter.
*/
- master->reseed_prop_counter++;
- private->reseed_prop_counter++;
+ master->reseed_counter++;
+ private->reseed_counter++;
if (!TEST_true(test_drbg_reseed(1, master, public, private, 0, 1, 0, 0)))
goto error;
reset_drbg_hook_ctx();
* Test whether the private DRBG is reseeded when its reseed counter differs
* from the master's reseed counter.
*/
- master->reseed_prop_counter++;
- public->reseed_prop_counter++;
+ master->reseed_counter++;
+ public->reseed_counter++;
if (!TEST_true(test_drbg_reseed(1, master, public, private, 0, 0, 1, 0)))
goto error;
reset_drbg_hook_ctx();
* Test whether none of the DRBGs is reseed if the master fails to reseed
*/
master_ctx.fail = 1;
- master->reseed_prop_counter++;
+ master->reseed_counter++;
RAND_add(rand_add_buf, sizeof(rand_add_buf), sizeof(rand_add_buf));
if (!TEST_true(test_drbg_reseed(0, master, public, private, 0, 0, 0, 0)))
goto error;