mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-07 13:22:46 +00:00
Test when all three inputs to mbedtls_mpi_core_sub() are aliased
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
parent
3bd7bc3add
commit
f2b3818a69
@ -1911,6 +1911,14 @@ void mpi_core_sub( char * input_A, char * input_B,
|
|||||||
/* 3b) r = a - b => we should get the correct result */
|
/* 3b) r = a - b => we should get the correct result */
|
||||||
ASSERT_COMPARE( r, bytes, x, bytes );
|
ASSERT_COMPARE( r, bytes, x, bytes );
|
||||||
|
|
||||||
|
/* 4 tests "r may be aliased to [...] both" */
|
||||||
|
if ( A.n == B.n && memcmp( A.p, B.p, bytes ) == 0 )
|
||||||
|
{
|
||||||
|
memcpy( r, b, bytes );
|
||||||
|
TEST_EQUAL( carry, mbedtls_mpi_core_sub( r, r, r, limbs ) );
|
||||||
|
ASSERT_COMPARE( r, bytes, x, bytes );
|
||||||
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
mbedtls_free( a );
|
mbedtls_free( a );
|
||||||
mbedtls_free( b );
|
mbedtls_free( b );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user