Skip to content

Commit

Permalink
crypto: drbg - Only fail when jent is unavailable in FIPS mode
Browse files Browse the repository at this point in the history
When jent initialisation fails for any reason other than ENOENT,
the entire drbg fails to initialise, even when we're not in FIPS
mode.  This is wrong because we can still use the kernel RNG when
we're not in FIPS mode.

Change it so that it only fails when we are in FIPS mode.

Fixes: 57225e6 ("crypto: drbg - Use callback API for random readiness")
Signed-off-by: Herbert Xu <[email protected]>
Reviewed-by: Stephan Mueller <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Apr 6, 2023
1 parent 3fde2fe commit 686cd97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/drbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ static int drbg_prepare_hrng(struct drbg_state *drbg)
const int err = PTR_ERR(drbg->jent);

drbg->jent = NULL;
if (fips_enabled || err != -ENOENT)
if (fips_enabled)
return err;
pr_info("DRBG: Continuing without Jitter RNG\n");
}
Expand Down

0 comments on commit 686cd97

Please sign in to comment.