This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 79863bb140923a6d2b988fb7787a2d63c5458ad1
Author: makejian <[email protected]>
AuthorDate: Mon Oct 13 21:16:11 2025 +0800

    crypto/ecc: fix static check in using uninitilized params
    
    1. p.x uninitialized in line 1643
    2. l_public.y uninitialized in line 1579
    3. l_public.y uninitialized in line 1533
    Signed-off-by: makejian <[email protected]>
---
 crypto/ecc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/crypto/ecc.c b/crypto/ecc.c
index 430457b7d6d..2a980c4432d 100644
--- a/crypto/ecc.c
+++ b/crypto/ecc.c
@@ -1505,6 +1505,8 @@ int ecc_make_key(uint8_t publickey[ECC_BYTES + 1],
   eccpoint_t l_public;
   unsigned l_tries = 0;
 
+  memset(&l_public, 0, sizeof(eccpoint_t));
+
   do
     {
       if (l_tries++ >= MAX_TRIES)
@@ -1590,6 +1592,9 @@ int ecdh_shared_secret(const uint8_t publickey[ECC_BYTES 
+ 1],
   uint64_t l_private[NUM_ECC_DIGITS];
   uint64_t l_random[NUM_ECC_DIGITS];
 
+  memset(&l_product, 0, sizeof(eccpoint_t));
+  memset(&l_public, 0, sizeof(eccpoint_t));
+
   arc4random_buf(l_random, NUM_ECC_DIGITS);
   ecc_point_decompress(&l_public, publickey);
   ecc_bytes2native(l_private, privatekey);
@@ -1611,6 +1616,8 @@ int ecdsa_sign(const uint8_t privatekey[ECC_BYTES],
   unsigned l_tries = 0;
   eccpoint_t p;
 
+  memset(&p, 0, sizeof(eccpoint_t));
+
   do
     {
       if (l_tries++ >= MAX_TRIES)

Reply via email to