mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master 1/2] crypto: ecc: use HWRNG for random numbers
@ 2025-04-17  6:21 Ahmad Fatoum
  2025-04-17  6:21 ` [PATCH master 2/2] crypto: imx-scc: blobgen: " Ahmad Fatoum
  2025-04-22  8:25 ` [PATCH master 1/2] crypto: ecc: " Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2025-04-17  6:21 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The kernel's get_random_bytes provides random numbers suitable for crypto
purposes, while in barebox, we need to use get_crypto_bytes for that.

This footgun needs to be fixed, but until we do, let's make sure crypto
code doesn't use a badly seeded PRNG.

Fortunately crypto_ecdh_shared_secret is currently unused and this
doesn't affect any upstream users.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 crypto/ecc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/ecc.c b/crypto/ecc.c
index d91948bddbde..b90fe0e74809 100644
--- a/crypto/ecc.c
+++ b/crypto/ecc.c
@@ -1621,7 +1621,7 @@ int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits,
 
 	nbytes = ndigits << ECC_DIGITS_TO_BYTES_SHIFT;
 
-	get_random_bytes(rand_z, nbytes);
+	get_crypto_bytes(rand_z, nbytes);
 
 	pk = ecc_alloc_point(ndigits);
 	if (!pk) {
-- 
2.39.5




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

end of thread, other threads:[~2025-04-22  9:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-17  6:21 [PATCH master 1/2] crypto: ecc: use HWRNG for random numbers Ahmad Fatoum
2025-04-17  6:21 ` [PATCH master 2/2] crypto: imx-scc: blobgen: " Ahmad Fatoum
2025-04-22  8:25 ` [PATCH master 1/2] crypto: ecc: " Sascha Hauer

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