* [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
0 siblings, 1 reply; 2+ 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] 2+ messages in thread
* [PATCH master 2/2] crypto: imx-scc: blobgen: use HWRNG for random numbers
2025-04-17 6:21 [PATCH master 1/2] crypto: ecc: use HWRNG for random numbers Ahmad Fatoum
@ 2025-04-17 6:21 ` Ahmad Fatoum
0 siblings, 0 replies; 2+ 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.
Fixes: b62a31a9069b ("crypto: add new imx-scc driver")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/crypto/imx-scc/scc-blobgen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/imx-scc/scc-blobgen.c b/drivers/crypto/imx-scc/scc-blobgen.c
index 530d0840f810..a444386dab5a 100644
--- a/drivers/crypto/imx-scc/scc-blobgen.c
+++ b/drivers/crypto/imx-scc/scc-blobgen.c
@@ -67,7 +67,7 @@ static int imx_scc_blob_encrypt(struct blobgen *bg, const char *modifier,
req.dst = blob;
req.nbytes = bufsiz;
- get_random_bytes(req.info, MAX_IVLEN);
+ get_crypto_bytes(req.info, MAX_IVLEN);
ret = imx_scc_cbc_des_encrypt(&req);
if (ret)
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-17 6:24 UTC | newest]
Thread overview: 2+ 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox