mirror of
https://github.com/cuberite/polarssl.git
synced 2025-10-03 02:23:32 -04:00
Refine error check for mbedtls_ecp_modulus_setup
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
This commit is contained in:
parent
afdea64b50
commit
78b93b1902
@ -1554,7 +1554,7 @@ exit:
|
|||||||
/* BEGIN_CASE depends_on:MBEDTLS_TEST_HOOKS */
|
/* BEGIN_CASE depends_on:MBEDTLS_TEST_HOOKS */
|
||||||
void ecp_mod_mul_inv(char *input_A, int id, int ctype, int iret)
|
void ecp_mod_mul_inv(char *input_A, int id, int ctype, int iret)
|
||||||
{
|
{
|
||||||
int ret;
|
size_t limbs;
|
||||||
mbedtls_mpi_mod_modulus m;
|
mbedtls_mpi_mod_modulus m;
|
||||||
mbedtls_mpi_mod_modulus_init(&m);
|
mbedtls_mpi_mod_modulus_init(&m);
|
||||||
mbedtls_mpi_mod_residue A = { NULL, 0 };
|
mbedtls_mpi_mod_residue A = { NULL, 0 };
|
||||||
@ -1566,12 +1566,9 @@ void ecp_mod_mul_inv(char *input_A, int id, int ctype, int iret)
|
|||||||
mbedtls_mpi_uint *bufx = NULL;
|
mbedtls_mpi_uint *bufx = NULL;
|
||||||
mbedtls_mpi_uint Result = 1;
|
mbedtls_mpi_uint Result = 1;
|
||||||
|
|
||||||
ret = mbedtls_ecp_modulus_setup(&m, id, ctype);
|
((void) iret);
|
||||||
TEST_EQUAL(ret, iret);
|
|
||||||
|
|
||||||
if (ret == 0) {
|
TEST_ASSERT(mbedtls_ecp_modulus_setup(&m, id, ctype) == 0);
|
||||||
|
|
||||||
size_t limbs;
|
|
||||||
|
|
||||||
TEST_EQUAL(mbedtls_test_read_mpi_core(&p, &limbs, input_A), 0);
|
TEST_EQUAL(mbedtls_test_read_mpi_core(&p, &limbs, input_A), 0);
|
||||||
TEST_EQUAL(0, mbedtls_mpi_mod_residue_setup(&A, &m, p, limbs));
|
TEST_EQUAL(0, mbedtls_mpi_mod_residue_setup(&A, &m, p, limbs));
|
||||||
@ -1596,7 +1593,6 @@ void ecp_mod_mul_inv(char *input_A, int id, int ctype, int iret)
|
|||||||
MBEDTLS_MPI_MOD_EXT_REP_LE), 0);
|
MBEDTLS_MPI_MOD_EXT_REP_LE), 0);
|
||||||
TEST_EQUAL(memcmp(bufx, &Result, sizeof(mbedtls_mpi_uint)), 0);
|
TEST_EQUAL(memcmp(bufx, &Result, sizeof(mbedtls_mpi_uint)), 0);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
mbedtls_mpi_mod_modulus_free(&m);
|
mbedtls_mpi_mod_modulus_free(&m);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user