From d830feb2561d99fa8b25c7ca68ed92db8b1d71bc Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Tue, 12 Apr 2022 11:10:19 +0100 Subject: [PATCH] Simplify check in p25519 quasi-reduction Signed-off-by: Hanno Becker --- library/ecp_curves.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/ecp_curves.c b/library/ecp_curves.c index d3a14d679..9e70e8ec9 100644 --- a/library/ecp_curves.c +++ b/library/ecp_curves.c @@ -5223,7 +5223,7 @@ static int ecp_mod_p255( mbedtls_mpi *N ) /* Helper references for top part of N */ mbedtls_mpi_uint * const NT_p = N->p + P255_WIDTH; const size_t NT_n = N->n - P255_WIDTH; - if( NT_n == 0 || NT_n > N->n ) + if( NT_n <= P255_WIDTH ) return( 0 ); /* Split N as N + 2^256 M */