[PATCH 2/2] ecc: Check return value of l_getrandom()
Sergey Trofimov <[email protected]> Wed, 21 May 2025 18:16:40 +0200
| Newsgroups | dev.linux.lists.ell |
|---|---|
| Message-ID | <[email protected]> |
---
ell/ecc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ell/ecc.c b/ell/ecc.c
index 7ab3c1accc869f0d178a203d85f9ec5f77c89a09..bed31336a634d2e40cdda88da06df9e6a62d515b 100644
--- a/ell/ecc.c
+++ b/ell/ecc.c
@@ -1037,7 +1037,8 @@ LIB_EXPORT struct l_ecc_scalar *l_ecc_scalar_new_random(
uint64_t r[L_ECC_MAX_DIGITS];
while (iter++ < ECC_RANDOM_MAX_ITERATIONS) {
- l_getrandom(r, curve->ndigits * 8);
+ if (!l_getrandom(r, curve->ndigits * 8))
+ continue;
if (curve == &p521)
r[8] &= 0x1ff;
--
2.49.0