Merge pull request #3529 from ronald-cron-arm/common-mbedtls_param_failed-2.16

[Backport 2.16] Backport clean-up in tests done in #3474
This commit is contained in:
Gilles Peskine 2020-10-06 22:15:47 +02:00 committed by GitHub
commit e944cac87a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 289 additions and 267 deletions

View file

@ -154,6 +154,27 @@ typedef enum
} \
} while( 0 )
/** Compare two buffers and fail the test case if they differ.
*
* This macro expands to an instruction, not an expression.
* It may jump to the \c exit label.
*
* \param p1 Pointer to the start of the first buffer.
* \param size1 Size of the first buffer in bytes.
* This expression may be evaluated multiple times.
* \param p2 Pointer to the start of the second buffer.
* \param size2 Size of the second buffer in bytes.
* This expression may be evaluated multiple times.
*/
#define ASSERT_COMPARE( p1, size1, p2, size2 ) \
do \
{ \
TEST_ASSERT( ( size1 ) == ( size2 ) ); \
if( ( size1 ) != 0 ) \
TEST_ASSERT( memcmp( ( p1 ), ( p2 ), ( size1 ) ) == 0 ); \
} \
while( 0 )
/**
* \brief This macro tests the expression passed to it and skips the
* running test if it doesn't evaluate to 'true'.
@ -738,7 +759,7 @@ int rnd_pseudo_rand( void *rng_state, unsigned char *output, size_t len )
return( 0 );
}
int hexcmp( uint8_t * a, uint8_t * b, uint32_t a_len, uint32_t b_len )
int mbedtls_test_hexcmp( uint8_t * a, uint8_t * b, uint32_t a_len, uint32_t b_len )
{
int ret = 0;
uint32_t i = 0;