Test calculated MBEDTLS_ECP_MAX_xxx constants in unit tests
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
601d34396c
commit
814d0129ec
1 changed files with 4 additions and 0 deletions
|
@ -65,6 +65,8 @@ void mbedtls_ecp_curve_info( int id, int tls_id, int size, char * name )
|
|||
TEST_ASSERT( by_id == by_name );
|
||||
|
||||
TEST_ASSERT( by_id->bit_size == size );
|
||||
TEST_ASSERT( size <= MBEDTLS_ECP_MAX_BITS );
|
||||
TEST_ASSERT( size <= MBEDTLS_ECP_MAX_BYTES * 8 );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
@ -473,6 +475,7 @@ void ecp_muladd( int id,
|
|||
TEST_EQUAL( 0, mbedtls_ecp_point_write_binary(
|
||||
&grp, &R, MBEDTLS_ECP_PF_UNCOMPRESSED,
|
||||
&len, actual_result, sizeof( actual_result ) ) );
|
||||
TEST_ASSERT( len <= MBEDTLS_ECP_MAX_PT_LEN );
|
||||
|
||||
ASSERT_COMPARE( expected_result->x, expected_result->len,
|
||||
actual_result, len );
|
||||
|
@ -544,6 +547,7 @@ void ecp_write_binary( int id, char * x, char * y, char * z, int format,
|
|||
|
||||
if( ret == 0 )
|
||||
{
|
||||
TEST_ASSERT( olen <= MBEDTLS_ECP_MAX_PT_LEN );
|
||||
TEST_ASSERT( mbedtls_test_hexcmp( buf, out->x, olen, out->len ) == 0 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue