mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-24 06:02:44 +00:00
Fix memory corruption in exp_mod tests
Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
parent
afb2079652
commit
878af12807
@ -1255,7 +1255,7 @@ void mpi_core_exp_mod(char *input_N, char *input_A,
|
|||||||
/* Check both with output aliased to input */
|
/* Check both with output aliased to input */
|
||||||
|
|
||||||
TEST_CALLOC(A_copy, A_limbs);
|
TEST_CALLOC(A_copy, A_limbs);
|
||||||
memcpy(A_copy, A, sizeof(A_copy) * A_limbs);
|
memcpy(A_copy, A, sizeof(*A_copy) * A_limbs);
|
||||||
|
|
||||||
#if defined(MBEDTLS_TEST_HOOKS) && !defined(MBEDTLS_THREADING_C)
|
#if defined(MBEDTLS_TEST_HOOKS) && !defined(MBEDTLS_THREADING_C)
|
||||||
mbedtls_mpi_optionally_safe_codepath_reset();
|
mbedtls_mpi_optionally_safe_codepath_reset();
|
||||||
@ -1266,7 +1266,7 @@ void mpi_core_exp_mod(char *input_N, char *input_A,
|
|||||||
#endif
|
#endif
|
||||||
TEST_EQUAL(0, memcmp(X, A, N_limbs * sizeof(mbedtls_mpi_uint)));
|
TEST_EQUAL(0, memcmp(X, A, N_limbs * sizeof(mbedtls_mpi_uint)));
|
||||||
|
|
||||||
memcpy(A, A_copy, sizeof(A) * A_limbs);
|
memcpy(A, A_copy, sizeof(*A) * A_limbs);
|
||||||
#if defined(MBEDTLS_TEST_HOOKS) && !defined(MBEDTLS_THREADING_C)
|
#if defined(MBEDTLS_TEST_HOOKS) && !defined(MBEDTLS_THREADING_C)
|
||||||
mbedtls_mpi_optionally_safe_codepath_reset();
|
mbedtls_mpi_optionally_safe_codepath_reset();
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user