From e4710ae9ed02cf51d75bdd1b822f5f845dcab64c Mon Sep 17 00:00:00 2001 From: Gabor Mezei Date: Thu, 9 Mar 2023 13:41:10 +0100 Subject: [PATCH] Add and fix comments Signed-off-by: Gabor Mezei --- library/ecp_curves.c | 4 ++++ scripts/mbedtls_dev/ecp.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/library/ecp_curves.c b/library/ecp_curves.c index 7d312cacc9..f426e6450d 100644 --- a/library/ecp_curves.c +++ b/library/ecp_curves.c @@ -5150,6 +5150,8 @@ int mbedtls_ecp_mod_p256_raw(mbedtls_mpi_uint *X, size_t X_limbs) RESET; + /* Use 2^224 * (2^32 - 1) + 2^192 + 2^96 - 1 + * to modulo reduce the final carry. */ ADD_LAST; NEXT; // A0 ; NEXT; // A1 ; NEXT; // A2 @@ -5161,6 +5163,8 @@ int mbedtls_ecp_mod_p256_raw(mbedtls_mpi_uint *X, size_t X_limbs) RESET; + /* Use 2^224 * (2^32 - 1) + 2^192 + 2^96 - 1 + * to modulo reduce the carry generated by the previous reduction. */ ADD_LAST; NEXT; // A0 ; NEXT; // A1 ; NEXT; // A2 diff --git a/scripts/mbedtls_dev/ecp.py b/scripts/mbedtls_dev/ecp.py index f448925abe..e245171008 100644 --- a/scripts/mbedtls_dev/ecp.py +++ b/scripts/mbedtls_dev/ecp.py @@ -147,7 +147,7 @@ class EcpP224R1Raw(bignum_common.ModOperationCommon, class EcpP256R1Raw(bignum_common.ModOperationCommon, EcpTarget): - """Test cases for ecp quasi_reduction().""" + """Test cases for ECP P256 fast reduction.""" symbol = "-" test_function = "ecp_mod_p256_raw" test_name = "ecp_mod_p256_raw"