commit 2d3d732c9bf87cc10729f69678dd9e6862f99fa3
Author: NIIBE Yutaka <gniibe@fsij.org>
Date:   Fri Apr 10 16:58:57 2026 +0900

    cipher:ecc: Fix decoding a point on Montgomery curve.
    
    * cipher/ecc-misc.c (_gcry_ecc_mont_decodepoint): Fix the padding
    mistake and add updating RAWMPILEN.
    
    --
    
    Reported by Calif.io in collaboration with Claude and Anthropic
    Research.
    
    GnuPG-bug-id: 8211
    Fixes-commit: bbe15758c893dbf546416c1a6bccdad1ab000ad7
    Suggested-by: Bronson Yen <bronson@calif.io>
    Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>

diff --git a/cipher/ecc-misc.c b/cipher/ecc-misc.c
index 615b0df2..ab3799dc 100644
--- a/cipher/ecc-misc.c
+++ b/cipher/ecc-misc.c
@@ -438,7 +438,10 @@ _gcry_ecc_mont_decodepoint (gcry_mpi_t pk, mpi_ec_t ec, mpi_point_t result)
         *--p = *buf++;
 
       if (rawmpilen < nbytes)
-        memset (rawmpi + nbytes - rawmpilen, 0, nbytes - rawmpilen);
+        {
+          memset (rawmpi + rawmpilen, 0, nbytes - rawmpilen);
+          rawmpilen = nbytes;
+        }
     }
   else
     {
