From 0dbf04a9a6f3f362187a99e472a9cb5958832ab1 Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Wed, 13 Apr 2022 06:54:48 +0100 Subject: [PATCH] Remove unnecessary memory operations in p25519 quasireduction Signed-off-by: Hanno Becker --- library/ecp_curves.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/ecp_curves.c b/library/ecp_curves.c index 5788b0dba..6b8ff5c7f 100644 --- a/library/ecp_curves.c +++ b/library/ecp_curves.c @@ -5229,13 +5229,12 @@ static int ecp_mod_p255( mbedtls_mpi *N ) return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA ); /* Split N as N + 2^256 M */ - memset( Mp, 0, sizeof( Mp ) ); memcpy( Mp, NT_p, sizeof( mbedtls_mpi_uint ) * NT_n ); memset( NT_p, 0, sizeof( mbedtls_mpi_uint ) * NT_n ); /* N = A0 + 38 * A1 */ - mbedtls_mpi_core_mla( N->p, N->n, - Mp, P255_WIDTH, + mbedtls_mpi_core_mla( N->p, P255_WIDTH + 1, + Mp, NT_n, 38 ); return( 0 );