Skip to content

Commit 52c415c

Browse files
Vge0rgerlubos
authored andcommitted
nrf_security: Reset the PRNG reseed counter in Cracen PSA
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]>
1 parent be9c4be commit 52c415c

File tree

1 file changed

+2
-0
lines changed
  • subsys/nrf_security/src/drivers/cracen/cracenpsa/src

1 file changed

+2
-0
lines changed

subsys/nrf_security/src/drivers/cracen/cracenpsa/src/ctr_drbg.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ psa_status_t cracen_get_random(cracen_prng_context_t *context, uint8_t *output,
202202
}
203203
safe_memset(entropy, sizeof(entropy), 0,
204204
CRACEN_PRNG_ENTROPY_SIZE + CRACEN_PRNG_NONCE_SIZE);
205+
206+
prng.reseed_counter = 0;
205207
}
206208

207209
psa_key_attributes_t attr = PSA_KEY_ATTRIBUTES_INIT;

0 commit comments

Comments
 (0)