mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-06-24 01:41:35 +03:00
Both compare the least significant limb 1 and the left limbs 0
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
This commit is contained in:
@ -1563,7 +1563,7 @@ void ecp_mod_mul_inv(char *input_A, int id, int ctype)
|
|||||||
mbedtls_mpi_uint *A_inverse = NULL;
|
mbedtls_mpi_uint *A_inverse = NULL;
|
||||||
mbedtls_mpi_uint *A = NULL;
|
mbedtls_mpi_uint *A = NULL;
|
||||||
mbedtls_mpi_uint *bufx = NULL;
|
mbedtls_mpi_uint *bufx = NULL;
|
||||||
const mbedtls_mpi_uint one[2] = {1, 0};
|
const mbedtls_mpi_uint one[1] = { 1 };
|
||||||
|
|
||||||
mbedtls_mpi_mod_modulus_init(&m);
|
mbedtls_mpi_mod_modulus_init(&m);
|
||||||
|
|
||||||
@ -1588,9 +1588,13 @@ void ecp_mod_mul_inv(char *input_A, int id, int ctype)
|
|||||||
|
|
||||||
ASSERT_ALLOC(bufx, limbs);
|
ASSERT_ALLOC(bufx, limbs);
|
||||||
TEST_EQUAL(mbedtls_mpi_mod_write(&rX, &m, (unsigned char *) bufx,
|
TEST_EQUAL(mbedtls_mpi_mod_write(&rX, &m, (unsigned char *) bufx,
|
||||||
limbs * sizeof(mbedtls_mpi_uint),
|
limbs * ciL,
|
||||||
MBEDTLS_MPI_MOD_EXT_REP_LE), 0);
|
MBEDTLS_MPI_MOD_EXT_REP_LE), 0);
|
||||||
ASSERT_COMPARE(bufx, 2, one, 2);
|
|
||||||
|
ASSERT_COMPARE(bufx, ciL, one, ciL);
|
||||||
|
/*Borrow the buffer of A to compare the left lims with 0 */
|
||||||
|
memset(A, 0, limbs * ciL);
|
||||||
|
ASSERT_COMPARE(&bufx[1], (limbs - 1) * ciL, A, (limbs - 1) * ciL);
|
||||||
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
Reference in New Issue
Block a user