Patch "crypto: ecc - Fix off-by-one missing to clear most significant digit" has been added to the 6.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    crypto: ecc - Fix off-by-one missing to clear most significant digit

to the 6.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     crypto-ecc-fix-off-by-one-missing-to-clear-most-sign.patch
and it can be found in the queue-6.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 26727b72c076b28ee9ea8d77952bcf92a49033b4
Author: Stefan Berger <stefanb@xxxxxxxxxxxxx>
Date:   Thu Jun 13 17:38:20 2024 -0400

    crypto: ecc - Fix off-by-one missing to clear most significant digit
    
    [ Upstream commit 1dcf865d3bf5bff45e93cb2410911b3428dacb78 ]
    
    Fix an off-by-one error where the most significant digit was not
    initialized leading to signature verification failures by the testmgr.
    
    Example: If a curve requires ndigits (=9) and diff (=2) indicates that
    2 digits need to be set to zero then start with digit 'ndigits - diff' (=7)
    and clear 'diff' digits starting from there, so 7 and 8.
    
    Reported-by: Venkat Rao Bagalkote <venkat88@xxxxxxxxxxxxxxxxxx>
    Closes: https://lore.kernel.org/linux-crypto/619bc2de-b18a-4939-a652-9ca886bf6349@xxxxxxxxxxxxx/T/#m045d8812409ce233c17fcdb8b88b6629c671f9f4
    Fixes: 2fd2a82ccbfc ("crypto: ecdsa - Use ecc_digits_from_bytes to create hash digits array")
    Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxx>
    Tested-by: Venkat Rao Bagalkote <venkat88@xxxxxxxxxxxxxxxxxx>
    Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/crypto/ecc.c b/crypto/ecc.c
index fe761256e335..dd48d9928a21 100644
--- a/crypto/ecc.c
+++ b/crypto/ecc.c
@@ -78,7 +78,7 @@ void ecc_digits_from_bytes(const u8 *in, unsigned int nbytes,
 	/* diff > 0: not enough input bytes: set most significant digits to 0 */
 	if (diff > 0) {
 		ndigits -= diff;
-		memset(&out[ndigits - 1], 0, diff * sizeof(u64));
+		memset(&out[ndigits], 0, diff * sizeof(u64));
 	}
 
 	if (o) {




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux