forked from espressif/esp-idf
mbedtls: Add UTs for modexp
This commit is contained in:
@@ -419,7 +419,7 @@ int mbedtls_mpi_exp_mod( mbedtls_mpi* Z, const mbedtls_mpi* X, const mbedtls_mpi
|
|||||||
Z->s = -1;
|
Z->s = -1;
|
||||||
MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(Z, M, Z));
|
MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(Z, M, Z));
|
||||||
} else {
|
} else {
|
||||||
Z->s = 1;
|
Z->s = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@@ -140,12 +140,6 @@ static bool test_bignum_modexp(const char *z_str, const char *x_str, const char
|
|||||||
//mbedtls_mpi_printf("M", &M);
|
//mbedtls_mpi_printf("M", &M);
|
||||||
|
|
||||||
/* Z = (X ^ Y) mod M */
|
/* Z = (X ^ Y) mod M */
|
||||||
<<<<<<< HEAD
|
|
||||||
TEST_ASSERT_FALSE(mbedtls_mpi_exp_mod(&Z, &X, &Y, &M, NULL));
|
|
||||||
|
|
||||||
mbedtls_mpi_write_string(&Z, 16, z_buf, sizeof(z_buf)-1, &z_buf_len);
|
|
||||||
TEST_ASSERT_EQUAL_STRING_MESSAGE(z_str, z_buf, "mbedtls_mpi_exp_mod incorrect");
|
|
||||||
=======
|
|
||||||
if (ret_error != mbedtls_mpi_exp_mod(&Z, &X, &Y, &M, NULL)) {
|
if (ret_error != mbedtls_mpi_exp_mod(&Z, &X, &Y, &M, NULL)) {
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
@@ -169,7 +163,6 @@ static bool test_bignum_modexp(const char *z_str, const char *x_str, const char
|
|||||||
printf(" PASS\n");
|
printf(" PASS\n");
|
||||||
}
|
}
|
||||||
return fail;
|
return fail;
|
||||||
>>>>>>> mbedtls: Add UTs for modexp
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("test MPI modexp", "[bignum]")
|
TEST_CASE("test MPI modexp", "[bignum]")
|
||||||
|
Reference in New Issue
Block a user