From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A2C8101C0 for ; Mon, 15 May 2023 17:57:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B78B6C433EF; Mon, 15 May 2023 17:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1684173442; bh=YEB+Jut9FpCIkPP9R++XHX142KeQUeO4gw+CbmMqB2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BvSQN3kxdTpViDcVisDlotlLivuCN5rUKLMjDrGNiv7jgOWqo5DIKg4H41aXKH56f t+f15kmkvr/ndlejBB2ER+9Qcd/XVedBtS1ypglRR8vurN/vkrKniQwTs883szTWTJ eB9JZp6uEZ+7kD8cNRT25c+Zg6d9ZhgYwWqmMODA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Herbert Xu , Stephan Mueller , Sasha Levin Subject: [PATCH 5.4 095/282] crypto: drbg - Only fail when jent is unavailable in FIPS mode Date: Mon, 15 May 2023 18:27:53 +0200 Message-Id: <20230515161725.109561072@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515161722.146344674@linuxfoundation.org> References: <20230515161722.146344674@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Herbert Xu [ 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 Reviewed-by: Stephan Mueller Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- crypto/drbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/drbg.c b/crypto/drbg.c index 732b72e4ee4dd..df80752fb649b 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -1519,7 +1519,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"); } -- 2.39.2