crypto: drbg - Only fail when jent is unavailable in FIPS mode
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 28 Mar 2023 03:35:23 +0000 (11:35 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:21 +0000 (23:03 +0900)
commit8bc8e34e8017fec0f430875a9b3a7448561a381a
treef7f81cfa2921ee26859349e73d55e1c15faef631
parent81366e333c7e034cc2e86021f1e5accdfc37ab7f
crypto: drbg - Only fail when jent is unavailable in FIPS mode

[ Upstream commit 686cd976b6ddedeeb1a1fb09ba53a891d3cc9a03 ]

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: 57225e679788 ("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: Sasha Levin <sashal@kernel.org>
crypto/drbg.c