Skip to content

Commit

Permalink
crypto: drbg - always try to free Jitter RNG instance
Browse files Browse the repository at this point in the history
The Jitter RNG is unconditionally allocated as a seed source follwoing
the patch 97f2650. Thus, the instance must always be deallocated.

Reported-by: [email protected]
Fixes: 97f2650 ("crypto: drbg - always seeded with SP800-90B ...")
Signed-off-by: Stephan Mueller <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
smuellerDD authored and herbertx committed Jun 15, 2020
1 parent 1f5b07f commit 819966c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crypto/drbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1631,10 +1631,12 @@ static int drbg_uninstantiate(struct drbg_state *drbg)
if (drbg->random_ready.func) {
del_random_ready_callback(&drbg->random_ready);
cancel_work_sync(&drbg->seed_work);
crypto_free_rng(drbg->jent);
drbg->jent = NULL;
}

if (!IS_ERR_OR_NULL(drbg->jent))
crypto_free_rng(drbg->jent);
drbg->jent = NULL;

if (drbg->d_ops)
drbg->d_ops->crypto_fini(drbg);
drbg_dealloc_state(drbg);
Expand Down

0 comments on commit 819966c

Please sign in to comment.