Fix parantheses on return and sizeof statements.
Used script:
```
import re
import sys
for arg in sys.argv[1:]:
print(arg)
with open(arg, 'r') as file:
content = file.read()
content = re.sub(r"return\s?\((?!.*\).*\()\s*\n?(.*)\n?\);", r"return \1;", \
content, flags = re.M)
content = re.sub(r"sizeof ([^\(][a-zA-Z0-9_\[\]]*)", r"sizeof(\1)",\
content, flags = re.M)
with open(arg, 'w') as file:
file.write(content)
```
Executed with:
` find . -regextype posix-egrep -regex ".*\.([hc]|fmt|function)" | xargs -L1 python script.py`
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
diff --git a/tests/src/psa_exercise_key.c b/tests/src/psa_exercise_key.c
index e4e55c9..f47f15a 100644
--- a/tests/src/psa_exercise_key.c
+++ b/tests/src/psa_exercise_key.c
@@ -110,7 +110,7 @@
*/
psa_reset_key_attributes( &attributes );
- return( ok );
+ return ok ;
}
static int exercise_mac_key( mbedtls_svc_key_id_t key,
@@ -151,11 +151,11 @@
verify_status );
}
- return( 1 );
+ return 1 ;
exit:
psa_mac_abort( &operation );
- return( 0 );
+ return 0 ;
}
static int exercise_cipher_key( mbedtls_svc_key_id_t key,
@@ -224,11 +224,11 @@
PSA_ASSERT( status );
}
- return( 1 );
+ return 1 ;
exit:
psa_cipher_abort( &operation );
- return( 0 );
+ return 0 ;
}
static int exercise_aead_key( mbedtls_svc_key_id_t key,
@@ -287,10 +287,10 @@
verify_status );
}
- return( 1 );
+ return 1 ;
exit:
- return( 0 );
+ return 0 ;
}
static int exercise_signature_key( mbedtls_svc_key_id_t key,
@@ -371,10 +371,10 @@
}
}
- return( 1 );
+ return 1 ;
exit:
- return( 0 );
+ return 0 ;
}
static int exercise_asymmetric_encryption_key( mbedtls_svc_key_id_t key,
@@ -409,10 +409,10 @@
status == PSA_ERROR_INVALID_PADDING ) ) );
}
- return( 1 );
+ return 1 ;
exit:
- return( 0 );
+ return 0 ;
}
int mbedtls_test_psa_setup_key_derivation_wrap(
@@ -458,10 +458,10 @@
if( capacity != SIZE_MAX )
PSA_ASSERT( psa_key_derivation_set_capacity( operation, capacity ) );
- return( 1 );
+ return 1 ;
exit:
- return( 0 );
+ return 0 ;
}
@@ -491,10 +491,10 @@
PSA_ASSERT( psa_key_derivation_abort( &operation ) );
}
- return( 1 );
+ return 1 ;
exit:
- return( 0 );
+ return 0 ;
}
/* We need two keys to exercise key agreement. Exercise the
@@ -534,7 +534,7 @@
psa_reset_key_attributes( &attributes );
mbedtls_free( public_key );
- return( status );
+ return status ;
}
/* We need two keys to exercise key agreement. Exercise the
@@ -586,7 +586,7 @@
psa_reset_key_attributes( &attributes );
mbedtls_free( public_key );
- return( status );
+ return status ;
}
static int exercise_raw_key_agreement_key( mbedtls_svc_key_id_t key,
@@ -604,7 +604,7 @@
ok = 1;
exit:
- return( ok );
+ return ok ;
}
static int exercise_key_agreement_key( mbedtls_svc_key_id_t key,
@@ -629,7 +629,7 @@
ok = 1;
exit:
- return( ok );
+ return ok ;
}
int mbedtls_test_psa_exported_key_sanity_check(
@@ -785,10 +785,10 @@
}
#endif
- return( 1 );
+ return 1 ;
exit:
- return( 0 );
+ return 0 ;
}
static int exercise_export_key( mbedtls_svc_key_id_t key,
@@ -832,7 +832,7 @@
psa_reset_key_attributes( &attributes );
mbedtls_free( exported );
- return( ok );
+ return ok ;
}
static int exercise_export_public_key( mbedtls_svc_key_id_t key )
@@ -880,7 +880,7 @@
psa_reset_key_attributes( &attributes );
mbedtls_free( exported );
- return( ok );
+ return ok ;
}
int mbedtls_test_psa_exercise_key( mbedtls_svc_key_id_t key,
@@ -890,7 +890,7 @@
int ok = 0;
if( ! check_key_attributes_sanity( key ) )
- return( 0 );
+ return 0 ;
if( alg == 0 )
ok = 1; /* If no algorihm, do nothing (used for raw data "keys"). */
@@ -917,7 +917,7 @@
ok = ok && exercise_export_public_key( key );
exit:
- return( ok );
+ return ok ;
}
psa_key_usage_t mbedtls_test_psa_usage_to_exercise( psa_key_type_t type,
@@ -952,11 +952,11 @@
else if( PSA_ALG_IS_KEY_DERIVATION( alg ) ||
PSA_ALG_IS_KEY_AGREEMENT( alg ) )
{
- return( PSA_KEY_USAGE_DERIVE );
+ return PSA_KEY_USAGE_DERIVE ;
}
else
{
- return( 0 );
+ return 0 ;
}
}