public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] crypto: drbg - ensure most preferred type is FIPS health checked
@ 2023-10-29 20:48 Dimitri John Ledkov
  2023-10-29 20:48 ` [PATCH 2/4] crypto: drbg - update FIPS CTR self-checks to aes256 Dimitri John Ledkov
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Dimitri John Ledkov @ 2023-10-29 20:48 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Stephan Mueller
  Cc: simo, linux-crypto, linux-kernel

drbg supports multiple types of drbg, and multiple parameters of
each. Health check sanity only checks one drbg of a single type. One
can enable all three types of drbg. And instead of checking the most
preferred algorithm (last one wins), it is currently checking first
one instead.

Update ifdef to ensure that healthcheck prefers HMAC, over HASH, over
CTR, last one wins, like all other code and functions.

Fixes: 541af946fe ("crypto: drbg - SP800-90A Deterministic Random Bit Generator")

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
---
 crypto/drbg.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/crypto/drbg.c b/crypto/drbg.c
index ff4ebbc68e..2cce18dcfc 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -2018,9 +2018,11 @@ static inline int __init drbg_healthcheck_sanity(void)
 
 #ifdef CONFIG_CRYPTO_DRBG_CTR
 	drbg_convert_tfm_core("drbg_nopr_ctr_aes128", &coreref, &pr);
-#elif defined CONFIG_CRYPTO_DRBG_HASH
+#endif
+#ifdef CONFIG_CRYPTO_DRBG_HASH
 	drbg_convert_tfm_core("drbg_nopr_sha256", &coreref, &pr);
-#else
+#endif
+#ifdef CONFIG_CRYPTO_DRBG_HMAC
 	drbg_convert_tfm_core("drbg_nopr_hmac_sha256", &coreref, &pr);
 #endif
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-11-17 11:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-29 20:48 [PATCH 1/4] crypto: drbg - ensure most preferred type is FIPS health checked Dimitri John Ledkov
2023-10-29 20:48 ` [PATCH 2/4] crypto: drbg - update FIPS CTR self-checks to aes256 Dimitri John Ledkov
2023-10-30 10:23   ` Stephan Mueller
2023-10-30 10:30     ` Dimitri John Ledkov
2023-10-30 10:35       ` Stephan Mueller
2023-10-29 20:48 ` [PATCH 3/4] crypto: drbg - ensure drbg hmac sha512 is used in FIPS selftests Dimitri John Ledkov
2023-10-30 10:25   ` Stephan Mueller
2023-10-29 20:48 ` [PATCH 4/4] crypto: drbg - Remove SHA1 from drbg Dimitri John Ledkov
2023-10-30 11:20   ` Stephan Mueller
2023-10-30 10:19 ` [PATCH 1/4] crypto: drbg - ensure most preferred type is FIPS health checked Stephan Mueller
2023-10-30 12:05 ` [PATCH v2 0/4] drbg small fixes Dimitri John Ledkov
2023-10-30 12:05   ` [PATCH v2 1/4] crypto: drbg - ensure most preferred type is FIPS health checked Dimitri John Ledkov
2023-10-30 12:05   ` [PATCH v2 2/4] crypto: drbg - update FIPS CTR self-checks to aes256 Dimitri John Ledkov
2023-10-30 12:05   ` [PATCH v2 3/4] crypto: drbg - ensure drbg hmac sha512 is used in FIPS selftests Dimitri John Ledkov
2023-10-30 12:05   ` [PATCH v2 4/4] crypto: drbg - Remove SHA1 from drbg Dimitri John Ledkov
2023-11-17 11:23   ` [PATCH v2 0/4] drbg small fixes Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox