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:
parent
c1f5e54d2d
commit
c8f677d33e
1 changed files with 9 additions and 5 deletions
|
@ -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 = 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);
|
||||
|
||||
|
@ -1588,9 +1588,13 @@ void ecp_mod_mul_inv(char *input_A, int id, int ctype)
|
|||
|
||||
ASSERT_ALLOC(bufx, limbs);
|
||||
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);
|
||||
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:
|
||||
|
|
Loading…
Reference in a new issue