Skip to content

Commit

Permalink
nrf_security: Reset the PRNG reseed counter in Cracen PSA
Browse files Browse the repository at this point in the history
Reset the reseed counter when reseed is performed. Without this
the cracen_get_random will perform reseeding for every call when
reseed counter > reseed interval (Until reseed counter overflows
which will have an undefined behavior).

Signed-off-by: Georgios Vasilakis <[email protected]>
  • Loading branch information
Vge0rge authored and rlubos committed Jan 3, 2025
1 parent be9c4be commit 52c415c
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ psa_status_t cracen_get_random(cracen_prng_context_t *context, uint8_t *output,
}
safe_memset(entropy, sizeof(entropy), 0,
CRACEN_PRNG_ENTROPY_SIZE + CRACEN_PRNG_NONCE_SIZE);

prng.reseed_counter = 0;
}

psa_key_attributes_t attr = PSA_KEY_ATTRIBUTES_INIT;
Expand Down

0 comments on commit 52c415c

Please sign in to comment.