mirror of
https://github.com/yuzu-mirror/mbedtls.git
synced 2026-04-20 22:05:15 +00:00
Switch to the new code style
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
fd13a0f851
commit
449bd8303e
442 changed files with 86735 additions and 89438 deletions
|
|
@ -69,24 +69,23 @@ __MBEDTLS_TEST_TEMPLATE__FUNCTIONS_CODE
|
|||
*
|
||||
* \return 0 if exp_id is found. 1 otherwise.
|
||||
*/
|
||||
int get_expression( int32_t exp_id, int32_t * out_value )
|
||||
int get_expression(int32_t exp_id, int32_t *out_value)
|
||||
{
|
||||
int ret = KEY_VALUE_MAPPING_FOUND;
|
||||
|
||||
(void) exp_id;
|
||||
(void) out_value;
|
||||
|
||||
switch( exp_id )
|
||||
{
|
||||
__MBEDTLS_TEST_TEMPLATE__EXPRESSION_CODE
|
||||
switch (exp_id) {
|
||||
__MBEDTLS_TEST_TEMPLATE__EXPRESSION_CODE
|
||||
#line __MBEDTLS_TEST_TEMPLATE__LINE_NO "suites/main_test.function"
|
||||
default:
|
||||
{
|
||||
ret = KEY_VALUE_MAPPING_NOT_FOUND;
|
||||
}
|
||||
break;
|
||||
{
|
||||
ret = KEY_VALUE_MAPPING_NOT_FOUND;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return( ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -101,20 +100,19 @@ __MBEDTLS_TEST_TEMPLATE__EXPRESSION_CODE
|
|||
*
|
||||
* \return DEPENDENCY_SUPPORTED if set else DEPENDENCY_NOT_SUPPORTED
|
||||
*/
|
||||
int dep_check( int dep_id )
|
||||
int dep_check(int dep_id)
|
||||
{
|
||||
int ret = DEPENDENCY_NOT_SUPPORTED;
|
||||
|
||||
(void) dep_id;
|
||||
|
||||
switch( dep_id )
|
||||
{
|
||||
__MBEDTLS_TEST_TEMPLATE__DEP_CHECK_CODE
|
||||
switch (dep_id) {
|
||||
__MBEDTLS_TEST_TEMPLATE__DEP_CHECK_CODE
|
||||
#line __MBEDTLS_TEST_TEMPLATE__LINE_NO "suites/main_test.function"
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return( ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -131,7 +129,7 @@ __MBEDTLS_TEST_TEMPLATE__DEP_CHECK_CODE
|
|||
* dereferences. Each wrapper function hard-codes the
|
||||
* number and types of the parameters.
|
||||
*/
|
||||
typedef void (*TestWrapper_t)( void **param_array );
|
||||
typedef void (*TestWrapper_t)(void **param_array);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -142,7 +140,7 @@ typedef void (*TestWrapper_t)( void **param_array );
|
|||
*/
|
||||
TestWrapper_t test_funcs[] =
|
||||
{
|
||||
__MBEDTLS_TEST_TEMPLATE__DISPATCH_CODE
|
||||
__MBEDTLS_TEST_TEMPLATE__DISPATCH_CODE
|
||||
#line __MBEDTLS_TEST_TEMPLATE__LINE_NO "suites/main_test.function"
|
||||
};
|
||||
|
||||
|
|
@ -157,35 +155,31 @@ __MBEDTLS_TEST_TEMPLATE__DISPATCH_CODE
|
|||
* DISPATCH_TEST_FN_NOT_FOUND if not found
|
||||
* DISPATCH_UNSUPPORTED_SUITE if not compile time enabled.
|
||||
*/
|
||||
int dispatch_test( size_t func_idx, void ** params )
|
||||
int dispatch_test(size_t func_idx, void **params)
|
||||
{
|
||||
int ret = DISPATCH_TEST_SUCCESS;
|
||||
TestWrapper_t fp = NULL;
|
||||
|
||||
if ( func_idx < (int)( sizeof( test_funcs ) / sizeof( TestWrapper_t ) ) )
|
||||
{
|
||||
if (func_idx < (int) (sizeof(test_funcs) / sizeof(TestWrapper_t))) {
|
||||
fp = test_funcs[func_idx];
|
||||
if ( fp )
|
||||
{
|
||||
if (fp) {
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
|
||||
mbedtls_test_enable_insecure_external_rng( );
|
||||
mbedtls_test_enable_insecure_external_rng();
|
||||
#endif
|
||||
|
||||
fp( params );
|
||||
fp(params);
|
||||
|
||||
#if defined(MBEDTLS_TEST_MUTEX_USAGE)
|
||||
mbedtls_test_mutex_usage_check( );
|
||||
mbedtls_test_mutex_usage_check();
|
||||
#endif /* MBEDTLS_TEST_MUTEX_USAGE */
|
||||
}
|
||||
else
|
||||
} else {
|
||||
ret = DISPATCH_UNSUPPORTED_SUITE;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
} else {
|
||||
ret = DISPATCH_TEST_FN_NOT_FOUND;
|
||||
}
|
||||
|
||||
return( ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -199,23 +193,21 @@ int dispatch_test( size_t func_idx, void ** params )
|
|||
* DISPATCH_TEST_FN_NOT_FOUND if not found
|
||||
* DISPATCH_UNSUPPORTED_SUITE if not compile time enabled.
|
||||
*/
|
||||
int check_test( size_t func_idx )
|
||||
int check_test(size_t func_idx)
|
||||
{
|
||||
int ret = DISPATCH_TEST_SUCCESS;
|
||||
TestWrapper_t fp = NULL;
|
||||
|
||||
if ( func_idx < (int)( sizeof(test_funcs)/sizeof( TestWrapper_t ) ) )
|
||||
{
|
||||
if (func_idx < (int) (sizeof(test_funcs)/sizeof(TestWrapper_t))) {
|
||||
fp = test_funcs[func_idx];
|
||||
if ( fp == NULL )
|
||||
if (fp == NULL) {
|
||||
ret = DISPATCH_UNSUPPORTED_SUITE;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
} else {
|
||||
ret = DISPATCH_TEST_FN_NOT_FOUND;
|
||||
}
|
||||
|
||||
return( ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -235,10 +227,10 @@ __MBEDTLS_TEST_TEMPLATE__PLATFORM_CODE
|
|||
*
|
||||
* \return Exit code.
|
||||
*/
|
||||
int main( int argc, const char *argv[] )
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
#if defined(MBEDTLS_TEST_HOOKS)
|
||||
extern void (*mbedtls_test_hook_test_fail)( const char * test, int line, const char * file );
|
||||
extern void (*mbedtls_test_hook_test_fail)(const char *test, int line, const char *file);
|
||||
mbedtls_test_hook_test_fail = &mbedtls_test_fail;
|
||||
#if defined(MBEDTLS_ERROR_C)
|
||||
mbedtls_test_hook_error_add = &mbedtls_test_err_add_check;
|
||||
|
|
@ -246,15 +238,14 @@ int main( int argc, const char *argv[] )
|
|||
#endif
|
||||
|
||||
int ret = mbedtls_test_platform_setup();
|
||||
if( ret != 0 )
|
||||
{
|
||||
mbedtls_fprintf( stderr,
|
||||
"FATAL: Failed to initialize platform - error %d\n",
|
||||
ret );
|
||||
return( -1 );
|
||||
if (ret != 0) {
|
||||
mbedtls_fprintf(stderr,
|
||||
"FATAL: Failed to initialize platform - error %d\n",
|
||||
ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = execute_tests( argc, argv );
|
||||
ret = execute_tests(argc, argv);
|
||||
mbedtls_test_platform_teardown();
|
||||
return( ret );
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue