Corrections to the new functions names and error message wording
Signed-off-by: TRodziewicz <tomasz.rodziewicz@mobica.com>
This commit is contained in:
parent
053b99b90b
commit
d9be65277d
8 changed files with 15 additions and 11 deletions
|
@ -129,7 +129,7 @@ extern "C" {
|
||||||
* Only used when invasive testing is enabled via MBEDTLS_TEST_HOOKS.
|
* Only used when invasive testing is enabled via MBEDTLS_TEST_HOOKS.
|
||||||
*/
|
*/
|
||||||
extern void (*mbedtls_test_hook_error_add)( int, int, const char *, int );
|
extern void (*mbedtls_test_hook_error_add)( int, int, const char *, int );
|
||||||
extern void (*mbedtls_test_hook_value)( int test, const char * file, int line );
|
extern void (*mbedtls_test_hook_assert_test)( int test, const char * file, int line );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1683,7 +1683,7 @@
|
||||||
*
|
*
|
||||||
* Uncomment to enable invasive tests.
|
* Uncomment to enable invasive tests.
|
||||||
*/
|
*/
|
||||||
#define MBEDTLS_TEST_HOOKS
|
//#define MBEDTLS_TEST_HOOKS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \def MBEDTLS_THREADING_ALT
|
* \def MBEDTLS_THREADING_ALT
|
||||||
|
|
|
@ -1003,8 +1003,8 @@ psa_status_t psa_wipe_key_slot( psa_key_slot_t *slot )
|
||||||
if( slot->lock_count != 1 )
|
if( slot->lock_count != 1 )
|
||||||
{
|
{
|
||||||
#if defined(MBEDTLS_TEST_HOOKS)
|
#if defined(MBEDTLS_TEST_HOOKS)
|
||||||
if( *mbedtls_test_hook_value != NULL )
|
if( *mbedtls_test_hook_assert_test != NULL )
|
||||||
( *mbedtls_test_hook_value )( slot->lock_count == 1, __FILE__, __LINE__ );
|
( *mbedtls_test_hook_assert_test )( slot->lock_count == 1, __FILE__, __LINE__ );
|
||||||
#endif
|
#endif
|
||||||
status = PSA_ERROR_CORRUPTION_DETECTED;
|
status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,8 +416,8 @@ psa_status_t psa_unlock_key_slot( psa_key_slot_t *slot )
|
||||||
slot->lock_count = 1;
|
slot->lock_count = 1;
|
||||||
|
|
||||||
#if defined(MBEDTLS_TEST_HOOKS)
|
#if defined(MBEDTLS_TEST_HOOKS)
|
||||||
if( *mbedtls_test_hook_value != NULL )
|
if( *mbedtls_test_hook_assert_test != NULL )
|
||||||
( *mbedtls_test_hook_value )( slot->lock_count > 0, __FILE__, __LINE__ );
|
( *mbedtls_test_hook_assert_test )( slot->lock_count > 0, __FILE__, __LINE__ );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return( PSA_ERROR_CORRUPTION_DETECTED );
|
return( PSA_ERROR_CORRUPTION_DETECTED );
|
||||||
|
|
|
@ -164,7 +164,7 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
||||||
|
|
||||||
#if defined(MBEDTLS_TEST_HOOKS)
|
#if defined(MBEDTLS_TEST_HOOKS)
|
||||||
void (*mbedtls_test_hook_error_add)( int, int, const char *, int );
|
void (*mbedtls_test_hook_error_add)( int, int, const char *, int );
|
||||||
void (*mbedtls_test_hook_value)( int, const char *, int );
|
void (*mbedtls_test_hook_assert_test)( int, const char *, int );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* MBEDTLS_ERROR_C || MBEDTLS_ERROR_STRERROR_DUMMY */
|
#endif /* MBEDTLS_ERROR_C || MBEDTLS_ERROR_STRERROR_DUMMY */
|
||||||
|
|
|
@ -237,7 +237,7 @@ int mbedtls_test_read_mpi( mbedtls_mpi *X, int radix, const char *s );
|
||||||
* \note If the check fails, fail the test currently being run.
|
* \note If the check fails, fail the test currently being run.
|
||||||
*/
|
*/
|
||||||
#if defined(MBEDTLS_TEST_HOOKS)
|
#if defined(MBEDTLS_TEST_HOOKS)
|
||||||
void mbedtls_test_hook_value_check( int test, const char * file, int line );
|
void mbedtls_test_assert_test( int test, const char * file, int line );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* TEST_HELPERS_H */
|
#endif /* TEST_HELPERS_H */
|
||||||
|
|
|
@ -276,11 +276,11 @@ int mbedtls_test_read_mpi( mbedtls_mpi *X, int radix, const char *s )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_TEST_HOOKS)
|
#if defined(MBEDTLS_TEST_HOOKS)
|
||||||
void mbedtls_test_hook_value_check( int test, const char * file, int line )
|
void mbedtls_test_assert_test( int test, const char * file, int line )
|
||||||
{
|
{
|
||||||
if ( !test )
|
if ( !test )
|
||||||
{
|
{
|
||||||
mbedtls_test_fail( "Wrong value in test", line, file );
|
mbedtls_test_fail( "Test hook - test assertion failed.", line, file );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -239,9 +239,13 @@ int main( int argc, const char *argv[] )
|
||||||
{
|
{
|
||||||
#if defined(MBEDTLS_TEST_HOOKS) && defined (MBEDTLS_ERROR_C)
|
#if defined(MBEDTLS_TEST_HOOKS) && defined (MBEDTLS_ERROR_C)
|
||||||
mbedtls_test_hook_error_add = &mbedtls_test_err_add_check;
|
mbedtls_test_hook_error_add = &mbedtls_test_err_add_check;
|
||||||
mbedtls_test_hook_value = &mbedtls_test_hook_value_check;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_TEST_HOOKS)
|
||||||
|
mbedtls_test_hook_assert_test = &mbedtls_test_assert_test;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int ret = mbedtls_test_platform_setup();
|
int ret = mbedtls_test_platform_setup();
|
||||||
if( ret != 0 )
|
if( ret != 0 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue