crypto: drbg - Only fail when jent is unavailable in FIPS mode

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2175240
Upstream Status: merged into herbert/cryptodev-2.6.git

commit 686cd976b6ddedeeb1a1fb09ba53a891d3cc9a03
Author: Herbert Xu <herbert@gondor.apana.org.au>
Date:   Tue Mar 28 11:35:23 2023 +0800

    crypto: drbg - Only fail when jent is unavailable in FIPS mode

    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: 57225e6797 ("crypto: drbg - Use callback API for random readiness")
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Reviewed-by: Stephan Mueller <smueller@chronox.de>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Vladis Dronov <vdronov@redhat.com>
This commit is contained in:
Vladis Dronov 2023-04-13 17:59:05 +02:00
parent 966461f8f9
commit d4a8c86207
1 changed files with 1 additions and 1 deletions

View File

@ -1549,7 +1549,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");
}