Switch to the new code style

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/tests/configs/config-wrapper-malloc-0-null.h b/tests/configs/config-wrapper-malloc-0-null.h
index add1a78..622ac57 100644
--- a/tests/configs/config-wrapper-malloc-0-null.h
+++ b/tests/configs/config-wrapper-malloc-0-null.h
@@ -26,11 +26,12 @@
 #include <stdlib.h>
 
 #ifndef MBEDTLS_PLATFORM_STD_CALLOC
-static inline void *custom_calloc( size_t nmemb, size_t size )
+static inline void *custom_calloc(size_t nmemb, size_t size)
 {
-    if( nmemb == 0 || size == 0 )
-        return( NULL );
-    return( calloc( nmemb, size ) );
+    if (nmemb == 0 || size == 0) {
+        return NULL;
+    }
+    return calloc(nmemb, size);
 }
 
 #define MBEDTLS_PLATFORM_MEMORY
diff --git a/tests/include/spe/crypto_spe.h b/tests/include/spe/crypto_spe.h
index 1aee8a5..a79ce17 100644
--- a/tests/include/spe/crypto_spe.h
+++ b/tests/include/spe/crypto_spe.h
@@ -34,110 +34,110 @@
 #define PSA_FUNCTION_NAME(x) mbedcrypto__ ## x
 
 #define psa_crypto_init \
-        PSA_FUNCTION_NAME(psa_crypto_init)
+    PSA_FUNCTION_NAME(psa_crypto_init)
 #define psa_key_derivation_get_capacity \
-        PSA_FUNCTION_NAME(psa_key_derivation_get_capacity)
+    PSA_FUNCTION_NAME(psa_key_derivation_get_capacity)
 #define psa_key_derivation_set_capacity \
-        PSA_FUNCTION_NAME(psa_key_derivation_set_capacity)
+    PSA_FUNCTION_NAME(psa_key_derivation_set_capacity)
 #define psa_key_derivation_input_bytes \
-        PSA_FUNCTION_NAME(psa_key_derivation_input_bytes)
+    PSA_FUNCTION_NAME(psa_key_derivation_input_bytes)
 #define psa_key_derivation_output_bytes \
-        PSA_FUNCTION_NAME(psa_key_derivation_output_bytes)
+    PSA_FUNCTION_NAME(psa_key_derivation_output_bytes)
 #define psa_key_derivation_input_key \
-        PSA_FUNCTION_NAME(psa_key_derivation_input_key)
+    PSA_FUNCTION_NAME(psa_key_derivation_input_key)
 #define psa_key_derivation_output_key \
-        PSA_FUNCTION_NAME(psa_key_derivation_output_key)
+    PSA_FUNCTION_NAME(psa_key_derivation_output_key)
 #define psa_key_derivation_setup \
-        PSA_FUNCTION_NAME(psa_key_derivation_setup)
+    PSA_FUNCTION_NAME(psa_key_derivation_setup)
 #define psa_key_derivation_abort \
-        PSA_FUNCTION_NAME(psa_key_derivation_abort)
+    PSA_FUNCTION_NAME(psa_key_derivation_abort)
 #define psa_key_derivation_key_agreement \
-        PSA_FUNCTION_NAME(psa_key_derivation_key_agreement)
+    PSA_FUNCTION_NAME(psa_key_derivation_key_agreement)
 #define psa_raw_key_agreement \
-        PSA_FUNCTION_NAME(psa_raw_key_agreement)
+    PSA_FUNCTION_NAME(psa_raw_key_agreement)
 #define psa_generate_random \
-        PSA_FUNCTION_NAME(psa_generate_random)
+    PSA_FUNCTION_NAME(psa_generate_random)
 #define psa_aead_encrypt \
-        PSA_FUNCTION_NAME(psa_aead_encrypt)
+    PSA_FUNCTION_NAME(psa_aead_encrypt)
 #define psa_aead_decrypt \
-        PSA_FUNCTION_NAME(psa_aead_decrypt)
+    PSA_FUNCTION_NAME(psa_aead_decrypt)
 #define psa_open_key \
-        PSA_FUNCTION_NAME(psa_open_key)
+    PSA_FUNCTION_NAME(psa_open_key)
 #define psa_close_key \
-        PSA_FUNCTION_NAME(psa_close_key)
+    PSA_FUNCTION_NAME(psa_close_key)
 #define psa_import_key \
-        PSA_FUNCTION_NAME(psa_import_key)
+    PSA_FUNCTION_NAME(psa_import_key)
 #define psa_destroy_key \
-        PSA_FUNCTION_NAME(psa_destroy_key)
+    PSA_FUNCTION_NAME(psa_destroy_key)
 #define psa_get_key_attributes \
-        PSA_FUNCTION_NAME(psa_get_key_attributes)
+    PSA_FUNCTION_NAME(psa_get_key_attributes)
 #define psa_reset_key_attributes \
-        PSA_FUNCTION_NAME(psa_reset_key_attributes)
+    PSA_FUNCTION_NAME(psa_reset_key_attributes)
 #define psa_export_key \
-        PSA_FUNCTION_NAME(psa_export_key)
+    PSA_FUNCTION_NAME(psa_export_key)
 #define psa_export_public_key \
-        PSA_FUNCTION_NAME(psa_export_public_key)
+    PSA_FUNCTION_NAME(psa_export_public_key)
 #define psa_purge_key \
-        PSA_FUNCTION_NAME(psa_purge_key)
+    PSA_FUNCTION_NAME(psa_purge_key)
 #define psa_copy_key \
-        PSA_FUNCTION_NAME(psa_copy_key)
+    PSA_FUNCTION_NAME(psa_copy_key)
 #define psa_cipher_operation_init \
-        PSA_FUNCTION_NAME(psa_cipher_operation_init)
+    PSA_FUNCTION_NAME(psa_cipher_operation_init)
 #define psa_cipher_generate_iv \
-        PSA_FUNCTION_NAME(psa_cipher_generate_iv)
+    PSA_FUNCTION_NAME(psa_cipher_generate_iv)
 #define psa_cipher_set_iv \
-        PSA_FUNCTION_NAME(psa_cipher_set_iv)
+    PSA_FUNCTION_NAME(psa_cipher_set_iv)
 #define psa_cipher_encrypt_setup \
-        PSA_FUNCTION_NAME(psa_cipher_encrypt_setup)
+    PSA_FUNCTION_NAME(psa_cipher_encrypt_setup)
 #define psa_cipher_decrypt_setup \
-        PSA_FUNCTION_NAME(psa_cipher_decrypt_setup)
+    PSA_FUNCTION_NAME(psa_cipher_decrypt_setup)
 #define psa_cipher_update \
-        PSA_FUNCTION_NAME(psa_cipher_update)
+    PSA_FUNCTION_NAME(psa_cipher_update)
 #define psa_cipher_finish \
-        PSA_FUNCTION_NAME(psa_cipher_finish)
+    PSA_FUNCTION_NAME(psa_cipher_finish)
 #define psa_cipher_abort \
-        PSA_FUNCTION_NAME(psa_cipher_abort)
+    PSA_FUNCTION_NAME(psa_cipher_abort)
 #define psa_hash_operation_init \
-        PSA_FUNCTION_NAME(psa_hash_operation_init)
+    PSA_FUNCTION_NAME(psa_hash_operation_init)
 #define psa_hash_setup \
-        PSA_FUNCTION_NAME(psa_hash_setup)
+    PSA_FUNCTION_NAME(psa_hash_setup)
 #define psa_hash_update \
-        PSA_FUNCTION_NAME(psa_hash_update)
+    PSA_FUNCTION_NAME(psa_hash_update)
 #define psa_hash_finish \
-        PSA_FUNCTION_NAME(psa_hash_finish)
+    PSA_FUNCTION_NAME(psa_hash_finish)
 #define psa_hash_verify \
-        PSA_FUNCTION_NAME(psa_hash_verify)
+    PSA_FUNCTION_NAME(psa_hash_verify)
 #define psa_hash_abort \
-        PSA_FUNCTION_NAME(psa_hash_abort)
+    PSA_FUNCTION_NAME(psa_hash_abort)
 #define psa_hash_clone \
-        PSA_FUNCTION_NAME(psa_hash_clone)
+    PSA_FUNCTION_NAME(psa_hash_clone)
 #define psa_hash_compute \
-        PSA_FUNCTION_NAME(psa_hash_compute)
+    PSA_FUNCTION_NAME(psa_hash_compute)
 #define psa_hash_compare \
-        PSA_FUNCTION_NAME(psa_hash_compare)
+    PSA_FUNCTION_NAME(psa_hash_compare)
 #define psa_mac_operation_init \
-        PSA_FUNCTION_NAME(psa_mac_operation_init)
+    PSA_FUNCTION_NAME(psa_mac_operation_init)
 #define psa_mac_sign_setup \
-        PSA_FUNCTION_NAME(psa_mac_sign_setup)
+    PSA_FUNCTION_NAME(psa_mac_sign_setup)
 #define psa_mac_verify_setup \
-        PSA_FUNCTION_NAME(psa_mac_verify_setup)
+    PSA_FUNCTION_NAME(psa_mac_verify_setup)
 #define psa_mac_update \
-        PSA_FUNCTION_NAME(psa_mac_update)
+    PSA_FUNCTION_NAME(psa_mac_update)
 #define psa_mac_sign_finish \
-        PSA_FUNCTION_NAME(psa_mac_sign_finish)
+    PSA_FUNCTION_NAME(psa_mac_sign_finish)
 #define psa_mac_verify_finish \
-        PSA_FUNCTION_NAME(psa_mac_verify_finish)
+    PSA_FUNCTION_NAME(psa_mac_verify_finish)
 #define psa_mac_abort \
-        PSA_FUNCTION_NAME(psa_mac_abort)
+    PSA_FUNCTION_NAME(psa_mac_abort)
 #define psa_sign_hash \
-        PSA_FUNCTION_NAME(psa_sign_hash)
+    PSA_FUNCTION_NAME(psa_sign_hash)
 #define psa_verify_hash \
-        PSA_FUNCTION_NAME(psa_verify_hash)
+    PSA_FUNCTION_NAME(psa_verify_hash)
 #define psa_asymmetric_encrypt \
-        PSA_FUNCTION_NAME(psa_asymmetric_encrypt)
+    PSA_FUNCTION_NAME(psa_asymmetric_encrypt)
 #define psa_asymmetric_decrypt \
-        PSA_FUNCTION_NAME(psa_asymmetric_decrypt)
+    PSA_FUNCTION_NAME(psa_asymmetric_decrypt)
 #define psa_generate_key \
-        PSA_FUNCTION_NAME(psa_generate_key)
+    PSA_FUNCTION_NAME(psa_generate_key)
 
 #endif /* CRYPTO_SPE_H */
diff --git a/tests/include/test/asn1_helpers.h b/tests/include/test/asn1_helpers.h
index 91ae260..dee3cbd 100644
--- a/tests/include/test/asn1_helpers.h
+++ b/tests/include/test/asn1_helpers.h
@@ -43,8 +43,8 @@
  *
  * \return              \c 0 if the test failed, otherwise 1.
  */
-int mbedtls_test_asn1_skip_integer( unsigned char **p, const unsigned char *end,
-                                    size_t min_bits, size_t max_bits,
-                                    int must_be_odd );
+int mbedtls_test_asn1_skip_integer(unsigned char **p, const unsigned char *end,
+                                   size_t min_bits, size_t max_bits,
+                                   int must_be_odd);
 
 #endif /* ASN1_HELPERS_H */
diff --git a/tests/include/test/drivers/aead.h b/tests/include/test/drivers/aead.h
index 2207cb3..182bed2 100644
--- a/tests/include/test/drivers/aead.h
+++ b/tests/include/test/drivers/aead.h
@@ -41,10 +41,10 @@
 
 #define MBEDTLS_TEST_DRIVER_AEAD_INIT { 0, 0, 0 }
 static inline mbedtls_test_driver_aead_hooks_t
-    mbedtls_test_driver_aead_hooks_init( void )
+mbedtls_test_driver_aead_hooks_init(void)
 {
     const mbedtls_test_driver_aead_hooks_t v = MBEDTLS_TEST_DRIVER_AEAD_INIT;
-    return( v );
+    return v;
 }
 
 extern mbedtls_test_driver_aead_hooks_t mbedtls_test_driver_aead_hooks;
@@ -56,7 +56,7 @@
     const uint8_t *nonce, size_t nonce_length,
     const uint8_t *additional_data, size_t additional_data_length,
     const uint8_t *plaintext, size_t plaintext_length,
-    uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length );
+    uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length);
 
 psa_status_t mbedtls_test_transparent_aead_decrypt(
     const psa_key_attributes_t *attributes,
@@ -65,7 +65,7 @@
     const uint8_t *nonce, size_t nonce_length,
     const uint8_t *additional_data, size_t additional_data_length,
     const uint8_t *ciphertext, size_t ciphertext_length,
-    uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length );
+    uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length);
 
 #endif /* PSA_CRYPTO_DRIVER_TEST */
 #endif /* PSA_CRYPTO_TEST_DRIVERS_AEAD_H */
diff --git a/tests/include/test/drivers/cipher.h b/tests/include/test/drivers/cipher.h
index c1aa616..2bd7b62 100644
--- a/tests/include/test/drivers/cipher.h
+++ b/tests/include/test/drivers/cipher.h
@@ -45,10 +45,10 @@
 
 #define MBEDTLS_TEST_DRIVER_CIPHER_INIT { NULL, 0, PSA_SUCCESS, 0 }
 static inline mbedtls_test_driver_cipher_hooks_t
-     mbedtls_test_driver_cipher_hooks_init( void )
+mbedtls_test_driver_cipher_hooks_init(void)
 {
     const mbedtls_test_driver_cipher_hooks_t v = MBEDTLS_TEST_DRIVER_CIPHER_INIT;
-    return( v );
+    return v;
 }
 
 extern mbedtls_test_driver_cipher_hooks_t mbedtls_test_driver_cipher_hooks;
@@ -81,7 +81,7 @@
     psa_algorithm_t alg);
 
 psa_status_t mbedtls_test_transparent_cipher_abort(
-    mbedtls_transparent_test_driver_cipher_operation_t *operation );
+    mbedtls_transparent_test_driver_cipher_operation_t *operation);
 
 psa_status_t mbedtls_test_transparent_cipher_set_iv(
     mbedtls_transparent_test_driver_cipher_operation_t *operation,
diff --git a/tests/include/test/drivers/hash.h b/tests/include/test/drivers/hash.h
index 865cd74..de7ebc5 100644
--- a/tests/include/test/drivers/hash.h
+++ b/tests/include/test/drivers/hash.h
@@ -41,10 +41,10 @@
 
 #define MBEDTLS_TEST_DRIVER_HASH_INIT { 0, 0, 0 }
 static inline mbedtls_test_driver_hash_hooks_t
-    mbedtls_test_driver_hash_hooks_init( void )
+mbedtls_test_driver_hash_hooks_init(void)
 {
     const mbedtls_test_driver_hash_hooks_t v = MBEDTLS_TEST_DRIVER_HASH_INIT;
-    return( v );
+    return v;
 }
 
 extern mbedtls_test_driver_hash_hooks_t mbedtls_test_driver_hash_hooks;
@@ -52,29 +52,29 @@
 psa_status_t mbedtls_test_transparent_hash_compute(
     psa_algorithm_t alg,
     const uint8_t *input, size_t input_length,
-    uint8_t *hash, size_t hash_size, size_t *hash_length );
+    uint8_t *hash, size_t hash_size, size_t *hash_length);
 
 psa_status_t mbedtls_test_transparent_hash_setup(
     mbedtls_transparent_test_driver_hash_operation_t *operation,
-    psa_algorithm_t alg );
+    psa_algorithm_t alg);
 
 psa_status_t mbedtls_test_transparent_hash_clone(
     const mbedtls_transparent_test_driver_hash_operation_t *source_operation,
-    mbedtls_transparent_test_driver_hash_operation_t *target_operation );
+    mbedtls_transparent_test_driver_hash_operation_t *target_operation);
 
 psa_status_t mbedtls_test_transparent_hash_update(
     mbedtls_transparent_test_driver_hash_operation_t *operation,
     const uint8_t *input,
-    size_t input_length );
+    size_t input_length);
 
 psa_status_t mbedtls_test_transparent_hash_finish(
     mbedtls_transparent_test_driver_hash_operation_t *operation,
     uint8_t *hash,
     size_t hash_size,
-    size_t *hash_length );
+    size_t *hash_length);
 
 psa_status_t mbedtls_test_transparent_hash_abort(
-    mbedtls_transparent_test_driver_hash_operation_t *operation );
+    mbedtls_transparent_test_driver_hash_operation_t *operation);
 
 #endif /* PSA_CRYPTO_DRIVER_TEST */
 #endif /* PSA_CRYPTO_TEST_DRIVERS_HASH_H */
diff --git a/tests/include/test/drivers/key_management.h b/tests/include/test/drivers/key_management.h
index c8dfbb3..d10ba4b 100644
--- a/tests/include/test/drivers/key_management.h
+++ b/tests/include/test/drivers/key_management.h
@@ -52,43 +52,43 @@
  * used as a location of an opaque test drivers. */
 #define MBEDTLS_TEST_DRIVER_KEY_MANAGEMENT_INIT { NULL, 0, PSA_SUCCESS, 0, 0x800000 }
 static inline mbedtls_test_driver_key_management_hooks_t
-    mbedtls_test_driver_key_management_hooks_init( void )
+mbedtls_test_driver_key_management_hooks_init(void)
 {
     const mbedtls_test_driver_key_management_hooks_t
         v = MBEDTLS_TEST_DRIVER_KEY_MANAGEMENT_INIT;
-    return( v );
+    return v;
 }
 
 extern mbedtls_test_driver_key_management_hooks_t
     mbedtls_test_driver_key_management_hooks;
 
-psa_status_t mbedtls_test_transparent_init( void );
-void mbedtls_test_transparent_free( void );
-psa_status_t mbedtls_test_opaque_init( void );
-void mbedtls_test_opaque_free( void );
+psa_status_t mbedtls_test_transparent_init(void);
+void mbedtls_test_transparent_free(void);
+psa_status_t mbedtls_test_opaque_init(void);
+void mbedtls_test_opaque_free(void);
 
 psa_status_t mbedtls_test_transparent_generate_key(
     const psa_key_attributes_t *attributes,
-    uint8_t *key, size_t key_size, size_t *key_length );
+    uint8_t *key, size_t key_size, size_t *key_length);
 
 psa_status_t mbedtls_test_opaque_generate_key(
     const psa_key_attributes_t *attributes,
-    uint8_t *key, size_t key_size, size_t *key_length );
+    uint8_t *key, size_t key_size, size_t *key_length);
 
 psa_status_t mbedtls_test_opaque_export_key(
     const psa_key_attributes_t *attributes,
     const uint8_t *key, size_t key_length,
-    uint8_t *data, size_t data_size, size_t *data_length );
+    uint8_t *data, size_t data_size, size_t *data_length);
 
 psa_status_t mbedtls_test_transparent_export_public_key(
     const psa_key_attributes_t *attributes,
     const uint8_t *key, size_t key_length,
-    uint8_t *data, size_t data_size, size_t *data_length );
+    uint8_t *data, size_t data_size, size_t *data_length);
 
 psa_status_t mbedtls_test_opaque_export_public_key(
     const psa_key_attributes_t *attributes,
     const uint8_t *key, size_t key_length,
-    uint8_t *data, size_t data_size, size_t *data_length );
+    uint8_t *data, size_t data_size, size_t *data_length);
 
 psa_status_t mbedtls_test_transparent_import_key(
     const psa_key_attributes_t *attributes,
@@ -102,7 +102,7 @@
 psa_status_t mbedtls_test_opaque_get_builtin_key(
     psa_drv_slot_number_t slot_number,
     psa_key_attributes_t *attributes,
-    uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length );
+    uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length);
 
 #endif /* PSA_CRYPTO_DRIVER_TEST */
 #endif /* PSA_CRYPTO_TEST_DRIVERS_KEY_MANAGEMENT_H */
diff --git a/tests/include/test/drivers/mac.h b/tests/include/test/drivers/mac.h
index 7733dd3..8af1335 100644
--- a/tests/include/test/drivers/mac.h
+++ b/tests/include/test/drivers/mac.h
@@ -41,10 +41,10 @@
 
 #define MBEDTLS_TEST_DRIVER_MAC_INIT { 0, 0, 0 }
 static inline mbedtls_test_driver_mac_hooks_t
-    mbedtls_test_driver_mac_hooks_init( void )
+mbedtls_test_driver_mac_hooks_init(void)
 {
     const mbedtls_test_driver_mac_hooks_t v = MBEDTLS_TEST_DRIVER_MAC_INIT;
-    return( v );
+    return v;
 }
 
 extern mbedtls_test_driver_mac_hooks_t mbedtls_test_driver_mac_hooks;
@@ -58,40 +58,40 @@
     size_t input_length,
     uint8_t *mac,
     size_t mac_size,
-    size_t *mac_length );
+    size_t *mac_length);
 
 psa_status_t mbedtls_test_transparent_mac_sign_setup(
     mbedtls_transparent_test_driver_mac_operation_t *operation,
     const psa_key_attributes_t *attributes,
     const uint8_t *key_buffer,
     size_t key_buffer_size,
-    psa_algorithm_t alg );
+    psa_algorithm_t alg);
 
 psa_status_t mbedtls_test_transparent_mac_verify_setup(
     mbedtls_transparent_test_driver_mac_operation_t *operation,
     const psa_key_attributes_t *attributes,
     const uint8_t *key_buffer,
     size_t key_buffer_size,
-    psa_algorithm_t alg );
+    psa_algorithm_t alg);
 
 psa_status_t mbedtls_test_transparent_mac_update(
     mbedtls_transparent_test_driver_mac_operation_t *operation,
     const uint8_t *input,
-    size_t input_length );
+    size_t input_length);
 
 psa_status_t mbedtls_test_transparent_mac_sign_finish(
     mbedtls_transparent_test_driver_mac_operation_t *operation,
     uint8_t *mac,
     size_t mac_size,
-    size_t *mac_length );
+    size_t *mac_length);
 
 psa_status_t mbedtls_test_transparent_mac_verify_finish(
     mbedtls_transparent_test_driver_mac_operation_t *operation,
     const uint8_t *mac,
-    size_t mac_length );
+    size_t mac_length);
 
 psa_status_t mbedtls_test_transparent_mac_abort(
-    mbedtls_transparent_test_driver_mac_operation_t *operation );
+    mbedtls_transparent_test_driver_mac_operation_t *operation);
 
 psa_status_t mbedtls_test_opaque_mac_compute(
     const psa_key_attributes_t *attributes,
@@ -102,40 +102,40 @@
     size_t input_length,
     uint8_t *mac,
     size_t mac_size,
-    size_t *mac_length );
+    size_t *mac_length);
 
 psa_status_t mbedtls_test_opaque_mac_sign_setup(
     mbedtls_opaque_test_driver_mac_operation_t *operation,
     const psa_key_attributes_t *attributes,
     const uint8_t *key_buffer,
     size_t key_buffer_size,
-    psa_algorithm_t alg );
+    psa_algorithm_t alg);
 
 psa_status_t mbedtls_test_opaque_mac_verify_setup(
     mbedtls_opaque_test_driver_mac_operation_t *operation,
     const psa_key_attributes_t *attributes,
     const uint8_t *key_buffer,
     size_t key_buffer_size,
-    psa_algorithm_t alg );
+    psa_algorithm_t alg);
 
 psa_status_t mbedtls_test_opaque_mac_update(
     mbedtls_opaque_test_driver_mac_operation_t *operation,
     const uint8_t *input,
-    size_t input_length );
+    size_t input_length);
 
 psa_status_t mbedtls_test_opaque_mac_sign_finish(
     mbedtls_opaque_test_driver_mac_operation_t *operation,
     uint8_t *mac,
     size_t mac_size,
-    size_t *mac_length );
+    size_t *mac_length);
 
 psa_status_t mbedtls_test_opaque_mac_verify_finish(
     mbedtls_opaque_test_driver_mac_operation_t *operation,
     const uint8_t *mac,
-    size_t mac_length );
+    size_t mac_length);
 
 psa_status_t mbedtls_test_opaque_mac_abort(
-    mbedtls_opaque_test_driver_mac_operation_t *operation );
+    mbedtls_opaque_test_driver_mac_operation_t *operation);
 
 #endif /* PSA_CRYPTO_DRIVER_TEST */
 #endif /* PSA_CRYPTO_TEST_DRIVERS_MAC_H */
diff --git a/tests/include/test/drivers/signature.h b/tests/include/test/drivers/signature.h
index 5e64edc..4a2465b 100644
--- a/tests/include/test/drivers/signature.h
+++ b/tests/include/test/drivers/signature.h
@@ -42,11 +42,11 @@
 
 #define MBEDTLS_TEST_DRIVER_SIGNATURE_INIT { NULL, 0, PSA_SUCCESS, 0 }
 static inline mbedtls_test_driver_signature_hooks_t
-    mbedtls_test_driver_signature_hooks_init( void )
+mbedtls_test_driver_signature_hooks_init(void)
 {
     const mbedtls_test_driver_signature_hooks_t
         v = MBEDTLS_TEST_DRIVER_SIGNATURE_INIT;
-    return( v );
+    return v;
 }
 
 extern mbedtls_test_driver_signature_hooks_t
@@ -63,7 +63,7 @@
     size_t input_length,
     uint8_t *signature,
     size_t signature_size,
-    size_t *signature_length );
+    size_t *signature_length);
 
 psa_status_t mbedtls_test_opaque_signature_sign_message(
     const psa_key_attributes_t *attributes,
@@ -74,7 +74,7 @@
     size_t input_length,
     uint8_t *signature,
     size_t signature_size,
-    size_t *signature_length );
+    size_t *signature_length);
 
 psa_status_t mbedtls_test_transparent_signature_verify_message(
     const psa_key_attributes_t *attributes,
@@ -84,7 +84,7 @@
     const uint8_t *input,
     size_t input_length,
     const uint8_t *signature,
-    size_t signature_length );
+    size_t signature_length);
 
 psa_status_t mbedtls_test_opaque_signature_verify_message(
     const psa_key_attributes_t *attributes,
@@ -94,35 +94,35 @@
     const uint8_t *input,
     size_t input_length,
     const uint8_t *signature,
-    size_t signature_length );
+    size_t signature_length);
 
 psa_status_t mbedtls_test_transparent_signature_sign_hash(
     const psa_key_attributes_t *attributes,
     const uint8_t *key, size_t key_length,
     psa_algorithm_t alg,
     const uint8_t *hash, size_t hash_length,
-    uint8_t *signature, size_t signature_size, size_t *signature_length );
+    uint8_t *signature, size_t signature_size, size_t *signature_length);
 
 psa_status_t mbedtls_test_opaque_signature_sign_hash(
     const psa_key_attributes_t *attributes,
     const uint8_t *key, size_t key_length,
     psa_algorithm_t alg,
     const uint8_t *hash, size_t hash_length,
-    uint8_t *signature, size_t signature_size, size_t *signature_length );
+    uint8_t *signature, size_t signature_size, size_t *signature_length);
 
 psa_status_t mbedtls_test_transparent_signature_verify_hash(
     const psa_key_attributes_t *attributes,
     const uint8_t *key, size_t key_length,
     psa_algorithm_t alg,
     const uint8_t *hash, size_t hash_length,
-    const uint8_t *signature, size_t signature_length );
+    const uint8_t *signature, size_t signature_length);
 
 psa_status_t mbedtls_test_opaque_signature_verify_hash(
     const psa_key_attributes_t *attributes,
     const uint8_t *key, size_t key_length,
     psa_algorithm_t alg,
     const uint8_t *hash, size_t hash_length,
-    const uint8_t *signature, size_t signature_length );
+    const uint8_t *signature, size_t signature_length);
 
 #endif /* PSA_CRYPTO_DRIVER_TEST */
 #endif /* PSA_CRYPTO_TEST_DRIVERS_SIGNATURE_H */
diff --git a/tests/include/test/drivers/size.h b/tests/include/test/drivers/size.h
index b2665bd..9d0adcf 100644
--- a/tests/include/test/drivers/size.h
+++ b/tests/include/test/drivers/size.h
@@ -31,7 +31,7 @@
 
 size_t mbedtls_test_size_function(
     const psa_key_type_t key_type,
-    const size_t key_bits );
+    const size_t key_bits);
 
 #endif /* PSA_CRYPTO_DRIVER_TEST */
 #endif /* PSA_CRYPTO_TEST_DRIVERS_SIZE_H */
diff --git a/tests/include/test/fake_external_rng_for_test.h b/tests/include/test/fake_external_rng_for_test.h
index faeef22..ad8e1c6 100644
--- a/tests/include/test/fake_external_rng_for_test.h
+++ b/tests/include/test/fake_external_rng_for_test.h
@@ -44,13 +44,13 @@
  * of the PSA subsystem. You may disable it temporarily to simulate a
  * depleted entropy source.
  */
-void mbedtls_test_enable_insecure_external_rng( void );
+void mbedtls_test_enable_insecure_external_rng(void);
 
 /** Disable the insecure implementation of mbedtls_psa_external_get_random().
  *
  * See mbedtls_test_enable_insecure_external_rng().
  */
-void mbedtls_test_disable_insecure_external_rng( void );
+void mbedtls_test_disable_insecure_external_rng(void);
 #endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
 
 #endif /* FAKE_EXTERNAL_RNG_FOR_TEST_H */
diff --git a/tests/include/test/helpers.h b/tests/include/test/helpers.h
index 7a87c5b..9d60c20 100644
--- a/tests/include/test/helpers.h
+++ b/tests/include/test/helpers.h
@@ -46,21 +46,18 @@
 #endif
 
 /** The type of test case arguments that contain binary data. */
-typedef struct data_tag
-{
-    uint8_t *   x;
+typedef struct data_tag {
+    uint8_t *x;
     uint32_t    len;
 } data_t;
 
-typedef enum
-{
+typedef enum {
     MBEDTLS_TEST_RESULT_SUCCESS = 0,
     MBEDTLS_TEST_RESULT_FAILED,
     MBEDTLS_TEST_RESULT_SKIPPED
 } mbedtls_test_result_t;
 
-typedef struct
-{
+typedef struct {
     mbedtls_test_result_t result;
     const char *test;
     const char *filename;
@@ -75,8 +72,8 @@
 mbedtls_test_info_t;
 extern mbedtls_test_info_t mbedtls_test_info;
 
-int mbedtls_test_platform_setup( void );
-void mbedtls_test_platform_teardown( void );
+int mbedtls_test_platform_setup(void);
+void mbedtls_test_platform_teardown(void);
 
 /**
  * \brief           Record the current test case as a failure.
@@ -94,7 +91,7 @@
  * \param line_no   Line number where the failure originated.
  * \param filename  Filename where the failure originated.
  */
-void mbedtls_test_fail( const char *test, int line_no, const char* filename );
+void mbedtls_test_fail(const char *test, int line_no, const char *filename);
 
 /**
  * \brief           Record the current test case as skipped.
@@ -107,7 +104,7 @@
  * \param line_no   Line number where the test case was skipped.
  * \param filename  Filename where the test case was skipped.
  */
-void mbedtls_test_skip( const char *test, int line_no, const char* filename );
+void mbedtls_test_skip(const char *test, int line_no, const char *filename);
 
 /**
  * \brief       Set the test step number for failure reports.
@@ -119,12 +116,12 @@
  *
  * \param step  The step number to report.
  */
-void mbedtls_test_set_step( unsigned long step );
+void mbedtls_test_set_step(unsigned long step);
 
 /**
  * \brief       Reset mbedtls_test_info to a ready/starting state.
  */
-void mbedtls_test_info_reset( void );
+void mbedtls_test_info_reset(void);
 
 /**
  * \brief           Record the current test case as a failure if two integers
@@ -144,8 +141,8 @@
  *
  * \return          \c 1 if the values are equal, otherwise \c 0.
  */
-int mbedtls_test_equal( const char *test, int line_no, const char* filename,
-                        unsigned long long value1, unsigned long long value2 );
+int mbedtls_test_equal(const char *test, int line_no, const char *filename,
+                       unsigned long long value1, unsigned long long value2);
 
 /**
  * \brief           Record the current test case as a failure based
@@ -165,8 +162,8 @@
  *
  * \return          \c 1 if \p value1 <= \p value2, otherwise \c 0.
  */
-int mbedtls_test_le_u( const char *test, int line_no, const char* filename,
-                       unsigned long long value1, unsigned long long value2 );
+int mbedtls_test_le_u(const char *test, int line_no, const char *filename,
+                      unsigned long long value1, unsigned long long value2);
 
 /**
  * \brief           Record the current test case as a failure based
@@ -186,8 +183,8 @@
  *
  * \return          \c 1 if \p value1 <= \p value2, otherwise \c 0.
  */
-int mbedtls_test_le_s( const char *test, int line_no, const char* filename,
-                       long long value1, long long value2 );
+int mbedtls_test_le_s(const char *test, int line_no, const char *filename,
+                      long long value1, long long value2);
 
 /**
  * \brief          This function decodes the hexadecimal representation of
@@ -207,12 +204,12 @@
  * \return         \c -1 if the output buffer is too small or the input string
  *                 is not a valid hexadecimal representation.
  */
-int mbedtls_test_unhexify( unsigned char *obuf, size_t obufmax,
-                           const char *ibuf, size_t *len );
+int mbedtls_test_unhexify(unsigned char *obuf, size_t obufmax,
+                          const char *ibuf, size_t *len);
 
-void mbedtls_test_hexify( unsigned char *obuf,
-                          const unsigned char *ibuf,
-                          int len );
+void mbedtls_test_hexify(unsigned char *obuf,
+                         const unsigned char *ibuf,
+                         int len);
 
 /**
  * Allocate and zeroize a buffer.
@@ -221,7 +218,7 @@
  *
  * For convenience, dies if allocation fails.
  */
-unsigned char *mbedtls_test_zero_alloc( size_t len );
+unsigned char *mbedtls_test_zero_alloc(size_t len);
 
 /**
  * Allocate and fill a buffer from hex data.
@@ -233,15 +230,14 @@
  *
  * For convenience, dies if allocation fails.
  */
-unsigned char *mbedtls_test_unhexify_alloc( const char *ibuf, size_t *olen );
+unsigned char *mbedtls_test_unhexify_alloc(const char *ibuf, size_t *olen);
 
-int mbedtls_test_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);
 
 #if defined(MBEDTLS_CHECK_PARAMS)
 
-typedef struct
-{
+typedef struct {
     const char *failure_condition;
     const char *file;
     int line;
@@ -257,7 +253,7 @@
  *          mbedtls_param_failed() that cancels it.
  */
 void mbedtls_test_param_failed_get_location_record(
-         mbedtls_test_param_failed_location_record_t *location_record );
+    mbedtls_test_param_failed_location_record_t *location_record);
 
 /**
  * \brief   State that a call to mbedtls_param_failed() is expected.
@@ -266,7 +262,7 @@
  *          mbedtls_test_param_failed_check_expected_call() or
  *          mbedtls_param_failed that cancel it.
  */
-void mbedtls_test_param_failed_expect_call( void );
+void mbedtls_test_param_failed_expect_call(void);
 
 /**
  * \brief   Check whether mbedtls_param_failed() has been called as expected.
@@ -279,7 +275,7 @@
  *               mbedtls_param_failed() has been called.
  *          \c -1 Otherwise.
  */
-int mbedtls_test_param_failed_check_expected_call( void );
+int mbedtls_test_param_failed_check_expected_call(void);
 
 /**
  * \brief   Get the address of the object of type jmp_buf holding the execution
@@ -308,7 +304,7 @@
  * \return  Address of the object of type jmp_buf holding the execution state
  *          information used by mbedtls_param_failed() to do a long jump.
  */
-void* mbedtls_test_param_failed_get_state_buf( void );
+void *mbedtls_test_param_failed_get_state_buf(void);
 
 /**
  * \brief   Reset the execution state used by mbedtls_param_failed() to do a
@@ -324,7 +320,7 @@
  *          mbedtls_param_failed() will not trigger a long jump with
  *          undefined behavior but rather a long jump that will rather fault.
  */
-void mbedtls_test_param_failed_reset_state( void );
+void mbedtls_test_param_failed_reset_state(void);
 #endif /* MBEDTLS_CHECK_PARAMS */
 
 #if defined(MBEDTLS_PSA_CRYPTO_C) && defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
@@ -334,11 +330,11 @@
 #if defined(MBEDTLS_TEST_MUTEX_USAGE)
 /** Permanently activate the mutex usage verification framework. See
  * threading_helpers.c for information. */
-void mbedtls_test_mutex_usage_init( void );
+void mbedtls_test_mutex_usage_init(void);
 
 /** Call this function after executing a test case to check for mutex usage
  * errors. */
-void mbedtls_test_mutex_usage_check( void );
+void mbedtls_test_mutex_usage_check(void);
 #endif /* MBEDTLS_TEST_MUTEX_USAGE */
 
 #if defined(MBEDTLS_TEST_HOOKS)
@@ -353,8 +349,8 @@
  *
  * \note    If the check fails, fail the test currently being run.
  */
-void mbedtls_test_err_add_check( int high, int low,
-                                 const char *file, int line);
+void mbedtls_test_err_add_check(int high, int low,
+                                const char *file, int line);
 #endif
 
 #if defined(MBEDTLS_BIGNUM_C)
@@ -379,7 +375,7 @@
  *
  * \return \c 0 on success, an \c MBEDTLS_ERR_MPI_xxx error code otherwise.
  */
-int mbedtls_test_read_mpi( mbedtls_mpi *X, const char *s );
+int mbedtls_test_read_mpi(mbedtls_mpi *X, const char *s);
 
 /** Nonzero if the current test case had an input parsed with
  * mbedtls_test_read_mpi() that is a negative 0 (`"-"`, `"-0"`, `"-00"`, etc.,
diff --git a/tests/include/test/macros.h b/tests/include/test/macros.h
index f9de646..2354205 100644
--- a/tests/include/test/macros.h
+++ b/tests/include/test/macros.h
@@ -62,14 +62,14 @@
  *
  * \param   TEST    The test expression to be tested.
  */
-#define TEST_ASSERT( TEST )                                 \
+#define TEST_ASSERT(TEST)                                 \
     do {                                                    \
-       if( ! (TEST) )                                       \
-       {                                                    \
-          mbedtls_test_fail( #TEST, __LINE__, __FILE__ );   \
-          goto exit;                                        \
-       }                                                    \
-    } while( 0 )
+        if (!(TEST))                                       \
+        {                                                    \
+            mbedtls_test_fail( #TEST, __LINE__, __FILE__);   \
+            goto exit;                                        \
+        }                                                    \
+    } while (0)
 
 /** Evaluate two integer expressions and fail the test case if they have
  * different values.
@@ -80,12 +80,12 @@
  * \param expr1     An integral-typed expression to evaluate.
  * \param expr2     Another integral-typed expression to evaluate.
  */
-#define TEST_EQUAL( expr1, expr2 )                                      \
+#define TEST_EQUAL(expr1, expr2)                                      \
     do {                                                                \
-        if( ! mbedtls_test_equal( #expr1 " == " #expr2, __LINE__, __FILE__, \
-                                  expr1, expr2 ) )                      \
-            goto exit;                                                  \
-    } while( 0 )
+        if (!mbedtls_test_equal( #expr1 " == " #expr2, __LINE__, __FILE__, \
+                                 expr1, expr2))                      \
+        goto exit;                                                  \
+    } while (0)
 
 /** Evaluate two unsigned integer expressions and fail the test case
  * if they are not in increasing order (left <= right).
@@ -93,12 +93,12 @@
  * \param expr1     An integral-typed expression to evaluate.
  * \param expr2     Another integral-typed expression to evaluate.
  */
-#define TEST_LE_U( expr1, expr2 )                                       \
+#define TEST_LE_U(expr1, expr2)                                       \
     do {                                                                \
-        if( ! mbedtls_test_le_u( #expr1 " <= " #expr2, __LINE__, __FILE__, \
-                                 expr1, expr2 ) )                      \
-            goto exit;                                                  \
-    } while( 0 )
+        if (!mbedtls_test_le_u( #expr1 " <= " #expr2, __LINE__, __FILE__, \
+                                expr1, expr2))                      \
+        goto exit;                                                  \
+    } while (0)
 
 /** Evaluate two signed integer expressions and fail the test case
  * if they are not in increasing order (left <= right).
@@ -106,12 +106,12 @@
  * \param expr1     An integral-typed expression to evaluate.
  * \param expr2     Another integral-typed expression to evaluate.
  */
-#define TEST_LE_S( expr1, expr2 )                                       \
+#define TEST_LE_S(expr1, expr2)                                       \
     do {                                                                \
-        if( ! mbedtls_test_le_s( #expr1 " <= " #expr2, __LINE__, __FILE__, \
-                                 expr1, expr2 ) )                      \
-            goto exit;                                                  \
-    } while( 0 )
+        if (!mbedtls_test_le_s( #expr1 " <= " #expr2, __LINE__, __FILE__, \
+                                expr1, expr2))                      \
+        goto exit;                                                  \
+    } while (0)
 
 /** Allocate memory dynamically and fail the test case if this fails.
  * The allocated memory will be filled with zeros.
@@ -133,36 +133,36 @@
  *                  This expression may be evaluated multiple times.
  *
  */
-#define ASSERT_ALLOC( pointer, length )                           \
+#define ASSERT_ALLOC(pointer, length)                           \
     do                                                            \
     {                                                             \
-        TEST_ASSERT( ( pointer ) == NULL );                       \
-        if( ( length ) != 0 )                                     \
+        TEST_ASSERT((pointer) == NULL);                       \
+        if ((length) != 0)                                     \
         {                                                         \
-            ( pointer ) = mbedtls_calloc( sizeof( *( pointer ) ), \
-                                          ( length ) );           \
-            TEST_ASSERT( ( pointer ) != NULL );                   \
+            (pointer) = mbedtls_calloc(sizeof(*(pointer)), \
+                                       (length));           \
+            TEST_ASSERT((pointer) != NULL);                   \
         }                                                         \
     }                                                             \
-    while( 0 )
+    while (0)
 
 /** Allocate memory dynamically. If the allocation fails, skip the test case.
  *
  * This macro behaves like #ASSERT_ALLOC, except that if the allocation
  * fails, it marks the test as skipped rather than failed.
  */
-#define ASSERT_ALLOC_WEAK( pointer, length )                      \
+#define ASSERT_ALLOC_WEAK(pointer, length)                      \
     do                                                            \
     {                                                             \
-        TEST_ASSERT( ( pointer ) == NULL );                       \
-        if( ( length ) != 0 )                                     \
+        TEST_ASSERT((pointer) == NULL);                       \
+        if ((length) != 0)                                     \
         {                                                         \
-            ( pointer ) = mbedtls_calloc( sizeof( *( pointer ) ), \
-                                          ( length ) );           \
-            TEST_ASSUME( ( pointer ) != NULL );                   \
+            (pointer) = mbedtls_calloc(sizeof(*(pointer)), \
+                                       (length));           \
+            TEST_ASSUME((pointer) != NULL);                   \
         }                                                         \
     }                                                             \
-    while( 0 )
+    while (0)
 
 /** Compare two buffers and fail the test case if they differ.
  *
@@ -176,14 +176,14 @@
  * \param size2     Size of the second buffer in bytes.
  *                  This expression may be evaluated multiple times.
  */
-#define ASSERT_COMPARE( p1, size1, p2, size2 )                          \
+#define ASSERT_COMPARE(p1, size1, p2, size2)                          \
     do                                                                  \
     {                                                                   \
-        TEST_ASSERT( ( size1 ) == ( size2 ) );                          \
-        if( ( size1 ) != 0 )                                            \
-            TEST_ASSERT( memcmp( ( p1 ), ( p2 ), ( size1 ) ) == 0 );    \
+        TEST_ASSERT((size1) == (size2));                          \
+        if ((size1) != 0)                                            \
+        TEST_ASSERT(memcmp((p1), (p2), (size1)) == 0);    \
     }                                                                   \
-    while( 0 )
+    while (0)
 
 /**
  * \brief   This macro tests the expression passed to it and skips the
@@ -191,14 +191,14 @@
  *
  * \param   TEST    The test expression to be tested.
  */
-#define TEST_ASSUME( TEST )                                 \
+#define TEST_ASSUME(TEST)                                 \
     do {                                                    \
-        if( ! (TEST) )                                      \
+        if (!(TEST))                                      \
         {                                                   \
-            mbedtls_test_skip( #TEST, __LINE__, __FILE__ ); \
+            mbedtls_test_skip( #TEST, __LINE__, __FILE__); \
             goto exit;                                      \
         }                                                   \
-    } while( 0 )
+    } while (0)
 
 #if defined(MBEDTLS_CHECK_PARAMS) && !defined(MBEDTLS_PARAM_FAILED_ALT)
 /**
@@ -221,17 +221,17 @@
  *
  * \param   TEST                The test expression to be tested.
  */
-#define TEST_INVALID_PARAM_RET( PARAM_ERR_VALUE, TEST )                 \
+#define TEST_INVALID_PARAM_RET(PARAM_ERR_VALUE, TEST)                 \
     do {                                                                \
-        mbedtls_test_param_failed_expect_call( );                       \
-        if( ( ( TEST ) != ( PARAM_ERR_VALUE ) ) ||                      \
-            ( mbedtls_test_param_failed_check_expected_call( ) != 0 ) ) \
+        mbedtls_test_param_failed_expect_call();                       \
+        if (((TEST) != (PARAM_ERR_VALUE)) ||                      \
+            (mbedtls_test_param_failed_check_expected_call() != 0)) \
         {                                                               \
-            mbedtls_test_fail( #TEST, __LINE__, __FILE__ );             \
+            mbedtls_test_fail( #TEST, __LINE__, __FILE__);             \
             goto exit;                                                  \
         }                                                               \
-        mbedtls_test_param_failed_check_expected_call( );               \
-   } while( 0 )
+        mbedtls_test_param_failed_check_expected_call();               \
+    } while (0)
 
 /**
  * \brief   This macro tests the statement passed to it as a test step or
@@ -253,18 +253,18 @@
  *
  * \param   TEST                The test expression to be tested.
  */
-#define TEST_INVALID_PARAM( TEST )                                       \
+#define TEST_INVALID_PARAM(TEST)                                       \
     do {                                                                 \
-        memcpy( jmp_tmp, mbedtls_test_param_failed_get_state_buf( ),     \
-                sizeof( jmp_tmp ) );                                     \
-        if( setjmp(  mbedtls_test_param_failed_get_state_buf( ) ) == 0 ) \
+        memcpy(jmp_tmp, mbedtls_test_param_failed_get_state_buf(),     \
+               sizeof(jmp_tmp));                                     \
+        if (setjmp(mbedtls_test_param_failed_get_state_buf()) == 0) \
         {                                                                \
             TEST;                                                        \
-            mbedtls_test_fail( #TEST, __LINE__, __FILE__ );              \
+            mbedtls_test_fail( #TEST, __LINE__, __FILE__);              \
             goto exit;                                                   \
         }                                                                \
-        mbedtls_test_param_failed_reset_state( );                        \
-    } while( 0 )
+        mbedtls_test_param_failed_reset_state();                        \
+    } while (0)
 #endif /* MBEDTLS_CHECK_PARAMS && !MBEDTLS_PARAM_FAILED_ALT */
 
 /**
@@ -298,15 +298,15 @@
  *
  * \param   TEST                The test expression to be tested.
  */
-#define TEST_VALID_PARAM( TEST )                                    \
-    TEST_ASSERT( ( TEST, 1 ) );
+#define TEST_VALID_PARAM(TEST)                                    \
+    TEST_ASSERT((TEST, 1));
 
-#define TEST_HELPER_ASSERT(a) if( !( a ) )                          \
-{                                                                   \
-    mbedtls_fprintf( stderr, "Assertion Failed at %s:%d - %s\n",    \
-                             __FILE__, __LINE__, #a );              \
-    mbedtls_exit( 1 );                                              \
-}
+#define TEST_HELPER_ASSERT(a) if (!(a))                          \
+    {                                                                   \
+        mbedtls_fprintf(stderr, "Assertion Failed at %s:%d - %s\n",    \
+                        __FILE__, __LINE__, #a);              \
+        mbedtls_exit(1);                                              \
+    }
 
 /** \def ARRAY_LENGTH
  * Return the number of elements of a static or stack array.
@@ -317,34 +317,34 @@
  */
 /* A correct implementation of ARRAY_LENGTH, but which silently gives
  * a nonsensical result if called with a pointer rather than an array. */
-#define ARRAY_LENGTH_UNSAFE( array )            \
-    ( sizeof( array ) / sizeof( *( array ) ) )
+#define ARRAY_LENGTH_UNSAFE(array)            \
+    (sizeof(array) / sizeof(*(array)))
 
 #if defined(__GNUC__)
 /* Test if arg and &(arg)[0] have the same type. This is true if arg is
  * an array but not if it's a pointer. */
-#define IS_ARRAY_NOT_POINTER( arg )                                     \
-    ( ! __builtin_types_compatible_p( __typeof__( arg ),                \
-                                      __typeof__( &( arg )[0] ) ) )
+#define IS_ARRAY_NOT_POINTER(arg)                                     \
+    (!__builtin_types_compatible_p(__typeof__(arg),                \
+                                   __typeof__(&(arg)[0])))
 /* A compile-time constant with the value 0. If `const_expr` is not a
  * compile-time constant with a nonzero value, cause a compile-time error. */
-#define STATIC_ASSERT_EXPR( const_expr )                                \
-    ( 0 && sizeof( struct { unsigned int STATIC_ASSERT : 1 - 2 * ! ( const_expr ); } ) )
+#define STATIC_ASSERT_EXPR(const_expr)                                \
+    (0 && sizeof(struct { unsigned int STATIC_ASSERT : 1 - 2 * !(const_expr); }))
 
 /* Return the scalar value `value` (possibly promoted). This is a compile-time
  * constant if `value` is. `condition` must be a compile-time constant.
  * If `condition` is false, arrange to cause a compile-time error. */
-#define STATIC_ASSERT_THEN_RETURN( condition, value )   \
-    ( STATIC_ASSERT_EXPR( condition ) ? 0 : ( value ) )
+#define STATIC_ASSERT_THEN_RETURN(condition, value)   \
+    (STATIC_ASSERT_EXPR(condition) ? 0 : (value))
 
-#define ARRAY_LENGTH( array )                                           \
-    ( STATIC_ASSERT_THEN_RETURN( IS_ARRAY_NOT_POINTER( array ),         \
-                                 ARRAY_LENGTH_UNSAFE( array ) ) )
+#define ARRAY_LENGTH(array)                                           \
+    (STATIC_ASSERT_THEN_RETURN(IS_ARRAY_NOT_POINTER(array),         \
+                               ARRAY_LENGTH_UNSAFE(array)))
 
 #else
 /* If we aren't sure the compiler supports our non-standard tricks,
  * fall back to the unsafe implementation. */
-#define ARRAY_LENGTH( array ) ARRAY_LENGTH_UNSAFE( array )
+#define ARRAY_LENGTH(array) ARRAY_LENGTH_UNSAFE(array)
 #endif
 
 /** Return the smaller of two values.
@@ -354,7 +354,7 @@
  *
  * \return The smaller of \p x and \p y.
  */
-#define MIN( x, y ) ( ( x ) < ( y ) ? ( x ) : ( y ) )
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
 
 /** Return the larger of two values.
  *
@@ -363,29 +363,29 @@
  *
  * \return The larger of \p x and \p y.
  */
-#define MAX( x, y ) ( ( x ) > ( y ) ? ( x ) : ( y ) )
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
 
 /*
  * 32-bit integer manipulation macros (big endian)
  */
 #ifndef GET_UINT32_BE
-#define GET_UINT32_BE(n,b,i)                            \
-{                                                       \
-    (n) = ( (uint32_t) (b)[(i)    ] << 24 )             \
-        | ( (uint32_t) (b)[(i) + 1] << 16 )             \
-        | ( (uint32_t) (b)[(i) + 2] <<  8 )             \
-        | ( (uint32_t) (b)[(i) + 3]       );            \
-}
+#define GET_UINT32_BE(n, b, i)                            \
+    {                                                       \
+        (n) = ((uint32_t) (b)[(i)] << 24)             \
+              | ((uint32_t) (b)[(i) + 1] << 16)             \
+              | ((uint32_t) (b)[(i) + 2] <<  8)             \
+              | ((uint32_t) (b)[(i) + 3]);            \
+    }
 #endif
 
 #ifndef PUT_UINT32_BE
-#define PUT_UINT32_BE(n,b,i)                            \
-{                                                       \
-    (b)[(i)    ] = (unsigned char) ( (n) >> 24 );       \
-    (b)[(i) + 1] = (unsigned char) ( (n) >> 16 );       \
-    (b)[(i) + 2] = (unsigned char) ( (n) >>  8 );       \
-    (b)[(i) + 3] = (unsigned char) ( (n)       );       \
-}
+#define PUT_UINT32_BE(n, b, i)                            \
+    {                                                       \
+        (b)[(i)] = (unsigned char) ((n) >> 24);       \
+        (b)[(i) + 1] = (unsigned char) ((n) >> 16);       \
+        (b)[(i) + 2] = (unsigned char) ((n) >>  8);       \
+        (b)[(i) + 3] = (unsigned char) ((n));       \
+    }
 #endif
 
 #endif /* TEST_MACROS_H */
diff --git a/tests/include/test/psa_crypto_helpers.h b/tests/include/test/psa_crypto_helpers.h
index 7dc829b..08179e2 100644
--- a/tests/include/test/psa_crypto_helpers.h
+++ b/tests/include/test/psa_crypto_helpers.h
@@ -36,11 +36,11 @@
 #if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C)
 
 /* Internal function for #TEST_USES_KEY_ID. Return 1 on success, 0 on failure. */
-int mbedtls_test_uses_key_id( mbedtls_svc_key_id_t key_id );
+int mbedtls_test_uses_key_id(mbedtls_svc_key_id_t key_id);
 
 /** Destroy persistent keys recorded with #TEST_USES_KEY_ID.
  */
-void mbedtls_test_psa_purge_key_storage( void );
+void mbedtls_test_psa_purge_key_storage(void);
 
 /** Purge the in-memory cache of persistent keys recorded with
  * #TEST_USES_KEY_ID.
@@ -48,7 +48,7 @@
  * Call this function before calling PSA_DONE() if it's ok for
  * persistent keys to still exist at this point.
  */
-void mbedtls_test_psa_purge_key_cache( void );
+void mbedtls_test_psa_purge_key_cache(void);
 
 /** \def TEST_USES_KEY_ID
  *
@@ -75,18 +75,18 @@
  *
  * \param key_id    The PSA key identifier to record.
  */
-#define TEST_USES_KEY_ID( key_id )                      \
-    TEST_ASSERT( mbedtls_test_uses_key_id( key_id ) )
+#define TEST_USES_KEY_ID(key_id)                      \
+    TEST_ASSERT(mbedtls_test_uses_key_id(key_id))
 
 #else /* MBEDTLS_PSA_CRYPTO_STORAGE_C */
 
-#define TEST_USES_KEY_ID( key_id ) ( (void) ( key_id ) )
-#define mbedtls_test_psa_purge_key_storage( ) ( (void) 0 )
-#define mbedtls_test_psa_purge_key_cache( ) ( (void) 0 )
+#define TEST_USES_KEY_ID(key_id) ((void) (key_id))
+#define mbedtls_test_psa_purge_key_storage() ((void) 0)
+#define mbedtls_test_psa_purge_key_cache() ((void) 0)
 
 #endif /* MBEDTLS_PSA_CRYPTO_STORAGE_C */
 
-#define PSA_INIT( ) PSA_ASSERT( psa_crypto_init( ) )
+#define PSA_INIT() PSA_ASSERT(psa_crypto_init())
 
 /** Check for things that have not been cleaned up properly in the
  * PSA subsystem.
@@ -95,7 +95,7 @@
  * \return A string literal explaining what has not been cleaned up
  *         if applicable.
  */
-const char *mbedtls_test_helper_is_psa_leaking( void );
+const char *mbedtls_test_helper_is_psa_leaking(void);
 
 /** Check that no PSA Crypto key slots are in use.
  *
@@ -104,13 +104,13 @@
  * `TEST_ASSERT( ! mbedtls_test_helper_is_psa_leaking( ) )`
  * but with a more informative message.
  */
-#define ASSERT_PSA_PRISTINE( )                                          \
+#define ASSERT_PSA_PRISTINE()                                          \
     do                                                                  \
     {                                                                   \
-        if( test_fail_if_psa_leaking( __LINE__, __FILE__ ) )            \
-            goto exit;                                                  \
+        if (test_fail_if_psa_leaking(__LINE__, __FILE__))            \
+        goto exit;                                                  \
     }                                                                   \
-    while( 0 )
+    while (0)
 
 /** Shut down the PSA Crypto subsystem and destroy persistent keys.
  * Expect a clean shutdown, with no slots in use.
@@ -122,14 +122,14 @@
  * \note Persistent keys must be recorded with #TEST_USES_KEY_ID before
  *       creating them.
  */
-#define PSA_DONE( )                                                     \
+#define PSA_DONE()                                                     \
     do                                                                  \
     {                                                                   \
-        test_fail_if_psa_leaking( __LINE__, __FILE__ );                 \
-        mbedtls_test_psa_purge_key_storage( );                          \
-        mbedtls_psa_crypto_free( );                                     \
+        test_fail_if_psa_leaking(__LINE__, __FILE__);                 \
+        mbedtls_test_psa_purge_key_storage();                          \
+        mbedtls_psa_crypto_free();                                     \
     }                                                                   \
-    while( 0 )
+    while (0)
 
 /** Shut down the PSA Crypto subsystem, allowing persistent keys to survive.
  * Expect a clean shutdown, with no slots in use.
@@ -137,22 +137,22 @@
  * If some key slots are still in use, record the test case as failed and
  * jump to the `exit` label.
  */
-#define PSA_SESSION_DONE( )                                             \
+#define PSA_SESSION_DONE()                                             \
     do                                                                  \
     {                                                                   \
-        mbedtls_test_psa_purge_key_cache( );                            \
-        ASSERT_PSA_PRISTINE( );                                         \
-        mbedtls_psa_crypto_free( );                                     \
+        mbedtls_test_psa_purge_key_cache();                            \
+        ASSERT_PSA_PRISTINE();                                         \
+        mbedtls_psa_crypto_free();                                     \
     }                                                                   \
-    while( 0 )
+    while (0)
 
 
 
 #if defined(RECORD_PSA_STATUS_COVERAGE_LOG)
-psa_status_t mbedtls_test_record_status( psa_status_t status,
-                                         const char *func,
-                                         const char *file, int line,
-                                         const char *expr );
+psa_status_t mbedtls_test_record_status(psa_status_t status,
+                                        const char *func,
+                                        const char *file, int line,
+                                        const char *expr);
 
 /** Return value logging wrapper macro.
  *
@@ -178,8 +178,8 @@
  *                  a value of type #psa_status_t.
  * \return          The value of \p expr.
  */
-#define RECORD_STATUS( string, expr )                                   \
-    mbedtls_test_record_status( ( expr ), string, __FILE__, __LINE__, #expr )
+#define RECORD_STATUS(string, expr)                                   \
+    mbedtls_test_record_status((expr), string, __FILE__, __LINE__, #expr)
 
 #include "instrument_record_status.h"
 
@@ -191,7 +191,7 @@
  * permissions of other usage policies
  * (like PSA_KEY_USAGE_SIGN_HASH involves PSA_KEY_USAGE_SIGN_MESSAGE).
  */
-psa_key_usage_t mbedtls_test_update_key_usage_flags( psa_key_usage_t usage_flags );
+psa_key_usage_t mbedtls_test_update_key_usage_flags(psa_key_usage_t usage_flags);
 
 /** Skip a test case if the given key is a 192 bits AES key and the AES
  *  implementation is at least partially provided by an accelerator or
@@ -220,18 +220,18 @@
 #define MBEDTLS_TEST_HAVE_ALT_AES 0
 #endif
 
-#define MBEDTLS_TEST_PSA_SKIP_IF_ALT_AES_192( key_type, key_bits )        \
+#define MBEDTLS_TEST_PSA_SKIP_IF_ALT_AES_192(key_type, key_bits)        \
     do                                                                    \
     {                                                                     \
-        if( ( MBEDTLS_TEST_HAVE_ALT_AES ) &&                              \
-            ( ( key_type ) == PSA_KEY_TYPE_AES ) &&                       \
-            ( key_bits == 192 ) )                                         \
+        if ((MBEDTLS_TEST_HAVE_ALT_AES) &&                              \
+            ((key_type) == PSA_KEY_TYPE_AES) &&                       \
+            (key_bits == 192))                                         \
         {                                                                 \
-            mbedtls_test_skip( "AES-192 not supported", __LINE__, __FILE__ );     \
+            mbedtls_test_skip("AES-192 not supported", __LINE__, __FILE__);     \
             goto exit;                                                    \
         }                                                                 \
     }                                                                     \
-    while( 0 )
+    while (0)
 
 /** Skip a test case if a GCM operation with a nonce length different from
  *  12 bytes fails and was performed by an accelerator or alternative
@@ -262,20 +262,20 @@
 #define MBEDTLS_TEST_HAVE_ALT_GCM  0
 #endif
 
-#define MBEDTLS_TEST_PSA_SKIP_IF_ALT_GCM_NOT_12BYTES_NONCE( alg,           \
-                                                            nonce_length ) \
+#define MBEDTLS_TEST_PSA_SKIP_IF_ALT_GCM_NOT_12BYTES_NONCE(alg,           \
+                                                           nonce_length) \
     do                                                                     \
     {                                                                      \
-        if( ( MBEDTLS_TEST_HAVE_ALT_GCM ) &&                               \
-            ( PSA_ALG_AEAD_WITH_SHORTENED_TAG( ( alg ) , 0 ) ==            \
-              PSA_ALG_AEAD_WITH_SHORTENED_TAG( PSA_ALG_GCM, 0 ) ) &&       \
-            ( ( nonce_length ) != 12 ) )                                   \
+        if ((MBEDTLS_TEST_HAVE_ALT_GCM) &&                               \
+            (PSA_ALG_AEAD_WITH_SHORTENED_TAG((alg), 0) ==            \
+             PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_GCM, 0)) &&       \
+            ((nonce_length) != 12))                                   \
         {                                                                  \
-            mbedtls_test_skip( "GCM with non-12-byte IV is not supported", __LINE__, __FILE__ ); \
+            mbedtls_test_skip("GCM with non-12-byte IV is not supported", __LINE__, __FILE__); \
             goto exit;                                                     \
         }                                                                  \
     }                                                                      \
-    while( 0 )
+    while (0)
 
 #endif /* MBEDTLS_PSA_CRYPTO_C */
 
@@ -292,14 +292,14 @@
  * #MBEDTLS_USE_PSA_CRYPTO is disabled.
  */
 #if defined(MBEDTLS_USE_PSA_CRYPTO)
-#define USE_PSA_INIT( ) PSA_INIT( )
-#define USE_PSA_DONE( ) PSA_DONE( )
+#define USE_PSA_INIT() PSA_INIT()
+#define USE_PSA_DONE() PSA_DONE()
 #else /* MBEDTLS_USE_PSA_CRYPTO */
 /* Define empty macros so that we can use them in the preamble and teardown
  * of every test function that uses PSA conditionally based on
  * MBEDTLS_USE_PSA_CRYPTO. */
-#define USE_PSA_INIT( ) ( (void) 0 )
-#define USE_PSA_DONE( ) ( (void) 0 )
+#define USE_PSA_INIT() ((void) 0)
+#define USE_PSA_DONE() ((void) 0)
 #endif /* !MBEDTLS_USE_PSA_CRYPTO */
 
 #endif /* PSA_CRYPTO_HELPERS_H */
diff --git a/tests/include/test/psa_exercise_key.h b/tests/include/test/psa_exercise_key.h
index 4306c1a..179df18 100644
--- a/tests/include/test/psa_exercise_key.h
+++ b/tests/include/test/psa_exercise_key.h
@@ -109,7 +109,7 @@
  * This is used in some smoke tests.
  */
 #if defined(KNOWN_SUPPORTED_HASH_ALG) && defined(PSA_WANT_ALG_HMAC)
-#define KNOWN_SUPPORTED_MAC_ALG ( PSA_ALG_HMAC( KNOWN_SUPPORTED_HASH_ALG ) )
+#define KNOWN_SUPPORTED_MAC_ALG (PSA_ALG_HMAC(KNOWN_SUPPORTED_HASH_ALG))
 #define KNOWN_SUPPORTED_MAC_KEY_TYPE PSA_KEY_TYPE_HMAC
 #elif defined(KNOWN_SUPPORTED_BLOCK_CIPHER) && defined(MBEDTLS_CMAC_C)
 #define KNOWN_SUPPORTED_MAC_ALG PSA_ALG_CMAC
@@ -168,12 +168,12 @@
  * \return                  \c 1 on success, \c 0 on failure.
  */
 int mbedtls_test_psa_setup_key_derivation_wrap(
-    psa_key_derivation_operation_t* operation,
+    psa_key_derivation_operation_t *operation,
     mbedtls_svc_key_id_t key,
     psa_algorithm_t alg,
-    const unsigned char* input1, size_t input1_length,
-    const unsigned char* input2, size_t input2_length,
-    size_t capacity );
+    const unsigned char *input1, size_t input1_length,
+    const unsigned char *input2, size_t input2_length,
+    size_t capacity);
 
 /** Perform a key agreement using the given key pair against its public key
  * using psa_raw_key_agreement().
@@ -189,7 +189,7 @@
  */
 psa_status_t mbedtls_test_psa_raw_key_agreement_with_self(
     psa_algorithm_t alg,
-    mbedtls_svc_key_id_t key );
+    mbedtls_svc_key_id_t key);
 
 /** Perform a key agreement using the given key pair against its public key
  * using psa_key_derivation_raw_key().
@@ -208,7 +208,7 @@
  */
 psa_status_t mbedtls_test_psa_key_agreement_with_self(
     psa_key_derivation_operation_t *operation,
-    mbedtls_svc_key_id_t key );
+    mbedtls_svc_key_id_t key);
 
 /** Perform sanity checks on the given key representation.
  *
@@ -230,7 +230,7 @@
  */
 int mbedtls_test_psa_exported_key_sanity_check(
     psa_key_type_t type, size_t bits,
-    const uint8_t *exported, size_t exported_length );
+    const uint8_t *exported, size_t exported_length);
 
 /** Do smoke tests on a key.
  *
@@ -259,11 +259,11 @@
  * \retval 0 The key failed the smoke tests.
  * \retval 1 The key passed the smoke tests.
  */
-int mbedtls_test_psa_exercise_key( mbedtls_svc_key_id_t key,
-                                   psa_key_usage_t usage,
-                                   psa_algorithm_t alg );
+int mbedtls_test_psa_exercise_key(mbedtls_svc_key_id_t key,
+                                  psa_key_usage_t usage,
+                                  psa_algorithm_t alg);
 
-psa_key_usage_t mbedtls_test_psa_usage_to_exercise( psa_key_type_t type,
-                                                    psa_algorithm_t alg );
+psa_key_usage_t mbedtls_test_psa_usage_to_exercise(psa_key_type_t type,
+                                                   psa_algorithm_t alg);
 
 #endif /* PSA_EXERCISE_KEY_H */
diff --git a/tests/include/test/psa_helpers.h b/tests/include/test/psa_helpers.h
index f438a71..2665fac 100644
--- a/tests/include/test/psa_helpers.h
+++ b/tests/include/test/psa_helpers.h
@@ -31,6 +31,6 @@
  *                  to a \c psa_xxx function that returns a value of type
  *                  #psa_status_t.
  */
-#define PSA_ASSERT( expr ) TEST_EQUAL( ( expr ), PSA_SUCCESS )
+#define PSA_ASSERT(expr) TEST_EQUAL((expr), PSA_SUCCESS)
 
 #endif /* PSA_HELPERS_H */
diff --git a/tests/include/test/random.h b/tests/include/test/random.h
index 6428280..4f7b55c 100644
--- a/tests/include/test/random.h
+++ b/tests/include/test/random.h
@@ -34,12 +34,11 @@
 #include <stddef.h>
 #include <stdint.h>
 
-typedef struct
-{
+typedef struct {
     unsigned char *buf; /* Pointer to a buffer of length bytes. */
     size_t length;
     /* If fallback_f_rng is NULL, fail after delivering length bytes. */
-    int ( *fallback_f_rng )( void*, unsigned char *, size_t );
+    int (*fallback_f_rng)(void *, unsigned char *, size_t);
     void *fallback_p_rng;
 } mbedtls_test_rnd_buf_info;
 
@@ -50,8 +49,7 @@
  * Do not forget endianness!
  * State( v0, v1 ) should be set to zero.
  */
-typedef struct
-{
+typedef struct {
     uint32_t key[16];
     uint32_t v0, v1;
 } mbedtls_test_rnd_pseudo_info;
@@ -65,18 +63,18 @@
  *
  * rng_state shall be NULL.
  */
-int mbedtls_test_rnd_std_rand( void *rng_state,
-                               unsigned char *output,
-                               size_t len );
+int mbedtls_test_rnd_std_rand(void *rng_state,
+                              unsigned char *output,
+                              size_t len);
 
 /**
  * This function only returns zeros.
  *
  * \p rng_state shall be \c NULL.
  */
-int mbedtls_test_rnd_zero_rand( void *rng_state,
-                                unsigned char *output,
-                                size_t len );
+int mbedtls_test_rnd_zero_rand(void *rng_state,
+                               unsigned char *output,
+                               size_t len);
 
 /**
  * This function returns random data based on a buffer it receives.
@@ -90,9 +88,9 @@
  * #mbedtls_test_rnd_buf_info structure if there is one, and
  * will return #MBEDTLS_ERR_ENTROPY_SOURCE_FAILED otherwise.
  */
-int mbedtls_test_rnd_buffer_rand( void *rng_state,
-                                  unsigned char *output,
-                                  size_t len );
+int mbedtls_test_rnd_buffer_rand(void *rng_state,
+                                 unsigned char *output,
+                                 size_t len);
 
 /**
  * This function returns random based on a pseudo random function.
@@ -102,8 +100,8 @@
  *
  * \p rng_state shall be a pointer to a #mbedtls_test_rnd_pseudo_info structure.
  */
-int mbedtls_test_rnd_pseudo_rand( void *rng_state,
-                                  unsigned char *output,
-                                  size_t len );
+int mbedtls_test_rnd_pseudo_rand(void *rng_state,
+                                 unsigned char *output,
+                                 size_t len);
 
 #endif /* TEST_RANDOM_H */
diff --git a/tests/src/asn1_helpers.c b/tests/src/asn1_helpers.c
index 79aa166..aaf7587 100644
--- a/tests/src/asn1_helpers.c
+++ b/tests/src/asn1_helpers.c
@@ -27,48 +27,48 @@
 
 #include <mbedtls/asn1.h>
 
-int mbedtls_test_asn1_skip_integer( unsigned char **p, const unsigned char *end,
-                                    size_t min_bits, size_t max_bits,
-                                    int must_be_odd )
+int mbedtls_test_asn1_skip_integer(unsigned char **p, const unsigned char *end,
+                                   size_t min_bits, size_t max_bits,
+                                   int must_be_odd)
 {
     size_t len;
     size_t actual_bits;
     unsigned char msb;
-    TEST_EQUAL( mbedtls_asn1_get_tag( p, end, &len,
-                                      MBEDTLS_ASN1_INTEGER ),
-                0 );
+    TEST_EQUAL(mbedtls_asn1_get_tag(p, end, &len,
+                                    MBEDTLS_ASN1_INTEGER),
+               0);
 
     /* Check if the retrieved length doesn't extend the actual buffer's size.
      * It is assumed here, that end >= p, which validates casting to size_t. */
-    TEST_ASSERT( len <= (size_t)( end - *p) );
+    TEST_ASSERT(len <= (size_t) (end - *p));
 
     /* Tolerate a slight departure from DER encoding:
      * - 0 may be represented by an empty string or a 1-byte string.
      * - The sign bit may be used as a value bit. */
-    if( ( len == 1 && ( *p )[0] == 0 ) ||
-        ( len > 1 && ( *p )[0] == 0 && ( ( *p )[1] & 0x80 ) != 0 ) )
-    {
-        ++( *p );
+    if ((len == 1 && (*p)[0] == 0) ||
+        (len > 1 && (*p)[0] == 0 && ((*p)[1] & 0x80) != 0)) {
+        ++(*p);
         --len;
     }
-    if( min_bits == 0 && len == 0 )
-        return( 1 );
-    msb = ( *p )[0];
-    TEST_ASSERT( msb != 0 );
-    actual_bits = 8 * ( len - 1 );
-    while( msb != 0 )
-    {
+    if (min_bits == 0 && len == 0) {
+        return 1;
+    }
+    msb = (*p)[0];
+    TEST_ASSERT(msb != 0);
+    actual_bits = 8 * (len - 1);
+    while (msb != 0) {
         msb >>= 1;
         ++actual_bits;
     }
-    TEST_ASSERT( actual_bits >= min_bits );
-    TEST_ASSERT( actual_bits <= max_bits );
-    if( must_be_odd )
-        TEST_ASSERT( ( ( *p )[len-1] & 1 ) != 0 );
+    TEST_ASSERT(actual_bits >= min_bits);
+    TEST_ASSERT(actual_bits <= max_bits);
+    if (must_be_odd) {
+        TEST_ASSERT(((*p)[len-1] & 1) != 0);
+    }
     *p += len;
-    return( 1 );
+    return 1;
 exit:
-    return( 0 );
+    return 0;
 }
 
 #endif /* MBEDTLS_ASN1_PARSE_C */
diff --git a/tests/src/drivers/hash.c b/tests/src/drivers/hash.c
index 0d59bee..9cfb707 100644
--- a/tests/src/drivers/hash.c
+++ b/tests/src/drivers/hash.c
@@ -38,28 +38,25 @@
 psa_status_t mbedtls_test_transparent_hash_compute(
     psa_algorithm_t alg,
     const uint8_t *input, size_t input_length,
-    uint8_t *hash, size_t hash_size, size_t *hash_length )
+    uint8_t *hash, size_t hash_size, size_t *hash_length)
 {
     mbedtls_test_driver_hash_hooks.hits++;
 
-    if( mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_hash_hooks.driver_status =
-             mbedtls_test_driver_hash_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_hash_hooks.driver_status =
+            mbedtls_test_driver_hash_hooks.forced_status;
+    } else {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
         mbedtls_test_driver_hash_hooks.driver_status =
             libtestdriver1_mbedtls_psa_hash_compute(
                 alg, input, input_length,
-                hash, hash_size, hash_length );
+                hash, hash_size, hash_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_HASH)
         mbedtls_test_driver_hash_hooks.driver_status =
             mbedtls_psa_hash_compute(
                 alg, input, input_length,
-                hash, hash_size, hash_length );
+                hash, hash_size, hash_length);
 #else
         (void) alg;
         (void) input;
@@ -71,29 +68,26 @@
 #endif
     }
 
-    return( mbedtls_test_driver_hash_hooks.driver_status );
+    return mbedtls_test_driver_hash_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_transparent_hash_setup(
     mbedtls_transparent_test_driver_hash_operation_t *operation,
-    psa_algorithm_t alg )
+    psa_algorithm_t alg)
 {
     mbedtls_test_driver_hash_hooks.hits++;
 
-    if( mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_hash_hooks.driver_status =
-             mbedtls_test_driver_hash_hooks.forced_status;
-    }
-    else
-    {
-#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
+    if (mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS) {
         mbedtls_test_driver_hash_hooks.driver_status =
-            libtestdriver1_mbedtls_psa_hash_setup( operation, alg );
+            mbedtls_test_driver_hash_hooks.forced_status;
+    } else {
+#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
+        mbedtls_test_driver_hash_hooks.driver_status =
+            libtestdriver1_mbedtls_psa_hash_setup(operation, alg);
 #elif defined(MBEDTLS_PSA_BUILTIN_HASH)
         mbedtls_test_driver_hash_hooks.driver_status =
-            mbedtls_psa_hash_setup( operation, alg );
+            mbedtls_psa_hash_setup(operation, alg);
 #else
         (void) operation;
         (void) alg;
@@ -101,30 +95,27 @@
 #endif
     }
 
-    return( mbedtls_test_driver_hash_hooks.driver_status );
+    return mbedtls_test_driver_hash_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_transparent_hash_clone(
     const mbedtls_transparent_test_driver_hash_operation_t *source_operation,
-    mbedtls_transparent_test_driver_hash_operation_t *target_operation )
+    mbedtls_transparent_test_driver_hash_operation_t *target_operation)
 {
     mbedtls_test_driver_hash_hooks.hits++;
 
-    if( mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_hash_hooks.driver_status =
-             mbedtls_test_driver_hash_hooks.forced_status;
-    }
-    else
-    {
-#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
+    if (mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS) {
         mbedtls_test_driver_hash_hooks.driver_status =
-            libtestdriver1_mbedtls_psa_hash_clone( source_operation,
-                                                   target_operation );
+            mbedtls_test_driver_hash_hooks.forced_status;
+    } else {
+#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
+        mbedtls_test_driver_hash_hooks.driver_status =
+            libtestdriver1_mbedtls_psa_hash_clone(source_operation,
+                                                  target_operation);
 #elif defined(MBEDTLS_PSA_BUILTIN_HASH)
         mbedtls_test_driver_hash_hooks.driver_status =
-            mbedtls_psa_hash_clone( source_operation, target_operation );
+            mbedtls_psa_hash_clone(source_operation, target_operation);
 #else
         (void) source_operation;
         (void) target_operation;
@@ -132,31 +123,28 @@
 #endif
     }
 
-    return( mbedtls_test_driver_hash_hooks.driver_status );
+    return mbedtls_test_driver_hash_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_transparent_hash_update(
     mbedtls_transparent_test_driver_hash_operation_t *operation,
     const uint8_t *input,
-    size_t input_length )
+    size_t input_length)
 {
     mbedtls_test_driver_hash_hooks.hits++;
 
-    if( mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_hash_hooks.driver_status =
-             mbedtls_test_driver_hash_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_hash_hooks.driver_status =
+            mbedtls_test_driver_hash_hooks.forced_status;
+    } else {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
         mbedtls_test_driver_hash_hooks.driver_status =
             libtestdriver1_mbedtls_psa_hash_update(
-                operation, input, input_length );
+                operation, input, input_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_HASH)
         mbedtls_test_driver_hash_hooks.driver_status =
-            mbedtls_psa_hash_update( operation, input, input_length );
+            mbedtls_psa_hash_update(operation, input, input_length);
 #else
         (void) operation;
         (void) input;
@@ -165,32 +153,29 @@
 #endif
     }
 
-    return( mbedtls_test_driver_hash_hooks.driver_status );
+    return mbedtls_test_driver_hash_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_transparent_hash_finish(
     mbedtls_transparent_test_driver_hash_operation_t *operation,
     uint8_t *hash,
     size_t hash_size,
-    size_t *hash_length )
+    size_t *hash_length)
 {
     mbedtls_test_driver_hash_hooks.hits++;
 
-    if( mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_hash_hooks.driver_status =
-             mbedtls_test_driver_hash_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_hash_hooks.driver_status =
+            mbedtls_test_driver_hash_hooks.forced_status;
+    } else {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
         mbedtls_test_driver_hash_hooks.driver_status =
             libtestdriver1_mbedtls_psa_hash_finish(
-                operation, hash, hash_size, hash_length );
+                operation, hash, hash_size, hash_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_HASH)
         mbedtls_test_driver_hash_hooks.driver_status =
-            mbedtls_psa_hash_finish( operation, hash, hash_size, hash_length );
+            mbedtls_psa_hash_finish(operation, hash, hash_size, hash_length);
 #else
         (void) operation;
         (void) hash;
@@ -200,34 +185,31 @@
 #endif
     }
 
-    return( mbedtls_test_driver_hash_hooks.driver_status );
+    return mbedtls_test_driver_hash_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_transparent_hash_abort(
-    mbedtls_transparent_test_driver_hash_operation_t *operation )
+    mbedtls_transparent_test_driver_hash_operation_t *operation)
 {
     mbedtls_test_driver_hash_hooks.hits++;
 
-    if( mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_hash_hooks.driver_status =
-             mbedtls_test_driver_hash_hooks.forced_status;
-    }
-    else
-    {
-#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
+    if (mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS) {
         mbedtls_test_driver_hash_hooks.driver_status =
-            libtestdriver1_mbedtls_psa_hash_abort( operation );
+            mbedtls_test_driver_hash_hooks.forced_status;
+    } else {
+#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
+        mbedtls_test_driver_hash_hooks.driver_status =
+            libtestdriver1_mbedtls_psa_hash_abort(operation);
 #elif defined(MBEDTLS_PSA_BUILTIN_HASH)
         mbedtls_test_driver_hash_hooks.driver_status =
-            mbedtls_psa_hash_abort( operation );
+            mbedtls_psa_hash_abort(operation);
 #else
         (void) operation;
         mbedtls_test_driver_hash_hooks.driver_status = PSA_ERROR_NOT_SUPPORTED;
 #endif
     }
 
-    return( mbedtls_test_driver_hash_hooks.driver_status );
+    return mbedtls_test_driver_hash_hooks.driver_status;
 }
 #endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */
diff --git a/tests/src/drivers/platform_builtin_keys.c b/tests/src/drivers/platform_builtin_keys.c
index 759fa78..f073410 100644
--- a/tests/src/drivers/platform_builtin_keys.c
+++ b/tests/src/drivers/platform_builtin_keys.c
@@ -27,8 +27,7 @@
 #include <test/drivers/test_driver.h>
 #endif
 
-typedef struct
-{
+typedef struct {
     psa_key_id_t builtin_key_id;
     psa_key_lifetime_t lifetime;
     psa_drv_slot_number_t slot_number;
@@ -40,52 +39,50 @@
      * ECDSA can be exercised on key ID MBEDTLS_PSA_KEY_ID_BUILTIN_MIN + 1. */
     { MBEDTLS_PSA_KEY_ID_BUILTIN_MIN - 1,
       PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
-        PSA_KEY_PERSISTENCE_READ_ONLY, PSA_CRYPTO_TEST_DRIVER_LOCATION ),
+          PSA_KEY_PERSISTENCE_READ_ONLY, PSA_CRYPTO_TEST_DRIVER_LOCATION),
       PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT },
     { MBEDTLS_PSA_KEY_ID_BUILTIN_MIN,
       PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
-        PSA_KEY_PERSISTENCE_READ_ONLY, PSA_CRYPTO_TEST_DRIVER_LOCATION ),
+          PSA_KEY_PERSISTENCE_READ_ONLY, PSA_CRYPTO_TEST_DRIVER_LOCATION),
       PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT },
     { MBEDTLS_PSA_KEY_ID_BUILTIN_MIN + 1,
       PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
-        PSA_KEY_PERSISTENCE_READ_ONLY, PSA_CRYPTO_TEST_DRIVER_LOCATION ),
-      PSA_CRYPTO_TEST_DRIVER_BUILTIN_ECDSA_KEY_SLOT},
+          PSA_KEY_PERSISTENCE_READ_ONLY, PSA_CRYPTO_TEST_DRIVER_LOCATION),
+      PSA_CRYPTO_TEST_DRIVER_BUILTIN_ECDSA_KEY_SLOT },
     { MBEDTLS_PSA_KEY_ID_BUILTIN_MAX - 1,
       PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
-        PSA_KEY_PERSISTENCE_READ_ONLY, PSA_CRYPTO_TEST_DRIVER_LOCATION ),
-      PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT},
+          PSA_KEY_PERSISTENCE_READ_ONLY, PSA_CRYPTO_TEST_DRIVER_LOCATION),
+      PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT },
     { MBEDTLS_PSA_KEY_ID_BUILTIN_MAX,
       PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
-        PSA_KEY_PERSISTENCE_READ_ONLY, PSA_CRYPTO_TEST_DRIVER_LOCATION ),
-      PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT},
+          PSA_KEY_PERSISTENCE_READ_ONLY, PSA_CRYPTO_TEST_DRIVER_LOCATION),
+      PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT },
     { MBEDTLS_PSA_KEY_ID_BUILTIN_MAX + 1,
       PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(
-        PSA_KEY_PERSISTENCE_READ_ONLY, PSA_CRYPTO_TEST_DRIVER_LOCATION ),
-      PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT},
+          PSA_KEY_PERSISTENCE_READ_ONLY, PSA_CRYPTO_TEST_DRIVER_LOCATION),
+      PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT },
 #else
-    {0, 0, 0}
+    { 0, 0, 0 }
 #endif
 };
 
 psa_status_t mbedtls_psa_platform_get_builtin_key(
     mbedtls_svc_key_id_t key_id,
     psa_key_lifetime_t *lifetime,
-    psa_drv_slot_number_t *slot_number )
+    psa_drv_slot_number_t *slot_number)
 {
-    psa_key_id_t app_key_id = MBEDTLS_SVC_KEY_ID_GET_KEY_ID( key_id );
+    psa_key_id_t app_key_id = MBEDTLS_SVC_KEY_ID_GET_KEY_ID(key_id);
     const mbedtls_psa_builtin_key_description_t *builtin_key;
 
-    for( size_t i = 0;
-         i < ( sizeof( builtin_keys ) / sizeof( builtin_keys[0] ) ); i++ )
-    {
+    for (size_t i = 0;
+         i < (sizeof(builtin_keys) / sizeof(builtin_keys[0])); i++) {
         builtin_key = &builtin_keys[i];
-        if( builtin_key->builtin_key_id == app_key_id )
-        {
+        if (builtin_key->builtin_key_id == app_key_id) {
             *lifetime = builtin_key->lifetime;
             *slot_number = builtin_key->slot_number;
-            return( PSA_SUCCESS );
+            return PSA_SUCCESS;
         }
     }
 
-    return( PSA_ERROR_DOES_NOT_EXIST );
+    return PSA_ERROR_DOES_NOT_EXIST;
 }
diff --git a/tests/src/drivers/test_driver_aead.c b/tests/src/drivers/test_driver_aead.c
index e249ec3..ebee4f8 100644
--- a/tests/src/drivers/test_driver_aead.c
+++ b/tests/src/drivers/test_driver_aead.c
@@ -42,28 +42,25 @@
     const uint8_t *nonce, size_t nonce_length,
     const uint8_t *additional_data, size_t additional_data_length,
     const uint8_t *plaintext, size_t plaintext_length,
-    uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length )
+    uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length)
 {
     mbedtls_test_driver_aead_hooks.hits++;
 
-    if( mbedtls_test_driver_aead_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_aead_hooks.driver_status =
-             mbedtls_test_driver_aead_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_aead_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_aead_hooks.driver_status =
+            mbedtls_test_driver_aead_hooks.forced_status;
+    } else {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD)
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD)
         mbedtls_test_driver_aead_hooks.driver_status =
             libtestdriver1_mbedtls_psa_aead_encrypt(
-                (const libtestdriver1_psa_key_attributes_t *)attributes,
+                (const libtestdriver1_psa_key_attributes_t *) attributes,
                 key_buffer, key_buffer_size,
                 alg,
                 nonce, nonce_length,
                 additional_data, additional_data_length,
                 plaintext, plaintext_length,
-                ciphertext, ciphertext_size, ciphertext_length );
+                ciphertext, ciphertext_size, ciphertext_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_AEAD)
         mbedtls_test_driver_aead_hooks.driver_status =
             mbedtls_psa_aead_encrypt(
@@ -72,7 +69,7 @@
                 nonce, nonce_length,
                 additional_data, additional_data_length,
                 plaintext, plaintext_length,
-                ciphertext, ciphertext_size, ciphertext_length );
+                ciphertext, ciphertext_size, ciphertext_length);
 #else
         (void) attributes;
         (void) key_buffer;
@@ -90,7 +87,7 @@
         mbedtls_test_driver_aead_hooks.driver_status = PSA_ERROR_NOT_SUPPORTED;
 #endif
     }
-    return( mbedtls_test_driver_aead_hooks.driver_status );
+    return mbedtls_test_driver_aead_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_transparent_aead_decrypt(
@@ -100,28 +97,25 @@
     const uint8_t *nonce, size_t nonce_length,
     const uint8_t *additional_data, size_t additional_data_length,
     const uint8_t *ciphertext, size_t ciphertext_length,
-    uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length )
+    uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length)
 {
     mbedtls_test_driver_aead_hooks.hits++;
 
-    if( mbedtls_test_driver_aead_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_aead_hooks.driver_status =
-             mbedtls_test_driver_aead_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_aead_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_aead_hooks.driver_status =
+            mbedtls_test_driver_aead_hooks.forced_status;
+    } else {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD)
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_AEAD)
         mbedtls_test_driver_aead_hooks.driver_status =
             libtestdriver1_mbedtls_psa_aead_decrypt(
-                (const libtestdriver1_psa_key_attributes_t *)attributes,
+                (const libtestdriver1_psa_key_attributes_t *) attributes,
                 key_buffer, key_buffer_size,
                 alg,
                 nonce, nonce_length,
                 additional_data, additional_data_length,
                 ciphertext, ciphertext_length,
-                plaintext, plaintext_size, plaintext_length );
+                plaintext, plaintext_size, plaintext_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_AEAD)
         mbedtls_test_driver_aead_hooks.driver_status =
             mbedtls_psa_aead_decrypt(
@@ -130,7 +124,7 @@
                 nonce, nonce_length,
                 additional_data, additional_data_length,
                 ciphertext, ciphertext_length,
-                plaintext, plaintext_size, plaintext_length );
+                plaintext, plaintext_size, plaintext_length);
 #else
         (void) attributes;
         (void) key_buffer;
@@ -148,7 +142,7 @@
         mbedtls_test_driver_aead_hooks.driver_status = PSA_ERROR_NOT_SUPPORTED;
 #endif
     }
-    return( mbedtls_test_driver_aead_hooks.driver_status );
+    return mbedtls_test_driver_aead_hooks.driver_status;
 }
 
 #endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */
diff --git a/tests/src/drivers/test_driver_cipher.c b/tests/src/drivers/test_driver_cipher.c
index 30a8119..42eb74d 100644
--- a/tests/src/drivers/test_driver_cipher.c
+++ b/tests/src/drivers/test_driver_cipher.c
@@ -54,41 +54,42 @@
     size_t input_length,
     uint8_t *output,
     size_t output_size,
-    size_t *output_length )
+    size_t *output_length)
 {
     mbedtls_test_driver_cipher_hooks.hits++;
 
-    if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
-    {
-        if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
-            return( PSA_ERROR_BUFFER_TOO_SMALL );
+    if (mbedtls_test_driver_cipher_hooks.forced_output != NULL) {
+        if (output_size < mbedtls_test_driver_cipher_hooks.forced_output_length) {
+            return PSA_ERROR_BUFFER_TOO_SMALL;
+        }
 
-        memcpy( output,
-                mbedtls_test_driver_cipher_hooks.forced_output,
-                mbedtls_test_driver_cipher_hooks.forced_output_length );
+        memcpy(output,
+               mbedtls_test_driver_cipher_hooks.forced_output,
+               mbedtls_test_driver_cipher_hooks.forced_output_length);
         *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
 
-        return( mbedtls_test_driver_cipher_hooks.forced_status );
+        return mbedtls_test_driver_cipher_hooks.forced_status;
     }
 
-    if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
-        return( mbedtls_test_driver_cipher_hooks.forced_status );
+    if (mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS) {
+        return mbedtls_test_driver_cipher_hooks.forced_status;
+    }
 
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
-    return( libtestdriver1_mbedtls_psa_cipher_encrypt(
-                (const libtestdriver1_psa_key_attributes_t *)attributes,
-                key_buffer, key_buffer_size,
-                alg, iv, iv_length, input, input_length,
-                output, output_size, output_length ) );
+    return libtestdriver1_mbedtls_psa_cipher_encrypt(
+        (const libtestdriver1_psa_key_attributes_t *) attributes,
+        key_buffer, key_buffer_size,
+        alg, iv, iv_length, input, input_length,
+        output, output_size, output_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
-    return( mbedtls_psa_cipher_encrypt(
-                attributes, key_buffer, key_buffer_size,
-                alg, iv, iv_length, input, input_length,
-                output, output_size, output_length ) );
+    return mbedtls_psa_cipher_encrypt(
+        attributes, key_buffer, key_buffer_size,
+        alg, iv, iv_length, input, input_length,
+        output, output_size, output_length);
 #endif
 
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_transparent_cipher_decrypt(
@@ -100,41 +101,42 @@
     size_t input_length,
     uint8_t *output,
     size_t output_size,
-    size_t *output_length )
+    size_t *output_length)
 {
-   mbedtls_test_driver_cipher_hooks.hits++;
+    mbedtls_test_driver_cipher_hooks.hits++;
 
-    if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
-    {
-        if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
-            return( PSA_ERROR_BUFFER_TOO_SMALL );
+    if (mbedtls_test_driver_cipher_hooks.forced_output != NULL) {
+        if (output_size < mbedtls_test_driver_cipher_hooks.forced_output_length) {
+            return PSA_ERROR_BUFFER_TOO_SMALL;
+        }
 
-        memcpy( output,
-                mbedtls_test_driver_cipher_hooks.forced_output,
-                mbedtls_test_driver_cipher_hooks.forced_output_length );
+        memcpy(output,
+               mbedtls_test_driver_cipher_hooks.forced_output,
+               mbedtls_test_driver_cipher_hooks.forced_output_length);
         *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
 
-        return( mbedtls_test_driver_cipher_hooks.forced_status );
+        return mbedtls_test_driver_cipher_hooks.forced_status;
     }
 
-    if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
-        return( mbedtls_test_driver_cipher_hooks.forced_status );
+    if (mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS) {
+        return mbedtls_test_driver_cipher_hooks.forced_status;
+    }
 
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
-    return( libtestdriver1_mbedtls_psa_cipher_decrypt(
-                (const libtestdriver1_psa_key_attributes_t *)attributes,
-                key_buffer, key_buffer_size,
-                alg, input, input_length,
-                output, output_size, output_length ) );
+    return libtestdriver1_mbedtls_psa_cipher_decrypt(
+        (const libtestdriver1_psa_key_attributes_t *) attributes,
+        key_buffer, key_buffer_size,
+        alg, input, input_length,
+        output, output_size, output_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
-    return( mbedtls_psa_cipher_decrypt(
-                attributes, key_buffer, key_buffer_size,
-                alg, input, input_length,
-                output, output_size, output_length ) );
+    return mbedtls_psa_cipher_decrypt(
+        attributes, key_buffer, key_buffer_size,
+        alg, input, input_length,
+        output, output_size, output_length);
 #endif
 
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_transparent_cipher_encrypt_setup(
@@ -149,23 +151,24 @@
      * useful for the test suite, since it gives a chance of catching memory
      * corruption errors should the core not have allocated (enough) memory for
      * our context struct. */
-    memset( operation, 0, sizeof( *operation ) );
+    memset(operation, 0, sizeof(*operation));
 
-    if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
-        return( mbedtls_test_driver_cipher_hooks.forced_status );
+    if (mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS) {
+        return mbedtls_test_driver_cipher_hooks.forced_status;
+    }
 
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
-    return( libtestdriver1_mbedtls_psa_cipher_encrypt_setup(
-                operation,
-                (const libtestdriver1_psa_key_attributes_t *)attributes,
-                key, key_length, alg ) );
+    return libtestdriver1_mbedtls_psa_cipher_encrypt_setup(
+        operation,
+        (const libtestdriver1_psa_key_attributes_t *) attributes,
+        key, key_length, alg);
 #elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
-    return( mbedtls_psa_cipher_encrypt_setup(
-                operation, attributes, key, key_length, alg ) );
+    return mbedtls_psa_cipher_encrypt_setup(
+        operation, attributes, key, key_length, alg);
 #endif
 
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_transparent_cipher_decrypt_setup(
@@ -176,21 +179,22 @@
 {
     mbedtls_test_driver_cipher_hooks.hits++;
 
-    if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
-        return( mbedtls_test_driver_cipher_hooks.forced_status );
+    if (mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS) {
+        return mbedtls_test_driver_cipher_hooks.forced_status;
+    }
 
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
-    return( libtestdriver1_mbedtls_psa_cipher_decrypt_setup(
-                operation,
-                (const libtestdriver1_psa_key_attributes_t *)attributes,
-                key, key_length, alg ) );
+    return libtestdriver1_mbedtls_psa_cipher_decrypt_setup(
+        operation,
+        (const libtestdriver1_psa_key_attributes_t *) attributes,
+        key, key_length, alg);
 #elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
-    return( mbedtls_psa_cipher_decrypt_setup(
-                operation, attributes, key, key_length, alg ) );
+    return mbedtls_psa_cipher_decrypt_setup(
+        operation, attributes, key, key_length, alg);
 #endif
 
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_transparent_cipher_abort(
@@ -198,23 +202,24 @@
 {
     mbedtls_test_driver_cipher_hooks.hits++;
 
-    if( operation->alg == 0 )
-        return( PSA_SUCCESS );
+    if (operation->alg == 0) {
+        return PSA_SUCCESS;
+    }
 
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
-    libtestdriver1_mbedtls_psa_cipher_abort( operation );
+    libtestdriver1_mbedtls_psa_cipher_abort(operation);
 #elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
-    mbedtls_psa_cipher_abort( operation );
+    mbedtls_psa_cipher_abort(operation);
 #endif
 
     /* Wiping the entire struct here, instead of member-by-member. This is
      * useful for the test suite, since it gives a chance of catching memory
      * corruption errors should the core not have allocated (enough) memory for
      * our context struct. */
-    memset( operation, 0, sizeof( *operation ) );
+    memset(operation, 0, sizeof(*operation));
 
-    return( mbedtls_test_driver_cipher_hooks.forced_status );
+    return mbedtls_test_driver_cipher_hooks.forced_status;
 }
 
 psa_status_t mbedtls_test_transparent_cipher_set_iv(
@@ -224,18 +229,19 @@
 {
     mbedtls_test_driver_cipher_hooks.hits++;
 
-    if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
-        return( mbedtls_test_driver_cipher_hooks.forced_status );
+    if (mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS) {
+        return mbedtls_test_driver_cipher_hooks.forced_status;
+    }
 
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
-    return( libtestdriver1_mbedtls_psa_cipher_set_iv(
-                operation, iv, iv_length ) );
+    return libtestdriver1_mbedtls_psa_cipher_set_iv(
+        operation, iv, iv_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
-    return( mbedtls_psa_cipher_set_iv( operation, iv, iv_length ) );
+    return mbedtls_psa_cipher_set_iv(operation, iv, iv_length);
 #endif
 
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_transparent_cipher_update(
@@ -248,34 +254,35 @@
 {
     mbedtls_test_driver_cipher_hooks.hits++;
 
-    if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
-    {
-        if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
+    if (mbedtls_test_driver_cipher_hooks.forced_output != NULL) {
+        if (output_size < mbedtls_test_driver_cipher_hooks.forced_output_length) {
             return PSA_ERROR_BUFFER_TOO_SMALL;
+        }
 
-        memcpy( output,
-                mbedtls_test_driver_cipher_hooks.forced_output,
-                mbedtls_test_driver_cipher_hooks.forced_output_length );
+        memcpy(output,
+               mbedtls_test_driver_cipher_hooks.forced_output,
+               mbedtls_test_driver_cipher_hooks.forced_output_length);
         *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
 
-        return( mbedtls_test_driver_cipher_hooks.forced_status );
+        return mbedtls_test_driver_cipher_hooks.forced_status;
     }
 
-    if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
-        return( mbedtls_test_driver_cipher_hooks.forced_status );
+    if (mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS) {
+        return mbedtls_test_driver_cipher_hooks.forced_status;
+    }
 
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
-    return( libtestdriver1_mbedtls_psa_cipher_update(
-                operation, input, input_length,
-                output, output_size, output_length ) );
+    return libtestdriver1_mbedtls_psa_cipher_update(
+        operation, input, input_length,
+        output, output_size, output_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
-    return( mbedtls_psa_cipher_update(
-                operation, input, input_length,
-                output, output_size, output_length ) );
+    return mbedtls_psa_cipher_update(
+        operation, input, input_length,
+        output, output_size, output_length);
 #endif
 
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_transparent_cipher_finish(
@@ -286,32 +293,33 @@
 {
     mbedtls_test_driver_cipher_hooks.hits++;
 
-    if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
-    {
-        if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
+    if (mbedtls_test_driver_cipher_hooks.forced_output != NULL) {
+        if (output_size < mbedtls_test_driver_cipher_hooks.forced_output_length) {
             return PSA_ERROR_BUFFER_TOO_SMALL;
+        }
 
-        memcpy( output,
-                mbedtls_test_driver_cipher_hooks.forced_output,
-                mbedtls_test_driver_cipher_hooks.forced_output_length );
+        memcpy(output,
+               mbedtls_test_driver_cipher_hooks.forced_output,
+               mbedtls_test_driver_cipher_hooks.forced_output_length);
         *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
 
-        return( mbedtls_test_driver_cipher_hooks.forced_status );
+        return mbedtls_test_driver_cipher_hooks.forced_status;
     }
 
-    if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
-        return( mbedtls_test_driver_cipher_hooks.forced_status );
+    if (mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS) {
+        return mbedtls_test_driver_cipher_hooks.forced_status;
+    }
 
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
-    return( libtestdriver1_mbedtls_psa_cipher_finish(
-                operation, output, output_size, output_length ) );
+    return libtestdriver1_mbedtls_psa_cipher_finish(
+        operation, output, output_size, output_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
-    return( mbedtls_psa_cipher_finish(
-                operation, output, output_size, output_length ) );
+    return mbedtls_psa_cipher_finish(
+        operation, output, output_size, output_length);
 #endif
 
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 /*
@@ -336,7 +344,7 @@
     (void) output;
     (void) output_size;
     (void) output_length;
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_cipher_decrypt(
@@ -355,7 +363,7 @@
     (void) output;
     (void) output_size;
     (void) output_length;
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_cipher_encrypt_setup(
@@ -369,7 +377,7 @@
     (void) key;
     (void) key_length;
     (void) alg;
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_cipher_decrypt_setup(
@@ -383,14 +391,14 @@
     (void) key;
     (void) key_length;
     (void) alg;
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_cipher_abort(
-    mbedtls_opaque_test_driver_cipher_operation_t *operation )
+    mbedtls_opaque_test_driver_cipher_operation_t *operation)
 {
     (void) operation;
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_cipher_set_iv(
@@ -401,7 +409,7 @@
     (void) operation;
     (void) iv;
     (void) iv_length;
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_cipher_update(
@@ -418,7 +426,7 @@
     (void) output;
     (void) output_size;
     (void) output_length;
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_cipher_finish(
@@ -431,6 +439,6 @@
     (void) output;
     (void) output_size;
     (void) output_length;
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 #endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */
diff --git a/tests/src/drivers/test_driver_key_management.c b/tests/src/drivers/test_driver_key_management.c
index 89cb8b9..f337e42 100644
--- a/tests/src/drivers/test_driver_key_management.c
+++ b/tests/src/drivers/test_driver_key_management.c
@@ -48,116 +48,115 @@
     mbedtls_test_driver_key_management_hooks = MBEDTLS_TEST_DRIVER_KEY_MANAGEMENT_INIT;
 
 const uint8_t mbedtls_test_driver_aes_key[16] =
-    { 0x36, 0x77, 0x39, 0x7A, 0x24, 0x43, 0x26, 0x46,
-      0x29, 0x4A, 0x40, 0x4E, 0x63, 0x52, 0x66, 0x55 };
+{ 0x36, 0x77, 0x39, 0x7A, 0x24, 0x43, 0x26, 0x46,
+  0x29, 0x4A, 0x40, 0x4E, 0x63, 0x52, 0x66, 0x55 };
 const uint8_t mbedtls_test_driver_ecdsa_key[32] =
-    { 0xdc, 0x7d, 0x9d, 0x26, 0xd6, 0x7a, 0x4f, 0x63,
-      0x2c, 0x34, 0xc2, 0xdc, 0x0b, 0x69, 0x86, 0x18,
-      0x38, 0x82, 0xc2, 0x06, 0xdf, 0x04, 0xcd, 0xb7,
-      0xd6, 0x9a, 0xab, 0xe2, 0x8b, 0xe4, 0xf8, 0x1a };
+{ 0xdc, 0x7d, 0x9d, 0x26, 0xd6, 0x7a, 0x4f, 0x63,
+  0x2c, 0x34, 0xc2, 0xdc, 0x0b, 0x69, 0x86, 0x18,
+  0x38, 0x82, 0xc2, 0x06, 0xdf, 0x04, 0xcd, 0xb7,
+  0xd6, 0x9a, 0xab, 0xe2, 0x8b, 0xe4, 0xf8, 0x1a };
 const uint8_t mbedtls_test_driver_ecdsa_pubkey[65] =
-    { 0x04,
-      0x85, 0xf6, 0x4d, 0x89, 0xf0, 0x0b, 0xe6, 0x6c,
-      0x88, 0xdd, 0x93, 0x7e, 0xfd, 0x6d, 0x7c, 0x44,
-      0x56, 0x48, 0xdc, 0xb7, 0x01, 0x15, 0x0b, 0x8a,
-      0x95, 0x09, 0x29, 0x58, 0x50, 0xf4, 0x1c, 0x19,
-      0x31, 0xe5, 0x71, 0xfb, 0x8f, 0x8c, 0x78, 0x31,
-      0x7a, 0x20, 0xb3, 0x80, 0xe8, 0x66, 0x58, 0x4b,
-      0xbc, 0x25, 0x16, 0xc3, 0xd2, 0x70, 0x2d, 0x79,
-      0x2f, 0x13, 0x1a, 0x92, 0x20, 0x95, 0xfd, 0x6c };
+{ 0x04,
+  0x85, 0xf6, 0x4d, 0x89, 0xf0, 0x0b, 0xe6, 0x6c,
+  0x88, 0xdd, 0x93, 0x7e, 0xfd, 0x6d, 0x7c, 0x44,
+  0x56, 0x48, 0xdc, 0xb7, 0x01, 0x15, 0x0b, 0x8a,
+  0x95, 0x09, 0x29, 0x58, 0x50, 0xf4, 0x1c, 0x19,
+  0x31, 0xe5, 0x71, 0xfb, 0x8f, 0x8c, 0x78, 0x31,
+  0x7a, 0x20, 0xb3, 0x80, 0xe8, 0x66, 0x58, 0x4b,
+  0xbc, 0x25, 0x16, 0xc3, 0xd2, 0x70, 0x2d, 0x79,
+  0x2f, 0x13, 0x1a, 0x92, 0x20, 0x95, 0xfd, 0x6c };
 
-psa_status_t mbedtls_test_transparent_init( void )
+psa_status_t mbedtls_test_transparent_init(void)
 {
-psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+    psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
 
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1)
-    status = libtestdriver1_psa_crypto_init( );
-    if( status != PSA_SUCCESS )
-        return( status );
+    status = libtestdriver1_psa_crypto_init();
+    if (status != PSA_SUCCESS) {
+        return status;
+    }
 #endif
 
-    (void)status;
-    return( PSA_SUCCESS );
+    (void) status;
+    return PSA_SUCCESS;
 }
 
-void mbedtls_test_transparent_free( void )
+void mbedtls_test_transparent_free(void)
 {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1)
-    libtestdriver1_mbedtls_psa_crypto_free( );
+    libtestdriver1_mbedtls_psa_crypto_free();
 #endif
 
     return;
 }
 
-psa_status_t mbedtls_test_opaque_init( void )
+psa_status_t mbedtls_test_opaque_init(void)
 {
-    return( PSA_SUCCESS );
+    return PSA_SUCCESS;
 }
 
-void mbedtls_test_opaque_free( void )
+void mbedtls_test_opaque_free(void)
 {
     return;
 }
 
 psa_status_t mbedtls_test_transparent_generate_key(
     const psa_key_attributes_t *attributes,
-    uint8_t *key, size_t key_size, size_t *key_length )
+    uint8_t *key, size_t key_size, size_t *key_length)
 {
     ++mbedtls_test_driver_key_management_hooks.hits;
 
-    if( mbedtls_test_driver_key_management_hooks.forced_status != PSA_SUCCESS )
-        return( mbedtls_test_driver_key_management_hooks.forced_status );
+    if (mbedtls_test_driver_key_management_hooks.forced_status != PSA_SUCCESS) {
+        return mbedtls_test_driver_key_management_hooks.forced_status;
+    }
 
-    if( mbedtls_test_driver_key_management_hooks.forced_output != NULL )
-    {
-        if( mbedtls_test_driver_key_management_hooks.forced_output_length >
-            key_size )
-            return( PSA_ERROR_BUFFER_TOO_SMALL );
-        memcpy( key, mbedtls_test_driver_key_management_hooks.forced_output,
-                mbedtls_test_driver_key_management_hooks.forced_output_length );
+    if (mbedtls_test_driver_key_management_hooks.forced_output != NULL) {
+        if (mbedtls_test_driver_key_management_hooks.forced_output_length >
+            key_size) {
+            return PSA_ERROR_BUFFER_TOO_SMALL;
+        }
+        memcpy(key, mbedtls_test_driver_key_management_hooks.forced_output,
+               mbedtls_test_driver_key_management_hooks.forced_output_length);
         *key_length = mbedtls_test_driver_key_management_hooks.forced_output_length;
-        return( PSA_SUCCESS );
+        return PSA_SUCCESS;
     }
 
-    if( PSA_KEY_TYPE_IS_ECC( psa_get_key_type( attributes ) )
-        && PSA_KEY_TYPE_IS_KEY_PAIR( psa_get_key_type( attributes ) ) )
-    {
+    if (PSA_KEY_TYPE_IS_ECC(psa_get_key_type(attributes))
+        && PSA_KEY_TYPE_IS_KEY_PAIR(psa_get_key_type(attributes))) {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR)
-        return( libtestdriver1_mbedtls_psa_ecp_generate_key(
-                    (const libtestdriver1_psa_key_attributes_t *)attributes,
-                    key, key_size, key_length ) );
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR)
+        return libtestdriver1_mbedtls_psa_ecp_generate_key(
+            (const libtestdriver1_psa_key_attributes_t *) attributes,
+            key, key_size, key_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR)
-        return( mbedtls_psa_ecp_generate_key(
-                    attributes, key, key_size, key_length ) );
+        return mbedtls_psa_ecp_generate_key(
+            attributes, key, key_size, key_length);
 #endif
-    }
-    else if( psa_get_key_type( attributes ) == PSA_KEY_TYPE_RSA_KEY_PAIR )
-    {
+    } else if (psa_get_key_type(attributes) == PSA_KEY_TYPE_RSA_KEY_PAIR) {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR)
-        return( libtestdriver1_mbedtls_psa_rsa_generate_key(
-                    (const libtestdriver1_psa_key_attributes_t *)attributes,
-                    key, key_size, key_length ) );
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR)
+        return libtestdriver1_mbedtls_psa_rsa_generate_key(
+            (const libtestdriver1_psa_key_attributes_t *) attributes,
+            key, key_size, key_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR)
-        return( mbedtls_psa_rsa_generate_key(
-                    attributes, key, key_size, key_length ) );
+        return mbedtls_psa_rsa_generate_key(
+            attributes, key, key_size, key_length);
 #endif
     }
 
-    (void)attributes;
-    return( PSA_ERROR_NOT_SUPPORTED );
+    (void) attributes;
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_generate_key(
     const psa_key_attributes_t *attributes,
-    uint8_t *key, size_t key_size, size_t *key_length )
+    uint8_t *key, size_t key_size, size_t *key_length)
 {
     (void) attributes;
     (void) key;
     (void) key_size;
     (void) key_length;
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_transparent_import_key(
@@ -169,231 +168,237 @@
     size_t *key_buffer_length,
     size_t *bits)
 {
-    psa_key_type_t type = psa_get_key_type( attributes );
+    psa_key_type_t type = psa_get_key_type(attributes);
 
     ++mbedtls_test_driver_key_management_hooks.hits;
     mbedtls_test_driver_key_management_hooks.location = PSA_KEY_LOCATION_LOCAL_STORAGE;
 
-    if( mbedtls_test_driver_key_management_hooks.forced_status != PSA_SUCCESS )
-        return( mbedtls_test_driver_key_management_hooks.forced_status );
+    if (mbedtls_test_driver_key_management_hooks.forced_status != PSA_SUCCESS) {
+        return mbedtls_test_driver_key_management_hooks.forced_status;
+    }
 
-    if( PSA_KEY_TYPE_IS_ECC( type ) )
-    {
+    if (PSA_KEY_TYPE_IS_ECC(type)) {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    ( defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) || \
-      defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY) )
-        return( libtestdriver1_mbedtls_psa_ecp_import_key(
-                    (const libtestdriver1_psa_key_attributes_t *)attributes,
-                    data, data_length,
-                    key_buffer, key_buffer_size,
-                    key_buffer_length, bits ) );
+        (defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) || \
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY))
+        return libtestdriver1_mbedtls_psa_ecp_import_key(
+            (const libtestdriver1_psa_key_attributes_t *) attributes,
+            data, data_length,
+            key_buffer, key_buffer_size,
+            key_buffer_length, bits);
 #elif defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) || \
-      defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY)
-        return( mbedtls_psa_ecp_import_key(
-                    attributes,
-                    data, data_length,
-                    key_buffer, key_buffer_size,
-                    key_buffer_length, bits ) );
+        defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY)
+        return mbedtls_psa_ecp_import_key(
+            attributes,
+            data, data_length,
+            key_buffer, key_buffer_size,
+            key_buffer_length, bits);
 #endif
-    }
-    else if( PSA_KEY_TYPE_IS_RSA( type ) )
-    {
+    } else if (PSA_KEY_TYPE_IS_RSA(type)) {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    ( defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) || \
-      defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) )
-        return( libtestdriver1_mbedtls_psa_rsa_import_key(
-                    (const libtestdriver1_psa_key_attributes_t *)attributes,
-                    data, data_length,
-                    key_buffer, key_buffer_size,
-                    key_buffer_length, bits ) );
+        (defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) || \
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY))
+        return libtestdriver1_mbedtls_psa_rsa_import_key(
+            (const libtestdriver1_psa_key_attributes_t *) attributes,
+            data, data_length,
+            key_buffer, key_buffer_size,
+            key_buffer_length, bits);
 #elif defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) || \
-      defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
-        return( mbedtls_psa_rsa_import_key(
-                    attributes,
-                    data, data_length,
-                    key_buffer, key_buffer_size,
-                    key_buffer_length, bits ) );
+        defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
+        return mbedtls_psa_rsa_import_key(
+            attributes,
+            data, data_length,
+            key_buffer, key_buffer_size,
+            key_buffer_length, bits);
 #endif
     }
 
-    (void)data;
-    (void)data_length;
-    (void)key_buffer;
-    (void)key_buffer_size;
-    (void)key_buffer_length;
-    (void)bits;
-    (void)type;
+    (void) data;
+    (void) data_length;
+    (void) key_buffer;
+    (void) key_buffer_size;
+    (void) key_buffer_length;
+    (void) bits;
+    (void) type;
 
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_export_key(
     const psa_key_attributes_t *attributes,
     const uint8_t *key, size_t key_length,
-    uint8_t *data, size_t data_size, size_t *data_length )
+    uint8_t *data, size_t data_size, size_t *data_length)
 {
     /* Assume this is a builtin key based on the key material length. */
-    psa_drv_slot_number_t slot_number = *( ( psa_drv_slot_number_t* ) key );
+    psa_drv_slot_number_t slot_number = *((psa_drv_slot_number_t *) key);
 
-    if( key_length != sizeof( psa_drv_slot_number_t ) )
-    {
+    if (key_length != sizeof(psa_drv_slot_number_t)) {
         /* Test driver does not support generic opaque key handling yet. */
-        return( PSA_ERROR_NOT_SUPPORTED );
+        return PSA_ERROR_NOT_SUPPORTED;
     }
 
-    switch( slot_number )
-    {
+    switch (slot_number) {
         case PSA_CRYPTO_TEST_DRIVER_BUILTIN_ECDSA_KEY_SLOT:
             /* This is the ECDSA slot. Verify the key's attributes before
              * returning the private key. */
-            if( psa_get_key_type( attributes ) !=
-                PSA_KEY_TYPE_ECC_KEY_PAIR( PSA_ECC_FAMILY_SECP_R1 ) )
-                return( PSA_ERROR_CORRUPTION_DETECTED );
-            if( psa_get_key_bits( attributes ) != 256 )
-                return( PSA_ERROR_CORRUPTION_DETECTED );
-            if( psa_get_key_algorithm( attributes ) !=
-                PSA_ALG_ECDSA( PSA_ALG_ANY_HASH ) )
-                return( PSA_ERROR_CORRUPTION_DETECTED );
-            if( ( psa_get_key_usage_flags( attributes ) &
-                  PSA_KEY_USAGE_EXPORT ) == 0 )
-                return( PSA_ERROR_CORRUPTION_DETECTED );
+            if (psa_get_key_type(attributes) !=
+                PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1)) {
+                return PSA_ERROR_CORRUPTION_DETECTED;
+            }
+            if (psa_get_key_bits(attributes) != 256) {
+                return PSA_ERROR_CORRUPTION_DETECTED;
+            }
+            if (psa_get_key_algorithm(attributes) !=
+                PSA_ALG_ECDSA(PSA_ALG_ANY_HASH)) {
+                return PSA_ERROR_CORRUPTION_DETECTED;
+            }
+            if ((psa_get_key_usage_flags(attributes) &
+                 PSA_KEY_USAGE_EXPORT) == 0) {
+                return PSA_ERROR_CORRUPTION_DETECTED;
+            }
 
-            if( data_size < sizeof( mbedtls_test_driver_ecdsa_key ) )
-                return( PSA_ERROR_BUFFER_TOO_SMALL );
+            if (data_size < sizeof(mbedtls_test_driver_ecdsa_key)) {
+                return PSA_ERROR_BUFFER_TOO_SMALL;
+            }
 
-            memcpy( data, mbedtls_test_driver_ecdsa_key,
-                    sizeof( mbedtls_test_driver_ecdsa_key ) );
-            *data_length = sizeof( mbedtls_test_driver_ecdsa_key );
-            return( PSA_SUCCESS );
+            memcpy(data, mbedtls_test_driver_ecdsa_key,
+                   sizeof(mbedtls_test_driver_ecdsa_key));
+            *data_length = sizeof(mbedtls_test_driver_ecdsa_key);
+            return PSA_SUCCESS;
 
         case PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT:
             /* This is the AES slot. Verify the key's attributes before
              * returning the key. */
-            if( psa_get_key_type( attributes ) != PSA_KEY_TYPE_AES )
-                return( PSA_ERROR_CORRUPTION_DETECTED );
-            if( psa_get_key_bits( attributes ) != 128 )
-                return( PSA_ERROR_CORRUPTION_DETECTED );
-            if( psa_get_key_algorithm( attributes ) != PSA_ALG_CTR )
-                return( PSA_ERROR_CORRUPTION_DETECTED );
-            if( ( psa_get_key_usage_flags( attributes ) &
-                  PSA_KEY_USAGE_EXPORT ) == 0 )
-                return( PSA_ERROR_CORRUPTION_DETECTED );
+            if (psa_get_key_type(attributes) != PSA_KEY_TYPE_AES) {
+                return PSA_ERROR_CORRUPTION_DETECTED;
+            }
+            if (psa_get_key_bits(attributes) != 128) {
+                return PSA_ERROR_CORRUPTION_DETECTED;
+            }
+            if (psa_get_key_algorithm(attributes) != PSA_ALG_CTR) {
+                return PSA_ERROR_CORRUPTION_DETECTED;
+            }
+            if ((psa_get_key_usage_flags(attributes) &
+                 PSA_KEY_USAGE_EXPORT) == 0) {
+                return PSA_ERROR_CORRUPTION_DETECTED;
+            }
 
-            if( data_size < sizeof( mbedtls_test_driver_aes_key ) )
-                return( PSA_ERROR_BUFFER_TOO_SMALL );
+            if (data_size < sizeof(mbedtls_test_driver_aes_key)) {
+                return PSA_ERROR_BUFFER_TOO_SMALL;
+            }
 
-            memcpy( data, mbedtls_test_driver_aes_key,
-                    sizeof( mbedtls_test_driver_aes_key ) );
-            *data_length = sizeof( mbedtls_test_driver_aes_key );
-            return( PSA_SUCCESS );
+            memcpy(data, mbedtls_test_driver_aes_key,
+                   sizeof(mbedtls_test_driver_aes_key));
+            *data_length = sizeof(mbedtls_test_driver_aes_key);
+            return PSA_SUCCESS;
 
         default:
-            return( PSA_ERROR_DOES_NOT_EXIST );
+            return PSA_ERROR_DOES_NOT_EXIST;
     }
 }
 
 psa_status_t mbedtls_test_transparent_export_public_key(
     const psa_key_attributes_t *attributes,
     const uint8_t *key_buffer, size_t key_buffer_size,
-    uint8_t *data, size_t data_size, size_t *data_length )
+    uint8_t *data, size_t data_size, size_t *data_length)
 {
     ++mbedtls_test_driver_key_management_hooks.hits;
 
-    if( mbedtls_test_driver_key_management_hooks.forced_status != PSA_SUCCESS )
-        return( mbedtls_test_driver_key_management_hooks.forced_status );
+    if (mbedtls_test_driver_key_management_hooks.forced_status != PSA_SUCCESS) {
+        return mbedtls_test_driver_key_management_hooks.forced_status;
+    }
 
-    if( mbedtls_test_driver_key_management_hooks.forced_output != NULL )
-    {
-        if( mbedtls_test_driver_key_management_hooks.forced_output_length >
-            data_size )
-            return( PSA_ERROR_BUFFER_TOO_SMALL );
-        memcpy( data, mbedtls_test_driver_key_management_hooks.forced_output,
-                mbedtls_test_driver_key_management_hooks.forced_output_length );
+    if (mbedtls_test_driver_key_management_hooks.forced_output != NULL) {
+        if (mbedtls_test_driver_key_management_hooks.forced_output_length >
+            data_size) {
+            return PSA_ERROR_BUFFER_TOO_SMALL;
+        }
+        memcpy(data, mbedtls_test_driver_key_management_hooks.forced_output,
+               mbedtls_test_driver_key_management_hooks.forced_output_length);
         *data_length = mbedtls_test_driver_key_management_hooks.forced_output_length;
-        return( PSA_SUCCESS );
+        return PSA_SUCCESS;
     }
 
-    psa_key_type_t key_type = psa_get_key_type( attributes );
+    psa_key_type_t key_type = psa_get_key_type(attributes);
 
-    if( PSA_KEY_TYPE_IS_ECC( key_type ) )
-    {
+    if (PSA_KEY_TYPE_IS_ECC(key_type)) {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    ( defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) || \
-      defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY) )
-        return( libtestdriver1_mbedtls_psa_ecp_export_public_key(
-                    (const libtestdriver1_psa_key_attributes_t *)attributes,
-                    key_buffer, key_buffer_size,
-                    data, data_size, data_length ) );
+        (defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) || \
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY))
+        return libtestdriver1_mbedtls_psa_ecp_export_public_key(
+            (const libtestdriver1_psa_key_attributes_t *) attributes,
+            key_buffer, key_buffer_size,
+            data, data_size, data_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) || \
-      defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY)
-        return( mbedtls_psa_ecp_export_public_key(
-                    attributes,
-                    key_buffer, key_buffer_size,
-                    data, data_size, data_length ) );
+        defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY)
+        return mbedtls_psa_ecp_export_public_key(
+            attributes,
+            key_buffer, key_buffer_size,
+            data, data_size, data_length);
 #endif
-    }
-    else if( PSA_KEY_TYPE_IS_RSA( key_type ) )
-    {
+    } else if (PSA_KEY_TYPE_IS_RSA(key_type)) {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    ( defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) || \
-      defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY) )
-        return( libtestdriver1_mbedtls_psa_rsa_export_public_key(
-                    (const libtestdriver1_psa_key_attributes_t *)attributes,
-                    key_buffer, key_buffer_size,
-                    data, data_size, data_length ) );
+        (defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) || \
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY))
+        return libtestdriver1_mbedtls_psa_rsa_export_public_key(
+            (const libtestdriver1_psa_key_attributes_t *) attributes,
+            key_buffer, key_buffer_size,
+            data, data_size, data_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) || \
-      defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
-        return( mbedtls_psa_rsa_export_public_key(
-                    attributes,
-                    key_buffer, key_buffer_size,
-                    data, data_size, data_length ) );
+        defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
+        return mbedtls_psa_rsa_export_public_key(
+            attributes,
+            key_buffer, key_buffer_size,
+            data, data_size, data_length);
 #endif
     }
 
-    (void)key_buffer;
-    (void)key_buffer_size;
-    (void)key_type;
+    (void) key_buffer;
+    (void) key_buffer_size;
+    (void) key_type;
 
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_export_public_key(
     const psa_key_attributes_t *attributes,
     const uint8_t *key, size_t key_length,
-    uint8_t *data, size_t data_size, size_t *data_length )
+    uint8_t *data, size_t data_size, size_t *data_length)
 {
-    if( key_length != sizeof( psa_drv_slot_number_t ) )
-    {
+    if (key_length != sizeof(psa_drv_slot_number_t)) {
         /* Test driver does not support generic opaque key handling yet. */
-        return( PSA_ERROR_NOT_SUPPORTED );
+        return PSA_ERROR_NOT_SUPPORTED;
     }
 
     /* Assume this is a builtin key based on the key material length. */
-    psa_drv_slot_number_t slot_number = *( ( psa_drv_slot_number_t* ) key );
-    switch( slot_number )
-    {
+    psa_drv_slot_number_t slot_number = *((psa_drv_slot_number_t *) key);
+    switch (slot_number) {
         case PSA_CRYPTO_TEST_DRIVER_BUILTIN_ECDSA_KEY_SLOT:
             /* This is the ECDSA slot. Verify the key's attributes before
              * returning the public key. */
-            if( psa_get_key_type( attributes ) !=
-                PSA_KEY_TYPE_ECC_KEY_PAIR( PSA_ECC_FAMILY_SECP_R1 ) )
-                return( PSA_ERROR_CORRUPTION_DETECTED );
-            if( psa_get_key_bits( attributes ) != 256 )
-                return( PSA_ERROR_CORRUPTION_DETECTED );
-            if( psa_get_key_algorithm( attributes ) !=
-                PSA_ALG_ECDSA( PSA_ALG_ANY_HASH ) )
-                return( PSA_ERROR_CORRUPTION_DETECTED );
+            if (psa_get_key_type(attributes) !=
+                PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1)) {
+                return PSA_ERROR_CORRUPTION_DETECTED;
+            }
+            if (psa_get_key_bits(attributes) != 256) {
+                return PSA_ERROR_CORRUPTION_DETECTED;
+            }
+            if (psa_get_key_algorithm(attributes) !=
+                PSA_ALG_ECDSA(PSA_ALG_ANY_HASH)) {
+                return PSA_ERROR_CORRUPTION_DETECTED;
+            }
 
-            if( data_size < sizeof( mbedtls_test_driver_ecdsa_pubkey ) )
-                return( PSA_ERROR_BUFFER_TOO_SMALL );
+            if (data_size < sizeof(mbedtls_test_driver_ecdsa_pubkey)) {
+                return PSA_ERROR_BUFFER_TOO_SMALL;
+            }
 
-            memcpy( data, mbedtls_test_driver_ecdsa_pubkey,
-                    sizeof( mbedtls_test_driver_ecdsa_pubkey ) );
-            *data_length = sizeof( mbedtls_test_driver_ecdsa_pubkey );
-            return( PSA_SUCCESS );
+            memcpy(data, mbedtls_test_driver_ecdsa_pubkey,
+                   sizeof(mbedtls_test_driver_ecdsa_pubkey));
+            *data_length = sizeof(mbedtls_test_driver_ecdsa_pubkey);
+            return PSA_SUCCESS;
 
         default:
-            return( PSA_ERROR_DOES_NOT_EXIST );
+            return PSA_ERROR_DOES_NOT_EXIST;
     }
 }
 
@@ -410,49 +415,50 @@
 psa_status_t mbedtls_test_opaque_get_builtin_key(
     psa_drv_slot_number_t slot_number,
     psa_key_attributes_t *attributes,
-    uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length )
+    uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length)
 {
-    switch( slot_number )
-    {
+    switch (slot_number) {
         case PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT:
-            psa_set_key_type( attributes, PSA_KEY_TYPE_AES );
-            psa_set_key_bits( attributes, 128 );
+            psa_set_key_type(attributes, PSA_KEY_TYPE_AES);
+            psa_set_key_bits(attributes, 128);
             psa_set_key_usage_flags(
                 attributes,
                 PSA_KEY_USAGE_ENCRYPT |
                 PSA_KEY_USAGE_DECRYPT |
-                PSA_KEY_USAGE_EXPORT );
-            psa_set_key_algorithm( attributes, PSA_ALG_CTR );
+                PSA_KEY_USAGE_EXPORT);
+            psa_set_key_algorithm(attributes, PSA_ALG_CTR);
 
-            if( key_buffer_size < sizeof( psa_drv_slot_number_t ) )
-                return( PSA_ERROR_BUFFER_TOO_SMALL );
+            if (key_buffer_size < sizeof(psa_drv_slot_number_t)) {
+                return PSA_ERROR_BUFFER_TOO_SMALL;
+            }
 
-            *( (psa_drv_slot_number_t*) key_buffer ) =
+            *((psa_drv_slot_number_t *) key_buffer) =
                 PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT;
-            *key_buffer_length = sizeof( psa_drv_slot_number_t );
-            return( PSA_SUCCESS );
+            *key_buffer_length = sizeof(psa_drv_slot_number_t);
+            return PSA_SUCCESS;
         case PSA_CRYPTO_TEST_DRIVER_BUILTIN_ECDSA_KEY_SLOT:
             psa_set_key_type(
                 attributes,
-                PSA_KEY_TYPE_ECC_KEY_PAIR( PSA_ECC_FAMILY_SECP_R1 ) );
-            psa_set_key_bits( attributes, 256 );
+                PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1));
+            psa_set_key_bits(attributes, 256);
             psa_set_key_usage_flags(
                 attributes,
                 PSA_KEY_USAGE_SIGN_HASH |
                 PSA_KEY_USAGE_VERIFY_HASH |
-                PSA_KEY_USAGE_EXPORT );
+                PSA_KEY_USAGE_EXPORT);
             psa_set_key_algorithm(
-                attributes, PSA_ALG_ECDSA( PSA_ALG_ANY_HASH ) );
+                attributes, PSA_ALG_ECDSA(PSA_ALG_ANY_HASH));
 
-            if( key_buffer_size < sizeof( psa_drv_slot_number_t ) )
-                return( PSA_ERROR_BUFFER_TOO_SMALL );
+            if (key_buffer_size < sizeof(psa_drv_slot_number_t)) {
+                return PSA_ERROR_BUFFER_TOO_SMALL;
+            }
 
-            *( (psa_drv_slot_number_t*) key_buffer ) =
+            *((psa_drv_slot_number_t *) key_buffer) =
                 PSA_CRYPTO_TEST_DRIVER_BUILTIN_ECDSA_KEY_SLOT;
-            *key_buffer_length = sizeof( psa_drv_slot_number_t );
-            return( PSA_SUCCESS );
+            *key_buffer_length = sizeof(psa_drv_slot_number_t);
+            return PSA_SUCCESS;
         default:
-            return( PSA_ERROR_DOES_NOT_EXIST );
+            return PSA_ERROR_DOES_NOT_EXIST;
     }
 }
 
diff --git a/tests/src/drivers/test_driver_mac.c b/tests/src/drivers/test_driver_mac.c
index 06b6eb7..362cc43 100644
--- a/tests/src/drivers/test_driver_mac.c
+++ b/tests/src/drivers/test_driver_mac.c
@@ -44,31 +44,28 @@
     size_t input_length,
     uint8_t *mac,
     size_t mac_size,
-    size_t *mac_length )
+    size_t *mac_length)
 {
     mbedtls_test_driver_mac_hooks.hits++;
 
-    if( mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_mac_hooks.driver_status =
-             mbedtls_test_driver_mac_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
         mbedtls_test_driver_mac_hooks.driver_status =
             libtestdriver1_mbedtls_psa_mac_compute(
-                (const libtestdriver1_psa_key_attributes_t *)attributes,
+                (const libtestdriver1_psa_key_attributes_t *) attributes,
                 key_buffer, key_buffer_size, alg,
                 input, input_length,
-                mac, mac_size, mac_length );
+                mac, mac_size, mac_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_MAC)
         mbedtls_test_driver_mac_hooks.driver_status =
             mbedtls_psa_mac_compute(
                 attributes, key_buffer, key_buffer_size, alg,
                 input, input_length,
-                mac, mac_size, mac_length );
+                mac, mac_size, mac_length);
 #else
         (void) attributes;
         (void) key_buffer;
@@ -83,7 +80,7 @@
 #endif
     }
 
-    return( mbedtls_test_driver_mac_hooks.driver_status );
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_transparent_mac_sign_setup(
@@ -91,28 +88,25 @@
     const psa_key_attributes_t *attributes,
     const uint8_t *key_buffer,
     size_t key_buffer_size,
-    psa_algorithm_t alg )
+    psa_algorithm_t alg)
 {
     mbedtls_test_driver_mac_hooks.hits++;
 
-    if( mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_mac_hooks.driver_status =
-             mbedtls_test_driver_mac_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
         mbedtls_test_driver_mac_hooks.driver_status =
             libtestdriver1_mbedtls_psa_mac_sign_setup(
                 operation,
-                (const libtestdriver1_psa_key_attributes_t *)attributes,
-                key_buffer, key_buffer_size, alg );
+                (const libtestdriver1_psa_key_attributes_t *) attributes,
+                key_buffer, key_buffer_size, alg);
 #elif defined(MBEDTLS_PSA_BUILTIN_MAC)
         mbedtls_test_driver_mac_hooks.driver_status =
             mbedtls_psa_mac_sign_setup(
-                operation, attributes, key_buffer, key_buffer_size, alg );
+                operation, attributes, key_buffer, key_buffer_size, alg);
 #else
         (void) operation;
         (void) attributes;
@@ -123,7 +117,7 @@
 #endif
     }
 
-    return( mbedtls_test_driver_mac_hooks.driver_status );
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_transparent_mac_verify_setup(
@@ -131,28 +125,25 @@
     const psa_key_attributes_t *attributes,
     const uint8_t *key_buffer,
     size_t key_buffer_size,
-    psa_algorithm_t alg )
+    psa_algorithm_t alg)
 {
     mbedtls_test_driver_mac_hooks.hits++;
 
-    if( mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_mac_hooks.driver_status =
-             mbedtls_test_driver_mac_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
         mbedtls_test_driver_mac_hooks.driver_status =
             libtestdriver1_mbedtls_psa_mac_verify_setup(
                 operation,
-                (const libtestdriver1_psa_key_attributes_t *)attributes,
-                key_buffer, key_buffer_size, alg );
+                (const libtestdriver1_psa_key_attributes_t *) attributes,
+                key_buffer, key_buffer_size, alg);
 #elif defined(MBEDTLS_PSA_BUILTIN_MAC)
         mbedtls_test_driver_mac_hooks.driver_status =
             mbedtls_psa_mac_verify_setup(
-                operation, attributes, key_buffer, key_buffer_size, alg );
+                operation, attributes, key_buffer, key_buffer_size, alg);
 #else
         (void) operation;
         (void) attributes;
@@ -163,32 +154,29 @@
 #endif
     }
 
-    return( mbedtls_test_driver_mac_hooks.driver_status );
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_transparent_mac_update(
     mbedtls_transparent_test_driver_mac_operation_t *operation,
     const uint8_t *input,
-    size_t input_length )
+    size_t input_length)
 {
     mbedtls_test_driver_mac_hooks.hits++;
 
-    if( mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_mac_hooks.driver_status =
-             mbedtls_test_driver_mac_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
         mbedtls_test_driver_mac_hooks.driver_status =
             libtestdriver1_mbedtls_psa_mac_update(
-                operation, input, input_length );
+                operation, input, input_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_MAC)
         mbedtls_test_driver_mac_hooks.driver_status =
             mbedtls_psa_mac_update(
-                operation, input, input_length );
+                operation, input, input_length);
 #else
         (void) operation;
         (void) input;
@@ -197,33 +185,30 @@
 #endif
     }
 
-    return( mbedtls_test_driver_mac_hooks.driver_status );
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_transparent_mac_sign_finish(
     mbedtls_transparent_test_driver_mac_operation_t *operation,
     uint8_t *mac,
     size_t mac_size,
-    size_t *mac_length )
+    size_t *mac_length)
 {
     mbedtls_test_driver_mac_hooks.hits++;
 
-    if( mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_mac_hooks.driver_status =
-             mbedtls_test_driver_mac_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
         mbedtls_test_driver_mac_hooks.driver_status =
             libtestdriver1_mbedtls_psa_mac_sign_finish(
-                operation, mac, mac_size, mac_length );
+                operation, mac, mac_size, mac_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_MAC)
         mbedtls_test_driver_mac_hooks.driver_status =
             mbedtls_psa_mac_sign_finish(
-                operation, mac, mac_size, mac_length );
+                operation, mac, mac_size, mac_length);
 #else
         (void) operation;
         (void) mac;
@@ -233,32 +218,29 @@
 #endif
     }
 
-    return( mbedtls_test_driver_mac_hooks.driver_status );
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_transparent_mac_verify_finish(
     mbedtls_transparent_test_driver_mac_operation_t *operation,
     const uint8_t *mac,
-    size_t mac_length )
+    size_t mac_length)
 {
     mbedtls_test_driver_mac_hooks.hits++;
 
-    if( mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_mac_hooks.driver_status =
-             mbedtls_test_driver_mac_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
         mbedtls_test_driver_mac_hooks.driver_status =
             libtestdriver1_mbedtls_psa_mac_verify_finish(
-                operation, mac, mac_length );
+                operation, mac, mac_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_MAC)
         mbedtls_test_driver_mac_hooks.driver_status =
             mbedtls_psa_mac_verify_finish(
-                operation, mac, mac_length );
+                operation, mac, mac_length);
 #else
         (void) operation;
         (void) mac;
@@ -267,35 +249,32 @@
 #endif
     }
 
-    return( mbedtls_test_driver_mac_hooks.driver_status );
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_transparent_mac_abort(
-    mbedtls_transparent_test_driver_mac_operation_t *operation )
+    mbedtls_transparent_test_driver_mac_operation_t *operation)
 {
     mbedtls_test_driver_mac_hooks.hits++;
 
-    if( mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_mac_hooks.driver_status =
-             mbedtls_test_driver_mac_hooks.forced_status;
-    }
-    else
-    {
-#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
+    if (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
         mbedtls_test_driver_mac_hooks.driver_status =
-            libtestdriver1_mbedtls_psa_mac_abort( operation );
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
+#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
+        defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_MAC)
+        mbedtls_test_driver_mac_hooks.driver_status =
+            libtestdriver1_mbedtls_psa_mac_abort(operation);
 #elif defined(MBEDTLS_PSA_BUILTIN_MAC)
         mbedtls_test_driver_mac_hooks.driver_status =
-            mbedtls_psa_mac_abort( operation );
+            mbedtls_psa_mac_abort(operation);
 #else
         (void) operation;
         mbedtls_test_driver_mac_hooks.driver_status = PSA_ERROR_NOT_SUPPORTED;
 #endif
     }
 
-    return( mbedtls_test_driver_mac_hooks.driver_status );
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_opaque_mac_compute(
@@ -307,17 +286,14 @@
     size_t input_length,
     uint8_t *mac,
     size_t mac_size,
-    size_t *mac_length )
+    size_t *mac_length)
 {
     mbedtls_test_driver_mac_hooks.hits++;
 
-    if( mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_mac_hooks.driver_status =
-             mbedtls_test_driver_mac_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
         (void) attributes;
         (void) key_buffer;
         (void) key_buffer_size;
@@ -330,7 +306,7 @@
         mbedtls_test_driver_mac_hooks.driver_status = PSA_ERROR_NOT_SUPPORTED;
     }
 
-    return( mbedtls_test_driver_mac_hooks.driver_status );
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_opaque_mac_sign_setup(
@@ -338,17 +314,14 @@
     const psa_key_attributes_t *attributes,
     const uint8_t *key_buffer,
     size_t key_buffer_size,
-    psa_algorithm_t alg )
+    psa_algorithm_t alg)
 {
     mbedtls_test_driver_mac_hooks.hits++;
 
-    if( mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_mac_hooks.driver_status =
-             mbedtls_test_driver_mac_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
         (void) operation;
         (void) attributes;
         (void) key_buffer;
@@ -357,7 +330,7 @@
         mbedtls_test_driver_mac_hooks.driver_status = PSA_ERROR_NOT_SUPPORTED;
     }
 
-    return( mbedtls_test_driver_mac_hooks.driver_status );
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_opaque_mac_verify_setup(
@@ -365,17 +338,14 @@
     const psa_key_attributes_t *attributes,
     const uint8_t *key_buffer,
     size_t key_buffer_size,
-    psa_algorithm_t alg )
+    psa_algorithm_t alg)
 {
     mbedtls_test_driver_mac_hooks.hits++;
 
-    if( mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_mac_hooks.driver_status =
-             mbedtls_test_driver_mac_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
         (void) operation;
         (void) attributes;
         (void) key_buffer;
@@ -384,47 +354,41 @@
         mbedtls_test_driver_mac_hooks.driver_status = PSA_ERROR_NOT_SUPPORTED;
     }
 
-    return( mbedtls_test_driver_mac_hooks.driver_status );
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_opaque_mac_update(
     mbedtls_opaque_test_driver_mac_operation_t *operation,
     const uint8_t *input,
-    size_t input_length )
+    size_t input_length)
 {
     mbedtls_test_driver_mac_hooks.hits++;
 
-    if( mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_mac_hooks.driver_status =
-             mbedtls_test_driver_mac_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
         (void) operation;
         (void) input;
         (void) input_length;
         mbedtls_test_driver_mac_hooks.driver_status = PSA_ERROR_NOT_SUPPORTED;
     }
 
-    return( mbedtls_test_driver_mac_hooks.driver_status );
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_opaque_mac_sign_finish(
     mbedtls_opaque_test_driver_mac_operation_t *operation,
     uint8_t *mac,
     size_t mac_size,
-    size_t *mac_length )
+    size_t *mac_length)
 {
     mbedtls_test_driver_mac_hooks.hits++;
 
-    if( mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_mac_hooks.driver_status =
-             mbedtls_test_driver_mac_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
         (void) operation;
         (void) mac;
         (void) mac_size;
@@ -432,49 +396,43 @@
         mbedtls_test_driver_mac_hooks.driver_status = PSA_ERROR_NOT_SUPPORTED;
     }
 
-    return( mbedtls_test_driver_mac_hooks.driver_status );
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_opaque_mac_verify_finish(
     mbedtls_opaque_test_driver_mac_operation_t *operation,
     const uint8_t *mac,
-    size_t mac_length )
+    size_t mac_length)
 {
     mbedtls_test_driver_mac_hooks.hits++;
 
-    if( mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_mac_hooks.driver_status =
-             mbedtls_test_driver_mac_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
         (void) operation;
         (void) mac;
         (void) mac_length;
         mbedtls_test_driver_mac_hooks.driver_status = PSA_ERROR_NOT_SUPPORTED;
     }
 
-    return( mbedtls_test_driver_mac_hooks.driver_status );
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
 psa_status_t mbedtls_test_opaque_mac_abort(
-    mbedtls_opaque_test_driver_mac_operation_t *operation )
+    mbedtls_opaque_test_driver_mac_operation_t *operation)
 {
     mbedtls_test_driver_mac_hooks.hits++;
 
-    if( mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS )
-    {
-         mbedtls_test_driver_mac_hooks.driver_status =
-             mbedtls_test_driver_mac_hooks.forced_status;
-    }
-    else
-    {
+    if (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
         (void) operation;
         mbedtls_test_driver_mac_hooks.driver_status = PSA_ERROR_NOT_SUPPORTED;
     }
 
-    return( mbedtls_test_driver_mac_hooks.driver_status );
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
 #endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */
diff --git a/tests/src/drivers/test_driver_signature.c b/tests/src/drivers/test_driver_signature.c
index 3de43a8..75d7703 100644
--- a/tests/src/drivers/test_driver_signature.c
+++ b/tests/src/drivers/test_driver_signature.c
@@ -64,72 +64,63 @@
     size_t hash_length,
     uint8_t *signature,
     size_t signature_size,
-    size_t *signature_length )
+    size_t *signature_length)
 {
-    if( attributes->core.type == PSA_KEY_TYPE_RSA_KEY_PAIR )
-    {
-        if( PSA_ALG_IS_RSA_PKCS1V15_SIGN( alg ) ||
-            PSA_ALG_IS_RSA_PSS( alg) )
-        {
+    if (attributes->core.type == PSA_KEY_TYPE_RSA_KEY_PAIR) {
+        if (PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) ||
+            PSA_ALG_IS_RSA_PSS(alg)) {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    ( defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN) || \
-      defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS) )
-            return( libtestdriver1_mbedtls_psa_rsa_sign_hash(
-                        (const libtestdriver1_psa_key_attributes_t *) attributes,
-                        key_buffer, key_buffer_size,
-                        alg, hash, hash_length,
-                        signature, signature_size, signature_length ) );
+            (defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN) || \
+            defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS))
+            return libtestdriver1_mbedtls_psa_rsa_sign_hash(
+                (const libtestdriver1_psa_key_attributes_t *) attributes,
+                key_buffer, key_buffer_size,
+                alg, hash, hash_length,
+                signature, signature_size, signature_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN) || \
-      defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS)
-            return( mbedtls_psa_rsa_sign_hash(
-                        attributes,
-                        key_buffer, key_buffer_size,
-                        alg, hash, hash_length,
-                        signature, signature_size, signature_length ) );
+            defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS)
+            return mbedtls_psa_rsa_sign_hash(
+                attributes,
+                key_buffer, key_buffer_size,
+                alg, hash, hash_length,
+                signature, signature_size, signature_length);
 #endif
+        } else {
+            return PSA_ERROR_INVALID_ARGUMENT;
         }
-        else
-        {
-            return( PSA_ERROR_INVALID_ARGUMENT );
-        }
-    }
-    else if( PSA_KEY_TYPE_IS_ECC( attributes->core.type ) )
-    {
-        if( PSA_ALG_IS_ECDSA( alg ) )
-        {
+    } else if (PSA_KEY_TYPE_IS_ECC(attributes->core.type)) {
+        if (PSA_ALG_IS_ECDSA(alg)) {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    ( defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
-      defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) )
-            return( libtestdriver1_mbedtls_psa_ecdsa_sign_hash(
-                        (const libtestdriver1_psa_key_attributes_t *) attributes,
-                        key_buffer, key_buffer_size,
-                        alg, hash, hash_length,
-                        signature, signature_size, signature_length ) );
+            (defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
+            defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA))
+            return libtestdriver1_mbedtls_psa_ecdsa_sign_hash(
+                (const libtestdriver1_psa_key_attributes_t *) attributes,
+                key_buffer, key_buffer_size,
+                alg, hash, hash_length,
+                signature, signature_size, signature_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
-      defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA)
-            return( mbedtls_psa_ecdsa_sign_hash(
-                        attributes,
-                        key_buffer, key_buffer_size,
-                        alg, hash, hash_length,
-                        signature, signature_size, signature_length ) );
+            defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA)
+            return mbedtls_psa_ecdsa_sign_hash(
+                attributes,
+                key_buffer, key_buffer_size,
+                alg, hash, hash_length,
+                signature, signature_size, signature_length);
 #endif
-        }
-        else
-        {
-            return( PSA_ERROR_INVALID_ARGUMENT );
+        } else {
+            return PSA_ERROR_INVALID_ARGUMENT;
         }
     }
 
-    (void)attributes;
-    (void)key_buffer;
-    (void)key_buffer_size;
-    (void)alg;
-    (void)hash;
-    (void)hash_length;
-    (void)signature;
-    (void)signature_size;
-    (void)signature_length;
-    return( PSA_ERROR_NOT_SUPPORTED );
+    (void) attributes;
+    (void) key_buffer;
+    (void) key_buffer_size;
+    (void) alg;
+    (void) hash;
+    (void) hash_length;
+    (void) signature;
+    (void) signature_size;
+    (void) signature_length;
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t verify_hash(
@@ -140,71 +131,62 @@
     const uint8_t *hash,
     size_t hash_length,
     const uint8_t *signature,
-    size_t signature_length )
+    size_t signature_length)
 {
-    if( PSA_KEY_TYPE_IS_RSA( attributes->core.type ) )
-    {
-        if( PSA_ALG_IS_RSA_PKCS1V15_SIGN( alg ) ||
-            PSA_ALG_IS_RSA_PSS( alg) )
-        {
+    if (PSA_KEY_TYPE_IS_RSA(attributes->core.type)) {
+        if (PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) ||
+            PSA_ALG_IS_RSA_PSS(alg)) {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    ( defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN) || \
-      defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS) )
-            return( libtestdriver1_mbedtls_psa_rsa_verify_hash(
-                        (const libtestdriver1_psa_key_attributes_t *) attributes,
-                        key_buffer, key_buffer_size,
-                        alg, hash, hash_length,
-                        signature, signature_length ) );
+            (defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN) || \
+            defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS))
+            return libtestdriver1_mbedtls_psa_rsa_verify_hash(
+                (const libtestdriver1_psa_key_attributes_t *) attributes,
+                key_buffer, key_buffer_size,
+                alg, hash, hash_length,
+                signature, signature_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN) || \
-      defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS)
-            return( mbedtls_psa_rsa_verify_hash(
-                        attributes,
-                        key_buffer, key_buffer_size,
-                        alg, hash, hash_length,
-                        signature, signature_length ) );
+            defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS)
+            return mbedtls_psa_rsa_verify_hash(
+                attributes,
+                key_buffer, key_buffer_size,
+                alg, hash, hash_length,
+                signature, signature_length);
 #endif
+        } else {
+            return PSA_ERROR_INVALID_ARGUMENT;
         }
-        else
-        {
-            return( PSA_ERROR_INVALID_ARGUMENT );
-        }
-    }
-    else if( PSA_KEY_TYPE_IS_ECC( attributes->core.type ) )
-    {
-        if( PSA_ALG_IS_ECDSA( alg ) )
-        {
+    } else if (PSA_KEY_TYPE_IS_ECC(attributes->core.type)) {
+        if (PSA_ALG_IS_ECDSA(alg)) {
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
-    ( defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
-      defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA) )
-            return( libtestdriver1_mbedtls_psa_ecdsa_verify_hash(
-                        (const libtestdriver1_psa_key_attributes_t *) attributes,
-                        key_buffer, key_buffer_size,
-                        alg, hash, hash_length,
-                        signature, signature_length ) );
+            (defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
+            defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA))
+            return libtestdriver1_mbedtls_psa_ecdsa_verify_hash(
+                (const libtestdriver1_psa_key_attributes_t *) attributes,
+                key_buffer, key_buffer_size,
+                alg, hash, hash_length,
+                signature, signature_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_ALG_ECDSA) || \
-      defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA)
-            return( mbedtls_psa_ecdsa_verify_hash(
-                        attributes,
-                        key_buffer, key_buffer_size,
-                        alg, hash, hash_length,
-                        signature, signature_length ) );
+            defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA)
+            return mbedtls_psa_ecdsa_verify_hash(
+                attributes,
+                key_buffer, key_buffer_size,
+                alg, hash, hash_length,
+                signature, signature_length);
 #endif
-        }
-        else
-        {
-            return( PSA_ERROR_INVALID_ARGUMENT );
+        } else {
+            return PSA_ERROR_INVALID_ARGUMENT;
         }
     }
 
-    (void)attributes;
-    (void)key_buffer;
-    (void)key_buffer_size;
-    (void)alg;
-    (void)hash;
-    (void)hash_length;
-    (void)signature;
-    (void)signature_length;
-    return( PSA_ERROR_NOT_SUPPORTED );
+    (void) attributes;
+    (void) key_buffer;
+    (void) key_buffer_size;
+    (void) alg;
+    (void) hash;
+    (void) hash_length;
+    (void) signature;
+    (void) signature_length;
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_transparent_signature_sign_message(
@@ -216,7 +198,7 @@
     size_t input_length,
     uint8_t *signature,
     size_t signature_size,
-    size_t *signature_length )
+    size_t *signature_length)
 {
     psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
     size_t hash_length;
@@ -224,41 +206,43 @@
 
     ++mbedtls_test_driver_signature_sign_hooks.hits;
 
-    if( mbedtls_test_driver_signature_sign_hooks.forced_status != PSA_SUCCESS )
-        return( mbedtls_test_driver_signature_sign_hooks.forced_status );
+    if (mbedtls_test_driver_signature_sign_hooks.forced_status != PSA_SUCCESS) {
+        return mbedtls_test_driver_signature_sign_hooks.forced_status;
+    }
 
-    if( mbedtls_test_driver_signature_sign_hooks.forced_output != NULL )
-    {
-        if( mbedtls_test_driver_signature_sign_hooks.forced_output_length > signature_size )
-            return( PSA_ERROR_BUFFER_TOO_SMALL );
+    if (mbedtls_test_driver_signature_sign_hooks.forced_output != NULL) {
+        if (mbedtls_test_driver_signature_sign_hooks.forced_output_length > signature_size) {
+            return PSA_ERROR_BUFFER_TOO_SMALL;
+        }
 
-        memcpy( signature, mbedtls_test_driver_signature_sign_hooks.forced_output,
-                mbedtls_test_driver_signature_sign_hooks.forced_output_length );
+        memcpy(signature, mbedtls_test_driver_signature_sign_hooks.forced_output,
+               mbedtls_test_driver_signature_sign_hooks.forced_output_length);
         *signature_length = mbedtls_test_driver_signature_sign_hooks.forced_output_length;
 
-        return( PSA_SUCCESS );
+        return PSA_SUCCESS;
     }
 
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
     status = libtestdriver1_mbedtls_psa_hash_compute(
-                PSA_ALG_SIGN_GET_HASH( alg ), input, input_length,
-                hash, sizeof( hash ), &hash_length );
+        PSA_ALG_SIGN_GET_HASH(alg), input, input_length,
+        hash, sizeof(hash), &hash_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_HASH)
     status = mbedtls_psa_hash_compute(
-                PSA_ALG_SIGN_GET_HASH( alg ), input, input_length,
-                hash, sizeof( hash ), &hash_length );
+        PSA_ALG_SIGN_GET_HASH(alg), input, input_length,
+        hash, sizeof(hash), &hash_length);
 #else
     (void) input;
     (void) input_length;
     status = PSA_ERROR_NOT_SUPPORTED;
 #endif
-    if( status != PSA_SUCCESS )
+    if (status != PSA_SUCCESS) {
         return status;
+    }
 
-    return( sign_hash( attributes, key_buffer, key_buffer_size,
-                       alg, hash, hash_length,
-                       signature, signature_size, signature_length ) );
+    return sign_hash(attributes, key_buffer, key_buffer_size,
+                     alg, hash, hash_length,
+                     signature, signature_size, signature_length);
 }
 
 psa_status_t mbedtls_test_opaque_signature_sign_message(
@@ -270,7 +254,7 @@
     size_t input_length,
     uint8_t *signature,
     size_t signature_size,
-    size_t *signature_length )
+    size_t *signature_length)
 {
     (void) attributes;
     (void) key;
@@ -282,7 +266,7 @@
     (void) signature_size;
     (void) signature_length;
 
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_transparent_signature_verify_message(
@@ -293,7 +277,7 @@
     const uint8_t *input,
     size_t input_length,
     const uint8_t *signature,
-    size_t signature_length )
+    size_t signature_length)
 {
     psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
     size_t hash_length;
@@ -301,29 +285,31 @@
 
     ++mbedtls_test_driver_signature_verify_hooks.hits;
 
-    if( mbedtls_test_driver_signature_verify_hooks.forced_status != PSA_SUCCESS )
-        return( mbedtls_test_driver_signature_verify_hooks.forced_status );
+    if (mbedtls_test_driver_signature_verify_hooks.forced_status != PSA_SUCCESS) {
+        return mbedtls_test_driver_signature_verify_hooks.forced_status;
+    }
 
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
     defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_HASH)
     status = libtestdriver1_mbedtls_psa_hash_compute(
-                PSA_ALG_SIGN_GET_HASH( alg ), input, input_length,
-                hash, sizeof( hash ), &hash_length );
+        PSA_ALG_SIGN_GET_HASH(alg), input, input_length,
+        hash, sizeof(hash), &hash_length);
 #elif defined(MBEDTLS_PSA_BUILTIN_HASH)
     status = mbedtls_psa_hash_compute(
-                PSA_ALG_SIGN_GET_HASH( alg ), input, input_length,
-                hash, sizeof( hash ), &hash_length );
+        PSA_ALG_SIGN_GET_HASH(alg), input, input_length,
+        hash, sizeof(hash), &hash_length);
 #else
     (void) input;
     (void) input_length;
     status = PSA_ERROR_NOT_SUPPORTED;
 #endif
-    if( status != PSA_SUCCESS )
+    if (status != PSA_SUCCESS) {
         return status;
+    }
 
-    return( verify_hash( attributes, key_buffer, key_buffer_size,
-                         alg, hash, hash_length,
-                         signature, signature_length ) );
+    return verify_hash(attributes, key_buffer, key_buffer_size,
+                       alg, hash, hash_length,
+                       signature, signature_length);
 }
 
 psa_status_t mbedtls_test_opaque_signature_verify_message(
@@ -334,7 +320,7 @@
     const uint8_t *input,
     size_t input_length,
     const uint8_t *signature,
-    size_t signature_length )
+    size_t signature_length)
 {
     (void) attributes;
     (void) key;
@@ -345,7 +331,7 @@
     (void) signature;
     (void) signature_length;
 
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_transparent_signature_sign_hash(
@@ -353,26 +339,27 @@
     const uint8_t *key_buffer, size_t key_buffer_size,
     psa_algorithm_t alg,
     const uint8_t *hash, size_t hash_length,
-    uint8_t *signature, size_t signature_size, size_t *signature_length )
+    uint8_t *signature, size_t signature_size, size_t *signature_length)
 {
     ++mbedtls_test_driver_signature_sign_hooks.hits;
 
-    if( mbedtls_test_driver_signature_sign_hooks.forced_status != PSA_SUCCESS )
-        return( mbedtls_test_driver_signature_sign_hooks.forced_status );
-
-    if( mbedtls_test_driver_signature_sign_hooks.forced_output != NULL )
-    {
-        if( mbedtls_test_driver_signature_sign_hooks.forced_output_length > signature_size )
-            return( PSA_ERROR_BUFFER_TOO_SMALL );
-        memcpy( signature, mbedtls_test_driver_signature_sign_hooks.forced_output,
-                mbedtls_test_driver_signature_sign_hooks.forced_output_length );
-        *signature_length = mbedtls_test_driver_signature_sign_hooks.forced_output_length;
-        return( PSA_SUCCESS );
+    if (mbedtls_test_driver_signature_sign_hooks.forced_status != PSA_SUCCESS) {
+        return mbedtls_test_driver_signature_sign_hooks.forced_status;
     }
 
-    return( sign_hash( attributes, key_buffer, key_buffer_size,
-                      alg, hash, hash_length,
-                      signature, signature_size, signature_length ) );
+    if (mbedtls_test_driver_signature_sign_hooks.forced_output != NULL) {
+        if (mbedtls_test_driver_signature_sign_hooks.forced_output_length > signature_size) {
+            return PSA_ERROR_BUFFER_TOO_SMALL;
+        }
+        memcpy(signature, mbedtls_test_driver_signature_sign_hooks.forced_output,
+               mbedtls_test_driver_signature_sign_hooks.forced_output_length);
+        *signature_length = mbedtls_test_driver_signature_sign_hooks.forced_output_length;
+        return PSA_SUCCESS;
+    }
+
+    return sign_hash(attributes, key_buffer, key_buffer_size,
+                     alg, hash, hash_length,
+                     signature, signature_size, signature_length);
 }
 
 psa_status_t mbedtls_test_opaque_signature_sign_hash(
@@ -380,7 +367,7 @@
     const uint8_t *key, size_t key_length,
     psa_algorithm_t alg,
     const uint8_t *hash, size_t hash_length,
-    uint8_t *signature, size_t signature_size, size_t *signature_length )
+    uint8_t *signature, size_t signature_size, size_t *signature_length)
 {
     (void) attributes;
     (void) key;
@@ -392,7 +379,7 @@
     (void) signature_size;
     (void) signature_length;
 
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_transparent_signature_verify_hash(
@@ -400,16 +387,17 @@
     const uint8_t *key_buffer, size_t key_buffer_size,
     psa_algorithm_t alg,
     const uint8_t *hash, size_t hash_length,
-    const uint8_t *signature, size_t signature_length )
+    const uint8_t *signature, size_t signature_length)
 {
     ++mbedtls_test_driver_signature_verify_hooks.hits;
 
-    if( mbedtls_test_driver_signature_verify_hooks.forced_status != PSA_SUCCESS )
-        return( mbedtls_test_driver_signature_verify_hooks.forced_status );
+    if (mbedtls_test_driver_signature_verify_hooks.forced_status != PSA_SUCCESS) {
+        return mbedtls_test_driver_signature_verify_hooks.forced_status;
+    }
 
-    return verify_hash( attributes, key_buffer, key_buffer_size,
-                        alg, hash, hash_length,
-                        signature, signature_length );
+    return verify_hash(attributes, key_buffer, key_buffer_size,
+                       alg, hash, hash_length,
+                       signature, signature_length);
 }
 
 psa_status_t mbedtls_test_opaque_signature_verify_hash(
@@ -417,7 +405,7 @@
     const uint8_t *key, size_t key_length,
     psa_algorithm_t alg,
     const uint8_t *hash, size_t hash_length,
-    const uint8_t *signature, size_t signature_length )
+    const uint8_t *signature, size_t signature_length)
 {
     (void) attributes;
     (void) key;
@@ -427,7 +415,7 @@
     (void) hash_length;
     (void) signature;
     (void) signature_length;
-    return( PSA_ERROR_NOT_SUPPORTED );
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 #endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */
diff --git a/tests/src/drivers/test_driver_size.c b/tests/src/drivers/test_driver_size.c
index d8bcaee..e0226dd 100644
--- a/tests/src/drivers/test_driver_size.c
+++ b/tests/src/drivers/test_driver_size.c
@@ -37,7 +37,7 @@
  * This macro returns the base size for the key context. It is the size of the
  * driver specific information stored in each key context.
  */
-#define TEST_DRIVER_KEY_CONTEXT_BASE_SIZE sizeof( test_driver_key_context_t )
+#define TEST_DRIVER_KEY_CONTEXT_BASE_SIZE sizeof(test_driver_key_context_t)
 
 /*
  * Number of bytes included in every key context for a key pair.
@@ -70,32 +70,27 @@
 
 size_t mbedtls_test_size_function(
     const psa_key_type_t key_type,
-    const size_t key_bits )
+    const size_t key_bits)
 {
     size_t key_buffer_size = 0;
 
-    if( PSA_KEY_TYPE_IS_KEY_PAIR( key_type ) )
-    {
+    if (PSA_KEY_TYPE_IS_KEY_PAIR(key_type)) {
         int public_key_overhead =
-            ( ( TEST_DRIVER_KEY_CONTEXT_STORE_PUBLIC_KEY == 1 )
-              ? PSA_EXPORT_KEY_OUTPUT_SIZE( key_type, key_bits ) : 0 );
+            ((TEST_DRIVER_KEY_CONTEXT_STORE_PUBLIC_KEY == 1)
+              ? PSA_EXPORT_KEY_OUTPUT_SIZE(key_type, key_bits) : 0);
         key_buffer_size = TEST_DRIVER_KEY_CONTEXT_BASE_SIZE +
                           TEST_DRIVER_KEY_CONTEXT_PUBLIC_KEY_SIZE +
                           public_key_overhead;
-    }
-    else if( PSA_KEY_TYPE_IS_PUBLIC_KEY( key_type ) )
-    {
+    } else if (PSA_KEY_TYPE_IS_PUBLIC_KEY(key_type)) {
         key_buffer_size = TEST_DRIVER_KEY_CONTEXT_BASE_SIZE +
                           TEST_DRIVER_KEY_CONTEXT_PUBLIC_KEY_SIZE;
-    }
-    else if ( !PSA_KEY_TYPE_IS_KEY_PAIR( key_type ) &&
-              !PSA_KEY_TYPE_IS_PUBLIC_KEY ( key_type ) )
-    {
+    } else if (!PSA_KEY_TYPE_IS_KEY_PAIR(key_type) &&
+               !PSA_KEY_TYPE_IS_PUBLIC_KEY(key_type)) {
         key_buffer_size = TEST_DRIVER_KEY_CONTEXT_BASE_SIZE +
-                          ( TEST_DRIVER_KEY_CONTEXT_SYMMETRIC_FACTOR *
-                            ( ( key_bits + 7 ) / 8 ) );
+                          (TEST_DRIVER_KEY_CONTEXT_SYMMETRIC_FACTOR *
+                           ((key_bits + 7) / 8));
     }
 
-    return( key_buffer_size );
+    return key_buffer_size;
 }
 #endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */
diff --git a/tests/src/fake_external_rng_for_test.c b/tests/src/fake_external_rng_for_test.c
index 9c2195b..89af7d3 100644
--- a/tests/src/fake_external_rng_for_test.c
+++ b/tests/src/fake_external_rng_for_test.c
@@ -28,29 +28,30 @@
 
 static int test_insecure_external_rng_enabled = 0;
 
-void mbedtls_test_enable_insecure_external_rng( void )
+void mbedtls_test_enable_insecure_external_rng(void)
 {
     test_insecure_external_rng_enabled = 1;
 }
 
-void mbedtls_test_disable_insecure_external_rng( void )
+void mbedtls_test_disable_insecure_external_rng(void)
 {
     test_insecure_external_rng_enabled = 0;
 }
 
 psa_status_t mbedtls_psa_external_get_random(
     mbedtls_psa_external_random_context_t *context,
-    uint8_t *output, size_t output_size, size_t *output_length )
+    uint8_t *output, size_t output_size, size_t *output_length)
 {
     (void) context;
 
-    if( !test_insecure_external_rng_enabled )
-        return( PSA_ERROR_INSUFFICIENT_ENTROPY );
+    if (!test_insecure_external_rng_enabled) {
+        return PSA_ERROR_INSUFFICIENT_ENTROPY;
+    }
 
     /* This implementation is for test purposes only!
      * Use the libc non-cryptographic random generator. */
-    mbedtls_test_rnd_std_rand( NULL, output, output_size );
+    mbedtls_test_rnd_std_rand(NULL, output, output_size);
     *output_length = output_size;
-    return( PSA_SUCCESS );
+    return PSA_SUCCESS;
 }
 #endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
diff --git a/tests/src/helpers.c b/tests/src/helpers.c
index 77b4d94..6c215d1 100644
--- a/tests/src/helpers.c
+++ b/tests/src/helpers.c
@@ -28,8 +28,7 @@
 /* Static global variables */
 
 #if defined(MBEDTLS_CHECK_PARAMS)
-typedef struct
-{
+typedef struct {
     uint8_t expected_call;
     uint8_t expected_call_happened;
 
@@ -50,40 +49,40 @@
 /*----------------------------------------------------------------------------*/
 /* Helper Functions */
 
-int mbedtls_test_platform_setup( void )
+int mbedtls_test_platform_setup(void)
 {
     int ret = 0;
 #if defined(MBEDTLS_PLATFORM_C)
-    ret = mbedtls_platform_setup( &platform_ctx );
+    ret = mbedtls_platform_setup(&platform_ctx);
 #endif /* MBEDTLS_PLATFORM_C */
-    return( ret );
+    return ret;
 }
 
-void mbedtls_test_platform_teardown( void )
+void mbedtls_test_platform_teardown(void)
 {
 #if defined(MBEDTLS_PLATFORM_C)
-    mbedtls_platform_teardown( &platform_ctx );
+    mbedtls_platform_teardown(&platform_ctx);
 #endif /* MBEDTLS_PLATFORM_C */
 }
 
 static int ascii2uc(const char c, unsigned char *uc)
 {
-    if( ( c >= '0' ) && ( c <= '9' ) )
+    if ((c >= '0') && (c <= '9')) {
         *uc = c - '0';
-    else if( ( c >= 'a' ) && ( c <= 'f' ) )
+    } else if ((c >= 'a') && (c <= 'f')) {
         *uc = c - 'a' + 10;
-    else if( ( c >= 'A' ) && ( c <= 'F' ) )
+    } else if ((c >= 'A') && (c <= 'F')) {
         *uc = c - 'A' + 10;
-    else
-        return( -1 );
+    } else {
+        return -1;
+    }
 
-    return( 0 );
+    return 0;
 }
 
-void mbedtls_test_fail( const char *test, int line_no, const char* filename )
+void mbedtls_test_fail(const char *test, int line_no, const char *filename)
 {
-    if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED )
-    {
+    if (mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED) {
         /* We've already recorded the test as having failed. Don't
          * overwrite any previous information about the failure. */
         return;
@@ -94,7 +93,7 @@
     mbedtls_test_info.filename = filename;
 }
 
-void mbedtls_test_skip( const char *test, int line_no, const char* filename )
+void mbedtls_test_skip(const char *test, int line_no, const char *filename)
 {
     mbedtls_test_info.result = MBEDTLS_TEST_RESULT_SKIPPED;
     mbedtls_test_info.test = test;
@@ -102,7 +101,7 @@
     mbedtls_test_info.filename = filename;
 }
 
-void mbedtls_test_set_step( unsigned long step )
+void mbedtls_test_set_step(unsigned long step)
 {
     mbedtls_test_info.step = step;
 }
@@ -111,201 +110,205 @@
 unsigned mbedtls_test_case_uses_negative_0 = 0;
 #endif
 
-void mbedtls_test_info_reset( void )
+void mbedtls_test_info_reset(void)
 {
     mbedtls_test_info.result = MBEDTLS_TEST_RESULT_SUCCESS;
-    mbedtls_test_info.step = (unsigned long)( -1 );
+    mbedtls_test_info.step = (unsigned long) (-1);
     mbedtls_test_info.test = 0;
     mbedtls_test_info.line_no = 0;
     mbedtls_test_info.filename = 0;
-    memset( mbedtls_test_info.line1, 0, sizeof( mbedtls_test_info.line1 ) );
-    memset( mbedtls_test_info.line2, 0, sizeof( mbedtls_test_info.line2 ) );
+    memset(mbedtls_test_info.line1, 0, sizeof(mbedtls_test_info.line1));
+    memset(mbedtls_test_info.line2, 0, sizeof(mbedtls_test_info.line2));
 #if defined(MBEDTLS_BIGNUM_C)
     mbedtls_test_case_uses_negative_0 = 0;
 #endif
 }
 
-int mbedtls_test_equal( const char *test, int line_no, const char* filename,
-                        unsigned long long value1, unsigned long long value2 )
+int mbedtls_test_equal(const char *test, int line_no, const char *filename,
+                       unsigned long long value1, unsigned long long value2)
 {
-    TEST_CF_PUBLIC( &value1, sizeof( value1 ) );
-    TEST_CF_PUBLIC( &value2, sizeof( value2 ) );
+    TEST_CF_PUBLIC(&value1, sizeof(value1));
+    TEST_CF_PUBLIC(&value2, sizeof(value2));
 
-    if( value1 == value2 )
-        return( 1 );
+    if (value1 == value2) {
+        return 1;
+    }
 
-    if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED )
-    {
+    if (mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED) {
         /* We've already recorded the test as having failed. Don't
          * overwrite any previous information about the failure. */
-        return( 0 );
+        return 0;
     }
-    mbedtls_test_fail( test, line_no, filename );
-    (void) mbedtls_snprintf( mbedtls_test_info.line1,
-                             sizeof( mbedtls_test_info.line1 ),
-                             "lhs = 0x%016llx = %lld",
-                             value1, (long long) value1 );
-    (void) mbedtls_snprintf( mbedtls_test_info.line2,
-                             sizeof( mbedtls_test_info.line2 ),
-                             "rhs = 0x%016llx = %lld",
-                             value2, (long long) value2 );
-    return( 0 );
+    mbedtls_test_fail(test, line_no, filename);
+    (void) mbedtls_snprintf(mbedtls_test_info.line1,
+                            sizeof(mbedtls_test_info.line1),
+                            "lhs = 0x%016llx = %lld",
+                            value1, (long long) value1);
+    (void) mbedtls_snprintf(mbedtls_test_info.line2,
+                            sizeof(mbedtls_test_info.line2),
+                            "rhs = 0x%016llx = %lld",
+                            value2, (long long) value2);
+    return 0;
 }
 
-int mbedtls_test_le_u( const char *test, int line_no, const char* filename,
-                       unsigned long long value1, unsigned long long value2 )
+int mbedtls_test_le_u(const char *test, int line_no, const char *filename,
+                      unsigned long long value1, unsigned long long value2)
 {
-    TEST_CF_PUBLIC( &value1, sizeof( value1 ) );
-    TEST_CF_PUBLIC( &value2, sizeof( value2 ) );
+    TEST_CF_PUBLIC(&value1, sizeof(value1));
+    TEST_CF_PUBLIC(&value2, sizeof(value2));
 
-    if( value1 <= value2 )
-        return( 1 );
+    if (value1 <= value2) {
+        return 1;
+    }
 
-    if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED )
-    {
+    if (mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED) {
         /* We've already recorded the test as having failed. Don't
          * overwrite any previous information about the failure. */
-        return( 0 );
+        return 0;
     }
-    mbedtls_test_fail( test, line_no, filename );
-    (void) mbedtls_snprintf( mbedtls_test_info.line1,
-                             sizeof( mbedtls_test_info.line1 ),
-                             "lhs = 0x%016llx = %llu",
-                             value1, value1 );
-    (void) mbedtls_snprintf( mbedtls_test_info.line2,
-                             sizeof( mbedtls_test_info.line2 ),
-                             "rhs = 0x%016llx = %llu",
-                             value2, value2 );
-    return( 0 );
+    mbedtls_test_fail(test, line_no, filename);
+    (void) mbedtls_snprintf(mbedtls_test_info.line1,
+                            sizeof(mbedtls_test_info.line1),
+                            "lhs = 0x%016llx = %llu",
+                            value1, value1);
+    (void) mbedtls_snprintf(mbedtls_test_info.line2,
+                            sizeof(mbedtls_test_info.line2),
+                            "rhs = 0x%016llx = %llu",
+                            value2, value2);
+    return 0;
 }
 
-int mbedtls_test_le_s( const char *test, int line_no, const char* filename,
-                       long long value1, long long value2 )
+int mbedtls_test_le_s(const char *test, int line_no, const char *filename,
+                      long long value1, long long value2)
 {
-    TEST_CF_PUBLIC( &value1, sizeof( value1 ) );
-    TEST_CF_PUBLIC( &value2, sizeof( value2 ) );
+    TEST_CF_PUBLIC(&value1, sizeof(value1));
+    TEST_CF_PUBLIC(&value2, sizeof(value2));
 
-    if( value1 <= value2 )
-        return( 1 );
+    if (value1 <= value2) {
+        return 1;
+    }
 
-    if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED )
-    {
+    if (mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED) {
         /* We've already recorded the test as having failed. Don't
          * overwrite any previous information about the failure. */
-        return( 0 );
+        return 0;
     }
-    mbedtls_test_fail( test, line_no, filename );
-    (void) mbedtls_snprintf( mbedtls_test_info.line1,
-                             sizeof( mbedtls_test_info.line1 ),
-                             "lhs = 0x%016llx = %lld",
-                             (unsigned long long) value1, value1 );
-    (void) mbedtls_snprintf( mbedtls_test_info.line2,
-                             sizeof( mbedtls_test_info.line2 ),
-                             "rhs = 0x%016llx = %lld",
-                             (unsigned long long) value2, value2 );
-    return( 0 );
+    mbedtls_test_fail(test, line_no, filename);
+    (void) mbedtls_snprintf(mbedtls_test_info.line1,
+                            sizeof(mbedtls_test_info.line1),
+                            "lhs = 0x%016llx = %lld",
+                            (unsigned long long) value1, value1);
+    (void) mbedtls_snprintf(mbedtls_test_info.line2,
+                            sizeof(mbedtls_test_info.line2),
+                            "rhs = 0x%016llx = %lld",
+                            (unsigned long long) value2, value2);
+    return 0;
 }
 
-int mbedtls_test_unhexify( unsigned char *obuf,
-                           size_t obufmax,
-                           const char *ibuf,
-                           size_t *len )
+int mbedtls_test_unhexify(unsigned char *obuf,
+                          size_t obufmax,
+                          const char *ibuf,
+                          size_t *len)
 {
     unsigned char uc, uc2;
 
-    *len = strlen( ibuf );
+    *len = strlen(ibuf);
 
     /* Must be even number of bytes. */
-    if ( ( *len ) & 1 )
-        return( -1 );
+    if ((*len) & 1) {
+        return -1;
+    }
     *len /= 2;
 
-    if ( (*len) > obufmax )
-        return( -1 );
-
-    while( *ibuf != 0 )
-    {
-        if ( ascii2uc( *(ibuf++), &uc ) != 0 )
-            return( -1 );
-
-        if ( ascii2uc( *(ibuf++), &uc2 ) != 0 )
-            return( -1 );
-
-        *(obuf++) = ( uc << 4 ) | uc2;
+    if ((*len) > obufmax) {
+        return -1;
     }
 
-    return( 0 );
+    while (*ibuf != 0) {
+        if (ascii2uc(*(ibuf++), &uc) != 0) {
+            return -1;
+        }
+
+        if (ascii2uc(*(ibuf++), &uc2) != 0) {
+            return -1;
+        }
+
+        *(obuf++) = (uc << 4) | uc2;
+    }
+
+    return 0;
 }
 
-void mbedtls_test_hexify( unsigned char *obuf,
-                          const unsigned char *ibuf,
-                          int len )
+void mbedtls_test_hexify(unsigned char *obuf,
+                         const unsigned char *ibuf,
+                         int len)
 {
     unsigned char l, h;
 
-    while( len != 0 )
-    {
+    while (len != 0) {
         h = *ibuf / 16;
         l = *ibuf % 16;
 
-        if( h < 10 )
+        if (h < 10) {
             *obuf++ = '0' + h;
-        else
+        } else {
             *obuf++ = 'a' + h - 10;
+        }
 
-        if( l < 10 )
+        if (l < 10) {
             *obuf++ = '0' + l;
-        else
+        } else {
             *obuf++ = 'a' + l - 10;
+        }
 
         ++ibuf;
         len--;
     }
 }
 
-unsigned char *mbedtls_test_zero_alloc( size_t len )
+unsigned char *mbedtls_test_zero_alloc(size_t len)
 {
     void *p;
-    size_t actual_len = ( len != 0 ) ? len : 1;
+    size_t actual_len = (len != 0) ? len : 1;
 
-    p = mbedtls_calloc( 1, actual_len );
-    TEST_HELPER_ASSERT( p != NULL );
+    p = mbedtls_calloc(1, actual_len);
+    TEST_HELPER_ASSERT(p != NULL);
 
-    memset( p, 0x00, actual_len );
+    memset(p, 0x00, actual_len);
 
-    return( p );
+    return p;
 }
 
-unsigned char *mbedtls_test_unhexify_alloc( const char *ibuf, size_t *olen )
+unsigned char *mbedtls_test_unhexify_alloc(const char *ibuf, size_t *olen)
 {
     unsigned char *obuf;
     size_t len;
 
-    *olen = strlen( ibuf ) / 2;
+    *olen = strlen(ibuf) / 2;
 
-    if( *olen == 0 )
-        return( mbedtls_test_zero_alloc( *olen ) );
+    if (*olen == 0) {
+        return mbedtls_test_zero_alloc(*olen);
+    }
 
-    obuf = mbedtls_calloc( 1, *olen );
-    TEST_HELPER_ASSERT( obuf != NULL );
-    TEST_HELPER_ASSERT( mbedtls_test_unhexify( obuf, *olen, ibuf, &len ) == 0 );
+    obuf = mbedtls_calloc(1, *olen);
+    TEST_HELPER_ASSERT(obuf != NULL);
+    TEST_HELPER_ASSERT(mbedtls_test_unhexify(obuf, *olen, ibuf, &len) == 0);
 
-    return( obuf );
+    return obuf;
 }
 
-int mbedtls_test_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;
 
-    if( a_len != b_len )
-        return( -1 );
+    if (a_len != b_len) {
+        return -1;
+    }
 
-    for( i = 0; i < a_len; i++ )
-    {
-        if( a[i] != b[i] )
-        {
+    for (i = 0; i < a_len; i++) {
+        if (a[i] != b[i]) {
             ret = -1;
             break;
         }
@@ -315,40 +318,41 @@
 
 #if defined(MBEDTLS_CHECK_PARAMS)
 void mbedtls_test_param_failed_get_location_record(
-         mbedtls_test_param_failed_location_record_t *location_record )
+    mbedtls_test_param_failed_location_record_t *location_record)
 {
     *location_record = param_failed_ctx.location_record;
 }
 
-void mbedtls_test_param_failed_expect_call( void )
+void mbedtls_test_param_failed_expect_call(void)
 {
     param_failed_ctx.expected_call_happened = 0;
     param_failed_ctx.expected_call = 1;
 }
 
-int mbedtls_test_param_failed_check_expected_call( void )
+int mbedtls_test_param_failed_check_expected_call(void)
 {
     param_failed_ctx.expected_call = 0;
 
-    if( param_failed_ctx.expected_call_happened != 0 )
-        return( 0 );
+    if (param_failed_ctx.expected_call_happened != 0) {
+        return 0;
+    }
 
-    return( -1 );
+    return -1;
 }
 
-void* mbedtls_test_param_failed_get_state_buf( void )
+void *mbedtls_test_param_failed_get_state_buf(void)
 {
     return &param_failed_ctx.state;
 }
 
-void mbedtls_test_param_failed_reset_state( void )
+void mbedtls_test_param_failed_reset_state(void)
 {
-    memset( param_failed_ctx.state, 0, sizeof( param_failed_ctx.state ) );
+    memset(param_failed_ctx.state, 0, sizeof(param_failed_ctx.state));
 }
 
-void mbedtls_param_failed( const char *failure_condition,
-                           const char *file,
-                           int line )
+void mbedtls_param_failed(const char *failure_condition,
+                          const char *file,
+                          int line)
 {
     /* Record the location of the failure */
     param_failed_ctx.location_record.failure_condition = failure_condition;
@@ -356,27 +360,24 @@
     param_failed_ctx.location_record.line = line;
 
     /* If we are testing the callback function...  */
-    if( param_failed_ctx.expected_call != 0 )
-    {
+    if (param_failed_ctx.expected_call != 0) {
         param_failed_ctx.expected_call = 0;
         param_failed_ctx.expected_call_happened = 1;
-    }
-    else
-    {
+    } else {
         /* ...else try a long jump. If the execution state has not been set-up
          * or reset then the long jump buffer is all zero's and the call will
          * with high probability fault, emphasizing there is something to look
          * at.
          */
 
-        longjmp( param_failed_ctx.state, 1 );
+        longjmp(param_failed_ctx.state, 1);
     }
 }
 #endif /* MBEDTLS_CHECK_PARAMS */
 
 #if defined(MBEDTLS_TEST_HOOKS)
-void mbedtls_test_err_add_check( int high, int low,
-                                 const char *file, int line )
+void mbedtls_test_err_add_check(int high, int low,
+                                const char *file, int line)
 {
     /* Error codes are always negative (a value of zero is a success) however
      * their positive opposites can be easier to understand. The following
@@ -390,74 +391,64 @@
      *     and module-dependent error code (bits 7..11)).
      * l = low level error code.
      */
-    if ( high > -0x1000 && high != 0 )
-    /* high < 0001000000000000
-     * No high level module ID bits are set.
-     */
-    {
-        mbedtls_test_fail( "'high' is not a high-level error code",
-                            line, file );
-    }
-    else if ( high < -0x7F80 )
-    /* high > 0111111110000000
-     * Error code is greater than the largest allowed high level module ID.
-     */
-    {
-        mbedtls_test_fail( "'high' error code is greater than 15 bits",
-                            line, file );
-    }
-    else if ( ( high & 0x7F ) != 0 )
-    /* high & 0000000001111111
-     * Error code contains low level error code bits.
-     */
-    {
-        mbedtls_test_fail( "'high' contains a low-level error code",
-                            line, file );
-    }
-    else if ( low < -0x007F )
-    /* low >  0000000001111111
-     * Error code contains high or module level error code bits.
-     */
-    {
-        mbedtls_test_fail( "'low' error code is greater than 7 bits",
-                            line, file );
-    }
-    else if ( low > 0 )
-    {
-        mbedtls_test_fail( "'low' error code is greater than zero",
-                            line, file );
+    if (high > -0x1000 && high != 0) {
+        /* high < 0001000000000000
+         * No high level module ID bits are set.
+         */
+        mbedtls_test_fail("'high' is not a high-level error code",
+                          line, file);
+    } else if (high < -0x7F80) {
+        /* high > 0111111110000000
+         * Error code is greater than the largest allowed high level module ID.
+         */
+        mbedtls_test_fail("'high' error code is greater than 15 bits",
+                          line, file);
+    } else if ((high & 0x7F) != 0) {
+        /* high & 0000000001111111
+         * Error code contains low level error code bits.
+         */
+        mbedtls_test_fail("'high' contains a low-level error code",
+                          line, file);
+    } else if (low < -0x007F) {
+        /* low >  0000000001111111
+         * Error code contains high or module level error code bits.
+         */
+        mbedtls_test_fail("'low' error code is greater than 7 bits",
+                          line, file);
+    } else if (low > 0) {
+        mbedtls_test_fail("'low' error code is greater than zero",
+                          line, file);
     }
 }
 #endif /* MBEDTLS_TEST_HOOKS */
 
 #if defined(MBEDTLS_BIGNUM_C)
-int mbedtls_test_read_mpi( mbedtls_mpi *X, const char *s )
+int mbedtls_test_read_mpi(mbedtls_mpi *X, const char *s)
 {
     int negative = 0;
     /* Always set the sign bit to -1 if the input has a minus sign, even for 0.
      * This creates an invalid representation, which mbedtls_mpi_read_string()
      * avoids but we want to be able to create that in test data. */
-    if( s[0] == '-' )
-    {
+    if (s[0] == '-') {
         ++s;
         negative = 1;
     }
     /* mbedtls_mpi_read_string() currently retains leading zeros.
      * It always allocates at least one limb for the value 0. */
-    if( s[0] == 0 )
-    {
-        mbedtls_mpi_free( X );
-        return( 0 );
+    if (s[0] == 0) {
+        mbedtls_mpi_free(X);
+        return 0;
     }
-    int ret = mbedtls_mpi_read_string( X, 16, s );
-    if( ret != 0 )
-        return( ret );
-    if( negative )
-    {
-        if( mbedtls_mpi_cmp_int( X, 0 ) == 0 )
+    int ret = mbedtls_mpi_read_string(X, 16, s);
+    if (ret != 0) {
+        return ret;
+    }
+    if (negative) {
+        if (mbedtls_mpi_cmp_int(X, 0) == 0) {
             ++mbedtls_test_case_uses_negative_0;
+        }
         X->s = -1;
     }
-    return( 0 );
+    return 0;
 }
 #endif
diff --git a/tests/src/psa_crypto_helpers.c b/tests/src/psa_crypto_helpers.c
index 299b6d1..06274d3 100644
--- a/tests/src/psa_crypto_helpers.c
+++ b/tests/src/psa_crypto_helpers.c
@@ -36,96 +36,106 @@
 static mbedtls_svc_key_id_t key_ids_used_in_test[9];
 static size_t num_key_ids_used;
 
-int mbedtls_test_uses_key_id( mbedtls_svc_key_id_t key_id )
+int mbedtls_test_uses_key_id(mbedtls_svc_key_id_t key_id)
 {
     size_t i;
-    if( MBEDTLS_SVC_KEY_ID_GET_KEY_ID( key_id ) >
-        PSA_MAX_PERSISTENT_KEY_IDENTIFIER )
-    {
+    if (MBEDTLS_SVC_KEY_ID_GET_KEY_ID(key_id) >
+        PSA_MAX_PERSISTENT_KEY_IDENTIFIER) {
         /* Don't touch key id values that designate non-key files. */
-        return( 1 );
+        return 1;
     }
-    for( i = 0; i < num_key_ids_used ; i++ )
-    {
-        if( mbedtls_svc_key_id_equal( key_id, key_ids_used_in_test[i] ) )
-            return( 1 );
+    for (i = 0; i < num_key_ids_used; i++) {
+        if (mbedtls_svc_key_id_equal(key_id, key_ids_used_in_test[i])) {
+            return 1;
+        }
     }
-    if( num_key_ids_used == ARRAY_LENGTH( key_ids_used_in_test ) )
-        return( 0 );
+    if (num_key_ids_used == ARRAY_LENGTH(key_ids_used_in_test)) {
+        return 0;
+    }
     key_ids_used_in_test[num_key_ids_used] = key_id;
     ++num_key_ids_used;
-    return( 1 );
+    return 1;
 }
 
-void mbedtls_test_psa_purge_key_storage( void )
+void mbedtls_test_psa_purge_key_storage(void)
 {
     size_t i;
-    for( i = 0; i < num_key_ids_used; i++ )
-        psa_destroy_persistent_key( key_ids_used_in_test[i] );
+    for (i = 0; i < num_key_ids_used; i++) {
+        psa_destroy_persistent_key(key_ids_used_in_test[i]);
+    }
     num_key_ids_used = 0;
 }
 
-void mbedtls_test_psa_purge_key_cache( void )
+void mbedtls_test_psa_purge_key_cache(void)
 {
     size_t i;
-    for( i = 0; i < num_key_ids_used; i++ )
-        psa_purge_key( key_ids_used_in_test[i] );
+    for (i = 0; i < num_key_ids_used; i++) {
+        psa_purge_key(key_ids_used_in_test[i]);
+    }
 }
 
 #endif /* MBEDTLS_PSA_CRYPTO_STORAGE_C */
 
-const char *mbedtls_test_helper_is_psa_leaking( void )
+const char *mbedtls_test_helper_is_psa_leaking(void)
 {
     mbedtls_psa_stats_t stats;
 
-    mbedtls_psa_get_stats( &stats );
+    mbedtls_psa_get_stats(&stats);
 
-    if( stats.volatile_slots != 0 )
-        return( "A volatile slot has not been closed properly." );
-    if( stats.persistent_slots != 0 )
-        return( "A persistent slot has not been closed properly." );
-    if( stats.external_slots != 0 )
-        return( "An external slot has not been closed properly." );
-     if( stats.half_filled_slots != 0 )
-        return( "A half-filled slot has not been cleared properly." );
-    if( stats.locked_slots != 0 )
-        return( "Some slots are still marked as locked." );
+    if (stats.volatile_slots != 0) {
+        return "A volatile slot has not been closed properly.";
+    }
+    if (stats.persistent_slots != 0) {
+        return "A persistent slot has not been closed properly.";
+    }
+    if (stats.external_slots != 0) {
+        return "An external slot has not been closed properly.";
+    }
+    if (stats.half_filled_slots != 0) {
+        return "A half-filled slot has not been cleared properly.";
+    }
+    if (stats.locked_slots != 0) {
+        return "Some slots are still marked as locked.";
+    }
 
-    return( NULL );
+    return NULL;
 }
 
 #if defined(RECORD_PSA_STATUS_COVERAGE_LOG)
 /** Name of the file where return statuses are logged by #RECORD_STATUS. */
 #define STATUS_LOG_FILE_NAME "statuses.log"
 
-psa_status_t mbedtls_test_record_status( psa_status_t status,
-                                         const char *func,
-                                         const char *file, int line,
-                                         const char *expr )
+psa_status_t mbedtls_test_record_status(psa_status_t status,
+                                        const char *func,
+                                        const char *file, int line,
+                                        const char *expr)
 {
     /* We open the log file on first use.
      * We never close the log file, so the record_status feature is not
      * compatible with resource leak detectors such as Asan.
      */
     static FILE *log;
-    if( log == NULL )
-        log = fopen( STATUS_LOG_FILE_NAME, "a" );
-    fprintf( log, "%d:%s:%s:%d:%s\n", (int) status, func, file, line, expr );
-    return( status );
+    if (log == NULL) {
+        log = fopen(STATUS_LOG_FILE_NAME, "a");
+    }
+    fprintf(log, "%d:%s:%s:%d:%s\n", (int) status, func, file, line, expr);
+    return status;
 }
 #endif /* defined(RECORD_PSA_STATUS_COVERAGE_LOG) */
 
-psa_key_usage_t mbedtls_test_update_key_usage_flags( psa_key_usage_t usage_flags )
+psa_key_usage_t mbedtls_test_update_key_usage_flags(psa_key_usage_t usage_flags)
 {
     psa_key_usage_t updated_usage = usage_flags;
 
-    if( usage_flags & PSA_KEY_USAGE_SIGN_HASH )
+    if (usage_flags & PSA_KEY_USAGE_SIGN_HASH) {
         updated_usage |= PSA_KEY_USAGE_SIGN_MESSAGE;
+    }
 
-    if( usage_flags & PSA_KEY_USAGE_VERIFY_HASH )
+    if (usage_flags & PSA_KEY_USAGE_VERIFY_HASH) {
         updated_usage |= PSA_KEY_USAGE_VERIFY_MESSAGE;
+    }
 
-    return( updated_usage );
+    return updated_usage;
 }
 
 #endif /* MBEDTLS_PSA_CRYPTO_C */
diff --git a/tests/src/psa_exercise_key.c b/tests/src/psa_exercise_key.c
index d1650f1..0843e24 100644
--- a/tests/src/psa_exercise_key.c
+++ b/tests/src/psa_exercise_key.c
@@ -33,14 +33,14 @@
 #include <test/psa_crypto_helpers.h>
 
 #if defined(MBEDTLS_PSA_CRYPTO_SE_C)
-static int lifetime_is_dynamic_secure_element( psa_key_lifetime_t lifetime )
+static int lifetime_is_dynamic_secure_element(psa_key_lifetime_t lifetime)
 {
-    return( PSA_KEY_LIFETIME_GET_LOCATION( lifetime ) !=
-            PSA_KEY_LOCATION_LOCAL_STORAGE );
+    return PSA_KEY_LIFETIME_GET_LOCATION(lifetime) !=
+           PSA_KEY_LOCATION_LOCAL_STORAGE;
 }
 #endif
 
-static int check_key_attributes_sanity( mbedtls_svc_key_id_t key )
+static int check_key_attributes_sanity(mbedtls_svc_key_id_t key)
 {
     int ok = 0;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -49,58 +49,54 @@
     psa_key_type_t type;
     size_t bits;
 
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    lifetime = psa_get_key_lifetime( &attributes );
-    id = psa_get_key_id( &attributes );
-    type = psa_get_key_type( &attributes );
-    bits = psa_get_key_bits( &attributes );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    lifetime = psa_get_key_lifetime(&attributes);
+    id = psa_get_key_id(&attributes);
+    type = psa_get_key_type(&attributes);
+    bits = psa_get_key_bits(&attributes);
 
     /* Persistence */
-    if( PSA_KEY_LIFETIME_IS_VOLATILE( lifetime ) )
-    {
+    if (PSA_KEY_LIFETIME_IS_VOLATILE(lifetime)) {
         TEST_ASSERT(
-            ( PSA_KEY_ID_VOLATILE_MIN <=
-              MBEDTLS_SVC_KEY_ID_GET_KEY_ID( id ) ) &&
-            ( MBEDTLS_SVC_KEY_ID_GET_KEY_ID( id ) <=
-              PSA_KEY_ID_VOLATILE_MAX ) );
-    }
-    else
-    {
+            (PSA_KEY_ID_VOLATILE_MIN <=
+             MBEDTLS_SVC_KEY_ID_GET_KEY_ID(id)) &&
+            (MBEDTLS_SVC_KEY_ID_GET_KEY_ID(id) <=
+             PSA_KEY_ID_VOLATILE_MAX));
+    } else {
         TEST_ASSERT(
-            ( PSA_KEY_ID_USER_MIN <= MBEDTLS_SVC_KEY_ID_GET_KEY_ID( id ) ) &&
-            ( MBEDTLS_SVC_KEY_ID_GET_KEY_ID( id ) <= PSA_KEY_ID_USER_MAX ) );
+            (PSA_KEY_ID_USER_MIN <= MBEDTLS_SVC_KEY_ID_GET_KEY_ID(id)) &&
+            (MBEDTLS_SVC_KEY_ID_GET_KEY_ID(id) <= PSA_KEY_ID_USER_MAX));
     }
 #if defined(MBEDTLS_PSA_CRYPTO_SE_C)
     /* randomly-generated 64-bit constant, should never appear in test data */
     psa_key_slot_number_t slot_number = 0xec94d4a5058a1a21;
-    psa_status_t status = psa_get_key_slot_number( &attributes, &slot_number );
-    if( lifetime_is_dynamic_secure_element( lifetime ) )
-    {
+    psa_status_t status = psa_get_key_slot_number(&attributes, &slot_number);
+    if (lifetime_is_dynamic_secure_element(lifetime)) {
         /* Mbed Crypto currently always exposes the slot number to
          * applications. This is not mandated by the PSA specification
          * and may change in future versions. */
-        TEST_EQUAL( status, 0 );
-        TEST_ASSERT( slot_number != 0xec94d4a5058a1a21 );
-    }
-    else
-    {
-        TEST_EQUAL( status, PSA_ERROR_INVALID_ARGUMENT );
+        TEST_EQUAL(status, 0);
+        TEST_ASSERT(slot_number != 0xec94d4a5058a1a21);
+    } else {
+        TEST_EQUAL(status, PSA_ERROR_INVALID_ARGUMENT);
     }
 #endif
 
     /* Type and size */
-    TEST_ASSERT( type != 0 );
-    TEST_ASSERT( bits != 0 );
-    TEST_ASSERT( bits <= PSA_MAX_KEY_BITS );
-    if( PSA_KEY_TYPE_IS_UNSTRUCTURED( type ) )
-        TEST_ASSERT( bits % 8 == 0 );
+    TEST_ASSERT(type != 0);
+    TEST_ASSERT(bits != 0);
+    TEST_ASSERT(bits <= PSA_MAX_KEY_BITS);
+    if (PSA_KEY_TYPE_IS_UNSTRUCTURED(type)) {
+        TEST_ASSERT(bits % 8 == 0);
+    }
 
     /* MAX macros concerning specific key types */
-    if( PSA_KEY_TYPE_IS_ECC( type ) )
-        TEST_ASSERT( bits <= PSA_VENDOR_ECC_MAX_CURVE_BITS );
-    else if( PSA_KEY_TYPE_IS_RSA( type ) )
-        TEST_ASSERT( bits <= PSA_VENDOR_RSA_MAX_KEY_BITS );
-    TEST_ASSERT( PSA_BLOCK_CIPHER_BLOCK_LENGTH( type ) <= PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE );
+    if (PSA_KEY_TYPE_IS_ECC(type)) {
+        TEST_ASSERT(bits <= PSA_VENDOR_ECC_MAX_CURVE_BITS);
+    } else if (PSA_KEY_TYPE_IS_RSA(type)) {
+        TEST_ASSERT(bits <= PSA_VENDOR_RSA_MAX_KEY_BITS);
+    }
+    TEST_ASSERT(PSA_BLOCK_CIPHER_BLOCK_LENGTH(type) <= PSA_BLOCK_CIPHER_BLOCK_MAX_SIZE);
 
     ok = 1;
 
@@ -109,410 +105,389 @@
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    return( ok );
+    return ok;
 }
 
-static int exercise_mac_key( mbedtls_svc_key_id_t key,
-                             psa_key_usage_t usage,
-                             psa_algorithm_t alg )
+static int exercise_mac_key(mbedtls_svc_key_id_t key,
+                            psa_key_usage_t usage,
+                            psa_algorithm_t alg)
 {
     psa_mac_operation_t operation = PSA_MAC_OPERATION_INIT;
     const unsigned char input[] = "foo";
-    unsigned char mac[PSA_MAC_MAX_SIZE] = {0};
-    size_t mac_length = sizeof( mac );
+    unsigned char mac[PSA_MAC_MAX_SIZE] = { 0 };
+    size_t mac_length = sizeof(mac);
 
     /* Convert wildcard algorithm to exercisable algorithm */
-    if( alg & PSA_ALG_MAC_AT_LEAST_THIS_LENGTH_FLAG )
-    {
-        alg = PSA_ALG_TRUNCATED_MAC( alg, PSA_MAC_TRUNCATED_LENGTH( alg ) );
+    if (alg & PSA_ALG_MAC_AT_LEAST_THIS_LENGTH_FLAG) {
+        alg = PSA_ALG_TRUNCATED_MAC(alg, PSA_MAC_TRUNCATED_LENGTH(alg));
     }
 
-    if( usage & PSA_KEY_USAGE_SIGN_HASH )
-    {
-        PSA_ASSERT( psa_mac_sign_setup( &operation, key, alg ) );
-        PSA_ASSERT( psa_mac_update( &operation,
-                                    input, sizeof( input ) ) );
-        PSA_ASSERT( psa_mac_sign_finish( &operation,
-                                         mac, sizeof( mac ),
-                                         &mac_length ) );
+    if (usage & PSA_KEY_USAGE_SIGN_HASH) {
+        PSA_ASSERT(psa_mac_sign_setup(&operation, key, alg));
+        PSA_ASSERT(psa_mac_update(&operation,
+                                  input, sizeof(input)));
+        PSA_ASSERT(psa_mac_sign_finish(&operation,
+                                       mac, sizeof(mac),
+                                       &mac_length));
     }
 
-    if( usage & PSA_KEY_USAGE_VERIFY_HASH )
-    {
+    if (usage & PSA_KEY_USAGE_VERIFY_HASH) {
         psa_status_t verify_status =
-            ( usage & PSA_KEY_USAGE_SIGN_HASH ?
-              PSA_SUCCESS :
-              PSA_ERROR_INVALID_SIGNATURE );
-        PSA_ASSERT( psa_mac_verify_setup( &operation, key, alg ) );
-        PSA_ASSERT( psa_mac_update( &operation,
-                                    input, sizeof( input ) ) );
-        TEST_EQUAL( psa_mac_verify_finish( &operation, mac, mac_length ),
-                    verify_status );
+            (usage & PSA_KEY_USAGE_SIGN_HASH ?
+             PSA_SUCCESS :
+             PSA_ERROR_INVALID_SIGNATURE);
+        PSA_ASSERT(psa_mac_verify_setup(&operation, key, alg));
+        PSA_ASSERT(psa_mac_update(&operation,
+                                  input, sizeof(input)));
+        TEST_EQUAL(psa_mac_verify_finish(&operation, mac, mac_length),
+                   verify_status);
     }
 
-    return( 1 );
+    return 1;
 
 exit:
-    psa_mac_abort( &operation );
-    return( 0 );
+    psa_mac_abort(&operation);
+    return 0;
 }
 
-static int exercise_cipher_key( mbedtls_svc_key_id_t key,
-                                psa_key_usage_t usage,
-                                psa_algorithm_t alg )
+static int exercise_cipher_key(mbedtls_svc_key_id_t key,
+                               psa_key_usage_t usage,
+                               psa_algorithm_t alg)
 {
     psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT;
-    unsigned char iv[PSA_CIPHER_IV_MAX_SIZE] = {0};
+    unsigned char iv[PSA_CIPHER_IV_MAX_SIZE] = { 0 };
     size_t iv_length;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_type_t key_type;
     const unsigned char plaintext[16] = "Hello, world...";
     unsigned char ciphertext[32] = "(wabblewebblewibblewobblewubble)";
-    size_t ciphertext_length = sizeof( ciphertext );
-    unsigned char decrypted[sizeof( ciphertext )];
+    size_t ciphertext_length = sizeof(ciphertext);
+    unsigned char decrypted[sizeof(ciphertext)];
     size_t part_length;
 
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_type = psa_get_key_type( &attributes );
-    iv_length = PSA_CIPHER_IV_LENGTH( key_type, alg );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_type = psa_get_key_type(&attributes);
+    iv_length = PSA_CIPHER_IV_LENGTH(key_type, alg);
 
-    if( usage & PSA_KEY_USAGE_ENCRYPT )
-    {
-        PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-        if( iv_length != 0 )
-        {
-            PSA_ASSERT( psa_cipher_generate_iv( &operation,
-                                                iv, sizeof( iv ),
-                                                &iv_length ) );
+    if (usage & PSA_KEY_USAGE_ENCRYPT) {
+        PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+        if (iv_length != 0) {
+            PSA_ASSERT(psa_cipher_generate_iv(&operation,
+                                              iv, sizeof(iv),
+                                              &iv_length));
         }
-        PSA_ASSERT( psa_cipher_update( &operation,
-                                       plaintext, sizeof( plaintext ),
-                                       ciphertext, sizeof( ciphertext ),
-                                       &ciphertext_length ) );
-        PSA_ASSERT( psa_cipher_finish( &operation,
-                                       ciphertext + ciphertext_length,
-                                       sizeof( ciphertext ) - ciphertext_length,
-                                       &part_length ) );
+        PSA_ASSERT(psa_cipher_update(&operation,
+                                     plaintext, sizeof(plaintext),
+                                     ciphertext, sizeof(ciphertext),
+                                     &ciphertext_length));
+        PSA_ASSERT(psa_cipher_finish(&operation,
+                                     ciphertext + ciphertext_length,
+                                     sizeof(ciphertext) - ciphertext_length,
+                                     &part_length));
         ciphertext_length += part_length;
     }
 
-    if( usage & PSA_KEY_USAGE_DECRYPT )
-    {
+    if (usage & PSA_KEY_USAGE_DECRYPT) {
         psa_status_t status;
         int maybe_invalid_padding = 0;
-        if( ! ( usage & PSA_KEY_USAGE_ENCRYPT ) )
-        {
-            maybe_invalid_padding = ! PSA_ALG_IS_STREAM_CIPHER( alg );
+        if (!(usage & PSA_KEY_USAGE_ENCRYPT)) {
+            maybe_invalid_padding = !PSA_ALG_IS_STREAM_CIPHER(alg);
         }
-        PSA_ASSERT( psa_cipher_decrypt_setup( &operation, key, alg ) );
-        if( iv_length != 0 )
-        {
-            PSA_ASSERT( psa_cipher_set_iv( &operation,
-                                           iv, iv_length ) );
+        PSA_ASSERT(psa_cipher_decrypt_setup(&operation, key, alg));
+        if (iv_length != 0) {
+            PSA_ASSERT(psa_cipher_set_iv(&operation,
+                                         iv, iv_length));
         }
-        PSA_ASSERT( psa_cipher_update( &operation,
-                                       ciphertext, ciphertext_length,
-                                       decrypted, sizeof( decrypted ),
-                                       &part_length ) );
-        status = psa_cipher_finish( &operation,
-                                    decrypted + part_length,
-                                    sizeof( decrypted ) - part_length,
-                                    &part_length );
+        PSA_ASSERT(psa_cipher_update(&operation,
+                                     ciphertext, ciphertext_length,
+                                     decrypted, sizeof(decrypted),
+                                     &part_length));
+        status = psa_cipher_finish(&operation,
+                                   decrypted + part_length,
+                                   sizeof(decrypted) - part_length,
+                                   &part_length);
         /* For a stream cipher, all inputs are valid. For a block cipher,
          * if the input is some arbitrary data rather than an actual
-         ciphertext, a padding error is likely.  */
-        if( maybe_invalid_padding )
-            TEST_ASSERT( status == PSA_SUCCESS ||
-                         status == PSA_ERROR_INVALID_PADDING );
-        else
-            PSA_ASSERT( status );
+           ciphertext, a padding error is likely.  */
+        if (maybe_invalid_padding) {
+            TEST_ASSERT(status == PSA_SUCCESS ||
+                        status == PSA_ERROR_INVALID_PADDING);
+        } else {
+            PSA_ASSERT(status);
+        }
     }
 
-    return( 1 );
+    return 1;
 
 exit:
-    psa_cipher_abort( &operation );
-    psa_reset_key_attributes( &attributes );
-    return( 0 );
+    psa_cipher_abort(&operation);
+    psa_reset_key_attributes(&attributes);
+    return 0;
 }
 
-static int exercise_aead_key( mbedtls_svc_key_id_t key,
-                              psa_key_usage_t usage,
-                              psa_algorithm_t alg )
+static int exercise_aead_key(mbedtls_svc_key_id_t key,
+                             psa_key_usage_t usage,
+                             psa_algorithm_t alg)
 {
-    unsigned char nonce[PSA_AEAD_NONCE_MAX_SIZE] = {0};
+    unsigned char nonce[PSA_AEAD_NONCE_MAX_SIZE] = { 0 };
     size_t nonce_length;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_type_t key_type;
     unsigned char plaintext[16] = "Hello, world...";
     unsigned char ciphertext[48] = "(wabblewebblewibblewobblewubble)";
-    size_t ciphertext_length = sizeof( ciphertext );
-    size_t plaintext_length = sizeof( ciphertext );
+    size_t ciphertext_length = sizeof(ciphertext);
+    size_t plaintext_length = sizeof(ciphertext);
 
     /* Convert wildcard algorithm to exercisable algorithm */
-    if( alg & PSA_ALG_AEAD_AT_LEAST_THIS_LENGTH_FLAG )
-    {
-        alg = PSA_ALG_AEAD_WITH_SHORTENED_TAG( alg, PSA_ALG_AEAD_GET_TAG_LENGTH( alg ) );
+    if (alg & PSA_ALG_AEAD_AT_LEAST_THIS_LENGTH_FLAG) {
+        alg = PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, PSA_ALG_AEAD_GET_TAG_LENGTH(alg));
     }
 
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_type = psa_get_key_type( &attributes );
-    nonce_length = PSA_AEAD_NONCE_LENGTH( key_type, alg );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_type = psa_get_key_type(&attributes);
+    nonce_length = PSA_AEAD_NONCE_LENGTH(key_type, alg);
 
-    if( usage & PSA_KEY_USAGE_ENCRYPT )
-    {
-        PSA_ASSERT( psa_aead_encrypt( key, alg,
-                                      nonce, nonce_length,
-                                      NULL, 0,
-                                      plaintext, sizeof( plaintext ),
-                                      ciphertext, sizeof( ciphertext ),
-                                      &ciphertext_length ) );
+    if (usage & PSA_KEY_USAGE_ENCRYPT) {
+        PSA_ASSERT(psa_aead_encrypt(key, alg,
+                                    nonce, nonce_length,
+                                    NULL, 0,
+                                    plaintext, sizeof(plaintext),
+                                    ciphertext, sizeof(ciphertext),
+                                    &ciphertext_length));
     }
 
-    if( usage & PSA_KEY_USAGE_DECRYPT )
-    {
+    if (usage & PSA_KEY_USAGE_DECRYPT) {
         psa_status_t verify_status =
-            ( usage & PSA_KEY_USAGE_ENCRYPT ?
-              PSA_SUCCESS :
-              PSA_ERROR_INVALID_SIGNATURE );
-        TEST_EQUAL( psa_aead_decrypt( key, alg,
-                                      nonce, nonce_length,
-                                      NULL, 0,
-                                      ciphertext, ciphertext_length,
-                                      plaintext, sizeof( plaintext ),
-                                      &plaintext_length ),
-                    verify_status );
+            (usage & PSA_KEY_USAGE_ENCRYPT ?
+             PSA_SUCCESS :
+             PSA_ERROR_INVALID_SIGNATURE);
+        TEST_EQUAL(psa_aead_decrypt(key, alg,
+                                    nonce, nonce_length,
+                                    NULL, 0,
+                                    ciphertext, ciphertext_length,
+                                    plaintext, sizeof(plaintext),
+                                    &plaintext_length),
+                   verify_status);
     }
 
-    return( 1 );
+    return 1;
 
 exit:
-    psa_reset_key_attributes( &attributes );
-    return( 0 );
+    psa_reset_key_attributes(&attributes);
+    return 0;
 }
 
-static int can_sign_or_verify_message( psa_key_usage_t usage,
-                                       psa_algorithm_t alg )
+static int can_sign_or_verify_message(psa_key_usage_t usage,
+                                      psa_algorithm_t alg)
 {
     /* Sign-the-unspecified-hash algorithms can only be used with
      * {sign,verify}_hash, not with {sign,verify}_message. */
-    if( alg == PSA_ALG_ECDSA_ANY || alg == PSA_ALG_RSA_PKCS1V15_SIGN_RAW )
-        return( 0 );
-    return( usage & ( PSA_KEY_USAGE_SIGN_MESSAGE |
-                      PSA_KEY_USAGE_VERIFY_MESSAGE ) );
+    if (alg == PSA_ALG_ECDSA_ANY || alg == PSA_ALG_RSA_PKCS1V15_SIGN_RAW) {
+        return 0;
+    }
+    return usage & (PSA_KEY_USAGE_SIGN_MESSAGE |
+                    PSA_KEY_USAGE_VERIFY_MESSAGE);
 }
 
-static int exercise_signature_key( mbedtls_svc_key_id_t key,
-                                   psa_key_usage_t usage,
-                                   psa_algorithm_t alg )
+static int exercise_signature_key(mbedtls_svc_key_id_t key,
+                                  psa_key_usage_t usage,
+                                  psa_algorithm_t alg)
 {
-    if( usage & ( PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH ) )
-    {
-        unsigned char payload[PSA_HASH_MAX_SIZE] = {1};
+    if (usage & (PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH)) {
+        unsigned char payload[PSA_HASH_MAX_SIZE] = { 1 };
         size_t payload_length = 16;
-        unsigned char signature[PSA_SIGNATURE_MAX_SIZE] = {0};
-        size_t signature_length = sizeof( signature );
-        psa_algorithm_t hash_alg = PSA_ALG_SIGN_GET_HASH( alg );
+        unsigned char signature[PSA_SIGNATURE_MAX_SIZE] = { 0 };
+        size_t signature_length = sizeof(signature);
+        psa_algorithm_t hash_alg = PSA_ALG_SIGN_GET_HASH(alg);
 
         /* If the policy allows signing with any hash, just pick one. */
-        if( PSA_ALG_IS_SIGN_HASH( alg ) && hash_alg == PSA_ALG_ANY_HASH )
-        {
+        if (PSA_ALG_IS_SIGN_HASH(alg) && hash_alg == PSA_ALG_ANY_HASH) {
     #if defined(KNOWN_MBEDTLS_SUPPORTED_HASH_ALG)
             hash_alg = KNOWN_MBEDTLS_SUPPORTED_HASH_ALG;
             alg ^= PSA_ALG_ANY_HASH ^ hash_alg;
     #else
-            TEST_ASSERT( ! "No hash algorithm for hash-and-sign testing" );
+            TEST_ASSERT(!"No hash algorithm for hash-and-sign testing");
     #endif
         }
 
         /* Some algorithms require the payload to have the size of
          * the hash encoded in the algorithm. Use this input size
          * even for algorithms that allow other input sizes. */
-        if( hash_alg != 0 )
-            payload_length = PSA_HASH_LENGTH( hash_alg );
+        if (hash_alg != 0) {
+            payload_length = PSA_HASH_LENGTH(hash_alg);
+        }
 
-        if( usage & PSA_KEY_USAGE_SIGN_HASH )
-        {
-            PSA_ASSERT( psa_sign_hash( key, alg,
+        if (usage & PSA_KEY_USAGE_SIGN_HASH) {
+            PSA_ASSERT(psa_sign_hash(key, alg,
+                                     payload, payload_length,
+                                     signature, sizeof(signature),
+                                     &signature_length));
+        }
+
+        if (usage & PSA_KEY_USAGE_VERIFY_HASH) {
+            psa_status_t verify_status =
+                (usage & PSA_KEY_USAGE_SIGN_HASH ?
+                 PSA_SUCCESS :
+                 PSA_ERROR_INVALID_SIGNATURE);
+            TEST_EQUAL(psa_verify_hash(key, alg,
                                        payload, payload_length,
-                                       signature, sizeof( signature ),
-                                       &signature_length ) );
-        }
-
-        if( usage & PSA_KEY_USAGE_VERIFY_HASH )
-        {
-            psa_status_t verify_status =
-                ( usage & PSA_KEY_USAGE_SIGN_HASH ?
-                  PSA_SUCCESS :
-                  PSA_ERROR_INVALID_SIGNATURE );
-            TEST_EQUAL( psa_verify_hash( key, alg,
-                                         payload, payload_length,
-                                         signature, signature_length ),
-                        verify_status );
+                                       signature, signature_length),
+                       verify_status);
         }
     }
 
-    if( can_sign_or_verify_message( usage, alg ) )
-    {
+    if (can_sign_or_verify_message(usage, alg)) {
         unsigned char message[256] = "Hello, world...";
-        unsigned char signature[PSA_SIGNATURE_MAX_SIZE] = {0};
+        unsigned char signature[PSA_SIGNATURE_MAX_SIZE] = { 0 };
         size_t message_length = 16;
-        size_t signature_length = sizeof( signature );
+        size_t signature_length = sizeof(signature);
 
-        if( usage & PSA_KEY_USAGE_SIGN_MESSAGE )
-        {
-            PSA_ASSERT( psa_sign_message( key, alg,
-                                          message, message_length,
-                                          signature, sizeof( signature ),
-                                          &signature_length ) );
+        if (usage & PSA_KEY_USAGE_SIGN_MESSAGE) {
+            PSA_ASSERT(psa_sign_message(key, alg,
+                                        message, message_length,
+                                        signature, sizeof(signature),
+                                        &signature_length));
         }
 
-        if( usage & PSA_KEY_USAGE_VERIFY_MESSAGE )
-        {
+        if (usage & PSA_KEY_USAGE_VERIFY_MESSAGE) {
             psa_status_t verify_status =
-                ( usage & PSA_KEY_USAGE_SIGN_MESSAGE ?
-                  PSA_SUCCESS :
-                  PSA_ERROR_INVALID_SIGNATURE );
-            TEST_EQUAL( psa_verify_message( key, alg,
-                                            message, message_length,
-                                            signature, signature_length ),
-                        verify_status );
+                (usage & PSA_KEY_USAGE_SIGN_MESSAGE ?
+                 PSA_SUCCESS :
+                 PSA_ERROR_INVALID_SIGNATURE);
+            TEST_EQUAL(psa_verify_message(key, alg,
+                                          message, message_length,
+                                          signature, signature_length),
+                       verify_status);
         }
     }
 
-    return( 1 );
+    return 1;
 
 exit:
-    return( 0 );
+    return 0;
 }
 
-static int exercise_asymmetric_encryption_key( mbedtls_svc_key_id_t key,
-                                               psa_key_usage_t usage,
-                                               psa_algorithm_t alg )
+static int exercise_asymmetric_encryption_key(mbedtls_svc_key_id_t key,
+                                              psa_key_usage_t usage,
+                                              psa_algorithm_t alg)
 {
     unsigned char plaintext[256] = "Hello, world...";
     unsigned char ciphertext[256] = "(wabblewebblewibblewobblewubble)";
-    size_t ciphertext_length = sizeof( ciphertext );
+    size_t ciphertext_length = sizeof(ciphertext);
     size_t plaintext_length = 16;
 
-    if( usage & PSA_KEY_USAGE_ENCRYPT )
-    {
-        PSA_ASSERT( psa_asymmetric_encrypt( key, alg,
-                                            plaintext, plaintext_length,
-                                            NULL, 0,
-                                            ciphertext, sizeof( ciphertext ),
-                                            &ciphertext_length ) );
+    if (usage & PSA_KEY_USAGE_ENCRYPT) {
+        PSA_ASSERT(psa_asymmetric_encrypt(key, alg,
+                                          plaintext, plaintext_length,
+                                          NULL, 0,
+                                          ciphertext, sizeof(ciphertext),
+                                          &ciphertext_length));
     }
 
-    if( usage & PSA_KEY_USAGE_DECRYPT )
-    {
+    if (usage & PSA_KEY_USAGE_DECRYPT) {
         psa_status_t status =
-            psa_asymmetric_decrypt( key, alg,
-                                    ciphertext, ciphertext_length,
-                                    NULL, 0,
-                                    plaintext, sizeof( plaintext ),
-                                    &plaintext_length );
-        TEST_ASSERT( status == PSA_SUCCESS ||
-                     ( ( usage & PSA_KEY_USAGE_ENCRYPT ) == 0 &&
-                       ( status == PSA_ERROR_INVALID_ARGUMENT ||
-                         status == PSA_ERROR_INVALID_PADDING ) ) );
+            psa_asymmetric_decrypt(key, alg,
+                                   ciphertext, ciphertext_length,
+                                   NULL, 0,
+                                   plaintext, sizeof(plaintext),
+                                   &plaintext_length);
+        TEST_ASSERT(status == PSA_SUCCESS ||
+                    ((usage & PSA_KEY_USAGE_ENCRYPT) == 0 &&
+                     (status == PSA_ERROR_INVALID_ARGUMENT ||
+                      status == PSA_ERROR_INVALID_PADDING)));
     }
 
-    return( 1 );
+    return 1;
 
 exit:
-    return( 0 );
+    return 0;
 }
 
 int mbedtls_test_psa_setup_key_derivation_wrap(
-    psa_key_derivation_operation_t* operation,
+    psa_key_derivation_operation_t *operation,
     mbedtls_svc_key_id_t key,
     psa_algorithm_t alg,
-    const unsigned char* input1, size_t input1_length,
-    const unsigned char* input2, size_t input2_length,
-    size_t capacity )
+    const unsigned char *input1, size_t input1_length,
+    const unsigned char *input2, size_t input2_length,
+    size_t capacity)
 {
-    PSA_ASSERT( psa_key_derivation_setup( operation, alg ) );
-    if( PSA_ALG_IS_HKDF( alg ) )
-    {
-        PSA_ASSERT( psa_key_derivation_input_bytes( operation,
-                                                    PSA_KEY_DERIVATION_INPUT_SALT,
-                                                    input1, input1_length ) );
-        PSA_ASSERT( psa_key_derivation_input_key( operation,
-                                                  PSA_KEY_DERIVATION_INPUT_SECRET,
-                                                  key ) );
-        PSA_ASSERT( psa_key_derivation_input_bytes( operation,
-                                                    PSA_KEY_DERIVATION_INPUT_INFO,
-                                                    input2,
-                                                    input2_length ) );
-    }
-    else if( PSA_ALG_IS_TLS12_PRF( alg ) ||
-             PSA_ALG_IS_TLS12_PSK_TO_MS( alg ) )
-    {
-        PSA_ASSERT( psa_key_derivation_input_bytes( operation,
-                                                    PSA_KEY_DERIVATION_INPUT_SEED,
-                                                    input1, input1_length ) );
-        PSA_ASSERT( psa_key_derivation_input_key( operation,
-                                                  PSA_KEY_DERIVATION_INPUT_SECRET,
-                                                  key ) );
-        PSA_ASSERT( psa_key_derivation_input_bytes( operation,
-                                                    PSA_KEY_DERIVATION_INPUT_LABEL,
-                                                    input2, input2_length ) );
-    }
-    else
-    {
-        TEST_ASSERT( ! "Key derivation algorithm not supported" );
+    PSA_ASSERT(psa_key_derivation_setup(operation, alg));
+    if (PSA_ALG_IS_HKDF(alg)) {
+        PSA_ASSERT(psa_key_derivation_input_bytes(operation,
+                                                  PSA_KEY_DERIVATION_INPUT_SALT,
+                                                  input1, input1_length));
+        PSA_ASSERT(psa_key_derivation_input_key(operation,
+                                                PSA_KEY_DERIVATION_INPUT_SECRET,
+                                                key));
+        PSA_ASSERT(psa_key_derivation_input_bytes(operation,
+                                                  PSA_KEY_DERIVATION_INPUT_INFO,
+                                                  input2,
+                                                  input2_length));
+    } else if (PSA_ALG_IS_TLS12_PRF(alg) ||
+               PSA_ALG_IS_TLS12_PSK_TO_MS(alg)) {
+        PSA_ASSERT(psa_key_derivation_input_bytes(operation,
+                                                  PSA_KEY_DERIVATION_INPUT_SEED,
+                                                  input1, input1_length));
+        PSA_ASSERT(psa_key_derivation_input_key(operation,
+                                                PSA_KEY_DERIVATION_INPUT_SECRET,
+                                                key));
+        PSA_ASSERT(psa_key_derivation_input_bytes(operation,
+                                                  PSA_KEY_DERIVATION_INPUT_LABEL,
+                                                  input2, input2_length));
+    } else {
+        TEST_ASSERT(!"Key derivation algorithm not supported");
     }
 
-    if( capacity != SIZE_MAX )
-        PSA_ASSERT( psa_key_derivation_set_capacity( operation, capacity ) );
+    if (capacity != SIZE_MAX) {
+        PSA_ASSERT(psa_key_derivation_set_capacity(operation, capacity));
+    }
 
-    return( 1 );
+    return 1;
 
 exit:
-    return( 0 );
+    return 0;
 }
 
 
-static int exercise_key_derivation_key( mbedtls_svc_key_id_t key,
-                                        psa_key_usage_t usage,
-                                        psa_algorithm_t alg )
+static int exercise_key_derivation_key(mbedtls_svc_key_id_t key,
+                                       psa_key_usage_t usage,
+                                       psa_algorithm_t alg)
 {
     psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
     unsigned char input1[] = "Input 1";
-    size_t input1_length = sizeof( input1 );
+    size_t input1_length = sizeof(input1);
     unsigned char input2[] = "Input 2";
-    size_t input2_length = sizeof( input2 );
+    size_t input2_length = sizeof(input2);
     unsigned char output[1];
-    size_t capacity = sizeof( output );
+    size_t capacity = sizeof(output);
 
-    if( usage & PSA_KEY_USAGE_DERIVE )
-    {
-        if( !mbedtls_test_psa_setup_key_derivation_wrap( &operation, key, alg,
-                                                         input1, input1_length,
-                                                         input2, input2_length,
-                                                         capacity ) )
+    if (usage & PSA_KEY_USAGE_DERIVE) {
+        if (!mbedtls_test_psa_setup_key_derivation_wrap(&operation, key, alg,
+                                                        input1, input1_length,
+                                                        input2, input2_length,
+                                                        capacity)) {
             goto exit;
+        }
 
-        PSA_ASSERT( psa_key_derivation_output_bytes( &operation,
-                                                     output,
-                                                     capacity ) );
-        PSA_ASSERT( psa_key_derivation_abort( &operation ) );
+        PSA_ASSERT(psa_key_derivation_output_bytes(&operation,
+                                                   output,
+                                                   capacity));
+        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
  * private key against its own public key. */
 psa_status_t mbedtls_test_psa_key_agreement_with_self(
     psa_key_derivation_operation_t *operation,
-    mbedtls_svc_key_id_t key )
+    mbedtls_svc_key_id_t key)
 {
     psa_key_type_t private_key_type;
     psa_key_type_t public_key_type;
@@ -525,34 +500,34 @@
     psa_status_t status = PSA_ERROR_GENERIC_ERROR;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    private_key_type = psa_get_key_type( &attributes );
-    key_bits = psa_get_key_bits( &attributes );
-    public_key_type = PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR( private_key_type );
-    public_key_length = PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE( public_key_type, key_bits );
-    ASSERT_ALLOC( public_key, public_key_length );
-    PSA_ASSERT( psa_export_public_key( key, public_key, public_key_length,
-                                       &public_key_length ) );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    private_key_type = psa_get_key_type(&attributes);
+    key_bits = psa_get_key_bits(&attributes);
+    public_key_type = PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(private_key_type);
+    public_key_length = PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(public_key_type, key_bits);
+    ASSERT_ALLOC(public_key, public_key_length);
+    PSA_ASSERT(psa_export_public_key(key, public_key, public_key_length,
+                                     &public_key_length));
 
     status = psa_key_derivation_key_agreement(
         operation, PSA_KEY_DERIVATION_INPUT_SECRET, key,
-        public_key, public_key_length );
+        public_key, public_key_length);
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    mbedtls_free( public_key );
-    return( status );
+    mbedtls_free(public_key);
+    return status;
 }
 
 /* We need two keys to exercise key agreement. Exercise the
  * private key against its own public key. */
 psa_status_t mbedtls_test_psa_raw_key_agreement_with_self(
     psa_algorithm_t alg,
-    mbedtls_svc_key_id_t key )
+    mbedtls_svc_key_id_t key)
 {
     psa_key_type_t private_key_type;
     psa_key_type_t public_key_type;
@@ -567,26 +542,25 @@
     psa_status_t status = PSA_ERROR_GENERIC_ERROR;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    private_key_type = psa_get_key_type( &attributes );
-    key_bits = psa_get_key_bits( &attributes );
-    public_key_type = PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR( private_key_type );
-    public_key_length = PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE( public_key_type, key_bits );
-    ASSERT_ALLOC( public_key, public_key_length );
-    PSA_ASSERT( psa_export_public_key( key,
-                                       public_key, public_key_length,
-                                       &public_key_length ) );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    private_key_type = psa_get_key_type(&attributes);
+    key_bits = psa_get_key_bits(&attributes);
+    public_key_type = PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(private_key_type);
+    public_key_length = PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(public_key_type, key_bits);
+    ASSERT_ALLOC(public_key, public_key_length);
+    PSA_ASSERT(psa_export_public_key(key,
+                                     public_key, public_key_length,
+                                     &public_key_length));
 
-    status = psa_raw_key_agreement( alg, key,
-                                    public_key, public_key_length,
-                                    output, sizeof( output ), &output_length );
-    if ( status == PSA_SUCCESS )
-    {
-        TEST_ASSERT( output_length <=
-                     PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE( private_key_type,
-                                                        key_bits ) );
-        TEST_ASSERT( output_length <=
-                     PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE );
+    status = psa_raw_key_agreement(alg, key,
+                                   public_key, public_key_length,
+                                   output, sizeof(output), &output_length);
+    if (status == PSA_SUCCESS) {
+        TEST_ASSERT(output_length <=
+                    PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE(private_key_type,
+                                                      key_bits));
+        TEST_ASSERT(output_length <=
+                    PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE);
     }
 
 exit:
@@ -594,93 +568,86 @@
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    mbedtls_free( public_key );
-    return( status );
+    mbedtls_free(public_key);
+    return status;
 }
 
-static int exercise_raw_key_agreement_key( mbedtls_svc_key_id_t key,
-                                           psa_key_usage_t usage,
-                                           psa_algorithm_t alg )
+static int exercise_raw_key_agreement_key(mbedtls_svc_key_id_t key,
+                                          psa_key_usage_t usage,
+                                          psa_algorithm_t alg)
 {
     int ok = 0;
 
-    if( usage & PSA_KEY_USAGE_DERIVE )
-    {
+    if (usage & PSA_KEY_USAGE_DERIVE) {
         /* We need two keys to exercise key agreement. Exercise the
          * private key against its own public key. */
-        PSA_ASSERT( mbedtls_test_psa_raw_key_agreement_with_self( alg, key ) );
+        PSA_ASSERT(mbedtls_test_psa_raw_key_agreement_with_self(alg, key));
     }
     ok = 1;
 
 exit:
-    return( ok );
+    return ok;
 }
 
-static int exercise_key_agreement_key( mbedtls_svc_key_id_t key,
-                                       psa_key_usage_t usage,
-                                       psa_algorithm_t alg )
+static int exercise_key_agreement_key(mbedtls_svc_key_id_t key,
+                                      psa_key_usage_t usage,
+                                      psa_algorithm_t alg)
 {
     psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
     unsigned char input[1];
     unsigned char output[1];
     int ok = 0;
-    psa_algorithm_t kdf_alg = PSA_ALG_KEY_AGREEMENT_GET_KDF( alg );
+    psa_algorithm_t kdf_alg = PSA_ALG_KEY_AGREEMENT_GET_KDF(alg);
 
-    if( usage & PSA_KEY_USAGE_DERIVE )
-    {
+    if (usage & PSA_KEY_USAGE_DERIVE) {
         /* We need two keys to exercise key agreement. Exercise the
          * private key against its own public key. */
-        PSA_ASSERT( psa_key_derivation_setup( &operation, alg ) );
-        if( PSA_ALG_IS_TLS12_PRF( kdf_alg ) ||
-            PSA_ALG_IS_TLS12_PSK_TO_MS( kdf_alg ) )
-        {
-            PSA_ASSERT( psa_key_derivation_input_bytes(
-                            &operation, PSA_KEY_DERIVATION_INPUT_SEED,
-                            input, sizeof( input ) ) );
+        PSA_ASSERT(psa_key_derivation_setup(&operation, alg));
+        if (PSA_ALG_IS_TLS12_PRF(kdf_alg) ||
+            PSA_ALG_IS_TLS12_PSK_TO_MS(kdf_alg)) {
+            PSA_ASSERT(psa_key_derivation_input_bytes(
+                           &operation, PSA_KEY_DERIVATION_INPUT_SEED,
+                           input, sizeof(input)));
         }
 
-        PSA_ASSERT( mbedtls_test_psa_key_agreement_with_self( &operation, key ) );
+        PSA_ASSERT(mbedtls_test_psa_key_agreement_with_self(&operation, key));
 
-        if( PSA_ALG_IS_TLS12_PRF( kdf_alg ) ||
-            PSA_ALG_IS_TLS12_PSK_TO_MS( kdf_alg ) )
-        {
-            PSA_ASSERT( psa_key_derivation_input_bytes(
-                            &operation, PSA_KEY_DERIVATION_INPUT_LABEL,
-                            input, sizeof( input ) ) );
+        if (PSA_ALG_IS_TLS12_PRF(kdf_alg) ||
+            PSA_ALG_IS_TLS12_PSK_TO_MS(kdf_alg)) {
+            PSA_ASSERT(psa_key_derivation_input_bytes(
+                           &operation, PSA_KEY_DERIVATION_INPUT_LABEL,
+                           input, sizeof(input)));
+        } else if (PSA_ALG_IS_HKDF(kdf_alg)) {
+            PSA_ASSERT(psa_key_derivation_input_bytes(
+                           &operation, PSA_KEY_DERIVATION_INPUT_INFO,
+                           input, sizeof(input)));
         }
-        else if( PSA_ALG_IS_HKDF( kdf_alg ) )
-        {
-            PSA_ASSERT( psa_key_derivation_input_bytes(
-                            &operation, PSA_KEY_DERIVATION_INPUT_INFO,
-                            input, sizeof( input ) ) );
-        }
-        PSA_ASSERT( psa_key_derivation_output_bytes( &operation,
-                                                     output,
-                                                     sizeof( output ) ) );
-        PSA_ASSERT( psa_key_derivation_abort( &operation ) );
+        PSA_ASSERT(psa_key_derivation_output_bytes(&operation,
+                                                   output,
+                                                   sizeof(output)));
+        PSA_ASSERT(psa_key_derivation_abort(&operation));
     }
     ok = 1;
 
 exit:
-    return( ok );
+    return ok;
 }
 
 int mbedtls_test_psa_exported_key_sanity_check(
     psa_key_type_t type, size_t bits,
-    const uint8_t *exported, size_t exported_length )
+    const uint8_t *exported, size_t exported_length)
 {
-    TEST_ASSERT( exported_length <= PSA_EXPORT_KEY_OUTPUT_SIZE( type, bits ) );
+    TEST_ASSERT(exported_length <= PSA_EXPORT_KEY_OUTPUT_SIZE(type, bits));
 
-    if( PSA_KEY_TYPE_IS_UNSTRUCTURED( type ) )
-        TEST_EQUAL( exported_length, PSA_BITS_TO_BYTES( bits ) );
-    else
+    if (PSA_KEY_TYPE_IS_UNSTRUCTURED(type)) {
+        TEST_EQUAL(exported_length, PSA_BITS_TO_BYTES(bits));
+    } else
 
 #if defined(MBEDTLS_ASN1_PARSE_C)
-    if( type == PSA_KEY_TYPE_RSA_KEY_PAIR )
-    {
-        uint8_t *p = (uint8_t*) exported;
+    if (type == PSA_KEY_TYPE_RSA_KEY_PAIR) {
+        uint8_t *p = (uint8_t *) exported;
         const uint8_t *end = exported + exported_length;
         size_t len;
         /*   RSAPrivateKey ::= SEQUENCE {
@@ -695,140 +662,139 @@
          *       coefficient         INTEGER,  -- (inverse of q) mod p
          *   }
          */
-        TEST_EQUAL( mbedtls_asn1_get_tag( &p, end, &len,
-                                          MBEDTLS_ASN1_SEQUENCE |
-                                          MBEDTLS_ASN1_CONSTRUCTED ), 0 );
-        TEST_EQUAL( len, end - p );
-        if( ! mbedtls_test_asn1_skip_integer( &p, end, 0, 0, 0 ) )
+        TEST_EQUAL(mbedtls_asn1_get_tag(&p, end, &len,
+                                        MBEDTLS_ASN1_SEQUENCE |
+                                        MBEDTLS_ASN1_CONSTRUCTED), 0);
+        TEST_EQUAL(len, end - p);
+        if (!mbedtls_test_asn1_skip_integer(&p, end, 0, 0, 0)) {
             goto exit;
-        if( ! mbedtls_test_asn1_skip_integer( &p, end, bits, bits, 1 ) )
+        }
+        if (!mbedtls_test_asn1_skip_integer(&p, end, bits, bits, 1)) {
             goto exit;
-        if( ! mbedtls_test_asn1_skip_integer( &p, end, 2, bits, 1 ) )
+        }
+        if (!mbedtls_test_asn1_skip_integer(&p, end, 2, bits, 1)) {
             goto exit;
+        }
         /* Require d to be at least half the size of n. */
-        if( ! mbedtls_test_asn1_skip_integer( &p, end, bits / 2, bits, 1 ) )
+        if (!mbedtls_test_asn1_skip_integer(&p, end, bits / 2, bits, 1)) {
             goto exit;
+        }
         /* Require p and q to be at most half the size of n, rounded up. */
-        if( ! mbedtls_test_asn1_skip_integer( &p, end, bits / 2, bits / 2 + 1, 1 ) )
+        if (!mbedtls_test_asn1_skip_integer(&p, end, bits / 2, bits / 2 + 1, 1)) {
             goto exit;
-        if( ! mbedtls_test_asn1_skip_integer( &p, end, bits / 2, bits / 2 + 1, 1 ) )
+        }
+        if (!mbedtls_test_asn1_skip_integer(&p, end, bits / 2, bits / 2 + 1, 1)) {
             goto exit;
-        if( ! mbedtls_test_asn1_skip_integer( &p, end, 1, bits / 2 + 1, 0 ) )
+        }
+        if (!mbedtls_test_asn1_skip_integer(&p, end, 1, bits / 2 + 1, 0)) {
             goto exit;
-        if( ! mbedtls_test_asn1_skip_integer( &p, end, 1, bits / 2 + 1, 0 ) )
+        }
+        if (!mbedtls_test_asn1_skip_integer(&p, end, 1, bits / 2 + 1, 0)) {
             goto exit;
-        if( ! mbedtls_test_asn1_skip_integer( &p, end, 1, bits / 2 + 1, 0 ) )
+        }
+        if (!mbedtls_test_asn1_skip_integer(&p, end, 1, bits / 2 + 1, 0)) {
             goto exit;
-        TEST_EQUAL( p - end, 0 );
+        }
+        TEST_EQUAL(p - end, 0);
 
-        TEST_ASSERT( exported_length <= PSA_EXPORT_KEY_PAIR_MAX_SIZE );
-    }
-    else
+        TEST_ASSERT(exported_length <= PSA_EXPORT_KEY_PAIR_MAX_SIZE);
+    } else
 #endif /* MBEDTLS_ASN1_PARSE_C */
 
 #if defined(MBEDTLS_ECP_C)
-    if( PSA_KEY_TYPE_IS_ECC_KEY_PAIR( type ) )
-    {
+    if (PSA_KEY_TYPE_IS_ECC_KEY_PAIR(type)) {
         /* Just the secret value */
-        TEST_EQUAL( exported_length, PSA_BITS_TO_BYTES( bits ) );
+        TEST_EQUAL(exported_length, PSA_BITS_TO_BYTES(bits));
 
-        TEST_ASSERT( exported_length <= PSA_EXPORT_KEY_PAIR_MAX_SIZE );
-    }
-    else
+        TEST_ASSERT(exported_length <= PSA_EXPORT_KEY_PAIR_MAX_SIZE);
+    } else
 #endif /* MBEDTLS_ECP_C */
 
 #if defined(MBEDTLS_ASN1_PARSE_C)
-    if( type == PSA_KEY_TYPE_RSA_PUBLIC_KEY )
-    {
-        uint8_t *p = (uint8_t*) exported;
+    if (type == PSA_KEY_TYPE_RSA_PUBLIC_KEY) {
+        uint8_t *p = (uint8_t *) exported;
         const uint8_t *end = exported + exported_length;
         size_t len;
         /*   RSAPublicKey ::= SEQUENCE {
          *      modulus            INTEGER,    -- n
          *      publicExponent     INTEGER  }  -- e
          */
-        TEST_EQUAL( mbedtls_asn1_get_tag( &p, end, &len,
-                                          MBEDTLS_ASN1_SEQUENCE |
-                                          MBEDTLS_ASN1_CONSTRUCTED ),
-                    0 );
-        TEST_EQUAL( len, end - p );
-        if( ! mbedtls_test_asn1_skip_integer( &p, end, bits, bits, 1 ) )
+        TEST_EQUAL(mbedtls_asn1_get_tag(&p, end, &len,
+                                        MBEDTLS_ASN1_SEQUENCE |
+                                        MBEDTLS_ASN1_CONSTRUCTED),
+                   0);
+        TEST_EQUAL(len, end - p);
+        if (!mbedtls_test_asn1_skip_integer(&p, end, bits, bits, 1)) {
             goto exit;
-        if( ! mbedtls_test_asn1_skip_integer( &p, end, 2, bits, 1 ) )
+        }
+        if (!mbedtls_test_asn1_skip_integer(&p, end, 2, bits, 1)) {
             goto exit;
-        TEST_EQUAL( p - end, 0 );
+        }
+        TEST_EQUAL(p - end, 0);
 
 
-        TEST_ASSERT( exported_length <=
-                     PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE( type, bits ) );
-        TEST_ASSERT( exported_length <=
-                     PSA_EXPORT_PUBLIC_KEY_MAX_SIZE );
-    }
-    else
+        TEST_ASSERT(exported_length <=
+                    PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(type, bits));
+        TEST_ASSERT(exported_length <=
+                    PSA_EXPORT_PUBLIC_KEY_MAX_SIZE);
+    } else
 #endif /* MBEDTLS_ASN1_PARSE_C */
 
 #if defined(MBEDTLS_ECP_C)
-    if( PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY( type ) )
-    {
+    if (PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY(type)) {
 
-        TEST_ASSERT( exported_length <=
-                     PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE( type, bits ) );
-        TEST_ASSERT( exported_length <=
-                     PSA_EXPORT_PUBLIC_KEY_MAX_SIZE );
+        TEST_ASSERT(exported_length <=
+                    PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(type, bits));
+        TEST_ASSERT(exported_length <=
+                    PSA_EXPORT_PUBLIC_KEY_MAX_SIZE);
 
-        if( PSA_KEY_TYPE_ECC_GET_FAMILY( type ) == PSA_ECC_FAMILY_MONTGOMERY )
-        {
+        if (PSA_KEY_TYPE_ECC_GET_FAMILY(type) == PSA_ECC_FAMILY_MONTGOMERY) {
             /* The representation of an ECC Montgomery public key is
              * the raw compressed point */
-             TEST_EQUAL( PSA_BITS_TO_BYTES( bits ), exported_length );
-        }
-        else
-        {
+            TEST_EQUAL(PSA_BITS_TO_BYTES(bits), exported_length);
+        } else {
             /* The representation of an ECC Weierstrass public key is:
              *      - The byte 0x04;
              *      - `x_P` as a `ceiling(m/8)`-byte string, big-endian;
              *      - `y_P` as a `ceiling(m/8)`-byte string, big-endian;
              *      - where m is the bit size associated with the curve.
              */
-            TEST_EQUAL( 1 + 2 * PSA_BITS_TO_BYTES( bits ), exported_length );
-            TEST_EQUAL( exported[0], 4 );
+            TEST_EQUAL(1 + 2 * PSA_BITS_TO_BYTES(bits), exported_length);
+            TEST_EQUAL(exported[0], 4);
         }
-    }
-    else
+    } else
 #endif /* MBEDTLS_ECP_C */
 
     {
         (void) exported;
-        TEST_ASSERT( ! "Sanity check not implemented for this key type" );
+        TEST_ASSERT(!"Sanity check not implemented for this key type");
     }
 
 #if defined(MBEDTLS_DES_C)
-    if( type == PSA_KEY_TYPE_DES )
-    {
+    if (type == PSA_KEY_TYPE_DES) {
         /* Check the parity bits. */
         unsigned i;
-        for( i = 0; i < bits / 8; i++ )
-        {
+        for (i = 0; i < bits / 8; i++) {
             unsigned bit_count = 0;
             unsigned m;
-            for( m = 1; m <= 0x100; m <<= 1 )
-            {
-                if( exported[i] & m )
+            for (m = 1; m <= 0x100; m <<= 1) {
+                if (exported[i] & m) {
                     ++bit_count;
+                }
             }
-            TEST_ASSERT( bit_count % 2 != 0 );
+            TEST_ASSERT(bit_count % 2 != 0);
         }
     }
 #endif
 
-    return( 1 );
+    return 1;
 
 exit:
-    return( 0 );
+    return 0;
 }
 
-static int exercise_export_key( mbedtls_svc_key_id_t key,
-                                psa_key_usage_t usage )
+static int exercise_export_key(mbedtls_svc_key_id_t key,
+                               psa_key_usage_t usage)
 {
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     uint8_t *exported = NULL;
@@ -836,42 +802,41 @@
     size_t exported_length = 0;
     int ok = 0;
 
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
 
     exported_size = PSA_EXPORT_KEY_OUTPUT_SIZE(
-                        psa_get_key_type( &attributes ),
-                        psa_get_key_bits( &attributes ) );
-    ASSERT_ALLOC( exported, exported_size );
+        psa_get_key_type(&attributes),
+        psa_get_key_bits(&attributes));
+    ASSERT_ALLOC(exported, exported_size);
 
-    if( ( usage & PSA_KEY_USAGE_EXPORT ) == 0 &&
-        ! PSA_KEY_TYPE_IS_PUBLIC_KEY( psa_get_key_type( &attributes ) ) )
-    {
-        TEST_EQUAL( psa_export_key( key, exported,
-                                    exported_size, &exported_length ),
-                    PSA_ERROR_NOT_PERMITTED );
+    if ((usage & PSA_KEY_USAGE_EXPORT) == 0 &&
+        !PSA_KEY_TYPE_IS_PUBLIC_KEY(psa_get_key_type(&attributes))) {
+        TEST_EQUAL(psa_export_key(key, exported,
+                                  exported_size, &exported_length),
+                   PSA_ERROR_NOT_PERMITTED);
         ok = 1;
         goto exit;
     }
 
-    PSA_ASSERT( psa_export_key( key,
-                                exported, exported_size,
-                                &exported_length ) );
+    PSA_ASSERT(psa_export_key(key,
+                              exported, exported_size,
+                              &exported_length));
     ok = mbedtls_test_psa_exported_key_sanity_check(
-        psa_get_key_type( &attributes ), psa_get_key_bits( &attributes ),
-        exported, exported_length );
+        psa_get_key_type(&attributes), psa_get_key_bits(&attributes),
+        exported, exported_length);
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    mbedtls_free( exported );
-    return( ok );
+    mbedtls_free(exported);
+    return ok;
 }
 
-static int exercise_export_public_key( mbedtls_svc_key_id_t key )
+static int exercise_export_public_key(mbedtls_svc_key_id_t key)
 {
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_type_t public_type;
@@ -880,119 +845,113 @@
     size_t exported_length = 0;
     int ok = 0;
 
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    if( ! PSA_KEY_TYPE_IS_ASYMMETRIC( psa_get_key_type( &attributes ) ) )
-    {
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    if (!PSA_KEY_TYPE_IS_ASYMMETRIC(psa_get_key_type(&attributes))) {
         exported_size = PSA_EXPORT_KEY_OUTPUT_SIZE(
-                            psa_get_key_type( &attributes ),
-                            psa_get_key_bits( &attributes ) );
-        ASSERT_ALLOC( exported, exported_size );
+            psa_get_key_type(&attributes),
+            psa_get_key_bits(&attributes));
+        ASSERT_ALLOC(exported, exported_size);
 
-        TEST_EQUAL( psa_export_public_key( key, exported,
-                                           exported_size, &exported_length ),
-                    PSA_ERROR_INVALID_ARGUMENT );
+        TEST_EQUAL(psa_export_public_key(key, exported,
+                                         exported_size, &exported_length),
+                   PSA_ERROR_INVALID_ARGUMENT);
         ok = 1;
         goto exit;
     }
 
     public_type = PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(
-        psa_get_key_type( &attributes ) );
-    exported_size = PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE( public_type,
-                                                       psa_get_key_bits( &attributes ) );
-    ASSERT_ALLOC( exported, exported_size );
+        psa_get_key_type(&attributes));
+    exported_size = PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(public_type,
+                                                      psa_get_key_bits(&attributes));
+    ASSERT_ALLOC(exported, exported_size);
 
-    PSA_ASSERT( psa_export_public_key( key,
-                                       exported, exported_size,
-                                       &exported_length ) );
+    PSA_ASSERT(psa_export_public_key(key,
+                                     exported, exported_size,
+                                     &exported_length));
     ok = mbedtls_test_psa_exported_key_sanity_check(
-        public_type, psa_get_key_bits( &attributes ),
-        exported, exported_length );
+        public_type, psa_get_key_bits(&attributes),
+        exported, exported_length);
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    mbedtls_free( exported );
-    return( ok );
+    mbedtls_free(exported);
+    return ok;
 }
 
-int mbedtls_test_psa_exercise_key( mbedtls_svc_key_id_t key,
-                                   psa_key_usage_t usage,
-                                   psa_algorithm_t alg )
+int mbedtls_test_psa_exercise_key(mbedtls_svc_key_id_t key,
+                                  psa_key_usage_t usage,
+                                  psa_algorithm_t alg)
 {
     int ok = 0;
 
-    if( ! check_key_attributes_sanity( key ) )
-        return( 0 );
+    if (!check_key_attributes_sanity(key)) {
+        return 0;
+    }
 
-    if( alg == 0 )
+    if (alg == 0) {
         ok = 1; /* If no algorithm, do nothing (used for raw data "keys"). */
-    else if( PSA_ALG_IS_MAC( alg ) )
-        ok = exercise_mac_key( key, usage, alg );
-    else if( PSA_ALG_IS_CIPHER( alg ) )
-        ok = exercise_cipher_key( key, usage, alg );
-    else if( PSA_ALG_IS_AEAD( alg ) )
-        ok = exercise_aead_key( key, usage, alg );
-    else if( PSA_ALG_IS_SIGN( alg ) )
-        ok = exercise_signature_key( key, usage, alg );
-    else if( PSA_ALG_IS_ASYMMETRIC_ENCRYPTION( alg ) )
-        ok = exercise_asymmetric_encryption_key( key, usage, alg );
-    else if( PSA_ALG_IS_KEY_DERIVATION( alg ) )
-        ok = exercise_key_derivation_key( key, usage, alg );
-    else if( PSA_ALG_IS_RAW_KEY_AGREEMENT( alg ) )
-        ok = exercise_raw_key_agreement_key( key, usage, alg );
-    else if( PSA_ALG_IS_KEY_AGREEMENT( alg ) )
-        ok = exercise_key_agreement_key( key, usage, alg );
-    else
-        TEST_ASSERT( ! "No code to exercise this category of algorithm" );
+    } else if (PSA_ALG_IS_MAC(alg)) {
+        ok = exercise_mac_key(key, usage, alg);
+    } else if (PSA_ALG_IS_CIPHER(alg)) {
+        ok = exercise_cipher_key(key, usage, alg);
+    } else if (PSA_ALG_IS_AEAD(alg)) {
+        ok = exercise_aead_key(key, usage, alg);
+    } else if (PSA_ALG_IS_SIGN(alg)) {
+        ok = exercise_signature_key(key, usage, alg);
+    } else if (PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg)) {
+        ok = exercise_asymmetric_encryption_key(key, usage, alg);
+    } else if (PSA_ALG_IS_KEY_DERIVATION(alg)) {
+        ok = exercise_key_derivation_key(key, usage, alg);
+    } else if (PSA_ALG_IS_RAW_KEY_AGREEMENT(alg)) {
+        ok = exercise_raw_key_agreement_key(key, usage, alg);
+    } else if (PSA_ALG_IS_KEY_AGREEMENT(alg)) {
+        ok = exercise_key_agreement_key(key, usage, alg);
+    } else {
+        TEST_ASSERT(!"No code to exercise this category of algorithm");
+    }
 
-    ok = ok && exercise_export_key( key, usage );
-    ok = ok && exercise_export_public_key( key );
+    ok = ok && exercise_export_key(key, usage);
+    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,
-                                                    psa_algorithm_t alg )
+psa_key_usage_t mbedtls_test_psa_usage_to_exercise(psa_key_type_t type,
+                                                   psa_algorithm_t alg)
 {
-    if( PSA_ALG_IS_MAC( alg ) || PSA_ALG_IS_SIGN( alg ) )
-    {
-        if( PSA_ALG_IS_SIGN_HASH( alg ) )
-        {
-            if( PSA_ALG_SIGN_GET_HASH( alg ) )
-                return( PSA_KEY_TYPE_IS_PUBLIC_KEY( type ) ?
-                        PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_VERIFY_MESSAGE:
-                        PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH |
-                        PSA_KEY_USAGE_SIGN_MESSAGE | PSA_KEY_USAGE_VERIFY_MESSAGE );
+    if (PSA_ALG_IS_MAC(alg) || PSA_ALG_IS_SIGN(alg)) {
+        if (PSA_ALG_IS_SIGN_HASH(alg)) {
+            if (PSA_ALG_SIGN_GET_HASH(alg)) {
+                return PSA_KEY_TYPE_IS_PUBLIC_KEY(type) ?
+                       PSA_KEY_USAGE_VERIFY_HASH | PSA_KEY_USAGE_VERIFY_MESSAGE :
+                       PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH |
+                       PSA_KEY_USAGE_SIGN_MESSAGE | PSA_KEY_USAGE_VERIFY_MESSAGE;
+            }
+        } else if (PSA_ALG_IS_SIGN_MESSAGE(alg)) {
+            return PSA_KEY_TYPE_IS_PUBLIC_KEY(type) ?
+                   PSA_KEY_USAGE_VERIFY_MESSAGE :
+                   PSA_KEY_USAGE_SIGN_MESSAGE | PSA_KEY_USAGE_VERIFY_MESSAGE;
         }
-        else if( PSA_ALG_IS_SIGN_MESSAGE( alg) )
-            return( PSA_KEY_TYPE_IS_PUBLIC_KEY( type ) ?
-                    PSA_KEY_USAGE_VERIFY_MESSAGE :
-                    PSA_KEY_USAGE_SIGN_MESSAGE | PSA_KEY_USAGE_VERIFY_MESSAGE );
 
-        return( PSA_KEY_TYPE_IS_PUBLIC_KEY( type ) ?
-                PSA_KEY_USAGE_VERIFY_HASH :
-                PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH );
-    }
-    else if( PSA_ALG_IS_CIPHER( alg ) || PSA_ALG_IS_AEAD( alg ) ||
-             PSA_ALG_IS_ASYMMETRIC_ENCRYPTION( alg ) )
-    {
-        return( PSA_KEY_TYPE_IS_PUBLIC_KEY( type ) ?
-                PSA_KEY_USAGE_ENCRYPT :
-                PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT );
-    }
-    else if( PSA_ALG_IS_KEY_DERIVATION( alg ) ||
-             PSA_ALG_IS_KEY_AGREEMENT( alg ) )
-    {
-        return( PSA_KEY_USAGE_DERIVE );
-    }
-    else
-    {
-        return( 0 );
+        return PSA_KEY_TYPE_IS_PUBLIC_KEY(type) ?
+               PSA_KEY_USAGE_VERIFY_HASH :
+               PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH;
+    } else if (PSA_ALG_IS_CIPHER(alg) || PSA_ALG_IS_AEAD(alg) ||
+               PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg)) {
+        return PSA_KEY_TYPE_IS_PUBLIC_KEY(type) ?
+               PSA_KEY_USAGE_ENCRYPT :
+               PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT;
+    } else if (PSA_ALG_IS_KEY_DERIVATION(alg) ||
+               PSA_ALG_IS_KEY_AGREEMENT(alg)) {
+        return PSA_KEY_USAGE_DERIVE;
+    } else {
+        return 0;
     }
 
 }
diff --git a/tests/src/random.c b/tests/src/random.c
index 7f3f401..e74e689 100644
--- a/tests/src/random.c
+++ b/tests/src/random.c
@@ -37,109 +37,111 @@
 
 #include <mbedtls/entropy.h>
 
-int mbedtls_test_rnd_std_rand( void *rng_state,
-                               unsigned char *output,
-                               size_t len )
+int mbedtls_test_rnd_std_rand(void *rng_state,
+                              unsigned char *output,
+                              size_t len)
 {
 #if !defined(__OpenBSD__) && !defined(__NetBSD__)
     size_t i;
 
-    if( rng_state != NULL )
+    if (rng_state != NULL) {
         rng_state  = NULL;
+    }
 
-    for( i = 0; i < len; ++i )
+    for (i = 0; i < len; ++i) {
         output[i] = rand();
+    }
 #else
-    if( rng_state != NULL )
+    if (rng_state != NULL) {
         rng_state = NULL;
+    }
 
-    arc4random_buf( output, len );
+    arc4random_buf(output, len);
 #endif /* !OpenBSD && !NetBSD */
 
-    return( 0 );
+    return 0;
 }
 
-int mbedtls_test_rnd_zero_rand( void *rng_state,
-                                unsigned char *output,
-                                size_t len )
+int mbedtls_test_rnd_zero_rand(void *rng_state,
+                               unsigned char *output,
+                               size_t len)
 {
-    if( rng_state != NULL )
+    if (rng_state != NULL) {
         rng_state  = NULL;
+    }
 
-    memset( output, 0, len );
+    memset(output, 0, len);
 
-    return( 0 );
+    return 0;
 }
 
-int mbedtls_test_rnd_buffer_rand( void *rng_state,
-                                  unsigned char *output,
-                                  size_t len )
+int mbedtls_test_rnd_buffer_rand(void *rng_state,
+                                 unsigned char *output,
+                                 size_t len)
 {
     mbedtls_test_rnd_buf_info *info = (mbedtls_test_rnd_buf_info *) rng_state;
     size_t use_len;
 
-    if( rng_state == NULL )
-        return( mbedtls_test_rnd_std_rand( NULL, output, len ) );
+    if (rng_state == NULL) {
+        return mbedtls_test_rnd_std_rand(NULL, output, len);
+    }
 
     use_len = len;
-    if( len > info->length )
+    if (len > info->length) {
         use_len = info->length;
+    }
 
-    if( use_len )
-    {
-        memcpy( output, info->buf, use_len );
+    if (use_len) {
+        memcpy(output, info->buf, use_len);
         info->buf += use_len;
         info->length -= use_len;
     }
 
-    if( len - use_len > 0 )
-    {
-        if( info->fallback_f_rng != NULL )
-        {
-            return( info->fallback_f_rng( info->fallback_p_rng,
-                                          output + use_len,
-                                          len - use_len ) );
+    if (len - use_len > 0) {
+        if (info->fallback_f_rng != NULL) {
+            return info->fallback_f_rng(info->fallback_p_rng,
+                                        output + use_len,
+                                        len - use_len);
+        } else {
+            return MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
         }
-        else
-            return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
     }
 
-    return( 0 );
+    return 0;
 }
 
-int mbedtls_test_rnd_pseudo_rand( void *rng_state,
-                                  unsigned char *output,
-                                  size_t len )
+int mbedtls_test_rnd_pseudo_rand(void *rng_state,
+                                 unsigned char *output,
+                                 size_t len)
 {
     mbedtls_test_rnd_pseudo_info *info =
         (mbedtls_test_rnd_pseudo_info *) rng_state;
-    uint32_t i, *k, sum, delta=0x9E3779B9;
+    uint32_t i, *k, sum, delta = 0x9E3779B9;
     unsigned char result[4], *out = output;
 
-    if( rng_state == NULL )
-        return( mbedtls_test_rnd_std_rand( NULL, output, len ) );
+    if (rng_state == NULL) {
+        return mbedtls_test_rnd_std_rand(NULL, output, len);
+    }
 
     k = info->key;
 
-    while( len > 0 )
-    {
-        size_t use_len = ( len > 4 ) ? 4 : len;
+    while (len > 0) {
+        size_t use_len = (len > 4) ? 4 : len;
         sum = 0;
 
-        for( i = 0; i < 32; i++ )
-        {
-            info->v0 += ( ( ( info->v1 << 4 ) ^ ( info->v1 >> 5 ) )
-                            + info->v1 ) ^ ( sum + k[sum & 3] );
+        for (i = 0; i < 32; i++) {
+            info->v0 += (((info->v1 << 4) ^ (info->v1 >> 5))
+                         + info->v1) ^ (sum + k[sum & 3]);
             sum += delta;
-            info->v1 += ( ( ( info->v0 << 4 ) ^ ( info->v0 >> 5 ) )
-                            + info->v0 ) ^ ( sum + k[( sum>>11 ) & 3] );
+            info->v1 += (((info->v0 << 4) ^ (info->v0 >> 5))
+                         + info->v0) ^ (sum + k[(sum>>11) & 3]);
         }
 
-        PUT_UINT32_BE( info->v0, result, 0 );
-        memcpy( out, result, use_len );
+        PUT_UINT32_BE(info->v0, result, 0);
+        memcpy(out, result, use_len);
         len -= use_len;
         out += 4;
     }
 
-    return( 0 );
+    return 0;
 }
diff --git a/tests/src/threading_helpers.c b/tests/src/threading_helpers.c
index ca91b79..ae6e590 100644
--- a/tests/src/threading_helpers.c
+++ b/tests/src/threading_helpers.c
@@ -70,8 +70,7 @@
  * indicate the exact location of the problematic call. To locate the error,
  * use a debugger and set a breakpoint on mbedtls_test_mutex_usage_error().
  */
-enum value_of_mutex_is_valid_field
-{
+enum value_of_mutex_is_valid_field {
     /* Potential values for the is_valid field of mbedtls_threading_mutex_t.
      * Note that MUTEX_FREED must be 0 and MUTEX_IDLE must be 1 for
      * compatibility with threading_mutex_init_pthread() and
@@ -82,12 +81,11 @@
     MUTEX_LOCKED = 2, //!< Set by our lock
 };
 
-typedef struct
-{
-    void (*init)( mbedtls_threading_mutex_t * );
-    void (*free)( mbedtls_threading_mutex_t * );
-    int (*lock)( mbedtls_threading_mutex_t * );
-    int (*unlock)( mbedtls_threading_mutex_t * );
+typedef struct {
+    void (*init)(mbedtls_threading_mutex_t *);
+    void (*free)(mbedtls_threading_mutex_t *);
+    int (*lock)(mbedtls_threading_mutex_t *);
+    int (*unlock)(mbedtls_threading_mutex_t *);
 } mutex_functions_t;
 static mutex_functions_t mutex_functions;
 
@@ -98,94 +96,96 @@
  */
 static int live_mutexes;
 
-static void mbedtls_test_mutex_usage_error( mbedtls_threading_mutex_t *mutex,
-                                            const char *msg )
+static void mbedtls_test_mutex_usage_error(mbedtls_threading_mutex_t *mutex,
+                                           const char *msg)
 {
     (void) mutex;
-    if( mbedtls_test_info.mutex_usage_error == NULL )
+    if (mbedtls_test_info.mutex_usage_error == NULL) {
         mbedtls_test_info.mutex_usage_error = msg;
-    mbedtls_fprintf( stdout, "[mutex: %s] ", msg );
+    }
+    mbedtls_fprintf(stdout, "[mutex: %s] ", msg);
     /* Don't mark the test as failed yet. This way, if the test fails later
      * for a functional reason, the test framework will report the message
      * and location for this functional reason. If the test passes,
      * mbedtls_test_mutex_usage_check() will mark it as failed. */
 }
 
-static void mbedtls_test_wrap_mutex_init( mbedtls_threading_mutex_t *mutex )
+static void mbedtls_test_wrap_mutex_init(mbedtls_threading_mutex_t *mutex)
 {
-    mutex_functions.init( mutex );
-    if( mutex->is_valid )
+    mutex_functions.init(mutex);
+    if (mutex->is_valid) {
         ++live_mutexes;
+    }
 }
 
-static void mbedtls_test_wrap_mutex_free( mbedtls_threading_mutex_t *mutex )
+static void mbedtls_test_wrap_mutex_free(mbedtls_threading_mutex_t *mutex)
 {
-    switch( mutex->is_valid )
-    {
+    switch (mutex->is_valid) {
         case MUTEX_FREED:
-            mbedtls_test_mutex_usage_error( mutex, "free without init or double free" );
+            mbedtls_test_mutex_usage_error(mutex, "free without init or double free");
             break;
         case MUTEX_IDLE:
             /* Do nothing. The underlying free function will reset is_valid
              * to 0. */
             break;
         case MUTEX_LOCKED:
-            mbedtls_test_mutex_usage_error( mutex, "free without unlock" );
+            mbedtls_test_mutex_usage_error(mutex, "free without unlock");
             break;
         default:
-            mbedtls_test_mutex_usage_error( mutex, "corrupted state" );
+            mbedtls_test_mutex_usage_error(mutex, "corrupted state");
             break;
     }
-    if( mutex->is_valid )
+    if (mutex->is_valid) {
         --live_mutexes;
-    mutex_functions.free( mutex );
+    }
+    mutex_functions.free(mutex);
 }
 
-static int mbedtls_test_wrap_mutex_lock( mbedtls_threading_mutex_t *mutex )
+static int mbedtls_test_wrap_mutex_lock(mbedtls_threading_mutex_t *mutex)
 {
-    int ret = mutex_functions.lock( mutex );
-    switch( mutex->is_valid )
-    {
+    int ret = mutex_functions.lock(mutex);
+    switch (mutex->is_valid) {
         case MUTEX_FREED:
-            mbedtls_test_mutex_usage_error( mutex, "lock without init" );
+            mbedtls_test_mutex_usage_error(mutex, "lock without init");
             break;
         case MUTEX_IDLE:
-            if( ret == 0 )
+            if (ret == 0) {
                 mutex->is_valid = 2;
+            }
             break;
         case MUTEX_LOCKED:
-            mbedtls_test_mutex_usage_error( mutex, "double lock" );
+            mbedtls_test_mutex_usage_error(mutex, "double lock");
             break;
         default:
-            mbedtls_test_mutex_usage_error( mutex, "corrupted state" );
+            mbedtls_test_mutex_usage_error(mutex, "corrupted state");
             break;
     }
-    return( ret );
+    return ret;
 }
 
-static int mbedtls_test_wrap_mutex_unlock( mbedtls_threading_mutex_t *mutex )
+static int mbedtls_test_wrap_mutex_unlock(mbedtls_threading_mutex_t *mutex)
 {
-    int ret = mutex_functions.unlock( mutex );
-    switch( mutex->is_valid )
-    {
+    int ret = mutex_functions.unlock(mutex);
+    switch (mutex->is_valid) {
         case MUTEX_FREED:
-            mbedtls_test_mutex_usage_error( mutex, "unlock without init" );
+            mbedtls_test_mutex_usage_error(mutex, "unlock without init");
             break;
         case MUTEX_IDLE:
-            mbedtls_test_mutex_usage_error( mutex, "unlock without lock" );
+            mbedtls_test_mutex_usage_error(mutex, "unlock without lock");
             break;
         case MUTEX_LOCKED:
-            if( ret == 0 )
+            if (ret == 0) {
                 mutex->is_valid = MUTEX_IDLE;
+            }
             break;
         default:
-            mbedtls_test_mutex_usage_error( mutex, "corrupted state" );
+            mbedtls_test_mutex_usage_error(mutex, "corrupted state");
             break;
     }
-    return( ret );
+    return ret;
 }
 
-void mbedtls_test_mutex_usage_init( void )
+void mbedtls_test_mutex_usage_init(void)
 {
     mutex_functions.init = mbedtls_mutex_init;
     mutex_functions.free = mbedtls_mutex_free;
@@ -197,25 +197,24 @@
     mbedtls_mutex_unlock = &mbedtls_test_wrap_mutex_unlock;
 }
 
-void mbedtls_test_mutex_usage_check( void )
+void mbedtls_test_mutex_usage_check(void)
 {
-    if( live_mutexes != 0 )
-    {
+    if (live_mutexes != 0) {
         /* A positive number (more init than free) means that a mutex resource
          * is leaking (on platforms where a mutex consumes more than the
          * mbedtls_threading_mutex_t object itself). The rare case of a
          * negative number means a missing init somewhere. */
-        mbedtls_fprintf( stdout, "[mutex: %d leaked] ", live_mutexes );
+        mbedtls_fprintf(stdout, "[mutex: %d leaked] ", live_mutexes);
         live_mutexes = 0;
-        if( mbedtls_test_info.mutex_usage_error == NULL )
+        if (mbedtls_test_info.mutex_usage_error == NULL) {
             mbedtls_test_info.mutex_usage_error = "missing free";
+        }
     }
-    if( mbedtls_test_info.mutex_usage_error != NULL &&
-        mbedtls_test_info.result != MBEDTLS_TEST_RESULT_FAILED )
-    {
+    if (mbedtls_test_info.mutex_usage_error != NULL &&
+        mbedtls_test_info.result != MBEDTLS_TEST_RESULT_FAILED) {
         /* Functionally, the test passed. But there was a mutex usage error,
          * so mark the test as failed after all. */
-        mbedtls_test_fail( "Mutex usage error", __LINE__, __FILE__ );
+        mbedtls_test_fail("Mutex usage error", __LINE__, __FILE__);
     }
     mbedtls_test_info.mutex_usage_error = NULL;
 }
diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function
index c085b18..eb0dc03 100644
--- a/tests/suites/helpers.function
+++ b/tests/suites/helpers.function
@@ -68,11 +68,11 @@
 /* Indicates whether we expect mbedtls_entropy_init
  * to initialize some strong entropy source. */
 #if defined(MBEDTLS_TEST_NULL_ENTROPY) ||             \
-    ( !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) && \
-      ( !defined(MBEDTLS_NO_PLATFORM_ENTROPY)  ||     \
-         defined(MBEDTLS_HAVEGE_C)             ||     \
-         defined(MBEDTLS_ENTROPY_HARDWARE_ALT) ||     \
-         defined(ENTROPY_NV_SEED) ) )
+    (!defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) && \
+    (!defined(MBEDTLS_NO_PLATFORM_ENTROPY)  ||     \
+    defined(MBEDTLS_HAVEGE_C)             ||     \
+    defined(MBEDTLS_ENTROPY_HARDWARE_ALT) ||     \
+    defined(ENTROPY_NV_SEED)))
 #define ENTROPY_HAVE_STRONG
 #endif
 
@@ -87,65 +87,60 @@
  *
  * \return 0 if the key store is empty, 1 otherwise.
  */
-int test_fail_if_psa_leaking( int line_no, const char *filename )
+int test_fail_if_psa_leaking(int line_no, const char *filename)
 {
-    const char *msg = mbedtls_test_helper_is_psa_leaking( );
-    if( msg == NULL )
+    const char *msg = mbedtls_test_helper_is_psa_leaking();
+    if (msg == NULL) {
         return 0;
-    else
-    {
-        mbedtls_test_fail( msg, line_no, filename );
+    } else {
+        mbedtls_test_fail(msg, line_no, filename);
         return 1;
     }
 }
 #endif /* defined(MBEDTLS_PSA_CRYPTO_C) */
 
 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
-static int redirect_output( FILE* out_stream, const char* path )
+static int redirect_output(FILE *out_stream, const char *path)
 {
     int out_fd, dup_fd;
-    FILE* path_stream;
+    FILE *path_stream;
 
-    out_fd = fileno( out_stream );
-    dup_fd = dup( out_fd );
+    out_fd = fileno(out_stream);
+    dup_fd = dup(out_fd);
 
-    if( dup_fd == -1 )
-    {
-        return( -1 );
+    if (dup_fd == -1) {
+        return -1;
     }
 
-    path_stream = fopen( path, "w" );
-    if( path_stream == NULL )
-    {
-        close( dup_fd );
-        return( -1 );
+    path_stream = fopen(path, "w");
+    if (path_stream == NULL) {
+        close(dup_fd);
+        return -1;
     }
 
-    fflush( out_stream );
-    if( dup2( fileno( path_stream ), out_fd ) == -1 )
-    {
-        close( dup_fd );
-        fclose( path_stream );
-        return( -1 );
+    fflush(out_stream);
+    if (dup2(fileno(path_stream), out_fd) == -1) {
+        close(dup_fd);
+        fclose(path_stream);
+        return -1;
     }
 
-    fclose( path_stream );
-    return( dup_fd );
+    fclose(path_stream);
+    return dup_fd;
 }
 
-static int restore_output( FILE* out_stream, int dup_fd )
+static int restore_output(FILE *out_stream, int dup_fd)
 {
-    int out_fd = fileno( out_stream );
+    int out_fd = fileno(out_stream);
 
-    fflush( out_stream );
-    if( dup2( dup_fd, out_fd ) == -1 )
-    {
-        close( out_fd );
-        close( dup_fd );
-        return( -1 );
+    fflush(out_stream);
+    if (dup2(dup_fd, out_fd) == -1) {
+        close(out_fd);
+        close(dup_fd);
+        return -1;
     }
 
-    close( dup_fd );
-    return( 0 );
+    close(dup_fd);
+    return 0;
 }
 #endif /* __unix__ || __APPLE__ __MACH__ */
diff --git a/tests/suites/host_test.function b/tests/suites/host_test.function
index bb06822..475a9c8 100644
--- a/tests/suites/host_test.function
+++ b/tests/suites/host_test.function
@@ -8,20 +8,19 @@
  *
  * \return      0 if success else 1
  */
-int verify_string( char **str )
+int verify_string(char **str)
 {
-    if( ( *str )[0] != '"' ||
-        ( *str )[strlen( *str ) - 1] != '"' )
-    {
-        mbedtls_fprintf( stderr,
-            "Expected string (with \"\") for parameter and got: %s\n", *str );
-        return( -1 );
+    if ((*str)[0] != '"' ||
+        (*str)[strlen(*str) - 1] != '"') {
+        mbedtls_fprintf(stderr,
+                        "Expected string (with \"\") for parameter and got: %s\n", *str);
+        return -1;
     }
 
-    ( *str )++;
-    ( *str )[strlen( *str ) - 1] = '\0';
+    (*str)++;
+    (*str)[strlen(*str) - 1] = '\0';
 
-    return( 0 );
+    return 0;
 }
 
 /**
@@ -33,50 +32,46 @@
  *
  * \return      0 if success else 1
  */
-int verify_int( char *str, int32_t *value )
+int verify_int(char *str, int32_t *value)
 {
     size_t i;
     int minus = 0;
     int digits = 1;
     int hex = 0;
 
-    for( i = 0; i < strlen( str ); i++ )
-    {
-        if( i == 0 && str[i] == '-' )
-        {
+    for (i = 0; i < strlen(str); i++) {
+        if (i == 0 && str[i] == '-') {
             minus = 1;
             continue;
         }
 
-        if( ( ( minus && i == 2 ) || ( !minus && i == 1 ) ) &&
-            str[i - 1] == '0' && ( str[i] == 'x' || str[i] == 'X' ) )
-        {
+        if (((minus && i == 2) || (!minus && i == 1)) &&
+            str[i - 1] == '0' && (str[i] == 'x' || str[i] == 'X')) {
             hex = 1;
             continue;
         }
 
-        if( ! ( ( str[i] >= '0' && str[i] <= '9' ) ||
-                ( hex && ( ( str[i] >= 'a' && str[i] <= 'f' ) ||
-                           ( str[i] >= 'A' && str[i] <= 'F' ) ) ) ) )
-        {
+        if (!((str[i] >= '0' && str[i] <= '9') ||
+              (hex && ((str[i] >= 'a' && str[i] <= 'f') ||
+                       (str[i] >= 'A' && str[i] <= 'F'))))) {
             digits = 0;
             break;
         }
     }
 
-    if( digits )
-    {
-        if( hex )
-            *value = strtol( str, NULL, 16 );
-        else
-            *value = strtol( str, NULL, 10 );
+    if (digits) {
+        if (hex) {
+            *value = strtol(str, NULL, 16);
+        } else {
+            *value = strtol(str, NULL, 10);
+        }
 
-        return( 0 );
+        return 0;
     }
 
-    mbedtls_fprintf( stderr,
-                    "Expected integer for parameter and got: %s\n", str );
-    return( KEY_VALUE_MAPPING_NOT_FOUND );
+    mbedtls_fprintf(stderr,
+                    "Expected integer for parameter and got: %s\n", str);
+    return KEY_VALUE_MAPPING_NOT_FOUND;
 }
 
 
@@ -107,44 +102,45 @@
  *
  * \return      0 if success else -1
  */
-int get_line( FILE *f, char *buf, size_t len )
+int get_line(FILE *f, char *buf, size_t len)
 {
     char *ret;
     int i = 0, str_len = 0, has_string = 0;
 
     /* Read until we get a valid line */
-    do
-    {
-        ret = fgets( buf, len, f );
-        if( ret == NULL )
-            return( -1 );
+    do {
+        ret = fgets(buf, len, f);
+        if (ret == NULL) {
+            return -1;
+        }
 
-        str_len = strlen( buf );
+        str_len = strlen(buf);
 
         /* Skip empty line and comment */
-        if ( str_len == 0 || buf[0] == '#' )
+        if (str_len == 0 || buf[0] == '#') {
             continue;
+        }
         has_string = 0;
-        for ( i = 0; i < str_len; i++ )
-        {
+        for (i = 0; i < str_len; i++) {
             char c = buf[i];
-            if ( c != ' ' && c != '\t' && c != '\n' &&
-                 c != '\v' && c != '\f' && c != '\r' )
-            {
+            if (c != ' ' && c != '\t' && c != '\n' &&
+                c != '\v' && c != '\f' && c != '\r') {
                 has_string = 1;
                 break;
             }
         }
-    } while( !has_string );
+    } while (!has_string);
 
     /* Strip new line and carriage return */
-    ret = buf + strlen( buf );
-    if( ret-- > buf && *ret == '\n' )
+    ret = buf + strlen(buf);
+    if (ret-- > buf && *ret == '\n') {
         *ret = '\0';
-    if( ret-- > buf && *ret == '\r' )
+    }
+    if (ret-- > buf && *ret == '\r') {
         *ret = '\0';
+    }
 
-    return( 0 );
+    return 0;
 }
 
 /**
@@ -157,8 +153,8 @@
  *
  * \return      Count of strings found.
  */
-static int parse_arguments( char *buf, size_t len, char **params,
-                            size_t params_len )
+static int parse_arguments(char *buf, size_t len, char **params,
+                           size_t params_len)
 {
     size_t cnt = 0, i;
     char *cur = buf;
@@ -166,20 +162,16 @@
 
     params[cnt++] = cur;
 
-    while( *p != '\0' && p < ( buf + len ) )
-    {
-        if( *p == '\\' )
-        {
+    while (*p != '\0' && p < (buf + len)) {
+        if (*p == '\\') {
             p++;
             p++;
             continue;
         }
-        if( *p == ':' )
-        {
-            if( p + 1 < buf + len )
-            {
+        if (*p == ':') {
+            if (p + 1 < buf + len) {
                 cur = p + 1;
-                TEST_HELPER_ASSERT( cnt < params_len );
+                TEST_HELPER_ASSERT(cnt < params_len);
                 params[cnt++] = cur;
             }
             *p = '\0';
@@ -189,35 +181,28 @@
     }
 
     /* Replace newlines, question marks and colons in strings */
-    for( i = 0; i < cnt; i++ )
-    {
+    for (i = 0; i < cnt; i++) {
         p = params[i];
         q = params[i];
 
-        while( *p != '\0' )
-        {
-            if( *p == '\\' && *( p + 1 ) == 'n' )
-            {
+        while (*p != '\0') {
+            if (*p == '\\' && *(p + 1) == 'n') {
                 p += 2;
-                *( q++ ) = '\n';
-            }
-            else if( *p == '\\' && *( p + 1 ) == ':' )
-            {
+                *(q++) = '\n';
+            } else if (*p == '\\' && *(p + 1) == ':') {
                 p += 2;
-                *( q++ ) = ':';
-            }
-            else if( *p == '\\' && *( p + 1 ) == '?' )
-            {
+                *(q++) = ':';
+            } else if (*p == '\\' && *(p + 1) == '?') {
                 p += 2;
-                *( q++ ) = '?';
+                *(q++) = '?';
+            } else {
+                *(q++) = *(p++);
             }
-            else
-                *( q++ ) = *( p++ );
         }
         *q = '\0';
     }
 
-    return( cnt );
+    return cnt;
 }
 
 /**
@@ -238,81 +223,59 @@
  *
  * \return      0 for success else 1
  */
-static int convert_params( size_t cnt , char ** params , int32_t * int_params_store )
+static int convert_params(size_t cnt, char **params, int32_t *int_params_store)
 {
-    char ** cur = params;
-    char ** out = params;
+    char **cur = params;
+    char **out = params;
     int ret = DISPATCH_TEST_SUCCESS;
 
-    while ( cur < params + cnt )
-    {
-        char * type = *cur++;
-        char * val = *cur++;
+    while (cur < params + cnt) {
+        char *type = *cur++;
+        char *val = *cur++;
 
-        if ( strcmp( type, "char*" ) == 0 )
-        {
-            if ( verify_string( &val ) == 0 )
-            {
-              *out++ = val;
-            }
-            else
-            {
-                ret = ( DISPATCH_INVALID_TEST_DATA );
+        if (strcmp(type, "char*") == 0) {
+            if (verify_string(&val) == 0) {
+                *out++ = val;
+            } else {
+                ret = (DISPATCH_INVALID_TEST_DATA);
                 break;
             }
-        }
-        else if ( strcmp( type, "int" ) == 0 )
-        {
-            if ( verify_int( val, int_params_store ) == 0 )
-            {
-              *out++ = (char *) int_params_store++;
-            }
-            else
-            {
-                ret = ( DISPATCH_INVALID_TEST_DATA );
+        } else if (strcmp(type, "int") == 0) {
+            if (verify_int(val, int_params_store) == 0) {
+                *out++ = (char *) int_params_store++;
+            } else {
+                ret = (DISPATCH_INVALID_TEST_DATA);
                 break;
             }
-        }
-        else if ( strcmp( type, "hex" ) == 0 )
-        {
-            if ( verify_string( &val ) == 0 )
-            {
+        } else if (strcmp(type, "hex") == 0) {
+            if (verify_string(&val) == 0) {
                 size_t len;
 
                 TEST_HELPER_ASSERT(
-                  mbedtls_test_unhexify( (unsigned char *) val, strlen( val ),
-                                         val, &len ) == 0 );
+                    mbedtls_test_unhexify((unsigned char *) val, strlen(val),
+                                          val, &len) == 0);
 
                 *int_params_store = len;
                 *out++ = val;
-                *out++ = (char *)(int_params_store++);
-            }
-            else
-            {
-                ret = ( DISPATCH_INVALID_TEST_DATA );
+                *out++ = (char *) (int_params_store++);
+            } else {
+                ret = (DISPATCH_INVALID_TEST_DATA);
                 break;
             }
-        }
-        else if ( strcmp( type, "exp" ) == 0 )
-        {
-            int exp_id = strtol( val, NULL, 10 );
-            if ( get_expression ( exp_id, int_params_store ) == 0 )
-            {
-              *out++ = (char *)int_params_store++;
+        } else if (strcmp(type, "exp") == 0) {
+            int exp_id = strtol(val, NULL, 10);
+            if (get_expression(exp_id, int_params_store) == 0) {
+                *out++ = (char *) int_params_store++;
+            } else {
+                ret = (DISPATCH_INVALID_TEST_DATA);
+                break;
             }
-            else
-            {
-              ret = ( DISPATCH_INVALID_TEST_DATA );
-              break;
-            }
-        }
-        else
-        {
-          ret = ( DISPATCH_INVALID_TEST_DATA );
-          break;
+        } else {
+            ret = (DISPATCH_INVALID_TEST_DATA);
+            break;
         }
     }
-    return( ret );
+    return ret;
 }
 
 /**
@@ -335,26 +298,27 @@
 #if defined(__GNUC__)
 __attribute__((__noinline__))
 #endif
-static int test_snprintf( size_t n, const char *ref_buf, int ref_ret )
+static int test_snprintf(size_t n, const char *ref_buf, int ref_ret)
 {
     int ret;
     char buf[10] = "xxxxxxxxx";
     const char ref[10] = "xxxxxxxxx";
 
-    if( n >= sizeof( buf ) )
-        return( -1 );
-    ret = mbedtls_snprintf( buf, n, "%s", "123" );
-    if( ret < 0 || (size_t) ret >= n )
+    if (n >= sizeof(buf)) {
+        return -1;
+    }
+    ret = mbedtls_snprintf(buf, n, "%s", "123");
+    if (ret < 0 || (size_t) ret >= n) {
         ret = -1;
-
-    if( strncmp( ref_buf, buf, sizeof( buf ) ) != 0 ||
-        ref_ret != ret ||
-        memcmp( buf + n, ref + n, sizeof( buf ) - n ) != 0 )
-    {
-        return( 1 );
     }
 
-    return( 0 );
+    if (strncmp(ref_buf, buf, sizeof(buf)) != 0 ||
+        ref_ret != ret ||
+        memcmp(buf + n, ref + n, sizeof(buf) - n) != 0) {
+        return 1;
+    }
+
+    return 0;
 }
 
 /**
@@ -362,14 +326,14 @@
  *
  * \return      0 for success else 1
  */
-static int run_test_snprintf( void )
+static int run_test_snprintf(void)
 {
-    return( test_snprintf( 0, "xxxxxxxxx",  -1 ) != 0 ||
-            test_snprintf( 1, "",           -1 ) != 0 ||
-            test_snprintf( 2, "1",          -1 ) != 0 ||
-            test_snprintf( 3, "12",         -1 ) != 0 ||
-            test_snprintf( 4, "123",         3 ) != 0 ||
-            test_snprintf( 5, "123",         3 ) != 0 );
+    return test_snprintf(0, "xxxxxxxxx",  -1) != 0 ||
+           test_snprintf(1, "",           -1) != 0 ||
+           test_snprintf(2, "1",          -1) != 0 ||
+           test_snprintf(3, "12",         -1) != 0 ||
+           test_snprintf(4, "123",         3) != 0 ||
+           test_snprintf(5, "123",         3) != 0;
 }
 
 /** \brief Write the description of the test case to the outcome CSV file.
@@ -379,43 +343,44 @@
  * \param argv0         The test suite name.
  * \param test_case     The test case description.
  */
-static void write_outcome_entry( FILE *outcome_file,
-                                 const char *argv0,
-                                 const char *test_case )
+static void write_outcome_entry(FILE *outcome_file,
+                                const char *argv0,
+                                const char *test_case)
 {
     /* The non-varying fields are initialized on first use. */
     static const char *platform = NULL;
     static const char *configuration = NULL;
     static const char *test_suite = NULL;
 
-    if( outcome_file == NULL )
+    if (outcome_file == NULL) {
         return;
+    }
 
-    if( platform == NULL )
-    {
-        platform = getenv( "MBEDTLS_TEST_PLATFORM" );
-        if( platform == NULL )
+    if (platform == NULL) {
+        platform = getenv("MBEDTLS_TEST_PLATFORM");
+        if (platform == NULL) {
             platform = "unknown";
+        }
     }
-    if( configuration == NULL )
-    {
-        configuration = getenv( "MBEDTLS_TEST_CONFIGURATION" );
-        if( configuration == NULL )
+    if (configuration == NULL) {
+        configuration = getenv("MBEDTLS_TEST_CONFIGURATION");
+        if (configuration == NULL) {
             configuration = "unknown";
+        }
     }
-    if( test_suite == NULL )
-    {
-        test_suite = strrchr( argv0, '/' );
-        if( test_suite != NULL )
+    if (test_suite == NULL) {
+        test_suite = strrchr(argv0, '/');
+        if (test_suite != NULL) {
             test_suite += 1; // skip the '/'
-        else
+        } else {
             test_suite = argv0;
+        }
     }
 
     /* Write the beginning of the outcome line.
      * Ignore errors: writing the outcome file is on a best-effort basis. */
-    mbedtls_fprintf( outcome_file, "%s;%s;%s;%s;",
-                     platform, configuration, test_suite, test_case );
+    mbedtls_fprintf(outcome_file, "%s;%s;%s;%s;",
+                    platform, configuration, test_suite, test_case);
 }
 
 /** \brief Write the result of the test case to the outcome CSV file.
@@ -429,65 +394,63 @@
  * \param ret                        The test dispatch status (DISPATCH_xxx).
  * \param info                       A pointer to the test info structure.
  */
-static void write_outcome_result( FILE *outcome_file,
-                                  size_t unmet_dep_count,
-                                  int unmet_dependencies[],
-                                  int missing_unmet_dependencies,
-                                  int ret,
-                                  const mbedtls_test_info_t *info )
+static void write_outcome_result(FILE *outcome_file,
+                                 size_t unmet_dep_count,
+                                 int unmet_dependencies[],
+                                 int missing_unmet_dependencies,
+                                 int ret,
+                                 const mbedtls_test_info_t *info)
 {
-    if( outcome_file == NULL )
+    if (outcome_file == NULL) {
         return;
+    }
 
     /* Write the end of the outcome line.
      * Ignore errors: writing the outcome file is on a best-effort basis. */
-    switch( ret )
-    {
+    switch (ret) {
         case DISPATCH_TEST_SUCCESS:
-            if( unmet_dep_count > 0 )
-            {
+            if (unmet_dep_count > 0) {
                 size_t i;
-                mbedtls_fprintf( outcome_file, "SKIP" );
-                for( i = 0; i < unmet_dep_count; i++ )
-                {
-                    mbedtls_fprintf( outcome_file, "%c%d",
-                                     i == 0 ? ';' : ':',
-                                     unmet_dependencies[i] );
+                mbedtls_fprintf(outcome_file, "SKIP");
+                for (i = 0; i < unmet_dep_count; i++) {
+                    mbedtls_fprintf(outcome_file, "%c%d",
+                                    i == 0 ? ';' : ':',
+                                    unmet_dependencies[i]);
                 }
-                if( missing_unmet_dependencies )
-                    mbedtls_fprintf( outcome_file, ":..." );
+                if (missing_unmet_dependencies) {
+                    mbedtls_fprintf(outcome_file, ":...");
+                }
                 break;
             }
-            switch( info->result )
-            {
+            switch (info->result) {
                 case MBEDTLS_TEST_RESULT_SUCCESS:
-                    mbedtls_fprintf( outcome_file, "PASS;" );
+                    mbedtls_fprintf(outcome_file, "PASS;");
                     break;
                 case MBEDTLS_TEST_RESULT_SKIPPED:
-                    mbedtls_fprintf( outcome_file, "SKIP;Runtime skip" );
+                    mbedtls_fprintf(outcome_file, "SKIP;Runtime skip");
                     break;
                 default:
-                    mbedtls_fprintf( outcome_file, "FAIL;%s:%d:%s",
-                                     info->filename, info->line_no,
-                                     info->test );
+                    mbedtls_fprintf(outcome_file, "FAIL;%s:%d:%s",
+                                    info->filename, info->line_no,
+                                    info->test);
                     break;
             }
             break;
         case DISPATCH_TEST_FN_NOT_FOUND:
-            mbedtls_fprintf( outcome_file, "FAIL;Test function not found" );
+            mbedtls_fprintf(outcome_file, "FAIL;Test function not found");
             break;
         case DISPATCH_INVALID_TEST_DATA:
-            mbedtls_fprintf( outcome_file, "FAIL;Invalid test data" );
+            mbedtls_fprintf(outcome_file, "FAIL;Invalid test data");
             break;
         case DISPATCH_UNSUPPORTED_SUITE:
-            mbedtls_fprintf( outcome_file, "SKIP;Unsupported suite" );
+            mbedtls_fprintf(outcome_file, "SKIP;Unsupported suite");
             break;
         default:
-            mbedtls_fprintf( outcome_file, "FAIL;Unknown cause" );
+            mbedtls_fprintf(outcome_file, "FAIL;Unknown cause");
             break;
     }
-    mbedtls_fprintf( outcome_file, "\n" );
-    fflush( outcome_file );
+    mbedtls_fprintf(outcome_file, "\n");
+    fflush(outcome_file);
 }
 
 /**
@@ -500,7 +463,7 @@
  *
  * \return      Program exit status.
  */
-int execute_tests( int argc , const char ** argv )
+int execute_tests(int argc, const char **argv)
 {
     /* Local Configurations and options */
     const char *default_filename = "DATA_FILE";
@@ -525,17 +488,17 @@
 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
     int stdout_fd = -1;
 #endif /* __unix__ || __APPLE__ __MACH__ */
-    const char *outcome_file_name = getenv( "MBEDTLS_TEST_OUTCOME_FILE" );
+    const char *outcome_file_name = getenv("MBEDTLS_TEST_OUTCOME_FILE");
     FILE *outcome_file = NULL;
 
 #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
     !defined(TEST_SUITE_MEMORY_BUFFER_ALLOC)
     unsigned char alloc_buf[1000000];
-    mbedtls_memory_buffer_alloc_init( alloc_buf, sizeof( alloc_buf ) );
+    mbedtls_memory_buffer_alloc_init(alloc_buf, sizeof(alloc_buf));
 #endif
 
 #if defined(MBEDTLS_TEST_MUTEX_USAGE)
-    mbedtls_test_mutex_usage_init( );
+    mbedtls_test_mutex_usage_init();
 #endif
 
     /*
@@ -543,52 +506,42 @@
      * of a NULL pointer. We do however use that in our code for initializing
      * structures, which should work on every modern platform. Let's be sure.
      */
-    memset( &pointer, 0, sizeof( void * ) );
-    if( pointer != NULL )
-    {
-        mbedtls_fprintf( stderr, "all-bits-zero is not a NULL pointer\n" );
-        return( 1 );
+    memset(&pointer, 0, sizeof(void *));
+    if (pointer != NULL) {
+        mbedtls_fprintf(stderr, "all-bits-zero is not a NULL pointer\n");
+        return 1;
     }
 
     /*
      * Make sure we have a snprintf that correctly zero-terminates
      */
-    if( run_test_snprintf() != 0 )
-    {
-        mbedtls_fprintf( stderr, "the snprintf implementation is broken\n" );
-        return( 1 );
+    if (run_test_snprintf() != 0) {
+        mbedtls_fprintf(stderr, "the snprintf implementation is broken\n");
+        return 1;
     }
 
-    if( outcome_file_name != NULL && *outcome_file_name != '\0' )
-    {
-        outcome_file = fopen( outcome_file_name, "a" );
-        if( outcome_file == NULL )
-        {
-            mbedtls_fprintf( stderr, "Unable to open outcome file. Continuing anyway.\n" );
+    if (outcome_file_name != NULL && *outcome_file_name != '\0') {
+        outcome_file = fopen(outcome_file_name, "a");
+        if (outcome_file == NULL) {
+            mbedtls_fprintf(stderr, "Unable to open outcome file. Continuing anyway.\n");
         }
     }
 
-    while( arg_index < argc )
-    {
+    while (arg_index < argc) {
         next_arg = argv[arg_index];
 
-        if( strcmp( next_arg, "--verbose" ) == 0 ||
-                 strcmp( next_arg, "-v" ) == 0 )
-        {
+        if (strcmp(next_arg, "--verbose") == 0 ||
+            strcmp(next_arg, "-v") == 0) {
             option_verbose = 1;
-        }
-        else if( strcmp(next_arg, "--help" ) == 0 ||
-                 strcmp(next_arg, "-h" ) == 0 )
-        {
-            mbedtls_fprintf( stdout, USAGE );
-            mbedtls_exit( EXIT_SUCCESS );
-        }
-        else
-        {
+        } else if (strcmp(next_arg, "--help") == 0 ||
+                   strcmp(next_arg, "-h") == 0) {
+            mbedtls_fprintf(stdout, USAGE);
+            mbedtls_exit(EXIT_SUCCESS);
+        } else {
             /* Not an option, therefore treat all further arguments as the file
              * list.
              */
-            test_files = &argv[ arg_index ];
+            test_files = &argv[arg_index];
             testfile_count = argc - arg_index;
             break;
         }
@@ -597,226 +550,204 @@
     }
 
     /* If no files were specified, assume a default */
-    if ( test_files == NULL || testfile_count == 0 )
-    {
+    if (test_files == NULL || testfile_count == 0) {
         test_files = &default_filename;
         testfile_count = 1;
     }
 
     /* Initialize the struct that holds information about the last test */
-    mbedtls_test_info_reset( );
+    mbedtls_test_info_reset();
 
     /* Now begin to execute the tests in the testfiles */
-    for ( testfile_index = 0;
-          testfile_index < testfile_count;
-          testfile_index++ )
-    {
+    for (testfile_index = 0;
+         testfile_index < testfile_count;
+         testfile_index++) {
         size_t unmet_dep_count = 0;
         int unmet_dependencies[20];
         int missing_unmet_dependencies = 0;
 
-        test_filename = test_files[ testfile_index ];
+        test_filename = test_files[testfile_index];
 
-        file = fopen( test_filename, "r" );
-        if( file == NULL )
-        {
-            mbedtls_fprintf( stderr, "Failed to open test file: %s\n",
-                             test_filename );
-            if( outcome_file != NULL )
-                fclose( outcome_file );
-            return( 1 );
+        file = fopen(test_filename, "r");
+        if (file == NULL) {
+            mbedtls_fprintf(stderr, "Failed to open test file: %s\n",
+                            test_filename);
+            if (outcome_file != NULL) {
+                fclose(outcome_file);
+            }
+            return 1;
         }
 
-        while( !feof( file ) )
-        {
-            if( unmet_dep_count > 0 )
-            {
-                mbedtls_fprintf( stderr,
-                    "FATAL: Dep count larger than zero at start of loop\n" );
-                mbedtls_exit( MBEDTLS_EXIT_FAILURE );
+        while (!feof(file)) {
+            if (unmet_dep_count > 0) {
+                mbedtls_fprintf(stderr,
+                                "FATAL: Dep count larger than zero at start of loop\n");
+                mbedtls_exit(MBEDTLS_EXIT_FAILURE);
             }
             unmet_dep_count = 0;
             missing_unmet_dependencies = 0;
 
-            if( ( ret = get_line( file, buf, sizeof(buf) ) ) != 0 )
+            if ((ret = get_line(file, buf, sizeof(buf))) != 0) {
                 break;
-            mbedtls_fprintf( stdout, "%s%.66s",
-                    mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED ?
-                    "\n" : "", buf );
-            mbedtls_fprintf( stdout, " " );
-            for( i = strlen( buf ) + 1; i < 67; i++ )
-                mbedtls_fprintf( stdout, "." );
-            mbedtls_fprintf( stdout, " " );
-            fflush( stdout );
-            write_outcome_entry( outcome_file, argv[0], buf );
+            }
+            mbedtls_fprintf(stdout, "%s%.66s",
+                            mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED ?
+                            "\n" : "", buf);
+            mbedtls_fprintf(stdout, " ");
+            for (i = strlen(buf) + 1; i < 67; i++) {
+                mbedtls_fprintf(stdout, ".");
+            }
+            mbedtls_fprintf(stdout, " ");
+            fflush(stdout);
+            write_outcome_entry(outcome_file, argv[0], buf);
 
             total_tests++;
 
-            if( ( ret = get_line( file, buf, sizeof( buf ) ) ) != 0 )
+            if ((ret = get_line(file, buf, sizeof(buf))) != 0) {
                 break;
-            cnt = parse_arguments( buf, strlen( buf ), params,
-                                   sizeof( params ) / sizeof( params[0] ) );
+            }
+            cnt = parse_arguments(buf, strlen(buf), params,
+                                  sizeof(params) / sizeof(params[0]));
 
-            if( strcmp( params[0], "depends_on" ) == 0 )
-            {
-                for( i = 1; i < cnt; i++ )
-                {
-                    int dep_id = strtol( params[i], NULL, 10 );
-                    if( dep_check( dep_id ) != DEPENDENCY_SUPPORTED )
-                    {
-                        if( unmet_dep_count <
-                            ARRAY_LENGTH( unmet_dependencies ) )
-                        {
+            if (strcmp(params[0], "depends_on") == 0) {
+                for (i = 1; i < cnt; i++) {
+                    int dep_id = strtol(params[i], NULL, 10);
+                    if (dep_check(dep_id) != DEPENDENCY_SUPPORTED) {
+                        if (unmet_dep_count <
+                            ARRAY_LENGTH(unmet_dependencies)) {
                             unmet_dependencies[unmet_dep_count] = dep_id;
                             unmet_dep_count++;
-                        }
-                        else
-                        {
+                        } else {
                             missing_unmet_dependencies = 1;
                         }
                     }
                 }
 
-                if( ( ret = get_line( file, buf, sizeof( buf ) ) ) != 0 )
+                if ((ret = get_line(file, buf, sizeof(buf))) != 0) {
                     break;
-                cnt = parse_arguments( buf, strlen( buf ), params,
-                                       sizeof( params ) / sizeof( params[0] ) );
+                }
+                cnt = parse_arguments(buf, strlen(buf), params,
+                                      sizeof(params) / sizeof(params[0]));
             }
 
             // If there are no unmet dependencies execute the test
-            if( unmet_dep_count == 0 )
-            {
-                mbedtls_test_info_reset( );
+            if (unmet_dep_count == 0) {
+                mbedtls_test_info_reset();
 
 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
                 /* Suppress all output from the library unless we're verbose
                  * mode
                  */
-                if( !option_verbose )
-                {
-                    stdout_fd = redirect_output( stdout, "/dev/null" );
-                    if( stdout_fd == -1 )
-                    {
+                if (!option_verbose) {
+                    stdout_fd = redirect_output(stdout, "/dev/null");
+                    if (stdout_fd == -1) {
                         /* Redirection has failed with no stdout so exit */
-                        exit( 1 );
+                        exit(1);
                     }
                 }
 #endif /* __unix__ || __APPLE__ __MACH__ */
 
-                function_id = strtoul( params[0], NULL, 10 );
-                if ( (ret = check_test( function_id )) == DISPATCH_TEST_SUCCESS )
-                {
-                    ret = convert_params( cnt - 1, params + 1, int_params );
-                    if ( DISPATCH_TEST_SUCCESS == ret )
-                    {
-                        ret = dispatch_test( function_id, (void **)( params + 1 ) );
+                function_id = strtoul(params[0], NULL, 10);
+                if ((ret = check_test(function_id)) == DISPATCH_TEST_SUCCESS) {
+                    ret = convert_params(cnt - 1, params + 1, int_params);
+                    if (DISPATCH_TEST_SUCCESS == ret) {
+                        ret = dispatch_test(function_id, (void **) (params + 1));
                     }
                 }
 
 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
-                if( !option_verbose && restore_output( stdout, stdout_fd ) )
-                {
-                        /* Redirection has failed with no stdout so exit */
-                        exit( 1 );
+                if (!option_verbose && restore_output(stdout, stdout_fd)) {
+                    /* Redirection has failed with no stdout so exit */
+                    exit(1);
                 }
 #endif /* __unix__ || __APPLE__ __MACH__ */
 
             }
 
-            write_outcome_result( outcome_file,
-                                  unmet_dep_count, unmet_dependencies,
-                                  missing_unmet_dependencies,
-                                  ret, &mbedtls_test_info );
-            if( unmet_dep_count > 0 || ret == DISPATCH_UNSUPPORTED_SUITE )
-            {
+            write_outcome_result(outcome_file,
+                                 unmet_dep_count, unmet_dependencies,
+                                 missing_unmet_dependencies,
+                                 ret, &mbedtls_test_info);
+            if (unmet_dep_count > 0 || ret == DISPATCH_UNSUPPORTED_SUITE) {
                 total_skipped++;
-                mbedtls_fprintf( stdout, "----" );
+                mbedtls_fprintf(stdout, "----");
 
-                if( 1 == option_verbose && ret == DISPATCH_UNSUPPORTED_SUITE )
-                {
-                    mbedtls_fprintf( stdout, "\n   Test Suite not enabled" );
+                if (1 == option_verbose && ret == DISPATCH_UNSUPPORTED_SUITE) {
+                    mbedtls_fprintf(stdout, "\n   Test Suite not enabled");
                 }
 
-                if( 1 == option_verbose && unmet_dep_count > 0 )
-                {
-                    mbedtls_fprintf( stdout, "\n   Unmet dependencies: " );
-                    for( i = 0; i < unmet_dep_count; i++ )
-                    {
-                        mbedtls_fprintf( stdout, "%d ",
-                                        unmet_dependencies[i] );
+                if (1 == option_verbose && unmet_dep_count > 0) {
+                    mbedtls_fprintf(stdout, "\n   Unmet dependencies: ");
+                    for (i = 0; i < unmet_dep_count; i++) {
+                        mbedtls_fprintf(stdout, "%d ",
+                                        unmet_dependencies[i]);
                     }
-                    if( missing_unmet_dependencies )
-                        mbedtls_fprintf( stdout, "..." );
+                    if (missing_unmet_dependencies) {
+                        mbedtls_fprintf(stdout, "...");
+                    }
                 }
-                mbedtls_fprintf( stdout, "\n" );
-                fflush( stdout );
+                mbedtls_fprintf(stdout, "\n");
+                fflush(stdout);
 
                 unmet_dep_count = 0;
                 missing_unmet_dependencies = 0;
-            }
-            else if( ret == DISPATCH_TEST_SUCCESS )
-            {
-                if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_SUCCESS )
-                {
-                    mbedtls_fprintf( stdout, "PASS\n" );
-                }
-                else if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_SKIPPED )
-                {
-                    mbedtls_fprintf( stdout, "----\n" );
+            } else if (ret == DISPATCH_TEST_SUCCESS) {
+                if (mbedtls_test_info.result == MBEDTLS_TEST_RESULT_SUCCESS) {
+                    mbedtls_fprintf(stdout, "PASS\n");
+                } else if (mbedtls_test_info.result == MBEDTLS_TEST_RESULT_SKIPPED) {
+                    mbedtls_fprintf(stdout, "----\n");
                     total_skipped++;
-                }
-                else
-                {
+                } else {
                     total_errors++;
-                    mbedtls_fprintf( stdout, "FAILED\n" );
-                    mbedtls_fprintf( stdout, "  %s\n  at ",
-                                     mbedtls_test_info.test );
-                    if( mbedtls_test_info.step != (unsigned long)( -1 ) )
-                    {
-                        mbedtls_fprintf( stdout, "step %lu, ",
-                                         mbedtls_test_info.step );
+                    mbedtls_fprintf(stdout, "FAILED\n");
+                    mbedtls_fprintf(stdout, "  %s\n  at ",
+                                    mbedtls_test_info.test);
+                    if (mbedtls_test_info.step != (unsigned long) (-1)) {
+                        mbedtls_fprintf(stdout, "step %lu, ",
+                                        mbedtls_test_info.step);
                     }
-                    mbedtls_fprintf( stdout, "line %d, %s",
-                                     mbedtls_test_info.line_no,
-                                     mbedtls_test_info.filename );
-                    if( mbedtls_test_info.line1[0] != 0 )
-                        mbedtls_fprintf( stdout, "\n  %s",
-                                         mbedtls_test_info.line1 );
-                    if( mbedtls_test_info.line2[0] != 0 )
-                        mbedtls_fprintf( stdout, "\n  %s",
-                                         mbedtls_test_info.line2 );
+                    mbedtls_fprintf(stdout, "line %d, %s",
+                                    mbedtls_test_info.line_no,
+                                    mbedtls_test_info.filename);
+                    if (mbedtls_test_info.line1[0] != 0) {
+                        mbedtls_fprintf(stdout, "\n  %s",
+                                        mbedtls_test_info.line1);
+                    }
+                    if (mbedtls_test_info.line2[0] != 0) {
+                        mbedtls_fprintf(stdout, "\n  %s",
+                                        mbedtls_test_info.line2);
+                    }
                 }
-                fflush( stdout );
-            }
-            else if( ret == DISPATCH_INVALID_TEST_DATA )
-            {
-                mbedtls_fprintf( stderr, "FAILED: FATAL PARSE ERROR\n" );
-                fclose( file );
-                mbedtls_exit( 2 );
-            }
-            else if( ret == DISPATCH_TEST_FN_NOT_FOUND )
-            {
-                mbedtls_fprintf( stderr, "FAILED: FATAL TEST FUNCTION NOT FOUND\n" );
-                fclose( file );
-                mbedtls_exit( 2 );
-            }
-            else
+                fflush(stdout);
+            } else if (ret == DISPATCH_INVALID_TEST_DATA) {
+                mbedtls_fprintf(stderr, "FAILED: FATAL PARSE ERROR\n");
+                fclose(file);
+                mbedtls_exit(2);
+            } else if (ret == DISPATCH_TEST_FN_NOT_FOUND) {
+                mbedtls_fprintf(stderr, "FAILED: FATAL TEST FUNCTION NOT FOUND\n");
+                fclose(file);
+                mbedtls_exit(2);
+            } else {
                 total_errors++;
+            }
         }
-        fclose( file );
+        fclose(file);
     }
 
-    if( outcome_file != NULL )
-        fclose( outcome_file );
+    if (outcome_file != NULL) {
+        fclose(outcome_file);
+    }
 
-    mbedtls_fprintf( stdout, "\n----------------------------------------------------------------------------\n\n");
-    if( total_errors == 0 )
-        mbedtls_fprintf( stdout, "PASSED" );
-    else
-        mbedtls_fprintf( stdout, "FAILED" );
+    mbedtls_fprintf(stdout,
+                    "\n----------------------------------------------------------------------------\n\n");
+    if (total_errors == 0) {
+        mbedtls_fprintf(stdout, "PASSED");
+    } else {
+        mbedtls_fprintf(stdout, "FAILED");
+    }
 
-    mbedtls_fprintf( stdout, " (%u / %u tests (%u skipped))\n",
-                     total_tests - total_errors, total_tests, total_skipped );
+    mbedtls_fprintf(stdout, " (%u / %u tests (%u skipped))\n",
+                    total_tests - total_errors, total_tests, total_skipped);
 
 #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && \
     !defined(TEST_SUITE_MEMORY_BUFFER_ALLOC)
@@ -826,5 +757,5 @@
     mbedtls_memory_buffer_alloc_free();
 #endif
 
-    return( total_errors != 0 );
+    return total_errors != 0;
 }
diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function
index 65c7083..1e5c666 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -81,24 +81,23 @@
  *
  * \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;
 }
 
 
@@ -113,20 +112,19 @@
  *
  * \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;
 }
 
 
@@ -143,7 +141,7 @@
  *                      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);
 
 
 /**
@@ -154,7 +152,7 @@
  */
 TestWrapper_t test_funcs[] =
 {
-__MBEDTLS_TEST_TEMPLATE__DISPATCH_CODE
+    __MBEDTLS_TEST_TEMPLATE__DISPATCH_CODE
 #line __MBEDTLS_TEST_TEMPLATE__LINE_NO "suites/main_test.function"
 };
 
@@ -173,32 +171,29 @@
 void execute_function_ptr(TestWrapper_t fp, void **params)
 {
 #if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
-    mbedtls_test_enable_insecure_external_rng( );
+    mbedtls_test_enable_insecure_external_rng();
 #endif
 
 #if defined(MBEDTLS_CHECK_PARAMS)
     mbedtls_test_param_failed_location_record_t location_record;
 
-    if ( setjmp( mbedtls_test_param_failed_get_state_buf( ) ) == 0 )
-    {
-        fp( params );
-    }
-    else
-    {
+    if (setjmp(mbedtls_test_param_failed_get_state_buf()) == 0) {
+        fp(params);
+    } else {
         /* Unexpected parameter validation error */
-        mbedtls_test_param_failed_get_location_record( &location_record );
-        mbedtls_test_fail( location_record.failure_condition,
-                           location_record.line,
-                           location_record.file );
+        mbedtls_test_param_failed_get_location_record(&location_record);
+        mbedtls_test_fail(location_record.failure_condition,
+                          location_record.line,
+                          location_record.file);
     }
 
-    mbedtls_test_param_failed_reset_state( );
+    mbedtls_test_param_failed_reset_state();
 #else
-    fp( params );
+    fp(params);
 #endif
 
 #if defined(MBEDTLS_TEST_MUTEX_USAGE)
-    mbedtls_test_mutex_usage_check( );
+    mbedtls_test_mutex_usage_check();
 #endif /* MBEDTLS_TEST_MUTEX_USAGE */
 }
 
@@ -213,25 +208,23 @@
  *               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) {
             execute_function_ptr(fp, params);
-        else
+        } else {
             ret = DISPATCH_UNSUPPORTED_SUITE;
-    }
-    else
-    {
+        }
+    } else {
         ret = DISPATCH_TEST_FN_NOT_FOUND;
     }
 
-    return( ret );
+    return ret;
 }
 
 
@@ -245,23 +238,21 @@
  *               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;
 }
 
 
@@ -281,22 +272,21 @@
  *
  * \return       Exit code.
  */
-int main( int argc, const char *argv[] )
+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;
 #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;
 }
diff --git a/tests/suites/test_suite_aes.function b/tests/suites/test_suite_aes.function
index 57b8b92..6b92b87 100644
--- a/tests/suites/test_suite_aes.function
+++ b/tests/suites/test_suite_aes.function
@@ -8,107 +8,105 @@
  */
 
 /* BEGIN_CASE */
-void aes_encrypt_ecb( data_t * key_str, data_t * src_str,
-                      data_t * dst, int setkey_result )
+void aes_encrypt_ecb(data_t *key_str, data_t *src_str,
+                     data_t *dst, int setkey_result)
 {
     unsigned char output[100];
     mbedtls_aes_context ctx;
 
     memset(output, 0x00, 100);
 
-    mbedtls_aes_init( &ctx );
+    mbedtls_aes_init(&ctx);
 
-    TEST_ASSERT( mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 ) == setkey_result );
-    if( setkey_result == 0 )
-    {
-        TEST_ASSERT( mbedtls_aes_crypt_ecb( &ctx, MBEDTLS_AES_ENCRYPT, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8) == setkey_result);
+    if (setkey_result == 0) {
+        TEST_ASSERT(mbedtls_aes_crypt_ecb(&ctx, MBEDTLS_AES_ENCRYPT, src_str->x, output) == 0);
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 16, dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 16, dst->len) == 0);
     }
 
 exit:
-    mbedtls_aes_free( &ctx );
+    mbedtls_aes_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void aes_decrypt_ecb( data_t * key_str, data_t * src_str,
-                      data_t * dst, int setkey_result )
+void aes_decrypt_ecb(data_t *key_str, data_t *src_str,
+                     data_t *dst, int setkey_result)
 {
     unsigned char output[100];
     mbedtls_aes_context ctx;
 
     memset(output, 0x00, 100);
 
-    mbedtls_aes_init( &ctx );
+    mbedtls_aes_init(&ctx);
 
-    TEST_ASSERT( mbedtls_aes_setkey_dec( &ctx, key_str->x, key_str->len * 8 ) == setkey_result );
-    if( setkey_result == 0 )
-    {
-        TEST_ASSERT( mbedtls_aes_crypt_ecb( &ctx, MBEDTLS_AES_DECRYPT, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_aes_setkey_dec(&ctx, key_str->x, key_str->len * 8) == setkey_result);
+    if (setkey_result == 0) {
+        TEST_ASSERT(mbedtls_aes_crypt_ecb(&ctx, MBEDTLS_AES_DECRYPT, src_str->x, output) == 0);
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 16, dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 16, dst->len) == 0);
     }
 
 exit:
-    mbedtls_aes_free( &ctx );
+    mbedtls_aes_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void aes_encrypt_cbc( data_t * key_str, data_t * iv_str,
-                      data_t * src_str, data_t * dst,
-                      int cbc_result )
+void aes_encrypt_cbc(data_t *key_str, data_t *iv_str,
+                     data_t *src_str, data_t *dst,
+                     int cbc_result)
 {
     unsigned char output[100];
     mbedtls_aes_context ctx;
 
     memset(output, 0x00, 100);
 
-    mbedtls_aes_init( &ctx );
+    mbedtls_aes_init(&ctx);
 
-    TEST_ASSERT( mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 ) == 0 );
-    TEST_ASSERT( mbedtls_aes_crypt_cbc( &ctx, MBEDTLS_AES_ENCRYPT, src_str->len, iv_str->x, src_str->x, output ) == cbc_result );
-    if( cbc_result == 0 )
-    {
+    TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8) == 0);
+    TEST_ASSERT(mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_ENCRYPT, src_str->len, iv_str->x,
+                                      src_str->x, output) == cbc_result);
+    if (cbc_result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x,
-                                          src_str->len, dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x,
+                                        src_str->len, dst->len) == 0);
     }
 
 exit:
-    mbedtls_aes_free( &ctx );
+    mbedtls_aes_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void aes_decrypt_cbc( data_t * key_str, data_t * iv_str,
-                      data_t * src_str, data_t * dst,
-                      int cbc_result )
+void aes_decrypt_cbc(data_t *key_str, data_t *iv_str,
+                     data_t *src_str, data_t *dst,
+                     int cbc_result)
 {
     unsigned char output[100];
     mbedtls_aes_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_aes_init( &ctx );
+    mbedtls_aes_init(&ctx);
 
-    TEST_ASSERT( mbedtls_aes_setkey_dec( &ctx, key_str->x, key_str->len * 8 ) == 0 );
-    TEST_ASSERT( mbedtls_aes_crypt_cbc( &ctx, MBEDTLS_AES_DECRYPT, src_str->len, iv_str->x, src_str->x, output ) == cbc_result );
-    if( cbc_result == 0)
-    {
+    TEST_ASSERT(mbedtls_aes_setkey_dec(&ctx, key_str->x, key_str->len * 8) == 0);
+    TEST_ASSERT(mbedtls_aes_crypt_cbc(&ctx, MBEDTLS_AES_DECRYPT, src_str->len, iv_str->x,
+                                      src_str->x, output) == cbc_result);
+    if (cbc_result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x,
-                                          src_str->len, dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x,
+                                        src_str->len, dst->len) == 0);
     }
 
 exit:
-    mbedtls_aes_free( &ctx );
+    mbedtls_aes_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_XTS */
-void aes_encrypt_xts( char *hex_key_string, char *hex_data_unit_string,
-                      char *hex_src_string, char *hex_dst_string )
+void aes_encrypt_xts(char *hex_key_string, char *hex_data_unit_string,
+                     char *hex_src_string, char *hex_dst_string)
 {
     enum { AES_BLOCK_SIZE = 16 };
     unsigned char *data_unit = NULL;
@@ -119,40 +117,40 @@
     mbedtls_aes_xts_context ctx;
     size_t key_len, src_len, dst_len, data_unit_len;
 
-    mbedtls_aes_xts_init( &ctx );
+    mbedtls_aes_xts_init(&ctx);
 
-    data_unit = mbedtls_test_unhexify_alloc( hex_data_unit_string,
-                                             &data_unit_len );
-    TEST_ASSERT( data_unit_len == AES_BLOCK_SIZE );
+    data_unit = mbedtls_test_unhexify_alloc(hex_data_unit_string,
+                                            &data_unit_len);
+    TEST_ASSERT(data_unit_len == AES_BLOCK_SIZE);
 
-    key = mbedtls_test_unhexify_alloc( hex_key_string, &key_len );
-    TEST_ASSERT( key_len % 2 == 0 );
+    key = mbedtls_test_unhexify_alloc(hex_key_string, &key_len);
+    TEST_ASSERT(key_len % 2 == 0);
 
-    src = mbedtls_test_unhexify_alloc( hex_src_string, &src_len );
-    dst = mbedtls_test_unhexify_alloc( hex_dst_string, &dst_len );
-    TEST_ASSERT( src_len == dst_len );
+    src = mbedtls_test_unhexify_alloc(hex_src_string, &src_len);
+    dst = mbedtls_test_unhexify_alloc(hex_dst_string, &dst_len);
+    TEST_ASSERT(src_len == dst_len);
 
-    output = mbedtls_test_zero_alloc( dst_len );
+    output = mbedtls_test_zero_alloc(dst_len);
 
-    TEST_ASSERT( mbedtls_aes_xts_setkey_enc( &ctx, key, key_len * 8 ) == 0 );
-    TEST_ASSERT( mbedtls_aes_crypt_xts( &ctx, MBEDTLS_AES_ENCRYPT, src_len,
-                                        data_unit, src, output ) == 0 );
+    TEST_ASSERT(mbedtls_aes_xts_setkey_enc(&ctx, key, key_len * 8) == 0);
+    TEST_ASSERT(mbedtls_aes_crypt_xts(&ctx, MBEDTLS_AES_ENCRYPT, src_len,
+                                      data_unit, src, output) == 0);
 
-    TEST_ASSERT( memcmp( output, dst, dst_len ) == 0 );
+    TEST_ASSERT(memcmp(output, dst, dst_len) == 0);
 
 exit:
-    mbedtls_aes_xts_free( &ctx );
-    mbedtls_free( data_unit );
-    mbedtls_free( key );
-    mbedtls_free( src );
-    mbedtls_free( dst );
-    mbedtls_free( output );
+    mbedtls_aes_xts_free(&ctx);
+    mbedtls_free(data_unit);
+    mbedtls_free(key);
+    mbedtls_free(src);
+    mbedtls_free(dst);
+    mbedtls_free(output);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_XTS */
-void aes_decrypt_xts( char *hex_key_string, char *hex_data_unit_string,
-                      char *hex_dst_string, char *hex_src_string )
+void aes_decrypt_xts(char *hex_key_string, char *hex_data_unit_string,
+                     char *hex_dst_string, char *hex_src_string)
 {
     enum { AES_BLOCK_SIZE = 16 };
     unsigned char *data_unit = NULL;
@@ -163,39 +161,39 @@
     mbedtls_aes_xts_context ctx;
     size_t key_len, src_len, dst_len, data_unit_len;
 
-    mbedtls_aes_xts_init( &ctx );
+    mbedtls_aes_xts_init(&ctx);
 
-    data_unit = mbedtls_test_unhexify_alloc( hex_data_unit_string,
-                                             &data_unit_len );
-    TEST_ASSERT( data_unit_len == AES_BLOCK_SIZE );
+    data_unit = mbedtls_test_unhexify_alloc(hex_data_unit_string,
+                                            &data_unit_len);
+    TEST_ASSERT(data_unit_len == AES_BLOCK_SIZE);
 
-    key = mbedtls_test_unhexify_alloc( hex_key_string, &key_len );
-    TEST_ASSERT( key_len % 2 == 0 );
+    key = mbedtls_test_unhexify_alloc(hex_key_string, &key_len);
+    TEST_ASSERT(key_len % 2 == 0);
 
-    src = mbedtls_test_unhexify_alloc( hex_src_string, &src_len );
-    dst = mbedtls_test_unhexify_alloc( hex_dst_string, &dst_len );
-    TEST_ASSERT( src_len == dst_len );
+    src = mbedtls_test_unhexify_alloc(hex_src_string, &src_len);
+    dst = mbedtls_test_unhexify_alloc(hex_dst_string, &dst_len);
+    TEST_ASSERT(src_len == dst_len);
 
-    output = mbedtls_test_zero_alloc( dst_len );
+    output = mbedtls_test_zero_alloc(dst_len);
 
-    TEST_ASSERT( mbedtls_aes_xts_setkey_dec( &ctx, key, key_len * 8 ) == 0 );
-    TEST_ASSERT( mbedtls_aes_crypt_xts( &ctx, MBEDTLS_AES_DECRYPT, src_len,
-                                        data_unit, src, output ) == 0 );
+    TEST_ASSERT(mbedtls_aes_xts_setkey_dec(&ctx, key, key_len * 8) == 0);
+    TEST_ASSERT(mbedtls_aes_crypt_xts(&ctx, MBEDTLS_AES_DECRYPT, src_len,
+                                      data_unit, src, output) == 0);
 
-    TEST_ASSERT( memcmp( output, dst, dst_len ) == 0 );
+    TEST_ASSERT(memcmp(output, dst, dst_len) == 0);
 
 exit:
-    mbedtls_aes_xts_free( &ctx );
-    mbedtls_free( data_unit );
-    mbedtls_free( key );
-    mbedtls_free( src );
-    mbedtls_free( dst );
-    mbedtls_free( output );
+    mbedtls_aes_xts_free(&ctx);
+    mbedtls_free(data_unit);
+    mbedtls_free(key);
+    mbedtls_free(src);
+    mbedtls_free(dst);
+    mbedtls_free(output);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_XTS */
-void aes_crypt_xts_size( int size, int retval )
+void aes_crypt_xts_size(int size, int retval)
 {
     mbedtls_aes_xts_context ctx;
     const unsigned char src[16] = { 0 };
@@ -203,166 +201,171 @@
     unsigned char data_unit[16];
     size_t length = size;
 
-    mbedtls_aes_xts_init( &ctx );
-    memset( data_unit, 0x00, sizeof( data_unit ) );
+    mbedtls_aes_xts_init(&ctx);
+    memset(data_unit, 0x00, sizeof(data_unit));
 
 
     /* Valid pointers are passed for builds with MBEDTLS_CHECK_PARAMS, as
      * otherwise we wouldn't get to the size check we're interested in. */
-    TEST_ASSERT( mbedtls_aes_crypt_xts( &ctx, MBEDTLS_AES_ENCRYPT, length, data_unit, src, output ) == retval );
+    TEST_ASSERT(mbedtls_aes_crypt_xts(&ctx, MBEDTLS_AES_ENCRYPT, length, data_unit, src,
+                                      output) == retval);
 exit:
-    mbedtls_aes_xts_free( &ctx );
+    mbedtls_aes_xts_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_XTS */
-void aes_crypt_xts_keysize( int size, int retval )
+void aes_crypt_xts_keysize(int size, int retval)
 {
     mbedtls_aes_xts_context ctx;
     const unsigned char key[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
     size_t key_len = size;
 
-    mbedtls_aes_xts_init( &ctx );
+    mbedtls_aes_xts_init(&ctx);
 
-    TEST_ASSERT( mbedtls_aes_xts_setkey_enc( &ctx, key, key_len * 8 ) == retval );
-    TEST_ASSERT( mbedtls_aes_xts_setkey_dec( &ctx, key, key_len * 8 ) == retval );
+    TEST_ASSERT(mbedtls_aes_xts_setkey_enc(&ctx, key, key_len * 8) == retval);
+    TEST_ASSERT(mbedtls_aes_xts_setkey_dec(&ctx, key, key_len * 8) == retval);
 exit:
-    mbedtls_aes_xts_free( &ctx );
+    mbedtls_aes_xts_free(&ctx);
 }
 /* END_CASE */
 
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
-void aes_encrypt_cfb128( data_t * key_str, data_t * iv_str,
-                         data_t * src_str, data_t * dst )
+void aes_encrypt_cfb128(data_t *key_str, data_t *iv_str,
+                        data_t *src_str, data_t *dst)
 {
     unsigned char output[100];
     mbedtls_aes_context ctx;
     size_t iv_offset = 0;
 
     memset(output, 0x00, 100);
-    mbedtls_aes_init( &ctx );
+    mbedtls_aes_init(&ctx);
 
 
-    TEST_ASSERT( mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 ) == 0 );
-    TEST_ASSERT( mbedtls_aes_crypt_cfb128( &ctx, MBEDTLS_AES_ENCRYPT, 16, &iv_offset, iv_str->x, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8) == 0);
+    TEST_ASSERT(mbedtls_aes_crypt_cfb128(&ctx, MBEDTLS_AES_ENCRYPT, 16, &iv_offset, iv_str->x,
+                                         src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 16, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 16, dst->len) == 0);
 
 exit:
-    mbedtls_aes_free( &ctx );
+    mbedtls_aes_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
-void aes_decrypt_cfb128( data_t * key_str, data_t * iv_str,
-                         data_t * src_str, data_t * dst )
+void aes_decrypt_cfb128(data_t *key_str, data_t *iv_str,
+                        data_t *src_str, data_t *dst)
 {
     unsigned char output[100];
     mbedtls_aes_context ctx;
     size_t iv_offset = 0;
 
     memset(output, 0x00, 100);
-    mbedtls_aes_init( &ctx );
+    mbedtls_aes_init(&ctx);
 
 
-    TEST_ASSERT( mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 ) == 0 );
-    TEST_ASSERT( mbedtls_aes_crypt_cfb128( &ctx, MBEDTLS_AES_DECRYPT, 16, &iv_offset, iv_str->x, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8) == 0);
+    TEST_ASSERT(mbedtls_aes_crypt_cfb128(&ctx, MBEDTLS_AES_DECRYPT, 16, &iv_offset, iv_str->x,
+                                         src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 16, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 16, dst->len) == 0);
 
 exit:
-    mbedtls_aes_free( &ctx );
+    mbedtls_aes_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
-void aes_encrypt_cfb8( data_t * key_str, data_t * iv_str,
-                       data_t * src_str, data_t * dst )
+void aes_encrypt_cfb8(data_t *key_str, data_t *iv_str,
+                      data_t *src_str, data_t *dst)
 {
     unsigned char output[100];
     mbedtls_aes_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_aes_init( &ctx );
+    mbedtls_aes_init(&ctx);
 
 
-    TEST_ASSERT( mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 ) == 0 );
-    TEST_ASSERT( mbedtls_aes_crypt_cfb8( &ctx, MBEDTLS_AES_ENCRYPT, src_str->len, iv_str->x, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8) == 0);
+    TEST_ASSERT(mbedtls_aes_crypt_cfb8(&ctx, MBEDTLS_AES_ENCRYPT, src_str->len, iv_str->x,
+                                       src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x,
-                                      src_str->len, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x,
+                                    src_str->len, dst->len) == 0);
 
 exit:
-    mbedtls_aes_free( &ctx );
+    mbedtls_aes_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
-void aes_decrypt_cfb8( data_t * key_str, data_t * iv_str,
-                       data_t * src_str, data_t * dst )
+void aes_decrypt_cfb8(data_t *key_str, data_t *iv_str,
+                      data_t *src_str, data_t *dst)
 {
     unsigned char output[100];
     mbedtls_aes_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_aes_init( &ctx );
+    mbedtls_aes_init(&ctx);
 
 
-    TEST_ASSERT( mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 ) == 0 );
-    TEST_ASSERT( mbedtls_aes_crypt_cfb8( &ctx, MBEDTLS_AES_DECRYPT, src_str->len, iv_str->x, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8) == 0);
+    TEST_ASSERT(mbedtls_aes_crypt_cfb8(&ctx, MBEDTLS_AES_DECRYPT, src_str->len, iv_str->x,
+                                       src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x,
-                                      src_str->len, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x,
+                                    src_str->len, dst->len) == 0);
 
 exit:
-    mbedtls_aes_free( &ctx );
+    mbedtls_aes_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_OFB */
-void aes_encrypt_ofb( int fragment_size, data_t *key_str,
-                      data_t *iv_str, data_t *src_str,
-                      data_t *expected_output )
+void aes_encrypt_ofb(int fragment_size, data_t *key_str,
+                     data_t *iv_str, data_t *src_str,
+                     data_t *expected_output)
 {
     unsigned char output[32];
     mbedtls_aes_context ctx;
     size_t iv_offset = 0;
     int in_buffer_len;
-    unsigned char* src_str_next;
+    unsigned char *src_str_next;
 
-    memset( output, 0x00, sizeof( output ) );
-    mbedtls_aes_init( &ctx );
+    memset(output, 0x00, sizeof(output));
+    mbedtls_aes_init(&ctx);
 
-    TEST_ASSERT( (size_t)fragment_size < sizeof( output ) );
+    TEST_ASSERT((size_t) fragment_size < sizeof(output));
 
-    TEST_ASSERT( mbedtls_aes_setkey_enc( &ctx, key_str->x,
-                                         key_str->len * 8 ) == 0 );
+    TEST_ASSERT(mbedtls_aes_setkey_enc(&ctx, key_str->x,
+                                       key_str->len * 8) == 0);
     in_buffer_len = src_str->len;
     src_str_next = src_str->x;
 
-    while( in_buffer_len > 0 )
-    {
-        TEST_ASSERT( mbedtls_aes_crypt_ofb( &ctx, fragment_size, &iv_offset,
-                                            iv_str->x, src_str_next, output ) == 0 );
+    while (in_buffer_len > 0) {
+        TEST_ASSERT(mbedtls_aes_crypt_ofb(&ctx, fragment_size, &iv_offset,
+                                          iv_str->x, src_str_next, output) == 0);
 
-        TEST_ASSERT( memcmp( output, expected_output->x, fragment_size ) == 0 );
+        TEST_ASSERT(memcmp(output, expected_output->x, fragment_size) == 0);
 
         in_buffer_len -= fragment_size;
         expected_output->x += fragment_size;
         src_str_next += fragment_size;
 
-        if( in_buffer_len < fragment_size )
+        if (in_buffer_len < fragment_size) {
             fragment_size = in_buffer_len;
+        }
     }
 
 exit:
-    mbedtls_aes_free( &ctx );
+    mbedtls_aes_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void aes_check_params( )
+void aes_check_params()
 {
     mbedtls_aes_context aes_ctx;
 #if defined(MBEDTLS_CIPHER_MODE_XTS)
@@ -375,185 +378,185 @@
     const int valid_mode = MBEDTLS_AES_ENCRYPT;
     const int invalid_mode = 42;
 
-    TEST_INVALID_PARAM( mbedtls_aes_init( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_aes_init(NULL));
 #if defined(MBEDTLS_CIPHER_MODE_XTS)
-    TEST_INVALID_PARAM( mbedtls_aes_xts_init( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_aes_xts_init(NULL));
 #endif
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_setkey_enc( NULL, key, 128 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_setkey_enc( &aes_ctx, NULL, 128 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_setkey_enc(NULL, key, 128));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_setkey_enc(&aes_ctx, NULL, 128));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_setkey_dec( NULL, key, 128 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_setkey_dec( &aes_ctx, NULL, 128 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_setkey_dec(NULL, key, 128));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_setkey_dec(&aes_ctx, NULL, 128));
 
 #if defined(MBEDTLS_CIPHER_MODE_XTS)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_xts_setkey_enc( NULL, key, 128 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_xts_setkey_enc( &xts_ctx, NULL, 128 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_xts_setkey_enc(NULL, key, 128));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_xts_setkey_enc(&xts_ctx, NULL, 128));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_xts_setkey_dec( NULL, key, 128 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_xts_setkey_dec( &xts_ctx, NULL, 128 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_xts_setkey_dec(NULL, key, 128));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_xts_setkey_dec(&xts_ctx, NULL, 128));
 #endif
 
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ecb( NULL,
-                                                   valid_mode, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ecb( &aes_ctx,
-                                                   invalid_mode, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ecb( &aes_ctx,
-                                                   valid_mode, NULL, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ecb( &aes_ctx,
-                                                   valid_mode, in, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ecb(NULL,
+                                                 valid_mode, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ecb(&aes_ctx,
+                                                 invalid_mode, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ecb(&aes_ctx,
+                                                 valid_mode, NULL, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ecb(&aes_ctx,
+                                                 valid_mode, in, NULL));
 
 #if defined(MBEDTLS_CIPHER_MODE_CBC)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cbc( NULL,
-                                                   valid_mode, 16,
-                                                   out, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cbc( &aes_ctx,
-                                                   invalid_mode, 16,
-                                                   out, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cbc( &aes_ctx,
-                                                   valid_mode, 16,
-                                                   NULL, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cbc( &aes_ctx,
-                                                   valid_mode, 16,
-                                                   out, NULL, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cbc( &aes_ctx,
-                                                   valid_mode, 16,
-                                                   out, in, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cbc(NULL,
+                                                 valid_mode, 16,
+                                                 out, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cbc(&aes_ctx,
+                                                 invalid_mode, 16,
+                                                 out, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cbc(&aes_ctx,
+                                                 valid_mode, 16,
+                                                 NULL, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cbc(&aes_ctx,
+                                                 valid_mode, 16,
+                                                 out, NULL, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cbc(&aes_ctx,
+                                                 valid_mode, 16,
+                                                 out, in, NULL));
 #endif /* MBEDTLS_CIPHER_MODE_CBC */
 
 #if defined(MBEDTLS_CIPHER_MODE_XTS)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_xts( NULL,
-                                                   valid_mode, 16,
-                                                   in, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_xts( &xts_ctx,
-                                                   invalid_mode, 16,
-                                                   in, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_xts( &xts_ctx,
-                                                   valid_mode, 16,
-                                                   NULL, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_xts( &xts_ctx,
-                                                   valid_mode, 16,
-                                                   in, NULL, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_xts( &xts_ctx,
-                                                   valid_mode, 16,
-                                                   in, in, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_xts(NULL,
+                                                 valid_mode, 16,
+                                                 in, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_xts(&xts_ctx,
+                                                 invalid_mode, 16,
+                                                 in, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_xts(&xts_ctx,
+                                                 valid_mode, 16,
+                                                 NULL, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_xts(&xts_ctx,
+                                                 valid_mode, 16,
+                                                 in, NULL, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_xts(&xts_ctx,
+                                                 valid_mode, 16,
+                                                 in, in, NULL));
 #endif /* MBEDTLS_CIPHER_MODE_XTS */
 
 #if defined(MBEDTLS_CIPHER_MODE_CFB)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cfb128( NULL,
-                                                      valid_mode, 16,
-                                                      &size, out, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cfb128( &aes_ctx,
-                                                      invalid_mode, 16,
-                                                      &size, out, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cfb128( &aes_ctx,
-                                                      valid_mode, 16,
-                                                      NULL, out, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cfb128( &aes_ctx,
-                                                      valid_mode, 16,
-                                                      &size, NULL, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cfb128( &aes_ctx,
-                                                      valid_mode, 16,
-                                                      &size, out, NULL, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cfb128( &aes_ctx,
-                                                      valid_mode, 16,
-                                                      &size, out, in, NULL ) );
-
-
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cfb8( NULL,
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cfb128(NULL,
                                                     valid_mode, 16,
-                                                    out, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cfb8( &aes_ctx,
+                                                    &size, out, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cfb128(&aes_ctx,
                                                     invalid_mode, 16,
-                                                    out, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cfb8( &aes_ctx,
+                                                    &size, out, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cfb128(&aes_ctx,
                                                     valid_mode, 16,
-                                                    NULL, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cfb8( &aes_ctx,
+                                                    NULL, out, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cfb128(&aes_ctx,
                                                     valid_mode, 16,
-                                                    out, NULL, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_cfb8( &aes_ctx,
+                                                    &size, NULL, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cfb128(&aes_ctx,
                                                     valid_mode, 16,
-                                                    out, in, NULL ) );
+                                                    &size, out, NULL, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cfb128(&aes_ctx,
+                                                    valid_mode, 16,
+                                                    &size, out, in, NULL));
+
+
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cfb8(NULL,
+                                                  valid_mode, 16,
+                                                  out, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cfb8(&aes_ctx,
+                                                  invalid_mode, 16,
+                                                  out, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cfb8(&aes_ctx,
+                                                  valid_mode, 16,
+                                                  NULL, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cfb8(&aes_ctx,
+                                                  valid_mode, 16,
+                                                  out, NULL, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_cfb8(&aes_ctx,
+                                                  valid_mode, 16,
+                                                  out, in, NULL));
 #endif /* MBEDTLS_CIPHER_MODE_CFB */
 
 #if defined(MBEDTLS_CIPHER_MODE_OFB)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ofb( NULL, 16,
-                                                   &size, out, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ofb( &aes_ctx, 16,
-                                                   NULL, out, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ofb( &aes_ctx, 16,
-                                                   &size, NULL, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ofb( &aes_ctx, 16,
-                                                   &size, out, NULL, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ofb( &aes_ctx, 16,
-                                                   &size, out, in, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ofb(NULL, 16,
+                                                 &size, out, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ofb(&aes_ctx, 16,
+                                                 NULL, out, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ofb(&aes_ctx, 16,
+                                                 &size, NULL, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ofb(&aes_ctx, 16,
+                                                 &size, out, NULL, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ofb(&aes_ctx, 16,
+                                                 &size, out, in, NULL));
 #endif /* MBEDTLS_CIPHER_MODE_OFB */
 
 #if defined(MBEDTLS_CIPHER_MODE_CTR)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ctr( NULL, 16, &size, out,
-                                                   out, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ctr( &aes_ctx, 16, NULL, out,
-                                                   out, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ctr( &aes_ctx, 16, &size, NULL,
-                                                   out, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ctr( &aes_ctx, 16, &size, out,
-                                                   NULL, in, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ctr( &aes_ctx, 16, &size, out,
-                                                   out, NULL, out ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                            mbedtls_aes_crypt_ctr( &aes_ctx, 16, &size, out,
-                                                   out, in, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ctr(NULL, 16, &size, out,
+                                                 out, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ctr(&aes_ctx, 16, NULL, out,
+                                                 out, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ctr(&aes_ctx, 16, &size, NULL,
+                                                 out, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ctr(&aes_ctx, 16, &size, out,
+                                                 NULL, in, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ctr(&aes_ctx, 16, &size, out,
+                                                 out, NULL, out));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+                           mbedtls_aes_crypt_ctr(&aes_ctx, 16, &size, out,
+                                                 out, in, NULL));
 #endif /* MBEDTLS_CIPHER_MODE_CTR */
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void aes_misc_params( )
+void aes_misc_params()
 {
 #if defined(MBEDTLS_CIPHER_MODE_CBC) || \
     defined(MBEDTLS_CIPHER_MODE_XTS) || \
@@ -565,7 +568,7 @@
 #if defined(MBEDTLS_CIPHER_MODE_CBC) || \
     defined(MBEDTLS_CIPHER_MODE_CFB) || \
     defined(MBEDTLS_CIPHER_MODE_OFB)
-mbedtls_aes_context aes_ctx;
+    mbedtls_aes_context aes_ctx;
 #endif
 #if defined(MBEDTLS_CIPHER_MODE_XTS)
     mbedtls_aes_xts_context xts_ctx;
@@ -576,51 +579,51 @@
 #endif
 
     /* These calls accept NULL */
-    TEST_VALID_PARAM( mbedtls_aes_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_aes_free(NULL));
 #if defined(MBEDTLS_CIPHER_MODE_XTS)
-    TEST_VALID_PARAM( mbedtls_aes_xts_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_aes_xts_free(NULL));
 #endif
 
 #if defined(MBEDTLS_CIPHER_MODE_CBC)
-    TEST_ASSERT( mbedtls_aes_crypt_cbc( &aes_ctx, MBEDTLS_AES_ENCRYPT,
-                                        15,
-                                        out, in, out )
-                 == MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH );
-    TEST_ASSERT( mbedtls_aes_crypt_cbc( &aes_ctx, MBEDTLS_AES_ENCRYPT,
-                                        17,
-                                        out, in, out )
-                 == MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH );
+    TEST_ASSERT(mbedtls_aes_crypt_cbc(&aes_ctx, MBEDTLS_AES_ENCRYPT,
+                                      15,
+                                      out, in, out)
+                == MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH);
+    TEST_ASSERT(mbedtls_aes_crypt_cbc(&aes_ctx, MBEDTLS_AES_ENCRYPT,
+                                      17,
+                                      out, in, out)
+                == MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH);
 #endif
 
 #if defined(MBEDTLS_CIPHER_MODE_XTS)
-    TEST_ASSERT( mbedtls_aes_crypt_xts( &xts_ctx, MBEDTLS_AES_ENCRYPT,
-                                        15,
-                                        in, in, out )
-                 == MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH );
-    TEST_ASSERT( mbedtls_aes_crypt_xts( &xts_ctx, MBEDTLS_AES_ENCRYPT,
-                                        (1 << 24) + 1,
-                                        in, in, out )
-                 == MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH );
+    TEST_ASSERT(mbedtls_aes_crypt_xts(&xts_ctx, MBEDTLS_AES_ENCRYPT,
+                                      15,
+                                      in, in, out)
+                == MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH);
+    TEST_ASSERT(mbedtls_aes_crypt_xts(&xts_ctx, MBEDTLS_AES_ENCRYPT,
+                                      (1 << 24) + 1,
+                                      in, in, out)
+                == MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH);
 #endif
 
 #if defined(MBEDTLS_CIPHER_MODE_CFB)
     size = 16;
-    TEST_ASSERT( mbedtls_aes_crypt_cfb128( &aes_ctx, MBEDTLS_AES_ENCRYPT, 16,
-                                           &size, out, in, out )
-                 == MBEDTLS_ERR_AES_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_aes_crypt_cfb128(&aes_ctx, MBEDTLS_AES_ENCRYPT, 16,
+                                         &size, out, in, out)
+                == MBEDTLS_ERR_AES_BAD_INPUT_DATA);
 #endif
 
 #if defined(MBEDTLS_CIPHER_MODE_OFB)
     size = 16;
-    TEST_ASSERT( mbedtls_aes_crypt_ofb( &aes_ctx, 16, &size, out, in, out )
-                 == MBEDTLS_ERR_AES_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_aes_crypt_ofb(&aes_ctx, 16, &size, out, in, out)
+                == MBEDTLS_ERR_AES_BAD_INPUT_DATA);
 #endif
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void aes_selftest(  )
+void aes_selftest()
 {
-    TEST_ASSERT( mbedtls_aes_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_aes_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_arc4.function b/tests/suites/test_suite_arc4.function
index c1e2386..c1b19d5 100644
--- a/tests/suites/test_suite_arc4.function
+++ b/tests/suites/test_suite_arc4.function
@@ -8,30 +8,30 @@
  */
 
 /* BEGIN_CASE */
-void mbedtls_arc4_crypt( data_t * src_str, data_t * key_str, data_t * dst )
+void mbedtls_arc4_crypt(data_t *src_str, data_t *key_str, data_t *dst)
 {
     unsigned char dst_str[1000];
     mbedtls_arc4_context ctx;
 
     memset(dst_str, 0x00, 1000);
-    mbedtls_arc4_init( &ctx );
+    mbedtls_arc4_init(&ctx);
 
 
     mbedtls_arc4_setup(&ctx, key_str->x, key_str->len);
-    TEST_ASSERT( mbedtls_arc4_crypt(&ctx, src_str->len,
-                                    src_str->x, dst_str ) == 0 );
+    TEST_ASSERT(mbedtls_arc4_crypt(&ctx, src_str->len,
+                                   src_str->x, dst_str) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( dst_str, dst->x,
-                                      src_str->len, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(dst_str, dst->x,
+                                    src_str->len, dst->len) == 0);
 
 exit:
-    mbedtls_arc4_free( &ctx );
+    mbedtls_arc4_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void arc4_selftest(  )
+void arc4_selftest()
 {
-    TEST_ASSERT( mbedtls_arc4_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_arc4_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_aria.function b/tests/suites/test_suite_aria.function
index 11af9a3..ed33389 100644
--- a/tests/suites/test_suite_aria.function
+++ b/tests/suites/test_suite_aria.function
@@ -6,9 +6,9 @@
 #define ARIA_MAX_DATASIZE  160
 
 /* Maximum sizes of hexified things */
-#define ARIA_MAX_KEY_STR    ( 2 * MBEDTLS_ARIA_MAX_KEYSIZE + 1 )
-#define ARIA_BLOCK_STR      ( 2 * MBEDTLS_ARIA_BLOCKSIZE + 1 )
-#define ARIA_MAX_DATA_STR   ( 2 * ARIA_MAX_DATASIZE + 1 )
+#define ARIA_MAX_KEY_STR    (2 * MBEDTLS_ARIA_MAX_KEYSIZE + 1)
+#define ARIA_BLOCK_STR      (2 * MBEDTLS_ARIA_BLOCKSIZE + 1)
+#define ARIA_MAX_DATA_STR   (2 * ARIA_MAX_DATASIZE + 1)
 /* END_HEADER */
 
 /* BEGIN_DEPENDENCIES
@@ -17,14 +17,14 @@
  */
 
 /* BEGIN_CASE */
-void aria_valid_param( )
+void aria_valid_param()
 {
-    TEST_VALID_PARAM( mbedtls_aria_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_aria_free(NULL));
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void aria_invalid_param( )
+void aria_invalid_param()
 {
     mbedtls_aria_context ctx;
     unsigned char key[128 / 8] = { 0 };
@@ -36,167 +36,167 @@
     ((void) iv_off);
     ((void) iv);
 
-    TEST_INVALID_PARAM( mbedtls_aria_init( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_aria_init(NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_setkey_enc( NULL, key,
-                                                     sizeof( key ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_setkey_enc( &ctx, NULL,
-                                                     sizeof( key ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_setkey_enc(NULL, key,
+                                                   sizeof(key)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_setkey_enc(&ctx, NULL,
+                                                   sizeof(key)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_setkey_dec( NULL, key,
-                                                     sizeof( key ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_setkey_dec( &ctx, NULL,
-                                                     sizeof( key ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_setkey_dec(NULL, key,
+                                                   sizeof(key)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_setkey_dec(&ctx, NULL,
+                                                   sizeof(key)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_ecb( NULL, input, output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_ecb( &ctx, NULL, output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_ecb( &ctx, input, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_ecb(NULL, input, output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_ecb(&ctx, NULL, output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_ecb(&ctx, input, NULL));
 
 #if defined(MBEDTLS_CIPHER_MODE_CBC)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_cbc( NULL,
-                                                    MBEDTLS_ARIA_ENCRYPT,
-                                                    sizeof( input ),
-                                                    iv,
-                                                    input,
-                                                    output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_cbc( &ctx,
-                                                    42 /* invalid mode */,
-                                                    sizeof( input ),
-                                                    iv,
-                                                    input,
-                                                    output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_cbc( &ctx,
-                                                    MBEDTLS_ARIA_ENCRYPT,
-                                                    sizeof( input ),
-                                                    NULL,
-                                                    input,
-                                                    output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_cbc( &ctx,
-                                                    MBEDTLS_ARIA_ENCRYPT,
-                                                    sizeof( input ),
-                                                    iv,
-                                                    NULL,
-                                                    output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_cbc( &ctx,
-                                                    MBEDTLS_ARIA_ENCRYPT,
-                                                    sizeof( input ),
-                                                    iv,
-                                                    input,
-                                                    NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_cbc(NULL,
+                                                  MBEDTLS_ARIA_ENCRYPT,
+                                                  sizeof(input),
+                                                  iv,
+                                                  input,
+                                                  output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_cbc(&ctx,
+                                                  42 /* invalid mode */,
+                                                  sizeof(input),
+                                                  iv,
+                                                  input,
+                                                  output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_cbc(&ctx,
+                                                  MBEDTLS_ARIA_ENCRYPT,
+                                                  sizeof(input),
+                                                  NULL,
+                                                  input,
+                                                  output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_cbc(&ctx,
+                                                  MBEDTLS_ARIA_ENCRYPT,
+                                                  sizeof(input),
+                                                  iv,
+                                                  NULL,
+                                                  output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_cbc(&ctx,
+                                                  MBEDTLS_ARIA_ENCRYPT,
+                                                  sizeof(input),
+                                                  iv,
+                                                  input,
+                                                  NULL));
 #endif /* MBEDTLS_CIPHER_MODE_CBC */
 
 #if defined(MBEDTLS_CIPHER_MODE_CFB)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_cfb128( NULL,
-                                                    MBEDTLS_ARIA_ENCRYPT,
-                                                    sizeof( input ),
-                                                    &iv_off,
-                                                    iv,
-                                                    input,
-                                                    output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_cfb128( &ctx,
-                                                    42, /* invalid mode */
-                                                    sizeof( input ),
-                                                    &iv_off,
-                                                    iv,
-                                                    input,
-                                                    output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_cfb128( &ctx,
-                                                    MBEDTLS_ARIA_ENCRYPT,
-                                                    sizeof( input ),
-                                                    NULL,
-                                                    iv,
-                                                    input,
-                                                    output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_cfb128( &ctx,
-                                                    MBEDTLS_ARIA_ENCRYPT,
-                                                    sizeof( input ),
-                                                    &iv_off,
-                                                    NULL,
-                                                    input,
-                                                    output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_cfb128( &ctx,
-                                                    MBEDTLS_ARIA_ENCRYPT,
-                                                    sizeof( input ),
-                                                    &iv_off,
-                                                    iv,
-                                                    NULL,
-                                                    output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_cfb128( &ctx,
-                                                    MBEDTLS_ARIA_ENCRYPT,
-                                                    sizeof( input ),
-                                                    &iv_off,
-                                                    iv,
-                                                    input,
-                                                    NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_cfb128(NULL,
+                                                     MBEDTLS_ARIA_ENCRYPT,
+                                                     sizeof(input),
+                                                     &iv_off,
+                                                     iv,
+                                                     input,
+                                                     output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_cfb128(&ctx,
+                                                     42, /* invalid mode */
+                                                     sizeof(input),
+                                                     &iv_off,
+                                                     iv,
+                                                     input,
+                                                     output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_cfb128(&ctx,
+                                                     MBEDTLS_ARIA_ENCRYPT,
+                                                     sizeof(input),
+                                                     NULL,
+                                                     iv,
+                                                     input,
+                                                     output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_cfb128(&ctx,
+                                                     MBEDTLS_ARIA_ENCRYPT,
+                                                     sizeof(input),
+                                                     &iv_off,
+                                                     NULL,
+                                                     input,
+                                                     output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_cfb128(&ctx,
+                                                     MBEDTLS_ARIA_ENCRYPT,
+                                                     sizeof(input),
+                                                     &iv_off,
+                                                     iv,
+                                                     NULL,
+                                                     output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_cfb128(&ctx,
+                                                     MBEDTLS_ARIA_ENCRYPT,
+                                                     sizeof(input),
+                                                     &iv_off,
+                                                     iv,
+                                                     input,
+                                                     NULL));
 #endif /* MBEDTLS_CIPHER_MODE_CFB */
 
 #if defined(MBEDTLS_CIPHER_MODE_CTR)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_ctr( NULL,
-                                                    sizeof( input ),
-                                                    &iv_off,
-                                                    iv,
-                                                    iv,
-                                                    input,
-                                                    output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_ctr( &ctx,
-                                                    sizeof( input ),
-                                                    NULL,
-                                                    iv,
-                                                    iv,
-                                                    input,
-                                                    output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_ctr( &ctx,
-                                                    sizeof( input ),
-                                                    &iv_off,
-                                                    NULL,
-                                                    iv,
-                                                    input,
-                                                    output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_ctr( &ctx,
-                                                    sizeof( input ),
-                                                    &iv_off,
-                                                    iv,
-                                                    NULL,
-                                                    input,
-                                                    output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_ctr( &ctx,
-                                                    sizeof( input ),
-                                                    &iv_off,
-                                                    iv,
-                                                    iv,
-                                                    NULL,
-                                                    output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_ctr( &ctx,
-                                                    sizeof( input ),
-                                                    &iv_off,
-                                                    iv,
-                                                    iv,
-                                                    input,
-                                                    NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_ctr(NULL,
+                                                  sizeof(input),
+                                                  &iv_off,
+                                                  iv,
+                                                  iv,
+                                                  input,
+                                                  output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_ctr(&ctx,
+                                                  sizeof(input),
+                                                  NULL,
+                                                  iv,
+                                                  iv,
+                                                  input,
+                                                  output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_ctr(&ctx,
+                                                  sizeof(input),
+                                                  &iv_off,
+                                                  NULL,
+                                                  iv,
+                                                  input,
+                                                  output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_ctr(&ctx,
+                                                  sizeof(input),
+                                                  &iv_off,
+                                                  iv,
+                                                  NULL,
+                                                  input,
+                                                  output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_ctr(&ctx,
+                                                  sizeof(input),
+                                                  &iv_off,
+                                                  iv,
+                                                  iv,
+                                                  NULL,
+                                                  output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+                           mbedtls_aria_crypt_ctr(&ctx,
+                                                  sizeof(input),
+                                                  &iv_off,
+                                                  iv,
+                                                  iv,
+                                                  input,
+                                                  NULL));
 #endif /* MBEDTLS_CIPHER_MODE_CTR */
 
 exit:
@@ -206,224 +206,218 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void aria_encrypt_ecb( data_t *key_str, data_t *src_str,
-                       data_t *expected_output, int setkey_result )
+void aria_encrypt_ecb(data_t *key_str, data_t *src_str,
+                      data_t *expected_output, int setkey_result)
 {
     unsigned char output[ARIA_MAX_DATASIZE];
     mbedtls_aria_context ctx;
     size_t i;
 
-    memset( output, 0x00, sizeof( output ) );
-    mbedtls_aria_init( &ctx );
+    memset(output, 0x00, sizeof(output));
+    mbedtls_aria_init(&ctx);
 
-    TEST_ASSERT( mbedtls_aria_setkey_enc( &ctx, key_str->x, key_str->len * 8 )
-                 == setkey_result );
-    if( setkey_result == 0 )
-    {
-        for( i = 0; i < src_str->len; i += MBEDTLS_ARIA_BLOCKSIZE )
-        {
-            TEST_ASSERT( mbedtls_aria_crypt_ecb( &ctx, src_str->x + i,
-                                                 output + i ) == 0 );
+    TEST_ASSERT(mbedtls_aria_setkey_enc(&ctx, key_str->x, key_str->len * 8)
+                == setkey_result);
+    if (setkey_result == 0) {
+        for (i = 0; i < src_str->len; i += MBEDTLS_ARIA_BLOCKSIZE) {
+            TEST_ASSERT(mbedtls_aria_crypt_ecb(&ctx, src_str->x + i,
+                                               output + i) == 0);
         }
 
-        ASSERT_COMPARE( output, expected_output->len,
-                        expected_output->x, expected_output->len );
+        ASSERT_COMPARE(output, expected_output->len,
+                       expected_output->x, expected_output->len);
     }
 
 exit:
-    mbedtls_aria_free( &ctx );
+    mbedtls_aria_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void aria_decrypt_ecb( data_t *key_str, data_t *src_str,
-                       data_t *expected_output, int setkey_result )
+void aria_decrypt_ecb(data_t *key_str, data_t *src_str,
+                      data_t *expected_output, int setkey_result)
 {
     unsigned char output[ARIA_MAX_DATASIZE];
     mbedtls_aria_context ctx;
     size_t i;
 
-    memset( output, 0x00, sizeof( output ) );
-    mbedtls_aria_init( &ctx );
+    memset(output, 0x00, sizeof(output));
+    mbedtls_aria_init(&ctx);
 
-    TEST_ASSERT( mbedtls_aria_setkey_dec( &ctx, key_str->x, key_str->len * 8 )
-                 == setkey_result );
-    if( setkey_result == 0 )
-    {
-        for( i = 0; i < src_str->len; i += MBEDTLS_ARIA_BLOCKSIZE )
-        {
-            TEST_ASSERT( mbedtls_aria_crypt_ecb( &ctx, src_str->x + i,
-                                                 output + i ) == 0 );
+    TEST_ASSERT(mbedtls_aria_setkey_dec(&ctx, key_str->x, key_str->len * 8)
+                == setkey_result);
+    if (setkey_result == 0) {
+        for (i = 0; i < src_str->len; i += MBEDTLS_ARIA_BLOCKSIZE) {
+            TEST_ASSERT(mbedtls_aria_crypt_ecb(&ctx, src_str->x + i,
+                                               output + i) == 0);
         }
 
-        ASSERT_COMPARE( output, expected_output->len,
-                        expected_output->x, expected_output->len );
+        ASSERT_COMPARE(output, expected_output->len,
+                       expected_output->x, expected_output->len);
     }
 
 exit:
-    mbedtls_aria_free( &ctx );
+    mbedtls_aria_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void aria_encrypt_cbc( data_t *key_str, data_t *iv_str,
-                       data_t *src_str, data_t *expected_output,
-                       int cbc_result )
+void aria_encrypt_cbc(data_t *key_str, data_t *iv_str,
+                      data_t *src_str, data_t *expected_output,
+                      int cbc_result)
 {
     unsigned char output[ARIA_MAX_DATASIZE];
     mbedtls_aria_context ctx;
 
-    memset( output, 0x00, sizeof( output ) );
-    mbedtls_aria_init( &ctx );
+    memset(output, 0x00, sizeof(output));
+    mbedtls_aria_init(&ctx);
 
-    mbedtls_aria_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
-    TEST_ASSERT( mbedtls_aria_crypt_cbc( &ctx, MBEDTLS_ARIA_ENCRYPT,
-                                         src_str->len, iv_str->x, src_str->x,
-                                         output ) == cbc_result );
-    if( cbc_result == 0 )
-    {
-        ASSERT_COMPARE( output, expected_output->len,
-                        expected_output->x, expected_output->len );
+    mbedtls_aria_setkey_enc(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_aria_crypt_cbc(&ctx, MBEDTLS_ARIA_ENCRYPT,
+                                       src_str->len, iv_str->x, src_str->x,
+                                       output) == cbc_result);
+    if (cbc_result == 0) {
+        ASSERT_COMPARE(output, expected_output->len,
+                       expected_output->x, expected_output->len);
     }
 
 exit:
-    mbedtls_aria_free( &ctx );
+    mbedtls_aria_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void aria_decrypt_cbc( data_t *key_str, data_t *iv_str,
-                       data_t *src_str, data_t *expected_output,
-                       int cbc_result )
+void aria_decrypt_cbc(data_t *key_str, data_t *iv_str,
+                      data_t *src_str, data_t *expected_output,
+                      int cbc_result)
 {
     unsigned char output[ARIA_MAX_DATASIZE];
     mbedtls_aria_context ctx;
 
-    memset( output, 0x00, sizeof( output ) );
-    mbedtls_aria_init( &ctx );
+    memset(output, 0x00, sizeof(output));
+    mbedtls_aria_init(&ctx);
 
-    mbedtls_aria_setkey_dec( &ctx, key_str->x, key_str->len * 8 );
-    TEST_ASSERT( mbedtls_aria_crypt_cbc( &ctx, MBEDTLS_ARIA_DECRYPT,
-                                         src_str->len, iv_str->x, src_str->x,
-                                         output ) == cbc_result );
-    if( cbc_result == 0 )
-    {
-        ASSERT_COMPARE( output, expected_output->len,
-                        expected_output->x, expected_output->len );
+    mbedtls_aria_setkey_dec(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_aria_crypt_cbc(&ctx, MBEDTLS_ARIA_DECRYPT,
+                                       src_str->len, iv_str->x, src_str->x,
+                                       output) == cbc_result);
+    if (cbc_result == 0) {
+        ASSERT_COMPARE(output, expected_output->len,
+                       expected_output->x, expected_output->len);
     }
 
 exit:
-    mbedtls_aria_free( &ctx );
+    mbedtls_aria_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
-void aria_encrypt_cfb128( data_t *key_str, data_t *iv_str,
-                          data_t *src_str, data_t *expected_output,
-                          int result )
+void aria_encrypt_cfb128(data_t *key_str, data_t *iv_str,
+                         data_t *src_str, data_t *expected_output,
+                         int result)
 {
     unsigned char output[ARIA_MAX_DATASIZE];
     mbedtls_aria_context ctx;
     size_t iv_offset = 0;
 
-    memset( output, 0x00, sizeof( output ) );
-    mbedtls_aria_init( &ctx );
+    memset(output, 0x00, sizeof(output));
+    mbedtls_aria_init(&ctx);
 
-    mbedtls_aria_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
-    TEST_ASSERT( mbedtls_aria_crypt_cfb128( &ctx, MBEDTLS_ARIA_ENCRYPT,
-                                            src_str->len, &iv_offset,
-                                            iv_str->x, src_str->x, output )
-                 == result );
+    mbedtls_aria_setkey_enc(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_aria_crypt_cfb128(&ctx, MBEDTLS_ARIA_ENCRYPT,
+                                          src_str->len, &iv_offset,
+                                          iv_str->x, src_str->x, output)
+                == result);
 
-    ASSERT_COMPARE( output, expected_output->len,
-                    expected_output->x, expected_output->len );
+    ASSERT_COMPARE(output, expected_output->len,
+                   expected_output->x, expected_output->len);
 
 exit:
-    mbedtls_aria_free( &ctx );
+    mbedtls_aria_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
-void aria_decrypt_cfb128( data_t *key_str, data_t *iv_str,
-                          data_t *src_str, data_t *expected_output,
-                          int result  )
+void aria_decrypt_cfb128(data_t *key_str, data_t *iv_str,
+                         data_t *src_str, data_t *expected_output,
+                         int result)
 {
     unsigned char output[ARIA_MAX_DATASIZE];
     mbedtls_aria_context ctx;
     size_t iv_offset = 0;
 
-    memset( output, 0x00, sizeof( output ) );
-    mbedtls_aria_init( &ctx );
+    memset(output, 0x00, sizeof(output));
+    mbedtls_aria_init(&ctx);
 
-    mbedtls_aria_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
-    TEST_ASSERT( mbedtls_aria_crypt_cfb128( &ctx, MBEDTLS_ARIA_DECRYPT,
-                                            src_str->len, &iv_offset,
-                                            iv_str->x, src_str->x, output )
-                 == result );
+    mbedtls_aria_setkey_enc(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_aria_crypt_cfb128(&ctx, MBEDTLS_ARIA_DECRYPT,
+                                          src_str->len, &iv_offset,
+                                          iv_str->x, src_str->x, output)
+                == result);
 
-    ASSERT_COMPARE( output, expected_output->len,
-                    expected_output->x, expected_output->len );
+    ASSERT_COMPARE(output, expected_output->len,
+                   expected_output->x, expected_output->len);
 
 exit:
-    mbedtls_aria_free( &ctx );
+    mbedtls_aria_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CTR */
-void aria_encrypt_ctr( data_t *key_str, data_t *iv_str,
-                       data_t *src_str, data_t *expected_output,
-                       int result )
+void aria_encrypt_ctr(data_t *key_str, data_t *iv_str,
+                      data_t *src_str, data_t *expected_output,
+                      int result)
 {
     unsigned char output[ARIA_MAX_DATASIZE];
     unsigned char blk[MBEDTLS_ARIA_BLOCKSIZE];
     mbedtls_aria_context ctx;
     size_t iv_offset = 0;
 
-    memset( output, 0x00, sizeof( output ) );
-    mbedtls_aria_init( &ctx );
+    memset(output, 0x00, sizeof(output));
+    mbedtls_aria_init(&ctx);
 
-    mbedtls_aria_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
-    TEST_ASSERT( mbedtls_aria_crypt_ctr( &ctx, src_str->len, &iv_offset,
-                                         iv_str->x, blk, src_str->x, output )
-                 == result );
+    mbedtls_aria_setkey_enc(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_aria_crypt_ctr(&ctx, src_str->len, &iv_offset,
+                                       iv_str->x, blk, src_str->x, output)
+                == result);
 
-    ASSERT_COMPARE( output, expected_output->len,
-                    expected_output->x, expected_output->len );
+    ASSERT_COMPARE(output, expected_output->len,
+                   expected_output->x, expected_output->len);
 
 exit:
-    mbedtls_aria_free( &ctx );
+    mbedtls_aria_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CTR */
-void aria_decrypt_ctr( data_t *key_str, data_t *iv_str,
-                       data_t *src_str, data_t *expected_output,
-                       int result )
+void aria_decrypt_ctr(data_t *key_str, data_t *iv_str,
+                      data_t *src_str, data_t *expected_output,
+                      int result)
 {
     unsigned char output[ARIA_MAX_DATASIZE];
     unsigned char blk[MBEDTLS_ARIA_BLOCKSIZE];
     mbedtls_aria_context ctx;
     size_t iv_offset = 0;
 
-    memset( output, 0x00, sizeof( output ) );
-    mbedtls_aria_init( &ctx );
+    memset(output, 0x00, sizeof(output));
+    mbedtls_aria_init(&ctx);
 
-    mbedtls_aria_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
-    TEST_ASSERT( mbedtls_aria_crypt_ctr( &ctx, src_str->len, &iv_offset,
-                                         iv_str->x, blk, src_str->x, output )
-                 == result );
+    mbedtls_aria_setkey_enc(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_aria_crypt_ctr(&ctx, src_str->len, &iv_offset,
+                                       iv_str->x, blk, src_str->x, output)
+                == result);
 
-    ASSERT_COMPARE( output, expected_output->len,
-                    expected_output->x, expected_output->len );
+    ASSERT_COMPARE(output, expected_output->len,
+                   expected_output->x, expected_output->len);
 
 exit:
-    mbedtls_aria_free( &ctx );
+    mbedtls_aria_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
 void aria_selftest()
 {
-    TEST_ASSERT( mbedtls_aria_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_aria_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_asn1parse.function b/tests/suites/test_suite_asn1parse.function
index 4cc0f17..7c546c1 100644
--- a/tests/suites/test_suite_asn1parse.function
+++ b/tests/suites/test_suite_asn1parse.function
@@ -16,8 +16,8 @@
  * should not be checked. */
 #define UNPREDICTABLE_RESULT 0x5552
 
-static int nested_parse( unsigned char **const p,
-                         const unsigned char *const end )
+static int nested_parse(unsigned char **const p,
+                        const unsigned char *const end)
 {
     int ret;
     size_t len = 0;
@@ -28,31 +28,32 @@
 
     /* First get the length, skipping over the tag. */
     content_start = start + 1;
-    ret = mbedtls_asn1_get_len( &content_start, end, &len );
-    TEST_ASSERT( content_start <= end );
-    if( ret != 0 )
-        return( ret );
+    ret = mbedtls_asn1_get_len(&content_start, end, &len);
+    TEST_ASSERT(content_start <= end);
+    if (ret != 0) {
+        return ret;
+    }
 
     /* Since we have a valid element start (tag and length), retrieve and
      * check the tag. */
     tag = start[0];
-    TEST_EQUAL( mbedtls_asn1_get_tag( p, end, &len2, tag ^ 1 ),
-                MBEDTLS_ERR_ASN1_UNEXPECTED_TAG );
+    TEST_EQUAL(mbedtls_asn1_get_tag(p, end, &len2, tag ^ 1),
+               MBEDTLS_ERR_ASN1_UNEXPECTED_TAG);
     *p = start;
-    TEST_EQUAL( mbedtls_asn1_get_tag( p, end, &len2, tag ), 0 );
-    TEST_EQUAL( len, len2 );
-    TEST_ASSERT( *p == content_start );
+    TEST_EQUAL(mbedtls_asn1_get_tag(p, end, &len2, tag), 0);
+    TEST_EQUAL(len, len2);
+    TEST_ASSERT(*p == content_start);
     *p = content_start;
 
-    switch( tag & 0x1f )
-    {
+    switch (tag & 0x1f) {
         case MBEDTLS_ASN1_BOOLEAN:
         {
             int val = -257;
             *p = start;
-            ret = mbedtls_asn1_get_bool( p, end, &val );
-            if( ret == 0 )
-                TEST_ASSERT( val == 0 || val == 1 );
+            ret = mbedtls_asn1_get_bool(p, end, &val);
+            if (ret == 0) {
+                TEST_ASSERT(val == 0 || val == 1);
+            }
             break;
         }
 
@@ -60,23 +61,22 @@
         {
 #if defined(MBEDTLS_BIGNUM_C)
             mbedtls_mpi mpi;
-            mbedtls_mpi_init( &mpi );
+            mbedtls_mpi_init(&mpi);
             *p = start;
-            ret = mbedtls_asn1_get_mpi( p, end, &mpi );
-            mbedtls_mpi_free( &mpi );
+            ret = mbedtls_asn1_get_mpi(p, end, &mpi);
+            mbedtls_mpi_free(&mpi);
 #else
             *p = start + 1;
-            ret = mbedtls_asn1_get_len( p, end, &len );
+            ret = mbedtls_asn1_get_len(p, end, &len);
             *p += len;
 #endif
             /* If we're sure that the number fits in an int, also
              * call mbedtls_asn1_get_int(). */
-            if( ret == 0 && len < sizeof( int ) )
-            {
+            if (ret == 0 && len < sizeof(int)) {
                 int val = -257;
                 unsigned char *q = start;
-                ret = mbedtls_asn1_get_int( &q, end, &val );
-                TEST_ASSERT( *p == q );
+                ret = mbedtls_asn1_get_int(&q, end, &val);
+                TEST_ASSERT(*p == q);
             }
             break;
         }
@@ -85,14 +85,15 @@
         {
             mbedtls_asn1_bitstring bs;
             *p = start;
-            ret = mbedtls_asn1_get_bitstring( p, end, &bs );
+            ret = mbedtls_asn1_get_bitstring(p, end, &bs);
             break;
         }
 
         case MBEDTLS_ASN1_SEQUENCE:
         {
-            while( *p <= end && *p < content_start + len && ret == 0 )
-                ret = nested_parse( p, content_start + len );
+            while (*p <= end && *p < content_start + len && ret == 0) {
+                ret = nested_parse(p, content_start + len);
+            }
             break;
         }
 
@@ -111,18 +112,18 @@
         default:
             /* No further testing implemented for this tag. */
             *p += len;
-            return( 0 );
+            return 0;
     }
 
-    TEST_ASSERT( *p <= end );
-    return( ret );
+    TEST_ASSERT(*p <= end);
+    return ret;
 
 exit:
-    return( ERR_PARSE_INCONSISTENCY );
+    return ERR_PARSE_INCONSISTENCY;
 }
 
-int get_len_step( const data_t *input, size_t buffer_size,
-                  size_t actual_length )
+int get_len_step(const data_t *input, size_t buffer_size,
+                 size_t actual_length)
 {
     unsigned char *buf = NULL;
     unsigned char *p = NULL;
@@ -130,53 +131,43 @@
     size_t parsed_length;
     int ret;
 
-    mbedtls_test_set_step( buffer_size );
+    mbedtls_test_set_step(buffer_size);
     /* Allocate a new buffer of exactly the length to parse each time.
      * This gives memory sanitizers a chance to catch buffer overreads. */
-    if( buffer_size == 0 )
-    {
-        ASSERT_ALLOC( buf, 1 );
+    if (buffer_size == 0) {
+        ASSERT_ALLOC(buf, 1);
         end = buf + 1;
         p = end;
-    }
-    else
-    {
-        ASSERT_ALLOC_WEAK( buf, buffer_size );
-        if( buffer_size > input->len )
-        {
-            memcpy( buf, input->x, input->len );
-            memset( buf + input->len, 'A', buffer_size - input->len );
-        }
-        else
-        {
-            memcpy( buf, input->x, buffer_size );
+    } else {
+        ASSERT_ALLOC_WEAK(buf, buffer_size);
+        if (buffer_size > input->len) {
+            memcpy(buf, input->x, input->len);
+            memset(buf + input->len, 'A', buffer_size - input->len);
+        } else {
+            memcpy(buf, input->x, buffer_size);
         }
         p = buf;
         end = buf + buffer_size;
     }
 
-    ret = mbedtls_asn1_get_len( &p, end, &parsed_length );
+    ret = mbedtls_asn1_get_len(&p, end, &parsed_length);
 
-    if( buffer_size >= input->len + actual_length )
-    {
-        TEST_EQUAL( ret, 0 );
-        TEST_ASSERT( p == buf + input->len );
-        TEST_EQUAL( parsed_length, actual_length );
+    if (buffer_size >= input->len + actual_length) {
+        TEST_EQUAL(ret, 0);
+        TEST_ASSERT(p == buf + input->len);
+        TEST_EQUAL(parsed_length, actual_length);
+    } else {
+        TEST_EQUAL(ret, MBEDTLS_ERR_ASN1_OUT_OF_DATA);
     }
-    else
-    {
-        TEST_EQUAL( ret, MBEDTLS_ERR_ASN1_OUT_OF_DATA );
-    }
-    mbedtls_free( buf );
-    return( 1 );
+    mbedtls_free(buf);
+    return 1;
 
 exit:
-    mbedtls_free( buf );
-    return( 0 );
+    mbedtls_free(buf);
+    return 0;
 }
 
-typedef struct
-{
+typedef struct {
     const unsigned char *input_start;
     const char *description;
 } traverse_state_t;
@@ -188,38 +179,40 @@
 #define RET_TRAVERSE_ERROR 2
 
 
-static int traverse_callback( void *ctx, int tag,
-                              unsigned char *content, size_t len )
+static int traverse_callback(void *ctx, int tag,
+                             unsigned char *content, size_t len)
 {
     traverse_state_t *state = ctx;
     size_t offset;
     const char *rest = state->description;
     unsigned long n;
 
-    TEST_ASSERT( content > state->input_start );
+    TEST_ASSERT(content > state->input_start);
     offset = content - state->input_start;
-    mbedtls_test_set_step( offset );
+    mbedtls_test_set_step(offset);
 
-    if( *rest == 0 )
-        return( RET_TRAVERSE_STOP );
-    n = strtoul( rest, (char **) &rest, 0 );
-    TEST_EQUAL( n, offset );
-    TEST_EQUAL( *rest, ',' );
+    if (*rest == 0) {
+        return RET_TRAVERSE_STOP;
+    }
+    n = strtoul(rest, (char **) &rest, 0);
+    TEST_EQUAL(n, offset);
+    TEST_EQUAL(*rest, ',');
     ++rest;
-    n = strtoul( rest, (char **) &rest, 0 );
-    TEST_EQUAL( n, (unsigned) tag );
-    TEST_EQUAL( *rest, ',' );
+    n = strtoul(rest, (char **) &rest, 0);
+    TEST_EQUAL(n, (unsigned) tag);
+    TEST_EQUAL(*rest, ',');
     ++rest;
-    n = strtoul( rest, (char **) &rest, 0 );
-    TEST_EQUAL( n, len );
-    if( *rest == ',' )
+    n = strtoul(rest, (char **) &rest, 0);
+    TEST_EQUAL(n, len);
+    if (*rest == ',') {
         ++rest;
+    }
 
     state->description = rest;
-    return( 0 );
+    return 0;
 
 exit:
-    return( RET_TRAVERSE_ERROR );
+    return RET_TRAVERSE_ERROR;
 }
 
 /* END_HEADER */
@@ -230,9 +223,9 @@
  */
 
 /* BEGIN_CASE */
-void parse_prefixes( const data_t *input,
-                     int full_result,
-                     int overfull_result )
+void parse_prefixes(const data_t *input,
+                    int full_result,
+                    int overfull_result)
 {
     /* full_result: expected result from parsing the given string. */
     /* overfull_result: expected_result from parsing the given string plus
@@ -250,45 +243,42 @@
      * we wouldn't know what to parse the input as.
      * Also test the input followed by an extra byte.
      */
-    for( buffer_size = 1; buffer_size <= input->len + 1; buffer_size++ )
-    {
-        mbedtls_test_set_step( buffer_size );
+    for (buffer_size = 1; buffer_size <= input->len + 1; buffer_size++) {
+        mbedtls_test_set_step(buffer_size);
         /* Allocate a new buffer of exactly the length to parse each time.
          * This gives memory sanitizers a chance to catch buffer overreads. */
-        ASSERT_ALLOC( buf, buffer_size );
-        memcpy( buf, input->x, buffer_size );
+        ASSERT_ALLOC(buf, buffer_size);
+        memcpy(buf, input->x, buffer_size);
         p = buf;
-        ret = nested_parse( &p, buf + buffer_size );
+        ret = nested_parse(&p, buf + buffer_size);
 
-        if( ret == ERR_PARSE_INCONSISTENCY )
+        if (ret == ERR_PARSE_INCONSISTENCY) {
             goto exit;
-        if( buffer_size < input->len )
-        {
-            TEST_EQUAL( ret, MBEDTLS_ERR_ASN1_OUT_OF_DATA );
         }
-        else if( buffer_size == input->len )
-        {
-            TEST_EQUAL( ret, full_result );
+        if (buffer_size < input->len) {
+            TEST_EQUAL(ret, MBEDTLS_ERR_ASN1_OUT_OF_DATA);
+        } else if (buffer_size == input->len) {
+            TEST_EQUAL(ret, full_result);
+        } else { /* ( buffer_size > input->len ) */
+            if (overfull_result != UNPREDICTABLE_RESULT) {
+                TEST_EQUAL(ret, overfull_result);
+            }
         }
-        else /* ( buffer_size > input->len ) */
-        {
-            if( overfull_result != UNPREDICTABLE_RESULT )
-                TEST_EQUAL( ret, overfull_result );
+        if (ret == 0) {
+            TEST_ASSERT(p == buf + input->len);
         }
-        if( ret == 0 )
-            TEST_ASSERT( p == buf + input->len );
 
-        mbedtls_free( buf );
+        mbedtls_free(buf);
         buf = NULL;
     }
 
 exit:
-    mbedtls_free( buf );
+    mbedtls_free(buf);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void get_len( const data_t *input, int actual_length_arg )
+void get_len(const data_t *input, int actual_length_arg)
 {
     size_t actual_length = actual_length_arg;
     size_t buffer_size;
@@ -299,37 +289,38 @@
      * the payload is truncated more than one byte away from either end,
      * and we only test the empty string on a 1-byte input.
      */
-    for( buffer_size = 1; buffer_size <= input->len + 1; buffer_size++ )
-    {
-        if( ! get_len_step( input, buffer_size, actual_length ) )
+    for (buffer_size = 1; buffer_size <= input->len + 1; buffer_size++) {
+        if (!get_len_step(input, buffer_size, actual_length)) {
             goto exit;
+        }
     }
-    if( ! get_len_step( input, input->len + actual_length - 1, actual_length ) )
+    if (!get_len_step(input, input->len + actual_length - 1, actual_length)) {
         goto exit;
-    if( ! get_len_step( input, input->len + actual_length, actual_length ) )
+    }
+    if (!get_len_step(input, input->len + actual_length, actual_length)) {
         goto exit;
+    }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void get_boolean( const data_t *input,
-                  int expected_value, int expected_result )
+void get_boolean(const data_t *input,
+                 int expected_value, int expected_result)
 {
     unsigned char *p = input->x;
     int val;
     int ret;
-    ret = mbedtls_asn1_get_bool( &p, input->x + input->len, &val );
-    TEST_EQUAL( ret, expected_result );
-    if( expected_result == 0 )
-    {
-        TEST_EQUAL( val, expected_value );
-        TEST_ASSERT( p == input->x + input->len );
+    ret = mbedtls_asn1_get_bool(&p, input->x + input->len, &val);
+    TEST_EQUAL(ret, expected_result);
+    if (expected_result == 0) {
+        TEST_EQUAL(val, expected_value);
+        TEST_ASSERT(p == input->x + input->len);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void empty_integer( const data_t *input )
+void empty_integer(const data_t *input)
 {
     unsigned char *p;
 #if defined(MBEDTLS_BIGNUM_C)
@@ -338,34 +329,34 @@
     int val;
 
 #if defined(MBEDTLS_BIGNUM_C)
-    mbedtls_mpi_init( & actual_mpi );
+    mbedtls_mpi_init(&actual_mpi);
 #endif
 
     /* An INTEGER with no content is not valid. */
     p = input->x;
-    TEST_EQUAL( mbedtls_asn1_get_int( &p, input->x + input->len, &val ),
-                MBEDTLS_ERR_ASN1_INVALID_LENGTH );
+    TEST_EQUAL(mbedtls_asn1_get_int(&p, input->x + input->len, &val),
+               MBEDTLS_ERR_ASN1_INVALID_LENGTH);
 
 #if defined(MBEDTLS_BIGNUM_C)
     /* INTEGERs are sometimes abused as bitstrings, so the library accepts
      * an INTEGER with empty content and gives it the value 0. */
     p = input->x;
-    TEST_EQUAL( mbedtls_asn1_get_mpi( &p, input->x + input->len, &actual_mpi ),
-                0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &actual_mpi, 0 ), 0 );
+    TEST_EQUAL(mbedtls_asn1_get_mpi(&p, input->x + input->len, &actual_mpi),
+               0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&actual_mpi, 0), 0);
 #endif
 
 exit:
 #if defined(MBEDTLS_BIGNUM_C)
-    mbedtls_mpi_free( &actual_mpi );
+    mbedtls_mpi_free(&actual_mpi);
 #endif
-    /*empty cleanup in some configurations*/ ;
+    /*empty cleanup in some configurations*/;
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void get_integer( const data_t *input,
-                  const char *expected_hex, int expected_result )
+void get_integer(const data_t *input,
+                 const char *expected_hex, int expected_result)
 {
     unsigned char *p;
 #if defined(MBEDTLS_BIGNUM_C)
@@ -380,26 +371,24 @@
     int ret;
 
 #if defined(MBEDTLS_BIGNUM_C)
-    mbedtls_mpi_init( &expected_mpi );
-    mbedtls_mpi_init( &actual_mpi );
-    mbedtls_mpi_init( &complement );
+    mbedtls_mpi_init(&expected_mpi);
+    mbedtls_mpi_init(&actual_mpi);
+    mbedtls_mpi_init(&complement);
 #endif
 
     errno = 0;
-    expected_value = strtol( expected_hex, NULL, 16 );
-    if( expected_result == 0 &&
-        ( errno == ERANGE
+    expected_value = strtol(expected_hex, NULL, 16);
+    if (expected_result == 0 &&
+        (errno == ERANGE
 #if LONG_MAX > INT_MAX
-          || expected_value > INT_MAX || expected_value < INT_MIN
+         || expected_value > INT_MAX || expected_value < INT_MIN
 #endif
-            ) )
-    {
+        )) {
         /* The library returns the dubious error code INVALID_LENGTH
          * for integers that are out of range. */
         expected_result_for_int = MBEDTLS_ERR_ASN1_INVALID_LENGTH;
     }
-    if( expected_result == 0 && expected_value < 0 )
-    {
+    if (expected_result == 0 && expected_value < 0) {
         /* The library does not support negative INTEGERs and
          * returns the dubious error code INVALID_LENGTH.
          * Test that we preserve the historical behavior. If we
@@ -408,34 +397,28 @@
     }
 
     p = input->x;
-    ret = mbedtls_asn1_get_int( &p, input->x + input->len, &val );
-    TEST_EQUAL( ret, expected_result_for_int );
-    if( ret == 0 )
-    {
-        TEST_EQUAL( val, expected_value );
-        TEST_ASSERT( p == input->x + input->len );
+    ret = mbedtls_asn1_get_int(&p, input->x + input->len, &val);
+    TEST_EQUAL(ret, expected_result_for_int);
+    if (ret == 0) {
+        TEST_EQUAL(val, expected_value);
+        TEST_ASSERT(p == input->x + input->len);
     }
 
 #if defined(MBEDTLS_BIGNUM_C)
-    ret = mbedtls_test_read_mpi( &expected_mpi, expected_hex );
-    TEST_ASSERT( ret == 0 || ret == MBEDTLS_ERR_MPI_BAD_INPUT_DATA );
-    if( ret == MBEDTLS_ERR_MPI_BAD_INPUT_DATA )
-    {
+    ret = mbedtls_test_read_mpi(&expected_mpi, expected_hex);
+    TEST_ASSERT(ret == 0 || ret == MBEDTLS_ERR_MPI_BAD_INPUT_DATA);
+    if (ret == MBEDTLS_ERR_MPI_BAD_INPUT_DATA) {
         /* The data overflows the maximum MPI size. */
         expected_result_for_mpi = MBEDTLS_ERR_MPI_BAD_INPUT_DATA;
     }
     p = input->x;
-    ret = mbedtls_asn1_get_mpi( &p, input->x + input->len, &actual_mpi );
-    TEST_EQUAL( ret, expected_result_for_mpi );
-    if( ret == 0 )
-    {
-        if( expected_value >= 0 )
-        {
-            TEST_ASSERT( mbedtls_mpi_cmp_mpi( &actual_mpi,
-                                              &expected_mpi ) == 0 );
-        }
-        else
-        {
+    ret = mbedtls_asn1_get_mpi(&p, input->x + input->len, &actual_mpi);
+    TEST_EQUAL(ret, expected_result_for_mpi);
+    if (ret == 0) {
+        if (expected_value >= 0) {
+            TEST_ASSERT(mbedtls_mpi_cmp_mpi(&actual_mpi,
+                                            &expected_mpi) == 0);
+        } else {
             /* The library ignores the sign bit in ASN.1 INTEGERs
              * (which makes sense insofar as INTEGERs are sometimes
              * abused as bit strings), so the result of parsing them
@@ -448,32 +431,32 @@
              * negative INTEGERs, we'll fix this test code. */
             unsigned char *q = input->x + 1;
             size_t len;
-            TEST_ASSERT( mbedtls_asn1_get_len( &q, input->x + input->len,
-                                               &len ) == 0 );
-            TEST_ASSERT( mbedtls_mpi_lset( &complement, 1 ) == 0 );
-            TEST_ASSERT( mbedtls_mpi_shift_l( &complement, len * 8 ) == 0 );
-            TEST_ASSERT( mbedtls_mpi_add_mpi( &complement, &complement,
-                                              &expected_mpi ) == 0 );
-            TEST_ASSERT( mbedtls_mpi_cmp_mpi( &complement,
-                                              &actual_mpi ) == 0 );
+            TEST_ASSERT(mbedtls_asn1_get_len(&q, input->x + input->len,
+                                             &len) == 0);
+            TEST_ASSERT(mbedtls_mpi_lset(&complement, 1) == 0);
+            TEST_ASSERT(mbedtls_mpi_shift_l(&complement, len * 8) == 0);
+            TEST_ASSERT(mbedtls_mpi_add_mpi(&complement, &complement,
+                                            &expected_mpi) == 0);
+            TEST_ASSERT(mbedtls_mpi_cmp_mpi(&complement,
+                                            &actual_mpi) == 0);
         }
-        TEST_ASSERT( p == input->x + input->len );
+        TEST_ASSERT(p == input->x + input->len);
     }
 #endif
 
 exit:
 #if defined(MBEDTLS_BIGNUM_C)
-    mbedtls_mpi_free( &expected_mpi );
-    mbedtls_mpi_free( &actual_mpi );
-    mbedtls_mpi_free( &complement );
+    mbedtls_mpi_free(&expected_mpi);
+    mbedtls_mpi_free(&actual_mpi);
+    mbedtls_mpi_free(&complement);
 #endif
-    /*empty cleanup in some configurations*/ ;
+    /*empty cleanup in some configurations*/;
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void get_enum( const data_t *input,
-               const char *expected_hex, int expected_result )
+void get_enum(const data_t *input,
+              const char *expected_hex, int expected_result)
 {
     unsigned char *p;
     long expected_value;
@@ -482,20 +465,18 @@
     int ret;
 
     errno = 0;
-    expected_value = strtol( expected_hex, NULL, 16 );
-    if( expected_result == 0 &&
-        ( errno == ERANGE
+    expected_value = strtol(expected_hex, NULL, 16);
+    if (expected_result == 0 &&
+        (errno == ERANGE
 #if LONG_MAX > INT_MAX
-          || expected_value > INT_MAX || expected_value < INT_MIN
+         || expected_value > INT_MAX || expected_value < INT_MIN
 #endif
-            ) )
-    {
+        )) {
         /* The library returns the dubious error code INVALID_LENGTH
          * for integers that are out of range. */
         expected_result_for_enum = MBEDTLS_ERR_ASN1_INVALID_LENGTH;
     }
-    if( expected_result == 0 && expected_value < 0 )
-    {
+    if (expected_result == 0 && expected_value < 0) {
         /* The library does not support negative INTEGERs and
          * returns the dubious error code INVALID_LENGTH.
          * Test that we preserve the historical behavior. If we
@@ -504,18 +485,17 @@
     }
 
     p = input->x;
-    ret = mbedtls_asn1_get_enum( &p, input->x + input->len, &val );
-    TEST_EQUAL( ret, expected_result_for_enum );
-    if( ret == 0 )
-    {
-        TEST_EQUAL( val, expected_value );
-        TEST_ASSERT( p == input->x + input->len );
+    ret = mbedtls_asn1_get_enum(&p, input->x + input->len, &val);
+    TEST_EQUAL(ret, expected_result_for_enum);
+    if (ret == 0) {
+        TEST_EQUAL(val, expected_value);
+        TEST_ASSERT(p == input->x + input->len);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_BIGNUM_C */
-void get_mpi_too_large( )
+void get_mpi_too_large()
 {
     unsigned char *buf = NULL;
     unsigned char *p;
@@ -524,63 +504,62 @@
         MBEDTLS_MPI_MAX_LIMBS * sizeof(mbedtls_mpi_uint) + 1;
     size_t size = too_many_octets + 6;
 
-    mbedtls_mpi_init( &actual_mpi );
+    mbedtls_mpi_init(&actual_mpi);
 
-    ASSERT_ALLOC( buf, size );
+    ASSERT_ALLOC(buf, size);
     buf[0] = 0x02; /* tag: INTEGER */
     buf[1] = 0x84; /* 4-octet length */
-    buf[2] = ( too_many_octets >> 24 ) & 0xff;
-    buf[3] = ( too_many_octets >> 16 ) & 0xff;
-    buf[4] = ( too_many_octets >> 8 ) & 0xff;
+    buf[2] = (too_many_octets >> 24) & 0xff;
+    buf[3] = (too_many_octets >> 16) & 0xff;
+    buf[4] = (too_many_octets >> 8) & 0xff;
     buf[5] = too_many_octets & 0xff;
     buf[6] = 0x01; /* most significant octet */
 
     p = buf;
-    TEST_EQUAL( mbedtls_asn1_get_mpi( &p, buf + size, &actual_mpi ),
-                MBEDTLS_ERR_MPI_ALLOC_FAILED );
+    TEST_EQUAL(mbedtls_asn1_get_mpi(&p, buf + size, &actual_mpi),
+               MBEDTLS_ERR_MPI_ALLOC_FAILED);
 
 exit:
-    mbedtls_mpi_free( &actual_mpi );
-    mbedtls_free( buf );
+    mbedtls_mpi_free(&actual_mpi);
+    mbedtls_free(buf);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void get_bitstring( const data_t *input,
-                    int expected_length, int expected_unused_bits,
-                    int expected_result, int expected_result_null )
+void get_bitstring(const data_t *input,
+                   int expected_length, int expected_unused_bits,
+                   int expected_result, int expected_result_null)
 {
     mbedtls_asn1_bitstring bs = { 0xdead, 0x21, NULL };
     unsigned char *p = input->x;
 
-    TEST_EQUAL( mbedtls_asn1_get_bitstring( &p, input->x + input->len, &bs ),
-                expected_result );
-    if( expected_result == 0 )
-    {
-        TEST_EQUAL( bs.len, (size_t) expected_length );
-        TEST_EQUAL( bs.unused_bits, expected_unused_bits );
-        TEST_ASSERT( bs.p != NULL );
-        TEST_EQUAL( bs.p - input->x + bs.len, input->len );
-        TEST_ASSERT( p == input->x + input->len );
+    TEST_EQUAL(mbedtls_asn1_get_bitstring(&p, input->x + input->len, &bs),
+               expected_result);
+    if (expected_result == 0) {
+        TEST_EQUAL(bs.len, (size_t) expected_length);
+        TEST_EQUAL(bs.unused_bits, expected_unused_bits);
+        TEST_ASSERT(bs.p != NULL);
+        TEST_EQUAL(bs.p - input->x + bs.len, input->len);
+        TEST_ASSERT(p == input->x + input->len);
     }
 
     p = input->x;
-    TEST_EQUAL( mbedtls_asn1_get_bitstring_null( &p, input->x + input->len,
-                                                 &bs.len ),
-                expected_result_null );
-    if( expected_result_null == 0 )
-    {
-        TEST_EQUAL( bs.len, (size_t) expected_length );
-        if( expected_result == 0 )
-            TEST_ASSERT( p == input->x + input->len - bs.len );
+    TEST_EQUAL(mbedtls_asn1_get_bitstring_null(&p, input->x + input->len,
+                                               &bs.len),
+               expected_result_null);
+    if (expected_result_null == 0) {
+        TEST_EQUAL(bs.len, (size_t) expected_length);
+        if (expected_result == 0) {
+            TEST_ASSERT(p == input->x + input->len - bs.len);
+        }
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void get_sequence_of( const data_t *input, int tag,
-                      const char *description,
-                      int expected_result )
+void get_sequence_of(const data_t *input, int tag,
+                     const char *description,
+                     int expected_result)
 {
     /* The description string is a comma-separated list of integers.
      * For each element in the SEQUENCE in input, description contains
@@ -596,53 +575,49 @@
     unsigned long n;
     unsigned int step = 0;
 
-    TEST_EQUAL( mbedtls_asn1_get_sequence_of( &p, input->x + input->len,
-                                              &head, tag ),
-                expected_result );
-    if( expected_result == 0 )
-    {
-        TEST_ASSERT( p == input->x + input->len );
+    TEST_EQUAL(mbedtls_asn1_get_sequence_of(&p, input->x + input->len,
+                                            &head, tag),
+               expected_result);
+    if (expected_result == 0) {
+        TEST_ASSERT(p == input->x + input->len);
 
-        if( ! *rest )
-        {
-            TEST_EQUAL( head.buf.tag, 0 );
-            TEST_ASSERT( head.buf.p == NULL );
-            TEST_EQUAL( head.buf.len, 0 );
-            TEST_ASSERT( head.next == NULL );
-        }
-        else
-        {
+        if (!*rest) {
+            TEST_EQUAL(head.buf.tag, 0);
+            TEST_ASSERT(head.buf.p == NULL);
+            TEST_EQUAL(head.buf.len, 0);
+            TEST_ASSERT(head.next == NULL);
+        } else {
             cur = &head;
-            while( *rest )
-            {
-                mbedtls_test_set_step( step );
-                TEST_ASSERT( cur != NULL );
-                TEST_EQUAL( cur->buf.tag, tag );
-                n = strtoul( rest, (char **) &rest, 0 );
-                TEST_EQUAL( n, (size_t)( cur->buf.p - input->x ) );
+            while (*rest) {
+                mbedtls_test_set_step(step);
+                TEST_ASSERT(cur != NULL);
+                TEST_EQUAL(cur->buf.tag, tag);
+                n = strtoul(rest, (char **) &rest, 0);
+                TEST_EQUAL(n, (size_t) (cur->buf.p - input->x));
                 ++rest;
-                n = strtoul( rest, (char **) &rest, 0 );
-                TEST_EQUAL( n, cur->buf.len );
-                if( *rest )
+                n = strtoul(rest, (char **) &rest, 0);
+                TEST_EQUAL(n, cur->buf.len);
+                if (*rest) {
                     ++rest;
+                }
                 cur = cur->next;
                 ++step;
             }
-            TEST_ASSERT( cur == NULL );
+            TEST_ASSERT(cur == NULL);
         }
     }
 
 exit:
-    mbedtls_asn1_sequence_free( head.next );
+    mbedtls_asn1_sequence_free(head.next);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void traverse_sequence_of( const data_t *input,
-                           int tag_must_mask, int tag_must_val,
-                           int tag_may_mask, int tag_may_val,
-                           const char *description,
-                           int expected_result )
+void traverse_sequence_of(const data_t *input,
+                          int tag_must_mask, int tag_must_val,
+                          int tag_may_mask, int tag_may_val,
+                          const char *description,
+                          int expected_result)
 {
     /* The description string is a comma-separated list of integers.
      * For each element in the SEQUENCE in input, description contains
@@ -652,144 +627,148 @@
      * "offset1,tag1,length1,..." */
 
     unsigned char *p = input->x;
-    traverse_state_t traverse_state = {input->x, description};
+    traverse_state_t traverse_state = { input->x, description };
     int ret;
 
-    ret = mbedtls_asn1_traverse_sequence_of( &p, input->x + input->len,
-                                             (uint8_t) tag_must_mask, (uint8_t) tag_must_val,
-                                             (uint8_t) tag_may_mask, (uint8_t) tag_may_val,
-                                             traverse_callback, &traverse_state );
-    if( ret == RET_TRAVERSE_ERROR )
+    ret = mbedtls_asn1_traverse_sequence_of(&p, input->x + input->len,
+                                            (uint8_t) tag_must_mask, (uint8_t) tag_must_val,
+                                            (uint8_t) tag_may_mask, (uint8_t) tag_may_val,
+                                            traverse_callback, &traverse_state);
+    if (ret == RET_TRAVERSE_ERROR) {
         goto exit;
-    TEST_EQUAL( ret, expected_result );
-    TEST_EQUAL( *traverse_state.description, 0 );
+    }
+    TEST_EQUAL(ret, expected_result);
+    TEST_EQUAL(*traverse_state.description, 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void get_alg( const data_t *input,
-              int oid_offset, int oid_length,
-              int params_tag, int params_offset, int params_length,
-              int total_length,
-              int expected_result )
+void get_alg(const data_t *input,
+             int oid_offset, int oid_length,
+             int params_tag, int params_offset, int params_length,
+             int total_length,
+             int expected_result)
 {
     mbedtls_asn1_buf oid = { -1, 0, NULL };
     mbedtls_asn1_buf params = { -1, 0, NULL };
     unsigned char *p = input->x;
     int ret;
 
-    TEST_EQUAL( mbedtls_asn1_get_alg( &p, input->x + input->len,
-                                      &oid, &params ),
-                expected_result );
-    if( expected_result == 0 )
-    {
-        TEST_EQUAL( oid.tag, MBEDTLS_ASN1_OID );
-        TEST_EQUAL( oid.p - input->x, oid_offset );
-        TEST_EQUAL( oid.len, (size_t) oid_length );
-        TEST_EQUAL( params.tag, params_tag );
-        if( params_offset != 0 )
-            TEST_EQUAL( params.p - input->x, params_offset );
-        else
-            TEST_ASSERT( params.p == NULL );
-        TEST_EQUAL( params.len, (size_t) params_length );
-        TEST_EQUAL( p - input->x, total_length );
+    TEST_EQUAL(mbedtls_asn1_get_alg(&p, input->x + input->len,
+                                    &oid, &params),
+               expected_result);
+    if (expected_result == 0) {
+        TEST_EQUAL(oid.tag, MBEDTLS_ASN1_OID);
+        TEST_EQUAL(oid.p - input->x, oid_offset);
+        TEST_EQUAL(oid.len, (size_t) oid_length);
+        TEST_EQUAL(params.tag, params_tag);
+        if (params_offset != 0) {
+            TEST_EQUAL(params.p - input->x, params_offset);
+        } else {
+            TEST_ASSERT(params.p == NULL);
+        }
+        TEST_EQUAL(params.len, (size_t) params_length);
+        TEST_EQUAL(p - input->x, total_length);
     }
 
-    ret = mbedtls_asn1_get_alg_null( &p, input->x + input->len, &oid );
-    if( expected_result == 0 && params_offset == 0 )
-    {
-        TEST_EQUAL( oid.tag, MBEDTLS_ASN1_OID );
-        TEST_EQUAL( oid.p - input->x, oid_offset );
-        TEST_EQUAL( oid.len, (size_t) oid_length );
-        TEST_EQUAL( p - input->x, total_length );
+    ret = mbedtls_asn1_get_alg_null(&p, input->x + input->len, &oid);
+    if (expected_result == 0 && params_offset == 0) {
+        TEST_EQUAL(oid.tag, MBEDTLS_ASN1_OID);
+        TEST_EQUAL(oid.p - input->x, oid_offset);
+        TEST_EQUAL(oid.len, (size_t) oid_length);
+        TEST_EQUAL(p - input->x, total_length);
+    } else {
+        TEST_ASSERT(ret != 0);
     }
-    else
-        TEST_ASSERT( ret != 0 );
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void find_named_data( data_t *oid0, data_t *oid1, data_t *oid2, data_t *oid3,
-                      data_t *needle, int from, int position )
+void find_named_data(data_t *oid0, data_t *oid1, data_t *oid2, data_t *oid3,
+                     data_t *needle, int from, int position)
 {
-    mbedtls_asn1_named_data nd[] ={
-        { {0x06, oid0->len, oid0->x}, {0, 0, NULL}, NULL, 0 },
-        { {0x06, oid1->len, oid1->x}, {0, 0, NULL}, NULL, 0 },
-        { {0x06, oid2->len, oid2->x}, {0, 0, NULL}, NULL, 0 },
-        { {0x06, oid3->len, oid3->x}, {0, 0, NULL}, NULL, 0 },
+    mbedtls_asn1_named_data nd[] = {
+        { { 0x06, oid0->len, oid0->x }, { 0, 0, NULL }, NULL, 0 },
+        { { 0x06, oid1->len, oid1->x }, { 0, 0, NULL }, NULL, 0 },
+        { { 0x06, oid2->len, oid2->x }, { 0, 0, NULL }, NULL, 0 },
+        { { 0x06, oid3->len, oid3->x }, { 0, 0, NULL }, NULL, 0 },
     };
-    mbedtls_asn1_named_data *pointers[ARRAY_LENGTH( nd ) + 1];
+    mbedtls_asn1_named_data *pointers[ARRAY_LENGTH(nd) + 1];
     size_t i;
     mbedtls_asn1_named_data *found;
 
-    for( i = 0; i < ARRAY_LENGTH( nd ); i++ )
+    for (i = 0; i < ARRAY_LENGTH(nd); i++) {
         pointers[i] = &nd[i];
-    pointers[ARRAY_LENGTH( nd )] = NULL;
-    for( i = 0; i < ARRAY_LENGTH( nd ); i++ )
+    }
+    pointers[ARRAY_LENGTH(nd)] = NULL;
+    for (i = 0; i < ARRAY_LENGTH(nd); i++) {
         nd[i].next = pointers[i+1];
+    }
 
-    found = mbedtls_asn1_find_named_data( pointers[from],
-                                          (const char *) needle->x,
-                                          needle->len );
-    TEST_ASSERT( found == pointers[position] );
+    found = mbedtls_asn1_find_named_data(pointers[from],
+                                         (const char *) needle->x,
+                                         needle->len);
+    TEST_ASSERT(found == pointers[position]);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void free_named_data_null( )
+void free_named_data_null()
 {
-    mbedtls_asn1_free_named_data( NULL );
+    mbedtls_asn1_free_named_data(NULL);
     goto exit; /* Silence unused label warning */
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void free_named_data( int with_oid, int with_val, int with_next )
+void free_named_data(int with_oid, int with_val, int with_next)
 {
     mbedtls_asn1_named_data next =
-        { {0x06, 0, NULL}, {0, 0xcafe, NULL}, NULL, 0 };
+    { { 0x06, 0, NULL }, { 0, 0xcafe, NULL }, NULL, 0 };
     mbedtls_asn1_named_data head =
-        { {0x06, 0, NULL}, {0, 0, NULL}, NULL, 0 };
+    { { 0x06, 0, NULL }, { 0, 0, NULL }, NULL, 0 };
 
-    if( with_oid )
-        ASSERT_ALLOC( head.oid.p, 1 );
-    if( with_val )
-        ASSERT_ALLOC( head.val.p, 1 );
-    if( with_next )
+    if (with_oid) {
+        ASSERT_ALLOC(head.oid.p, 1);
+    }
+    if (with_val) {
+        ASSERT_ALLOC(head.val.p, 1);
+    }
+    if (with_next) {
         head.next = &next;
+    }
 
-    mbedtls_asn1_free_named_data( &head );
-    TEST_ASSERT( head.oid.p == NULL );
-    TEST_ASSERT( head.val.p == NULL );
-    TEST_ASSERT( head.next == NULL );
-    TEST_ASSERT( next.val.len == 0xcafe );
+    mbedtls_asn1_free_named_data(&head);
+    TEST_ASSERT(head.oid.p == NULL);
+    TEST_ASSERT(head.val.p == NULL);
+    TEST_ASSERT(head.next == NULL);
+    TEST_ASSERT(next.val.len == 0xcafe);
 
 exit:
-    mbedtls_free( head.oid.p );
-    mbedtls_free( head.val.p );
+    mbedtls_free(head.oid.p);
+    mbedtls_free(head.val.p);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void free_named_data_list( int length )
+void free_named_data_list(int length)
 {
     mbedtls_asn1_named_data *head = NULL;
     int i;
 
-    for( i = 0; i < length; i++ )
-    {
+    for (i = 0; i < length; i++) {
         mbedtls_asn1_named_data *new = NULL;
-        ASSERT_ALLOC( new, 1 );
+        ASSERT_ALLOC(new, 1);
         new->next = head;
         head = new;
     }
 
-    mbedtls_asn1_free_named_data_list( &head );
-    TEST_ASSERT( head == NULL );
+    mbedtls_asn1_free_named_data_list(&head);
+    TEST_ASSERT(head == NULL);
     /* Most of the point of the test is that it doesn't leak memory.
      * So this test is only really useful under a memory leak detection
      * framework. */
 exit:
-    mbedtls_asn1_free_named_data_list( &head );
+    mbedtls_asn1_free_named_data_list(&head);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_asn1write.function b/tests/suites/test_suite_asn1write.function
index 5aa4cbe..06b9edf 100644
--- a/tests/suites/test_suite_asn1write.function
+++ b/tests/suites/test_suite_asn1write.function
@@ -4,8 +4,7 @@
 #define GUARD_LEN 4
 #define GUARD_VAL 0x2a
 
-typedef struct
-{
+typedef struct {
     unsigned char *output;
     unsigned char *start;
     unsigned char *end;
@@ -13,41 +12,38 @@
     size_t size;
 } generic_write_data_t;
 
-int generic_write_start_step( generic_write_data_t *data )
+int generic_write_start_step(generic_write_data_t *data)
 {
-    mbedtls_test_set_step( data->size );
-    mbedtls_free( data->output );
+    mbedtls_test_set_step(data->size);
+    mbedtls_free(data->output);
     data->output = NULL;
-    ASSERT_ALLOC( data->output, data->size == 0 ? 1 : data->size );
+    ASSERT_ALLOC(data->output, data->size == 0 ? 1 : data->size);
     data->end = data->output + data->size;
     data->p = data->end;
     data->start = data->end - data->size;
-    return( 1 );
+    return 1;
 exit:
-    return( 0 );
+    return 0;
 }
 
-int generic_write_finish_step( generic_write_data_t *data,
-                               const data_t *expected, int ret )
+int generic_write_finish_step(generic_write_data_t *data,
+                              const data_t *expected, int ret)
 {
     int ok = 0;
 
-    if( data->size < expected->len )
-    {
-        TEST_EQUAL( ret, MBEDTLS_ERR_ASN1_BUF_TOO_SMALL );
-    }
-    else
-    {
-        TEST_EQUAL( ret, data->end - data->p );
-        TEST_ASSERT( data->p >= data->start );
-        TEST_ASSERT( data->p <= data->end );
-        ASSERT_COMPARE( data->p, (size_t)( data->end - data->p ),
-                        expected->x, expected->len );
+    if (data->size < expected->len) {
+        TEST_EQUAL(ret, MBEDTLS_ERR_ASN1_BUF_TOO_SMALL);
+    } else {
+        TEST_EQUAL(ret, data->end - data->p);
+        TEST_ASSERT(data->p >= data->start);
+        TEST_ASSERT(data->p <= data->end);
+        ASSERT_COMPARE(data->p, (size_t) (data->end - data->p),
+                       expected->x, expected->len);
     }
     ok = 1;
 
 exit:
-    return( ok );
+    return ok;
 }
 
 /* END_HEADER */
@@ -58,206 +54,209 @@
  */
 
 /* BEGIN_CASE */
-void mbedtls_asn1_write_null( data_t *expected )
+void mbedtls_asn1_write_null(data_t *expected)
 {
     generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
     int ret;
 
-    for( data.size = 0; data.size <= expected->len + 1; data.size++ )
-    {
-        if( ! generic_write_start_step( &data ) )
+    for (data.size = 0; data.size <= expected->len + 1; data.size++) {
+        if (!generic_write_start_step(&data)) {
             goto exit;
-        ret = mbedtls_asn1_write_null( &data.p, data.start );
-        if( ! generic_write_finish_step( &data, expected, ret ) )
+        }
+        ret = mbedtls_asn1_write_null(&data.p, data.start);
+        if (!generic_write_finish_step(&data, expected, ret)) {
             goto exit;
+        }
         /* There's no parsing function for NULL. */
     }
 
 exit:
-    mbedtls_free( data.output );
+    mbedtls_free(data.output);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_asn1_write_bool( int val, data_t *expected )
+void mbedtls_asn1_write_bool(int val, data_t *expected)
 {
     generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
     int ret;
 
-    for( data.size = 0; data.size <= expected->len + 1; data.size++ )
-    {
-        if( ! generic_write_start_step( &data ) )
+    for (data.size = 0; data.size <= expected->len + 1; data.size++) {
+        if (!generic_write_start_step(&data)) {
             goto exit;
-        ret = mbedtls_asn1_write_bool( &data.p, data.start, val );
-        if( ! generic_write_finish_step( &data, expected, ret ) )
+        }
+        ret = mbedtls_asn1_write_bool(&data.p, data.start, val);
+        if (!generic_write_finish_step(&data, expected, ret)) {
             goto exit;
+        }
 #if defined(MBEDTLS_ASN1_PARSE_C)
-        if( ret >= 0 )
-        {
+        if (ret >= 0) {
             int read = 0xdeadbeef;
-            TEST_EQUAL( mbedtls_asn1_get_bool( &data.p, data.end, &read ), 0 );
-            TEST_EQUAL( val, read );
+            TEST_EQUAL(mbedtls_asn1_get_bool(&data.p, data.end, &read), 0);
+            TEST_EQUAL(val, read);
         }
 #endif /* MBEDTLS_ASN1_PARSE_C */
     }
 
 exit:
-    mbedtls_free( data.output );
+    mbedtls_free(data.output);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_asn1_write_int( int val, data_t *expected )
+void mbedtls_asn1_write_int(int val, data_t *expected)
 {
     generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
     int ret;
 
-    for( data.size = 0; data.size <= expected->len + 1; data.size++ )
-    {
-        if( ! generic_write_start_step( &data ) )
+    for (data.size = 0; data.size <= expected->len + 1; data.size++) {
+        if (!generic_write_start_step(&data)) {
             goto exit;
-        ret = mbedtls_asn1_write_int( &data.p, data.start, val );
-        if( ! generic_write_finish_step( &data, expected, ret ) )
+        }
+        ret = mbedtls_asn1_write_int(&data.p, data.start, val);
+        if (!generic_write_finish_step(&data, expected, ret)) {
             goto exit;
+        }
 #if defined(MBEDTLS_ASN1_PARSE_C)
-        if( ret >= 0 )
-        {
+        if (ret >= 0) {
             int read = 0xdeadbeef;
-            TEST_EQUAL( mbedtls_asn1_get_int( &data.p, data.end, &read ), 0 );
-            TEST_EQUAL( val, read );
+            TEST_EQUAL(mbedtls_asn1_get_int(&data.p, data.end, &read), 0);
+            TEST_EQUAL(val, read);
         }
 #endif /* MBEDTLS_ASN1_PARSE_C */
     }
 
 exit:
-    mbedtls_free( data.output );
+    mbedtls_free(data.output);
 }
 /* END_CASE */
 
 
 /* BEGIN_CASE */
-void mbedtls_asn1_write_enum( int val, data_t *expected )
+void mbedtls_asn1_write_enum(int val, data_t *expected)
 {
     generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
     int ret;
 
-    for( data.size = 0; data.size <= expected->len + 1; data.size++ )
-    {
-        if( ! generic_write_start_step( &data ) )
+    for (data.size = 0; data.size <= expected->len + 1; data.size++) {
+        if (!generic_write_start_step(&data)) {
             goto exit;
-        ret = mbedtls_asn1_write_enum( &data.p, data.start, val );
-        if( ! generic_write_finish_step( &data, expected, ret ) )
+        }
+        ret = mbedtls_asn1_write_enum(&data.p, data.start, val);
+        if (!generic_write_finish_step(&data, expected, ret)) {
             goto exit;
+        }
 #if defined(MBEDTLS_ASN1_PARSE_C)
-        if( ret >= 0 )
-        {
+        if (ret >= 0) {
             int read = 0xdeadbeef;
-            TEST_EQUAL( mbedtls_asn1_get_enum( &data.p, data.end, &read ), 0 );
-            TEST_EQUAL( val, read );
+            TEST_EQUAL(mbedtls_asn1_get_enum(&data.p, data.end, &read), 0);
+            TEST_EQUAL(val, read);
         }
 #endif /* MBEDTLS_ASN1_PARSE_C */
     }
 
 exit:
-    mbedtls_free( data.output );
+    mbedtls_free(data.output);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_BIGNUM_C */
-void mbedtls_asn1_write_mpi( data_t *val, data_t *expected )
+void mbedtls_asn1_write_mpi(data_t *val, data_t *expected)
 {
     generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
     mbedtls_mpi mpi, read;
     int ret;
 
-    mbedtls_mpi_init( &mpi );
-    mbedtls_mpi_init( &read );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &mpi, val->x, val->len ) == 0 );
+    mbedtls_mpi_init(&mpi);
+    mbedtls_mpi_init(&read);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&mpi, val->x, val->len) == 0);
 
-    for( data.size = 0; data.size <= expected->len + 1; data.size++ )
-    {
-        if( ! generic_write_start_step( &data ) )
+    for (data.size = 0; data.size <= expected->len + 1; data.size++) {
+        if (!generic_write_start_step(&data)) {
             goto exit;
-        ret = mbedtls_asn1_write_mpi( &data.p, data.start, &mpi );
-        if( ! generic_write_finish_step( &data, expected, ret ) )
+        }
+        ret = mbedtls_asn1_write_mpi(&data.p, data.start, &mpi);
+        if (!generic_write_finish_step(&data, expected, ret)) {
             goto exit;
+        }
 #if defined(MBEDTLS_ASN1_PARSE_C)
-        if( ret >= 0 )
-        {
-            TEST_EQUAL( mbedtls_asn1_get_mpi( &data.p, data.end, &read ), 0 );
-            TEST_EQUAL( 0, mbedtls_mpi_cmp_mpi( &mpi, &read ) );
+        if (ret >= 0) {
+            TEST_EQUAL(mbedtls_asn1_get_mpi(&data.p, data.end, &read), 0);
+            TEST_EQUAL(0, mbedtls_mpi_cmp_mpi(&mpi, &read));
         }
 #endif /* MBEDTLS_ASN1_PARSE_C */
         /* Skip some intermediate lengths, they're boring. */
-        if( expected->len > 10 && data.size == 8 )
+        if (expected->len > 10 && data.size == 8) {
             data.size = expected->len - 2;
+        }
     }
 
 exit:
-    mbedtls_mpi_free( &mpi );
-    mbedtls_mpi_free( &read );
-    mbedtls_free( data.output );
+    mbedtls_mpi_free(&mpi);
+    mbedtls_mpi_free(&read);
+    mbedtls_free(data.output);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_asn1_write_string( int tag, data_t *content, data_t *expected )
+void mbedtls_asn1_write_string(int tag, data_t *content, data_t *expected)
 {
     generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
     int ret;
 
-    for( data.size = 0; data.size <= expected->len + 1; data.size++ )
-    {
-        if( ! generic_write_start_step( &data ) )
+    for (data.size = 0; data.size <= expected->len + 1; data.size++) {
+        if (!generic_write_start_step(&data)) {
             goto exit;
-        switch( tag )
-        {
+        }
+        switch (tag) {
             case MBEDTLS_ASN1_OCTET_STRING:
                 ret = mbedtls_asn1_write_octet_string(
-                    &data.p, data.start, content->x, content->len );
+                    &data.p, data.start, content->x, content->len);
                 break;
             case MBEDTLS_ASN1_OID:
                 ret = mbedtls_asn1_write_oid(
                     &data.p, data.start,
-                    (const char *) content->x, content->len );
+                    (const char *) content->x, content->len);
                 break;
             case MBEDTLS_ASN1_UTF8_STRING:
                 ret = mbedtls_asn1_write_utf8_string(
                     &data.p, data.start,
-                    (const char *) content->x, content->len );
+                    (const char *) content->x, content->len);
                 break;
             case MBEDTLS_ASN1_PRINTABLE_STRING:
                 ret = mbedtls_asn1_write_printable_string(
                     &data.p, data.start,
-                    (const char *) content->x, content->len );
+                    (const char *) content->x, content->len);
                 break;
             case MBEDTLS_ASN1_IA5_STRING:
                 ret = mbedtls_asn1_write_ia5_string(
                     &data.p, data.start,
-                    (const char *) content->x, content->len );
+                    (const char *) content->x, content->len);
                 break;
             default:
                 ret = mbedtls_asn1_write_tagged_string(
                     &data.p, data.start, tag,
-                    (const char *) content->x, content->len );
+                    (const char *) content->x, content->len);
         }
-        if( ! generic_write_finish_step( &data, expected, ret ) )
+        if (!generic_write_finish_step(&data, expected, ret)) {
             goto exit;
+        }
         /* There's no parsing function for octet or character strings. */
         /* Skip some intermediate lengths, they're boring. */
-        if( expected->len > 10 && data.size == 8 )
+        if (expected->len > 10 && data.size == 8) {
             data.size = expected->len - 2;
+        }
     }
 
 exit:
-    mbedtls_free( data.output );
+    mbedtls_free(data.output);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_asn1_write_algorithm_identifier( data_t *oid,
-                                              int par_len,
-                                              data_t *expected )
+void mbedtls_asn1_write_algorithm_identifier(data_t *oid,
+                                             int par_len,
+                                             data_t *expected)
 {
     generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
     int ret;
@@ -265,29 +264,30 @@
     unsigned char *buf_complete = NULL;
 #endif /* MBEDTLS_ASN1_PARSE_C */
 
-    for( data.size = 0; data.size <= expected->len + 1; data.size++ )
-    {
-        if( ! generic_write_start_step( &data ) )
+    for (data.size = 0; data.size <= expected->len + 1; data.size++) {
+        if (!generic_write_start_step(&data)) {
             goto exit;
+        }
         ret = mbedtls_asn1_write_algorithm_identifier(
             &data.p, data.start,
-            (const char *) oid->x, oid->len, par_len );
+            (const char *) oid->x, oid->len, par_len);
         /* If params_len != 0, mbedtls_asn1_write_algorithm_identifier()
          * assumes that the parameters are already present in the buffer
          * and returns a length that accounts for this, but our test
          * data omits the parameters. */
-        if( ret >= 0 )
+        if (ret >= 0) {
             ret -= par_len;
-        if( ! generic_write_finish_step( &data, expected, ret ) )
+        }
+        if (!generic_write_finish_step(&data, expected, ret)) {
             goto exit;
+        }
 
 #if defined(MBEDTLS_ASN1_PARSE_C)
         /* Only do a parse-back test if the parameters aren't too large for
          * a small-heap environment. The boundary is somewhat arbitrary. */
-        if( ret >= 0 && par_len <= 1234 )
-        {
-            mbedtls_asn1_buf alg = {0, 0, NULL};
-            mbedtls_asn1_buf params = {0, 0, NULL};
+        if (ret >= 0 && par_len <= 1234) {
+            mbedtls_asn1_buf alg = { 0, 0, NULL };
+            mbedtls_asn1_buf params = { 0, 0, NULL };
             /* The writing function doesn't write the parameters unless
              * they're null: it only takes their length as input. But the
              * parsing function requires the parameters to be present.
@@ -296,59 +296,52 @@
             size_t len_complete = data_len + par_len;
             unsigned char expected_params_tag;
             size_t expected_params_len;
-            ASSERT_ALLOC( buf_complete, len_complete );
+            ASSERT_ALLOC(buf_complete, len_complete);
             unsigned char *end_complete = buf_complete + len_complete;
-            memcpy( buf_complete, data.p, data_len );
-            if( par_len == 0 )
-            {
+            memcpy(buf_complete, data.p, data_len);
+            if (par_len == 0) {
                 /* mbedtls_asn1_write_algorithm_identifier() wrote a NULL */
                 expected_params_tag = 0x05;
                 expected_params_len = 0;
-            }
-            else if( par_len >= 2 && par_len < 2 + 128 )
-            {
+            } else if (par_len >= 2 && par_len < 2 + 128) {
                 /* Write an OCTET STRING with a short length encoding */
                 expected_params_tag = buf_complete[data_len] = 0x04;
                 expected_params_len = par_len - 2;
                 buf_complete[data_len + 1] = (unsigned char) expected_params_len;
-            }
-            else if( par_len >= 4 + 128 && par_len < 3 + 256 * 256 )
-            {
+            } else if (par_len >= 4 + 128 && par_len < 3 + 256 * 256) {
                 /* Write an OCTET STRING with a two-byte length encoding */
                 expected_params_tag = buf_complete[data_len] = 0x04;
                 expected_params_len = par_len - 4;
                 buf_complete[data_len + 1] = 0x82;
-                buf_complete[data_len + 2] = (unsigned char) ( expected_params_len >> 8 );
-                buf_complete[data_len + 3] = (unsigned char) ( expected_params_len );
-            }
-            else
-            {
-                TEST_ASSERT( ! "Bad test data: invalid length of ASN.1 element" );
+                buf_complete[data_len + 2] = (unsigned char) (expected_params_len >> 8);
+                buf_complete[data_len + 3] = (unsigned char) (expected_params_len);
+            } else {
+                TEST_ASSERT(!"Bad test data: invalid length of ASN.1 element");
             }
             unsigned char *p = buf_complete;
-            TEST_EQUAL( mbedtls_asn1_get_alg( &p, end_complete,
-                                              &alg, &params ), 0 );
-            TEST_EQUAL( alg.tag, MBEDTLS_ASN1_OID );
-            ASSERT_COMPARE( alg.p, alg.len, oid->x, oid->len );
-            TEST_EQUAL( params.tag, expected_params_tag );
-            TEST_EQUAL( params.len, expected_params_len );
-            mbedtls_free( buf_complete );
+            TEST_EQUAL(mbedtls_asn1_get_alg(&p, end_complete,
+                                            &alg, &params), 0);
+            TEST_EQUAL(alg.tag, MBEDTLS_ASN1_OID);
+            ASSERT_COMPARE(alg.p, alg.len, oid->x, oid->len);
+            TEST_EQUAL(params.tag, expected_params_tag);
+            TEST_EQUAL(params.len, expected_params_len);
+            mbedtls_free(buf_complete);
             buf_complete = NULL;
         }
 #endif /* MBEDTLS_ASN1_PARSE_C */
     }
 
 exit:
-    mbedtls_free( data.output );
+    mbedtls_free(data.output);
 #if defined(MBEDTLS_ASN1_PARSE_C)
-    mbedtls_free( buf_complete );
+    mbedtls_free(buf_complete);
 #endif /* MBEDTLS_ASN1_PARSE_C */
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ASN1_PARSE_C */
-void mbedtls_asn1_write_len( int len, data_t * asn1, int buf_len,
-                             int result )
+void mbedtls_asn1_write_len(int len, data_t *asn1, int buf_len,
+                            int result)
 {
     int ret;
     unsigned char buf[150];
@@ -356,260 +349,253 @@
     size_t i;
     size_t read_len;
 
-    memset( buf, GUARD_VAL, sizeof( buf ) );
+    memset(buf, GUARD_VAL, sizeof(buf));
 
     p = buf + GUARD_LEN + buf_len;
 
-    ret = mbedtls_asn1_write_len( &p, buf + GUARD_LEN, (size_t) len );
+    ret = mbedtls_asn1_write_len(&p, buf + GUARD_LEN, (size_t) len);
 
-    TEST_ASSERT( ret == result );
+    TEST_ASSERT(ret == result);
 
     /* Check for buffer overwrite on both sides */
-    for( i = 0; i < GUARD_LEN; i++ )
-    {
-        TEST_ASSERT( buf[i] == GUARD_VAL );
-        TEST_ASSERT( buf[GUARD_LEN + buf_len + i] == GUARD_VAL );
+    for (i = 0; i < GUARD_LEN; i++) {
+        TEST_ASSERT(buf[i] == GUARD_VAL);
+        TEST_ASSERT(buf[GUARD_LEN + buf_len + i] == GUARD_VAL);
     }
 
-    if( result >= 0 )
-    {
-        TEST_ASSERT( p + asn1->len == buf + GUARD_LEN + buf_len );
+    if (result >= 0) {
+        TEST_ASSERT(p + asn1->len == buf + GUARD_LEN + buf_len);
 
-        TEST_ASSERT( memcmp( p, asn1->x, asn1->len ) == 0 );
+        TEST_ASSERT(memcmp(p, asn1->x, asn1->len) == 0);
 
         /* Read back with mbedtls_asn1_get_len() to check */
-        ret = mbedtls_asn1_get_len( &p, buf + GUARD_LEN + buf_len, &read_len );
+        ret = mbedtls_asn1_get_len(&p, buf + GUARD_LEN + buf_len, &read_len);
 
-        if( len == 0 )
-        {
-            TEST_ASSERT( ret == 0 );
-        }
-        else
-        {
+        if (len == 0) {
+            TEST_ASSERT(ret == 0);
+        } else {
             /* Return will be MBEDTLS_ERR_ASN1_OUT_OF_DATA because the rest of
              * the buffer is missing
              */
-            TEST_ASSERT( ret == MBEDTLS_ERR_ASN1_OUT_OF_DATA );
+            TEST_ASSERT(ret == MBEDTLS_ERR_ASN1_OUT_OF_DATA);
         }
-        TEST_ASSERT( read_len == (size_t) len );
-        TEST_ASSERT( p == buf + GUARD_LEN + buf_len );
+        TEST_ASSERT(read_len == (size_t) len);
+        TEST_ASSERT(p == buf + GUARD_LEN + buf_len);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void test_asn1_write_bitstrings( data_t *bitstring, int bits,
-                                 data_t *expected, int is_named )
+void test_asn1_write_bitstrings(data_t *bitstring, int bits,
+                                data_t *expected, int is_named)
 {
     generic_write_data_t data = { NULL, NULL, NULL, NULL, 0 };
     int ret;
-    int ( *func )( unsigned char **p, unsigned char *start,
-                   const unsigned char *buf, size_t bits ) =
-        ( is_named ? mbedtls_asn1_write_named_bitstring :
-          mbedtls_asn1_write_bitstring );
+    int (*func)(unsigned char **p, unsigned char *start,
+                const unsigned char *buf, size_t bits) =
+        (is_named ? mbedtls_asn1_write_named_bitstring :
+         mbedtls_asn1_write_bitstring);
 #if defined(MBEDTLS_ASN1_PARSE_C)
     unsigned char *masked_bitstring = NULL;
 #endif /* MBEDTLS_ASN1_PARSE_C */
 
     /* The API expects `bitstring->x` to contain `bits` bits. */
-    size_t byte_length = ( bits + 7 ) / 8;
-    TEST_ASSERT( bitstring->len >= byte_length );
+    size_t byte_length = (bits + 7) / 8;
+    TEST_ASSERT(bitstring->len >= byte_length);
 
 #if defined(MBEDTLS_ASN1_PARSE_C)
-    ASSERT_ALLOC( masked_bitstring, byte_length );
-    if( byte_length != 0 )
-    {
-        memcpy( masked_bitstring, bitstring->x, byte_length );
-        if( bits % 8 != 0 )
-            masked_bitstring[byte_length - 1] &= ~( 0xff >> ( bits % 8 ) );
+    ASSERT_ALLOC(masked_bitstring, byte_length);
+    if (byte_length != 0) {
+        memcpy(masked_bitstring, bitstring->x, byte_length);
+        if (bits % 8 != 0) {
+            masked_bitstring[byte_length - 1] &= ~(0xff >> (bits % 8));
+        }
     }
     size_t value_bits = bits;
-    if( is_named )
-    {
+    if (is_named) {
         /* In a named bit string, all trailing 0 bits are removed. */
-        while( byte_length > 0 && masked_bitstring[byte_length - 1] == 0 )
+        while (byte_length > 0 && masked_bitstring[byte_length - 1] == 0) {
             --byte_length;
+        }
         value_bits = 8 * byte_length;
-        if( byte_length > 0 )
-        {
+        if (byte_length > 0) {
             unsigned char last_byte = masked_bitstring[byte_length - 1];
-            for( unsigned b = 1; b < 0xff && ( last_byte & b ) == 0; b <<= 1 )
+            for (unsigned b = 1; b < 0xff && (last_byte & b) == 0; b <<= 1) {
                 --value_bits;
+            }
         }
     }
 #endif /* MBEDTLS_ASN1_PARSE_C */
 
-    for( data.size = 0; data.size <= expected->len + 1; data.size++ )
-    {
-        if( ! generic_write_start_step( &data ) )
+    for (data.size = 0; data.size <= expected->len + 1; data.size++) {
+        if (!generic_write_start_step(&data)) {
             goto exit;
-        ret = ( *func )( &data.p, data.start, bitstring->x, bits );
-        if( ! generic_write_finish_step( &data, expected, ret ) )
+        }
+        ret = (*func)(&data.p, data.start, bitstring->x, bits);
+        if (!generic_write_finish_step(&data, expected, ret)) {
             goto exit;
+        }
 #if defined(MBEDTLS_ASN1_PARSE_C)
-        if( ret >= 0 )
-        {
-            mbedtls_asn1_bitstring read = {0, 0, NULL};
-            TEST_EQUAL( mbedtls_asn1_get_bitstring( &data.p, data.end,
-                                                    &read ), 0 );
-            ASSERT_COMPARE( read.p, read.len,
-                            masked_bitstring, byte_length );
-            TEST_EQUAL( read.unused_bits, 8 * byte_length - value_bits );
+        if (ret >= 0) {
+            mbedtls_asn1_bitstring read = { 0, 0, NULL };
+            TEST_EQUAL(mbedtls_asn1_get_bitstring(&data.p, data.end,
+                                                  &read), 0);
+            ASSERT_COMPARE(read.p, read.len,
+                           masked_bitstring, byte_length);
+            TEST_EQUAL(read.unused_bits, 8 * byte_length - value_bits);
         }
 #endif /* MBEDTLS_ASN1_PARSE_C */
     }
 
 exit:
-    mbedtls_free( data.output );
+    mbedtls_free(data.output);
 #if defined(MBEDTLS_ASN1_PARSE_C)
-    mbedtls_free( masked_bitstring );
+    mbedtls_free(masked_bitstring);
 #endif /* MBEDTLS_ASN1_PARSE_C */
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void store_named_data_find( data_t *oid0, data_t *oid1,
-                            data_t *oid2, data_t *oid3,
-                            data_t *needle, int from, int position )
+void store_named_data_find(data_t *oid0, data_t *oid1,
+                           data_t *oid2, data_t *oid3,
+                           data_t *needle, int from, int position)
 {
-    data_t *oid[4] = {oid0, oid1, oid2, oid3};
-    mbedtls_asn1_named_data nd[] ={
-        { {0x06, 0, NULL}, {0, 0, NULL}, NULL, 0 },
-        { {0x06, 0, NULL}, {0, 0, NULL}, NULL, 0 },
-        { {0x06, 0, NULL}, {0, 0, NULL}, NULL, 0 },
-        { {0x06, 0, NULL}, {0, 0, NULL}, NULL, 0 },
+    data_t *oid[4] = { oid0, oid1, oid2, oid3 };
+    mbedtls_asn1_named_data nd[] = {
+        { { 0x06, 0, NULL }, { 0, 0, NULL }, NULL, 0 },
+        { { 0x06, 0, NULL }, { 0, 0, NULL }, NULL, 0 },
+        { { 0x06, 0, NULL }, { 0, 0, NULL }, NULL, 0 },
+        { { 0x06, 0, NULL }, { 0, 0, NULL }, NULL, 0 },
     };
-    mbedtls_asn1_named_data *pointers[ARRAY_LENGTH( nd ) + 1];
+    mbedtls_asn1_named_data *pointers[ARRAY_LENGTH(nd) + 1];
     size_t i;
     mbedtls_asn1_named_data *head = NULL;
     mbedtls_asn1_named_data *found = NULL;
 
-    for( i = 0; i < ARRAY_LENGTH( nd ); i++ )
+    for (i = 0; i < ARRAY_LENGTH(nd); i++) {
         pointers[i] = &nd[i];
-    pointers[ARRAY_LENGTH( nd )] = NULL;
-    for( i = 0; i < ARRAY_LENGTH( nd ); i++ )
-    {
-        ASSERT_ALLOC( nd[i].oid.p, oid[i]->len );
-        memcpy( nd[i].oid.p, oid[i]->x, oid[i]->len );
+    }
+    pointers[ARRAY_LENGTH(nd)] = NULL;
+    for (i = 0; i < ARRAY_LENGTH(nd); i++) {
+        ASSERT_ALLOC(nd[i].oid.p, oid[i]->len);
+        memcpy(nd[i].oid.p, oid[i]->x, oid[i]->len);
         nd[i].oid.len = oid[i]->len;
         nd[i].next = pointers[i+1];
     }
 
     head = pointers[from];
-    found = mbedtls_asn1_store_named_data( &head,
-                                           (const char *) needle->x,
-                                           needle->len,
-                                           NULL, 0 );
+    found = mbedtls_asn1_store_named_data(&head,
+                                          (const char *) needle->x,
+                                          needle->len,
+                                          NULL, 0);
 
     /* In any case, the existing list structure must be unchanged. */
-    for( i = 0; i < ARRAY_LENGTH( nd ); i++ )
-        TEST_ASSERT( nd[i].next == pointers[i+1] );
-
-    if( position >= 0 )
-    {
-        /* position should have been found and modified. */
-        TEST_ASSERT( head == pointers[from] );
-        TEST_ASSERT( found == pointers[position] );
+    for (i = 0; i < ARRAY_LENGTH(nd); i++) {
+        TEST_ASSERT(nd[i].next == pointers[i+1]);
     }
-    else
-    {
+
+    if (position >= 0) {
+        /* position should have been found and modified. */
+        TEST_ASSERT(head == pointers[from]);
+        TEST_ASSERT(found == pointers[position]);
+    } else {
         /* A new entry should have been created. */
-        TEST_ASSERT( found == head );
-        TEST_ASSERT( head->next == pointers[from] );
-        for( i = 0; i < ARRAY_LENGTH( nd ); i++ )
-            TEST_ASSERT( found != &nd[i] );
+        TEST_ASSERT(found == head);
+        TEST_ASSERT(head->next == pointers[from]);
+        for (i = 0; i < ARRAY_LENGTH(nd); i++) {
+            TEST_ASSERT(found != &nd[i]);
+        }
     }
 
 exit:
-    if( found != NULL && found == head && found != pointers[from] )
-    {
-        mbedtls_free( found->oid.p );
-        mbedtls_free( found );
+    if (found != NULL && found == head && found != pointers[from]) {
+        mbedtls_free(found->oid.p);
+        mbedtls_free(found);
     }
-    for( i = 0; i < ARRAY_LENGTH( nd ); i++ )
-        mbedtls_free( nd[i].oid.p );
+    for (i = 0; i < ARRAY_LENGTH(nd); i++) {
+        mbedtls_free(nd[i].oid.p);
+    }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void store_named_data_val_found( int old_len, int new_len )
+void store_named_data_val_found(int old_len, int new_len)
 {
     mbedtls_asn1_named_data nd =
-        { {0x06, 3, (unsigned char *) "OID"}, {0, 0, NULL}, NULL, 0 };
+    { { 0x06, 3, (unsigned char *) "OID" }, { 0, 0, NULL }, NULL, 0 };
     mbedtls_asn1_named_data *head = &nd;
     mbedtls_asn1_named_data *found = NULL;
     unsigned char *old_val = NULL;
     unsigned char *new_val = (unsigned char *) "new value";
 
-    if( old_len != 0 )
-    {
-        ASSERT_ALLOC( nd.val.p, (size_t) old_len );
+    if (old_len != 0) {
+        ASSERT_ALLOC(nd.val.p, (size_t) old_len);
         old_val = nd.val.p;
         nd.val.len = old_len;
-        memset( old_val, 'x', old_len );
+        memset(old_val, 'x', old_len);
     }
-    if( new_len <= 0 )
-    {
-        new_len = - new_len;
+    if (new_len <= 0) {
+        new_len = -new_len;
         new_val = NULL;
     }
 
-    found = mbedtls_asn1_store_named_data( &head, "OID", 3,
-                                           new_val, new_len );
-    TEST_ASSERT( head == &nd );
-    TEST_ASSERT( found == head );
+    found = mbedtls_asn1_store_named_data(&head, "OID", 3,
+                                          new_val, new_len);
+    TEST_ASSERT(head == &nd);
+    TEST_ASSERT(found == head);
 
-    if( new_val != NULL)
-        ASSERT_COMPARE( found->val.p, found->val.len,
-                        new_val, (size_t) new_len );
-    if( new_len == 0)
-        TEST_ASSERT( found->val.p == NULL );
-    else if( new_len == old_len )
-        TEST_ASSERT( found->val.p == old_val );
-    else
-        TEST_ASSERT( found->val.p != old_val );
+    if (new_val != NULL) {
+        ASSERT_COMPARE(found->val.p, found->val.len,
+                       new_val, (size_t) new_len);
+    }
+    if (new_len == 0) {
+        TEST_ASSERT(found->val.p == NULL);
+    } else if (new_len == old_len) {
+        TEST_ASSERT(found->val.p == old_val);
+    } else {
+        TEST_ASSERT(found->val.p != old_val);
+    }
 
 exit:
-    mbedtls_free( nd.val.p );
+    mbedtls_free(nd.val.p);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void store_named_data_val_new( int new_len, int set_new_val )
+void store_named_data_val_new(int new_len, int set_new_val)
 {
     mbedtls_asn1_named_data *head = NULL;
     mbedtls_asn1_named_data *found = NULL;
     const unsigned char *oid = (unsigned char *) "OID";
-    size_t oid_len = strlen( (const char *) oid );
+    size_t oid_len = strlen((const char *) oid);
     const unsigned char *new_val = (unsigned char *) "new value";
 
-    if( set_new_val == 0 )
+    if (set_new_val == 0) {
         new_val = NULL;
+    }
 
-    found = mbedtls_asn1_store_named_data( &head,
-                                           (const char *) oid, oid_len,
-                                           new_val, (size_t) new_len );
-    TEST_ASSERT( found != NULL );
-    TEST_ASSERT( found == head );
-    TEST_ASSERT( found->oid.p != oid );
-    ASSERT_COMPARE( found->oid.p, found->oid.len, oid, oid_len );
-    if( new_len == 0 )
-        TEST_ASSERT( found->val.p == NULL );
-    else if( new_val == NULL )
-        TEST_ASSERT( found->val.p != NULL );
-    else
-    {
-        TEST_ASSERT( found->val.p != new_val );
-        ASSERT_COMPARE( found->val.p, found->val.len,
-                        new_val, (size_t) new_len );
+    found = mbedtls_asn1_store_named_data(&head,
+                                          (const char *) oid, oid_len,
+                                          new_val, (size_t) new_len);
+    TEST_ASSERT(found != NULL);
+    TEST_ASSERT(found == head);
+    TEST_ASSERT(found->oid.p != oid);
+    ASSERT_COMPARE(found->oid.p, found->oid.len, oid, oid_len);
+    if (new_len == 0) {
+        TEST_ASSERT(found->val.p == NULL);
+    } else if (new_val == NULL) {
+        TEST_ASSERT(found->val.p != NULL);
+    } else {
+        TEST_ASSERT(found->val.p != new_val);
+        ASSERT_COMPARE(found->val.p, found->val.len,
+                       new_val, (size_t) new_len);
     }
 
 exit:
-    if( found != NULL )
-    {
-        mbedtls_free( found->oid.p );
-        mbedtls_free( found->val.p );
+    if (found != NULL) {
+        mbedtls_free(found->oid.p);
+        mbedtls_free(found->val.p);
     }
-    mbedtls_free( found );
+    mbedtls_free(found);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_base64.function b/tests/suites/test_suite_base64.function
index 7baa3d5..ce6bd42 100644
--- a/tests/suites/test_suite_base64.function
+++ b/tests/suites/test_suite_base64.function
@@ -17,67 +17,66 @@
  */
 
 /* BEGIN_CASE depends_on:MBEDTLS_TEST_HOOKS */
-void mask_of_range( int low_arg, int high_arg )
+void mask_of_range(int low_arg, int high_arg)
 {
     unsigned char low = low_arg, high = high_arg;
     unsigned c;
-    for( c = 0; c <= 0xff; c++ )
-    {
-        mbedtls_test_set_step( c );
-        TEST_CF_SECRET( &c, sizeof( c ) );
-        unsigned char m = mbedtls_ct_uchar_mask_of_range( low, high, c );
-        TEST_CF_PUBLIC( &c, sizeof( c ) );
-        TEST_CF_PUBLIC( &m, sizeof( m ) );
-        if( low <= c && c <= high )
-            TEST_EQUAL( m, 0xff );
-        else
-            TEST_EQUAL( m, 0 );
+    for (c = 0; c <= 0xff; c++) {
+        mbedtls_test_set_step(c);
+        TEST_CF_SECRET(&c, sizeof(c));
+        unsigned char m = mbedtls_ct_uchar_mask_of_range(low, high, c);
+        TEST_CF_PUBLIC(&c, sizeof(c));
+        TEST_CF_PUBLIC(&m, sizeof(m));
+        if (low <= c && c <= high) {
+            TEST_EQUAL(m, 0xff);
+        } else {
+            TEST_EQUAL(m, 0);
+        }
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_TEST_HOOKS */
-void enc_chars( )
+void enc_chars()
 {
-    for( unsigned value = 0; value < 64; value++ )
-    {
-        mbedtls_test_set_step( value );
-        TEST_CF_SECRET( &value, sizeof( value ) );
-        unsigned char digit = mbedtls_ct_base64_enc_char( value );
-        TEST_CF_PUBLIC( &value, sizeof( value ) );
-        TEST_CF_PUBLIC( &digit, sizeof( digit ) );
-        TEST_EQUAL( digit, base64_digits[value] );
+    for (unsigned value = 0; value < 64; value++) {
+        mbedtls_test_set_step(value);
+        TEST_CF_SECRET(&value, sizeof(value));
+        unsigned char digit = mbedtls_ct_base64_enc_char(value);
+        TEST_CF_PUBLIC(&value, sizeof(value));
+        TEST_CF_PUBLIC(&digit, sizeof(digit));
+        TEST_EQUAL(digit, base64_digits[value]);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_TEST_HOOKS */
-void dec_chars( )
+void dec_chars()
 {
     char *p;
     signed char expected;
 
-    for( unsigned c = 0; c <= 0xff; c++ )
-    {
-        mbedtls_test_set_step( c );
+    for (unsigned c = 0; c <= 0xff; c++) {
+        mbedtls_test_set_step(c);
         /* base64_digits is 0-terminated. sizeof()-1 excludes the trailing 0. */
-        p = memchr( base64_digits, c, sizeof( base64_digits ) - 1 );
-        if( p == NULL )
+        p = memchr(base64_digits, c, sizeof(base64_digits) - 1);
+        if (p == NULL) {
             expected = -1;
-        else
+        } else {
             expected = p - base64_digits;
-        TEST_CF_SECRET( &c, sizeof( c ) );
-        signed char actual = mbedtls_ct_base64_dec_value( c );
-        TEST_CF_PUBLIC( &c, sizeof( c ) );
-        TEST_CF_PUBLIC( &actual, sizeof( actual ) );
-        TEST_EQUAL( actual, expected );
+        }
+        TEST_CF_SECRET(&c, sizeof(c));
+        signed char actual = mbedtls_ct_base64_dec_value(c);
+        TEST_CF_PUBLIC(&c, sizeof(c));
+        TEST_CF_PUBLIC(&actual, sizeof(actual));
+        TEST_EQUAL(actual, expected);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_base64_encode( char * src_string, char * dst_string,
-                            int dst_buf_size, int result )
+void mbedtls_base64_encode(char *src_string, char *dst_string,
+                           int dst_buf_size, int result)
 {
     unsigned char src_str[1000];
     unsigned char dst_str[1000];
@@ -86,26 +85,25 @@
     memset(src_str, 0x00, 1000);
     memset(dst_str, 0x00, 1000);
 
-    strncpy( (char *) src_str, src_string, sizeof(src_str) - 1 );
-    src_len = strlen( (char *) src_str );
+    strncpy((char *) src_str, src_string, sizeof(src_str) - 1);
+    src_len = strlen((char *) src_str);
 
-    TEST_CF_SECRET( src_str, sizeof( src_str ) );
-    TEST_ASSERT( mbedtls_base64_encode( dst_str, dst_buf_size, &len, src_str, src_len) == result );
-    TEST_CF_PUBLIC( src_str, sizeof( src_str ) );
+    TEST_CF_SECRET(src_str, sizeof(src_str));
+    TEST_ASSERT(mbedtls_base64_encode(dst_str, dst_buf_size, &len, src_str, src_len) == result);
+    TEST_CF_PUBLIC(src_str, sizeof(src_str));
 
     /* dest_str will have had tainted data copied to it, prevent the TEST_ASSERT below from triggering
        CF failures by unmarking it. */
-    TEST_CF_PUBLIC( dst_str, len );
+    TEST_CF_PUBLIC(dst_str, len);
 
-    if( result == 0 )
-    {
-        TEST_ASSERT( strcmp( (char *) dst_str, dst_string ) == 0 );
+    if (result == 0) {
+        TEST_ASSERT(strcmp((char *) dst_str, dst_string) == 0);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_base64_decode( char * src_string, char * dst_string, int result )
+void mbedtls_base64_decode(char *src_string, char *dst_string, int result)
 {
     unsigned char src_str[1000];
     unsigned char dst_str[1000];
@@ -115,77 +113,73 @@
     memset(src_str, 0x00, 1000);
     memset(dst_str, 0x00, 1000);
 
-    strncpy( (char *) src_str, src_string, sizeof(src_str) - 1 );
-    res = mbedtls_base64_decode( dst_str, sizeof( dst_str ), &len, src_str, strlen( (char *) src_str ) );
-    TEST_ASSERT( res == result );
-    if( result == 0 )
-    {
-        TEST_ASSERT( strcmp( (char *) dst_str, dst_string ) == 0 );
+    strncpy((char *) src_str, src_string, sizeof(src_str) - 1);
+    res = mbedtls_base64_decode(dst_str, sizeof(dst_str), &len, src_str, strlen((char *) src_str));
+    TEST_ASSERT(res == result);
+    if (result == 0) {
+        TEST_ASSERT(strcmp((char *) dst_str, dst_string) == 0);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void base64_encode_hex( data_t * src, char * dst, int dst_buf_size,
-                        int result )
+void base64_encode_hex(data_t *src, char *dst, int dst_buf_size,
+                       int result)
 {
     unsigned char *res = NULL;
     size_t len;
 
-    res = mbedtls_test_zero_alloc( dst_buf_size );
+    res = mbedtls_test_zero_alloc(dst_buf_size);
 
-    TEST_CF_SECRET( src->x, src->len );
-    TEST_ASSERT( mbedtls_base64_encode( res, dst_buf_size, &len, src->x, src->len ) == result );
-    TEST_CF_PUBLIC( src->x, src->len );
+    TEST_CF_SECRET(src->x, src->len);
+    TEST_ASSERT(mbedtls_base64_encode(res, dst_buf_size, &len, src->x, src->len) == result);
+    TEST_CF_PUBLIC(src->x, src->len);
 
     /* res will have had tainted data copied to it, prevent the TEST_ASSERT below from triggering
        CF failures by unmarking it. */
-    TEST_CF_PUBLIC( res, len );
+    TEST_CF_PUBLIC(res, len);
 
-    if( result == 0 )
-    {
-        TEST_ASSERT( len == strlen( dst ) );
-        TEST_ASSERT( memcmp( dst, res, len ) == 0 );
+    if (result == 0) {
+        TEST_ASSERT(len == strlen(dst));
+        TEST_ASSERT(memcmp(dst, res, len) == 0);
     }
 
 exit:
-    mbedtls_free( res );
+    mbedtls_free(res);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void base64_decode_hex( char * src, data_t * dst, int dst_buf_size,
-                        int result )
+void base64_decode_hex(char *src, data_t *dst, int dst_buf_size,
+                       int result)
 {
     unsigned char *res = NULL;
     size_t len;
 
-    res = mbedtls_test_zero_alloc( dst_buf_size );
+    res = mbedtls_test_zero_alloc(dst_buf_size);
 
-    TEST_ASSERT( mbedtls_base64_decode( res, dst_buf_size, &len, (unsigned char *) src,
-                                strlen( src ) ) == result );
-    if( result == 0 )
-    {
-        TEST_ASSERT( len == dst->len );
-        TEST_ASSERT( memcmp( dst->x, res, len ) == 0 );
+    TEST_ASSERT(mbedtls_base64_decode(res, dst_buf_size, &len, (unsigned char *) src,
+                                      strlen(src)) == result);
+    if (result == 0) {
+        TEST_ASSERT(len == dst->len);
+        TEST_ASSERT(memcmp(dst->x, res, len) == 0);
     }
 
 exit:
-    mbedtls_free( res );
+    mbedtls_free(res);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void base64_decode_hex_src( data_t * src, char * dst_ref, int result )
+void base64_decode_hex_src(data_t *src, char *dst_ref, int result)
 {
     unsigned char dst[1000] = { 0 };
     size_t len;
 
-    TEST_ASSERT( mbedtls_base64_decode( dst, sizeof( dst ), &len, src->x, src->len ) == result );
-    if( result == 0 )
-    {
-        TEST_ASSERT( len == strlen( dst_ref ) );
-        TEST_ASSERT( memcmp( dst, dst_ref, len ) == 0 );
+    TEST_ASSERT(mbedtls_base64_decode(dst, sizeof(dst), &len, src->x, src->len) == result);
+    if (result == 0) {
+        TEST_ASSERT(len == strlen(dst_ref));
+        TEST_ASSERT(memcmp(dst, dst_ref, len) == 0);
     }
 
 exit:
@@ -194,8 +188,8 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void base64_selftest(  )
+void base64_selftest()
 {
-    TEST_ASSERT( mbedtls_base64_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_base64_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_bignum.function b/tests/suites/test_suite_bignum.function
index 35952f0..9afebba 100644
--- a/tests/suites/test_suite_bignum.function
+++ b/tests/suites/test_suite_bignum.function
@@ -9,28 +9,27 @@
 /* Check the validity of the sign bit in an MPI object. Reject representations
  * that are not supported by the rest of the library and indicate a bug when
  * constructing the value. */
-static int sign_is_valid( const mbedtls_mpi *X )
+static int sign_is_valid(const mbedtls_mpi *X)
 {
     /* Only +1 and -1 are valid sign bits, not e.g. 0 */
-    if( X->s != 1 && X->s != -1 )
-        return( 0 );
+    if (X->s != 1 && X->s != -1) {
+        return 0;
+    }
 
     /* The value 0 must be represented with the sign +1. A "negative zero"
      * with s=-1 is an invalid representation. Forbid that. As an exception,
      * we sometimes test the robustness of library functions when given
      * a negative zero input. If a test case has a negative zero as input,
      * we don't mind if the function has a negative zero output. */
-    if( ! mbedtls_test_case_uses_negative_0 &&
-        mbedtls_mpi_bitlen( X ) == 0 && X->s != 1 )
-    {
-        return( 0 );
+    if (!mbedtls_test_case_uses_negative_0 &&
+        mbedtls_mpi_bitlen(X) == 0 && X->s != 1) {
+        return 0;
     }
 
-    return( 1 );
+    return 1;
 }
 
-typedef struct mbedtls_test_mpi_random
-{
+typedef struct mbedtls_test_mpi_random {
     data_t *data;
     size_t  pos;
     size_t  chunk_len;
@@ -42,49 +41,49 @@
  * test) are stored in the data member of the state structure. Each number is in
  * the format that mbedtls_mpi_read_string understands and is chunk_len long.
  */
-int mbedtls_test_mpi_miller_rabin_determinizer( void* state,
-                                                unsigned char* buf,
-                                                size_t len )
+int mbedtls_test_mpi_miller_rabin_determinizer(void *state,
+                                               unsigned char *buf,
+                                               size_t len)
 {
-    mbedtls_test_mpi_random *random = (mbedtls_test_mpi_random*) state;
+    mbedtls_test_mpi_random *random = (mbedtls_test_mpi_random *) state;
 
-    if( random == NULL || random->data->x == NULL || buf == NULL )
-        return( -1 );
-
-    if( random->pos + random->chunk_len > random->data->len
-            || random->chunk_len > len )
-    {
-        return( -1 );
+    if (random == NULL || random->data->x == NULL || buf == NULL) {
+        return -1;
     }
 
-    memset( buf, 0, len );
+    if (random->pos + random->chunk_len > random->data->len
+        || random->chunk_len > len) {
+        return -1;
+    }
+
+    memset(buf, 0, len);
 
     /* The witness is written to the end of the buffer, since the buffer is
      * used as big endian, unsigned binary data in mbedtls_mpi_read_binary.
      * Writing the witness to the start of the buffer would result in the
      * buffer being 'witness 000...000', which would be treated as
      * witness * 2^n for some n. */
-    memcpy( buf + len - random->chunk_len, &random->data->x[random->pos],
-            random->chunk_len );
+    memcpy(buf + len - random->chunk_len, &random->data->x[random->pos],
+           random->chunk_len);
 
     random->pos += random->chunk_len;
 
-    return( 0 );
+    return 0;
 }
 
 /* Random generator that is told how many bytes to return. */
-static int f_rng_bytes_left( void *state, unsigned char *buf, size_t len )
+static int f_rng_bytes_left(void *state, unsigned char *buf, size_t len)
 {
     size_t *bytes_left = state;
     size_t i;
-    for( i = 0; i < len; i++ )
-    {
-        if( *bytes_left == 0 )
-            return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
+    for (i = 0; i < len; i++) {
+        if (*bytes_left == 0) {
+            return MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
+        }
         buf[i] = *bytes_left & 0xff;
-        --( *bytes_left );
+        --(*bytes_left);
     }
-    return( 0 );
+    return 0;
 }
 
 /* Test whether bytes represents (in big-endian base 256) a number b that
@@ -98,37 +97,39 @@
  * number is above some threshold A. The threshold value is heuristic and
  * based on the needs of mpi_random_many().
  */
-static int is_significantly_above_a_power_of_2( data_t *bytes )
+static int is_significantly_above_a_power_of_2(data_t *bytes)
 {
     const uint8_t *p = bytes->x;
     size_t len = bytes->len;
     unsigned x;
 
     /* Skip leading null bytes */
-    while( len > 0 && p[0] == 0 )
-    {
+    while (len > 0 && p[0] == 0) {
         ++p;
         --len;
     }
     /* 0 is not significantly above a power of 2 */
-    if( len == 0 )
-        return( 0 );
+    if (len == 0) {
+        return 0;
+    }
     /* Extract the (up to) 2 most significant bytes */
-    if( len == 1 )
+    if (len == 1) {
         x = p[0];
-    else
-        x = ( p[0] << 8 ) | p[1];
+    } else {
+        x = (p[0] << 8) | p[1];
+    }
 
     /* Shift the most significant bit of x to position 8 and mask it out */
-    while( ( x & 0xfe00 ) != 0 )
+    while ((x & 0xfe00) != 0) {
         x >>= 1;
+    }
     x &= 0x00ff;
 
     /* At this point, x = floor((b - 2^n) / 2^(n-8)). b is significantly above
      * a power of 2 iff x is significantly above 0 compared to 2^8.
      * Testing x >= 2^4 amounts to picking A = 1/16 in the function
      * description above. */
-    return( x >= 0x10 );
+    return x >= 0x10;
 }
 
 /* END_HEADER */
@@ -139,14 +140,14 @@
  */
 
 /* BEGIN_CASE */
-void mpi_valid_param( )
+void mpi_valid_param()
 {
-    TEST_VALID_PARAM( mbedtls_mpi_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_mpi_free(NULL));
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void mpi_invalid_param( )
+void mpi_invalid_param()
 {
     mbedtls_mpi X;
     const char *s_in = "00101000101010";
@@ -156,197 +157,197 @@
     size_t olen;
     mbedtls_mpi_uint mpi_uint;
 
-    TEST_INVALID_PARAM( mbedtls_mpi_init( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_mpi_init(NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_grow( NULL, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_copy( NULL, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_copy( &X, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_grow(NULL, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_copy(NULL, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_copy(&X, NULL));
 
-    TEST_INVALID_PARAM( mbedtls_mpi_swap( NULL, &X ) );
-    TEST_INVALID_PARAM( mbedtls_mpi_swap( &X, NULL ) );
+    TEST_INVALID_PARAM(mbedtls_mpi_swap(NULL, &X));
+    TEST_INVALID_PARAM(mbedtls_mpi_swap(&X, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_safe_cond_assign( NULL, &X, 0 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_safe_cond_assign( &X, NULL, 0 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_safe_cond_assign(NULL, &X, 0));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_safe_cond_assign(&X, NULL, 0));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_safe_cond_swap( NULL, &X, 0 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_safe_cond_swap( &X, NULL, 0 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_safe_cond_swap(NULL, &X, 0));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_safe_cond_swap(&X, NULL, 0));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_lset( NULL, 42 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_lset(NULL, 42));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_get_bit( NULL, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_set_bit( NULL, 42, 0 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_get_bit(NULL, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_set_bit(NULL, 42, 0));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_read_string( NULL, 2, s_in ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_read_string( &X, 2, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_read_string(NULL, 2, s_in));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_read_string(&X, 2, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_write_string( NULL, 2,
-                                                      s_out, sizeof( s_out ),
-                                                      &olen ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_write_string( &X, 2,
-                                                      NULL, sizeof( s_out ),
-                                                      &olen ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_write_string( &X, 2,
-                                                      s_out, sizeof( s_out ),
-                                                      NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_write_string(NULL, 2,
+                                                    s_out, sizeof(s_out),
+                                                    &olen));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_write_string(&X, 2,
+                                                    NULL, sizeof(s_out),
+                                                    &olen));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_write_string(&X, 2,
+                                                    s_out, sizeof(s_out),
+                                                    NULL));
 
 #if defined(MBEDTLS_FS_IO)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_read_file( NULL, 2, stdin ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_read_file( &X, 2, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_read_file(NULL, 2, stdin));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_read_file(&X, 2, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_write_file( "", NULL, 2, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_write_file("", NULL, 2, NULL));
 #endif /* MBEDTLS_FS_IO */
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_read_binary( NULL, u_in,
-                                                     sizeof( u_in ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_read_binary( &X, NULL,
-                                                     sizeof( u_in ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_read_binary(NULL, u_in,
+                                                   sizeof(u_in)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_read_binary(&X, NULL,
+                                                   sizeof(u_in)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_write_binary( NULL, u_out,
-                                                      sizeof( u_out ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_write_binary( &X, NULL,
-                                                      sizeof( u_out ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_write_binary(NULL, u_out,
+                                                    sizeof(u_out)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_write_binary(&X, NULL,
+                                                    sizeof(u_out)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_shift_l( NULL, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_shift_r( NULL, 42 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_shift_l(NULL, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_shift_r(NULL, 42));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_cmp_abs( NULL, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_cmp_abs( &X, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_cmp_abs(NULL, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_cmp_abs(&X, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_cmp_mpi( NULL, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_cmp_mpi( &X, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_cmp_mpi(NULL, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_cmp_mpi(&X, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_cmp_int( NULL, 42 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_cmp_int(NULL, 42));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_add_abs( NULL, &X, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_add_abs( &X, NULL, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_add_abs( &X, &X, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_add_abs(NULL, &X, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_add_abs(&X, NULL, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_add_abs(&X, &X, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_sub_abs( NULL, &X, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_sub_abs( &X, NULL, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_sub_abs( &X, &X, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_sub_abs(NULL, &X, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_sub_abs(&X, NULL, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_sub_abs(&X, &X, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_add_mpi( NULL, &X, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_add_mpi( &X, NULL, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_add_mpi( &X, &X, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_add_mpi(NULL, &X, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_add_mpi(&X, NULL, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_add_mpi(&X, &X, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_sub_mpi( NULL, &X, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_sub_mpi( &X, NULL, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_sub_mpi( &X, &X, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_sub_mpi(NULL, &X, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_sub_mpi(&X, NULL, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_sub_mpi(&X, &X, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_add_int( NULL, &X, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_add_int( &X, NULL, 42 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_add_int(NULL, &X, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_add_int(&X, NULL, 42));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_sub_int( NULL, &X, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_sub_int( &X, NULL, 42 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_sub_int(NULL, &X, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_sub_int(&X, NULL, 42));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_mul_mpi( NULL, &X, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_mul_mpi( &X, NULL, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_mul_mpi( &X, &X, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_mul_mpi(NULL, &X, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_mul_mpi(&X, NULL, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_mul_mpi(&X, &X, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_mul_int( NULL, &X, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_mul_int( &X, NULL, 42 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_mul_int(NULL, &X, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_mul_int(&X, NULL, 42));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_div_mpi( &X, &X, NULL, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_div_mpi( &X, &X, &X, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_div_mpi(&X, &X, NULL, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_div_mpi(&X, &X, &X, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_div_int( &X, &X, NULL, 42 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_div_int(&X, &X, NULL, 42));
 
-    TEST_INVALID_PARAM_RET( 0, mbedtls_mpi_lsb( NULL ) );
+    TEST_INVALID_PARAM_RET(0, mbedtls_mpi_lsb(NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_mod_mpi( NULL, &X, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_mod_mpi( &X, NULL, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_mod_mpi( &X, &X, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_mod_mpi(NULL, &X, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_mod_mpi(&X, NULL, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_mod_mpi(&X, &X, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_mod_int( NULL, &X, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_mod_int( &mpi_uint, NULL, 42 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_mod_int(NULL, &X, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_mod_int(&mpi_uint, NULL, 42));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_exp_mod( NULL, &X, &X, &X, NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_exp_mod( &X, NULL, &X, &X, NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_exp_mod( &X, &X, NULL, &X, NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_exp_mod( &X, &X, &X, NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_exp_mod(NULL, &X, &X, &X, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_exp_mod(&X, NULL, &X, &X, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_exp_mod(&X, &X, NULL, &X, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_exp_mod(&X, &X, &X, NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_fill_random( NULL, 42,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_fill_random( &X, 42, NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_fill_random(NULL, 42,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_fill_random(&X, 42, NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_gcd( NULL, &X, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_gcd( &X, NULL, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_gcd( &X, &X, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_gcd(NULL, &X, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_gcd(&X, NULL, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_gcd(&X, &X, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_inv_mod( NULL, &X, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_inv_mod( &X, NULL, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
-                            mbedtls_mpi_inv_mod( &X, &X, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_inv_mod(NULL, &X, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_inv_mod(&X, NULL, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_MPI_BAD_INPUT_DATA,
+                           mbedtls_mpi_inv_mod(&X, &X, NULL));
 
 exit:
     return;
@@ -354,158 +355,156 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mpi_null(  )
+void mpi_null()
 {
     mbedtls_mpi X, Y, Z;
 
-    mbedtls_mpi_init( &X );
-    mbedtls_mpi_init( &Y );
-    mbedtls_mpi_init( &Z );
+    mbedtls_mpi_init(&X);
+    mbedtls_mpi_init(&Y);
+    mbedtls_mpi_init(&Z);
 
-    TEST_ASSERT( mbedtls_mpi_get_bit( &X, 42 ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_lsb( &X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_bitlen( &X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_size( &X ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_get_bit(&X, 42) == 0);
+    TEST_ASSERT(mbedtls_mpi_lsb(&X) == 0);
+    TEST_ASSERT(mbedtls_mpi_bitlen(&X) == 0);
+    TEST_ASSERT(mbedtls_mpi_size(&X) == 0);
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mpi_read_write_string( int radix_X, char * input_X, int radix_A,
-                            char * input_A, int output_size, int result_read,
-                            int result_write )
+void mpi_read_write_string(int radix_X, char *input_X, int radix_A,
+                           char *input_A, int output_size, int result_read,
+                           int result_write)
 {
     mbedtls_mpi X;
     char str[1000];
     size_t len;
 
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
-    memset( str, '!', sizeof( str ) );
+    memset(str, '!', sizeof(str));
 
-    TEST_ASSERT( mbedtls_mpi_read_string( &X, radix_X, input_X ) == result_read );
-    if( result_read == 0 )
-    {
-        TEST_ASSERT( sign_is_valid( &X ) );
-        TEST_ASSERT( mbedtls_mpi_write_string( &X, radix_A, str, output_size, &len ) == result_write );
-        if( result_write == 0 )
-        {
-            TEST_ASSERT( strcasecmp( str, input_A ) == 0 );
-            TEST_ASSERT( str[len] == '!' );
+    TEST_ASSERT(mbedtls_mpi_read_string(&X, radix_X, input_X) == result_read);
+    if (result_read == 0) {
+        TEST_ASSERT(sign_is_valid(&X));
+        TEST_ASSERT(mbedtls_mpi_write_string(&X, radix_A, str, output_size, &len) == result_write);
+        if (result_write == 0) {
+            TEST_ASSERT(strcasecmp(str, input_A) == 0);
+            TEST_ASSERT(str[len] == '!');
         }
     }
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_read_binary( data_t * buf, char * input_A )
+void mbedtls_mpi_read_binary(data_t *buf, char *input_A)
 {
     mbedtls_mpi X;
     char str[1000];
     size_t len;
 
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
 
-    TEST_ASSERT( mbedtls_mpi_read_binary( &X, buf->x, buf->len ) == 0 );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    TEST_ASSERT( mbedtls_mpi_write_string( &X, 16, str, sizeof( str ), &len ) == 0 );
-    TEST_ASSERT( strcmp( (char *) str, input_A ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_read_binary(&X, buf->x, buf->len) == 0);
+    TEST_ASSERT(sign_is_valid(&X));
+    TEST_ASSERT(mbedtls_mpi_write_string(&X, 16, str, sizeof(str), &len) == 0);
+    TEST_ASSERT(strcmp((char *) str, input_A) == 0);
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_read_binary_le( data_t * buf, char * input_A )
+void mbedtls_mpi_read_binary_le(data_t *buf, char *input_A)
 {
     mbedtls_mpi X;
     char str[1000];
     size_t len;
 
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
 
-    TEST_ASSERT( mbedtls_mpi_read_binary_le( &X, buf->x, buf->len ) == 0 );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    TEST_ASSERT( mbedtls_mpi_write_string( &X, 16, str, sizeof( str ), &len ) == 0 );
-    TEST_ASSERT( strcmp( (char *) str, input_A ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_read_binary_le(&X, buf->x, buf->len) == 0);
+    TEST_ASSERT(sign_is_valid(&X));
+    TEST_ASSERT(mbedtls_mpi_write_string(&X, 16, str, sizeof(str), &len) == 0);
+    TEST_ASSERT(strcmp((char *) str, input_A) == 0);
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_write_binary( char * input_X, data_t * input_A,
-                               int output_size, int result )
+void mbedtls_mpi_write_binary(char *input_X, data_t *input_A,
+                              int output_size, int result)
 {
     mbedtls_mpi X;
     unsigned char buf[1000];
     size_t buflen;
 
-    memset( buf, 0x00, 1000 );
+    memset(buf, 0x00, 1000);
 
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
 
-    buflen = mbedtls_mpi_size( &X );
-    if( buflen > (size_t) output_size )
+    buflen = mbedtls_mpi_size(&X);
+    if (buflen > (size_t) output_size) {
         buflen = (size_t) output_size;
+    }
 
-    TEST_ASSERT( mbedtls_mpi_write_binary( &X, buf, buflen ) == result );
-    if( result == 0)
-    {
+    TEST_ASSERT(mbedtls_mpi_write_binary(&X, buf, buflen) == result);
+    if (result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( buf, input_A->x,
-                                          buflen, input_A->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(buf, input_A->x,
+                                        buflen, input_A->len) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_write_binary_le( char * input_X, data_t * input_A,
-                                  int output_size, int result )
+void mbedtls_mpi_write_binary_le(char *input_X, data_t *input_A,
+                                 int output_size, int result)
 {
     mbedtls_mpi X;
     unsigned char buf[1000];
     size_t buflen;
 
-    memset( buf, 0x00, 1000 );
+    memset(buf, 0x00, 1000);
 
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
 
-    buflen = mbedtls_mpi_size( &X );
-    if( buflen > (size_t) output_size )
+    buflen = mbedtls_mpi_size(&X);
+    if (buflen > (size_t) output_size) {
         buflen = (size_t) output_size;
+    }
 
-    TEST_ASSERT( mbedtls_mpi_write_binary_le( &X, buf, buflen ) == result );
-    if( result == 0)
-    {
+    TEST_ASSERT(mbedtls_mpi_write_binary_le(&X, buf, buflen) == result);
+    if (result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( buf, input_A->x,
-                                          buflen, input_A->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(buf, input_A->x,
+                                        buflen, input_A->len) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO */
-void mbedtls_mpi_read_file( char * input_file, data_t * input_A, int result )
+void mbedtls_mpi_read_file(char *input_file, data_t *input_A, int result)
 {
     mbedtls_mpi X;
     unsigned char buf[1000];
@@ -513,678 +512,677 @@
     FILE *file;
     int ret;
 
-    memset( buf, 0x00, 1000 );
+    memset(buf, 0x00, 1000);
 
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
-    file = fopen( input_file, "r" );
-    TEST_ASSERT( file != NULL );
-    ret = mbedtls_mpi_read_file( &X, 16, file );
+    file = fopen(input_file, "r");
+    TEST_ASSERT(file != NULL);
+    ret = mbedtls_mpi_read_file(&X, 16, file);
     fclose(file);
-    TEST_ASSERT( ret == result );
+    TEST_ASSERT(ret == result);
 
-    if( result == 0 )
-    {
-        TEST_ASSERT( sign_is_valid( &X ) );
-        buflen = mbedtls_mpi_size( &X );
-        TEST_ASSERT( mbedtls_mpi_write_binary( &X, buf, buflen ) == 0 );
+    if (result == 0) {
+        TEST_ASSERT(sign_is_valid(&X));
+        buflen = mbedtls_mpi_size(&X);
+        TEST_ASSERT(mbedtls_mpi_write_binary(&X, buf, buflen) == 0);
 
 
-        TEST_ASSERT( mbedtls_test_hexcmp( buf, input_A->x,
-                                          buflen, input_A->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(buf, input_A->x,
+                                        buflen, input_A->len) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO */
-void mbedtls_mpi_write_file( char * input_X, char * output_file )
+void mbedtls_mpi_write_file(char *input_X, char *output_file)
 {
     mbedtls_mpi X, Y;
     FILE *file_out, *file_in;
     int ret;
 
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
 
-    file_out = fopen( output_file, "w" );
-    TEST_ASSERT( file_out != NULL );
-    ret = mbedtls_mpi_write_file( NULL, &X, 16, file_out );
+    file_out = fopen(output_file, "w");
+    TEST_ASSERT(file_out != NULL);
+    ret = mbedtls_mpi_write_file(NULL, &X, 16, file_out);
     fclose(file_out);
-    TEST_ASSERT( ret == 0 );
+    TEST_ASSERT(ret == 0);
 
-    file_in = fopen( output_file, "r" );
-    TEST_ASSERT( file_in != NULL );
-    ret = mbedtls_mpi_read_file( &Y, 16, file_in );
+    file_in = fopen(output_file, "r");
+    TEST_ASSERT(file_in != NULL);
+    ret = mbedtls_mpi_read_file(&Y, 16, file_in);
     fclose(file_in);
-    TEST_ASSERT( ret == 0 );
+    TEST_ASSERT(ret == 0);
 
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &Y ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &Y) == 0);
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_get_bit( char * input_X, int pos, int val )
+void mbedtls_mpi_get_bit(char *input_X, int pos, int val)
 {
     mbedtls_mpi X;
-    mbedtls_mpi_init( &X );
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_get_bit( &X, pos ) == val );
+    mbedtls_mpi_init(&X);
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_mpi_get_bit(&X, pos) == val);
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_set_bit( char * input_X, int pos, int val,
-                          char * output_Y, int result )
+void mbedtls_mpi_set_bit(char *input_X, int pos, int val,
+                         char *output_Y, int result)
 {
     mbedtls_mpi X, Y;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, output_Y ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_set_bit( &X, pos, val ) == result );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, output_Y) == 0);
+    TEST_ASSERT(mbedtls_mpi_set_bit(&X, pos, val) == result);
 
-    if( result == 0 )
-    {
-        TEST_ASSERT( sign_is_valid( &X ) );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &Y ) == 0 );
+    if (result == 0) {
+        TEST_ASSERT(sign_is_valid(&X));
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &Y) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_lsb( char * input_X, int nr_bits )
+void mbedtls_mpi_lsb(char *input_X, int nr_bits)
 {
     mbedtls_mpi X;
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_lsb( &X ) == (size_t) nr_bits );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_mpi_lsb(&X) == (size_t) nr_bits);
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_bitlen( char * input_X, int nr_bits )
+void mbedtls_mpi_bitlen(char *input_X, int nr_bits)
 {
     mbedtls_mpi X;
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_bitlen( &X ) == (size_t) nr_bits );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_mpi_bitlen(&X) == (size_t) nr_bits);
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_gcd( char * input_X, char * input_Y,
-                      char * input_A )
+void mbedtls_mpi_gcd(char *input_X, char *input_Y,
+                     char *input_A)
 {
     mbedtls_mpi A, X, Y, Z;
-    mbedtls_mpi_init( &A ); mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Z );
+    mbedtls_mpi_init(&A); mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y); mbedtls_mpi_init(&Z);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_gcd( &Z, &X, &Y ) == 0 );
-    TEST_ASSERT( sign_is_valid( &Z ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Z, &A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    TEST_ASSERT(mbedtls_mpi_gcd(&Z, &X, &Y) == 0);
+    TEST_ASSERT(sign_is_valid(&Z));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Z, &A) == 0);
 
 exit:
-    mbedtls_mpi_free( &A ); mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y ); mbedtls_mpi_free( &Z );
+    mbedtls_mpi_free(&A); mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y); mbedtls_mpi_free(&Z);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_cmp_int( int input_X, int input_A, int result_CMP )
+void mbedtls_mpi_cmp_int(int input_X, int input_A, int result_CMP)
 {
     mbedtls_mpi X;
-    mbedtls_mpi_init( &X  );
+    mbedtls_mpi_init(&X);
 
-    TEST_ASSERT( mbedtls_mpi_lset( &X, input_X ) == 0);
-    TEST_ASSERT( mbedtls_mpi_cmp_int( &X, input_A ) == result_CMP);
+    TEST_ASSERT(mbedtls_mpi_lset(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_int(&X, input_A) == result_CMP);
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_cmp_mpi( char * input_X, char * input_Y,
-                          int input_A )
+void mbedtls_mpi_cmp_mpi(char *input_X, char *input_Y,
+                         int input_A)
 {
     mbedtls_mpi X, Y;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &Y ) == input_A );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &Y) == input_A);
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_lt_mpi_ct( int size_X, char * input_X,
-                            int size_Y, char * input_Y,
-                            int input_ret, int input_err )
+void mbedtls_mpi_lt_mpi_ct(int size_X, char *input_X,
+                           int size_Y, char *input_Y,
+                           int input_ret, int input_err)
 {
     unsigned ret = -1;
     unsigned input_uret = input_ret;
     mbedtls_mpi X, Y;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, input_Y ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, input_Y) == 0);
 
-    TEST_ASSERT( mbedtls_mpi_grow( &X, size_X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_grow( &Y, size_Y ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_grow(&X, size_X) == 0);
+    TEST_ASSERT(mbedtls_mpi_grow(&Y, size_Y) == 0);
 
-    TEST_ASSERT( mbedtls_mpi_lt_mpi_ct( &X, &Y, &ret ) == input_err );
-    if( input_err == 0 )
-        TEST_ASSERT( ret == input_uret );
+    TEST_ASSERT(mbedtls_mpi_lt_mpi_ct(&X, &Y, &ret) == input_err);
+    if (input_err == 0) {
+        TEST_ASSERT(ret == input_uret);
+    }
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_cmp_abs( char * input_X, char * input_Y,
-                          int input_A )
+void mbedtls_mpi_cmp_abs(char *input_X, char *input_Y,
+                         int input_A)
 {
     mbedtls_mpi X, Y;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_abs( &X, &Y ) == input_A );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_abs(&X, &Y) == input_A);
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_copy( char *src_hex, char *dst_hex )
+void mbedtls_mpi_copy(char *src_hex, char *dst_hex)
 {
     mbedtls_mpi src, dst, ref;
-    mbedtls_mpi_init( &src );
-    mbedtls_mpi_init( &dst );
-    mbedtls_mpi_init( &ref );
+    mbedtls_mpi_init(&src);
+    mbedtls_mpi_init(&dst);
+    mbedtls_mpi_init(&ref);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &src, src_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &ref, dst_hex ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&src, src_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&ref, dst_hex) == 0);
 
     /* mbedtls_mpi_copy() */
-    TEST_ASSERT( mbedtls_test_read_mpi( &dst, dst_hex ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_copy( &dst, &src ) == 0 );
-    TEST_ASSERT( sign_is_valid( &dst ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &dst, &src ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&dst, dst_hex) == 0);
+    TEST_ASSERT(mbedtls_mpi_copy(&dst, &src) == 0);
+    TEST_ASSERT(sign_is_valid(&dst));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&dst, &src) == 0);
 
     /* mbedtls_mpi_safe_cond_assign(), assignment done */
-    mbedtls_mpi_free( &dst );
-    TEST_ASSERT( mbedtls_test_read_mpi( &dst, dst_hex ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_safe_cond_assign( &dst, &src, 1 ) == 0 );
-    TEST_ASSERT( sign_is_valid( &dst ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &dst, &src ) == 0 );
+    mbedtls_mpi_free(&dst);
+    TEST_ASSERT(mbedtls_test_read_mpi(&dst, dst_hex) == 0);
+    TEST_ASSERT(mbedtls_mpi_safe_cond_assign(&dst, &src, 1) == 0);
+    TEST_ASSERT(sign_is_valid(&dst));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&dst, &src) == 0);
 
     /* mbedtls_mpi_safe_cond_assign(), assignment not done */
-    mbedtls_mpi_free( &dst );
-    TEST_ASSERT( mbedtls_test_read_mpi( &dst, dst_hex ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_safe_cond_assign( &dst, &src, 0 ) == 0 );
-    TEST_ASSERT( sign_is_valid( &dst ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &dst, &ref ) == 0 );
+    mbedtls_mpi_free(&dst);
+    TEST_ASSERT(mbedtls_test_read_mpi(&dst, dst_hex) == 0);
+    TEST_ASSERT(mbedtls_mpi_safe_cond_assign(&dst, &src, 0) == 0);
+    TEST_ASSERT(sign_is_valid(&dst));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&dst, &ref) == 0);
 
 exit:
-    mbedtls_mpi_free( &src );
-    mbedtls_mpi_free( &dst );
-    mbedtls_mpi_free( &ref );
+    mbedtls_mpi_free(&src);
+    mbedtls_mpi_free(&dst);
+    mbedtls_mpi_free(&ref);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mpi_copy_self( char *input_X )
+void mpi_copy_self(char *input_X)
 {
     mbedtls_mpi X, A;
-    mbedtls_mpi_init( &A );
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&A);
+    mbedtls_mpi_init(&X);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_copy( &X, &X ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_mpi_copy(&X, &X) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_X ) == 0 );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_X) == 0);
+    TEST_ASSERT(sign_is_valid(&X));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &A) == 0);
 
 exit:
-    mbedtls_mpi_free( &A );
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&A);
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_swap( char *X_hex, char *Y_hex )
+void mbedtls_mpi_swap(char *X_hex, char *Y_hex)
 {
     mbedtls_mpi X, Y, X0, Y0;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y );
-    mbedtls_mpi_init( &X0 ); mbedtls_mpi_init( &Y0 );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y);
+    mbedtls_mpi_init(&X0); mbedtls_mpi_init(&Y0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X0, X_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y0, Y_hex ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X0, X_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y0, Y_hex) == 0);
 
     /* mbedtls_mpi_swap() */
-    TEST_ASSERT( mbedtls_test_read_mpi( &X,  X_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y,  Y_hex ) == 0 );
-    mbedtls_mpi_swap( &X, &Y );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    TEST_ASSERT( sign_is_valid( &Y ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &Y0 ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Y, &X0 ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X,  X_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y,  Y_hex) == 0);
+    mbedtls_mpi_swap(&X, &Y);
+    TEST_ASSERT(sign_is_valid(&X));
+    TEST_ASSERT(sign_is_valid(&Y));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &Y0) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Y, &X0) == 0);
 
     /* mbedtls_mpi_safe_cond_swap(), swap done */
-    mbedtls_mpi_free( &X );
-    mbedtls_mpi_free( &Y );
-    TEST_ASSERT( mbedtls_test_read_mpi( &X,  X_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y,  Y_hex ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_safe_cond_swap( &X, &Y, 1 ) == 0 );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    TEST_ASSERT( sign_is_valid( &Y ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &Y0 ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Y, &X0 ) == 0 );
+    mbedtls_mpi_free(&X);
+    mbedtls_mpi_free(&Y);
+    TEST_ASSERT(mbedtls_test_read_mpi(&X,  X_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y,  Y_hex) == 0);
+    TEST_ASSERT(mbedtls_mpi_safe_cond_swap(&X, &Y, 1) == 0);
+    TEST_ASSERT(sign_is_valid(&X));
+    TEST_ASSERT(sign_is_valid(&Y));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &Y0) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Y, &X0) == 0);
 
     /* mbedtls_mpi_safe_cond_swap(), swap not done */
-    mbedtls_mpi_free( &X );
-    mbedtls_mpi_free( &Y );
-    TEST_ASSERT( mbedtls_test_read_mpi( &X,  X_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y,  Y_hex ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_safe_cond_swap( &X, &Y, 0 ) == 0 );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    TEST_ASSERT( sign_is_valid( &Y ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &X0 ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Y, &Y0 ) == 0 );
+    mbedtls_mpi_free(&X);
+    mbedtls_mpi_free(&Y);
+    TEST_ASSERT(mbedtls_test_read_mpi(&X,  X_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y,  Y_hex) == 0);
+    TEST_ASSERT(mbedtls_mpi_safe_cond_swap(&X, &Y, 0) == 0);
+    TEST_ASSERT(sign_is_valid(&X));
+    TEST_ASSERT(sign_is_valid(&Y));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &X0) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Y, &Y0) == 0);
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y );
-    mbedtls_mpi_free( &X0 ); mbedtls_mpi_free( &Y0 );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y);
+    mbedtls_mpi_free(&X0); mbedtls_mpi_free(&Y0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mpi_swap_self( char *X_hex )
+void mpi_swap_self(char *X_hex)
 {
     mbedtls_mpi X, X0;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &X0 );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&X0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X,  X_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &X0, X_hex ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X,  X_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&X0, X_hex) == 0);
 
-    mbedtls_mpi_swap( &X, &X );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &X0 ) == 0 );
+    mbedtls_mpi_swap(&X, &X);
+    TEST_ASSERT(sign_is_valid(&X));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &X0) == 0);
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &X0 );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&X0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_shrink( int before, int used, int min, int after )
+void mbedtls_mpi_shrink(int before, int used, int min, int after)
 {
     mbedtls_mpi X;
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
-    TEST_ASSERT( mbedtls_mpi_grow( &X, before ) == 0 );
-    if( used > 0 )
-    {
-        size_t used_bit_count = used * 8 * sizeof( mbedtls_mpi_uint );
-        TEST_ASSERT( mbedtls_mpi_set_bit( &X, used_bit_count - 1, 1 ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_grow(&X, before) == 0);
+    if (used > 0) {
+        size_t used_bit_count = used * 8 * sizeof(mbedtls_mpi_uint);
+        TEST_ASSERT(mbedtls_mpi_set_bit(&X, used_bit_count - 1, 1) == 0);
     }
-    TEST_EQUAL( X.n, (size_t) before );
-    TEST_ASSERT( mbedtls_mpi_shrink( &X, min ) == 0 );
-    TEST_EQUAL( X.n, (size_t) after );
+    TEST_EQUAL(X.n, (size_t) before);
+    TEST_ASSERT(mbedtls_mpi_shrink(&X, min) == 0);
+    TEST_EQUAL(X.n, (size_t) after);
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_add_mpi( char * input_X, char * input_Y,
-                          char * input_A )
+void mbedtls_mpi_add_mpi(char *input_X, char *input_Y,
+                         char *input_A)
 {
     mbedtls_mpi X, Y, Z, A;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &A );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y); mbedtls_mpi_init(&Z); mbedtls_mpi_init(&A);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_add_mpi( &Z, &X, &Y ) == 0 );
-    TEST_ASSERT( sign_is_valid( &Z ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Z, &A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    TEST_ASSERT(mbedtls_mpi_add_mpi(&Z, &X, &Y) == 0);
+    TEST_ASSERT(sign_is_valid(&Z));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Z, &A) == 0);
 
     /* result == first operand */
-    TEST_ASSERT( mbedtls_mpi_add_mpi( &X, &X, &Y ) == 0 );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &A ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_add_mpi(&X, &X, &Y) == 0);
+    TEST_ASSERT(sign_is_valid(&X));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &A) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
 
     /* result == second operand */
-    TEST_ASSERT( mbedtls_mpi_add_mpi( &Y, &X, &Y ) == 0 );
-    TEST_ASSERT( sign_is_valid( &Y ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Y, &A ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_add_mpi(&Y, &X, &Y) == 0);
+    TEST_ASSERT(sign_is_valid(&Y));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Y, &A) == 0);
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y ); mbedtls_mpi_free( &Z ); mbedtls_mpi_free( &A );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y); mbedtls_mpi_free(&Z); mbedtls_mpi_free(&A);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_add_mpi_inplace( char * input_X, char * input_A )
+void mbedtls_mpi_add_mpi_inplace(char *input_X, char *input_A)
 {
     mbedtls_mpi X, A;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &A );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&A);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_sub_abs( &X, &X, &X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_int( &X, 0 ) == 0 );
-    TEST_ASSERT( sign_is_valid( &X ) );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_mpi_sub_abs(&X, &X, &X) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_int(&X, 0) == 0);
+    TEST_ASSERT(sign_is_valid(&X));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_add_abs( &X, &X, &X ) == 0 );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_mpi_add_abs(&X, &X, &X) == 0);
+    TEST_ASSERT(sign_is_valid(&X));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &A) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_add_mpi( &X, &X, &X ) == 0 );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_mpi_add_mpi(&X, &X, &X) == 0);
+    TEST_ASSERT(sign_is_valid(&X));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &A) == 0);
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &A );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&A);
 }
 /* END_CASE */
 
 
 /* BEGIN_CASE */
-void mbedtls_mpi_add_abs( char * input_X, char * input_Y,
-                          char * input_A )
+void mbedtls_mpi_add_abs(char *input_X, char *input_Y,
+                         char *input_A)
 {
     mbedtls_mpi X, Y, Z, A;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &A );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y); mbedtls_mpi_init(&Z); mbedtls_mpi_init(&A);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_add_abs( &Z, &X, &Y ) == 0 );
-    TEST_ASSERT( sign_is_valid( &Z ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Z, &A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    TEST_ASSERT(mbedtls_mpi_add_abs(&Z, &X, &Y) == 0);
+    TEST_ASSERT(sign_is_valid(&Z));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Z, &A) == 0);
 
     /* result == first operand */
-    TEST_ASSERT( mbedtls_mpi_add_abs( &X, &X, &Y ) == 0 );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &A ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_add_abs(&X, &X, &Y) == 0);
+    TEST_ASSERT(sign_is_valid(&X));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &A) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
 
     /* result == second operand */
-    TEST_ASSERT( mbedtls_mpi_add_abs( &Y, &X, &Y ) == 0 );
-    TEST_ASSERT( sign_is_valid( &Y ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Y, &A ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_add_abs(&Y, &X, &Y) == 0);
+    TEST_ASSERT(sign_is_valid(&Y));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Y, &A) == 0);
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y ); mbedtls_mpi_free( &Z ); mbedtls_mpi_free( &A );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y); mbedtls_mpi_free(&Z); mbedtls_mpi_free(&A);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_add_int( char * input_X, int input_Y,
-                          char * input_A )
+void mbedtls_mpi_add_int(char *input_X, int input_Y,
+                         char *input_A)
 {
     mbedtls_mpi X, Z, A;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &A );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Z); mbedtls_mpi_init(&A);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_add_int( &Z, &X, input_Y ) == 0 );
-    TEST_ASSERT( sign_is_valid( &Z ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Z, &A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    TEST_ASSERT(mbedtls_mpi_add_int(&Z, &X, input_Y) == 0);
+    TEST_ASSERT(sign_is_valid(&Z));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Z, &A) == 0);
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Z ); mbedtls_mpi_free( &A );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Z); mbedtls_mpi_free(&A);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_sub_mpi( char * input_X, char * input_Y,
-                          char * input_A )
+void mbedtls_mpi_sub_mpi(char *input_X, char *input_Y,
+                         char *input_A)
 {
     mbedtls_mpi X, Y, Z, A;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &A );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y); mbedtls_mpi_init(&Z); mbedtls_mpi_init(&A);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_sub_mpi( &Z, &X, &Y ) == 0 );
-    TEST_ASSERT( sign_is_valid( &Z ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Z, &A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    TEST_ASSERT(mbedtls_mpi_sub_mpi(&Z, &X, &Y) == 0);
+    TEST_ASSERT(sign_is_valid(&Z));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Z, &A) == 0);
 
     /* result == first operand */
-    TEST_ASSERT( mbedtls_mpi_sub_mpi( &X, &X, &Y ) == 0 );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &A ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_sub_mpi(&X, &X, &Y) == 0);
+    TEST_ASSERT(sign_is_valid(&X));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &A) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
 
     /* result == second operand */
-    TEST_ASSERT( mbedtls_mpi_sub_mpi( &Y, &X, &Y ) == 0 );
-    TEST_ASSERT( sign_is_valid( &Y ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Y, &A ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_sub_mpi(&Y, &X, &Y) == 0);
+    TEST_ASSERT(sign_is_valid(&Y));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Y, &A) == 0);
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y ); mbedtls_mpi_free( &Z ); mbedtls_mpi_free( &A );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y); mbedtls_mpi_free(&Z); mbedtls_mpi_free(&A);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_sub_abs( char * input_X, char * input_Y,
-                          char * input_A, int sub_result )
+void mbedtls_mpi_sub_abs(char *input_X, char *input_Y,
+                         char *input_A, int sub_result)
 {
     mbedtls_mpi X, Y, Z, A;
     int res;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &A );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y); mbedtls_mpi_init(&Z); mbedtls_mpi_init(&A);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
 
-    res = mbedtls_mpi_sub_abs( &Z, &X, &Y );
-    TEST_ASSERT( res == sub_result );
-    TEST_ASSERT( sign_is_valid( &Z ) );
-    if( res == 0 )
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Z, &A ) == 0 );
+    res = mbedtls_mpi_sub_abs(&Z, &X, &Y);
+    TEST_ASSERT(res == sub_result);
+    TEST_ASSERT(sign_is_valid(&Z));
+    if (res == 0) {
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Z, &A) == 0);
+    }
 
     /* result == first operand */
-    TEST_ASSERT( mbedtls_mpi_sub_abs( &X, &X, &Y ) == sub_result );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    if( sub_result == 0 )
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &A ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_sub_abs(&X, &X, &Y) == sub_result);
+    TEST_ASSERT(sign_is_valid(&X));
+    if (sub_result == 0) {
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &A) == 0);
+    }
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
 
     /* result == second operand */
-    TEST_ASSERT( mbedtls_mpi_sub_abs( &Y, &X, &Y ) == sub_result );
-    TEST_ASSERT( sign_is_valid( &Y ) );
-    if( sub_result == 0 )
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Y, &A ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_sub_abs(&Y, &X, &Y) == sub_result);
+    TEST_ASSERT(sign_is_valid(&Y));
+    if (sub_result == 0) {
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Y, &A) == 0);
+    }
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y ); mbedtls_mpi_free( &Z ); mbedtls_mpi_free( &A );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y); mbedtls_mpi_free(&Z); mbedtls_mpi_free(&A);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_sub_int( char * input_X, int input_Y,
-                          char * input_A )
+void mbedtls_mpi_sub_int(char *input_X, int input_Y,
+                         char *input_A)
 {
     mbedtls_mpi X, Z, A;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &A );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Z); mbedtls_mpi_init(&A);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_sub_int( &Z, &X, input_Y ) == 0 );
-    TEST_ASSERT( sign_is_valid( &Z ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Z, &A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    TEST_ASSERT(mbedtls_mpi_sub_int(&Z, &X, input_Y) == 0);
+    TEST_ASSERT(sign_is_valid(&Z));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Z, &A) == 0);
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Z ); mbedtls_mpi_free( &A );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Z); mbedtls_mpi_free(&A);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_mul_mpi( char * input_X, char * input_Y,
-                          char * input_A )
+void mbedtls_mpi_mul_mpi(char *input_X, char *input_Y,
+                         char *input_A)
 {
     mbedtls_mpi X, Y, Z, A;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &A );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y); mbedtls_mpi_init(&Z); mbedtls_mpi_init(&A);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_mul_mpi( &Z, &X, &Y ) == 0 );
-    TEST_ASSERT( sign_is_valid( &Z ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Z, &A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    TEST_ASSERT(mbedtls_mpi_mul_mpi(&Z, &X, &Y) == 0);
+    TEST_ASSERT(sign_is_valid(&Z));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Z, &A) == 0);
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y ); mbedtls_mpi_free( &Z ); mbedtls_mpi_free( &A );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y); mbedtls_mpi_free(&Z); mbedtls_mpi_free(&A);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_mul_int( char * input_X, int input_Y,
-                          char * input_A, char * result_comparison )
+void mbedtls_mpi_mul_int(char *input_X, int input_Y,
+                         char *input_A, char *result_comparison)
 {
     mbedtls_mpi X, Z, A;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &A );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Z); mbedtls_mpi_init(&A);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_mul_int( &Z, &X, input_Y ) == 0 );
-    TEST_ASSERT( sign_is_valid( &Z ) );
-    if( strcmp( result_comparison, "==" ) == 0 )
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Z, &A ) == 0 );
-    else if( strcmp( result_comparison, "!=" ) == 0 )
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Z, &A ) != 0 );
-    else
-        TEST_ASSERT( "unknown operator" == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    TEST_ASSERT(mbedtls_mpi_mul_int(&Z, &X, input_Y) == 0);
+    TEST_ASSERT(sign_is_valid(&Z));
+    if (strcmp(result_comparison, "==") == 0) {
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Z, &A) == 0);
+    } else if (strcmp(result_comparison, "!=") == 0) {
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Z, &A) != 0);
+    } else {
+        TEST_ASSERT("unknown operator" == 0);
+    }
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Z ); mbedtls_mpi_free( &A );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Z); mbedtls_mpi_free(&A);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_div_mpi( char * input_X, char * input_Y,
-                          char * input_A, char * input_B,
-                          int div_result )
+void mbedtls_mpi_div_mpi(char *input_X, char *input_Y,
+                         char *input_A, char *input_B,
+                         int div_result)
 {
     mbedtls_mpi X, Y, Q, R, A, B;
     int res;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Q ); mbedtls_mpi_init( &R );
-    mbedtls_mpi_init( &A ); mbedtls_mpi_init( &B );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y); mbedtls_mpi_init(&Q); mbedtls_mpi_init(&R);
+    mbedtls_mpi_init(&A); mbedtls_mpi_init(&B);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &B, input_B ) == 0 );
-    res = mbedtls_mpi_div_mpi( &Q, &R, &X, &Y );
-    TEST_ASSERT( res == div_result );
-    if( res == 0 )
-    {
-        TEST_ASSERT( sign_is_valid( &Q ) );
-        TEST_ASSERT( sign_is_valid( &R ) );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Q, &A ) == 0 );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R, &B ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&B, input_B) == 0);
+    res = mbedtls_mpi_div_mpi(&Q, &R, &X, &Y);
+    TEST_ASSERT(res == div_result);
+    if (res == 0) {
+        TEST_ASSERT(sign_is_valid(&Q));
+        TEST_ASSERT(sign_is_valid(&R));
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Q, &A) == 0);
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R, &B) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y ); mbedtls_mpi_free( &Q ); mbedtls_mpi_free( &R );
-    mbedtls_mpi_free( &A ); mbedtls_mpi_free( &B );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y); mbedtls_mpi_free(&Q); mbedtls_mpi_free(&R);
+    mbedtls_mpi_free(&A); mbedtls_mpi_free(&B);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_div_int( char * input_X, int input_Y,
-                          char * input_A, char * input_B,
-                          int div_result )
+void mbedtls_mpi_div_int(char *input_X, int input_Y,
+                         char *input_A, char *input_B,
+                         int div_result)
 {
     mbedtls_mpi X, Q, R, A, B;
     int res;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Q ); mbedtls_mpi_init( &R ); mbedtls_mpi_init( &A );
-    mbedtls_mpi_init( &B );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Q); mbedtls_mpi_init(&R); mbedtls_mpi_init(&A);
+    mbedtls_mpi_init(&B);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &B, input_B ) == 0 );
-    res = mbedtls_mpi_div_int( &Q, &R, &X, input_Y );
-    TEST_ASSERT( res == div_result );
-    if( res == 0 )
-    {
-        TEST_ASSERT( sign_is_valid( &Q ) );
-        TEST_ASSERT( sign_is_valid( &R ) );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Q, &A ) == 0 );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R, &B ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&B, input_B) == 0);
+    res = mbedtls_mpi_div_int(&Q, &R, &X, input_Y);
+    TEST_ASSERT(res == div_result);
+    if (res == 0) {
+        TEST_ASSERT(sign_is_valid(&Q));
+        TEST_ASSERT(sign_is_valid(&R));
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Q, &A) == 0);
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R, &B) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Q ); mbedtls_mpi_free( &R ); mbedtls_mpi_free( &A );
-    mbedtls_mpi_free( &B );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Q); mbedtls_mpi_free(&R); mbedtls_mpi_free(&A);
+    mbedtls_mpi_free(&B);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_mod_mpi( char * input_X, char * input_Y,
-                          char * input_A, int div_result )
+void mbedtls_mpi_mod_mpi(char *input_X, char *input_Y,
+                         char *input_A, int div_result)
 {
     mbedtls_mpi X, Y, A;
     int res;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &A );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y); mbedtls_mpi_init(&A);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    res = mbedtls_mpi_mod_mpi( &X, &X, &Y );
-    TEST_ASSERT( res == div_result );
-    if( res == 0 )
-    {
-        TEST_ASSERT( sign_is_valid( &X ) );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    res = mbedtls_mpi_mod_mpi(&X, &X, &Y);
+    TEST_ASSERT(res == div_result);
+    if (res == 0) {
+        TEST_ASSERT(sign_is_valid(&X));
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &A) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y ); mbedtls_mpi_free( &A );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y); mbedtls_mpi_free(&A);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_mod_int( char * input_X, char * input_Y,
-                          char * input_A, int mod_result )
+void mbedtls_mpi_mod_int(char *input_X, char *input_Y,
+                         char *input_A, int mod_result)
 {
     mbedtls_mpi X;
     mbedtls_mpi Y;
@@ -1192,18 +1190,18 @@
     int res;
     mbedtls_mpi_uint r;
 
-    mbedtls_mpi_init( &X );
-    mbedtls_mpi_init( &Y );
-    mbedtls_mpi_init( &A );
+    mbedtls_mpi_init(&X);
+    mbedtls_mpi_init(&Y);
+    mbedtls_mpi_init(&A);
 
     /* We use MPIs to read Y and A since the test framework limits us to
      * ints, so we can't have 64-bit values */
-    TEST_EQUAL( mbedtls_test_read_mpi( &X, input_X ), 0 );
-    TEST_EQUAL( mbedtls_test_read_mpi( &Y, input_Y ), 0 );
-    TEST_EQUAL( mbedtls_test_read_mpi( &A, input_A ), 0 );
+    TEST_EQUAL(mbedtls_test_read_mpi(&X, input_X), 0);
+    TEST_EQUAL(mbedtls_test_read_mpi(&Y, input_Y), 0);
+    TEST_EQUAL(mbedtls_test_read_mpi(&A, input_A), 0);
 
-    TEST_EQUAL( Y.n, 1 );
-    TEST_EQUAL( A.n, 1 );
+    TEST_EQUAL(Y.n, 1);
+    TEST_EQUAL(A.n, 1);
 
     /* Convert the MPIs for Y and A to (signed) mbedtls_mpi_sints */
 
@@ -1214,301 +1212,297 @@
      * easy to test for, and this helps guard against human error. */
 
     mbedtls_mpi_sint y = (mbedtls_mpi_sint) Y.p[0];
-    TEST_ASSERT( y >= 0 );      /* If y < 0 here, we can't make negative y */
-    if( Y.s == -1 )
+    TEST_ASSERT(y >= 0);        /* If y < 0 here, we can't make negative y */
+    if (Y.s == -1) {
         y = -y;
+    }
 
     mbedtls_mpi_sint a = (mbedtls_mpi_sint) A.p[0];
-    TEST_ASSERT( a >= 0 );      /* Same goes for a */
-    if( A.s == -1 )
+    TEST_ASSERT(a >= 0);        /* Same goes for a */
+    if (A.s == -1) {
         a = -a;
+    }
 
-    res = mbedtls_mpi_mod_int( &r, &X, y );
-    TEST_EQUAL( res, mod_result );
-    if( res == 0 )
-    {
-        TEST_EQUAL( r, a );
+    res = mbedtls_mpi_mod_int(&r, &X, y);
+    TEST_EQUAL(res, mod_result);
+    if (res == 0) {
+        TEST_EQUAL(r, a);
     }
 
 exit:
-    mbedtls_mpi_free( &X );
-    mbedtls_mpi_free( &Y );
-    mbedtls_mpi_free( &A );
+    mbedtls_mpi_free(&X);
+    mbedtls_mpi_free(&Y);
+    mbedtls_mpi_free(&A);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_exp_mod( char * input_A, char * input_E,
-                          char * input_N, char * input_X,
-                          int exp_result )
+void mbedtls_mpi_exp_mod(char *input_A, char *input_E,
+                         char *input_N, char *input_X,
+                         int exp_result)
 {
     mbedtls_mpi A, E, N, RR, Z, X;
     int res;
-    mbedtls_mpi_init( &A  ); mbedtls_mpi_init( &E ); mbedtls_mpi_init( &N );
-    mbedtls_mpi_init( &RR ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&A); mbedtls_mpi_init(&E); mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&RR); mbedtls_mpi_init(&Z); mbedtls_mpi_init(&X);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
 
-    res = mbedtls_mpi_exp_mod( &Z, &A, &E, &N, NULL );
-    TEST_ASSERT( res == exp_result );
-    if( res == 0 )
-    {
-        TEST_ASSERT( sign_is_valid( &Z ) );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Z, &X ) == 0 );
+    res = mbedtls_mpi_exp_mod(&Z, &A, &E, &N, NULL);
+    TEST_ASSERT(res == exp_result);
+    if (res == 0) {
+        TEST_ASSERT(sign_is_valid(&Z));
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Z, &X) == 0);
     }
 
     /* Now test again with the speed-up parameter supplied as an output. */
-    res = mbedtls_mpi_exp_mod( &Z, &A, &E, &N, &RR );
-    TEST_ASSERT( res == exp_result );
-    if( res == 0 )
-    {
-        TEST_ASSERT( sign_is_valid( &Z ) );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Z, &X ) == 0 );
+    res = mbedtls_mpi_exp_mod(&Z, &A, &E, &N, &RR);
+    TEST_ASSERT(res == exp_result);
+    if (res == 0) {
+        TEST_ASSERT(sign_is_valid(&Z));
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Z, &X) == 0);
     }
 
     /* Now test again with the speed-up parameter supplied in calculated form. */
-    res = mbedtls_mpi_exp_mod( &Z, &A, &E, &N, &RR );
-    TEST_ASSERT( res == exp_result );
-    if( res == 0 )
-    {
-        TEST_ASSERT( sign_is_valid( &Z ) );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Z, &X ) == 0 );
+    res = mbedtls_mpi_exp_mod(&Z, &A, &E, &N, &RR);
+    TEST_ASSERT(res == exp_result);
+    if (res == 0) {
+        TEST_ASSERT(sign_is_valid(&Z));
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Z, &X) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &A  ); mbedtls_mpi_free( &E ); mbedtls_mpi_free( &N );
-    mbedtls_mpi_free( &RR ); mbedtls_mpi_free( &Z ); mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&A); mbedtls_mpi_free(&E); mbedtls_mpi_free(&N);
+    mbedtls_mpi_free(&RR); mbedtls_mpi_free(&Z); mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_exp_mod_size( int A_bytes, int E_bytes, int N_bytes,
-                               char * input_RR, int exp_result )
+void mbedtls_mpi_exp_mod_size(int A_bytes, int E_bytes, int N_bytes,
+                              char *input_RR, int exp_result)
 {
     mbedtls_mpi A, E, N, RR, Z;
-    mbedtls_mpi_init( &A  ); mbedtls_mpi_init( &E ); mbedtls_mpi_init( &N );
-    mbedtls_mpi_init( &RR ); mbedtls_mpi_init( &Z );
+    mbedtls_mpi_init(&A); mbedtls_mpi_init(&E); mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&RR); mbedtls_mpi_init(&Z);
 
     /* Set A to 2^(A_bytes - 1) + 1 */
-    TEST_ASSERT( mbedtls_mpi_lset( &A, 1 ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_shift_l( &A, ( A_bytes * 8 ) - 1 ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_set_bit( &A, 0, 1 ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_lset(&A, 1) == 0);
+    TEST_ASSERT(mbedtls_mpi_shift_l(&A, (A_bytes * 8) - 1) == 0);
+    TEST_ASSERT(mbedtls_mpi_set_bit(&A, 0, 1) == 0);
 
     /* Set E to 2^(E_bytes - 1) + 1 */
-    TEST_ASSERT( mbedtls_mpi_lset( &E, 1 ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_shift_l( &E, ( E_bytes * 8 ) - 1 ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_set_bit( &E, 0, 1 ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_lset(&E, 1) == 0);
+    TEST_ASSERT(mbedtls_mpi_shift_l(&E, (E_bytes * 8) - 1) == 0);
+    TEST_ASSERT(mbedtls_mpi_set_bit(&E, 0, 1) == 0);
 
     /* Set N to 2^(N_bytes - 1) + 1 */
-    TEST_ASSERT( mbedtls_mpi_lset( &N, 1 ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_shift_l( &N, ( N_bytes * 8 ) - 1 ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_set_bit( &N, 0, 1 ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_lset(&N, 1) == 0);
+    TEST_ASSERT(mbedtls_mpi_shift_l(&N, (N_bytes * 8) - 1) == 0);
+    TEST_ASSERT(mbedtls_mpi_set_bit(&N, 0, 1) == 0);
 
-    if( strlen( input_RR ) )
-        TEST_ASSERT( mbedtls_test_read_mpi( &RR, input_RR ) == 0 );
+    if (strlen(input_RR)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&RR, input_RR) == 0);
+    }
 
-    TEST_ASSERT( mbedtls_mpi_exp_mod( &Z, &A, &E, &N, &RR ) == exp_result );
+    TEST_ASSERT(mbedtls_mpi_exp_mod(&Z, &A, &E, &N, &RR) == exp_result);
 
 exit:
-    mbedtls_mpi_free( &A  ); mbedtls_mpi_free( &E ); mbedtls_mpi_free( &N );
-    mbedtls_mpi_free( &RR ); mbedtls_mpi_free( &Z );
+    mbedtls_mpi_free(&A); mbedtls_mpi_free(&E); mbedtls_mpi_free(&N);
+    mbedtls_mpi_free(&RR); mbedtls_mpi_free(&Z);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_inv_mod( char * input_X, char * input_Y,
-                          char * input_A, int div_result )
+void mbedtls_mpi_inv_mod(char *input_X, char *input_Y,
+                         char *input_A, int div_result)
 {
     mbedtls_mpi X, Y, Z, A;
     int res;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Z ); mbedtls_mpi_init( &A );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y); mbedtls_mpi_init(&Z); mbedtls_mpi_init(&A);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    res = mbedtls_mpi_inv_mod( &Z, &X, &Y );
-    TEST_ASSERT( res == div_result );
-    if( res == 0 )
-    {
-        TEST_ASSERT( sign_is_valid( &Z ) );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Z, &A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    res = mbedtls_mpi_inv_mod(&Z, &X, &Y);
+    TEST_ASSERT(res == div_result);
+    if (res == 0) {
+        TEST_ASSERT(sign_is_valid(&Z));
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Z, &A) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y ); mbedtls_mpi_free( &Z ); mbedtls_mpi_free( &A );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y); mbedtls_mpi_free(&Z); mbedtls_mpi_free(&A);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_GENPRIME */
-void mbedtls_mpi_is_prime( char * input_X, int div_result )
+void mbedtls_mpi_is_prime(char *input_X, int div_result)
 {
     mbedtls_mpi X;
     int res;
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    res = mbedtls_mpi_is_prime_ext( &X, 40, mbedtls_test_rnd_std_rand, NULL );
-    TEST_ASSERT( res == div_result );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    res = mbedtls_mpi_is_prime_ext(&X, 40, mbedtls_test_rnd_std_rand, NULL);
+    TEST_ASSERT(res == div_result);
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_GENPRIME */
-void mbedtls_mpi_is_prime_det( data_t * input_X, data_t * witnesses,
-                               int chunk_len, int rounds )
+void mbedtls_mpi_is_prime_det(data_t *input_X, data_t *witnesses,
+                              int chunk_len, int rounds)
 {
     mbedtls_mpi X;
     int res;
     mbedtls_test_mpi_random rand;
 
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
     rand.data = witnesses;
     rand.pos = 0;
     rand.chunk_len = chunk_len;
 
-    TEST_ASSERT( mbedtls_mpi_read_binary( &X, input_X->x, input_X->len ) == 0 );
-    res = mbedtls_mpi_is_prime_ext( &X, rounds - 1,
-                                    mbedtls_test_mpi_miller_rabin_determinizer,
-                                    &rand );
-    TEST_ASSERT( res == 0 );
+    TEST_ASSERT(mbedtls_mpi_read_binary(&X, input_X->x, input_X->len) == 0);
+    res = mbedtls_mpi_is_prime_ext(&X, rounds - 1,
+                                   mbedtls_test_mpi_miller_rabin_determinizer,
+                                   &rand);
+    TEST_ASSERT(res == 0);
 
     rand.data = witnesses;
     rand.pos = 0;
     rand.chunk_len = chunk_len;
 
-    res = mbedtls_mpi_is_prime_ext( &X, rounds,
-                                    mbedtls_test_mpi_miller_rabin_determinizer,
-                                    &rand );
-    TEST_ASSERT( res == MBEDTLS_ERR_MPI_NOT_ACCEPTABLE );
+    res = mbedtls_mpi_is_prime_ext(&X, rounds,
+                                   mbedtls_test_mpi_miller_rabin_determinizer,
+                                   &rand);
+    TEST_ASSERT(res == MBEDTLS_ERR_MPI_NOT_ACCEPTABLE);
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_GENPRIME */
-void mbedtls_mpi_gen_prime( int bits, int flags, int ref_ret )
+void mbedtls_mpi_gen_prime(int bits, int flags, int ref_ret)
 {
     mbedtls_mpi X;
     int my_ret;
 
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
-    my_ret = mbedtls_mpi_gen_prime( &X, bits, flags,
-                                    mbedtls_test_rnd_std_rand, NULL );
-    TEST_ASSERT( my_ret == ref_ret );
+    my_ret = mbedtls_mpi_gen_prime(&X, bits, flags,
+                                   mbedtls_test_rnd_std_rand, NULL);
+    TEST_ASSERT(my_ret == ref_ret);
 
-    if( ref_ret == 0 )
-    {
-        size_t actual_bits = mbedtls_mpi_bitlen( &X );
+    if (ref_ret == 0) {
+        size_t actual_bits = mbedtls_mpi_bitlen(&X);
 
-        TEST_ASSERT( actual_bits >= (size_t) bits );
-        TEST_ASSERT( actual_bits <= (size_t) bits + 1 );
-        TEST_ASSERT( sign_is_valid( &X ) );
+        TEST_ASSERT(actual_bits >= (size_t) bits);
+        TEST_ASSERT(actual_bits <= (size_t) bits + 1);
+        TEST_ASSERT(sign_is_valid(&X));
 
-        TEST_ASSERT( mbedtls_mpi_is_prime_ext( &X, 40,
-                                               mbedtls_test_rnd_std_rand,
-                                               NULL ) == 0 );
-        if( flags & MBEDTLS_MPI_GEN_PRIME_FLAG_DH )
-        {
+        TEST_ASSERT(mbedtls_mpi_is_prime_ext(&X, 40,
+                                             mbedtls_test_rnd_std_rand,
+                                             NULL) == 0);
+        if (flags & MBEDTLS_MPI_GEN_PRIME_FLAG_DH) {
             /* X = ( X - 1 ) / 2 */
-            TEST_ASSERT( mbedtls_mpi_shift_r( &X, 1 ) == 0 );
-            TEST_ASSERT( mbedtls_mpi_is_prime_ext( &X, 40,
-                                                   mbedtls_test_rnd_std_rand,
-                                                   NULL ) == 0 );
+            TEST_ASSERT(mbedtls_mpi_shift_r(&X, 1) == 0);
+            TEST_ASSERT(mbedtls_mpi_is_prime_ext(&X, 40,
+                                                 mbedtls_test_rnd_std_rand,
+                                                 NULL) == 0);
         }
     }
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_shift_l( char * input_X, int shift_X,
-                          char * input_A )
+void mbedtls_mpi_shift_l(char *input_X, int shift_X,
+                         char *input_A)
 {
     mbedtls_mpi X, A;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &A );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&A);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_shift_l( &X, shift_X ) == 0 );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    TEST_ASSERT(mbedtls_mpi_shift_l(&X, shift_X) == 0);
+    TEST_ASSERT(sign_is_valid(&X));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &A) == 0);
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &A );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&A);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_shift_r( char * input_X, int shift_X,
-                          char * input_A )
+void mbedtls_mpi_shift_r(char *input_X, int shift_X,
+                         char *input_A)
 {
     mbedtls_mpi X, A;
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &A );
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&A);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_shift_r( &X, shift_X ) == 0 );
-    TEST_ASSERT( sign_is_valid( &X ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, input_A) == 0);
+    TEST_ASSERT(mbedtls_mpi_shift_r(&X, shift_X) == 0);
+    TEST_ASSERT(sign_is_valid(&X));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&X, &A) == 0);
 
 exit:
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &A );
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&A);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mpi_fill_random( int wanted_bytes, int rng_bytes,
-                      int before, int expected_ret )
+void mpi_fill_random(int wanted_bytes, int rng_bytes,
+                     int before, int expected_ret)
 {
     mbedtls_mpi X;
     int ret;
     size_t bytes_left = rng_bytes;
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
-    if( before != 0 )
-    {
+    if (before != 0) {
         /* Set X to sign(before) * 2^(|before|-1) */
-        TEST_ASSERT( mbedtls_mpi_lset( &X, before > 0 ? 1 : -1 ) == 0 );
-        if( before < 0 )
-            before = - before;
-        TEST_ASSERT( mbedtls_mpi_shift_l( &X, before - 1 ) == 0 );
+        TEST_ASSERT(mbedtls_mpi_lset(&X, before > 0 ? 1 : -1) == 0);
+        if (before < 0) {
+            before = -before;
+        }
+        TEST_ASSERT(mbedtls_mpi_shift_l(&X, before - 1) == 0);
     }
 
-    ret = mbedtls_mpi_fill_random( &X, wanted_bytes,
-                                   f_rng_bytes_left, &bytes_left );
-    TEST_ASSERT( ret == expected_ret );
+    ret = mbedtls_mpi_fill_random(&X, wanted_bytes,
+                                  f_rng_bytes_left, &bytes_left);
+    TEST_ASSERT(ret == expected_ret);
 
-    if( expected_ret == 0 )
-    {
+    if (expected_ret == 0) {
         /* mbedtls_mpi_fill_random is documented to use bytes from the RNG
          * as a big-endian representation of the number. We know when
          * our RNG function returns null bytes, so we know how many
          * leading zero bytes the number has. */
         size_t leading_zeros = 0;
-        if( wanted_bytes > 0 && rng_bytes % 256 == 0 )
+        if (wanted_bytes > 0 && rng_bytes % 256 == 0) {
             leading_zeros = 1;
-        TEST_ASSERT( mbedtls_mpi_size( &X ) + leading_zeros ==
-                     (size_t) wanted_bytes );
-        TEST_ASSERT( (int) bytes_left == rng_bytes - wanted_bytes );
-        TEST_ASSERT( sign_is_valid( &X ) );
+        }
+        TEST_ASSERT(mbedtls_mpi_size(&X) + leading_zeros ==
+                    (size_t) wanted_bytes);
+        TEST_ASSERT((int) bytes_left == rng_bytes - wanted_bytes);
+        TEST_ASSERT(sign_is_valid(&X));
     }
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mpi_random_many( int min, data_t *bound_bytes, int iterations )
+void mpi_random_many(int min, data_t *bound_bytes, int iterations)
 {
     /* Generate numbers in the range 1..bound-1. Do it iterations times.
      * This function assumes that the value of bound is at least 2 and
@@ -1528,71 +1522,60 @@
     int full_stats;
     size_t i;
 
-    mbedtls_mpi_init( &upper_bound );
-    mbedtls_mpi_init( &result );
+    mbedtls_mpi_init(&upper_bound);
+    mbedtls_mpi_init(&result);
 
-    TEST_EQUAL( 0, mbedtls_mpi_read_binary( &upper_bound,
-                                            bound_bytes->x, bound_bytes->len ) );
-    n_bits = mbedtls_mpi_bitlen( &upper_bound );
+    TEST_EQUAL(0, mbedtls_mpi_read_binary(&upper_bound,
+                                          bound_bytes->x, bound_bytes->len));
+    n_bits = mbedtls_mpi_bitlen(&upper_bound);
     /* Consider a bound "small" if it's less than 2^5. This value is chosen
      * to be small enough that the probability of missing one value is
      * negligible given the number of iterations. It must be less than
      * 256 because some of the code below assumes that "small" values
      * fit in a byte. */
-    if( n_bits <= 5 )
-    {
+    if (n_bits <= 5) {
         full_stats = 1;
         stats_len = bound_bytes->x[bound_bytes->len - 1];
-    }
-    else
-    {
+    } else {
         full_stats = 0;
         stats_len = n_bits;
     }
-    ASSERT_ALLOC( stats, stats_len );
+    ASSERT_ALLOC(stats, stats_len);
 
-    for( i = 0; i < (size_t) iterations; i++ )
-    {
-        mbedtls_test_set_step( i );
-        TEST_EQUAL( 0, mbedtls_mpi_random( &result, min, &upper_bound,
-                                           mbedtls_test_rnd_std_rand, NULL ) );
+    for (i = 0; i < (size_t) iterations; i++) {
+        mbedtls_test_set_step(i);
+        TEST_EQUAL(0, mbedtls_mpi_random(&result, min, &upper_bound,
+                                         mbedtls_test_rnd_std_rand, NULL));
 
-        TEST_ASSERT( sign_is_valid( &result ) );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &result, &upper_bound ) < 0 );
-        TEST_ASSERT( mbedtls_mpi_cmp_int( &result, min ) >= 0 );
-        if( full_stats )
-        {
+        TEST_ASSERT(sign_is_valid(&result));
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&result, &upper_bound) < 0);
+        TEST_ASSERT(mbedtls_mpi_cmp_int(&result, min) >= 0);
+        if (full_stats) {
             uint8_t value;
-            TEST_EQUAL( 0, mbedtls_mpi_write_binary( &result, &value, 1 ) );
-            TEST_ASSERT( value < stats_len );
+            TEST_EQUAL(0, mbedtls_mpi_write_binary(&result, &value, 1));
+            TEST_ASSERT(value < stats_len);
             ++stats[value];
-        }
-        else
-        {
-            for( b = 0; b < n_bits; b++ )
-                stats[b] += mbedtls_mpi_get_bit( &result, b );
+        } else {
+            for (b = 0; b < n_bits; b++) {
+                stats[b] += mbedtls_mpi_get_bit(&result, b);
+            }
         }
     }
 
-    if( full_stats )
-    {
-        for( b = min; b < stats_len; b++ )
-        {
-            mbedtls_test_set_step( 1000000 + b );
+    if (full_stats) {
+        for (b = min; b < stats_len; b++) {
+            mbedtls_test_set_step(1000000 + b);
             /* Assert that each value has been reached at least once.
              * This is almost guaranteed if the iteration count is large
              * enough. This is a very crude way of checking the distribution.
              */
-            TEST_ASSERT( stats[b] > 0 );
+            TEST_ASSERT(stats[b] > 0);
         }
-    }
-    else
-    {
+    } else {
         int statistically_safe_all_the_way =
-            is_significantly_above_a_power_of_2( bound_bytes );
-        for( b = 0; b < n_bits; b++ )
-        {
-            mbedtls_test_set_step( 1000000 + b );
+            is_significantly_above_a_power_of_2(bound_bytes);
+        for (b = 0; b < n_bits; b++) {
+            mbedtls_test_set_step(1000000 + b);
             /* Assert that each bit has been set in at least one result and
              * clear in at least one result. Provided that iterations is not
              * too small, it would be extremely unlikely for this not to be
@@ -1601,78 +1584,77 @@
              * As an exception, the top bit may legitimately never be set
              * if bound is a power of 2 or only slightly above.
              */
-            if( statistically_safe_all_the_way || b != n_bits - 1 )
-            {
-                TEST_ASSERT( stats[b] > 0 );
+            if (statistically_safe_all_the_way || b != n_bits - 1) {
+                TEST_ASSERT(stats[b] > 0);
             }
-            TEST_ASSERT( stats[b] < (size_t) iterations );
+            TEST_ASSERT(stats[b] < (size_t) iterations);
         }
     }
 
 exit:
-    mbedtls_mpi_free( &upper_bound );
-    mbedtls_mpi_free( &result );
-    mbedtls_free( stats );
+    mbedtls_mpi_free(&upper_bound);
+    mbedtls_mpi_free(&result);
+    mbedtls_free(stats);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mpi_random_sizes( int min, data_t *bound_bytes, int nlimbs, int before )
+void mpi_random_sizes(int min, data_t *bound_bytes, int nlimbs, int before)
 {
     mbedtls_mpi upper_bound;
     mbedtls_mpi result;
 
-    mbedtls_mpi_init( &upper_bound );
-    mbedtls_mpi_init( &result );
+    mbedtls_mpi_init(&upper_bound);
+    mbedtls_mpi_init(&result);
 
-    if( before != 0 )
-    {
+    if (before != 0) {
         /* Set result to sign(before) * 2^(|before|-1) */
-        TEST_ASSERT( mbedtls_mpi_lset( &result, before > 0 ? 1 : -1 ) == 0 );
-        if( before < 0 )
-            before = - before;
-        TEST_ASSERT( mbedtls_mpi_shift_l( &result, before - 1 ) == 0 );
+        TEST_ASSERT(mbedtls_mpi_lset(&result, before > 0 ? 1 : -1) == 0);
+        if (before < 0) {
+            before = -before;
+        }
+        TEST_ASSERT(mbedtls_mpi_shift_l(&result, before - 1) == 0);
     }
 
-    TEST_EQUAL( 0, mbedtls_mpi_grow( &result, nlimbs ) );
-    TEST_EQUAL( 0, mbedtls_mpi_read_binary( &upper_bound,
-                                            bound_bytes->x, bound_bytes->len ) );
-    TEST_EQUAL( 0, mbedtls_mpi_random( &result, min, &upper_bound,
-                                       mbedtls_test_rnd_std_rand, NULL ) );
-    TEST_ASSERT( sign_is_valid( &result ) );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &result, &upper_bound ) < 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_int( &result, min ) >= 0 );
+    TEST_EQUAL(0, mbedtls_mpi_grow(&result, nlimbs));
+    TEST_EQUAL(0, mbedtls_mpi_read_binary(&upper_bound,
+                                          bound_bytes->x, bound_bytes->len));
+    TEST_EQUAL(0, mbedtls_mpi_random(&result, min, &upper_bound,
+                                     mbedtls_test_rnd_std_rand, NULL));
+    TEST_ASSERT(sign_is_valid(&result));
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&result, &upper_bound) < 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_int(&result, min) >= 0);
 
 exit:
-    mbedtls_mpi_free( &upper_bound );
-    mbedtls_mpi_free( &result );
+    mbedtls_mpi_free(&upper_bound);
+    mbedtls_mpi_free(&result);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mpi_random_fail( int min, data_t *bound_bytes, int expected_ret )
+void mpi_random_fail(int min, data_t *bound_bytes, int expected_ret)
 {
     mbedtls_mpi upper_bound;
     mbedtls_mpi result;
     int actual_ret;
 
-    mbedtls_mpi_init( &upper_bound );
-    mbedtls_mpi_init( &result );
+    mbedtls_mpi_init(&upper_bound);
+    mbedtls_mpi_init(&result);
 
-    TEST_EQUAL( 0, mbedtls_mpi_read_binary( &upper_bound,
-                                            bound_bytes->x, bound_bytes->len ) );
-    actual_ret = mbedtls_mpi_random( &result, min, &upper_bound,
-                                     mbedtls_test_rnd_std_rand, NULL );
-    TEST_EQUAL( expected_ret, actual_ret );
+    TEST_EQUAL(0, mbedtls_mpi_read_binary(&upper_bound,
+                                          bound_bytes->x, bound_bytes->len));
+    actual_ret = mbedtls_mpi_random(&result, min, &upper_bound,
+                                    mbedtls_test_rnd_std_rand, NULL);
+    TEST_EQUAL(expected_ret, actual_ret);
 
 exit:
-    mbedtls_mpi_free( &upper_bound );
-    mbedtls_mpi_free( &result );
+    mbedtls_mpi_free(&upper_bound);
+    mbedtls_mpi_free(&result);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void most_negative_mpi_sint( )
+void most_negative_mpi_sint()
 {
     /* Ad hoc tests for n = -p = -2^(biL-1) as a mbedtls_mpi_sint. We
      * guarantee that mbedtls_mpi_sint is a two's complement type, so this
@@ -1690,134 +1672,134 @@
      */
 
     mbedtls_mpi A, R, X;
-    mbedtls_mpi_init( &A );
-    mbedtls_mpi_init( &R );
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&A);
+    mbedtls_mpi_init(&R);
+    mbedtls_mpi_init(&X);
 
-    const size_t biL = 8 * sizeof( mbedtls_mpi_sint );
-    mbedtls_mpi_uint most_positive_plus_1 = (mbedtls_mpi_uint) 1 << ( biL - 1 );
+    const size_t biL = 8 * sizeof(mbedtls_mpi_sint);
+    mbedtls_mpi_uint most_positive_plus_1 = (mbedtls_mpi_uint) 1 << (biL - 1);
     const mbedtls_mpi_sint most_positive = most_positive_plus_1 - 1;
-    const mbedtls_mpi_sint most_negative = - most_positive - 1;
-    TEST_EQUAL( (mbedtls_mpi_uint) most_negative,
-                (mbedtls_mpi_uint) 1 << ( biL - 1 ) );
-    TEST_EQUAL( (mbedtls_mpi_uint) most_negative << 1, 0 );
+    const mbedtls_mpi_sint most_negative = -most_positive - 1;
+    TEST_EQUAL((mbedtls_mpi_uint) most_negative,
+               (mbedtls_mpi_uint) 1 << (biL - 1));
+    TEST_EQUAL((mbedtls_mpi_uint) most_negative << 1, 0);
 
     /* Test mbedtls_mpi_lset() */
-    TEST_EQUAL( mbedtls_mpi_lset( &A, most_negative ), 0 );
-    TEST_EQUAL( A.s, -1 );
-    TEST_EQUAL( A.n, 1 );
-    TEST_EQUAL( A.p[0], most_positive_plus_1 );
+    TEST_EQUAL(mbedtls_mpi_lset(&A, most_negative), 0);
+    TEST_EQUAL(A.s, -1);
+    TEST_EQUAL(A.n, 1);
+    TEST_EQUAL(A.p[0], most_positive_plus_1);
 
     /* Test mbedtls_mpi_cmp_int(): -p == -p */
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &A, most_negative ), 0 );
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&A, most_negative), 0);
 
     /* Test mbedtls_mpi_cmp_int(): -(p+1) < -p */
     A.p[0] = most_positive_plus_1 + 1;
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &A, most_negative ), -1 );
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&A, most_negative), -1);
 
     /* Test mbedtls_mpi_cmp_int(): -(p-1) > -p */
     A.p[0] = most_positive_plus_1 - 1;
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &A, most_negative ), 1 );
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&A, most_negative), 1);
 
     /* Test mbedtls_mpi_add_int(): (p-1) + (-p) */
-    TEST_EQUAL( mbedtls_mpi_lset( &A, most_positive ), 0 );
-    TEST_EQUAL( mbedtls_mpi_add_int( &X, &A, most_negative ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &X, -1 ), 0 );
+    TEST_EQUAL(mbedtls_mpi_lset(&A, most_positive), 0);
+    TEST_EQUAL(mbedtls_mpi_add_int(&X, &A, most_negative), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&X, -1), 0);
 
     /* Test mbedtls_mpi_add_int(): (0) + (-p) */
-    TEST_EQUAL( mbedtls_mpi_lset( &A, 0 ), 0 );
-    TEST_EQUAL( mbedtls_mpi_add_int( &X, &A, most_negative ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &X, most_negative ), 0 );
+    TEST_EQUAL(mbedtls_mpi_lset(&A, 0), 0);
+    TEST_EQUAL(mbedtls_mpi_add_int(&X, &A, most_negative), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&X, most_negative), 0);
 
     /* Test mbedtls_mpi_add_int(): (-p) + (-p) */
-    TEST_EQUAL( mbedtls_mpi_lset( &A, most_negative ), 0 );
-    TEST_EQUAL( mbedtls_mpi_add_int( &X, &A, most_negative ), 0 );
-    TEST_EQUAL( X.s, -1 );
-    TEST_EQUAL( X.n, 2 );
-    TEST_EQUAL( X.p[0], 0 );
-    TEST_EQUAL( X.p[1], 1 );
+    TEST_EQUAL(mbedtls_mpi_lset(&A, most_negative), 0);
+    TEST_EQUAL(mbedtls_mpi_add_int(&X, &A, most_negative), 0);
+    TEST_EQUAL(X.s, -1);
+    TEST_EQUAL(X.n, 2);
+    TEST_EQUAL(X.p[0], 0);
+    TEST_EQUAL(X.p[1], 1);
 
     /* Test mbedtls_mpi_sub_int(): (p) - (-p) */
-    mbedtls_mpi_free( &X );
-    TEST_EQUAL( mbedtls_mpi_lset( &A, most_positive ), 0 );
-    TEST_EQUAL( mbedtls_mpi_sub_int( &X, &A, most_negative ), 0 );
-    TEST_EQUAL( X.s, 1 );
-    TEST_EQUAL( X.n, 1 );
-    TEST_EQUAL( X.p[0], ~(mbedtls_mpi_uint)0 );
+    mbedtls_mpi_free(&X);
+    TEST_EQUAL(mbedtls_mpi_lset(&A, most_positive), 0);
+    TEST_EQUAL(mbedtls_mpi_sub_int(&X, &A, most_negative), 0);
+    TEST_EQUAL(X.s, 1);
+    TEST_EQUAL(X.n, 1);
+    TEST_EQUAL(X.p[0], ~(mbedtls_mpi_uint) 0);
 
     /* Test mbedtls_mpi_sub_int(): (0) - (-p) */
-    TEST_EQUAL( mbedtls_mpi_lset( &A, 0 ), 0 );
-    TEST_EQUAL( mbedtls_mpi_sub_int( &X, &A, most_negative ), 0 );
-    TEST_EQUAL( X.s, 1 );
-    TEST_EQUAL( X.n, 1 );
-    TEST_EQUAL( X.p[0], most_positive_plus_1 );
+    TEST_EQUAL(mbedtls_mpi_lset(&A, 0), 0);
+    TEST_EQUAL(mbedtls_mpi_sub_int(&X, &A, most_negative), 0);
+    TEST_EQUAL(X.s, 1);
+    TEST_EQUAL(X.n, 1);
+    TEST_EQUAL(X.p[0], most_positive_plus_1);
 
     /* Test mbedtls_mpi_sub_int(): (-p) - (-p) */
-    TEST_EQUAL( mbedtls_mpi_lset( &A, most_negative ), 0 );
-    TEST_EQUAL( mbedtls_mpi_sub_int( &X, &A, most_negative ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &X, 0 ), 0 );
+    TEST_EQUAL(mbedtls_mpi_lset(&A, most_negative), 0);
+    TEST_EQUAL(mbedtls_mpi_sub_int(&X, &A, most_negative), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&X, 0), 0);
 
     /* Test mbedtls_mpi_div_int(): (-p+1) / (-p) */
-    TEST_EQUAL( mbedtls_mpi_lset( &A, -most_positive ), 0 );
-    TEST_EQUAL( mbedtls_mpi_div_int( &X, &R, &A, most_negative ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &X, 0 ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &R, -most_positive ), 0 );
+    TEST_EQUAL(mbedtls_mpi_lset(&A, -most_positive), 0);
+    TEST_EQUAL(mbedtls_mpi_div_int(&X, &R, &A, most_negative), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&X, 0), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&R, -most_positive), 0);
 
     /* Test mbedtls_mpi_div_int(): (-p) / (-p) */
-    TEST_EQUAL( mbedtls_mpi_lset( &A, most_negative ), 0 );
-    TEST_EQUAL( mbedtls_mpi_div_int( &X, &R, &A, most_negative ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &X, 1 ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &R, 0 ), 0 );
+    TEST_EQUAL(mbedtls_mpi_lset(&A, most_negative), 0);
+    TEST_EQUAL(mbedtls_mpi_div_int(&X, &R, &A, most_negative), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&X, 1), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&R, 0), 0);
 
     /* Test mbedtls_mpi_div_int(): (-2*p) / (-p) */
-    TEST_EQUAL( mbedtls_mpi_shift_l( &A, 1 ), 0 );
-    TEST_EQUAL( mbedtls_mpi_div_int( &X, &R, &A, most_negative ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &X, 2 ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &R, 0 ), 0 );
+    TEST_EQUAL(mbedtls_mpi_shift_l(&A, 1), 0);
+    TEST_EQUAL(mbedtls_mpi_div_int(&X, &R, &A, most_negative), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&X, 2), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&R, 0), 0);
 
     /* Test mbedtls_mpi_div_int(): (-2*p+1) / (-p) */
-    TEST_EQUAL( mbedtls_mpi_add_int( &A, &A, 1 ), 0 );
-    TEST_EQUAL( mbedtls_mpi_div_int( &X, &R, &A, most_negative ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &X, 1 ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &R, -most_positive ), 0 );
+    TEST_EQUAL(mbedtls_mpi_add_int(&A, &A, 1), 0);
+    TEST_EQUAL(mbedtls_mpi_div_int(&X, &R, &A, most_negative), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&X, 1), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&R, -most_positive), 0);
 
     /* Test mbedtls_mpi_div_int(): (p-1) / (-p) */
-    TEST_EQUAL( mbedtls_mpi_lset( &A, most_positive ), 0 );
-    TEST_EQUAL( mbedtls_mpi_div_int( &X, &R, &A, most_negative ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &X, 0 ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &R, most_positive ), 0 );
+    TEST_EQUAL(mbedtls_mpi_lset(&A, most_positive), 0);
+    TEST_EQUAL(mbedtls_mpi_div_int(&X, &R, &A, most_negative), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&X, 0), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&R, most_positive), 0);
 
     /* Test mbedtls_mpi_div_int(): (p) / (-p) */
-    TEST_EQUAL( mbedtls_mpi_add_int( &A, &A, 1 ), 0 );
-    TEST_EQUAL( mbedtls_mpi_div_int( &X, &R, &A, most_negative ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &X, -1 ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &R, 0 ), 0 );
+    TEST_EQUAL(mbedtls_mpi_add_int(&A, &A, 1), 0);
+    TEST_EQUAL(mbedtls_mpi_div_int(&X, &R, &A, most_negative), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&X, -1), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&R, 0), 0);
 
     /* Test mbedtls_mpi_div_int(): (2*p) / (-p) */
-    TEST_EQUAL( mbedtls_mpi_shift_l( &A, 1 ), 0 );
-    TEST_EQUAL( mbedtls_mpi_div_int( &X, &R, &A, most_negative ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &X, -2 ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_int( &R, 0 ), 0 );
+    TEST_EQUAL(mbedtls_mpi_shift_l(&A, 1), 0);
+    TEST_EQUAL(mbedtls_mpi_div_int(&X, &R, &A, most_negative), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&X, -2), 0);
+    TEST_EQUAL(mbedtls_mpi_cmp_int(&R, 0), 0);
 
     /* Test mbedtls_mpi_mod_int(): never valid */
-    TEST_EQUAL( mbedtls_mpi_mod_int( X.p, &A, most_negative ),
-                MBEDTLS_ERR_MPI_NEGATIVE_VALUE );
+    TEST_EQUAL(mbedtls_mpi_mod_int(X.p, &A, most_negative),
+               MBEDTLS_ERR_MPI_NEGATIVE_VALUE);
 
     /* Test mbedtls_mpi_random(): never valid */
-    TEST_EQUAL( mbedtls_mpi_random( &X, most_negative, &A,
-                                    mbedtls_test_rnd_std_rand, NULL ),
-                MBEDTLS_ERR_MPI_BAD_INPUT_DATA );
+    TEST_EQUAL(mbedtls_mpi_random(&X, most_negative, &A,
+                                  mbedtls_test_rnd_std_rand, NULL),
+               MBEDTLS_ERR_MPI_BAD_INPUT_DATA);
 
 exit:
-    mbedtls_mpi_free( &A );
-    mbedtls_mpi_free( &R );
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&A);
+    mbedtls_mpi_free(&R);
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void mpi_selftest(  )
+void mpi_selftest()
 {
-    TEST_ASSERT( mbedtls_mpi_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_blowfish.function b/tests/suites/test_suite_blowfish.function
index f89353c..9541711 100644
--- a/tests/suites/test_suite_blowfish.function
+++ b/tests/suites/test_suite_blowfish.function
@@ -8,156 +8,156 @@
  */
 
 /* BEGIN_CASE */
-void blowfish_valid_param( )
+void blowfish_valid_param()
 {
-    TEST_VALID_PARAM( mbedtls_blowfish_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_blowfish_free(NULL));
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void blowfish_invalid_param( )
+void blowfish_invalid_param()
 {
     mbedtls_blowfish_context ctx;
     unsigned char buf[16] = { 0 };
-    size_t const valid_keylength = sizeof( buf ) * 8;
+    size_t const valid_keylength = sizeof(buf) * 8;
     size_t valid_mode = MBEDTLS_BLOWFISH_ENCRYPT;
     size_t invalid_mode = 42;
     size_t off;
     ((void) off);
 
-    TEST_INVALID_PARAM( mbedtls_blowfish_init( NULL ) );
-    TEST_VALID_PARAM( mbedtls_blowfish_free( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_blowfish_init(NULL));
+    TEST_VALID_PARAM(mbedtls_blowfish_free(NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_setkey( NULL,
-                                                     buf,
-                                                     valid_keylength ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_setkey( &ctx,
-                                                     NULL,
-                                                     valid_keylength ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_setkey(NULL,
+                                                   buf,
+                                                   valid_keylength));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_setkey(&ctx,
+                                                   NULL,
+                                                   valid_keylength));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_ecb( NULL,
-                                                     valid_mode,
-                                                     buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_ecb( &ctx,
-                                                        invalid_mode,
-                                                        buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_ecb( &ctx,
-                                                        valid_mode,
-                                                        NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_ecb( &ctx,
-                                                        valid_mode,
-                                                        buf, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_ecb(NULL,
+                                                      valid_mode,
+                                                      buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_ecb(&ctx,
+                                                      invalid_mode,
+                                                      buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_ecb(&ctx,
+                                                      valid_mode,
+                                                      NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_ecb(&ctx,
+                                                      valid_mode,
+                                                      buf, NULL));
 
 #if defined(MBEDTLS_CIPHER_MODE_CBC)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_cbc( NULL,
-                                                        valid_mode,
-                                                        sizeof( buf ),
-                                                        buf, buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_cbc( &ctx,
-                                                        invalid_mode,
-                                                        sizeof( buf ),
-                                                        buf, buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_cbc( &ctx,
-                                                        valid_mode,
-                                                        sizeof( buf ),
-                                                        NULL, buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_cbc( &ctx,
-                                                        valid_mode,
-                                                        sizeof( buf ),
-                                                        buf, NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_cbc( &ctx,
-                                                        valid_mode,
-                                                        sizeof( buf ),
-                                                        buf, buf, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_cbc(NULL,
+                                                      valid_mode,
+                                                      sizeof(buf),
+                                                      buf, buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_cbc(&ctx,
+                                                      invalid_mode,
+                                                      sizeof(buf),
+                                                      buf, buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_cbc(&ctx,
+                                                      valid_mode,
+                                                      sizeof(buf),
+                                                      NULL, buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_cbc(&ctx,
+                                                      valid_mode,
+                                                      sizeof(buf),
+                                                      buf, NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_cbc(&ctx,
+                                                      valid_mode,
+                                                      sizeof(buf),
+                                                      buf, buf, NULL));
 #endif /* MBEDTLS_CIPHER_MODE_CBC */
 
 #if defined(MBEDTLS_CIPHER_MODE_CFB)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_cfb64( NULL,
-                                                          valid_mode,
-                                                          sizeof( buf ),
-                                                          &off, buf,
-                                                          buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_cfb64( &ctx,
-                                                          invalid_mode,
-                                                          sizeof( buf ),
-                                                          &off, buf,
-                                                          buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_cfb64( &ctx,
-                                                          valid_mode,
-                                                          sizeof( buf ),
-                                                          NULL, buf,
-                                                          buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_cfb64( &ctx,
-                                                          valid_mode,
-                                                          sizeof( buf ),
-                                                          &off, NULL,
-                                                          buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_cfb64( &ctx,
-                                                          valid_mode,
-                                                          sizeof( buf ),
-                                                          &off, buf,
-                                                          NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_cfb64( &ctx,
-                                                          valid_mode,
-                                                          sizeof( buf ),
-                                                          &off, buf,
-                                                          buf, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_cfb64(NULL,
+                                                        valid_mode,
+                                                        sizeof(buf),
+                                                        &off, buf,
+                                                        buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_cfb64(&ctx,
+                                                        invalid_mode,
+                                                        sizeof(buf),
+                                                        &off, buf,
+                                                        buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_cfb64(&ctx,
+                                                        valid_mode,
+                                                        sizeof(buf),
+                                                        NULL, buf,
+                                                        buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_cfb64(&ctx,
+                                                        valid_mode,
+                                                        sizeof(buf),
+                                                        &off, NULL,
+                                                        buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_cfb64(&ctx,
+                                                        valid_mode,
+                                                        sizeof(buf),
+                                                        &off, buf,
+                                                        NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_cfb64(&ctx,
+                                                        valid_mode,
+                                                        sizeof(buf),
+                                                        &off, buf,
+                                                        buf, NULL));
 #endif /* MBEDTLS_CIPHER_MODE_CFB */
 
 #if defined(MBEDTLS_CIPHER_MODE_CTR)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_ctr( NULL,
-                                                        sizeof( buf ),
-                                                        &off,
-                                                        buf, buf,
-                                                        buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_ctr( &ctx,
-                                                        sizeof( buf ),
-                                                        NULL,
-                                                        buf, buf,
-                                                        buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_ctr( &ctx,
-                                                        sizeof( buf ),
-                                                        &off,
-                                                        NULL, buf,
-                                                        buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_ctr( &ctx,
-                                                        sizeof( buf ),
-                                                        &off,
-                                                        buf, NULL,
-                                                        buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_ctr( &ctx,
-                                                        sizeof( buf ),
-                                                        &off,
-                                                        buf, buf,
-                                                        NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
-                            mbedtls_blowfish_crypt_ctr( &ctx,
-                                                        sizeof( buf ),
-                                                        &off,
-                                                        buf, buf,
-                                                        buf, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_ctr(NULL,
+                                                      sizeof(buf),
+                                                      &off,
+                                                      buf, buf,
+                                                      buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_ctr(&ctx,
+                                                      sizeof(buf),
+                                                      NULL,
+                                                      buf, buf,
+                                                      buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_ctr(&ctx,
+                                                      sizeof(buf),
+                                                      &off,
+                                                      NULL, buf,
+                                                      buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_ctr(&ctx,
+                                                      sizeof(buf),
+                                                      &off,
+                                                      buf, NULL,
+                                                      buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_ctr(&ctx,
+                                                      sizeof(buf),
+                                                      &off,
+                                                      buf, buf,
+                                                      NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA,
+                           mbedtls_blowfish_crypt_ctr(&ctx,
+                                                      sizeof(buf),
+                                                      &off,
+                                                      buf, buf,
+                                                      buf, NULL));
 #endif /* MBEDTLS_CIPHER_MODE_CTR */
 
 exit:
@@ -166,155 +166,157 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void blowfish_encrypt_ecb( data_t * key_str, data_t * src_str,
-                           data_t * dst, int setkey_result )
+void blowfish_encrypt_ecb(data_t *key_str, data_t *src_str,
+                          data_t *dst, int setkey_result)
 {
     unsigned char output[100];
     mbedtls_blowfish_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_blowfish_init( &ctx );
+    mbedtls_blowfish_init(&ctx);
 
 
-    TEST_ASSERT( mbedtls_blowfish_setkey( &ctx, key_str->x, key_str->len * 8 ) == setkey_result );
-    if( setkey_result == 0 )
-    {
-        TEST_ASSERT( mbedtls_blowfish_crypt_ecb( &ctx, MBEDTLS_BLOWFISH_ENCRYPT, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_blowfish_setkey(&ctx, key_str->x, key_str->len * 8) == setkey_result);
+    if (setkey_result == 0) {
+        TEST_ASSERT(mbedtls_blowfish_crypt_ecb(&ctx, MBEDTLS_BLOWFISH_ENCRYPT, src_str->x,
+                                               output) == 0);
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 8, dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 8, dst->len) == 0);
     }
 
 exit:
-    mbedtls_blowfish_free( &ctx );
+    mbedtls_blowfish_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void blowfish_decrypt_ecb( data_t * key_str, data_t * src_str,
-                           data_t * dst, int setkey_result )
+void blowfish_decrypt_ecb(data_t *key_str, data_t *src_str,
+                          data_t *dst, int setkey_result)
 {
     unsigned char output[100];
     mbedtls_blowfish_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_blowfish_init( &ctx );
+    mbedtls_blowfish_init(&ctx);
 
 
-    TEST_ASSERT( mbedtls_blowfish_setkey( &ctx, key_str->x, key_str->len * 8 ) == setkey_result );
-    if( setkey_result == 0 )
-    {
-        TEST_ASSERT( mbedtls_blowfish_crypt_ecb( &ctx, MBEDTLS_BLOWFISH_DECRYPT, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_blowfish_setkey(&ctx, key_str->x, key_str->len * 8) == setkey_result);
+    if (setkey_result == 0) {
+        TEST_ASSERT(mbedtls_blowfish_crypt_ecb(&ctx, MBEDTLS_BLOWFISH_DECRYPT, src_str->x,
+                                               output) == 0);
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 8, dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 8, dst->len) == 0);
     }
 
 exit:
-    mbedtls_blowfish_free( &ctx );
+    mbedtls_blowfish_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void blowfish_encrypt_cbc( data_t * key_str, data_t * iv_str,
-                           data_t * src_str, data_t * dst,
-                           int cbc_result )
+void blowfish_encrypt_cbc(data_t *key_str, data_t *iv_str,
+                          data_t *src_str, data_t *dst,
+                          int cbc_result)
 {
     unsigned char output[100];
     mbedtls_blowfish_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_blowfish_init( &ctx );
+    mbedtls_blowfish_init(&ctx);
 
 
-    mbedtls_blowfish_setkey( &ctx, key_str->x, key_str->len * 8 );
+    mbedtls_blowfish_setkey(&ctx, key_str->x, key_str->len * 8);
 
-    TEST_ASSERT( mbedtls_blowfish_crypt_cbc( &ctx, MBEDTLS_BLOWFISH_ENCRYPT, src_str->len , iv_str->x, src_str->x, output ) == cbc_result );
-    if( cbc_result == 0 )
-    {
+    TEST_ASSERT(mbedtls_blowfish_crypt_cbc(&ctx, MBEDTLS_BLOWFISH_ENCRYPT, src_str->len, iv_str->x,
+                                           src_str->x, output) == cbc_result);
+    if (cbc_result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x,
-                                          src_str->len, dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x,
+                                        src_str->len, dst->len) == 0);
     }
 
 exit:
-    mbedtls_blowfish_free( &ctx );
+    mbedtls_blowfish_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void blowfish_decrypt_cbc( data_t * key_str, data_t * iv_str,
-                           data_t * src_str, data_t * dst,
-                           int cbc_result )
+void blowfish_decrypt_cbc(data_t *key_str, data_t *iv_str,
+                          data_t *src_str, data_t *dst,
+                          int cbc_result)
 {
     unsigned char output[100];
     mbedtls_blowfish_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_blowfish_init( &ctx );
+    mbedtls_blowfish_init(&ctx);
 
 
-    mbedtls_blowfish_setkey( &ctx, key_str->x, key_str->len * 8 );
-    TEST_ASSERT( mbedtls_blowfish_crypt_cbc( &ctx, MBEDTLS_BLOWFISH_DECRYPT, src_str->len , iv_str->x, src_str->x, output ) == cbc_result );
-    if( cbc_result == 0)
-    {
+    mbedtls_blowfish_setkey(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_blowfish_crypt_cbc(&ctx, MBEDTLS_BLOWFISH_DECRYPT, src_str->len, iv_str->x,
+                                           src_str->x, output) == cbc_result);
+    if (cbc_result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, src_str->len,
-                                          dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, src_str->len,
+                                        dst->len) == 0);
     }
 
 exit:
-    mbedtls_blowfish_free( &ctx );
+    mbedtls_blowfish_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
-void blowfish_encrypt_cfb64( data_t * key_str, data_t * iv_str,
-                             data_t * src_str, data_t * dst )
+void blowfish_encrypt_cfb64(data_t *key_str, data_t *iv_str,
+                            data_t *src_str, data_t *dst)
 {
     unsigned char output[100];
     mbedtls_blowfish_context ctx;
     size_t iv_offset = 0;
 
     memset(output, 0x00, 100);
-    mbedtls_blowfish_init( &ctx );
+    mbedtls_blowfish_init(&ctx);
 
 
-    mbedtls_blowfish_setkey( &ctx, key_str->x, key_str->len * 8 );
-    TEST_ASSERT( mbedtls_blowfish_crypt_cfb64( &ctx, MBEDTLS_BLOWFISH_ENCRYPT, src_str->len, &iv_offset, iv_str->x, src_str->x, output ) == 0 );
+    mbedtls_blowfish_setkey(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_blowfish_crypt_cfb64(&ctx, MBEDTLS_BLOWFISH_ENCRYPT, src_str->len,
+                                             &iv_offset, iv_str->x, src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, src_str->len,
-                                      dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, src_str->len,
+                                    dst->len) == 0);
 
 exit:
-    mbedtls_blowfish_free( &ctx );
+    mbedtls_blowfish_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
-void blowfish_decrypt_cfb64( data_t * key_str, data_t * iv_str,
-                             data_t * src_str, data_t * dst )
+void blowfish_decrypt_cfb64(data_t *key_str, data_t *iv_str,
+                            data_t *src_str, data_t *dst)
 {
     unsigned char output[100];
     mbedtls_blowfish_context ctx;
     size_t iv_offset = 0;
 
     memset(output, 0x00, 100);
-    mbedtls_blowfish_init( &ctx );
+    mbedtls_blowfish_init(&ctx);
 
 
-    mbedtls_blowfish_setkey( &ctx, key_str->x, key_str->len * 8 );
-    TEST_ASSERT( mbedtls_blowfish_crypt_cfb64( &ctx, MBEDTLS_BLOWFISH_DECRYPT, src_str->len, &iv_offset, iv_str->x, src_str->x, output ) == 0 );
+    mbedtls_blowfish_setkey(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_blowfish_crypt_cfb64(&ctx, MBEDTLS_BLOWFISH_DECRYPT, src_str->len,
+                                             &iv_offset, iv_str->x, src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, src_str->len,
-                                      dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, src_str->len,
+                                    dst->len) == 0);
 
 exit:
-    mbedtls_blowfish_free( &ctx );
+    mbedtls_blowfish_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CTR */
-void blowfish_encrypt_ctr( data_t * key_str, data_t * iv_str,
-                           data_t * src_str, data_t * dst )
+void blowfish_encrypt_ctr(data_t *key_str, data_t *iv_str,
+                          data_t *src_str, data_t *dst)
 {
     unsigned char stream_str[100];
     unsigned char output[100];
@@ -323,16 +325,17 @@
 
     memset(stream_str, 0x00, 100);
     memset(output, 0x00, 100);
-    mbedtls_blowfish_init( &ctx );
+    mbedtls_blowfish_init(&ctx);
 
 
-    mbedtls_blowfish_setkey( &ctx, key_str->x, key_str->len * 8 );
-    TEST_ASSERT( mbedtls_blowfish_crypt_ctr( &ctx, src_str->len, &iv_offset, iv_str->x, stream_str, src_str->x, output ) == 0 );
+    mbedtls_blowfish_setkey(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_blowfish_crypt_ctr(&ctx, src_str->len, &iv_offset, iv_str->x, stream_str,
+                                           src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, src_str->len,
-                                      dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, src_str->len,
+                                    dst->len) == 0);
 
 exit:
-    mbedtls_blowfish_free( &ctx );
+    mbedtls_blowfish_free(&ctx);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_camellia.function b/tests/suites/test_suite_camellia.function
index 312495c..da4276a 100644
--- a/tests/suites/test_suite_camellia.function
+++ b/tests/suites/test_suite_camellia.function
@@ -8,14 +8,14 @@
  */
 
 /* BEGIN_CASE */
-void camellia_valid_param( )
+void camellia_valid_param()
 {
-    TEST_VALID_PARAM( mbedtls_camellia_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_camellia_free(NULL));
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void camellia_invalid_param( )
+void camellia_invalid_param()
 {
     mbedtls_camellia_context ctx;
     unsigned char buf[16] = { 0 };
@@ -25,147 +25,147 @@
     size_t off;
     ((void) off);
 
-    TEST_INVALID_PARAM( mbedtls_camellia_init( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_camellia_init(NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_setkey_enc( NULL,
-                                                         buf,
-                                                         valid_keybits ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_setkey_enc( &ctx,
-                                                         NULL,
-                                                         valid_keybits ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_setkey_enc(NULL,
+                                                       buf,
+                                                       valid_keybits));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_setkey_enc(&ctx,
+                                                       NULL,
+                                                       valid_keybits));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_setkey_dec( NULL,
-                                                         buf,
-                                                         valid_keybits ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_setkey_dec( &ctx,
-                                                         NULL,
-                                                         valid_keybits ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_setkey_dec(NULL,
+                                                       buf,
+                                                       valid_keybits));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_setkey_dec(&ctx,
+                                                       NULL,
+                                                       valid_keybits));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_ecb( NULL,
-                                                        valid_mode,
-                                                        buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_ecb( &ctx,
-                                                        invalid_mode,
-                                                        buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_ecb( &ctx,
-                                                        valid_mode,
-                                                        NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_ecb( &ctx,
-                                                        valid_mode,
-                                                        buf, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_ecb(NULL,
+                                                      valid_mode,
+                                                      buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_ecb(&ctx,
+                                                      invalid_mode,
+                                                      buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_ecb(&ctx,
+                                                      valid_mode,
+                                                      NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_ecb(&ctx,
+                                                      valid_mode,
+                                                      buf, NULL));
 
 #if defined(MBEDTLS_CIPHER_MODE_CBC)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_cbc( NULL,
-                                                        valid_mode,
-                                                        sizeof( buf ),
-                                                        buf, buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_cbc( &ctx,
-                                                        invalid_mode,
-                                                        sizeof( buf ),
-                                                        buf, buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_cbc( &ctx,
-                                                        valid_mode,
-                                                        sizeof( buf ),
-                                                        NULL, buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_cbc( &ctx,
-                                                        valid_mode,
-                                                        sizeof( buf ),
-                                                        buf, NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_cbc( &ctx,
-                                                        valid_mode,
-                                                        sizeof( buf ),
-                                                        buf, buf, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_cbc(NULL,
+                                                      valid_mode,
+                                                      sizeof(buf),
+                                                      buf, buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_cbc(&ctx,
+                                                      invalid_mode,
+                                                      sizeof(buf),
+                                                      buf, buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_cbc(&ctx,
+                                                      valid_mode,
+                                                      sizeof(buf),
+                                                      NULL, buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_cbc(&ctx,
+                                                      valid_mode,
+                                                      sizeof(buf),
+                                                      buf, NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_cbc(&ctx,
+                                                      valid_mode,
+                                                      sizeof(buf),
+                                                      buf, buf, NULL));
 #endif /* MBEDTLS_CIPHER_MODE_CBC */
 
 #if defined(MBEDTLS_CIPHER_MODE_CFB)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_cfb128( NULL,
-                                                           valid_mode,
-                                                           sizeof( buf ),
-                                                           &off, buf,
-                                                           buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_cfb128( &ctx,
-                                                           invalid_mode,
-                                                           sizeof( buf ),
-                                                           &off, buf,
-                                                           buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_cfb128( &ctx,
-                                                           valid_mode,
-                                                           sizeof( buf ),
-                                                           NULL, buf,
-                                                           buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_cfb128( &ctx,
-                                                           valid_mode,
-                                                           sizeof( buf ),
-                                                           &off, NULL,
-                                                           buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_cfb128( &ctx,
-                                                           valid_mode,
-                                                           sizeof( buf ),
-                                                           &off, buf,
-                                                           NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_cfb128( &ctx,
-                                                           valid_mode,
-                                                           sizeof( buf ),
-                                                           &off, buf,
-                                                           buf, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_cfb128(NULL,
+                                                         valid_mode,
+                                                         sizeof(buf),
+                                                         &off, buf,
+                                                         buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_cfb128(&ctx,
+                                                         invalid_mode,
+                                                         sizeof(buf),
+                                                         &off, buf,
+                                                         buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_cfb128(&ctx,
+                                                         valid_mode,
+                                                         sizeof(buf),
+                                                         NULL, buf,
+                                                         buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_cfb128(&ctx,
+                                                         valid_mode,
+                                                         sizeof(buf),
+                                                         &off, NULL,
+                                                         buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_cfb128(&ctx,
+                                                         valid_mode,
+                                                         sizeof(buf),
+                                                         &off, buf,
+                                                         NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_cfb128(&ctx,
+                                                         valid_mode,
+                                                         sizeof(buf),
+                                                         &off, buf,
+                                                         buf, NULL));
 #endif /* MBEDTLS_CIPHER_MODE_CFB */
 
 #if defined(MBEDTLS_CIPHER_MODE_CTR)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_ctr( NULL,
-                                                        sizeof( buf ),
-                                                        &off,
-                                                        buf, buf,
-                                                        buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_ctr( &ctx,
-                                                        sizeof( buf ),
-                                                        NULL,
-                                                        buf, buf,
-                                                        buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_ctr( &ctx,
-                                                        sizeof( buf ),
-                                                        &off,
-                                                        NULL, buf,
-                                                        buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_ctr( &ctx,
-                                                        sizeof( buf ),
-                                                        &off,
-                                                        buf, NULL,
-                                                        buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_ctr( &ctx,
-                                                        sizeof( buf ),
-                                                        &off,
-                                                        buf, buf,
-                                                        NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_ctr( &ctx,
-                                                        sizeof( buf ),
-                                                        &off,
-                                                        buf, buf,
-                                                        buf, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_ctr(NULL,
+                                                      sizeof(buf),
+                                                      &off,
+                                                      buf, buf,
+                                                      buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_ctr(&ctx,
+                                                      sizeof(buf),
+                                                      NULL,
+                                                      buf, buf,
+                                                      buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_ctr(&ctx,
+                                                      sizeof(buf),
+                                                      &off,
+                                                      NULL, buf,
+                                                      buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_ctr(&ctx,
+                                                      sizeof(buf),
+                                                      &off,
+                                                      buf, NULL,
+                                                      buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_ctr(&ctx,
+                                                      sizeof(buf),
+                                                      &off,
+                                                      buf, buf,
+                                                      NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+                           mbedtls_camellia_crypt_ctr(&ctx,
+                                                      sizeof(buf),
+                                                      &off,
+                                                      buf, buf,
+                                                      buf, NULL));
 #endif /* MBEDTLS_CIPHER_MODE_CTR */
 
 exit:
@@ -174,152 +174,154 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void camellia_encrypt_ecb( data_t * key_str, data_t * src_str,
-                           data_t * dst, int setkey_result )
+void camellia_encrypt_ecb(data_t *key_str, data_t *src_str,
+                          data_t *dst, int setkey_result)
 {
     unsigned char output[100];
     mbedtls_camellia_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_camellia_init( &ctx );
+    mbedtls_camellia_init(&ctx);
 
 
-    TEST_ASSERT( mbedtls_camellia_setkey_enc( &ctx, key_str->x, key_str->len * 8 ) == setkey_result );
-    if( setkey_result == 0 )
-    {
-        TEST_ASSERT( mbedtls_camellia_crypt_ecb( &ctx, MBEDTLS_CAMELLIA_ENCRYPT, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_camellia_setkey_enc(&ctx, key_str->x, key_str->len * 8) == setkey_result);
+    if (setkey_result == 0) {
+        TEST_ASSERT(mbedtls_camellia_crypt_ecb(&ctx, MBEDTLS_CAMELLIA_ENCRYPT, src_str->x,
+                                               output) == 0);
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 16, dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 16, dst->len) == 0);
     }
 
 exit:
-    mbedtls_camellia_free( &ctx );
+    mbedtls_camellia_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void camellia_decrypt_ecb( data_t * key_str, data_t * src_str,
-                           data_t * dst, int setkey_result )
+void camellia_decrypt_ecb(data_t *key_str, data_t *src_str,
+                          data_t *dst, int setkey_result)
 {
     unsigned char output[100];
     mbedtls_camellia_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_camellia_init( &ctx );
+    mbedtls_camellia_init(&ctx);
 
 
-    TEST_ASSERT( mbedtls_camellia_setkey_dec( &ctx, key_str->x, key_str->len * 8 ) == setkey_result );
-    if( setkey_result == 0 )
-    {
-        TEST_ASSERT( mbedtls_camellia_crypt_ecb( &ctx, MBEDTLS_CAMELLIA_DECRYPT, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_camellia_setkey_dec(&ctx, key_str->x, key_str->len * 8) == setkey_result);
+    if (setkey_result == 0) {
+        TEST_ASSERT(mbedtls_camellia_crypt_ecb(&ctx, MBEDTLS_CAMELLIA_DECRYPT, src_str->x,
+                                               output) == 0);
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 16, dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 16, dst->len) == 0);
     }
 
 exit:
-    mbedtls_camellia_free( &ctx );
+    mbedtls_camellia_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void camellia_encrypt_cbc( data_t * key_str, data_t * iv_str,
-                           data_t * src_str, data_t * dst, int cbc_result )
+void camellia_encrypt_cbc(data_t *key_str, data_t *iv_str,
+                          data_t *src_str, data_t *dst, int cbc_result)
 {
     unsigned char output[100];
     mbedtls_camellia_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_camellia_init( &ctx );
+    mbedtls_camellia_init(&ctx);
 
 
-    mbedtls_camellia_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
-    TEST_ASSERT( mbedtls_camellia_crypt_cbc( &ctx, MBEDTLS_CAMELLIA_ENCRYPT, src_str->len, iv_str->x, src_str->x, output) == cbc_result );
-    if( cbc_result == 0 )
-    {
+    mbedtls_camellia_setkey_enc(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_camellia_crypt_cbc(&ctx, MBEDTLS_CAMELLIA_ENCRYPT, src_str->len, iv_str->x,
+                                           src_str->x, output) == cbc_result);
+    if (cbc_result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, src_str->len,
-                                          dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, src_str->len,
+                                        dst->len) == 0);
     }
 
 exit:
-    mbedtls_camellia_free( &ctx );
+    mbedtls_camellia_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void camellia_decrypt_cbc( data_t * key_str, data_t * iv_str,
-                           data_t * src_str, data_t * dst,
-                           int cbc_result )
+void camellia_decrypt_cbc(data_t *key_str, data_t *iv_str,
+                          data_t *src_str, data_t *dst,
+                          int cbc_result)
 {
     unsigned char output[100];
     mbedtls_camellia_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_camellia_init( &ctx );
+    mbedtls_camellia_init(&ctx);
 
 
-    mbedtls_camellia_setkey_dec( &ctx, key_str->x, key_str->len * 8 );
-    TEST_ASSERT( mbedtls_camellia_crypt_cbc( &ctx, MBEDTLS_CAMELLIA_DECRYPT, src_str->len, iv_str->x, src_str->x, output ) == cbc_result );
-    if( cbc_result == 0 )
-    {
+    mbedtls_camellia_setkey_dec(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_camellia_crypt_cbc(&ctx, MBEDTLS_CAMELLIA_DECRYPT, src_str->len, iv_str->x,
+                                           src_str->x, output) == cbc_result);
+    if (cbc_result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, src_str->len,
-                                          dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, src_str->len,
+                                        dst->len) == 0);
     }
 
 exit:
-    mbedtls_camellia_free( &ctx );
+    mbedtls_camellia_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
-void camellia_encrypt_cfb128( data_t * key_str, data_t * iv_str,
-                              data_t * src_str, data_t * dst )
+void camellia_encrypt_cfb128(data_t *key_str, data_t *iv_str,
+                             data_t *src_str, data_t *dst)
 {
     unsigned char output[100];
     mbedtls_camellia_context ctx;
     size_t iv_offset = 0;
 
     memset(output, 0x00, 100);
-    mbedtls_camellia_init( &ctx );
+    mbedtls_camellia_init(&ctx);
 
 
-    mbedtls_camellia_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
-    TEST_ASSERT( mbedtls_camellia_crypt_cfb128( &ctx, MBEDTLS_CAMELLIA_ENCRYPT, 16, &iv_offset, iv_str->x, src_str->x, output ) == 0 );
+    mbedtls_camellia_setkey_enc(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_camellia_crypt_cfb128(&ctx, MBEDTLS_CAMELLIA_ENCRYPT, 16, &iv_offset,
+                                              iv_str->x, src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 16, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 16, dst->len) == 0);
 
 exit:
-    mbedtls_camellia_free( &ctx );
+    mbedtls_camellia_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
-void camellia_decrypt_cfb128( data_t * key_str, data_t * iv_str,
-                              data_t * src_str,
-                              data_t * dst )
+void camellia_decrypt_cfb128(data_t *key_str, data_t *iv_str,
+                             data_t *src_str,
+                             data_t *dst)
 {
     unsigned char output[100];
     mbedtls_camellia_context ctx;
     size_t iv_offset = 0;
 
     memset(output, 0x00, 100);
-    mbedtls_camellia_init( &ctx );
+    mbedtls_camellia_init(&ctx);
 
 
-    mbedtls_camellia_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
-    TEST_ASSERT( mbedtls_camellia_crypt_cfb128( &ctx, MBEDTLS_CAMELLIA_DECRYPT, 16, &iv_offset, iv_str->x, src_str->x, output ) == 0 );
+    mbedtls_camellia_setkey_enc(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_camellia_crypt_cfb128(&ctx, MBEDTLS_CAMELLIA_DECRYPT, 16, &iv_offset,
+                                              iv_str->x, src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 16, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 16, dst->len) == 0);
 
 exit:
-    mbedtls_camellia_free( &ctx );
+    mbedtls_camellia_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void camellia_selftest(  )
+void camellia_selftest()
 {
-    TEST_ASSERT( mbedtls_camellia_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_camellia_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_ccm.function b/tests/suites/test_suite_ccm.function
index 5a3726e..735c9aa 100644
--- a/tests/suites/test_suite_ccm.function
+++ b/tests/suites/test_suite_ccm.function
@@ -8,34 +8,34 @@
  */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST:MBEDTLS_AES_C */
-void mbedtls_ccm_self_test(  )
+void mbedtls_ccm_self_test()
 {
-    TEST_ASSERT( mbedtls_ccm_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_ccm_self_test(1) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_ccm_setkey( int cipher_id, int key_size, int result )
+void mbedtls_ccm_setkey(int cipher_id, int key_size, int result)
 {
     mbedtls_ccm_context ctx;
     unsigned char key[32];
     int ret;
 
-    mbedtls_ccm_init( &ctx );
+    mbedtls_ccm_init(&ctx);
 
-    memset( key, 0x2A, sizeof( key ) );
-    TEST_ASSERT( (unsigned) key_size <= 8 * sizeof( key ) );
+    memset(key, 0x2A, sizeof(key));
+    TEST_ASSERT((unsigned) key_size <= 8 * sizeof(key));
 
-    ret = mbedtls_ccm_setkey( &ctx, cipher_id, key, key_size );
-    TEST_ASSERT( ret == result );
+    ret = mbedtls_ccm_setkey(&ctx, cipher_id, key, key_size);
+    TEST_ASSERT(ret == result);
 
 exit:
-    mbedtls_ccm_free( &ctx );
+    mbedtls_ccm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_AES_C */
-void ccm_lengths( int msg_len, int iv_len, int add_len, int tag_len, int res )
+void ccm_lengths(int msg_len, int iv_len, int add_len, int tag_len, int res)
 {
     mbedtls_ccm_context ctx;
     unsigned char key[16];
@@ -46,38 +46,39 @@
     unsigned char tag[18];
     int decrypt_ret;
 
-    mbedtls_ccm_init( &ctx );
+    mbedtls_ccm_init(&ctx);
 
-    ASSERT_ALLOC_WEAK( add, add_len );
-    memset( key, 0, sizeof( key ) );
-    memset( msg, 0, sizeof( msg ) );
-    memset( iv, 0, sizeof( iv ) );
-    memset( out, 0, sizeof( out ) );
-    memset( tag, 0, sizeof( tag ) );
+    ASSERT_ALLOC_WEAK(add, add_len);
+    memset(key, 0, sizeof(key));
+    memset(msg, 0, sizeof(msg));
+    memset(iv, 0, sizeof(iv));
+    memset(out, 0, sizeof(out));
+    memset(tag, 0, sizeof(tag));
 
-    TEST_ASSERT( mbedtls_ccm_setkey( &ctx, MBEDTLS_CIPHER_ID_AES,
-                                 key, 8 * sizeof( key ) ) == 0 );
+    TEST_ASSERT(mbedtls_ccm_setkey(&ctx, MBEDTLS_CIPHER_ID_AES,
+                                   key, 8 * sizeof(key)) == 0);
 
-    TEST_ASSERT( mbedtls_ccm_encrypt_and_tag( &ctx, msg_len, iv, iv_len, add, add_len,
-                                      msg, out, tag, tag_len ) == res );
+    TEST_ASSERT(mbedtls_ccm_encrypt_and_tag(&ctx, msg_len, iv, iv_len, add, add_len,
+                                            msg, out, tag, tag_len) == res);
 
-    decrypt_ret = mbedtls_ccm_auth_decrypt( &ctx, msg_len, iv, iv_len, add, add_len,
-                                    msg, out, tag, tag_len );
+    decrypt_ret = mbedtls_ccm_auth_decrypt(&ctx, msg_len, iv, iv_len, add, add_len,
+                                           msg, out, tag, tag_len);
 
-    if( res == 0 )
-        TEST_ASSERT( decrypt_ret == MBEDTLS_ERR_CCM_AUTH_FAILED );
-    else
-        TEST_ASSERT( decrypt_ret == res );
+    if (res == 0) {
+        TEST_ASSERT(decrypt_ret == MBEDTLS_ERR_CCM_AUTH_FAILED);
+    } else {
+        TEST_ASSERT(decrypt_ret == res);
+    }
 
 exit:
-    mbedtls_free( add );
-    mbedtls_ccm_free( &ctx );
+    mbedtls_free(add);
+    mbedtls_ccm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_AES_C */
-void ccm_star_lengths( int msg_len, int iv_len, int add_len, int tag_len,
-                       int res )
+void ccm_star_lengths(int msg_len, int iv_len, int add_len, int tag_len,
+                      int res)
 {
     mbedtls_ccm_context ctx;
     unsigned char key[16];
@@ -88,115 +89,115 @@
     unsigned char tag[18];
     int decrypt_ret;
 
-    mbedtls_ccm_init( &ctx );
+    mbedtls_ccm_init(&ctx);
 
-    memset( key, 0, sizeof( key ) );
-    memset( msg, 0, sizeof( msg ) );
-    memset( iv, 0, sizeof( iv ) );
-    memset( add, 0, sizeof( add ) );
-    memset( out, 0, sizeof( out ) );
-    memset( tag, 0, sizeof( tag ) );
+    memset(key, 0, sizeof(key));
+    memset(msg, 0, sizeof(msg));
+    memset(iv, 0, sizeof(iv));
+    memset(add, 0, sizeof(add));
+    memset(out, 0, sizeof(out));
+    memset(tag, 0, sizeof(tag));
 
-    TEST_ASSERT( mbedtls_ccm_setkey( &ctx, MBEDTLS_CIPHER_ID_AES,
-                                 key, 8 * sizeof( key ) ) == 0 );
+    TEST_ASSERT(mbedtls_ccm_setkey(&ctx, MBEDTLS_CIPHER_ID_AES,
+                                   key, 8 * sizeof(key)) == 0);
 
-    TEST_ASSERT( mbedtls_ccm_star_encrypt_and_tag( &ctx, msg_len, iv, iv_len,
-                 add, add_len, msg, out, tag, tag_len ) == res );
+    TEST_ASSERT(mbedtls_ccm_star_encrypt_and_tag(&ctx, msg_len, iv, iv_len,
+                                                 add, add_len, msg, out, tag, tag_len) == res);
 
-    decrypt_ret = mbedtls_ccm_star_auth_decrypt( &ctx, msg_len, iv, iv_len, add,
-                  add_len, msg, out, tag, tag_len );
+    decrypt_ret = mbedtls_ccm_star_auth_decrypt(&ctx, msg_len, iv, iv_len, add,
+                                                add_len, msg, out, tag, tag_len);
 
-    if( res == 0 && tag_len != 0 )
-        TEST_ASSERT( decrypt_ret == MBEDTLS_ERR_CCM_AUTH_FAILED );
-    else
-        TEST_ASSERT( decrypt_ret == res );
+    if (res == 0 && tag_len != 0) {
+        TEST_ASSERT(decrypt_ret == MBEDTLS_ERR_CCM_AUTH_FAILED);
+    } else {
+        TEST_ASSERT(decrypt_ret == res);
+    }
 
 exit:
-    mbedtls_ccm_free( &ctx );
+    mbedtls_ccm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_ccm_encrypt_and_tag( int cipher_id, data_t * key,
-                                  data_t * msg, data_t * iv,
-                                  data_t * add, data_t * result )
+void mbedtls_ccm_encrypt_and_tag(int cipher_id, data_t *key,
+                                 data_t *msg, data_t *iv,
+                                 data_t *add, data_t *result)
 {
     mbedtls_ccm_context ctx;
     size_t tag_len;
-    uint8_t * msg_n_tag = (uint8_t *)malloc( result->len + 2 );
+    uint8_t *msg_n_tag = (uint8_t *) malloc(result->len + 2);
 
-    mbedtls_ccm_init( &ctx );
+    mbedtls_ccm_init(&ctx);
 
-    memset( msg_n_tag, 0, result->len + 2 );
-    memcpy( msg_n_tag, msg->x, msg->len );
+    memset(msg_n_tag, 0, result->len + 2);
+    memcpy(msg_n_tag, msg->x, msg->len);
 
     tag_len = result->len - msg->len;
 
-    TEST_ASSERT( mbedtls_ccm_setkey( &ctx, cipher_id, key->x, key->len * 8 ) == 0 );
+    TEST_ASSERT(mbedtls_ccm_setkey(&ctx, cipher_id, key->x, key->len * 8) == 0);
 
     /* Test with input == output */
-    TEST_ASSERT( mbedtls_ccm_encrypt_and_tag( &ctx, msg->len, iv->x, iv->len, add->x, add->len,
-                 msg_n_tag, msg_n_tag, msg_n_tag + msg->len, tag_len ) == 0 );
+    TEST_ASSERT(mbedtls_ccm_encrypt_and_tag(&ctx, msg->len, iv->x, iv->len, add->x, add->len,
+                                            msg_n_tag, msg_n_tag, msg_n_tag + msg->len,
+                                            tag_len) == 0);
 
-    TEST_ASSERT( memcmp( msg_n_tag, result->x, result->len ) == 0 );
+    TEST_ASSERT(memcmp(msg_n_tag, result->x, result->len) == 0);
 
     /* Check we didn't write past the end */
-    TEST_ASSERT( msg_n_tag[result->len] == 0 && msg_n_tag[result->len + 1] == 0 );
+    TEST_ASSERT(msg_n_tag[result->len] == 0 && msg_n_tag[result->len + 1] == 0);
 
 exit:
-    mbedtls_ccm_free( &ctx );
-    free( msg_n_tag );
+    mbedtls_ccm_free(&ctx);
+    free(msg_n_tag);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_ccm_auth_decrypt( int cipher_id, data_t * key,
-                               data_t * msg, data_t * iv,
-                               data_t * add, int tag_len, int result,
-                               data_t * expected_msg )
+void mbedtls_ccm_auth_decrypt(int cipher_id, data_t *key,
+                              data_t *msg, data_t *iv,
+                              data_t *add, int tag_len, int result,
+                              data_t *expected_msg)
 {
     unsigned char tag[16];
     mbedtls_ccm_context ctx;
 
-    mbedtls_ccm_init( &ctx );
+    mbedtls_ccm_init(&ctx);
 
-    memset( tag, 0x00, sizeof( tag ) );
+    memset(tag, 0x00, sizeof(tag));
 
     msg->len -= tag_len;
-    memcpy( tag, msg->x + msg->len, tag_len );
+    memcpy(tag, msg->x + msg->len, tag_len);
 
-    TEST_ASSERT( mbedtls_ccm_setkey( &ctx, cipher_id, key->x, key->len * 8 ) == 0 );
+    TEST_ASSERT(mbedtls_ccm_setkey(&ctx, cipher_id, key->x, key->len * 8) == 0);
 
     /* Test with input == output */
-    TEST_ASSERT( mbedtls_ccm_auth_decrypt( &ctx, msg->len, iv->x, iv->len, add->x, add->len,
-                 msg->x, msg->x, msg->x + msg->len, tag_len ) == result );
+    TEST_ASSERT(mbedtls_ccm_auth_decrypt(&ctx, msg->len, iv->x, iv->len, add->x, add->len,
+                                         msg->x, msg->x, msg->x + msg->len, tag_len) == result);
 
-    if( result == 0 )
-    {
-        TEST_ASSERT( memcmp( msg->x, expected_msg->x, expected_msg->len ) == 0 );
-    }
-    else
-    {
+    if (result == 0) {
+        TEST_ASSERT(memcmp(msg->x, expected_msg->x, expected_msg->len) == 0);
+    } else {
         size_t i;
 
-        for( i = 0; i < msg->len; i++ )
-            TEST_ASSERT( msg->x[i] == 0 );
+        for (i = 0; i < msg->len; i++) {
+            TEST_ASSERT(msg->x[i] == 0);
+        }
     }
 
     /* Check we didn't write past the end (where the original tag is) */
-    TEST_ASSERT( memcmp( msg->x + msg->len, tag, tag_len ) == 0 );
+    TEST_ASSERT(memcmp(msg->x + msg->len, tag, tag_len) == 0);
 
 exit:
-    mbedtls_ccm_free( &ctx );
+    mbedtls_ccm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_ccm_star_encrypt_and_tag( int cipher_id,
-                            data_t *key, data_t *msg,
-                            data_t *source_address, data_t *frame_counter,
-                            int sec_level, data_t *add,
-                            data_t *expected_result, int output_ret )
+void mbedtls_ccm_star_encrypt_and_tag(int cipher_id,
+                                      data_t *key, data_t *msg,
+                                      data_t *source_address, data_t *frame_counter,
+                                      int sec_level, data_t *add,
+                                      data_t *expected_result, int output_ret)
 {
     unsigned char iv[13];
     unsigned char result[50];
@@ -204,49 +205,50 @@
     size_t iv_len, tag_len;
     int ret;
 
-    mbedtls_ccm_init( &ctx );
+    mbedtls_ccm_init(&ctx);
 
-    memset( result, 0x00, sizeof( result ) );
+    memset(result, 0x00, sizeof(result));
 
-    if( sec_level % 4 == 0)
+    if (sec_level % 4 == 0) {
         tag_len = 0;
-    else
-        tag_len = 1 << ( sec_level % 4 + 1);
+    } else {
+        tag_len = 1 << (sec_level % 4 + 1);
+    }
 
-    TEST_ASSERT( source_address->len == 8 );
-    TEST_ASSERT( frame_counter->len == 4 );
-    memcpy( iv, source_address->x, source_address->len );
-    memcpy( iv + source_address->len, frame_counter->x, frame_counter->len );
+    TEST_ASSERT(source_address->len == 8);
+    TEST_ASSERT(frame_counter->len == 4);
+    memcpy(iv, source_address->x, source_address->len);
+    memcpy(iv + source_address->len, frame_counter->x, frame_counter->len);
     iv[source_address->len + frame_counter->len] = sec_level;
-    iv_len = sizeof( iv );
+    iv_len = sizeof(iv);
 
-    TEST_ASSERT( mbedtls_ccm_setkey( &ctx, cipher_id,
-                                     key->x, key->len * 8 ) == 0 );
+    TEST_ASSERT(mbedtls_ccm_setkey(&ctx, cipher_id,
+                                   key->x, key->len * 8) == 0);
 
-    ret = mbedtls_ccm_star_encrypt_and_tag( &ctx, msg->len, iv, iv_len,
-                                            add->x, add->len, msg->x,
-                                            result, result + msg->len, tag_len );
+    ret = mbedtls_ccm_star_encrypt_and_tag(&ctx, msg->len, iv, iv_len,
+                                           add->x, add->len, msg->x,
+                                           result, result + msg->len, tag_len);
 
-    TEST_ASSERT( ret == output_ret );
+    TEST_ASSERT(ret == output_ret);
 
-    TEST_ASSERT( memcmp( result,
-                         expected_result->x, expected_result->len ) == 0 );
+    TEST_ASSERT(memcmp(result,
+                       expected_result->x, expected_result->len) == 0);
 
     /* Check we didn't write past the end */
-    TEST_ASSERT( result[expected_result->len] == 0 &&
-                 result[expected_result->len + 1] == 0 );
+    TEST_ASSERT(result[expected_result->len] == 0 &&
+                result[expected_result->len + 1] == 0);
 
 exit:
-    mbedtls_ccm_free( &ctx );
+    mbedtls_ccm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_ccm_star_auth_decrypt( int cipher_id,
-                            data_t *key, data_t *msg,
-                            data_t *source_address, data_t *frame_counter,
-                            int sec_level, data_t *add,
-                            data_t *expected_result, int output_ret )
+void mbedtls_ccm_star_auth_decrypt(int cipher_id,
+                                   data_t *key, data_t *msg,
+                                   data_t *source_address, data_t *frame_counter,
+                                   int sec_level, data_t *add,
+                                   data_t *expected_result, int output_ret)
 {
     unsigned char iv[13];
     unsigned char result[50];
@@ -254,46 +256,47 @@
     size_t iv_len, tag_len;
     int ret;
 
-    mbedtls_ccm_init( &ctx );
+    mbedtls_ccm_init(&ctx);
 
-    memset( iv, 0x00, sizeof( iv ) );
-    memset( result, '+', sizeof( result ) );
+    memset(iv, 0x00, sizeof(iv));
+    memset(result, '+', sizeof(result));
 
-    if( sec_level % 4 == 0)
+    if (sec_level % 4 == 0) {
         tag_len = 0;
-    else
-        tag_len = 1 << ( sec_level % 4 + 1);
+    } else {
+        tag_len = 1 << (sec_level % 4 + 1);
+    }
 
-    TEST_ASSERT( source_address->len == 8 );
-    TEST_ASSERT( frame_counter->len == 4 );
-    memcpy( iv, source_address->x, source_address->len );
-    memcpy( iv + source_address->len, frame_counter->x, frame_counter->len );
+    TEST_ASSERT(source_address->len == 8);
+    TEST_ASSERT(frame_counter->len == 4);
+    memcpy(iv, source_address->x, source_address->len);
+    memcpy(iv + source_address->len, frame_counter->x, frame_counter->len);
     iv[source_address->len + frame_counter->len] = sec_level;
-    iv_len = sizeof( iv );
+    iv_len = sizeof(iv);
 
-    TEST_ASSERT( mbedtls_ccm_setkey( &ctx, cipher_id, key->x, key->len * 8 ) == 0 );
+    TEST_ASSERT(mbedtls_ccm_setkey(&ctx, cipher_id, key->x, key->len * 8) == 0);
 
-    ret = mbedtls_ccm_star_auth_decrypt( &ctx, msg->len - tag_len, iv, iv_len,
-                                         add->x, add->len, msg->x, result,
-                                         msg->x + msg->len - tag_len, tag_len );
+    ret = mbedtls_ccm_star_auth_decrypt(&ctx, msg->len - tag_len, iv, iv_len,
+                                        add->x, add->len, msg->x, result,
+                                        msg->x + msg->len - tag_len, tag_len);
 
-    TEST_ASSERT( ret == output_ret );
+    TEST_ASSERT(ret == output_ret);
 
-    TEST_ASSERT( memcmp( result, expected_result->x,
-                                 expected_result->len ) == 0 );
+    TEST_ASSERT(memcmp(result, expected_result->x,
+                       expected_result->len) == 0);
 
     /* Check we didn't write past the end (where the original tag is) */
-    TEST_ASSERT( ( msg->len + 2 ) <= sizeof( result ) );
-    TEST_EQUAL( result[msg->len], '+' );
-    TEST_EQUAL( result[msg->len + 1], '+' );
+    TEST_ASSERT((msg->len + 2) <= sizeof(result));
+    TEST_EQUAL(result[msg->len], '+');
+    TEST_EQUAL(result[msg->len + 1], '+');
 
 exit:
-    mbedtls_ccm_free( &ctx );
+    mbedtls_ccm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void ccm_invalid_param( )
+void ccm_invalid_param()
 {
     struct mbedtls_ccm_context ctx;
     unsigned char valid_buffer[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
@@ -301,205 +304,205 @@
     int valid_len = sizeof(valid_buffer);
     int valid_bitlen = valid_len * 8;
 
-    mbedtls_ccm_init( &ctx );
+    mbedtls_ccm_init(&ctx);
 
     /* mbedtls_ccm_init() */
-    TEST_INVALID_PARAM( mbedtls_ccm_init( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_ccm_init(NULL));
 
     /* mbedtls_ccm_setkey() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_setkey( NULL, valid_cipher, valid_buffer, valid_bitlen ) );
+        mbedtls_ccm_setkey(NULL, valid_cipher, valid_buffer, valid_bitlen));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_setkey( &ctx, valid_cipher, NULL, valid_bitlen ) );
+        mbedtls_ccm_setkey(&ctx, valid_cipher, NULL, valid_bitlen));
 
     /* mbedtls_ccm_encrypt_and_tag() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_encrypt_and_tag( NULL, valid_len,
-                                     valid_buffer, valid_len,
-                                     valid_buffer, valid_len,
-                                     valid_buffer, valid_buffer,
-                                     valid_buffer, valid_len ) );
+        mbedtls_ccm_encrypt_and_tag(NULL, valid_len,
+                                    valid_buffer, valid_len,
+                                    valid_buffer, valid_len,
+                                    valid_buffer, valid_buffer,
+                                    valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_encrypt_and_tag( &ctx, valid_len,
-                                     NULL, valid_len,
-                                     valid_buffer, valid_len,
-                                     valid_buffer, valid_buffer,
-                                     valid_buffer, valid_len ) );
+        mbedtls_ccm_encrypt_and_tag(&ctx, valid_len,
+                                    NULL, valid_len,
+                                    valid_buffer, valid_len,
+                                    valid_buffer, valid_buffer,
+                                    valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_encrypt_and_tag( &ctx, valid_len,
-                                     valid_buffer, valid_len,
-                                     NULL, valid_len,
-                                     valid_buffer, valid_buffer,
-                                     valid_buffer, valid_len ) );
+        mbedtls_ccm_encrypt_and_tag(&ctx, valid_len,
+                                    valid_buffer, valid_len,
+                                    NULL, valid_len,
+                                    valid_buffer, valid_buffer,
+                                    valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_encrypt_and_tag( &ctx, valid_len,
-                                     valid_buffer, valid_len,
-                                     valid_buffer, valid_len,
-                                     NULL, valid_buffer,
-                                     valid_buffer, valid_len ) );
+        mbedtls_ccm_encrypt_and_tag(&ctx, valid_len,
+                                    valid_buffer, valid_len,
+                                    valid_buffer, valid_len,
+                                    NULL, valid_buffer,
+                                    valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_encrypt_and_tag( &ctx, valid_len,
-                                     valid_buffer, valid_len,
-                                     valid_buffer, valid_len,
-                                     valid_buffer, NULL,
-                                     valid_buffer, valid_len ) );
+        mbedtls_ccm_encrypt_and_tag(&ctx, valid_len,
+                                    valid_buffer, valid_len,
+                                    valid_buffer, valid_len,
+                                    valid_buffer, NULL,
+                                    valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_encrypt_and_tag( &ctx, valid_len,
-                                     valid_buffer, valid_len,
-                                     valid_buffer, valid_len,
-                                     valid_buffer, valid_buffer,
-                                     NULL, valid_len ) );
+        mbedtls_ccm_encrypt_and_tag(&ctx, valid_len,
+                                    valid_buffer, valid_len,
+                                    valid_buffer, valid_len,
+                                    valid_buffer, valid_buffer,
+                                    NULL, valid_len));
 
     /* mbedtls_ccm_star_encrypt_and_tag() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_star_encrypt_and_tag( NULL, valid_len,
-                                          valid_buffer, valid_len,
-                                          valid_buffer, valid_len,
-                                          valid_buffer, valid_buffer,
-                                          valid_buffer, valid_len) );
+        mbedtls_ccm_star_encrypt_and_tag(NULL, valid_len,
+                                         valid_buffer, valid_len,
+                                         valid_buffer, valid_len,
+                                         valid_buffer, valid_buffer,
+                                         valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_star_encrypt_and_tag( &ctx, valid_len,
-                                          NULL, valid_len,
-                                          valid_buffer, valid_len,
-                                          valid_buffer, valid_buffer,
-                                          valid_buffer, valid_len ) );
+        mbedtls_ccm_star_encrypt_and_tag(&ctx, valid_len,
+                                         NULL, valid_len,
+                                         valid_buffer, valid_len,
+                                         valid_buffer, valid_buffer,
+                                         valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_star_encrypt_and_tag( &ctx, valid_len,
-                                          valid_buffer, valid_len,
-                                          NULL, valid_len,
-                                          valid_buffer, valid_buffer,
-                                          valid_buffer, valid_len ) );
+        mbedtls_ccm_star_encrypt_and_tag(&ctx, valid_len,
+                                         valid_buffer, valid_len,
+                                         NULL, valid_len,
+                                         valid_buffer, valid_buffer,
+                                         valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_star_encrypt_and_tag( &ctx, valid_len,
-                                          valid_buffer, valid_len,
-                                          valid_buffer, valid_len,
-                                          NULL, valid_buffer,
-                                          valid_buffer, valid_len ) );
+        mbedtls_ccm_star_encrypt_and_tag(&ctx, valid_len,
+                                         valid_buffer, valid_len,
+                                         valid_buffer, valid_len,
+                                         NULL, valid_buffer,
+                                         valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_star_encrypt_and_tag( &ctx, valid_len,
-                                          valid_buffer, valid_len,
-                                          valid_buffer, valid_len,
-                                          valid_buffer, NULL,
-                                          valid_buffer, valid_len ) );
+        mbedtls_ccm_star_encrypt_and_tag(&ctx, valid_len,
+                                         valid_buffer, valid_len,
+                                         valid_buffer, valid_len,
+                                         valid_buffer, NULL,
+                                         valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_star_encrypt_and_tag( &ctx, valid_len,
-                                          valid_buffer, valid_len,
-                                          valid_buffer, valid_len,
-                                          valid_buffer, valid_buffer,
-                                          NULL, valid_len ) );
+        mbedtls_ccm_star_encrypt_and_tag(&ctx, valid_len,
+                                         valid_buffer, valid_len,
+                                         valid_buffer, valid_len,
+                                         valid_buffer, valid_buffer,
+                                         NULL, valid_len));
 
     /* mbedtls_ccm_auth_decrypt() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_auth_decrypt( NULL, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_buffer,
-                                  valid_buffer, valid_len ) );
+        mbedtls_ccm_auth_decrypt(NULL, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_buffer,
+                                 valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_auth_decrypt( &ctx, valid_len,
-                                  NULL, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_buffer,
-                                  valid_buffer, valid_len ) );
+        mbedtls_ccm_auth_decrypt(&ctx, valid_len,
+                                 NULL, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_buffer,
+                                 valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_auth_decrypt( &ctx, valid_len,
-                                  valid_buffer, valid_len,
-                                  NULL, valid_len,
-                                  valid_buffer, valid_buffer,
-                                  valid_buffer, valid_len ) );
+        mbedtls_ccm_auth_decrypt(&ctx, valid_len,
+                                 valid_buffer, valid_len,
+                                 NULL, valid_len,
+                                 valid_buffer, valid_buffer,
+                                 valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_auth_decrypt( &ctx, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_len,
-                                  NULL, valid_buffer,
-                                  valid_buffer, valid_len ) );
+        mbedtls_ccm_auth_decrypt(&ctx, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_len,
+                                 NULL, valid_buffer,
+                                 valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_auth_decrypt( &ctx, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, NULL,
-                                  valid_buffer, valid_len ) );
+        mbedtls_ccm_auth_decrypt(&ctx, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, NULL,
+                                 valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_auth_decrypt( &ctx, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_buffer,
-                                  NULL, valid_len ) );
+        mbedtls_ccm_auth_decrypt(&ctx, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_buffer,
+                                 NULL, valid_len));
 
     /* mbedtls_ccm_star_auth_decrypt() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_star_auth_decrypt( NULL, valid_len,
-                                       valid_buffer, valid_len,
-                                       valid_buffer, valid_len,
-                                       valid_buffer, valid_buffer,
-                                       valid_buffer, valid_len ) );
+        mbedtls_ccm_star_auth_decrypt(NULL, valid_len,
+                                      valid_buffer, valid_len,
+                                      valid_buffer, valid_len,
+                                      valid_buffer, valid_buffer,
+                                      valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_star_auth_decrypt( &ctx, valid_len,
-                                       NULL, valid_len,
-                                       valid_buffer, valid_len,
-                                       valid_buffer, valid_buffer,
-                                       valid_buffer, valid_len ) );
+        mbedtls_ccm_star_auth_decrypt(&ctx, valid_len,
+                                      NULL, valid_len,
+                                      valid_buffer, valid_len,
+                                      valid_buffer, valid_buffer,
+                                      valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_star_auth_decrypt( &ctx, valid_len,
-                                       valid_buffer, valid_len,
-                                       NULL, valid_len,
-                                       valid_buffer, valid_buffer,
-                                       valid_buffer, valid_len ) );
+        mbedtls_ccm_star_auth_decrypt(&ctx, valid_len,
+                                      valid_buffer, valid_len,
+                                      NULL, valid_len,
+                                      valid_buffer, valid_buffer,
+                                      valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_star_auth_decrypt( &ctx, valid_len,
-                                       valid_buffer, valid_len,
-                                       valid_buffer, valid_len,
-                                       NULL, valid_buffer,
-                                       valid_buffer, valid_len ) );
+        mbedtls_ccm_star_auth_decrypt(&ctx, valid_len,
+                                      valid_buffer, valid_len,
+                                      valid_buffer, valid_len,
+                                      NULL, valid_buffer,
+                                      valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_star_auth_decrypt( &ctx, valid_len,
-                                       valid_buffer, valid_len,
-                                       valid_buffer, valid_len,
-                                       valid_buffer, NULL,
-                                       valid_buffer, valid_len ) );
+        mbedtls_ccm_star_auth_decrypt(&ctx, valid_len,
+                                      valid_buffer, valid_len,
+                                      valid_buffer, valid_len,
+                                      valid_buffer, NULL,
+                                      valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CCM_BAD_INPUT,
-        mbedtls_ccm_star_auth_decrypt( &ctx, valid_len,
-                                       valid_buffer, valid_len,
-                                       valid_buffer, valid_len,
-                                       valid_buffer, valid_buffer,
-                                       NULL, valid_len ) );
+        mbedtls_ccm_star_auth_decrypt(&ctx, valid_len,
+                                      valid_buffer, valid_len,
+                                      valid_buffer, valid_len,
+                                      valid_buffer, valid_buffer,
+                                      NULL, valid_len));
 
 exit:
-    mbedtls_ccm_free( &ctx );
+    mbedtls_ccm_free(&ctx);
     return;
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ccm_valid_param( )
+void ccm_valid_param()
 {
-    TEST_VALID_PARAM( mbedtls_ccm_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_ccm_free(NULL));
 exit:
     return;
 }
diff --git a/tests/suites/test_suite_chacha20.function b/tests/suites/test_suite_chacha20.function
index 67c8de2..7f49561 100644
--- a/tests/suites/test_suite_chacha20.function
+++ b/tests/suites/test_suite_chacha20.function
@@ -8,43 +8,44 @@
  */
 
 /* BEGIN_CASE */
-void chacha20_crypt( data_t *key_str,
-                     data_t *nonce_str,
-                     int counter,
-                     data_t *src_str,
-                     data_t *expected_output_str )
+void chacha20_crypt(data_t *key_str,
+                    data_t *nonce_str,
+                    int counter,
+                    data_t *src_str,
+                    data_t *expected_output_str)
 {
     unsigned char output[375];
     mbedtls_chacha20_context ctx;
 
-    memset( output, 0x00, sizeof( output ) );
+    memset(output, 0x00, sizeof(output));
 
-    TEST_ASSERT( src_str->len   == expected_output_str->len );
-    TEST_ASSERT( key_str->len   == 32U );
-    TEST_ASSERT( nonce_str->len == 12U );
+    TEST_ASSERT(src_str->len   == expected_output_str->len);
+    TEST_ASSERT(key_str->len   == 32U);
+    TEST_ASSERT(nonce_str->len == 12U);
 
     /*
      * Test the integrated API
      */
-    TEST_ASSERT( mbedtls_chacha20_crypt( key_str->x, nonce_str->x, counter, src_str->len, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_chacha20_crypt(key_str->x, nonce_str->x, counter, src_str->len, src_str->x,
+                                       output) == 0);
 
-    ASSERT_COMPARE( output, expected_output_str->len,
-                    expected_output_str->x, expected_output_str->len );
+    ASSERT_COMPARE(output, expected_output_str->len,
+                   expected_output_str->x, expected_output_str->len);
 
     /*
      * Test the streaming API
      */
-    mbedtls_chacha20_init( &ctx );
+    mbedtls_chacha20_init(&ctx);
 
-    TEST_ASSERT( mbedtls_chacha20_setkey( &ctx, key_str->x ) == 0 );
+    TEST_ASSERT(mbedtls_chacha20_setkey(&ctx, key_str->x) == 0);
 
-    TEST_ASSERT( mbedtls_chacha20_starts( &ctx, nonce_str->x, counter ) == 0 );
+    TEST_ASSERT(mbedtls_chacha20_starts(&ctx, nonce_str->x, counter) == 0);
 
-    memset( output, 0x00, sizeof( output ) );
-    TEST_ASSERT( mbedtls_chacha20_update( &ctx, src_str->len, src_str->x, output ) == 0 );
+    memset(output, 0x00, sizeof(output));
+    TEST_ASSERT(mbedtls_chacha20_update(&ctx, src_str->len, src_str->x, output) == 0);
 
-    ASSERT_COMPARE( output, expected_output_str->len,
-                    expected_output_str->x, expected_output_str->len );
+    ASSERT_COMPARE(output, expected_output_str->len,
+                   expected_output_str->x, expected_output_str->len);
 
     /*
      * Test the streaming API again, piecewise
@@ -52,17 +53,17 @@
 
     /* Don't free/init the context nor set the key again,
      * in order to test that starts() does the right thing. */
-    TEST_ASSERT( mbedtls_chacha20_starts( &ctx, nonce_str->x, counter ) == 0 );
+    TEST_ASSERT(mbedtls_chacha20_starts(&ctx, nonce_str->x, counter) == 0);
 
-    memset( output, 0x00, sizeof( output ) );
-    TEST_ASSERT( mbedtls_chacha20_update( &ctx, 1, src_str->x, output ) == 0 );
-    TEST_ASSERT( mbedtls_chacha20_update( &ctx, src_str->len - 1,
-                                          src_str->x + 1, output + 1 ) == 0 );
+    memset(output, 0x00, sizeof(output));
+    TEST_ASSERT(mbedtls_chacha20_update(&ctx, 1, src_str->x, output) == 0);
+    TEST_ASSERT(mbedtls_chacha20_update(&ctx, src_str->len - 1,
+                                        src_str->x + 1, output + 1) == 0);
 
-    ASSERT_COMPARE( output, expected_output_str->len,
-                    expected_output_str->x, expected_output_str->len );
+    ASSERT_COMPARE(output, expected_output_str->len,
+                   expected_output_str->x, expected_output_str->len);
 
-    mbedtls_chacha20_free( &ctx );
+    mbedtls_chacha20_free(&ctx);
 }
 /* END_CASE */
 
@@ -74,37 +75,37 @@
     unsigned char src[1];
     unsigned char dst[1];
     uint32_t counter = 0;
-    size_t len = sizeof( src );
+    size_t len = sizeof(src);
     mbedtls_chacha20_context ctx;
 
-    TEST_INVALID_PARAM( mbedtls_chacha20_init( NULL ) );
-    TEST_VALID_PARAM( mbedtls_chacha20_free( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_chacha20_init(NULL));
+    TEST_VALID_PARAM(mbedtls_chacha20_free(NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
-                            mbedtls_chacha20_setkey( NULL, key ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
-                            mbedtls_chacha20_setkey( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
+                           mbedtls_chacha20_setkey(NULL, key));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
+                           mbedtls_chacha20_setkey(&ctx, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
-                            mbedtls_chacha20_starts( NULL, nonce, counter ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
-                            mbedtls_chacha20_starts( &ctx, NULL, counter ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
+                           mbedtls_chacha20_starts(NULL, nonce, counter));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
+                           mbedtls_chacha20_starts(&ctx, NULL, counter));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
-                            mbedtls_chacha20_update( NULL, 0, src, dst ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
-                            mbedtls_chacha20_update( &ctx, len, NULL, dst ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
-                            mbedtls_chacha20_update( &ctx, len, src, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
+                           mbedtls_chacha20_update(NULL, 0, src, dst));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
+                           mbedtls_chacha20_update(&ctx, len, NULL, dst));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
+                           mbedtls_chacha20_update(&ctx, len, src, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
-                            mbedtls_chacha20_crypt( NULL, nonce, counter, 0, src, dst ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
-                            mbedtls_chacha20_crypt( key, NULL, counter, 0, src, dst ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
-                            mbedtls_chacha20_crypt( key, nonce, counter, len, NULL, dst ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
-                            mbedtls_chacha20_crypt( key, nonce, counter, len, src, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
+                           mbedtls_chacha20_crypt(NULL, nonce, counter, 0, src, dst));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
+                           mbedtls_chacha20_crypt(key, NULL, counter, 0, src, dst));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
+                           mbedtls_chacha20_crypt(key, nonce, counter, len, NULL, dst));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA,
+                           mbedtls_chacha20_crypt(key, nonce, counter, len, src, NULL));
 
 exit:
     return;
@@ -115,6 +116,6 @@
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
 void chacha20_self_test()
 {
-    TEST_ASSERT( mbedtls_chacha20_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_chacha20_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_chachapoly.function b/tests/suites/test_suite_chachapoly.function
index 96128e4..906e3f5 100644
--- a/tests/suites/test_suite_chachapoly.function
+++ b/tests/suites/test_suite_chachapoly.function
@@ -8,61 +8,71 @@
  */
 
 /* BEGIN_CASE */
-void mbedtls_chachapoly_enc( data_t *key_str, data_t *nonce_str, data_t *aad_str, data_t *input_str, data_t *output_str, data_t *mac_str )
+void mbedtls_chachapoly_enc(data_t *key_str,
+                            data_t *nonce_str,
+                            data_t *aad_str,
+                            data_t *input_str,
+                            data_t *output_str,
+                            data_t *mac_str)
 {
     unsigned char output[265];
     unsigned char mac[16]; /* size set by the standard */
     mbedtls_chachapoly_context ctx;
 
-    TEST_ASSERT( key_str->len   == 32 );
-    TEST_ASSERT( nonce_str->len == 12 );
-    TEST_ASSERT( mac_str->len   == 16 );
+    TEST_ASSERT(key_str->len   == 32);
+    TEST_ASSERT(nonce_str->len == 12);
+    TEST_ASSERT(mac_str->len   == 16);
 
-    mbedtls_chachapoly_init( &ctx );
+    mbedtls_chachapoly_init(&ctx);
 
-    TEST_ASSERT( mbedtls_chachapoly_setkey( &ctx, key_str->x ) == 0 );
+    TEST_ASSERT(mbedtls_chachapoly_setkey(&ctx, key_str->x) == 0);
 
-    TEST_ASSERT( mbedtls_chachapoly_encrypt_and_tag( &ctx,
-                                      input_str->len, nonce_str->x,
-                                      aad_str->x, aad_str->len,
-                                      input_str->x, output, mac ) == 0 );
+    TEST_ASSERT(mbedtls_chachapoly_encrypt_and_tag(&ctx,
+                                                   input_str->len, nonce_str->x,
+                                                   aad_str->x, aad_str->len,
+                                                   input_str->x, output, mac) == 0);
 
-    TEST_ASSERT( memcmp( output_str->x, output, output_str->len ) == 0 );
-    TEST_ASSERT( memcmp( mac_str->x, mac, 16U ) == 0 );
+    TEST_ASSERT(memcmp(output_str->x, output, output_str->len) == 0);
+    TEST_ASSERT(memcmp(mac_str->x, mac, 16U) == 0);
 
 exit:
-    mbedtls_chachapoly_free( &ctx );
+    mbedtls_chachapoly_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_chachapoly_dec( data_t *key_str, data_t *nonce_str, data_t *aad_str, data_t *input_str, data_t *output_str, data_t *mac_str, int ret_exp )
+void mbedtls_chachapoly_dec(data_t *key_str,
+                            data_t *nonce_str,
+                            data_t *aad_str,
+                            data_t *input_str,
+                            data_t *output_str,
+                            data_t *mac_str,
+                            int ret_exp)
 {
     unsigned char output[265];
     int ret;
     mbedtls_chachapoly_context ctx;
 
-    TEST_ASSERT( key_str->len   == 32 );
-    TEST_ASSERT( nonce_str->len == 12 );
-    TEST_ASSERT( mac_str->len   == 16 );
+    TEST_ASSERT(key_str->len   == 32);
+    TEST_ASSERT(nonce_str->len == 12);
+    TEST_ASSERT(mac_str->len   == 16);
 
-    mbedtls_chachapoly_init( &ctx );
+    mbedtls_chachapoly_init(&ctx);
 
-    TEST_ASSERT( mbedtls_chachapoly_setkey( &ctx, key_str->x ) == 0 );
+    TEST_ASSERT(mbedtls_chachapoly_setkey(&ctx, key_str->x) == 0);
 
-    ret = mbedtls_chachapoly_auth_decrypt( &ctx,
-                                           input_str->len, nonce_str->x,
-                                           aad_str->x, aad_str->len,
-                                           mac_str->x, input_str->x, output );
+    ret = mbedtls_chachapoly_auth_decrypt(&ctx,
+                                          input_str->len, nonce_str->x,
+                                          aad_str->x, aad_str->len,
+                                          mac_str->x, input_str->x, output);
 
-    TEST_ASSERT( ret == ret_exp );
-    if( ret_exp == 0 )
-    {
-        TEST_ASSERT( memcmp( output_str->x, output, output_str->len ) == 0 );
+    TEST_ASSERT(ret == ret_exp);
+    if (ret_exp == 0) {
+        TEST_ASSERT(memcmp(output_str->x, output, output_str->len) == 0);
     }
 
 exit:
-    mbedtls_chachapoly_free( &ctx );
+    mbedtls_chachapoly_free(&ctx);
 }
 /* END_CASE */
 
@@ -75,122 +85,122 @@
     unsigned char input[1];
     unsigned char output[1];
     unsigned char mac[16];
-    size_t input_len = sizeof( input );
-    size_t aad_len = sizeof( aad );
+    size_t input_len = sizeof(input);
+    size_t aad_len = sizeof(aad);
     mbedtls_chachapoly_context ctx;
 
-    memset( key,    0x00, sizeof( key ) );
-    memset( nonce,  0x00, sizeof( nonce ) );
-    memset( aad,    0x00, sizeof( aad ) );
-    memset( input,  0x00, sizeof( input ) );
-    memset( output, 0x00, sizeof( output ) );
-    memset( mac,    0x00, sizeof( mac ) );
+    memset(key,    0x00, sizeof(key));
+    memset(nonce,  0x00, sizeof(nonce));
+    memset(aad,    0x00, sizeof(aad));
+    memset(input,  0x00, sizeof(input));
+    memset(output, 0x00, sizeof(output));
+    memset(mac,    0x00, sizeof(mac));
 
-    TEST_INVALID_PARAM( mbedtls_chachapoly_init( NULL ) );
-    TEST_VALID_PARAM( mbedtls_chachapoly_free( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_chachapoly_init(NULL));
+    TEST_VALID_PARAM(mbedtls_chachapoly_free(NULL));
 
     /* setkey */
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_setkey( NULL, key ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_setkey( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_setkey(NULL, key));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_setkey(&ctx, NULL));
 
     /* encrypt_and_tag */
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_encrypt_and_tag( NULL,
-                                      0, nonce,
-                                      aad, 0,
-                                      input, output, mac ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_encrypt_and_tag( &ctx,
-                                      0, NULL,
-                                      aad, 0,
-                                      input, output, mac ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_encrypt_and_tag( &ctx,
-                                      0, nonce,
-                                      NULL, aad_len,
-                                      input, output, mac ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_encrypt_and_tag( &ctx,
-                                      input_len, nonce,
-                                      aad, 0,
-                                      NULL, output, mac ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_encrypt_and_tag( &ctx,
-                                      input_len, nonce,
-                                      aad, 0,
-                                      input, NULL, mac ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_encrypt_and_tag( &ctx,
-                                      0, nonce,
-                                      aad, 0,
-                                      input, output, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_encrypt_and_tag(NULL,
+                                                              0, nonce,
+                                                              aad, 0,
+                                                              input, output, mac));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_encrypt_and_tag(&ctx,
+                                                              0, NULL,
+                                                              aad, 0,
+                                                              input, output, mac));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_encrypt_and_tag(&ctx,
+                                                              0, nonce,
+                                                              NULL, aad_len,
+                                                              input, output, mac));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_encrypt_and_tag(&ctx,
+                                                              input_len, nonce,
+                                                              aad, 0,
+                                                              NULL, output, mac));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_encrypt_and_tag(&ctx,
+                                                              input_len, nonce,
+                                                              aad, 0,
+                                                              input, NULL, mac));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_encrypt_and_tag(&ctx,
+                                                              0, nonce,
+                                                              aad, 0,
+                                                              input, output, NULL));
 
     /* auth_decrypt */
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_auth_decrypt( NULL,
-                                           0, nonce,
-                                           aad, 0,
-                                           mac, input, output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_auth_decrypt( &ctx,
-                                           0, NULL,
-                                           aad, 0,
-                                           mac, input, output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_auth_decrypt( &ctx,
-                                           0, nonce,
-                                           NULL, aad_len,
-                                           mac, input, output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_auth_decrypt( &ctx,
-                                           0, nonce,
-                                           aad, 0,
-                                           NULL, input, output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_auth_decrypt( &ctx,
-                                           input_len, nonce,
-                                           aad, 0,
-                                           mac, NULL, output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_auth_decrypt( &ctx,
-                                           input_len, nonce,
-                                           aad, 0,
-                                           mac, input, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_auth_decrypt(NULL,
+                                                           0, nonce,
+                                                           aad, 0,
+                                                           mac, input, output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_auth_decrypt(&ctx,
+                                                           0, NULL,
+                                                           aad, 0,
+                                                           mac, input, output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_auth_decrypt(&ctx,
+                                                           0, nonce,
+                                                           NULL, aad_len,
+                                                           mac, input, output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_auth_decrypt(&ctx,
+                                                           0, nonce,
+                                                           aad, 0,
+                                                           NULL, input, output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_auth_decrypt(&ctx,
+                                                           input_len, nonce,
+                                                           aad, 0,
+                                                           mac, NULL, output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_auth_decrypt(&ctx,
+                                                           input_len, nonce,
+                                                           aad, 0,
+                                                           mac, input, NULL));
 
     /* starts */
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_starts( NULL, nonce,
-                                               MBEDTLS_CHACHAPOLY_ENCRYPT ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_starts( &ctx, NULL,
-                                               MBEDTLS_CHACHAPOLY_ENCRYPT ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_starts(NULL, nonce,
+                                                     MBEDTLS_CHACHAPOLY_ENCRYPT));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_starts(&ctx, NULL,
+                                                     MBEDTLS_CHACHAPOLY_ENCRYPT));
 
     /* update_aad */
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_update_aad( NULL, aad,
-                                                           aad_len ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_update_aad( &ctx, NULL,
-                                                           aad_len ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_update_aad(NULL, aad,
+                                                         aad_len));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_update_aad(&ctx, NULL,
+                                                         aad_len));
 
     /* update */
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_update( NULL, input_len,
-                                                       input, output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_update( &ctx, input_len,
-                                                       NULL, output ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_update( &ctx, input_len,
-                                                       input, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_update(NULL, input_len,
+                                                     input, output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_update(&ctx, input_len,
+                                                     NULL, output));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_update(&ctx, input_len,
+                                                     input, NULL));
 
     /* finish */
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_finish( NULL, mac ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                            mbedtls_chachapoly_finish( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_finish(NULL, mac));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_chachapoly_finish(&ctx, NULL));
 
 exit:
     return;
@@ -206,80 +216,80 @@
     unsigned char input[1];
     unsigned char output[1];
     unsigned char mac[16];
-    size_t input_len = sizeof( input );
-    size_t aad_len = sizeof( aad );
+    size_t input_len = sizeof(input);
+    size_t aad_len = sizeof(aad);
     mbedtls_chachapoly_context ctx;
 
-    memset( key,    0x00, sizeof( key ) );
-    memset( nonce,  0x00, sizeof( nonce ) );
-    memset( aad,    0x00, sizeof( aad ) );
-    memset( input,  0x00, sizeof( input ) );
-    memset( output, 0x00, sizeof( output ) );
-    memset( mac,    0x00, sizeof( mac ) );
+    memset(key,    0x00, sizeof(key));
+    memset(nonce,  0x00, sizeof(nonce));
+    memset(aad,    0x00, sizeof(aad));
+    memset(input,  0x00, sizeof(input));
+    memset(output, 0x00, sizeof(output));
+    memset(mac,    0x00, sizeof(mac));
 
     /* Initial state: finish, update, update_aad forbidden */
-    mbedtls_chachapoly_init( &ctx );
+    mbedtls_chachapoly_init(&ctx);
 
-    TEST_ASSERT( mbedtls_chachapoly_finish( &ctx, mac )
-                 == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE );
-    TEST_ASSERT( mbedtls_chachapoly_update( &ctx, input_len, input, output )
-                 == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE );
-    TEST_ASSERT( mbedtls_chachapoly_update_aad( &ctx, aad, aad_len )
-                 == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE );
+    TEST_ASSERT(mbedtls_chachapoly_finish(&ctx, mac)
+                == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE);
+    TEST_ASSERT(mbedtls_chachapoly_update(&ctx, input_len, input, output)
+                == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE);
+    TEST_ASSERT(mbedtls_chachapoly_update_aad(&ctx, aad, aad_len)
+                == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE);
 
     /* Still initial state: finish, update, update_aad forbidden */
-    TEST_ASSERT( mbedtls_chachapoly_setkey( &ctx, key )
-                 == 0 );
+    TEST_ASSERT(mbedtls_chachapoly_setkey(&ctx, key)
+                == 0);
 
-    TEST_ASSERT( mbedtls_chachapoly_finish( &ctx, mac )
-                 == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE );
-    TEST_ASSERT( mbedtls_chachapoly_update( &ctx, input_len, input, output )
-                 == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE );
-    TEST_ASSERT( mbedtls_chachapoly_update_aad( &ctx, aad, aad_len )
-                 == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE );
+    TEST_ASSERT(mbedtls_chachapoly_finish(&ctx, mac)
+                == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE);
+    TEST_ASSERT(mbedtls_chachapoly_update(&ctx, input_len, input, output)
+                == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE);
+    TEST_ASSERT(mbedtls_chachapoly_update_aad(&ctx, aad, aad_len)
+                == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE);
 
     /* Starts -> finish OK */
-    TEST_ASSERT( mbedtls_chachapoly_starts( &ctx, nonce, MBEDTLS_CHACHAPOLY_ENCRYPT )
-                 == 0 );
-    TEST_ASSERT( mbedtls_chachapoly_finish( &ctx, mac )
-                 == 0 );
+    TEST_ASSERT(mbedtls_chachapoly_starts(&ctx, nonce, MBEDTLS_CHACHAPOLY_ENCRYPT)
+                == 0);
+    TEST_ASSERT(mbedtls_chachapoly_finish(&ctx, mac)
+                == 0);
 
     /* After finish: update, update_aad forbidden */
-    TEST_ASSERT( mbedtls_chachapoly_update( &ctx, input_len, input, output )
-                 == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE );
-    TEST_ASSERT( mbedtls_chachapoly_update_aad( &ctx, aad, aad_len )
-                 == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE );
+    TEST_ASSERT(mbedtls_chachapoly_update(&ctx, input_len, input, output)
+                == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE);
+    TEST_ASSERT(mbedtls_chachapoly_update_aad(&ctx, aad, aad_len)
+                == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE);
 
     /* Starts -> update* OK */
-    TEST_ASSERT( mbedtls_chachapoly_starts( &ctx, nonce, MBEDTLS_CHACHAPOLY_ENCRYPT )
-                 == 0 );
-    TEST_ASSERT( mbedtls_chachapoly_update( &ctx, input_len, input, output )
-                 == 0 );
-    TEST_ASSERT( mbedtls_chachapoly_update( &ctx, input_len, input, output )
-                 == 0 );
+    TEST_ASSERT(mbedtls_chachapoly_starts(&ctx, nonce, MBEDTLS_CHACHAPOLY_ENCRYPT)
+                == 0);
+    TEST_ASSERT(mbedtls_chachapoly_update(&ctx, input_len, input, output)
+                == 0);
+    TEST_ASSERT(mbedtls_chachapoly_update(&ctx, input_len, input, output)
+                == 0);
 
     /* After update: update_aad forbidden */
-    TEST_ASSERT( mbedtls_chachapoly_update_aad( &ctx, aad, aad_len )
-                 == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE );
+    TEST_ASSERT(mbedtls_chachapoly_update_aad(&ctx, aad, aad_len)
+                == MBEDTLS_ERR_CHACHAPOLY_BAD_STATE);
 
     /* Starts -> update_aad* -> finish OK */
-    TEST_ASSERT( mbedtls_chachapoly_starts( &ctx, nonce, MBEDTLS_CHACHAPOLY_ENCRYPT )
-                 == 0 );
-    TEST_ASSERT( mbedtls_chachapoly_update_aad( &ctx, aad, aad_len )
-                 == 0 );
-    TEST_ASSERT( mbedtls_chachapoly_update_aad( &ctx, aad, aad_len )
-                 == 0 );
-    TEST_ASSERT( mbedtls_chachapoly_finish( &ctx, mac )
-                 == 0 );
+    TEST_ASSERT(mbedtls_chachapoly_starts(&ctx, nonce, MBEDTLS_CHACHAPOLY_ENCRYPT)
+                == 0);
+    TEST_ASSERT(mbedtls_chachapoly_update_aad(&ctx, aad, aad_len)
+                == 0);
+    TEST_ASSERT(mbedtls_chachapoly_update_aad(&ctx, aad, aad_len)
+                == 0);
+    TEST_ASSERT(mbedtls_chachapoly_finish(&ctx, mac)
+                == 0);
 
 exit:
-    mbedtls_chachapoly_free( &ctx );
+    mbedtls_chachapoly_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
 void chachapoly_selftest()
 {
-    TEST_ASSERT( mbedtls_chachapoly_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_chachapoly_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_cipher.function b/tests/suites/test_suite_cipher.function
index 4fe54c0..ef9ff0a 100644
--- a/tests/suites/test_suite_cipher.function
+++ b/tests/suites/test_suite_cipher.function
@@ -20,35 +20,33 @@
  * individual ciphers, and it doesn't work with the PSA wrappers. So don't do
  * it, and instead start with a fresh context.
  */
-static int cipher_reset_key( mbedtls_cipher_context_t *ctx, int cipher_id,
-        int use_psa, size_t tag_len, const data_t *key, int direction )
+static int cipher_reset_key(mbedtls_cipher_context_t *ctx, int cipher_id,
+                            int use_psa, size_t tag_len, const data_t *key, int direction)
 {
-    mbedtls_cipher_free( ctx );
-    mbedtls_cipher_init( ctx );
+    mbedtls_cipher_free(ctx);
+    mbedtls_cipher_init(ctx);
 
 #if !defined(MBEDTLS_USE_PSA_CRYPTO)
     (void) use_psa;
     (void) tag_len;
 #else
-    if( use_psa == 1 )
-    {
-        TEST_ASSERT( 0 == mbedtls_cipher_setup_psa( ctx,
-                              mbedtls_cipher_info_from_type( cipher_id ),
-                              tag_len ) );
-    }
-    else
+    if (use_psa == 1) {
+        TEST_ASSERT(0 == mbedtls_cipher_setup_psa(ctx,
+                                                  mbedtls_cipher_info_from_type(cipher_id),
+                                                  tag_len));
+    } else
 #endif /* MBEDTLS_USE_PSA_CRYPTO */
     {
-        TEST_ASSERT( 0 == mbedtls_cipher_setup( ctx,
-                              mbedtls_cipher_info_from_type( cipher_id ) ) );
+        TEST_ASSERT(0 == mbedtls_cipher_setup(ctx,
+                                              mbedtls_cipher_info_from_type(cipher_id)));
     }
 
-    TEST_ASSERT( 0 == mbedtls_cipher_setkey( ctx, key->x, 8 * key->len,
-                                             direction ) );
-    return( 1 );
+    TEST_ASSERT(0 == mbedtls_cipher_setkey(ctx, key->x, 8 * key->len,
+                                           direction));
+    return 1;
 
 exit:
-    return( 0 );
+    return 0;
 }
 
 /*
@@ -56,11 +54,13 @@
  * return   1 if it is,
  *          0 if it isn't.
  */
-int buffer_is_all_zero( const uint8_t *buf, size_t size )
+int buffer_is_all_zero(const uint8_t *buf, size_t size)
 {
-    for( size_t i = 0; i < size; i++ )
-        if( buf[i] != 0 )
+    for (size_t i = 0; i < size; i++) {
+        if (buf[i] != 0) {
             return 0;
+        }
+    }
     return 1;
 }
 #endif /* MBEDTLS_CIPHER_AUTH_CRYPT */
@@ -73,17 +73,18 @@
  */
 
 /* BEGIN_CASE */
-void mbedtls_cipher_list(  )
+void mbedtls_cipher_list()
 {
     const int *cipher_type;
 
-    for( cipher_type = mbedtls_cipher_list(); *cipher_type != 0; cipher_type++ )
-        TEST_ASSERT( mbedtls_cipher_info_from_type( *cipher_type ) != NULL );
+    for (cipher_type = mbedtls_cipher_list(); *cipher_type != 0; cipher_type++) {
+        TEST_ASSERT(mbedtls_cipher_info_from_type(*cipher_type) != NULL);
+    }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_invalid_param_unconditional( )
+void cipher_invalid_param_unconditional()
 {
     mbedtls_cipher_context_t valid_ctx;
     mbedtls_cipher_context_t invalid_ctx;
@@ -93,120 +94,120 @@
     int valid_size = sizeof(valid_buffer);
     int valid_bitlen = valid_size * 8;
     const mbedtls_cipher_info_t *valid_info = mbedtls_cipher_info_from_type(
-        *( mbedtls_cipher_list() ) );
+        *(mbedtls_cipher_list()));
     size_t size_t_var;
 
-    (void)valid_mode; /* In some configurations this is unused */
+    (void) valid_mode; /* In some configurations this is unused */
 
-    mbedtls_cipher_init( &valid_ctx );
-    mbedtls_cipher_init( &invalid_ctx );
+    mbedtls_cipher_init(&valid_ctx);
+    mbedtls_cipher_init(&invalid_ctx);
 
-    TEST_ASSERT( mbedtls_cipher_setup( &valid_ctx, valid_info ) == 0 );
+    TEST_ASSERT(mbedtls_cipher_setup(&valid_ctx, valid_info) == 0);
 
     /* mbedtls_cipher_setup() */
-    TEST_ASSERT( mbedtls_cipher_setup( &valid_ctx, NULL ) ==
-                 MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_setup(&valid_ctx, NULL) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
     /* mbedtls_cipher_get_block_size() */
-    TEST_ASSERT( mbedtls_cipher_get_block_size( &invalid_ctx ) == 0 );
+    TEST_ASSERT(mbedtls_cipher_get_block_size(&invalid_ctx) == 0);
 
     /* mbedtls_cipher_get_cipher_mode() */
-    TEST_ASSERT( mbedtls_cipher_get_cipher_mode( &invalid_ctx ) ==
-                 MBEDTLS_MODE_NONE );
+    TEST_ASSERT(mbedtls_cipher_get_cipher_mode(&invalid_ctx) ==
+                MBEDTLS_MODE_NONE);
 
     /* mbedtls_cipher_get_iv_size() */
-    TEST_ASSERT( mbedtls_cipher_get_iv_size( &invalid_ctx ) == 0 );
+    TEST_ASSERT(mbedtls_cipher_get_iv_size(&invalid_ctx) == 0);
 
     /* mbedtls_cipher_get_type() */
     TEST_ASSERT(
-        mbedtls_cipher_get_type( &invalid_ctx ) ==
+        mbedtls_cipher_get_type(&invalid_ctx) ==
         MBEDTLS_CIPHER_NONE);
 
     /* mbedtls_cipher_get_name() */
-    TEST_ASSERT( mbedtls_cipher_get_name( &invalid_ctx ) == 0 );
+    TEST_ASSERT(mbedtls_cipher_get_name(&invalid_ctx) == 0);
 
     /* mbedtls_cipher_get_key_bitlen() */
-    TEST_ASSERT( mbedtls_cipher_get_key_bitlen( &invalid_ctx ) ==
-                 MBEDTLS_KEY_LENGTH_NONE );
+    TEST_ASSERT(mbedtls_cipher_get_key_bitlen(&invalid_ctx) ==
+                MBEDTLS_KEY_LENGTH_NONE);
 
     /* mbedtls_cipher_get_operation() */
-    TEST_ASSERT( mbedtls_cipher_get_operation( &invalid_ctx ) ==
-                 MBEDTLS_OPERATION_NONE );
+    TEST_ASSERT(mbedtls_cipher_get_operation(&invalid_ctx) ==
+                MBEDTLS_OPERATION_NONE);
 
     /* mbedtls_cipher_setkey() */
     TEST_ASSERT(
-        mbedtls_cipher_setkey( &invalid_ctx,
-                               valid_buffer,
-                               valid_bitlen,
-                               valid_operation ) ==
-        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+        mbedtls_cipher_setkey(&invalid_ctx,
+                              valid_buffer,
+                              valid_bitlen,
+                              valid_operation) ==
+        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
     /* mbedtls_cipher_set_iv() */
     TEST_ASSERT(
-        mbedtls_cipher_set_iv( &invalid_ctx,
-                               valid_buffer,
-                               valid_size ) ==
-        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+        mbedtls_cipher_set_iv(&invalid_ctx,
+                              valid_buffer,
+                              valid_size) ==
+        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
     /* mbedtls_cipher_reset() */
-    TEST_ASSERT( mbedtls_cipher_reset( &invalid_ctx ) ==
-                 MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_reset(&invalid_ctx) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
     /* mbedtls_cipher_update_ad() */
     TEST_ASSERT(
-        mbedtls_cipher_update_ad( &invalid_ctx,
-                                  valid_buffer,
-                                  valid_size ) ==
-        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+        mbedtls_cipher_update_ad(&invalid_ctx,
+                                 valid_buffer,
+                                 valid_size) ==
+        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 #endif /* defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C) */
 
 #if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
     /* mbedtls_cipher_set_padding_mode() */
-    TEST_ASSERT( mbedtls_cipher_set_padding_mode( &invalid_ctx, valid_mode ) ==
-                 MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_set_padding_mode(&invalid_ctx, valid_mode) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 #endif
 
     /* mbedtls_cipher_update() */
     TEST_ASSERT(
-        mbedtls_cipher_update( &invalid_ctx,
-                               valid_buffer,
-                               valid_size,
-                               valid_buffer,
-                               &size_t_var ) ==
-        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+        mbedtls_cipher_update(&invalid_ctx,
+                              valid_buffer,
+                              valid_size,
+                              valid_buffer,
+                              &size_t_var) ==
+        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
     /* mbedtls_cipher_finish() */
     TEST_ASSERT(
-        mbedtls_cipher_finish( &invalid_ctx,
-                               valid_buffer,
-                               &size_t_var ) ==
-        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+        mbedtls_cipher_finish(&invalid_ctx,
+                              valid_buffer,
+                              &size_t_var) ==
+        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
     /* mbedtls_cipher_write_tag() */
     TEST_ASSERT(
-        mbedtls_cipher_write_tag( &invalid_ctx,
-                                  valid_buffer,
-                                  valid_size ) ==
-        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+        mbedtls_cipher_write_tag(&invalid_ctx,
+                                 valid_buffer,
+                                 valid_size) ==
+        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
     /* mbedtls_cipher_check_tag() */
     TEST_ASSERT(
-        mbedtls_cipher_check_tag( &invalid_ctx,
-                                  valid_buffer,
-                                  valid_size ) ==
-        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+        mbedtls_cipher_check_tag(&invalid_ctx,
+                                 valid_buffer,
+                                 valid_size) ==
+        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 #endif /* defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C) */
 
 exit:
-    mbedtls_cipher_free( &invalid_ctx );
-    mbedtls_cipher_free( &valid_ctx );
+    mbedtls_cipher_free(&invalid_ctx);
+    mbedtls_cipher_free(&valid_ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void cipher_invalid_param_conditional( )
+void cipher_invalid_param_conditional()
 {
     mbedtls_cipher_context_t valid_ctx;
 
@@ -217,488 +218,488 @@
     int valid_size = sizeof(valid_buffer);
     int valid_bitlen = valid_size * 8;
     const mbedtls_cipher_info_t *valid_info = mbedtls_cipher_info_from_type(
-        *( mbedtls_cipher_list() ) );
+        *(mbedtls_cipher_list()));
 
     size_t size_t_var;
 
-    (void)valid_mode; /* In some configurations this is unused */
+    (void) valid_mode; /* In some configurations this is unused */
 
     /* mbedtls_cipher_init() */
-    TEST_VALID_PARAM( mbedtls_cipher_init( &valid_ctx ) );
-    TEST_INVALID_PARAM( mbedtls_cipher_init( NULL ) );
+    TEST_VALID_PARAM(mbedtls_cipher_init(&valid_ctx));
+    TEST_INVALID_PARAM(mbedtls_cipher_init(NULL));
 
     /* mbedtls_cipher_setup() */
-    TEST_VALID_PARAM( mbedtls_cipher_setup( &valid_ctx, valid_info ) );
+    TEST_VALID_PARAM(mbedtls_cipher_setup(&valid_ctx, valid_info));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_setup( NULL, valid_info ) );
+        mbedtls_cipher_setup(NULL, valid_info));
 
     /* mbedtls_cipher_get_block_size() */
-    TEST_INVALID_PARAM_RET( 0, mbedtls_cipher_get_block_size( NULL ) );
+    TEST_INVALID_PARAM_RET(0, mbedtls_cipher_get_block_size(NULL));
 
     /* mbedtls_cipher_get_cipher_mode() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_MODE_NONE,
-        mbedtls_cipher_get_cipher_mode( NULL ) );
+        mbedtls_cipher_get_cipher_mode(NULL));
 
     /* mbedtls_cipher_get_iv_size() */
-    TEST_INVALID_PARAM_RET( 0, mbedtls_cipher_get_iv_size( NULL ) );
+    TEST_INVALID_PARAM_RET(0, mbedtls_cipher_get_iv_size(NULL));
 
     /* mbedtls_cipher_get_type() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_CIPHER_NONE,
-        mbedtls_cipher_get_type( NULL ) );
+        mbedtls_cipher_get_type(NULL));
 
     /* mbedtls_cipher_get_name() */
-    TEST_INVALID_PARAM_RET( 0, mbedtls_cipher_get_name( NULL ) );
+    TEST_INVALID_PARAM_RET(0, mbedtls_cipher_get_name(NULL));
 
     /* mbedtls_cipher_get_key_bitlen() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_KEY_LENGTH_NONE,
-        mbedtls_cipher_get_key_bitlen( NULL ) );
+        mbedtls_cipher_get_key_bitlen(NULL));
 
     /* mbedtls_cipher_get_operation() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_OPERATION_NONE,
-        mbedtls_cipher_get_operation( NULL ) );
+        mbedtls_cipher_get_operation(NULL));
 
     /* mbedtls_cipher_setkey() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_setkey( NULL,
-                               valid_buffer,
-                               valid_bitlen,
-                               valid_operation ) );
+        mbedtls_cipher_setkey(NULL,
+                              valid_buffer,
+                              valid_bitlen,
+                              valid_operation));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_setkey( &valid_ctx,
-                               NULL,
-                               valid_bitlen,
-                               valid_operation ) );
+        mbedtls_cipher_setkey(&valid_ctx,
+                              NULL,
+                              valid_bitlen,
+                              valid_operation));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_setkey( &valid_ctx,
-                               valid_buffer,
-                               valid_bitlen,
-                               invalid_operation ) );
+        mbedtls_cipher_setkey(&valid_ctx,
+                              valid_buffer,
+                              valid_bitlen,
+                              invalid_operation));
 
     /* mbedtls_cipher_set_iv() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_set_iv( NULL,
-                               valid_buffer,
-                               valid_size ) );
+        mbedtls_cipher_set_iv(NULL,
+                              valid_buffer,
+                              valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_set_iv( &valid_ctx,
-                               NULL,
-                               valid_size ) );
+        mbedtls_cipher_set_iv(&valid_ctx,
+                              NULL,
+                              valid_size));
 
     /* mbedtls_cipher_reset() */
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-                            mbedtls_cipher_reset( NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
+                           mbedtls_cipher_reset(NULL));
 
 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
     /* mbedtls_cipher_update_ad() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_update_ad( NULL,
-                                  valid_buffer,
-                                  valid_size ) );
+        mbedtls_cipher_update_ad(NULL,
+                                 valid_buffer,
+                                 valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_update_ad( &valid_ctx,
-                                  NULL,
-                                  valid_size ) );
+        mbedtls_cipher_update_ad(&valid_ctx,
+                                 NULL,
+                                 valid_size));
 #endif /* defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C) */
 
 #if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
     /* mbedtls_cipher_set_padding_mode() */
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-                            mbedtls_cipher_set_padding_mode( NULL, valid_mode ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
+                           mbedtls_cipher_set_padding_mode(NULL, valid_mode));
 #endif
 
     /* mbedtls_cipher_update() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_update( NULL,
-                               valid_buffer,
-                               valid_size,
-                               valid_buffer,
-                               &size_t_var ) );
+        mbedtls_cipher_update(NULL,
+                              valid_buffer,
+                              valid_size,
+                              valid_buffer,
+                              &size_t_var));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_update( &valid_ctx,
-                               NULL, valid_size,
-                               valid_buffer,
-                               &size_t_var ) );
+        mbedtls_cipher_update(&valid_ctx,
+                              NULL, valid_size,
+                              valid_buffer,
+                              &size_t_var));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_update( &valid_ctx,
-                               valid_buffer, valid_size,
-                               NULL,
-                               &size_t_var ) );
+        mbedtls_cipher_update(&valid_ctx,
+                              valid_buffer, valid_size,
+                              NULL,
+                              &size_t_var));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_update( &valid_ctx,
-                               valid_buffer, valid_size,
-                               valid_buffer,
-                               NULL ) );
+        mbedtls_cipher_update(&valid_ctx,
+                              valid_buffer, valid_size,
+                              valid_buffer,
+                              NULL));
 
     /* mbedtls_cipher_finish() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_finish( NULL,
-                               valid_buffer,
-                               &size_t_var ) );
+        mbedtls_cipher_finish(NULL,
+                              valid_buffer,
+                              &size_t_var));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_finish( &valid_ctx,
-                               NULL,
-                               &size_t_var ) );
+        mbedtls_cipher_finish(&valid_ctx,
+                              NULL,
+                              &size_t_var));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_finish( &valid_ctx,
-                               valid_buffer,
-                               NULL ) );
+        mbedtls_cipher_finish(&valid_ctx,
+                              valid_buffer,
+                              NULL));
 
 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
     /* mbedtls_cipher_write_tag() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_write_tag( NULL,
-                                  valid_buffer,
-                                  valid_size ) );
+        mbedtls_cipher_write_tag(NULL,
+                                 valid_buffer,
+                                 valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_write_tag( &valid_ctx,
-                                  NULL,
-                                  valid_size ) );
+        mbedtls_cipher_write_tag(&valid_ctx,
+                                 NULL,
+                                 valid_size));
 
     /* mbedtls_cipher_check_tag() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_check_tag( NULL,
-                                  valid_buffer,
-                                  valid_size ) );
+        mbedtls_cipher_check_tag(NULL,
+                                 valid_buffer,
+                                 valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_check_tag( &valid_ctx,
-                                  NULL,
-                                  valid_size ) );
+        mbedtls_cipher_check_tag(&valid_ctx,
+                                 NULL,
+                                 valid_size));
 #endif /* defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C) */
 
     /* mbedtls_cipher_crypt() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_crypt( NULL,
-                              valid_buffer, valid_size,
-                              valid_buffer, valid_size,
-                              valid_buffer, &size_t_var ) );
+        mbedtls_cipher_crypt(NULL,
+                             valid_buffer, valid_size,
+                             valid_buffer, valid_size,
+                             valid_buffer, &size_t_var));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_crypt( &valid_ctx,
-                              NULL, valid_size,
-                              valid_buffer, valid_size,
-                              valid_buffer, &size_t_var ) );
+        mbedtls_cipher_crypt(&valid_ctx,
+                             NULL, valid_size,
+                             valid_buffer, valid_size,
+                             valid_buffer, &size_t_var));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_crypt( &valid_ctx,
-                              valid_buffer, valid_size,
-                              NULL, valid_size,
-                              valid_buffer, &size_t_var ) );
+        mbedtls_cipher_crypt(&valid_ctx,
+                             valid_buffer, valid_size,
+                             NULL, valid_size,
+                             valid_buffer, &size_t_var));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_crypt( &valid_ctx,
-                              valid_buffer, valid_size,
-                              valid_buffer, valid_size,
-                              NULL, &size_t_var ) );
+        mbedtls_cipher_crypt(&valid_ctx,
+                             valid_buffer, valid_size,
+                             valid_buffer, valid_size,
+                             NULL, &size_t_var));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_crypt( &valid_ctx,
-                              valid_buffer, valid_size,
-                              valid_buffer, valid_size,
-                              valid_buffer, NULL ) );
+        mbedtls_cipher_crypt(&valid_ctx,
+                             valid_buffer, valid_size,
+                             valid_buffer, valid_size,
+                             valid_buffer, NULL));
 
 #if defined(MBEDTLS_CIPHER_MODE_AEAD)
     /* mbedtls_cipher_auth_encrypt() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_encrypt( NULL,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, &size_t_var,
-                                     valid_buffer, valid_size ) );
+        mbedtls_cipher_auth_encrypt(NULL,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, &size_t_var,
+                                    valid_buffer, valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_encrypt( &valid_ctx,
-                                     NULL, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, &size_t_var,
-                                     valid_buffer, valid_size ) );
+        mbedtls_cipher_auth_encrypt(&valid_ctx,
+                                    NULL, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, &size_t_var,
+                                    valid_buffer, valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_encrypt( &valid_ctx,
-                                     valid_buffer, valid_size,
-                                     NULL, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, &size_t_var,
-                                     valid_buffer, valid_size ) );
+        mbedtls_cipher_auth_encrypt(&valid_ctx,
+                                    valid_buffer, valid_size,
+                                    NULL, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, &size_t_var,
+                                    valid_buffer, valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_encrypt( &valid_ctx,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     NULL, valid_size,
-                                     valid_buffer, &size_t_var,
-                                     valid_buffer, valid_size ) );
+        mbedtls_cipher_auth_encrypt(&valid_ctx,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    NULL, valid_size,
+                                    valid_buffer, &size_t_var,
+                                    valid_buffer, valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_encrypt( &valid_ctx,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     NULL, &size_t_var,
-                                     valid_buffer, valid_size ) );
+        mbedtls_cipher_auth_encrypt(&valid_ctx,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    NULL, &size_t_var,
+                                    valid_buffer, valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_encrypt( &valid_ctx,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, NULL,
-                                     valid_buffer, valid_size ) );
+        mbedtls_cipher_auth_encrypt(&valid_ctx,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, NULL,
+                                    valid_buffer, valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_encrypt( &valid_ctx,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, &size_t_var,
-                                     NULL, valid_size ) );
+        mbedtls_cipher_auth_encrypt(&valid_ctx,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, &size_t_var,
+                                    NULL, valid_size));
 
     /* mbedtls_cipher_auth_decrypt() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_decrypt( NULL,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, &size_t_var,
-                                     valid_buffer, valid_size ) );
+        mbedtls_cipher_auth_decrypt(NULL,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, &size_t_var,
+                                    valid_buffer, valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_decrypt( &valid_ctx,
-                                     NULL, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, &size_t_var,
-                                     valid_buffer, valid_size ) );
+        mbedtls_cipher_auth_decrypt(&valid_ctx,
+                                    NULL, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, &size_t_var,
+                                    valid_buffer, valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_decrypt( &valid_ctx,
-                                     valid_buffer, valid_size,
-                                     NULL, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, &size_t_var,
-                                     valid_buffer, valid_size ) );
+        mbedtls_cipher_auth_decrypt(&valid_ctx,
+                                    valid_buffer, valid_size,
+                                    NULL, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, &size_t_var,
+                                    valid_buffer, valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_decrypt( &valid_ctx,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     NULL, valid_size,
-                                     valid_buffer, &size_t_var,
-                                     valid_buffer, valid_size ) );
+        mbedtls_cipher_auth_decrypt(&valid_ctx,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    NULL, valid_size,
+                                    valid_buffer, &size_t_var,
+                                    valid_buffer, valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_decrypt( &valid_ctx,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     NULL, &size_t_var,
-                                     valid_buffer, valid_size ) );
+        mbedtls_cipher_auth_decrypt(&valid_ctx,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    NULL, &size_t_var,
+                                    valid_buffer, valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_decrypt( &valid_ctx,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, NULL,
-                                     valid_buffer, valid_size ) );
+        mbedtls_cipher_auth_decrypt(&valid_ctx,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, NULL,
+                                    valid_buffer, valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_decrypt( &valid_ctx,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, valid_size,
-                                     valid_buffer, &size_t_var,
-                                     NULL, valid_size ) );
+        mbedtls_cipher_auth_decrypt(&valid_ctx,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, valid_size,
+                                    valid_buffer, &size_t_var,
+                                    NULL, valid_size));
 #endif /* defined(MBEDTLS_CIPHER_MODE_AEAD) */
 
 #if defined(MBEDTLS_CIPHER_MODE_AEAD) || defined(MBEDTLS_NIST_KW_C)
     /* mbedtls_cipher_auth_encrypt_ext */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_encrypt_ext( NULL,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size, &size_t_var,
-                                         valid_size ) );
+        mbedtls_cipher_auth_encrypt_ext(NULL,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size, &size_t_var,
+                                        valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_encrypt_ext( &valid_ctx,
-                                         NULL, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size, &size_t_var,
-                                         valid_size ) );
+        mbedtls_cipher_auth_encrypt_ext(&valid_ctx,
+                                        NULL, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size, &size_t_var,
+                                        valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_encrypt_ext( &valid_ctx,
-                                         valid_buffer, valid_size,
-                                         NULL, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size, &size_t_var,
-                                         valid_size ) );
+        mbedtls_cipher_auth_encrypt_ext(&valid_ctx,
+                                        valid_buffer, valid_size,
+                                        NULL, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size, &size_t_var,
+                                        valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_encrypt_ext( &valid_ctx,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         NULL, valid_size,
-                                         valid_buffer, valid_size, &size_t_var,
-                                         valid_size ) );
+        mbedtls_cipher_auth_encrypt_ext(&valid_ctx,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        NULL, valid_size,
+                                        valid_buffer, valid_size, &size_t_var,
+                                        valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_encrypt_ext( &valid_ctx,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         NULL, valid_size, &size_t_var,
-                                         valid_size ) );
+        mbedtls_cipher_auth_encrypt_ext(&valid_ctx,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        NULL, valid_size, &size_t_var,
+                                        valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_encrypt_ext( &valid_ctx,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size, NULL,
-                                         valid_size ) );
+        mbedtls_cipher_auth_encrypt_ext(&valid_ctx,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size, NULL,
+                                        valid_size));
 
     /* mbedtls_cipher_auth_decrypt_ext */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_decrypt_ext( NULL,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size, &size_t_var,
-                                         valid_size ) );
+        mbedtls_cipher_auth_decrypt_ext(NULL,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size, &size_t_var,
+                                        valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_decrypt_ext( &valid_ctx,
-                                         NULL, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size, &size_t_var,
-                                         valid_size ) );
+        mbedtls_cipher_auth_decrypt_ext(&valid_ctx,
+                                        NULL, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size, &size_t_var,
+                                        valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_decrypt_ext( &valid_ctx,
-                                         valid_buffer, valid_size,
-                                         NULL, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size, &size_t_var,
-                                         valid_size ) );
+        mbedtls_cipher_auth_decrypt_ext(&valid_ctx,
+                                        valid_buffer, valid_size,
+                                        NULL, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size, &size_t_var,
+                                        valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_decrypt_ext( &valid_ctx,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         NULL, valid_size,
-                                         valid_buffer, valid_size, &size_t_var,
-                                         valid_size ) );
+        mbedtls_cipher_auth_decrypt_ext(&valid_ctx,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        NULL, valid_size,
+                                        valid_buffer, valid_size, &size_t_var,
+                                        valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_decrypt_ext( &valid_ctx,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         NULL, valid_size, &size_t_var,
-                                         valid_size ) );
+        mbedtls_cipher_auth_decrypt_ext(&valid_ctx,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        NULL, valid_size, &size_t_var,
+                                        valid_size));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_auth_decrypt_ext( &valid_ctx,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size,
-                                         valid_buffer, valid_size, NULL,
-                                         valid_size ) );
+        mbedtls_cipher_auth_decrypt_ext(&valid_ctx,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size,
+                                        valid_buffer, valid_size, NULL,
+                                        valid_size));
 #endif /* MBEDTLS_CIPHER_MODE_AEAD || MBEDTLS_NIST_KW_C */
 
     /* mbedtls_cipher_free() */
-    TEST_VALID_PARAM( mbedtls_cipher_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_cipher_free(NULL));
 exit:
-    TEST_VALID_PARAM( mbedtls_cipher_free( &valid_ctx ) );
+    TEST_VALID_PARAM(mbedtls_cipher_free(&valid_ctx));
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_AES_C */
-void cipher_special_behaviours(  )
+void cipher_special_behaviours()
 {
     const mbedtls_cipher_info_t *cipher_info;
     mbedtls_cipher_context_t ctx;
     unsigned char input[32];
     unsigned char output[32];
-#if defined (MBEDTLS_CIPHER_MODE_CBC)
+#if defined(MBEDTLS_CIPHER_MODE_CBC)
     unsigned char iv[32];
 #endif
     size_t olen = 0;
 
-    mbedtls_cipher_init( &ctx );
-    memset( input, 0, sizeof( input ) );
-    memset( output, 0, sizeof( output ) );
+    mbedtls_cipher_init(&ctx);
+    memset(input, 0, sizeof(input));
+    memset(output, 0, sizeof(output));
 #if defined(MBEDTLS_CIPHER_MODE_CBC)
-    memset( iv, 0, sizeof( iv ) );
+    memset(iv, 0, sizeof(iv));
 
     /* Check and get info structures */
-    cipher_info = mbedtls_cipher_info_from_type( MBEDTLS_CIPHER_AES_128_CBC );
-    TEST_ASSERT( NULL != cipher_info );
+    cipher_info = mbedtls_cipher_info_from_type(MBEDTLS_CIPHER_AES_128_CBC);
+    TEST_ASSERT(NULL != cipher_info);
 
-    TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx, cipher_info ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setup(&ctx, cipher_info));
 
     /* IV too big */
-    TEST_ASSERT( mbedtls_cipher_set_iv( &ctx, iv, MBEDTLS_MAX_IV_LENGTH + 1 )
-                 == MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE );
+    TEST_ASSERT(mbedtls_cipher_set_iv(&ctx, iv, MBEDTLS_MAX_IV_LENGTH + 1)
+                == MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE);
 
     /* IV too small */
-    TEST_ASSERT( mbedtls_cipher_set_iv( &ctx, iv, 0 )
-                 == MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_set_iv(&ctx, iv, 0)
+                == MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-    mbedtls_cipher_free( &ctx );
-    mbedtls_cipher_init( &ctx );
+    mbedtls_cipher_free(&ctx);
+    mbedtls_cipher_init(&ctx);
 #endif /* MBEDTLS_CIPHER_MODE_CBC */
-    cipher_info = mbedtls_cipher_info_from_type( MBEDTLS_CIPHER_AES_128_ECB );
-    TEST_ASSERT( NULL != cipher_info );
+    cipher_info = mbedtls_cipher_info_from_type(MBEDTLS_CIPHER_AES_128_ECB);
+    TEST_ASSERT(NULL != cipher_info);
 
-    TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx, cipher_info ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setup(&ctx, cipher_info));
 
     /* Update ECB with partial block */
-    TEST_ASSERT( mbedtls_cipher_update( &ctx, input, 1, output, &olen )
-                 == MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED );
+    TEST_ASSERT(mbedtls_cipher_update(&ctx, input, 1, output, &olen)
+                == MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED);
 
 exit:
-    mbedtls_cipher_free( &ctx );
+    mbedtls_cipher_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void enc_dec_buf( int cipher_id, char * cipher_string, int key_len,
-                  int length_val, int pad_mode )
+void enc_dec_buf(int cipher_id, char *cipher_string, int key_len,
+                 int length_val, int pad_mode)
 {
     size_t length = length_val, outlen, total_len, i, block_size, iv_len;
     unsigned char key[64];
@@ -716,28 +717,27 @@
     /*
      * Prepare contexts
      */
-    mbedtls_cipher_init( &ctx_dec );
-    mbedtls_cipher_init( &ctx_enc );
+    mbedtls_cipher_init(&ctx_dec);
+    mbedtls_cipher_init(&ctx_enc);
 
-    memset( key, 0x2a, sizeof( key ) );
+    memset(key, 0x2a, sizeof(key));
 
     /* Check and get info structures */
-    cipher_info = mbedtls_cipher_info_from_type( cipher_id );
-    TEST_ASSERT( NULL != cipher_info );
-    TEST_ASSERT( mbedtls_cipher_info_from_string( cipher_string ) == cipher_info );
+    cipher_info = mbedtls_cipher_info_from_type(cipher_id);
+    TEST_ASSERT(NULL != cipher_info);
+    TEST_ASSERT(mbedtls_cipher_info_from_string(cipher_string) == cipher_info);
 
     /* Initialise enc and dec contexts */
-    TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx_dec, cipher_info ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx_enc, cipher_info ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setup(&ctx_dec, cipher_info));
+    TEST_ASSERT(0 == mbedtls_cipher_setup(&ctx_enc, cipher_info));
 
-    TEST_ASSERT( 0 == mbedtls_cipher_setkey( &ctx_dec, key, key_len, MBEDTLS_DECRYPT ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_setkey( &ctx_enc, key, key_len, MBEDTLS_ENCRYPT ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setkey(&ctx_dec, key, key_len, MBEDTLS_DECRYPT));
+    TEST_ASSERT(0 == mbedtls_cipher_setkey(&ctx_enc, key, key_len, MBEDTLS_ENCRYPT));
 
 #if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
-    if( -1 != pad_mode )
-    {
-        TEST_ASSERT( 0 == mbedtls_cipher_set_padding_mode( &ctx_dec, pad_mode ) );
-        TEST_ASSERT( 0 == mbedtls_cipher_set_padding_mode( &ctx_enc, pad_mode ) );
+    if (-1 != pad_mode) {
+        TEST_ASSERT(0 == mbedtls_cipher_set_padding_mode(&ctx_dec, pad_mode));
+        TEST_ASSERT(0 == mbedtls_cipher_set_padding_mode(&ctx_enc, pad_mode));
     }
 #else
     (void) pad_mode;
@@ -746,90 +746,90 @@
     /*
      * Do a few encode/decode cycles
      */
-    for( i = 0; i < 3; i++ )
-    {
-    memset( iv , 0x00 + i, sizeof( iv ) );
-    memset( ad, 0x10 + i, sizeof( ad ) );
-    memset( inbuf, 0x20 + i, sizeof( inbuf ) );
+    for (i = 0; i < 3; i++) {
+        memset(iv, 0x00 + i, sizeof(iv));
+        memset(ad, 0x10 + i, sizeof(ad));
+        memset(inbuf, 0x20 + i, sizeof(inbuf));
 
-    memset( encbuf, 0, sizeof( encbuf ) );
-    memset( decbuf, 0, sizeof( decbuf ) );
-    memset( tag, 0, sizeof( tag ) );
+        memset(encbuf, 0, sizeof(encbuf));
+        memset(decbuf, 0, sizeof(decbuf));
+        memset(tag, 0, sizeof(tag));
 
-    if( cipher_info->type == MBEDTLS_CIPHER_CHACHA20 ||
-        cipher_info->type == MBEDTLS_CIPHER_CHACHA20_POLY1305 )
-        iv_len = 12;
-    else
-        iv_len = sizeof(iv);
+        if (cipher_info->type == MBEDTLS_CIPHER_CHACHA20 ||
+            cipher_info->type == MBEDTLS_CIPHER_CHACHA20_POLY1305) {
+            iv_len = 12;
+        } else {
+            iv_len = sizeof(iv);
+        }
 
-    TEST_ASSERT( 0 == mbedtls_cipher_set_iv( &ctx_dec, iv, iv_len ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_set_iv( &ctx_enc, iv, iv_len ) );
+        TEST_ASSERT(0 == mbedtls_cipher_set_iv(&ctx_dec, iv, iv_len));
+        TEST_ASSERT(0 == mbedtls_cipher_set_iv(&ctx_enc, iv, iv_len));
 
-    TEST_ASSERT( 0 == mbedtls_cipher_reset( &ctx_dec ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_reset( &ctx_enc ) );
+        TEST_ASSERT(0 == mbedtls_cipher_reset(&ctx_dec));
+        TEST_ASSERT(0 == mbedtls_cipher_reset(&ctx_enc));
 
 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
-    TEST_ASSERT( 0 == mbedtls_cipher_update_ad( &ctx_dec, ad, sizeof( ad ) - i ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_update_ad( &ctx_enc, ad, sizeof( ad ) - i ) );
+        TEST_ASSERT(0 == mbedtls_cipher_update_ad(&ctx_dec, ad, sizeof(ad) - i));
+        TEST_ASSERT(0 == mbedtls_cipher_update_ad(&ctx_enc, ad, sizeof(ad) - i));
 #endif
 
-    block_size = mbedtls_cipher_get_block_size( &ctx_enc );
-    TEST_ASSERT( block_size != 0 );
+        block_size = mbedtls_cipher_get_block_size(&ctx_enc);
+        TEST_ASSERT(block_size != 0);
 
-    /* encode length number of bytes from inbuf */
-    TEST_ASSERT( 0 == mbedtls_cipher_update( &ctx_enc, inbuf, length, encbuf, &outlen ) );
-    total_len = outlen;
+        /* encode length number of bytes from inbuf */
+        TEST_ASSERT(0 == mbedtls_cipher_update(&ctx_enc, inbuf, length, encbuf, &outlen));
+        total_len = outlen;
 
-    TEST_ASSERT( total_len == length ||
-                 ( total_len % block_size == 0 &&
-                   total_len < length &&
-                   total_len + block_size > length ) );
+        TEST_ASSERT(total_len == length ||
+                    (total_len % block_size == 0 &&
+                     total_len < length &&
+                     total_len + block_size > length));
 
-    TEST_ASSERT( 0 == mbedtls_cipher_finish( &ctx_enc, encbuf + outlen, &outlen ) );
-    total_len += outlen;
+        TEST_ASSERT(0 == mbedtls_cipher_finish(&ctx_enc, encbuf + outlen, &outlen));
+        total_len += outlen;
 
 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
-    TEST_ASSERT( 0 == mbedtls_cipher_write_tag( &ctx_enc, tag, sizeof( tag ) ) );
+        TEST_ASSERT(0 == mbedtls_cipher_write_tag(&ctx_enc, tag, sizeof(tag)));
 #endif
 
-    TEST_ASSERT( total_len == length ||
-                 ( total_len % block_size == 0 &&
-                   total_len > length &&
-                   total_len <= length + block_size ) );
+        TEST_ASSERT(total_len == length ||
+                    (total_len % block_size == 0 &&
+                     total_len > length &&
+                     total_len <= length + block_size));
 
-    /* decode the previously encoded string */
-    TEST_ASSERT( 0 == mbedtls_cipher_update( &ctx_dec, encbuf, total_len, decbuf, &outlen ) );
-    total_len = outlen;
+        /* decode the previously encoded string */
+        TEST_ASSERT(0 == mbedtls_cipher_update(&ctx_dec, encbuf, total_len, decbuf, &outlen));
+        total_len = outlen;
 
-    TEST_ASSERT( total_len == length ||
-                 ( total_len % block_size == 0 &&
-                   total_len < length &&
-                   total_len + block_size >= length ) );
+        TEST_ASSERT(total_len == length ||
+                    (total_len % block_size == 0 &&
+                     total_len < length &&
+                     total_len + block_size >= length));
 
-    TEST_ASSERT( 0 == mbedtls_cipher_finish( &ctx_dec, decbuf + outlen, &outlen ) );
-    total_len += outlen;
+        TEST_ASSERT(0 == mbedtls_cipher_finish(&ctx_dec, decbuf + outlen, &outlen));
+        total_len += outlen;
 
 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
-    TEST_ASSERT( 0 == mbedtls_cipher_check_tag( &ctx_dec, tag, sizeof( tag ) ) );
+        TEST_ASSERT(0 == mbedtls_cipher_check_tag(&ctx_dec, tag, sizeof(tag)));
 #endif
 
-    /* check result */
-    TEST_ASSERT( total_len == length );
-    TEST_ASSERT( 0 == memcmp(inbuf, decbuf, length) );
+        /* check result */
+        TEST_ASSERT(total_len == length);
+        TEST_ASSERT(0 == memcmp(inbuf, decbuf, length));
     }
 
     /*
      * Done
      */
 exit:
-    mbedtls_cipher_free( &ctx_dec );
-    mbedtls_cipher_free( &ctx_enc );
+    mbedtls_cipher_free(&ctx_dec);
+    mbedtls_cipher_free(&ctx_enc);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void enc_fail( int cipher_id, int pad_mode, int key_len, int length_val,
-               int ret )
+void enc_fail(int cipher_id, int pad_mode, int key_len, int length_val,
+              int ret)
 {
     size_t length = length_val;
     unsigned char key[32];
@@ -843,46 +843,46 @@
 
     size_t outlen = 0;
 
-    memset( key, 0, 32 );
-    memset( iv , 0, 16 );
+    memset(key, 0, 32);
+    memset(iv, 0, 16);
 
-    mbedtls_cipher_init( &ctx );
+    mbedtls_cipher_init(&ctx);
 
-    memset( inbuf, 5, 64 );
-    memset( encbuf, 0, 64 );
+    memset(inbuf, 5, 64);
+    memset(encbuf, 0, 64);
 
     /* Check and get info structures */
-    cipher_info = mbedtls_cipher_info_from_type( cipher_id );
-    TEST_ASSERT( NULL != cipher_info );
+    cipher_info = mbedtls_cipher_info_from_type(cipher_id);
+    TEST_ASSERT(NULL != cipher_info);
 
     /* Initialise context */
-    TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx, cipher_info ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_setkey( &ctx, key, key_len, MBEDTLS_ENCRYPT ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setup(&ctx, cipher_info));
+    TEST_ASSERT(0 == mbedtls_cipher_setkey(&ctx, key, key_len, MBEDTLS_ENCRYPT));
 #if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
-    TEST_ASSERT( 0 == mbedtls_cipher_set_padding_mode( &ctx, pad_mode ) );
+    TEST_ASSERT(0 == mbedtls_cipher_set_padding_mode(&ctx, pad_mode));
 #else
     (void) pad_mode;
 #endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */
-    TEST_ASSERT( 0 == mbedtls_cipher_set_iv( &ctx, iv, 16 ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_reset( &ctx ) );
+    TEST_ASSERT(0 == mbedtls_cipher_set_iv(&ctx, iv, 16));
+    TEST_ASSERT(0 == mbedtls_cipher_reset(&ctx));
 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
-    TEST_ASSERT( 0 == mbedtls_cipher_update_ad( &ctx, NULL, 0 ) );
+    TEST_ASSERT(0 == mbedtls_cipher_update_ad(&ctx, NULL, 0));
 #endif
 
     /* encode length number of bytes from inbuf */
-    TEST_ASSERT( 0 == mbedtls_cipher_update( &ctx, inbuf, length, encbuf, &outlen ) );
-    TEST_ASSERT( ret == mbedtls_cipher_finish( &ctx, encbuf + outlen, &outlen ) );
+    TEST_ASSERT(0 == mbedtls_cipher_update(&ctx, inbuf, length, encbuf, &outlen));
+    TEST_ASSERT(ret == mbedtls_cipher_finish(&ctx, encbuf + outlen, &outlen));
 
     /* done */
 exit:
-    mbedtls_cipher_free( &ctx );
+    mbedtls_cipher_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void dec_empty_buf( int cipher,
-                    int expected_update_ret,
-                    int expected_finish_ret )
+void dec_empty_buf(int cipher,
+                   int expected_update_ret,
+                   int expected_finish_ret)
 {
     unsigned char key[32];
     unsigned char iv[16];
@@ -896,47 +896,47 @@
 
     size_t outlen = 0;
 
-    memset( key, 0, 32 );
-    memset( iv , 0, 16 );
+    memset(key, 0, 32);
+    memset(iv, 0, 16);
 
-    mbedtls_cipher_init( &ctx_dec );
+    mbedtls_cipher_init(&ctx_dec);
 
-    memset( encbuf, 0, 64 );
-    memset( decbuf, 0, 64 );
+    memset(encbuf, 0, 64);
+    memset(decbuf, 0, 64);
 
     /* Initialise context */
-    cipher_info = mbedtls_cipher_info_from_type( cipher );
-    TEST_ASSERT( NULL != cipher_info);
+    cipher_info = mbedtls_cipher_info_from_type(cipher);
+    TEST_ASSERT(NULL != cipher_info);
 
-    if( cipher_info->type == MBEDTLS_CIPHER_CHACHA20 ||
-        cipher_info->type == MBEDTLS_CIPHER_CHACHA20_POLY1305 )
+    if (cipher_info->type == MBEDTLS_CIPHER_CHACHA20 ||
+        cipher_info->type == MBEDTLS_CIPHER_CHACHA20_POLY1305) {
         iv_len = 12;
+    }
 
-    TEST_ASSERT( sizeof(key) * 8 >= cipher_info->key_bitlen );
+    TEST_ASSERT(sizeof(key) * 8 >= cipher_info->key_bitlen);
 
-    TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx_dec, cipher_info ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setup(&ctx_dec, cipher_info));
 
-    TEST_ASSERT( 0 == mbedtls_cipher_setkey( &ctx_dec,
-                                             key, cipher_info->key_bitlen,
-                                             MBEDTLS_DECRYPT ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setkey(&ctx_dec,
+                                           key, cipher_info->key_bitlen,
+                                           MBEDTLS_DECRYPT));
 
-    TEST_ASSERT( 0 == mbedtls_cipher_set_iv( &ctx_dec, iv, iv_len ) );
+    TEST_ASSERT(0 == mbedtls_cipher_set_iv(&ctx_dec, iv, iv_len));
 
-    TEST_ASSERT( 0 == mbedtls_cipher_reset( &ctx_dec ) );
+    TEST_ASSERT(0 == mbedtls_cipher_reset(&ctx_dec));
 
 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
-    TEST_ASSERT( 0 == mbedtls_cipher_update_ad( &ctx_dec, NULL, 0 ) );
+    TEST_ASSERT(0 == mbedtls_cipher_update_ad(&ctx_dec, NULL, 0));
 #endif
 
     /* decode 0-byte string */
-    TEST_ASSERT( expected_update_ret ==
-                 mbedtls_cipher_update( &ctx_dec, encbuf, 0, decbuf, &outlen ) );
-    TEST_ASSERT( 0 == outlen );
+    TEST_ASSERT(expected_update_ret ==
+                mbedtls_cipher_update(&ctx_dec, encbuf, 0, decbuf, &outlen));
+    TEST_ASSERT(0 == outlen);
 
-    if ( expected_finish_ret == 0 &&
-         ( cipher_info->mode == MBEDTLS_MODE_CBC ||
-           cipher_info->mode == MBEDTLS_MODE_ECB ) )
-    {
+    if (expected_finish_ret == 0 &&
+        (cipher_info->mode == MBEDTLS_MODE_CBC ||
+         cipher_info->mode == MBEDTLS_MODE_ECB)) {
         /* Non-CBC and non-ECB ciphers are OK with decrypting empty buffers and
          * return success, not MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED, when
          * decrypting an empty buffer.
@@ -945,20 +945,20 @@
         expected_finish_ret = MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED;
     }
 
-    TEST_ASSERT( expected_finish_ret == mbedtls_cipher_finish(
-                                        &ctx_dec, decbuf + outlen, &outlen ) );
-    TEST_ASSERT( 0 == outlen );
+    TEST_ASSERT(expected_finish_ret == mbedtls_cipher_finish(
+                    &ctx_dec, decbuf + outlen, &outlen));
+    TEST_ASSERT(0 == outlen);
 
 exit:
-    mbedtls_cipher_free( &ctx_dec );
+    mbedtls_cipher_free(&ctx_dec);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void enc_dec_buf_multipart( int cipher_id, int key_len, int first_length_val,
-                            int second_length_val, int pad_mode,
-                            int first_encrypt_output_len, int second_encrypt_output_len,
-                            int first_decrypt_output_len, int second_decrypt_output_len )
+void enc_dec_buf_multipart(int cipher_id, int key_len, int first_length_val,
+                           int second_length_val, int pad_mode,
+                           int first_encrypt_output_len, int second_encrypt_output_len,
+                           int first_decrypt_output_len, int second_decrypt_output_len)
 {
     size_t first_length = first_length_val;
     size_t second_length = second_length_val;
@@ -978,115 +978,121 @@
     size_t outlen = 0;
     size_t totaloutlen = 0;
 
-    memset( key, 0, 32 );
-    memset( iv , 0, 16 );
+    memset(key, 0, 32);
+    memset(iv, 0, 16);
 
-    mbedtls_cipher_init( &ctx_dec );
-    mbedtls_cipher_init( &ctx_enc );
+    mbedtls_cipher_init(&ctx_dec);
+    mbedtls_cipher_init(&ctx_enc);
 
-    memset( inbuf, 5, 64 );
-    memset( encbuf, 0, 64 );
-    memset( decbuf, 0, 64 );
+    memset(inbuf, 5, 64);
+    memset(encbuf, 0, 64);
+    memset(decbuf, 0, 64);
 
     /* Initialise enc and dec contexts */
-    cipher_info = mbedtls_cipher_info_from_type( cipher_id );
-    TEST_ASSERT( NULL != cipher_info);
+    cipher_info = mbedtls_cipher_info_from_type(cipher_id);
+    TEST_ASSERT(NULL != cipher_info);
 
-    TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx_dec, cipher_info ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx_enc, cipher_info ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setup(&ctx_dec, cipher_info));
+    TEST_ASSERT(0 == mbedtls_cipher_setup(&ctx_enc, cipher_info));
 
-    TEST_ASSERT( 0 == mbedtls_cipher_setkey( &ctx_dec, key, key_len, MBEDTLS_DECRYPT ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_setkey( &ctx_enc, key, key_len, MBEDTLS_ENCRYPT ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setkey(&ctx_dec, key, key_len, MBEDTLS_DECRYPT));
+    TEST_ASSERT(0 == mbedtls_cipher_setkey(&ctx_enc, key, key_len, MBEDTLS_ENCRYPT));
 
 #if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
-    if( -1 != pad_mode )
-    {
-        TEST_ASSERT( 0 == mbedtls_cipher_set_padding_mode( &ctx_dec, pad_mode ) );
-        TEST_ASSERT( 0 == mbedtls_cipher_set_padding_mode( &ctx_enc, pad_mode ) );
+    if (-1 != pad_mode) {
+        TEST_ASSERT(0 == mbedtls_cipher_set_padding_mode(&ctx_dec, pad_mode));
+        TEST_ASSERT(0 == mbedtls_cipher_set_padding_mode(&ctx_enc, pad_mode));
     }
 #else
     (void) pad_mode;
 #endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */
 
-    if( cipher_info->type == MBEDTLS_CIPHER_CHACHA20 ||
-        cipher_info->type == MBEDTLS_CIPHER_CHACHA20_POLY1305 )
+    if (cipher_info->type == MBEDTLS_CIPHER_CHACHA20 ||
+        cipher_info->type == MBEDTLS_CIPHER_CHACHA20_POLY1305) {
         iv_len = 12;
-    else
+    } else {
         iv_len = sizeof(iv);
+    }
 
-    TEST_ASSERT( 0 == mbedtls_cipher_set_iv( &ctx_dec, iv, iv_len ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_set_iv( &ctx_enc, iv, iv_len ) );
+    TEST_ASSERT(0 == mbedtls_cipher_set_iv(&ctx_dec, iv, iv_len));
+    TEST_ASSERT(0 == mbedtls_cipher_set_iv(&ctx_enc, iv, iv_len));
 
-    TEST_ASSERT( 0 == mbedtls_cipher_reset( &ctx_dec ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_reset( &ctx_enc ) );
+    TEST_ASSERT(0 == mbedtls_cipher_reset(&ctx_dec));
+    TEST_ASSERT(0 == mbedtls_cipher_reset(&ctx_enc));
 
 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
-    TEST_ASSERT( 0 == mbedtls_cipher_update_ad( &ctx_dec, NULL, 0 ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_update_ad( &ctx_enc, NULL, 0 ) );
+    TEST_ASSERT(0 == mbedtls_cipher_update_ad(&ctx_dec, NULL, 0));
+    TEST_ASSERT(0 == mbedtls_cipher_update_ad(&ctx_enc, NULL, 0));
 #endif
 
-    block_size = mbedtls_cipher_get_block_size( &ctx_enc );
-    TEST_ASSERT( block_size != 0 );
+    block_size = mbedtls_cipher_get_block_size(&ctx_enc);
+    TEST_ASSERT(block_size != 0);
 
     /* encode length number of bytes from inbuf */
-    TEST_ASSERT( 0 == mbedtls_cipher_update( &ctx_enc, inbuf, first_length, encbuf, &outlen ) );
-    TEST_ASSERT( (size_t)first_encrypt_output_len == outlen );
+    TEST_ASSERT(0 == mbedtls_cipher_update(&ctx_enc, inbuf, first_length, encbuf, &outlen));
+    TEST_ASSERT((size_t) first_encrypt_output_len == outlen);
     totaloutlen = outlen;
-    TEST_ASSERT( 0 == mbedtls_cipher_update( &ctx_enc, inbuf + first_length, second_length, encbuf + totaloutlen, &outlen ) );
-    TEST_ASSERT( (size_t)second_encrypt_output_len == outlen );
+    TEST_ASSERT(0 ==
+                mbedtls_cipher_update(&ctx_enc, inbuf + first_length, second_length,
+                                      encbuf + totaloutlen,
+                                      &outlen));
+    TEST_ASSERT((size_t) second_encrypt_output_len == outlen);
     totaloutlen += outlen;
-    TEST_ASSERT( totaloutlen == length ||
-                 ( totaloutlen % block_size == 0 &&
-                   totaloutlen < length &&
-                   totaloutlen + block_size > length ) );
+    TEST_ASSERT(totaloutlen == length ||
+                (totaloutlen % block_size == 0 &&
+                 totaloutlen < length &&
+                 totaloutlen + block_size > length));
 
-    TEST_ASSERT( 0 == mbedtls_cipher_finish( &ctx_enc, encbuf + totaloutlen, &outlen ) );
+    TEST_ASSERT(0 == mbedtls_cipher_finish(&ctx_enc, encbuf + totaloutlen, &outlen));
     totaloutlen += outlen;
-    TEST_ASSERT( totaloutlen == length ||
-                 ( totaloutlen % block_size == 0 &&
-                   totaloutlen > length &&
-                   totaloutlen <= length + block_size ) );
+    TEST_ASSERT(totaloutlen == length ||
+                (totaloutlen % block_size == 0 &&
+                 totaloutlen > length &&
+                 totaloutlen <= length + block_size));
 
     /* decode the previously encoded string */
     second_length = totaloutlen - first_length;
-    TEST_ASSERT( 0 == mbedtls_cipher_update( &ctx_dec, encbuf, first_length, decbuf, &outlen ) );
-    TEST_ASSERT( (size_t)first_decrypt_output_len == outlen );
+    TEST_ASSERT(0 == mbedtls_cipher_update(&ctx_dec, encbuf, first_length, decbuf, &outlen));
+    TEST_ASSERT((size_t) first_decrypt_output_len == outlen);
     totaloutlen = outlen;
-    TEST_ASSERT( 0 == mbedtls_cipher_update( &ctx_dec, encbuf + first_length, second_length, decbuf + totaloutlen, &outlen ) );
-    TEST_ASSERT( (size_t)second_decrypt_output_len == outlen );
+    TEST_ASSERT(0 ==
+                mbedtls_cipher_update(&ctx_dec, encbuf + first_length, second_length,
+                                      decbuf + totaloutlen,
+                                      &outlen));
+    TEST_ASSERT((size_t) second_decrypt_output_len == outlen);
     totaloutlen += outlen;
 
-    TEST_ASSERT( totaloutlen == length ||
-                 ( totaloutlen % block_size == 0 &&
-                   totaloutlen < length &&
-                   totaloutlen + block_size >= length ) );
+    TEST_ASSERT(totaloutlen == length ||
+                (totaloutlen % block_size == 0 &&
+                 totaloutlen < length &&
+                 totaloutlen + block_size >= length));
 
-    TEST_ASSERT( 0 == mbedtls_cipher_finish( &ctx_dec, decbuf + totaloutlen, &outlen ) );
+    TEST_ASSERT(0 == mbedtls_cipher_finish(&ctx_dec, decbuf + totaloutlen, &outlen));
     totaloutlen += outlen;
 
-    TEST_ASSERT( totaloutlen == length );
+    TEST_ASSERT(totaloutlen == length);
 
-    TEST_ASSERT( 0 == memcmp(inbuf, decbuf, length) );
+    TEST_ASSERT(0 == memcmp(inbuf, decbuf, length));
 
 exit:
-    mbedtls_cipher_free( &ctx_dec );
-    mbedtls_cipher_free( &ctx_enc );
+    mbedtls_cipher_free(&ctx_dec);
+    mbedtls_cipher_free(&ctx_enc);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void decrypt_test_vec( int cipher_id, int pad_mode, data_t * key,
-                       data_t * iv, data_t * cipher,
-                       data_t * clear, data_t * ad, data_t * tag,
-                       int finish_result, int tag_result )
+void decrypt_test_vec(int cipher_id, int pad_mode, data_t *key,
+                      data_t *iv, data_t *cipher,
+                      data_t *clear, data_t *ad, data_t *tag,
+                      int finish_result, int tag_result)
 {
     unsigned char output[265];
     mbedtls_cipher_context_t ctx;
     size_t outlen, total_len;
 
-    mbedtls_cipher_init( &ctx );
+    mbedtls_cipher_init(&ctx);
 
-    memset( output, 0x00, sizeof( output ) );
+    memset(output, 0x00, sizeof(output));
 
 #if !defined(MBEDTLS_GCM_C) && !defined(MBEDTLS_CHACHAPOLY_C)
     ((void) ad);
@@ -1094,48 +1100,48 @@
 #endif
 
     /* Prepare context */
-    TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx,
-                                       mbedtls_cipher_info_from_type( cipher_id ) ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_setkey( &ctx, key->x, 8 * key->len, MBEDTLS_DECRYPT ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setup(&ctx,
+                                          mbedtls_cipher_info_from_type(cipher_id)));
+    TEST_ASSERT(0 == mbedtls_cipher_setkey(&ctx, key->x, 8 * key->len, MBEDTLS_DECRYPT));
 #if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
-    if( pad_mode != -1 )
-        TEST_ASSERT( 0 == mbedtls_cipher_set_padding_mode( &ctx, pad_mode ) );
+    if (pad_mode != -1) {
+        TEST_ASSERT(0 == mbedtls_cipher_set_padding_mode(&ctx, pad_mode));
+    }
 #else
     (void) pad_mode;
 #endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */
-    TEST_ASSERT( 0 == mbedtls_cipher_set_iv( &ctx, iv->x, iv->len ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_reset( &ctx ) );
+    TEST_ASSERT(0 == mbedtls_cipher_set_iv(&ctx, iv->x, iv->len));
+    TEST_ASSERT(0 == mbedtls_cipher_reset(&ctx));
 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
-    TEST_ASSERT( 0 == mbedtls_cipher_update_ad( &ctx, ad->x, ad->len ) );
+    TEST_ASSERT(0 == mbedtls_cipher_update_ad(&ctx, ad->x, ad->len));
 #endif
 
     /* decode buffer and check tag->x */
     total_len = 0;
-    TEST_ASSERT( 0 == mbedtls_cipher_update( &ctx, cipher->x, cipher->len, output, &outlen ) );
+    TEST_ASSERT(0 == mbedtls_cipher_update(&ctx, cipher->x, cipher->len, output, &outlen));
     total_len += outlen;
-    TEST_ASSERT( finish_result == mbedtls_cipher_finish( &ctx, output + outlen,
-                                                 &outlen ) );
+    TEST_ASSERT(finish_result == mbedtls_cipher_finish(&ctx, output + outlen,
+                                                       &outlen));
     total_len += outlen;
 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
-    TEST_ASSERT( tag_result == mbedtls_cipher_check_tag( &ctx, tag->x, tag->len ) );
+    TEST_ASSERT(tag_result == mbedtls_cipher_check_tag(&ctx, tag->x, tag->len));
 #endif
 
     /* check plaintext only if everything went fine */
-    if( 0 == finish_result && 0 == tag_result )
-    {
-        TEST_ASSERT( total_len == clear->len );
-        TEST_ASSERT( 0 == memcmp( output, clear->x, clear->len ) );
+    if (0 == finish_result && 0 == tag_result) {
+        TEST_ASSERT(total_len == clear->len);
+        TEST_ASSERT(0 == memcmp(output, clear->x, clear->len));
     }
 
 exit:
-    mbedtls_cipher_free( &ctx );
+    mbedtls_cipher_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_AUTH_CRYPT */
-void auth_crypt_tv( int cipher_id, data_t * key, data_t * iv,
-                    data_t * ad, data_t * cipher, data_t * tag,
-                    char * result, data_t * clear, int use_psa )
+void auth_crypt_tv(int cipher_id, data_t *key, data_t *iv,
+                   data_t *ad, data_t *cipher, data_t *tag,
+                   char *result, data_t *clear, int use_psa)
 {
     /*
      * Take an AEAD ciphertext + tag and perform a pair
@@ -1172,19 +1178,23 @@
     /* Null pointers are documented as valid for inputs of length 0.
      * The test framework passes non-null pointers, so set them to NULL.
      * key, cipher and tag can't be empty. */
-    if( iv->len == 0 )
+    if (iv->len == 0) {
         iv->x = NULL;
-    if( ad->len == 0 )
+    }
+    if (ad->len == 0) {
         ad->x = NULL;
-    if( clear->len == 0 )
+    }
+    if (clear->len == 0) {
         clear->x = NULL;
+    }
 
-    mbedtls_cipher_init( &ctx );
+    mbedtls_cipher_init(&ctx);
 
     /* Initialize PSA Crypto */
 #if defined(MBEDTLS_USE_PSA_CRYPTO)
-    if( use_psa == 1 )
-        PSA_ASSERT( psa_crypto_init( ) );
+    if (use_psa == 1) {
+        PSA_ASSERT(psa_crypto_init());
+    }
 #else
     (void) use_psa;
 #endif
@@ -1209,125 +1219,121 @@
     /*
      * Prepare context for decryption
      */
-    if( ! cipher_reset_key( &ctx, cipher_id, use_psa, tag->len, key,
-                            MBEDTLS_DECRYPT ) )
+    if (!cipher_reset_key(&ctx, cipher_id, use_psa, tag->len, key,
+                          MBEDTLS_DECRYPT)) {
         goto exit;
+    }
 
     /*
      * prepare buffer for decryption
      * (we need the tag appended to the ciphertext)
      */
     cipher_plus_tag_len = cipher->len + tag->len;
-    ASSERT_ALLOC( cipher_plus_tag, cipher_plus_tag_len );
-    memcpy( cipher_plus_tag, cipher->x, cipher->len );
-    memcpy( cipher_plus_tag + cipher->len, tag->x, tag->len );
+    ASSERT_ALLOC(cipher_plus_tag, cipher_plus_tag_len);
+    memcpy(cipher_plus_tag, cipher->x, cipher->len);
+    memcpy(cipher_plus_tag + cipher->len, tag->x, tag->len);
 
     /*
      * Compute length of output buffer according to the documentation
      */
-    if( using_nist_kw )
+    if (using_nist_kw) {
         decrypt_buf_len = cipher_plus_tag_len - 8;
-    else
+    } else {
         decrypt_buf_len = cipher_plus_tag_len - tag->len;
+    }
 
 
     /*
      * Try decrypting to a buffer that's 1B too small
      */
-    if( decrypt_buf_len != 0 )
-    {
-        ASSERT_ALLOC( decrypt_buf, decrypt_buf_len - 1 );
+    if (decrypt_buf_len != 0) {
+        ASSERT_ALLOC(decrypt_buf, decrypt_buf_len - 1);
 
         outlen = 0;
-        ret = mbedtls_cipher_auth_decrypt_ext( &ctx, iv->x, iv->len,
-                ad->x, ad->len, cipher_plus_tag, cipher_plus_tag_len,
-                decrypt_buf, decrypt_buf_len - 1, &outlen, tag->len );
-        TEST_ASSERT( ret == MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+        ret = mbedtls_cipher_auth_decrypt_ext(&ctx, iv->x, iv->len,
+                                              ad->x, ad->len, cipher_plus_tag, cipher_plus_tag_len,
+                                              decrypt_buf, decrypt_buf_len - 1, &outlen, tag->len);
+        TEST_ASSERT(ret == MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-        mbedtls_free( decrypt_buf );
+        mbedtls_free(decrypt_buf);
         decrypt_buf = NULL;
     }
 
     /*
      * Authenticate and decrypt, and check result
      */
-    ASSERT_ALLOC( decrypt_buf, decrypt_buf_len );
+    ASSERT_ALLOC(decrypt_buf, decrypt_buf_len);
 
     outlen = 0;
-    ret = mbedtls_cipher_auth_decrypt_ext( &ctx, iv->x, iv->len,
-            ad->x, ad->len, cipher_plus_tag, cipher_plus_tag_len,
-            decrypt_buf, decrypt_buf_len, &outlen, tag->len );
+    ret = mbedtls_cipher_auth_decrypt_ext(&ctx, iv->x, iv->len,
+                                          ad->x, ad->len, cipher_plus_tag, cipher_plus_tag_len,
+                                          decrypt_buf, decrypt_buf_len, &outlen, tag->len);
 
-    if( strcmp( result, "FAIL" ) == 0 )
-    {
-        TEST_ASSERT( ret == MBEDTLS_ERR_CIPHER_AUTH_FAILED );
-        TEST_ASSERT( buffer_is_all_zero( decrypt_buf, decrypt_buf_len ) );
-    }
-    else
-    {
-        TEST_ASSERT( ret == 0 );
-        ASSERT_COMPARE( decrypt_buf, outlen, clear->x, clear->len );
+    if (strcmp(result, "FAIL") == 0) {
+        TEST_ASSERT(ret == MBEDTLS_ERR_CIPHER_AUTH_FAILED);
+        TEST_ASSERT(buffer_is_all_zero(decrypt_buf, decrypt_buf_len));
+    } else {
+        TEST_ASSERT(ret == 0);
+        ASSERT_COMPARE(decrypt_buf, outlen, clear->x, clear->len);
     }
 
     /* Free this, but keep cipher_plus_tag for deprecated function with PSA */
-    mbedtls_free( decrypt_buf );
+    mbedtls_free(decrypt_buf);
     decrypt_buf = NULL;
 
     /*
      * Encrypt back if test data was authentic
      */
-    if( strcmp( result, "FAIL" ) != 0 )
-    {
+    if (strcmp(result, "FAIL") != 0) {
         /* prepare context for encryption */
-        if( ! cipher_reset_key( &ctx, cipher_id, use_psa, tag->len, key,
-                                MBEDTLS_ENCRYPT ) )
+        if (!cipher_reset_key(&ctx, cipher_id, use_psa, tag->len, key,
+                              MBEDTLS_ENCRYPT)) {
             goto exit;
+        }
 
         /*
          * Compute size of output buffer according to documentation
          */
-        if( using_nist_kw )
-        {
+        if (using_nist_kw) {
             encrypt_buf_len = clear->len + 8;
-            if( using_nist_kw_padding && encrypt_buf_len % 8 != 0 )
+            if (using_nist_kw_padding && encrypt_buf_len % 8 != 0) {
                 encrypt_buf_len += 8 - encrypt_buf_len % 8;
-        }
-        else
-        {
+            }
+        } else {
             encrypt_buf_len = clear->len + tag->len;
         }
 
         /*
          * Try encrypting with an output buffer that's 1B too small
          */
-        ASSERT_ALLOC( encrypt_buf, encrypt_buf_len - 1 );
+        ASSERT_ALLOC(encrypt_buf, encrypt_buf_len - 1);
 
         outlen = 0;
-        ret = mbedtls_cipher_auth_encrypt_ext( &ctx, iv->x, iv->len,
-                ad->x, ad->len, clear->x, clear->len,
-                encrypt_buf, encrypt_buf_len - 1, &outlen, tag->len );
-        TEST_ASSERT( ret != 0 );
+        ret = mbedtls_cipher_auth_encrypt_ext(&ctx, iv->x, iv->len,
+                                              ad->x, ad->len, clear->x, clear->len,
+                                              encrypt_buf, encrypt_buf_len - 1, &outlen, tag->len);
+        TEST_ASSERT(ret != 0);
 
-        mbedtls_free( encrypt_buf );
+        mbedtls_free(encrypt_buf);
         encrypt_buf = NULL;
 
         /*
          * Encrypt and check the result
          */
-        ASSERT_ALLOC( encrypt_buf, encrypt_buf_len );
+        ASSERT_ALLOC(encrypt_buf, encrypt_buf_len);
 
         outlen = 0;
-        ret = mbedtls_cipher_auth_encrypt_ext( &ctx, iv->x, iv->len,
-                ad->x, ad->len, clear->x, clear->len,
-                encrypt_buf, encrypt_buf_len, &outlen, tag->len );
-        TEST_ASSERT( ret == 0 );
+        ret = mbedtls_cipher_auth_encrypt_ext(&ctx, iv->x, iv->len,
+                                              ad->x, ad->len, clear->x, clear->len,
+                                              encrypt_buf, encrypt_buf_len, &outlen, tag->len);
+        TEST_ASSERT(ret == 0);
 
-        TEST_ASSERT( outlen == cipher->len + tag->len );
-        TEST_ASSERT( memcmp( encrypt_buf, cipher->x, cipher->len ) == 0 );
-        TEST_ASSERT( memcmp( encrypt_buf + cipher->len,
-                             tag->x, tag->len ) == 0 );
+        TEST_ASSERT(outlen == cipher->len + tag->len);
+        TEST_ASSERT(memcmp(encrypt_buf, cipher->x, cipher->len) == 0);
+        TEST_ASSERT(memcmp(encrypt_buf + cipher->len,
+                           tag->x, tag->len) == 0);
 
-        mbedtls_free( encrypt_buf );
+        mbedtls_free(encrypt_buf);
         encrypt_buf = NULL;
     }
 
@@ -1343,22 +1349,21 @@
     /*
      * Prepare context for decryption
      */
-    if( ! cipher_reset_key( &ctx, cipher_id, use_psa, tag->len, key,
-                            MBEDTLS_DECRYPT ) )
+    if (!cipher_reset_key(&ctx, cipher_id, use_psa, tag->len, key,
+                          MBEDTLS_DECRYPT)) {
         goto exit;
+    }
 
     /*
      * Prepare pointers for decryption
      */
 #if defined(MBEDTLS_USE_PSA_CRYPTO)
-    if( use_psa == 1 )
-    {
+    if (use_psa == 1) {
         /* PSA requires that the tag immediately follows the ciphertext.
          * Fortunately, we already have that from testing the new API. */
         tmp_cipher = cipher_plus_tag;
         tmp_tag = tmp_cipher + cipher->len;
-    }
-    else
+    } else
 #endif /* MBEDTLS_USE_PSA_CRYPTO */
     {
         tmp_cipher = cipher->x;
@@ -1369,58 +1374,51 @@
      * Authenticate and decrypt, and check result
      */
 
-    ASSERT_ALLOC( decrypt_buf, cipher->len );
+    ASSERT_ALLOC(decrypt_buf, cipher->len);
     outlen = 0;
-    ret = mbedtls_cipher_auth_decrypt( &ctx, iv->x, iv->len, ad->x, ad->len,
-                               tmp_cipher, cipher->len, decrypt_buf, &outlen,
-                               tmp_tag, tag->len );
+    ret = mbedtls_cipher_auth_decrypt(&ctx, iv->x, iv->len, ad->x, ad->len,
+                                      tmp_cipher, cipher->len, decrypt_buf, &outlen,
+                                      tmp_tag, tag->len);
 
-    if( using_nist_kw )
-    {
+    if (using_nist_kw) {
         /* NIST_KW with legacy API */
-        TEST_ASSERT( ret == MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE );
-    }
-    else if( strcmp( result, "FAIL" ) == 0 )
-    {
+        TEST_ASSERT(ret == MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE);
+    } else if (strcmp(result, "FAIL") == 0) {
         /* unauthentic message */
-        TEST_ASSERT( ret == MBEDTLS_ERR_CIPHER_AUTH_FAILED );
-        TEST_ASSERT( buffer_is_all_zero( decrypt_buf, cipher->len ) );
-    }
-    else
-    {
+        TEST_ASSERT(ret == MBEDTLS_ERR_CIPHER_AUTH_FAILED);
+        TEST_ASSERT(buffer_is_all_zero(decrypt_buf, cipher->len));
+    } else {
         /* authentic message: is the plaintext correct? */
-        TEST_ASSERT( ret == 0 );
-        ASSERT_COMPARE(  decrypt_buf, outlen, clear->x, clear->len );
+        TEST_ASSERT(ret == 0);
+        ASSERT_COMPARE(decrypt_buf, outlen, clear->x, clear->len);
     }
 
-    mbedtls_free( decrypt_buf );
+    mbedtls_free(decrypt_buf);
     decrypt_buf = NULL;
-    mbedtls_free( cipher_plus_tag );
+    mbedtls_free(cipher_plus_tag);
     cipher_plus_tag = NULL;
 
     /*
      * Encrypt back if test data was authentic
      */
-    if( strcmp( result, "FAIL" ) != 0 )
-    {
+    if (strcmp(result, "FAIL") != 0) {
         /* prepare context for encryption */
-        if( ! cipher_reset_key( &ctx, cipher_id, use_psa, tag->len, key,
-                                MBEDTLS_ENCRYPT ) )
+        if (!cipher_reset_key(&ctx, cipher_id, use_psa, tag->len, key,
+                              MBEDTLS_ENCRYPT)) {
             goto exit;
+        }
 
         /* prepare buffers for encryption */
 #if defined(MBEDTLS_USE_PSA_CRYPTO)
-        if( use_psa )
-        {
-            ASSERT_ALLOC( cipher_plus_tag, cipher->len + tag->len );
+        if (use_psa) {
+            ASSERT_ALLOC(cipher_plus_tag, cipher->len + tag->len);
             tmp_cipher = cipher_plus_tag;
             tmp_tag = cipher_plus_tag + cipher->len;
-        }
-        else
+        } else
 #endif /* MBEDTLS_USE_PSA_CRYPTO */
         {
-            ASSERT_ALLOC( encrypt_buf, cipher->len );
-            ASSERT_ALLOC( tag_buf, tag->len );
+            ASSERT_ALLOC(encrypt_buf, cipher->len);
+            ASSERT_ALLOC(tag_buf, tag->len);
             tmp_cipher = encrypt_buf;
             tmp_tag = tag_buf;
         }
@@ -1429,22 +1427,20 @@
          * Encrypt and check the result
          */
         outlen = 0;
-        ret = mbedtls_cipher_auth_encrypt( &ctx, iv->x, iv->len, ad->x, ad->len,
-                                   clear->x, clear->len, tmp_cipher, &outlen,
-                                   tmp_tag, tag->len );
+        ret = mbedtls_cipher_auth_encrypt(&ctx, iv->x, iv->len, ad->x, ad->len,
+                                          clear->x, clear->len, tmp_cipher, &outlen,
+                                          tmp_tag, tag->len);
 
-        if( using_nist_kw )
-        {
-            TEST_ASSERT( ret == MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE );
-        }
-        else
-        {
-            TEST_ASSERT( ret == 0 );
+        if (using_nist_kw) {
+            TEST_ASSERT(ret == MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE);
+        } else {
+            TEST_ASSERT(ret == 0);
 
-            TEST_ASSERT( outlen == cipher->len );
-            if( cipher->len != 0 )
-                TEST_ASSERT( memcmp( tmp_cipher, cipher->x, cipher->len ) == 0 );
-            TEST_ASSERT( memcmp( tmp_tag, tag->x, tag->len ) == 0 );
+            TEST_ASSERT(outlen == cipher->len);
+            if (cipher->len != 0) {
+                TEST_ASSERT(memcmp(tmp_cipher, cipher->x, cipher->len) == 0);
+            }
+            TEST_ASSERT(memcmp(tmp_tag, tag->x, tag->len) == 0);
         }
     }
 
@@ -1452,158 +1448,161 @@
 
 exit:
 
-    mbedtls_cipher_free( &ctx );
-    mbedtls_free( decrypt_buf );
-    mbedtls_free( encrypt_buf );
-    mbedtls_free( cipher_plus_tag );
+    mbedtls_cipher_free(&ctx);
+    mbedtls_free(decrypt_buf);
+    mbedtls_free(encrypt_buf);
+    mbedtls_free(cipher_plus_tag);
 #if !defined(MBEDTLS_DEPRECATED_WARNING) && \
     !defined(MBEDTLS_DEPRECATED_REMOVED)
-    mbedtls_free( tag_buf );
+    mbedtls_free(tag_buf);
 #endif /* !MBEDTLS_DEPRECATED_WARNING && !MBEDTLS_DEPRECATED_REMOVED */
 
 #if defined(MBEDTLS_USE_PSA_CRYPTO)
-    if( use_psa == 1 )
-        PSA_DONE( );
+    if (use_psa == 1) {
+        PSA_DONE();
+    }
 #endif /* MBEDTLS_USE_PSA_CRYPTO */
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void test_vec_ecb( int cipher_id, int operation, data_t * key,
-                   data_t * input, data_t * result, int finish_result
-                   )
+void test_vec_ecb(int cipher_id, int operation, data_t *key,
+                  data_t *input, data_t *result, int finish_result
+                  )
 {
     mbedtls_cipher_context_t ctx;
     unsigned char output[32];
     size_t outlen;
 
-    mbedtls_cipher_init( &ctx );
+    mbedtls_cipher_init(&ctx);
 
-    memset( output, 0x00, sizeof( output ) );
+    memset(output, 0x00, sizeof(output));
 
     /* Prepare context */
-    TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx,
-                                       mbedtls_cipher_info_from_type( cipher_id ) ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setup(&ctx,
+                                          mbedtls_cipher_info_from_type(cipher_id)));
 
 
-    TEST_ASSERT( 0 == mbedtls_cipher_setkey( &ctx, key->x, 8 * key->len, operation ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setkey(&ctx, key->x, 8 * key->len, operation));
 
-    TEST_ASSERT( 0 == mbedtls_cipher_update( &ctx, input->x,
-                                     mbedtls_cipher_get_block_size( &ctx ),
-                                     output, &outlen ) );
-    TEST_ASSERT( outlen == mbedtls_cipher_get_block_size( &ctx ) );
-    TEST_ASSERT( finish_result == mbedtls_cipher_finish( &ctx, output + outlen,
-                                                 &outlen ) );
-    TEST_ASSERT( 0 == outlen );
+    TEST_ASSERT(0 == mbedtls_cipher_update(&ctx, input->x,
+                                           mbedtls_cipher_get_block_size(&ctx),
+                                           output, &outlen));
+    TEST_ASSERT(outlen == mbedtls_cipher_get_block_size(&ctx));
+    TEST_ASSERT(finish_result == mbedtls_cipher_finish(&ctx, output + outlen,
+                                                       &outlen));
+    TEST_ASSERT(0 == outlen);
 
     /* check plaintext only if everything went fine */
-    if( 0 == finish_result )
-        TEST_ASSERT( 0 == memcmp( output, result->x,
-                                  mbedtls_cipher_get_block_size( &ctx ) ) );
+    if (0 == finish_result) {
+        TEST_ASSERT(0 == memcmp(output, result->x,
+                                mbedtls_cipher_get_block_size(&ctx)));
+    }
 
 exit:
-    mbedtls_cipher_free( &ctx );
+    mbedtls_cipher_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_WITH_PADDING */
-void test_vec_crypt( int cipher_id, int operation, data_t *key,
-                     data_t *iv, data_t *input, data_t *result,
-                     int finish_result, int use_psa )
+void test_vec_crypt(int cipher_id, int operation, data_t *key,
+                    data_t *iv, data_t *input, data_t *result,
+                    int finish_result, int use_psa)
 {
     mbedtls_cipher_context_t ctx;
     unsigned char output[32];
     size_t outlen;
 
-    mbedtls_cipher_init( &ctx );
+    mbedtls_cipher_init(&ctx);
 
-    memset( output, 0x00, sizeof( output ) );
+    memset(output, 0x00, sizeof(output));
 
     /* Prepare context */
 #if !defined(MBEDTLS_USE_PSA_CRYPTO)
     (void) use_psa;
 #else
-    if( use_psa == 1 )
-    {
-        PSA_ASSERT( psa_crypto_init( ) );
-        TEST_ASSERT( 0 == mbedtls_cipher_setup_psa( &ctx,
-                              mbedtls_cipher_info_from_type( cipher_id ), 0 ) );
-    }
-    else
+    if (use_psa == 1) {
+        PSA_ASSERT(psa_crypto_init());
+        TEST_ASSERT(0 == mbedtls_cipher_setup_psa(&ctx,
+                                                  mbedtls_cipher_info_from_type(cipher_id), 0));
+    } else
 #endif /* MBEDTLS_USE_PSA_CRYPTO */
-    TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx,
-                              mbedtls_cipher_info_from_type( cipher_id ) ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setup(&ctx,
+                                          mbedtls_cipher_info_from_type(cipher_id)));
 
-    TEST_ASSERT( 0 == mbedtls_cipher_setkey( &ctx, key->x, 8 * key->len, operation ) );
-    if( MBEDTLS_MODE_CBC == ctx.cipher_info->mode )
-        TEST_ASSERT( 0 == mbedtls_cipher_set_padding_mode( &ctx, MBEDTLS_PADDING_NONE ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setkey(&ctx, key->x, 8 * key->len, operation));
+    if (MBEDTLS_MODE_CBC == ctx.cipher_info->mode) {
+        TEST_ASSERT(0 == mbedtls_cipher_set_padding_mode(&ctx, MBEDTLS_PADDING_NONE));
+    }
 
-    TEST_ASSERT( finish_result == mbedtls_cipher_crypt( &ctx, iv->len ? iv->x : NULL,
-                                                        iv->len, input->x, input->len,
-                                                        output, &outlen ) );
-    TEST_ASSERT( result->len == outlen );
+    TEST_ASSERT(finish_result == mbedtls_cipher_crypt(&ctx, iv->len ? iv->x : NULL,
+                                                      iv->len, input->x, input->len,
+                                                      output, &outlen));
+    TEST_ASSERT(result->len == outlen);
     /* check plaintext only if everything went fine */
-    if( 0 == finish_result )
-        TEST_ASSERT( 0 == memcmp( output, result->x, outlen ) );
+    if (0 == finish_result) {
+        TEST_ASSERT(0 == memcmp(output, result->x, outlen));
+    }
 
 exit:
-    mbedtls_cipher_free( &ctx );
+    mbedtls_cipher_free(&ctx);
 #if defined(MBEDTLS_USE_PSA_CRYPTO)
-    PSA_DONE( );
+    PSA_DONE();
 #endif /* MBEDTLS_USE_PSA_CRYPTO */
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_WITH_PADDING */
-void set_padding( int cipher_id, int pad_mode, int ret )
+void set_padding(int cipher_id, int pad_mode, int ret)
 {
     const mbedtls_cipher_info_t *cipher_info;
     mbedtls_cipher_context_t ctx;
 
-    mbedtls_cipher_init( &ctx );
+    mbedtls_cipher_init(&ctx);
 
-    cipher_info = mbedtls_cipher_info_from_type( cipher_id );
-    TEST_ASSERT( NULL != cipher_info );
-    TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx, cipher_info ) );
+    cipher_info = mbedtls_cipher_info_from_type(cipher_id);
+    TEST_ASSERT(NULL != cipher_info);
+    TEST_ASSERT(0 == mbedtls_cipher_setup(&ctx, cipher_info));
 
-    TEST_ASSERT( ret == mbedtls_cipher_set_padding_mode( &ctx, pad_mode ) );
+    TEST_ASSERT(ret == mbedtls_cipher_set_padding_mode(&ctx, pad_mode));
 
 exit:
-    mbedtls_cipher_free( &ctx );
+    mbedtls_cipher_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void check_padding( int pad_mode, data_t * input, int ret, int dlen_check
-                    )
+void check_padding(int pad_mode, data_t *input, int ret, int dlen_check
+                   )
 {
     mbedtls_cipher_info_t cipher_info;
     mbedtls_cipher_context_t ctx;
     size_t dlen;
 
     /* build a fake context just for getting access to get_padding */
-    mbedtls_cipher_init( &ctx );
+    mbedtls_cipher_init(&ctx);
     cipher_info.mode = MBEDTLS_MODE_CBC;
     ctx.cipher_info = &cipher_info;
 
-    TEST_ASSERT( 0 == mbedtls_cipher_set_padding_mode( &ctx, pad_mode ) );
+    TEST_ASSERT(0 == mbedtls_cipher_set_padding_mode(&ctx, pad_mode));
 
 
-    TEST_ASSERT( ret == ctx.get_padding( input->x, input->len, &dlen ) );
-    if( 0 == ret )
-        TEST_ASSERT( dlen == (size_t) dlen_check );
+    TEST_ASSERT(ret == ctx.get_padding(input->x, input->len, &dlen));
+    if (0 == ret) {
+        TEST_ASSERT(dlen == (size_t) dlen_check);
+    }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void iv_len_validity( int cipher_id, char * cipher_string,
-               int iv_len_val, int ret )
+void iv_len_validity(int cipher_id, char *cipher_string,
+                     int iv_len_val, int ret)
 {
     size_t iv_len = iv_len_val;
     unsigned char iv[16];
 
     /* Initialise iv buffer */
-    memset( iv, 0, sizeof( iv ) );
+    memset(iv, 0, sizeof(iv));
 
     const mbedtls_cipher_info_t *cipher_info;
     mbedtls_cipher_context_t ctx_dec;
@@ -1612,23 +1611,23 @@
     /*
      * Prepare contexts
      */
-    mbedtls_cipher_init( &ctx_dec );
-    mbedtls_cipher_init( &ctx_enc );
+    mbedtls_cipher_init(&ctx_dec);
+    mbedtls_cipher_init(&ctx_enc);
 
     /* Check and get info structures */
-    cipher_info = mbedtls_cipher_info_from_type( cipher_id );
-    TEST_ASSERT( NULL != cipher_info );
-    TEST_ASSERT( mbedtls_cipher_info_from_string( cipher_string ) == cipher_info );
+    cipher_info = mbedtls_cipher_info_from_type(cipher_id);
+    TEST_ASSERT(NULL != cipher_info);
+    TEST_ASSERT(mbedtls_cipher_info_from_string(cipher_string) == cipher_info);
 
     /* Initialise enc and dec contexts */
-    TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx_dec, cipher_info ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_setup( &ctx_enc, cipher_info ) );
+    TEST_ASSERT(0 == mbedtls_cipher_setup(&ctx_dec, cipher_info));
+    TEST_ASSERT(0 == mbedtls_cipher_setup(&ctx_enc, cipher_info));
 
-    TEST_ASSERT( ret == mbedtls_cipher_set_iv( &ctx_dec, iv, iv_len ) );
-    TEST_ASSERT( ret == mbedtls_cipher_set_iv( &ctx_enc, iv, iv_len ) );
+    TEST_ASSERT(ret == mbedtls_cipher_set_iv(&ctx_dec, iv, iv_len));
+    TEST_ASSERT(ret == mbedtls_cipher_set_iv(&ctx_enc, iv, iv_len));
 
 exit:
-    mbedtls_cipher_free( &ctx_dec );
-    mbedtls_cipher_free( &ctx_enc );
+    mbedtls_cipher_free(&ctx_dec);
+    mbedtls_cipher_free(&ctx_enc);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_cmac.function b/tests/suites/test_suite_cmac.function
index c3d7da4..9624e8f 100644
--- a/tests/suites/test_suite_cmac.function
+++ b/tests/suites/test_suite_cmac.function
@@ -9,14 +9,14 @@
  */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void mbedtls_cmac_self_test(  )
+void mbedtls_cmac_self_test()
 {
-    TEST_ASSERT( mbedtls_cmac_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_cmac_self_test(1) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_cmac_null_args(  )
+void mbedtls_cmac_null_args()
 {
     mbedtls_cipher_context_t ctx;
     const mbedtls_cipher_info_t *cipher_info;
@@ -24,108 +24,108 @@
     unsigned char test_data[MBEDTLS_CIPHER_BLKSIZE_MAX];
     unsigned char test_output[MBEDTLS_CIPHER_BLKSIZE_MAX];
 
-    mbedtls_cipher_init( &ctx );
+    mbedtls_cipher_init(&ctx);
 
     /* Test NULL cipher info */
-    TEST_ASSERT( mbedtls_cipher_cmac_update( &ctx, test_data, 16 ) ==
-                                         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_cmac_update(&ctx, test_data, 16) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-    cipher_info = mbedtls_cipher_info_from_type( MBEDTLS_CIPHER_AES_128_ECB );
-    TEST_ASSERT( mbedtls_cipher_setup( &ctx, cipher_info ) == 0 );
+    cipher_info = mbedtls_cipher_info_from_type(MBEDTLS_CIPHER_AES_128_ECB);
+    TEST_ASSERT(mbedtls_cipher_setup(&ctx, cipher_info) == 0);
 
-    TEST_ASSERT( mbedtls_cipher_cmac_starts( NULL, test_key, 128 ) ==
-                                         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_cmac_starts(NULL, test_key, 128) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_cipher_cmac_starts( &ctx, NULL, 128 ) ==
-                                         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_cmac_starts(&ctx, NULL, 128) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_cipher_cmac_update( NULL, test_data, 16 ) ==
-                                         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_cmac_update(NULL, test_data, 16) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_cipher_cmac_update( &ctx, NULL, 16 ) ==
-                                         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_cmac_update(&ctx, NULL, 16) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_cipher_cmac_finish( NULL, test_output ) ==
-                                         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_cmac_finish(NULL, test_output) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_cipher_cmac_finish( &ctx, NULL ) ==
-                                         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_cmac_finish(&ctx, NULL) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_cipher_cmac_reset( NULL ) ==
-                                         MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_cmac_reset(NULL) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_cipher_cmac( NULL,
-                                      test_key, 128,
-                                      test_data, 16,
-                                      test_output ) ==
-                                            MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_cmac(NULL,
+                                    test_key, 128,
+                                    test_data, 16,
+                                    test_output) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_cipher_cmac( cipher_info,
-                                      NULL, 128,
-                                      test_data, 16,
-                                      test_output ) ==
-                                            MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_cmac(cipher_info,
+                                    NULL, 128,
+                                    test_data, 16,
+                                    test_output) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_cipher_cmac( cipher_info,
-                                      test_key, 128,
-                                      NULL, 16,
-                                      test_output ) ==
-                                            MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_cmac(cipher_info,
+                                    test_key, 128,
+                                    NULL, 16,
+                                    test_output) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_cipher_cmac( cipher_info,
-                                      test_key, 128,
-                                      test_data, 16,
-                                      NULL ) ==
-                                            MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_cipher_cmac(cipher_info,
+                                    test_key, 128,
+                                    test_data, 16,
+                                    NULL) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 #if defined(MBEDTLS_AES_C)
-    TEST_ASSERT( mbedtls_aes_cmac_prf_128( NULL, 16,
-                                           test_data, 16,
-                                           test_output ) ==
-                                           MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_aes_cmac_prf_128(NULL, 16,
+                                         test_data, 16,
+                                         test_output) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_aes_cmac_prf_128( test_key, 16,
-                                           NULL, 16,
-                                           test_output ) ==
-                                              MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_aes_cmac_prf_128(test_key, 16,
+                                         NULL, 16,
+                                         test_output) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_aes_cmac_prf_128( test_key, 16,
-                                           test_data, 16,
-                                           NULL ) ==
-                                              MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_aes_cmac_prf_128(test_key, 16,
+                                         test_data, 16,
+                                         NULL) ==
+                MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA);
 #endif
 exit:
-    mbedtls_cipher_free( &ctx );
+    mbedtls_cipher_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_cmac_setkey( int cipher_type, int key_size, int result )
+void mbedtls_cmac_setkey(int cipher_type, int key_size, int result)
 {
     const mbedtls_cipher_info_t *cipher_info;
     unsigned char key[32];
     unsigned char buf[16];
     unsigned char tmp[16];
 
-    memset( key, 0x2A, sizeof( key ) );
-    TEST_ASSERT( (unsigned) key_size <= 8 * sizeof( key ) );
+    memset(key, 0x2A, sizeof(key));
+    TEST_ASSERT((unsigned) key_size <= 8 * sizeof(key));
 
-    TEST_ASSERT( ( cipher_info = mbedtls_cipher_info_from_type( cipher_type ) )
-                    != NULL );
+    TEST_ASSERT((cipher_info = mbedtls_cipher_info_from_type(cipher_type))
+                != NULL);
 
-    memset( buf, 0x2A, sizeof( buf ) );
-    TEST_ASSERT( ( result == mbedtls_cipher_cmac( cipher_info, key, key_size,
-                                                buf, 16, tmp ) ) != 0 );
+    memset(buf, 0x2A, sizeof(buf));
+    TEST_ASSERT((result == mbedtls_cipher_cmac(cipher_info, key, key_size,
+                                               buf, 16, tmp)) != 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_cmac_multiple_blocks( int cipher_type, data_t * key,
-                                   int keybits, int block_size,
-                                   data_t * block1, int block1_len,
-                                   data_t * block2, int block2_len,
-                                   data_t * block3, int block3_len,
-                                   data_t * block4, int block4_len,
-                                   data_t * expected_result )
+void mbedtls_cmac_multiple_blocks(int cipher_type, data_t *key,
+                                  int keybits, int block_size,
+                                  data_t *block1, int block1_len,
+                                  data_t *block2, int block2_len,
+                                  data_t *block3, int block3_len,
+                                  data_t *block4, int block4_len,
+                                  data_t *expected_result)
 {
     const mbedtls_cipher_info_t *cipher_info;
     mbedtls_cipher_context_t ctx;
@@ -133,74 +133,78 @@
 
     /* Convert the test parameters to binary data */
 
-    mbedtls_cipher_init( &ctx );
+    mbedtls_cipher_init(&ctx);
 
     /* Validate the test inputs */
-    TEST_ASSERT( block1_len <= 100 );
-    TEST_ASSERT( block2_len <= 100 );
-    TEST_ASSERT( block3_len <= 100 );
-    TEST_ASSERT( block4_len <= 100 );
+    TEST_ASSERT(block1_len <= 100);
+    TEST_ASSERT(block2_len <= 100);
+    TEST_ASSERT(block3_len <= 100);
+    TEST_ASSERT(block4_len <= 100);
 
     /* Set up */
-    TEST_ASSERT( ( cipher_info = mbedtls_cipher_info_from_type( cipher_type ) )
-                    != NULL );
+    TEST_ASSERT((cipher_info = mbedtls_cipher_info_from_type(cipher_type))
+                != NULL);
 
-    TEST_ASSERT( mbedtls_cipher_setup( &ctx, cipher_info ) == 0 );
+    TEST_ASSERT(mbedtls_cipher_setup(&ctx, cipher_info) == 0);
 
-    TEST_ASSERT( mbedtls_cipher_cmac_starts( &ctx,
-                                             (const unsigned char*)key->x,
-                                             keybits ) == 0 );
+    TEST_ASSERT(mbedtls_cipher_cmac_starts(&ctx,
+                                           (const unsigned char *) key->x,
+                                           keybits) == 0);
 
     /* Multiple partial and complete blocks. A negative length means skip the
      * update operation */
-    if( block1_len >= 0)
-        TEST_ASSERT( mbedtls_cipher_cmac_update( &ctx,
-                                                 (unsigned char*)block1->x,
-                                                 block1_len ) == 0);
+    if (block1_len >= 0) {
+        TEST_ASSERT(mbedtls_cipher_cmac_update(&ctx,
+                                               (unsigned char *) block1->x,
+                                               block1_len) == 0);
+    }
 
-    if( block2_len >= 0 )
-        TEST_ASSERT( mbedtls_cipher_cmac_update( &ctx,
-                                                 (unsigned char*)block2->x,
-                                                 block2_len ) == 0);
+    if (block2_len >= 0) {
+        TEST_ASSERT(mbedtls_cipher_cmac_update(&ctx,
+                                               (unsigned char *) block2->x,
+                                               block2_len) == 0);
+    }
 
-    if( block3_len >= 0 )
-        TEST_ASSERT( mbedtls_cipher_cmac_update( &ctx,
-                                                 (unsigned char*)block3->x,
-                                                 block3_len ) == 0);
+    if (block3_len >= 0) {
+        TEST_ASSERT(mbedtls_cipher_cmac_update(&ctx,
+                                               (unsigned char *) block3->x,
+                                               block3_len) == 0);
+    }
 
-    if( block4_len >= 0 )
-        TEST_ASSERT( mbedtls_cipher_cmac_update( &ctx,
-                                                 (unsigned char*)block4->x,
-                                                 block4_len ) == 0);
+    if (block4_len >= 0) {
+        TEST_ASSERT(mbedtls_cipher_cmac_update(&ctx,
+                                               (unsigned char *) block4->x,
+                                               block4_len) == 0);
+    }
 
-    TEST_ASSERT( mbedtls_cipher_cmac_finish( &ctx, output ) == 0 );
+    TEST_ASSERT(mbedtls_cipher_cmac_finish(&ctx, output) == 0);
 
-    TEST_ASSERT( memcmp( output, expected_result->x, block_size )  == 0 );
+    TEST_ASSERT(memcmp(output, expected_result->x, block_size)  == 0);
 
 exit:
-    mbedtls_cipher_free( &ctx );
+    mbedtls_cipher_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_cmac_multiple_operations_same_key( int cipher_type,
-                                                data_t * key, int keybits,
-                                                int block_size,
-                                                data_t * block_a1,
-                                                int block_a1_len,
-                                                data_t * block_a2,
-                                                int block_a2_len,
-                                                data_t * block_a3,
-                                                int block_a3_len,
-                                                data_t * expected_result_a,
-                                                data_t * block_b1,
-                                                int block_b1_len,
-                                                data_t * block_b2,
-                                                int block_b2_len,
-                                                data_t * block_b3,
-                                                int block_b3_len,
-                                                data_t * expected_result_b
-                                                )
+void mbedtls_cmac_multiple_operations_same_key(int cipher_type,
+                                               data_t *key, int keybits,
+                                               int block_size,
+                                               data_t *block_a1,
+                                               int block_a1_len,
+                                               data_t *block_a2,
+                                               int block_a2_len,
+                                               data_t *block_a3,
+                                               int block_a3_len,
+                                               data_t *expected_result_a,
+                                               data_t *block_b1,
+                                               int block_b1_len,
+                                               data_t *block_b2,
+                                               int block_b2_len,
+                                               data_t *block_b3,
+                                               int block_b3_len,
+                                               data_t *expected_result_b
+                                               )
 {
     const mbedtls_cipher_info_t *cipher_info;
     mbedtls_cipher_context_t ctx;
@@ -210,77 +214,82 @@
 
 
 
-    mbedtls_cipher_init( &ctx );
+    mbedtls_cipher_init(&ctx);
 
     /* Validate the test inputs */
-    TEST_ASSERT( block_a1_len <= 100 );
-    TEST_ASSERT( block_a2_len <= 100 );
-    TEST_ASSERT( block_a3_len <= 100 );
+    TEST_ASSERT(block_a1_len <= 100);
+    TEST_ASSERT(block_a2_len <= 100);
+    TEST_ASSERT(block_a3_len <= 100);
 
-    TEST_ASSERT( block_b1_len <= 100 );
-    TEST_ASSERT( block_b2_len <= 100 );
-    TEST_ASSERT( block_b3_len <= 100 );
+    TEST_ASSERT(block_b1_len <= 100);
+    TEST_ASSERT(block_b2_len <= 100);
+    TEST_ASSERT(block_b3_len <= 100);
 
     /* Set up */
-    TEST_ASSERT( ( cipher_info = mbedtls_cipher_info_from_type( cipher_type ) )
-                    != NULL );
+    TEST_ASSERT((cipher_info = mbedtls_cipher_info_from_type(cipher_type))
+                != NULL);
 
-    TEST_ASSERT( mbedtls_cipher_setup( &ctx, cipher_info ) == 0 );
+    TEST_ASSERT(mbedtls_cipher_setup(&ctx, cipher_info) == 0);
 
-    TEST_ASSERT( mbedtls_cipher_cmac_starts( &ctx,
-                                             (const unsigned char*)key->x,
-                                             keybits ) == 0 );
+    TEST_ASSERT(mbedtls_cipher_cmac_starts(&ctx,
+                                           (const unsigned char *) key->x,
+                                           keybits) == 0);
 
     /* Sequence A */
 
     /* Multiple partial and complete blocks. A negative length means skip the
      * update operation */
-    if( block_a1_len >= 0 )
-        TEST_ASSERT( mbedtls_cipher_cmac_update( &ctx,
-                                                 (unsigned char*)block_a1->x,
-                                                 block_a1_len ) == 0);
+    if (block_a1_len >= 0) {
+        TEST_ASSERT(mbedtls_cipher_cmac_update(&ctx,
+                                               (unsigned char *) block_a1->x,
+                                               block_a1_len) == 0);
+    }
 
-    if( block_a2_len >= 0 )
-        TEST_ASSERT( mbedtls_cipher_cmac_update( &ctx,
-                                                 (unsigned char*)block_a2->x,
-                                                 block_a2_len ) == 0);
+    if (block_a2_len >= 0) {
+        TEST_ASSERT(mbedtls_cipher_cmac_update(&ctx,
+                                               (unsigned char *) block_a2->x,
+                                               block_a2_len) == 0);
+    }
 
-    if( block_a3_len >= 0 )
-        TEST_ASSERT( mbedtls_cipher_cmac_update( &ctx,
-                                                 (unsigned char*)block_a3->x,
-                                                  block_a3_len ) == 0);
+    if (block_a3_len >= 0) {
+        TEST_ASSERT(mbedtls_cipher_cmac_update(&ctx,
+                                               (unsigned char *) block_a3->x,
+                                               block_a3_len) == 0);
+    }
 
-    TEST_ASSERT( mbedtls_cipher_cmac_finish( &ctx, output ) == 0 );
+    TEST_ASSERT(mbedtls_cipher_cmac_finish(&ctx, output) == 0);
 
-    TEST_ASSERT( memcmp( output, expected_result_a->x, block_size )  == 0 );
+    TEST_ASSERT(memcmp(output, expected_result_a->x, block_size)  == 0);
 
-    TEST_ASSERT( mbedtls_cipher_cmac_reset( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_cipher_cmac_reset(&ctx) == 0);
 
     /* Sequence B */
 
     /* Multiple partial and complete blocks. A negative length means skip the
      * update operation */
-    if( block_b1_len >= 0)
-        TEST_ASSERT( mbedtls_cipher_cmac_update( &ctx,
-                                                 (unsigned char*)block_b1->x,
-                                                 block_b1_len ) == 0);
+    if (block_b1_len >= 0) {
+        TEST_ASSERT(mbedtls_cipher_cmac_update(&ctx,
+                                               (unsigned char *) block_b1->x,
+                                               block_b1_len) == 0);
+    }
 
-    if( block_b2_len >= 0 )
-        TEST_ASSERT( mbedtls_cipher_cmac_update( &ctx,
-                                                 (unsigned char*)block_b2->x,
-                                                 block_b2_len ) == 0);
+    if (block_b2_len >= 0) {
+        TEST_ASSERT(mbedtls_cipher_cmac_update(&ctx,
+                                               (unsigned char *) block_b2->x,
+                                               block_b2_len) == 0);
+    }
 
-    if( block_b3_len >= 0 )
-        TEST_ASSERT( mbedtls_cipher_cmac_update( &ctx,
-                                                 (unsigned char*)block_b3->x,
-                                                 block_b3_len ) == 0);
+    if (block_b3_len >= 0) {
+        TEST_ASSERT(mbedtls_cipher_cmac_update(&ctx,
+                                               (unsigned char *) block_b3->x,
+                                               block_b3_len) == 0);
+    }
 
-    TEST_ASSERT( mbedtls_cipher_cmac_finish( &ctx, output ) == 0 );
+    TEST_ASSERT(mbedtls_cipher_cmac_finish(&ctx, output) == 0);
 
-    TEST_ASSERT( memcmp( output, expected_result_b->x, block_size )  == 0 );
+    TEST_ASSERT(memcmp(output, expected_result_b->x, block_size)  == 0);
 
 exit:
-    mbedtls_cipher_free( &ctx );
+    mbedtls_cipher_free(&ctx);
 }
 /* END_CASE */
-
diff --git a/tests/suites/test_suite_constant_time.function b/tests/suites/test_suite_constant_time.function
index a3673b7..a40149a 100644
--- a/tests/suites/test_suite_constant_time.function
+++ b/tests/suites/test_suite_constant_time.function
@@ -16,34 +16,33 @@
 /* END_HEADER */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC:MBEDTLS_TEST_HOOKS */
-void ssl_cf_memcpy_offset( int offset_min, int offset_max, int len )
+void ssl_cf_memcpy_offset(int offset_min, int offset_max, int len)
 {
     unsigned char *dst = NULL;
     unsigned char *src = NULL;
     size_t src_len = offset_max + len;
     size_t secret;
 
-    ASSERT_ALLOC( dst, len );
-    ASSERT_ALLOC( src, src_len );
+    ASSERT_ALLOC(dst, len);
+    ASSERT_ALLOC(src, src_len);
 
     /* Fill src in a way that we can detect if we copied the right bytes */
-    mbedtls_test_rnd_std_rand( NULL, src, src_len );
+    mbedtls_test_rnd_std_rand(NULL, src, src_len);
 
-    for( secret = offset_min; secret <= (size_t) offset_max; secret++ )
-    {
-        mbedtls_test_set_step( (int) secret );
+    for (secret = offset_min; secret <= (size_t) offset_max; secret++) {
+        mbedtls_test_set_step((int) secret);
 
-        TEST_CF_SECRET( &secret, sizeof( secret ) );
-        mbedtls_ct_memcpy_offset( dst, src, secret,
-                                  offset_min, offset_max, len );
-        TEST_CF_PUBLIC( &secret, sizeof( secret ) );
-        TEST_CF_PUBLIC( dst, len );
+        TEST_CF_SECRET(&secret, sizeof(secret));
+        mbedtls_ct_memcpy_offset(dst, src, secret,
+                                 offset_min, offset_max, len);
+        TEST_CF_PUBLIC(&secret, sizeof(secret));
+        TEST_CF_PUBLIC(dst, len);
 
-        ASSERT_COMPARE( dst, len, src + secret, len );
+        ASSERT_COMPARE(dst, len, src + secret, len);
     }
 
 exit:
-    mbedtls_free( dst );
-    mbedtls_free( src );
+    mbedtls_free(dst);
+    mbedtls_free(src);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_constant_time_hmac.function b/tests/suites/test_suite_constant_time_hmac.function
index c19cde9..57d5a4e 100644
--- a/tests/suites/test_suite_constant_time_hmac.function
+++ b/tests/suites/test_suite_constant_time_hmac.function
@@ -8,7 +8,7 @@
 /* END_HEADER */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC:MBEDTLS_TEST_HOOKS */
-void ssl_cf_hmac( int hash )
+void ssl_cf_hmac(int hash)
 {
     /*
      * Test the function mbedtls_ct_hmac() against a reference
@@ -25,78 +25,77 @@
     unsigned char *out = NULL;
     unsigned char rec_num = 0;
 
-    mbedtls_md_init( &ctx );
-    mbedtls_md_init( &ref_ctx );
+    mbedtls_md_init(&ctx);
+    mbedtls_md_init(&ref_ctx);
 
-    md_info = mbedtls_md_info_from_type( hash );
-    TEST_ASSERT( md_info != NULL );
-    out_len = mbedtls_md_get_size( md_info );
-    TEST_ASSERT( out_len != 0 );
+    md_info = mbedtls_md_info_from_type(hash);
+    TEST_ASSERT(md_info != NULL);
+    out_len = mbedtls_md_get_size(md_info);
+    TEST_ASSERT(out_len != 0);
     block_size = hash == MBEDTLS_MD_SHA384 ? 128 : 64;
 
     /* Use allocated out buffer to catch overwrites */
-    ASSERT_ALLOC( out, out_len );
+    ASSERT_ALLOC(out, out_len);
 
     /* Set up contexts with the given hash and a dummy key */
-    TEST_EQUAL( 0, mbedtls_md_setup( &ctx, md_info, 1 ) );
-    TEST_EQUAL( 0, mbedtls_md_setup( &ref_ctx, md_info, 1 ) );
-    memset( ref_out, 42, sizeof( ref_out ) );
-    TEST_EQUAL( 0, mbedtls_md_hmac_starts( &ctx, ref_out, out_len ) );
-    TEST_EQUAL( 0, mbedtls_md_hmac_starts( &ref_ctx, ref_out, out_len ) );
-    memset( ref_out, 0, sizeof( ref_out ) );
+    TEST_EQUAL(0, mbedtls_md_setup(&ctx, md_info, 1));
+    TEST_EQUAL(0, mbedtls_md_setup(&ref_ctx, md_info, 1));
+    memset(ref_out, 42, sizeof(ref_out));
+    TEST_EQUAL(0, mbedtls_md_hmac_starts(&ctx, ref_out, out_len));
+    TEST_EQUAL(0, mbedtls_md_hmac_starts(&ref_ctx, ref_out, out_len));
+    memset(ref_out, 0, sizeof(ref_out));
 
     /*
      * Test all possible lengths up to a point. The difference between
      * max_in_len and min_in_len is at most 255, and make sure they both vary
      * by at least one block size.
      */
-    for( max_in_len = 0; max_in_len <= 255 + block_size; max_in_len++ )
-    {
-        mbedtls_test_set_step( max_in_len * 10000 );
+    for (max_in_len = 0; max_in_len <= 255 + block_size; max_in_len++) {
+        mbedtls_test_set_step(max_in_len * 10000);
 
         /* Use allocated in buffer to catch overreads */
-        ASSERT_ALLOC( data, max_in_len );
+        ASSERT_ALLOC(data, max_in_len);
 
         min_in_len = max_in_len > 255 ? max_in_len - 255 : 0;
-        for( in_len = min_in_len; in_len <= max_in_len; in_len++ )
-        {
-            mbedtls_test_set_step( max_in_len * 10000 + in_len );
+        for (in_len = min_in_len; in_len <= max_in_len; in_len++) {
+            mbedtls_test_set_step(max_in_len * 10000 + in_len);
 
             /* Set up dummy data and add_data */
             rec_num++;
-            memset( add_data, rec_num, sizeof( add_data ) );
-            for( i = 0; i < in_len; i++ )
-                data[i] = ( i & 0xff ) ^ rec_num;
+            memset(add_data, rec_num, sizeof(add_data));
+            for (i = 0; i < in_len; i++) {
+                data[i] = (i & 0xff) ^ rec_num;
+            }
 
             /* Get the function's result */
-            TEST_CF_SECRET( &in_len, sizeof( in_len ) );
-            TEST_EQUAL( 0, mbedtls_ct_hmac( &ctx, add_data, sizeof( add_data ),
-                                            data, in_len,
-                                            min_in_len, max_in_len,
-                                            out ) );
-            TEST_CF_PUBLIC( &in_len, sizeof( in_len ) );
-            TEST_CF_PUBLIC( out, out_len );
+            TEST_CF_SECRET(&in_len, sizeof(in_len));
+            TEST_EQUAL(0, mbedtls_ct_hmac(&ctx, add_data, sizeof(add_data),
+                                          data, in_len,
+                                          min_in_len, max_in_len,
+                                          out));
+            TEST_CF_PUBLIC(&in_len, sizeof(in_len));
+            TEST_CF_PUBLIC(out, out_len);
 
             /* Compute the reference result */
-            TEST_EQUAL( 0, mbedtls_md_hmac_update( &ref_ctx, add_data,
-                                                   sizeof( add_data ) ) );
-            TEST_EQUAL( 0, mbedtls_md_hmac_update( &ref_ctx, data, in_len ) );
-            TEST_EQUAL( 0, mbedtls_md_hmac_finish( &ref_ctx, ref_out ) );
-            TEST_EQUAL( 0, mbedtls_md_hmac_reset( &ref_ctx ) );
+            TEST_EQUAL(0, mbedtls_md_hmac_update(&ref_ctx, add_data,
+                                                 sizeof(add_data)));
+            TEST_EQUAL(0, mbedtls_md_hmac_update(&ref_ctx, data, in_len));
+            TEST_EQUAL(0, mbedtls_md_hmac_finish(&ref_ctx, ref_out));
+            TEST_EQUAL(0, mbedtls_md_hmac_reset(&ref_ctx));
 
             /* Compare */
-            ASSERT_COMPARE( out, out_len, ref_out, out_len );
+            ASSERT_COMPARE(out, out_len, ref_out, out_len);
         }
 
-        mbedtls_free( data );
+        mbedtls_free(data);
         data = NULL;
     }
 
 exit:
-    mbedtls_md_free( &ref_ctx );
-    mbedtls_md_free( &ctx );
+    mbedtls_md_free(&ref_ctx);
+    mbedtls_md_free(&ctx);
 
-    mbedtls_free( data );
-    mbedtls_free( out );
+    mbedtls_free(data);
+    mbedtls_free(out);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_ctr_drbg.function b/tests/suites/test_suite_ctr_drbg.function
index c3ffe3b..29753ff 100644
--- a/tests/suites/test_suite_ctr_drbg.function
+++ b/tests/suites/test_suite_ctr_drbg.function
@@ -4,8 +4,7 @@
 #include "string.h"
 
 /* Modes for ctr_drbg_validate */
-enum reseed_mode
-{
+enum reseed_mode {
     RESEED_NEVER, /* never reseed */
     RESEED_FIRST, /* instantiate, reseed, generate, generate */
     RESEED_SECOND, /* instantiate, generate, reseed, generate */
@@ -14,83 +13,83 @@
 
 static size_t test_offset_idx = 0;
 static size_t test_max_idx  = 0;
-static int mbedtls_test_entropy_func( void *data, unsigned char *buf, size_t len )
+static int mbedtls_test_entropy_func(void *data, unsigned char *buf, size_t len)
 {
     const unsigned char *p = (unsigned char *) data;
-    if( test_offset_idx + len > test_max_idx )
-        return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
-    memcpy( buf, p + test_offset_idx, len );
+    if (test_offset_idx + len > test_max_idx) {
+        return MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
+    }
+    memcpy(buf, p + test_offset_idx, len);
     test_offset_idx += len;
-    return( 0 );
+    return 0;
 }
 
-static void ctr_drbg_validate_internal( int reseed_mode, data_t * nonce,
-                        int entropy_len_arg, data_t * entropy,
-                        data_t * reseed,
-                        data_t * add1, data_t * add2,
-                        data_t * result )
+static void ctr_drbg_validate_internal(int reseed_mode, data_t *nonce,
+                                       int entropy_len_arg, data_t *entropy,
+                                       data_t *reseed,
+                                       data_t *add1, data_t *add2,
+                                       data_t *result)
 {
     mbedtls_ctr_drbg_context ctx;
     unsigned char buf[64];
 
     size_t entropy_chunk_len = (size_t) entropy_len_arg;
 
-    TEST_ASSERT( entropy_chunk_len <= sizeof( buf ) );
+    TEST_ASSERT(entropy_chunk_len <= sizeof(buf));
 
     test_offset_idx = 0;
-    mbedtls_ctr_drbg_init( &ctx );
+    mbedtls_ctr_drbg_init(&ctx);
 
     test_max_idx = entropy->len;
 
     /* CTR_DRBG_Instantiate(entropy[:entropy->len], nonce, perso, <ignored>)
      * where nonce||perso = nonce[nonce->len] */
-    mbedtls_ctr_drbg_set_entropy_len( &ctx, entropy_chunk_len );
-    mbedtls_ctr_drbg_set_nonce_len( &ctx, 0 );
-    TEST_ASSERT( mbedtls_ctr_drbg_seed(
-                     &ctx,
-                     mbedtls_test_entropy_func, entropy->x,
-                     nonce->x, nonce->len ) == 0 );
-    if( reseed_mode == RESEED_ALWAYS )
+    mbedtls_ctr_drbg_set_entropy_len(&ctx, entropy_chunk_len);
+    mbedtls_ctr_drbg_set_nonce_len(&ctx, 0);
+    TEST_ASSERT(mbedtls_ctr_drbg_seed(
+                    &ctx,
+                    mbedtls_test_entropy_func, entropy->x,
+                    nonce->x, nonce->len) == 0);
+    if (reseed_mode == RESEED_ALWAYS) {
         mbedtls_ctr_drbg_set_prediction_resistance(
             &ctx,
-            MBEDTLS_CTR_DRBG_PR_ON );
+            MBEDTLS_CTR_DRBG_PR_ON);
+    }
 
-    if( reseed_mode == RESEED_FIRST )
-    {
+    if (reseed_mode == RESEED_FIRST) {
         /* CTR_DRBG_Reseed(entropy[idx:idx+entropy->len],
          *                 reseed[:reseed->len]) */
-        TEST_ASSERT( mbedtls_ctr_drbg_reseed(
-                         &ctx,
-                         reseed->x, reseed->len ) == 0 );
+        TEST_ASSERT(mbedtls_ctr_drbg_reseed(
+                        &ctx,
+                        reseed->x, reseed->len) == 0);
     }
 
     /* CTR_DRBG_Generate(result->len * 8 bits, add1[:add1->len]) -> buf */
     /* Then reseed if prediction resistance is enabled. */
-    TEST_ASSERT( mbedtls_ctr_drbg_random_with_add(
-                     &ctx,
-                     buf, result->len,
-                     add1->x, add1->len ) == 0 );
+    TEST_ASSERT(mbedtls_ctr_drbg_random_with_add(
+                    &ctx,
+                    buf, result->len,
+                    add1->x, add1->len) == 0);
 
 
-    if( reseed_mode == RESEED_SECOND )
-    {
+    if (reseed_mode == RESEED_SECOND) {
         /* CTR_DRBG_Reseed(entropy[idx:idx+entropy->len],
          *                 reseed[:reseed->len]) */
-        TEST_ASSERT( mbedtls_ctr_drbg_reseed(
-                         &ctx,
-                         reseed->x, reseed->len ) == 0 );
+        TEST_ASSERT(mbedtls_ctr_drbg_reseed(
+                        &ctx,
+                        reseed->x, reseed->len) == 0);
     }
 
     /* CTR_DRBG_Generate(result->len * 8 bits, add2->x[:add2->len]) -> buf */
     /* Then reseed if prediction resistance is enabled. */
-    TEST_ASSERT( mbedtls_ctr_drbg_random_with_add(
-                     &ctx,
-                     buf, result->len,
-                     add2->x, add2->len ) == 0 );
-    TEST_ASSERT( memcmp( buf, result->x, result->len ) == 0 );
+    TEST_ASSERT(mbedtls_ctr_drbg_random_with_add(
+                    &ctx,
+                    buf, result->len,
+                    add2->x, add2->len) == 0);
+    TEST_ASSERT(memcmp(buf, result->x, result->len) == 0);
 
 exit:
-    mbedtls_ctr_drbg_free( &ctx );
+    mbedtls_ctr_drbg_free(&ctx);
 }
 
 /* END_HEADER */
@@ -101,127 +100,127 @@
  */
 
 /* BEGIN_CASE */
-void ctr_drbg_special_behaviours( )
+void ctr_drbg_special_behaviours()
 {
     mbedtls_ctr_drbg_context ctx;
     unsigned char output[512];
     unsigned char additional[512];
 
-    mbedtls_ctr_drbg_init( &ctx );
-    memset( output, 0, sizeof( output ) );
-    memset( additional, 0, sizeof( additional ) );
+    mbedtls_ctr_drbg_init(&ctx);
+    memset(output, 0, sizeof(output));
+    memset(additional, 0, sizeof(additional));
 
-    TEST_ASSERT( mbedtls_ctr_drbg_random_with_add( &ctx,
-                        output, MBEDTLS_CTR_DRBG_MAX_REQUEST + 1,
-                        additional, 16 ) ==
-                        MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG );
-    TEST_ASSERT( mbedtls_ctr_drbg_random_with_add( &ctx,
-                        output, 16,
-                        additional, MBEDTLS_CTR_DRBG_MAX_INPUT + 1 ) ==
-                        MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG );
+    TEST_ASSERT(mbedtls_ctr_drbg_random_with_add(&ctx,
+                                                 output, MBEDTLS_CTR_DRBG_MAX_REQUEST + 1,
+                                                 additional, 16) ==
+                MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG);
+    TEST_ASSERT(mbedtls_ctr_drbg_random_with_add(&ctx,
+                                                 output, 16,
+                                                 additional, MBEDTLS_CTR_DRBG_MAX_INPUT + 1) ==
+                MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG);
 
-    TEST_ASSERT( mbedtls_ctr_drbg_reseed( &ctx, additional,
-                        MBEDTLS_CTR_DRBG_MAX_SEED_INPUT + 1 ) ==
-                        MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG );
+    TEST_ASSERT(mbedtls_ctr_drbg_reseed(&ctx, additional,
+                                        MBEDTLS_CTR_DRBG_MAX_SEED_INPUT + 1) ==
+                MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG);
 
-    mbedtls_ctr_drbg_set_entropy_len( &ctx, ~0 );
-    TEST_ASSERT( mbedtls_ctr_drbg_reseed( &ctx, additional,
-                        MBEDTLS_CTR_DRBG_MAX_SEED_INPUT ) ==
-                        MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG );
+    mbedtls_ctr_drbg_set_entropy_len(&ctx, ~0);
+    TEST_ASSERT(mbedtls_ctr_drbg_reseed(&ctx, additional,
+                                        MBEDTLS_CTR_DRBG_MAX_SEED_INPUT) ==
+                MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG);
 exit:
-    mbedtls_ctr_drbg_free( &ctx );
+    mbedtls_ctr_drbg_free(&ctx);
 }
 /* END_CASE */
 
 
 /* BEGIN_CASE */
-void ctr_drbg_validate_no_reseed( data_t * add_init, data_t * entropy,
-                                  data_t * add1, data_t * add2,
-                                  data_t * result_string )
+void ctr_drbg_validate_no_reseed(data_t *add_init, data_t *entropy,
+                                 data_t *add1, data_t *add2,
+                                 data_t *result_string)
 {
     data_t empty = { 0, 0 };
-    ctr_drbg_validate_internal( RESEED_NEVER, add_init,
-                                entropy->len, entropy,
-                                &empty, add1, add2,
-                                result_string );
+    ctr_drbg_validate_internal(RESEED_NEVER, add_init,
+                               entropy->len, entropy,
+                               &empty, add1, add2,
+                               result_string);
     goto exit; // goto is needed to avoid warning ( no test assertions in func)
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ctr_drbg_validate_pr( data_t * add_init, data_t * entropy,
-                           data_t * add1, data_t * add2,
-                           data_t * result_string )
+void ctr_drbg_validate_pr(data_t *add_init, data_t *entropy,
+                          data_t *add1, data_t *add2,
+                          data_t *result_string)
 {
     data_t empty = { 0, 0 };
-    ctr_drbg_validate_internal( RESEED_ALWAYS, add_init,
-                                entropy->len / 3, entropy,
-                                &empty, add1, add2,
-                                result_string );
+    ctr_drbg_validate_internal(RESEED_ALWAYS, add_init,
+                               entropy->len / 3, entropy,
+                               &empty, add1, add2,
+                               result_string);
     goto exit; // goto is needed to avoid warning ( no test assertions in func)
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ctr_drbg_validate_reseed_between( data_t * add_init, data_t * entropy,
-                             data_t * add1, data_t * add_reseed,
-                             data_t * add2, data_t * result_string )
+void ctr_drbg_validate_reseed_between(data_t *add_init, data_t *entropy,
+                                      data_t *add1, data_t *add_reseed,
+                                      data_t *add2, data_t *result_string)
 {
-    ctr_drbg_validate_internal( RESEED_SECOND, add_init,
-                                entropy->len / 2, entropy,
-                                add_reseed, add1, add2,
-                                result_string );
+    ctr_drbg_validate_internal(RESEED_SECOND, add_init,
+                               entropy->len / 2, entropy,
+                               add_reseed, add1, add2,
+                               result_string);
     goto exit; // goto is needed to avoid warning ( no test assertions in func)
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ctr_drbg_validate_reseed_first( data_t * add_init, data_t * entropy,
-                             data_t * add1, data_t * add_reseed,
-                             data_t * add2, data_t * result_string )
+void ctr_drbg_validate_reseed_first(data_t *add_init, data_t *entropy,
+                                    data_t *add1, data_t *add_reseed,
+                                    data_t *add2, data_t *result_string)
 {
-    ctr_drbg_validate_internal( RESEED_FIRST, add_init,
-                                entropy->len / 2, entropy,
-                                add_reseed, add1, add2,
-                                result_string );
+    ctr_drbg_validate_internal(RESEED_FIRST, add_init,
+                               entropy->len / 2, entropy,
+                               add_reseed, add1, add2,
+                               result_string);
     goto exit; // goto is needed to avoid warning ( no test assertions in func)
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ctr_drbg_entropy_strength( int expected_bit_strength )
+void ctr_drbg_entropy_strength(int expected_bit_strength)
 {
     unsigned char entropy[/*initial entropy*/ MBEDTLS_CTR_DRBG_ENTROPY_LEN +
-                          /*nonce*/     MBEDTLS_CTR_DRBG_ENTROPY_NONCE_LEN +
-                          /*reseed*/          MBEDTLS_CTR_DRBG_ENTROPY_LEN];
+                          /*nonce*/ MBEDTLS_CTR_DRBG_ENTROPY_NONCE_LEN +
+                          /*reseed*/ MBEDTLS_CTR_DRBG_ENTROPY_LEN];
     mbedtls_ctr_drbg_context ctx;
     size_t last_idx;
     size_t byte_strength = expected_bit_strength / 8;
 
-    mbedtls_ctr_drbg_init( &ctx );
+    mbedtls_ctr_drbg_init(&ctx);
     test_offset_idx = 0;
-    test_max_idx = sizeof( entropy );
-    memset( entropy, 0, sizeof( entropy ) );
+    test_max_idx = sizeof(entropy);
+    memset(entropy, 0, sizeof(entropy));
 
     /* The initial seeding must grab at least byte_strength bytes of entropy
      * for the entropy input and byte_strength/2 bytes for a nonce. */
-    TEST_ASSERT( mbedtls_ctr_drbg_seed( &ctx,
-                                        mbedtls_test_entropy_func, entropy,
-                                        NULL, 0 ) == 0 );
-    TEST_ASSERT( test_offset_idx >= ( byte_strength * 3 + 1 ) / 2 );
+    TEST_ASSERT(mbedtls_ctr_drbg_seed(&ctx,
+                                      mbedtls_test_entropy_func, entropy,
+                                      NULL, 0) == 0);
+    TEST_ASSERT(test_offset_idx >= (byte_strength * 3 + 1) / 2);
     last_idx = test_offset_idx;
 
     /* A reseed must grab at least byte_strength bytes of entropy. */
-    TEST_ASSERT( mbedtls_ctr_drbg_reseed( &ctx, NULL, 0 ) == 0 );
-    TEST_ASSERT( test_offset_idx - last_idx >= byte_strength );
+    TEST_ASSERT(mbedtls_ctr_drbg_reseed(&ctx, NULL, 0) == 0);
+    TEST_ASSERT(test_offset_idx - last_idx >= byte_strength);
 
 exit:
-    mbedtls_ctr_drbg_free( &ctx );
+    mbedtls_ctr_drbg_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ctr_drbg_entropy_usage( int entropy_nonce_len )
+void ctr_drbg_entropy_usage(int entropy_nonce_len)
 {
     unsigned char out[16];
     unsigned char add[16];
@@ -230,109 +229,109 @@
     size_t i, reps = 10;
     size_t expected_idx = 0;
 
-    mbedtls_ctr_drbg_init( &ctx );
+    mbedtls_ctr_drbg_init(&ctx);
     test_offset_idx = 0;
-    test_max_idx = sizeof( entropy );
-    memset( entropy, 0, sizeof( entropy ) );
-    memset( out, 0, sizeof( out ) );
-    memset( add, 0, sizeof( add ) );
+    test_max_idx = sizeof(entropy);
+    memset(entropy, 0, sizeof(entropy));
+    memset(out, 0, sizeof(out));
+    memset(add, 0, sizeof(add));
 
-    if( entropy_nonce_len >= 0 )
-        TEST_ASSERT( mbedtls_ctr_drbg_set_nonce_len( &ctx, entropy_nonce_len ) == 0 );
+    if (entropy_nonce_len >= 0) {
+        TEST_ASSERT(mbedtls_ctr_drbg_set_nonce_len(&ctx, entropy_nonce_len) == 0);
+    }
 
     /* Set reseed interval before seed */
-    mbedtls_ctr_drbg_set_reseed_interval( &ctx, 2 * reps );
+    mbedtls_ctr_drbg_set_reseed_interval(&ctx, 2 * reps);
 
     /* Init must use entropy */
-    TEST_ASSERT( mbedtls_ctr_drbg_seed( &ctx, mbedtls_test_entropy_func, entropy, NULL, 0 ) == 0 );
+    TEST_ASSERT(mbedtls_ctr_drbg_seed(&ctx, mbedtls_test_entropy_func, entropy, NULL, 0) == 0);
     expected_idx += MBEDTLS_CTR_DRBG_ENTROPY_LEN;
-    if( entropy_nonce_len >= 0 )
+    if (entropy_nonce_len >= 0) {
         expected_idx += entropy_nonce_len;
-    else
+    } else {
         expected_idx += MBEDTLS_CTR_DRBG_ENTROPY_NONCE_LEN;
-    TEST_EQUAL( test_offset_idx, expected_idx );
+    }
+    TEST_EQUAL(test_offset_idx, expected_idx);
 
     /* By default, PR is off, and reseed interval was set to
      * 2 * reps so the next few calls should not use entropy */
-    for( i = 0; i < reps; i++ )
-    {
-        TEST_ASSERT( mbedtls_ctr_drbg_random( &ctx, out, sizeof( out ) - 4 ) == 0 );
-        TEST_ASSERT( mbedtls_ctr_drbg_random_with_add( &ctx, out, sizeof( out ) - 4,
-                                                add, sizeof( add ) ) == 0 );
+    for (i = 0; i < reps; i++) {
+        TEST_ASSERT(mbedtls_ctr_drbg_random(&ctx, out, sizeof(out) - 4) == 0);
+        TEST_ASSERT(mbedtls_ctr_drbg_random_with_add(&ctx, out, sizeof(out) - 4,
+                                                     add, sizeof(add)) == 0);
     }
-    TEST_EQUAL( test_offset_idx, expected_idx );
+    TEST_EQUAL(test_offset_idx, expected_idx);
 
     /* While at it, make sure we didn't write past the requested length */
-    TEST_ASSERT( out[sizeof( out ) - 4] == 0 );
-    TEST_ASSERT( out[sizeof( out ) - 3] == 0 );
-    TEST_ASSERT( out[sizeof( out ) - 2] == 0 );
-    TEST_ASSERT( out[sizeof( out ) - 1] == 0 );
+    TEST_ASSERT(out[sizeof(out) - 4] == 0);
+    TEST_ASSERT(out[sizeof(out) - 3] == 0);
+    TEST_ASSERT(out[sizeof(out) - 2] == 0);
+    TEST_ASSERT(out[sizeof(out) - 1] == 0);
 
     /* There have been 2 * reps calls to random. The next call should reseed */
-    TEST_ASSERT( mbedtls_ctr_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+    TEST_ASSERT(mbedtls_ctr_drbg_random(&ctx, out, sizeof(out)) == 0);
     expected_idx += MBEDTLS_CTR_DRBG_ENTROPY_LEN;
-    TEST_EQUAL( test_offset_idx, expected_idx );
+    TEST_EQUAL(test_offset_idx, expected_idx);
 
     /* Set reseed interval after seed */
-    mbedtls_ctr_drbg_set_reseed_interval( &ctx, 4 * reps + 1 );
+    mbedtls_ctr_drbg_set_reseed_interval(&ctx, 4 * reps + 1);
 
     /* The next few calls should not reseed */
-    for( i = 0; i < (2 * reps); i++ )
-    {
-        TEST_ASSERT( mbedtls_ctr_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
-        TEST_ASSERT( mbedtls_ctr_drbg_random_with_add( &ctx, out, sizeof( out ) ,
-                                                add, sizeof( add ) ) == 0 );
+    for (i = 0; i < (2 * reps); i++) {
+        TEST_ASSERT(mbedtls_ctr_drbg_random(&ctx, out, sizeof(out)) == 0);
+        TEST_ASSERT(mbedtls_ctr_drbg_random_with_add(&ctx, out, sizeof(out),
+                                                     add, sizeof(add)) == 0);
     }
-    TEST_EQUAL( test_offset_idx, expected_idx );
+    TEST_EQUAL(test_offset_idx, expected_idx);
 
     /* Call update with too much data (sizeof entropy > MAX(_SEED)_INPUT).
      * Make sure it's detected as an error and doesn't cause memory
      * corruption. */
-    TEST_ASSERT( mbedtls_ctr_drbg_update_ret(
-                     &ctx, entropy, sizeof( entropy ) ) != 0 );
+    TEST_ASSERT(mbedtls_ctr_drbg_update_ret(
+                    &ctx, entropy, sizeof(entropy)) != 0);
 
     /* Now enable PR, so the next few calls should all reseed */
-    mbedtls_ctr_drbg_set_prediction_resistance( &ctx, MBEDTLS_CTR_DRBG_PR_ON );
-    TEST_ASSERT( mbedtls_ctr_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+    mbedtls_ctr_drbg_set_prediction_resistance(&ctx, MBEDTLS_CTR_DRBG_PR_ON);
+    TEST_ASSERT(mbedtls_ctr_drbg_random(&ctx, out, sizeof(out)) == 0);
     expected_idx += MBEDTLS_CTR_DRBG_ENTROPY_LEN;
-    TEST_EQUAL( test_offset_idx, expected_idx );
+    TEST_EQUAL(test_offset_idx, expected_idx);
 
     /* Finally, check setting entropy_len */
-    mbedtls_ctr_drbg_set_entropy_len( &ctx, 42 );
-    TEST_ASSERT( mbedtls_ctr_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+    mbedtls_ctr_drbg_set_entropy_len(&ctx, 42);
+    TEST_ASSERT(mbedtls_ctr_drbg_random(&ctx, out, sizeof(out)) == 0);
     expected_idx += 42;
-    TEST_EQUAL( test_offset_idx, expected_idx );
+    TEST_EQUAL(test_offset_idx, expected_idx);
 
-    mbedtls_ctr_drbg_set_entropy_len( &ctx, 13 );
-    TEST_ASSERT( mbedtls_ctr_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+    mbedtls_ctr_drbg_set_entropy_len(&ctx, 13);
+    TEST_ASSERT(mbedtls_ctr_drbg_random(&ctx, out, sizeof(out)) == 0);
     expected_idx += 13;
-    TEST_EQUAL( test_offset_idx, expected_idx );
+    TEST_EQUAL(test_offset_idx, expected_idx);
 
 exit:
-    mbedtls_ctr_drbg_free( &ctx );
+    mbedtls_ctr_drbg_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO */
-void ctr_drbg_seed_file( char * path, int ret )
+void ctr_drbg_seed_file(char *path, int ret)
 {
     mbedtls_ctr_drbg_context ctx;
 
-    mbedtls_ctr_drbg_init( &ctx );
+    mbedtls_ctr_drbg_init(&ctx);
 
-    TEST_ASSERT( mbedtls_ctr_drbg_seed( &ctx, mbedtls_test_rnd_std_rand,
-                                        NULL, NULL, 0 ) == 0 );
-    TEST_ASSERT( mbedtls_ctr_drbg_write_seed_file( &ctx, path ) == ret );
-    TEST_ASSERT( mbedtls_ctr_drbg_update_seed_file( &ctx, path ) == ret );
+    TEST_ASSERT(mbedtls_ctr_drbg_seed(&ctx, mbedtls_test_rnd_std_rand,
+                                      NULL, NULL, 0) == 0);
+    TEST_ASSERT(mbedtls_ctr_drbg_write_seed_file(&ctx, path) == ret);
+    TEST_ASSERT(mbedtls_ctr_drbg_update_seed_file(&ctx, path) == ret);
 
 exit:
-    mbedtls_ctr_drbg_free( &ctx );
+    mbedtls_ctr_drbg_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void ctr_drbg_selftest(  )
+void ctr_drbg_selftest()
 {
-    TEST_ASSERT( mbedtls_ctr_drbg_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_ctr_drbg_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_debug.function b/tests/suites/test_suite_debug.function
index cadc947..cbb3a63 100644
--- a/tests/suites/test_suite_debug.function
+++ b/tests/suites/test_suite_debug.function
@@ -2,8 +2,7 @@
 #include "mbedtls/debug.h"
 #include "string.h"
 
-struct buffer_data
-{
+struct buffer_data {
     char buf[2000];
     char *ptr;
 };
@@ -14,29 +13,32 @@
     char *p = buffer->ptr;
     ((void) level);
 
-    memcpy( p, file, strlen( file ) );
-    p += strlen( file );
+    memcpy(p, file, strlen(file));
+    p += strlen(file);
 
     *p++ = '(';
-    *p++ = '0' + ( line / 1000 ) % 10;
-    *p++ = '0' + ( line / 100  ) % 10;
-    *p++ = '0' + ( line / 10   ) % 10;
-    *p++ = '0' + ( line / 1    ) % 10;
+    *p++ = '0' + (line / 1000) % 10;
+    *p++ = '0' + (line / 100) % 10;
+    *p++ = '0' + (line / 10) % 10;
+    *p++ = '0' + (line / 1) % 10;
     *p++ = ')';
     *p++ = ':';
     *p++ = ' ';
 
 #if defined(MBEDTLS_THREADING_C)
     /* Skip "thread ID" (up to the first space) as it is not predictable */
-    while( *str++ != ' ' );
+    while (*str++ != ' ') {
+        ;
+    }
 #endif
 
-    memcpy( p, str, strlen( str ) );
-    p += strlen( str );
+    memcpy(p, str, strlen(str));
+    p += strlen(str);
 
     /* Detect if debug messages output partial lines and mark them */
-    if( p[-1] != '\n' )
+    if (p[-1] != '\n') {
         *p++ = '*';
+    }
 
     buffer->ptr = p;
 }
@@ -48,148 +50,148 @@
  */
 
 /* BEGIN_CASE */
-void debug_print_msg_threshold( int threshold, int level, char * file,
-                                int line, char * result_str )
+void debug_print_msg_threshold(int threshold, int level, char *file,
+                               int line, char *result_str)
 {
     mbedtls_ssl_context ssl;
     mbedtls_ssl_config conf;
     struct buffer_data buffer;
 
-    mbedtls_ssl_init( &ssl );
-    mbedtls_ssl_config_init( &conf );
-    memset( buffer.buf, 0, 2000 );
+    mbedtls_ssl_init(&ssl);
+    mbedtls_ssl_config_init(&conf);
+    memset(buffer.buf, 0, 2000);
     buffer.ptr = buffer.buf;
 
-    TEST_ASSERT( mbedtls_ssl_setup( &ssl, &conf ) == 0 );
+    TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
 
-    mbedtls_debug_set_threshold( threshold );
-    mbedtls_ssl_conf_dbg( &conf, string_debug, &buffer);
+    mbedtls_debug_set_threshold(threshold);
+    mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
 
-    mbedtls_debug_print_msg( &ssl, level, file, line,
-                             "Text message, 2 == %d", 2 );
+    mbedtls_debug_print_msg(&ssl, level, file, line,
+                            "Text message, 2 == %d", 2);
 
-    TEST_ASSERT( strcmp( buffer.buf, result_str ) == 0 );
+    TEST_ASSERT(strcmp(buffer.buf, result_str) == 0);
 
 exit:
-    mbedtls_ssl_free( &ssl );
-    mbedtls_ssl_config_free( &conf );
+    mbedtls_ssl_free(&ssl);
+    mbedtls_ssl_config_free(&conf);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_debug_print_ret( char * file, int line, char * text, int value,
-                              char * result_str )
+void mbedtls_debug_print_ret(char *file, int line, char *text, int value,
+                             char *result_str)
 {
     mbedtls_ssl_context ssl;
     mbedtls_ssl_config conf;
     struct buffer_data buffer;
 
-    mbedtls_ssl_init( &ssl );
-    mbedtls_ssl_config_init( &conf );
-    memset( buffer.buf, 0, 2000 );
+    mbedtls_ssl_init(&ssl);
+    mbedtls_ssl_config_init(&conf);
+    memset(buffer.buf, 0, 2000);
     buffer.ptr = buffer.buf;
 
-    TEST_ASSERT( mbedtls_ssl_setup( &ssl, &conf ) == 0 );
+    TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
 
-    mbedtls_ssl_conf_dbg( &conf, string_debug, &buffer);
+    mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
 
-    mbedtls_debug_print_ret( &ssl, 0, file, line, text, value);
+    mbedtls_debug_print_ret(&ssl, 0, file, line, text, value);
 
-    TEST_ASSERT( strcmp( buffer.buf, result_str ) == 0 );
+    TEST_ASSERT(strcmp(buffer.buf, result_str) == 0);
 
 exit:
-    mbedtls_ssl_free( &ssl );
-    mbedtls_ssl_config_free( &conf );
+    mbedtls_ssl_free(&ssl);
+    mbedtls_ssl_config_free(&conf);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_debug_print_buf( char * file, int line, char * text,
-                              data_t * data, char * result_str )
+void mbedtls_debug_print_buf(char *file, int line, char *text,
+                             data_t *data, char *result_str)
 {
     mbedtls_ssl_context ssl;
     mbedtls_ssl_config conf;
     struct buffer_data buffer;
 
-    mbedtls_ssl_init( &ssl );
-    mbedtls_ssl_config_init( &conf );
-    memset( buffer.buf, 0, 2000 );
+    mbedtls_ssl_init(&ssl);
+    mbedtls_ssl_config_init(&conf);
+    memset(buffer.buf, 0, 2000);
     buffer.ptr = buffer.buf;
 
 
-    TEST_ASSERT( mbedtls_ssl_setup( &ssl, &conf ) == 0 );
+    TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
 
-    mbedtls_ssl_conf_dbg( &conf, string_debug, &buffer);
+    mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
 
-    mbedtls_debug_print_buf( &ssl, 0, file, line, text, data->x, data->len );
+    mbedtls_debug_print_buf(&ssl, 0, file, line, text, data->x, data->len);
 
-    TEST_ASSERT( strcmp( buffer.buf, result_str ) == 0 );
+    TEST_ASSERT(strcmp(buffer.buf, result_str) == 0);
 
 exit:
-    mbedtls_ssl_free( &ssl );
-    mbedtls_ssl_config_free( &conf );
+    mbedtls_ssl_free(&ssl);
+    mbedtls_ssl_config_free(&conf);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C */
-void mbedtls_debug_print_crt( char * crt_file, char * file, int line,
-                              char * prefix, char * result_str )
+void mbedtls_debug_print_crt(char *crt_file, char *file, int line,
+                             char *prefix, char *result_str)
 {
     mbedtls_x509_crt   crt;
     mbedtls_ssl_context ssl;
     mbedtls_ssl_config conf;
     struct buffer_data buffer;
 
-    mbedtls_ssl_init( &ssl );
-    mbedtls_ssl_config_init( &conf );
-    mbedtls_x509_crt_init( &crt );
-    memset( buffer.buf, 0, 2000 );
+    mbedtls_ssl_init(&ssl);
+    mbedtls_ssl_config_init(&conf);
+    mbedtls_x509_crt_init(&crt);
+    memset(buffer.buf, 0, 2000);
     buffer.ptr = buffer.buf;
 
-    TEST_ASSERT( mbedtls_ssl_setup( &ssl, &conf ) == 0 );
+    TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
 
-    mbedtls_ssl_conf_dbg( &conf, string_debug, &buffer);
+    mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &crt, crt_file ) == 0 );
-    mbedtls_debug_print_crt( &ssl, 0, file, line, prefix, &crt);
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
+    mbedtls_debug_print_crt(&ssl, 0, file, line, prefix, &crt);
 
-    TEST_ASSERT( strcmp( buffer.buf, result_str ) == 0 );
+    TEST_ASSERT(strcmp(buffer.buf, result_str) == 0);
 
 exit:
-    mbedtls_x509_crt_free( &crt );
-    mbedtls_ssl_free( &ssl );
-    mbedtls_ssl_config_free( &conf );
+    mbedtls_x509_crt_free(&crt);
+    mbedtls_ssl_free(&ssl);
+    mbedtls_ssl_config_free(&conf);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_BIGNUM_C */
-void mbedtls_debug_print_mpi( char * value, char * file, int line,
-                              char * prefix, char * result_str )
+void mbedtls_debug_print_mpi(char *value, char *file, int line,
+                             char *prefix, char *result_str)
 {
     mbedtls_ssl_context ssl;
     mbedtls_ssl_config conf;
     struct buffer_data buffer;
     mbedtls_mpi val;
 
-    mbedtls_ssl_init( &ssl );
-    mbedtls_ssl_config_init( &conf );
-    mbedtls_mpi_init( &val );
-    memset( buffer.buf, 0, 2000 );
+    mbedtls_ssl_init(&ssl);
+    mbedtls_ssl_config_init(&conf);
+    mbedtls_mpi_init(&val);
+    memset(buffer.buf, 0, 2000);
     buffer.ptr = buffer.buf;
 
-    TEST_ASSERT( mbedtls_ssl_setup( &ssl, &conf ) == 0 );
+    TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &val, value ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&val, value) == 0);
 
-    mbedtls_ssl_conf_dbg( &conf, string_debug, &buffer);
+    mbedtls_ssl_conf_dbg(&conf, string_debug, &buffer);
 
-    mbedtls_debug_print_mpi( &ssl, 0, file, line, prefix, &val);
+    mbedtls_debug_print_mpi(&ssl, 0, file, line, prefix, &val);
 
-    TEST_ASSERT( strcmp( buffer.buf, result_str ) == 0 );
+    TEST_ASSERT(strcmp(buffer.buf, result_str) == 0);
 
 exit:
-    mbedtls_mpi_free( &val );
-    mbedtls_ssl_free( &ssl );
-    mbedtls_ssl_config_free( &conf );
+    mbedtls_mpi_free(&val);
+    mbedtls_ssl_free(&ssl);
+    mbedtls_ssl_config_free(&conf);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_des.function b/tests/suites/test_suite_des.function
index 7256fb5..b846d77 100644
--- a/tests/suites/test_suite_des.function
+++ b/tests/suites/test_suite_des.function
@@ -8,269 +8,273 @@
  */
 
 /* BEGIN_CASE */
-void des_check_weak( data_t * key, int ret )
+void des_check_weak(data_t *key, int ret)
 {
-    TEST_ASSERT( mbedtls_des_key_check_weak( key->x ) == ret );
+    TEST_ASSERT(mbedtls_des_key_check_weak(key->x) == ret);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void des_encrypt_ecb( data_t * key_str, data_t * src_str, data_t * dst )
+void des_encrypt_ecb(data_t *key_str, data_t *src_str, data_t *dst)
 {
     unsigned char output[100];
     mbedtls_des_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_des_init( &ctx );
+    mbedtls_des_init(&ctx);
 
 
-    TEST_ASSERT( mbedtls_des_setkey_enc( &ctx, key_str->x ) == 0 );
-    TEST_ASSERT( mbedtls_des_crypt_ecb( &ctx, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_des_setkey_enc(&ctx, key_str->x) == 0);
+    TEST_ASSERT(mbedtls_des_crypt_ecb(&ctx, src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 8, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 8, dst->len) == 0);
 
 exit:
-    mbedtls_des_free( &ctx );
+    mbedtls_des_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void des_decrypt_ecb( data_t * key_str, data_t * src_str, data_t * dst )
+void des_decrypt_ecb(data_t *key_str, data_t *src_str, data_t *dst)
 {
     unsigned char output[100];
     mbedtls_des_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_des_init( &ctx );
+    mbedtls_des_init(&ctx);
 
 
-    TEST_ASSERT( mbedtls_des_setkey_dec( &ctx, key_str->x ) == 0 );
-    TEST_ASSERT( mbedtls_des_crypt_ecb( &ctx, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_des_setkey_dec(&ctx, key_str->x) == 0);
+    TEST_ASSERT(mbedtls_des_crypt_ecb(&ctx, src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 8, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 8, dst->len) == 0);
 
 exit:
-    mbedtls_des_free( &ctx );
+    mbedtls_des_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void des_encrypt_cbc( data_t * key_str, data_t * iv_str,
-                      data_t * src_str, data_t * dst, int cbc_result )
+void des_encrypt_cbc(data_t *key_str, data_t *iv_str,
+                     data_t *src_str, data_t *dst, int cbc_result)
 {
     unsigned char output[100];
     mbedtls_des_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_des_init( &ctx );
+    mbedtls_des_init(&ctx);
 
 
-    TEST_ASSERT( mbedtls_des_setkey_enc( &ctx, key_str->x ) == 0 );
-    TEST_ASSERT( mbedtls_des_crypt_cbc( &ctx, MBEDTLS_DES_ENCRYPT, src_str->len, iv_str->x, src_str->x, output ) == cbc_result );
-    if( cbc_result == 0 )
-    {
+    TEST_ASSERT(mbedtls_des_setkey_enc(&ctx, key_str->x) == 0);
+    TEST_ASSERT(mbedtls_des_crypt_cbc(&ctx, MBEDTLS_DES_ENCRYPT, src_str->len, iv_str->x,
+                                      src_str->x, output) == cbc_result);
+    if (cbc_result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, src_str->len,
-                                          dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, src_str->len,
+                                        dst->len) == 0);
     }
 
 exit:
-    mbedtls_des_free( &ctx );
+    mbedtls_des_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void des_decrypt_cbc( data_t * key_str, data_t * iv_str,
-                      data_t * src_str, data_t * dst,
-                      int cbc_result )
+void des_decrypt_cbc(data_t *key_str, data_t *iv_str,
+                     data_t *src_str, data_t *dst,
+                     int cbc_result)
 {
     unsigned char output[100];
     mbedtls_des_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_des_init( &ctx );
+    mbedtls_des_init(&ctx);
 
 
-    TEST_ASSERT( mbedtls_des_setkey_dec( &ctx, key_str->x ) == 0 );
-    TEST_ASSERT( mbedtls_des_crypt_cbc( &ctx, MBEDTLS_DES_DECRYPT, src_str->len, iv_str->x, src_str->x, output ) == cbc_result );
-    if( cbc_result == 0 )
-    {
+    TEST_ASSERT(mbedtls_des_setkey_dec(&ctx, key_str->x) == 0);
+    TEST_ASSERT(mbedtls_des_crypt_cbc(&ctx, MBEDTLS_DES_DECRYPT, src_str->len, iv_str->x,
+                                      src_str->x, output) == cbc_result);
+    if (cbc_result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, src_str->len,
-                                          dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, src_str->len,
+                                        dst->len) == 0);
     }
 
 exit:
-    mbedtls_des_free( &ctx );
+    mbedtls_des_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void des3_encrypt_ecb( int key_count, data_t * key_str,
-                       data_t * src_str, data_t * dst )
+void des3_encrypt_ecb(int key_count, data_t *key_str,
+                      data_t *src_str, data_t *dst)
 {
     unsigned char output[100];
     mbedtls_des3_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_des3_init( &ctx );
+    mbedtls_des3_init(&ctx);
 
 
-    if( key_count == 2 )
-        TEST_ASSERT( mbedtls_des3_set2key_enc( &ctx, key_str->x ) == 0 );
-    else if( key_count == 3 )
-        TEST_ASSERT( mbedtls_des3_set3key_enc( &ctx, key_str->x ) == 0 );
-    else
-        TEST_ASSERT( 0 );
+    if (key_count == 2) {
+        TEST_ASSERT(mbedtls_des3_set2key_enc(&ctx, key_str->x) == 0);
+    } else if (key_count == 3) {
+        TEST_ASSERT(mbedtls_des3_set3key_enc(&ctx, key_str->x) == 0);
+    } else {
+        TEST_ASSERT(0);
+    }
 
-    TEST_ASSERT( mbedtls_des3_crypt_ecb( &ctx, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_des3_crypt_ecb(&ctx, src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 8, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 8, dst->len) == 0);
 
 exit:
-    mbedtls_des3_free( &ctx );
+    mbedtls_des3_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void des3_decrypt_ecb( int key_count, data_t * key_str,
-                       data_t * src_str, data_t * dst )
+void des3_decrypt_ecb(int key_count, data_t *key_str,
+                      data_t *src_str, data_t *dst)
 {
     unsigned char output[100];
     mbedtls_des3_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_des3_init( &ctx );
+    mbedtls_des3_init(&ctx);
 
 
-    if( key_count == 2 )
-        TEST_ASSERT( mbedtls_des3_set2key_dec( &ctx, key_str->x ) == 0 );
-    else if( key_count == 3 )
-        TEST_ASSERT( mbedtls_des3_set3key_dec( &ctx, key_str->x ) == 0 );
-    else
-        TEST_ASSERT( 0 );
+    if (key_count == 2) {
+        TEST_ASSERT(mbedtls_des3_set2key_dec(&ctx, key_str->x) == 0);
+    } else if (key_count == 3) {
+        TEST_ASSERT(mbedtls_des3_set3key_dec(&ctx, key_str->x) == 0);
+    } else {
+        TEST_ASSERT(0);
+    }
 
-    TEST_ASSERT( mbedtls_des3_crypt_ecb( &ctx, src_str->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_des3_crypt_ecb(&ctx, src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 8, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 8, dst->len) == 0);
 
 exit:
-    mbedtls_des3_free( &ctx );
+    mbedtls_des3_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void des3_encrypt_cbc( int key_count, data_t * key_str,
-                       data_t * iv_str, data_t * src_str,
-                       data_t * dst, int cbc_result )
+void des3_encrypt_cbc(int key_count, data_t *key_str,
+                      data_t *iv_str, data_t *src_str,
+                      data_t *dst, int cbc_result)
 {
     unsigned char output[100];
     mbedtls_des3_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_des3_init( &ctx );
+    mbedtls_des3_init(&ctx);
 
 
-    if( key_count == 2 )
-        TEST_ASSERT( mbedtls_des3_set2key_enc( &ctx, key_str->x ) == 0 );
-    else if( key_count == 3 )
-        TEST_ASSERT( mbedtls_des3_set3key_enc( &ctx, key_str->x ) == 0 );
-    else
-        TEST_ASSERT( 0 );
+    if (key_count == 2) {
+        TEST_ASSERT(mbedtls_des3_set2key_enc(&ctx, key_str->x) == 0);
+    } else if (key_count == 3) {
+        TEST_ASSERT(mbedtls_des3_set3key_enc(&ctx, key_str->x) == 0);
+    } else {
+        TEST_ASSERT(0);
+    }
 
-    TEST_ASSERT( mbedtls_des3_crypt_cbc( &ctx, MBEDTLS_DES_ENCRYPT, src_str->len, iv_str->x, src_str->x, output ) == cbc_result );
+    TEST_ASSERT(mbedtls_des3_crypt_cbc(&ctx, MBEDTLS_DES_ENCRYPT, src_str->len, iv_str->x,
+                                       src_str->x, output) == cbc_result);
 
-    if( cbc_result == 0 )
-    {
+    if (cbc_result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x,
-                                          src_str->len, dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x,
+                                        src_str->len, dst->len) == 0);
     }
 
 exit:
-    mbedtls_des3_free( &ctx );
+    mbedtls_des3_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void des3_decrypt_cbc( int key_count, data_t * key_str,
-                       data_t * iv_str, data_t * src_str,
-                       data_t * dst, int cbc_result )
+void des3_decrypt_cbc(int key_count, data_t *key_str,
+                      data_t *iv_str, data_t *src_str,
+                      data_t *dst, int cbc_result)
 {
     unsigned char output[100];
     mbedtls_des3_context ctx;
 
     memset(output, 0x00, 100);
-    mbedtls_des3_init( &ctx );
+    mbedtls_des3_init(&ctx);
 
 
-    if( key_count == 2 )
-        TEST_ASSERT( mbedtls_des3_set2key_dec( &ctx, key_str->x ) == 0 );
-    else if( key_count == 3 )
-        TEST_ASSERT( mbedtls_des3_set3key_dec( &ctx, key_str->x ) == 0 );
-    else
-        TEST_ASSERT( 0 );
+    if (key_count == 2) {
+        TEST_ASSERT(mbedtls_des3_set2key_dec(&ctx, key_str->x) == 0);
+    } else if (key_count == 3) {
+        TEST_ASSERT(mbedtls_des3_set3key_dec(&ctx, key_str->x) == 0);
+    } else {
+        TEST_ASSERT(0);
+    }
 
-    TEST_ASSERT( mbedtls_des3_crypt_cbc( &ctx, MBEDTLS_DES_DECRYPT, src_str->len, iv_str->x, src_str->x, output ) == cbc_result );
+    TEST_ASSERT(mbedtls_des3_crypt_cbc(&ctx, MBEDTLS_DES_DECRYPT, src_str->len, iv_str->x,
+                                       src_str->x, output) == cbc_result);
 
-    if( cbc_result == 0 )
-    {
+    if (cbc_result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, src_str->len,
-                                          dst->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, src_str->len,
+                                        dst->len) == 0);
     }
 
 exit:
-    mbedtls_des3_free( &ctx );
+    mbedtls_des3_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void des_key_parity_run(  )
+void des_key_parity_run()
 {
     int i, j, cnt;
     unsigned char key[MBEDTLS_DES_KEY_SIZE];
     unsigned int parity;
 
-    memset( key, 0, MBEDTLS_DES_KEY_SIZE );
+    memset(key, 0, MBEDTLS_DES_KEY_SIZE);
     cnt = 0;
 
     // Iterate through all possible byte values
     //
-    for( i = 0; i < 32; i++ )
-    {
-        for( j = 0; j < 8; j++ )
+    for (i = 0; i < 32; i++) {
+        for (j = 0; j < 8; j++) {
             key[j] = cnt++;
+        }
 
         // Set the key parity according to the table
         //
-        mbedtls_des_key_set_parity( key );
+        mbedtls_des_key_set_parity(key);
 
         // Check the parity with a function
         //
-        for( j = 0; j < 8; j++ )
-        {
-            parity = key[j] ^ ( key[j] >> 4 );
+        for (j = 0; j < 8; j++) {
+            parity = key[j] ^ (key[j] >> 4);
             parity = parity ^
-                    ( parity >> 1 ) ^
-                    ( parity >> 2 ) ^
-                    ( parity >> 3 );
+                     (parity >> 1) ^
+                     (parity >> 2) ^
+                     (parity >> 3);
             parity &= 1;
 
-            if( parity != 1 )
-                TEST_ASSERT( 0 );
+            if (parity != 1) {
+                TEST_ASSERT(0);
+            }
         }
 
         // Check the parity with the table
         //
-        TEST_ASSERT( mbedtls_des_key_check_key_parity( key ) == 0 );
+        TEST_ASSERT(mbedtls_des_key_check_key_parity(key) == 0);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void des_selftest(  )
+void des_selftest()
 {
-    TEST_ASSERT( mbedtls_des_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_des_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_dhm.function b/tests/suites/test_suite_dhm.function
index 5d82fe6..1251723 100644
--- a/tests/suites/test_suite_dhm.function
+++ b/tests/suites/test_suite_dhm.function
@@ -4,63 +4,66 @@
 /* Sanity checks on a Diffie-Hellman parameter: check the length-value
  * syntax and check that the value is the expected one (taken from the
  * DHM context by the caller). */
-static int check_dhm_param_output( const mbedtls_mpi *expected,
-                                   const unsigned char *buffer,
-                                   size_t size,
-                                   size_t *offset )
+static int check_dhm_param_output(const mbedtls_mpi *expected,
+                                  const unsigned char *buffer,
+                                  size_t size,
+                                  size_t *offset)
 {
     size_t n;
     mbedtls_mpi actual;
     int ok = 0;
-    mbedtls_mpi_init( &actual );
+    mbedtls_mpi_init(&actual);
 
     ++mbedtls_test_info.step;
 
-    TEST_ASSERT( size >= *offset + 2 );
-    n = ( buffer[*offset] << 8 ) | buffer[*offset + 1];
+    TEST_ASSERT(size >= *offset + 2);
+    n = (buffer[*offset] << 8) | buffer[*offset + 1];
     *offset += 2;
     /* The DHM param output from Mbed TLS has leading zeros stripped, as
      * permitted but not required by RFC 5246 \S4.4. */
-    TEST_EQUAL( n, mbedtls_mpi_size( expected ) );
-    TEST_ASSERT( size >= *offset + n );
-    TEST_EQUAL( 0, mbedtls_mpi_read_binary( &actual, buffer + *offset, n ) );
-    TEST_EQUAL( 0, mbedtls_mpi_cmp_mpi( expected, &actual ) );
+    TEST_EQUAL(n, mbedtls_mpi_size(expected));
+    TEST_ASSERT(size >= *offset + n);
+    TEST_EQUAL(0, mbedtls_mpi_read_binary(&actual, buffer + *offset, n));
+    TEST_EQUAL(0, mbedtls_mpi_cmp_mpi(expected, &actual));
     *offset += n;
 
     ok = 1;
 exit:
-    mbedtls_mpi_free( &actual );
-    return( ok );
+    mbedtls_mpi_free(&actual);
+    return ok;
 }
 
 /* Sanity checks on Diffie-Hellman parameters: syntax, range, and comparison
  * against the context. */
-static int check_dhm_params( const mbedtls_dhm_context *ctx,
-                             size_t x_size,
-                             const unsigned char *ske, size_t ske_len )
+static int check_dhm_params(const mbedtls_dhm_context *ctx,
+                            size_t x_size,
+                            const unsigned char *ske, size_t ske_len)
 {
     size_t offset = 0;
 
     /* Check that ctx->X and ctx->GX are within range. */
-    TEST_ASSERT( mbedtls_mpi_cmp_int( &ctx->X, 1 ) > 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &ctx->X, &ctx->P ) < 0 );
-    TEST_ASSERT( mbedtls_mpi_size( &ctx->X ) <= x_size );
-    TEST_ASSERT( mbedtls_mpi_cmp_int( &ctx->GX, 1 ) > 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &ctx->GX, &ctx->P ) < 0 );
+    TEST_ASSERT(mbedtls_mpi_cmp_int(&ctx->X, 1) > 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&ctx->X, &ctx->P) < 0);
+    TEST_ASSERT(mbedtls_mpi_size(&ctx->X) <= x_size);
+    TEST_ASSERT(mbedtls_mpi_cmp_int(&ctx->GX, 1) > 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&ctx->GX, &ctx->P) < 0);
 
     /* Check ske: it must contain P, G and G^X, each prefixed with a
      * 2-byte size. */
-    if( !check_dhm_param_output( &ctx->P, ske, ske_len, &offset ) )
+    if (!check_dhm_param_output(&ctx->P, ske, ske_len, &offset)) {
         goto exit;
-    if( !check_dhm_param_output( &ctx->G, ske, ske_len, &offset ) )
+    }
+    if (!check_dhm_param_output(&ctx->G, ske, ske_len, &offset)) {
         goto exit;
-    if( !check_dhm_param_output( &ctx->GX, ske, ske_len, &offset ) )
+    }
+    if (!check_dhm_param_output(&ctx->GX, ske, ske_len, &offset)) {
         goto exit;
-    TEST_EQUAL( offset, ske_len );
+    }
+    TEST_EQUAL(offset, ske_len);
 
-    return( 1 );
+    return 1;
 exit:
-    return( 0 );
+    return 0;
 }
 
 /* END_HEADER */
@@ -71,104 +74,104 @@
  */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void dhm_invalid_params( )
+void dhm_invalid_params()
 {
     mbedtls_dhm_context ctx;
     unsigned char buf[42] = { 0 };
     unsigned char *buf_null = NULL;
     mbedtls_mpi X;
-    size_t const buflen = sizeof( buf );
+    size_t const buflen = sizeof(buf);
     size_t len;
 
-    TEST_INVALID_PARAM( mbedtls_dhm_init( NULL ) );
-    TEST_VALID_PARAM( mbedtls_dhm_free( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_dhm_init(NULL));
+    TEST_VALID_PARAM(mbedtls_dhm_free(NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_read_params( NULL,
-                                                     (unsigned char**) &buf,
-                                                     buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_read_params( &ctx, &buf_null, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_read_params( &ctx, NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_read_params( &ctx,
-                                                     (unsigned char**) &buf,
-                                                     NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_read_params(NULL,
+                                                   (unsigned char **) &buf,
+                                                   buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_read_params(&ctx, &buf_null, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_read_params(&ctx, NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_read_params(&ctx,
+                                                   (unsigned char **) &buf,
+                                                   NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_make_params( NULL, buflen,
-                                                     buf, &len,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_make_params( &ctx, buflen,
-                                                     NULL, &len,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_make_params( &ctx, buflen,
-                                                     buf, NULL,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_make_params( &ctx, buflen,
-                                                     buf, &len,
-                                                     NULL,
-                                                     NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_make_params(NULL, buflen,
+                                                   buf, &len,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_make_params(&ctx, buflen,
+                                                   NULL, &len,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_make_params(&ctx, buflen,
+                                                   buf, NULL,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_make_params(&ctx, buflen,
+                                                   buf, &len,
+                                                   NULL,
+                                                   NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_set_group( NULL, &X, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_set_group( &ctx, NULL, &X ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_set_group( &ctx, &X, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_set_group(NULL, &X, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_set_group(&ctx, NULL, &X));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_set_group(&ctx, &X, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_read_public( NULL, buf, buflen ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_read_public( &ctx, NULL, buflen ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_read_public(NULL, buf, buflen));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_read_public(&ctx, NULL, buflen));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_make_public( NULL, buflen,
-                                                     buf, buflen,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_make_public( &ctx, buflen,
-                                                     NULL, buflen,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_make_public( &ctx, buflen,
-                                                     buf, buflen,
-                                                     NULL,
-                                                     NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_make_public(NULL, buflen,
+                                                   buf, buflen,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_make_public(&ctx, buflen,
+                                                   NULL, buflen,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_make_public(&ctx, buflen,
+                                                   buf, buflen,
+                                                   NULL,
+                                                   NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_calc_secret( NULL, buf, buflen, &len,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_calc_secret( &ctx, NULL, buflen, &len,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_calc_secret( &ctx, buf, buflen, NULL,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_calc_secret(NULL, buf, buflen, &len,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_calc_secret(&ctx, NULL, buflen, &len,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_calc_secret(&ctx, buf, buflen, NULL,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
 
 #if defined(MBEDTLS_ASN1_PARSE_C)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_parse_dhm( NULL, buf, buflen ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_parse_dhm( &ctx, NULL, buflen ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_parse_dhm(NULL, buf, buflen));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_parse_dhm(&ctx, NULL, buflen));
 
 #if defined(MBEDTLS_FS_IO)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_parse_dhmfile( NULL, "" ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
-                            mbedtls_dhm_parse_dhmfile( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_parse_dhmfile(NULL, ""));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_DHM_BAD_INPUT_DATA,
+                           mbedtls_dhm_parse_dhmfile(&ctx, NULL));
 #endif /* MBEDTLS_FS_IO */
 #endif /* MBEDTLS_ASN1_PARSE_C */
 
@@ -178,8 +181,8 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void dhm_do_dhm( char *input_P, int x_size,
-                 char *input_G, int result )
+void dhm_do_dhm(char *input_P, int x_size,
+                char *input_G, int result)
 {
     mbedtls_dhm_context ctx_srv;
     mbedtls_dhm_context ctx_cli;
@@ -195,65 +198,67 @@
     int i;
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    mbedtls_dhm_init( &ctx_srv );
-    mbedtls_dhm_init( &ctx_cli );
-    memset( ske, 0x00, 1000 );
-    memset( pub_cli, 0x00, 1000 );
-    memset( sec_srv, 0x00, 1000 );
-    memset( sec_cli, 0x00, 1000 );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    mbedtls_dhm_init(&ctx_srv);
+    mbedtls_dhm_init(&ctx_cli);
+    memset(ske, 0x00, 1000);
+    memset(pub_cli, 0x00, 1000);
+    memset(sec_srv, 0x00, 1000);
+    memset(sec_cli, 0x00, 1000);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
 
     /*
      * Set params
      */
-    TEST_ASSERT( mbedtls_test_read_mpi( &ctx_srv.P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &ctx_srv.G, input_G ) == 0 );
-    pub_cli_len = mbedtls_mpi_size( &ctx_srv.P );
+    TEST_ASSERT(mbedtls_test_read_mpi(&ctx_srv.P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&ctx_srv.G, input_G) == 0);
+    pub_cli_len = mbedtls_mpi_size(&ctx_srv.P);
 
     /*
      * First key exchange
      */
-    mbedtls_test_set_step( 10 );
-    TEST_ASSERT( mbedtls_dhm_make_params( &ctx_srv, x_size, ske, &ske_len,
-                                          &mbedtls_test_rnd_pseudo_rand,
-                                          &rnd_info ) == result );
-    if ( result != 0 )
+    mbedtls_test_set_step(10);
+    TEST_ASSERT(mbedtls_dhm_make_params(&ctx_srv, x_size, ske, &ske_len,
+                                        &mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info) == result);
+    if (result != 0) {
         goto exit;
-    if( !check_dhm_params( &ctx_srv, x_size, ske, ske_len ) )
+    }
+    if (!check_dhm_params(&ctx_srv, x_size, ske, ske_len)) {
         goto exit;
+    }
 
     ske[ske_len++] = 0;
     ske[ske_len++] = 0;
-    TEST_ASSERT( mbedtls_dhm_read_params( &ctx_cli, &p, ske + ske_len ) == 0 );
+    TEST_ASSERT(mbedtls_dhm_read_params(&ctx_cli, &p, ske + ske_len) == 0);
 
-    TEST_ASSERT( mbedtls_dhm_make_public( &ctx_cli, x_size, pub_cli, pub_cli_len,
-                                          &mbedtls_test_rnd_pseudo_rand,
-                                          &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_dhm_read_public( &ctx_srv, pub_cli, pub_cli_len ) == 0 );
+    TEST_ASSERT(mbedtls_dhm_make_public(&ctx_cli, x_size, pub_cli, pub_cli_len,
+                                        &mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_dhm_read_public(&ctx_srv, pub_cli, pub_cli_len) == 0);
 
-    TEST_ASSERT( mbedtls_dhm_calc_secret( &ctx_srv, sec_srv, sizeof( sec_srv ),
-                                          &sec_srv_len,
-                                          &mbedtls_test_rnd_pseudo_rand,
-                                          &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_dhm_calc_secret( &ctx_cli, sec_cli, sizeof( sec_cli ), &sec_cli_len, NULL, NULL ) == 0 );
+    TEST_ASSERT(mbedtls_dhm_calc_secret(&ctx_srv, sec_srv, sizeof(sec_srv),
+                                        &sec_srv_len,
+                                        &mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_dhm_calc_secret(&ctx_cli, sec_cli, sizeof(sec_cli), &sec_cli_len, NULL,
+                                        NULL) == 0);
 
-    TEST_ASSERT( sec_srv_len == sec_cli_len );
-    TEST_ASSERT( sec_srv_len != 0 );
-    TEST_ASSERT( memcmp( sec_srv, sec_cli, sec_srv_len ) == 0 );
+    TEST_ASSERT(sec_srv_len == sec_cli_len);
+    TEST_ASSERT(sec_srv_len != 0);
+    TEST_ASSERT(memcmp(sec_srv, sec_cli, sec_srv_len) == 0);
 
     /* Re-do calc_secret on server a few times to test update of blinding values */
-    for( i = 0; i < 3; i++ )
-    {
-        mbedtls_test_set_step( 20 + i );
+    for (i = 0; i < 3; i++) {
+        mbedtls_test_set_step(20 + i);
         sec_srv_len = 1000;
-        TEST_ASSERT( mbedtls_dhm_calc_secret( &ctx_srv, sec_srv,
-                                              sizeof( sec_srv ), &sec_srv_len,
-                                              &mbedtls_test_rnd_pseudo_rand,
-                                              &rnd_info ) == 0 );
+        TEST_ASSERT(mbedtls_dhm_calc_secret(&ctx_srv, sec_srv,
+                                            sizeof(sec_srv), &sec_srv_len,
+                                            &mbedtls_test_rnd_pseudo_rand,
+                                            &rnd_info) == 0);
 
-        TEST_ASSERT( sec_srv_len == sec_cli_len );
-        TEST_ASSERT( sec_srv_len != 0 );
-        TEST_ASSERT( memcmp( sec_srv, sec_cli, sec_srv_len ) == 0 );
+        TEST_ASSERT(sec_srv_len == sec_cli_len);
+        TEST_ASSERT(sec_srv_len != 0);
+        TEST_ASSERT(memcmp(sec_srv, sec_cli, sec_srv_len) == 0);
     }
 
     /*
@@ -261,94 +266,96 @@
      */
     p = ske;
 
-    mbedtls_test_set_step( 30 );
-    TEST_ASSERT( mbedtls_dhm_make_params( &ctx_srv, x_size, ske, &ske_len,
-                                          &mbedtls_test_rnd_pseudo_rand,
-                                          &rnd_info ) == 0 );
-    if( !check_dhm_params( &ctx_srv, x_size, ske, ske_len ) )
+    mbedtls_test_set_step(30);
+    TEST_ASSERT(mbedtls_dhm_make_params(&ctx_srv, x_size, ske, &ske_len,
+                                        &mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info) == 0);
+    if (!check_dhm_params(&ctx_srv, x_size, ske, ske_len)) {
         goto exit;
+    }
     ske[ske_len++] = 0;
     ske[ske_len++] = 0;
-    TEST_ASSERT( mbedtls_dhm_read_params( &ctx_cli, &p, ske + ske_len ) == 0 );
+    TEST_ASSERT(mbedtls_dhm_read_params(&ctx_cli, &p, ske + ske_len) == 0);
 
-    TEST_ASSERT( mbedtls_dhm_make_public( &ctx_cli, x_size, pub_cli, pub_cli_len,
-                                          &mbedtls_test_rnd_pseudo_rand,
-                                          &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_dhm_read_public( &ctx_srv, pub_cli, pub_cli_len ) == 0 );
+    TEST_ASSERT(mbedtls_dhm_make_public(&ctx_cli, x_size, pub_cli, pub_cli_len,
+                                        &mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_dhm_read_public(&ctx_srv, pub_cli, pub_cli_len) == 0);
 
-    TEST_ASSERT( mbedtls_dhm_calc_secret( &ctx_srv, sec_srv, sizeof( sec_srv ),
-                                          &sec_srv_len,
-                                          &mbedtls_test_rnd_pseudo_rand,
-                                          &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_dhm_calc_secret( &ctx_cli, sec_cli, sizeof( sec_cli ), &sec_cli_len, NULL, NULL ) == 0 );
+    TEST_ASSERT(mbedtls_dhm_calc_secret(&ctx_srv, sec_srv, sizeof(sec_srv),
+                                        &sec_srv_len,
+                                        &mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_dhm_calc_secret(&ctx_cli, sec_cli, sizeof(sec_cli), &sec_cli_len, NULL,
+                                        NULL) == 0);
 
-    TEST_ASSERT( sec_srv_len == sec_cli_len );
-    TEST_ASSERT( sec_srv_len != 0 );
-    TEST_ASSERT( memcmp( sec_srv, sec_cli, sec_srv_len ) == 0 );
+    TEST_ASSERT(sec_srv_len == sec_cli_len);
+    TEST_ASSERT(sec_srv_len != 0);
+    TEST_ASSERT(memcmp(sec_srv, sec_cli, sec_srv_len) == 0);
 
 exit:
-    mbedtls_dhm_free( &ctx_srv );
-    mbedtls_dhm_free( &ctx_cli );
+    mbedtls_dhm_free(&ctx_srv);
+    mbedtls_dhm_free(&ctx_cli);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void dhm_make_public( int P_bytes, char *input_G, int result )
+void dhm_make_public(int P_bytes, char *input_G, int result)
 {
     mbedtls_mpi P, G;
     mbedtls_dhm_context ctx;
     unsigned char output[MBEDTLS_MPI_MAX_SIZE];
 
-    mbedtls_mpi_init( &P );
-    mbedtls_mpi_init( &G );
-    mbedtls_dhm_init( &ctx );
+    mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&G);
+    mbedtls_dhm_init(&ctx);
 
-    TEST_ASSERT( mbedtls_mpi_lset( &P, 1 ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_shift_l( &P, ( P_bytes * 8 ) - 1 ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_set_bit( &P, 0, 1 ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_lset(&P, 1) == 0);
+    TEST_ASSERT(mbedtls_mpi_shift_l(&P, (P_bytes * 8) - 1) == 0);
+    TEST_ASSERT(mbedtls_mpi_set_bit(&P, 0, 1) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &G, input_G ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&G, input_G) == 0);
 
-    TEST_ASSERT( mbedtls_dhm_set_group( &ctx, &P, &G ) == 0 );
-    TEST_ASSERT( mbedtls_dhm_make_public( &ctx, (int) mbedtls_mpi_size( &P ),
-                                          output, sizeof(output),
-                                          &mbedtls_test_rnd_pseudo_rand,
-                                          NULL ) == result );
+    TEST_ASSERT(mbedtls_dhm_set_group(&ctx, &P, &G) == 0);
+    TEST_ASSERT(mbedtls_dhm_make_public(&ctx, (int) mbedtls_mpi_size(&P),
+                                        output, sizeof(output),
+                                        &mbedtls_test_rnd_pseudo_rand,
+                                        NULL) == result);
 
 exit:
-    mbedtls_mpi_free( &P );
-    mbedtls_mpi_free( &G );
-    mbedtls_dhm_free( &ctx );
+    mbedtls_mpi_free(&P);
+    mbedtls_mpi_free(&G);
+    mbedtls_dhm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO */
-void dhm_file( char * filename, char * p, char * g, int len )
+void dhm_file(char *filename, char *p, char *g, int len)
 {
     mbedtls_dhm_context ctx;
     mbedtls_mpi P, G;
 
-    mbedtls_dhm_init( &ctx );
-    mbedtls_mpi_init( &P ); mbedtls_mpi_init( &G );
+    mbedtls_dhm_init(&ctx);
+    mbedtls_mpi_init(&P); mbedtls_mpi_init(&G);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &P, p ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &G, g ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, p) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&G, g) == 0);
 
-    TEST_ASSERT( mbedtls_dhm_parse_dhmfile( &ctx, filename ) == 0 );
+    TEST_ASSERT(mbedtls_dhm_parse_dhmfile(&ctx, filename) == 0);
 
-    TEST_ASSERT( ctx.len == (size_t) len );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &ctx.P, &P ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &ctx.G, &G ) == 0 );
+    TEST_ASSERT(ctx.len == (size_t) len);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&ctx.P, &P) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&ctx.G, &G) == 0);
 
 exit:
-    mbedtls_mpi_free( &P ); mbedtls_mpi_free( &G );
-    mbedtls_dhm_free( &ctx );
+    mbedtls_mpi_free(&P); mbedtls_mpi_free(&G);
+    mbedtls_dhm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void dhm_selftest(  )
+void dhm_selftest()
 {
-    TEST_ASSERT( mbedtls_dhm_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_dhm_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_ecdh.function b/tests/suites/test_suite_ecdh.function
index cd1b368..0de7c08 100644
--- a/tests/suites/test_suite_ecdh.function
+++ b/tests/suites/test_suite_ecdh.function
@@ -1,39 +1,39 @@
 /* BEGIN_HEADER */
 #include "mbedtls/ecdh.h"
 
-static int load_public_key( int grp_id, data_t *point,
-                            mbedtls_ecp_keypair *ecp )
+static int load_public_key(int grp_id, data_t *point,
+                           mbedtls_ecp_keypair *ecp)
 {
     int ok = 0;
-    TEST_ASSERT( mbedtls_ecp_group_load( &ecp->grp, grp_id ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_point_read_binary( &ecp->grp,
-                                                &ecp->Q,
-                                                point->x,
-                                                point->len ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &ecp->grp,
-                                           &ecp->Q ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&ecp->grp, grp_id) == 0);
+    TEST_ASSERT(mbedtls_ecp_point_read_binary(&ecp->grp,
+                                              &ecp->Q,
+                                              point->x,
+                                              point->len) == 0);
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&ecp->grp,
+                                         &ecp->Q) == 0);
     ok = 1;
 exit:
-    return( ok );
+    return ok;
 }
 
-static int load_private_key( int grp_id, data_t *private_key,
-                             mbedtls_ecp_keypair *ecp,
-                             mbedtls_test_rnd_pseudo_info *rnd_info )
+static int load_private_key(int grp_id, data_t *private_key,
+                            mbedtls_ecp_keypair *ecp,
+                            mbedtls_test_rnd_pseudo_info *rnd_info)
 {
     int ok = 0;
-    TEST_ASSERT( mbedtls_ecp_read_key( grp_id, ecp,
-                                       private_key->x,
-                                       private_key->len ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_check_privkey( &ecp->grp, &ecp->d ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_read_key(grp_id, ecp,
+                                     private_key->x,
+                                     private_key->len) == 0);
+    TEST_ASSERT(mbedtls_ecp_check_privkey(&ecp->grp, &ecp->d) == 0);
     /* Calculate the public key from the private key. */
-    TEST_ASSERT( mbedtls_ecp_mul( &ecp->grp, &ecp->Q, &ecp->d,
-                                  &ecp->grp.G,
-                                  &mbedtls_test_rnd_pseudo_rand,
-                                  rnd_info ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_mul(&ecp->grp, &ecp->Q, &ecp->d,
+                                &ecp->grp.G,
+                                &mbedtls_test_rnd_pseudo_rand,
+                                rnd_info) == 0);
     ok = 1;
 exit:
-    return( ok );
+    return ok;
 }
 
 /* END_HEADER */
@@ -44,14 +44,14 @@
  */
 
 /* BEGIN_CASE */
-void ecdh_valid_param( )
+void ecdh_valid_param()
 {
-    TEST_VALID_PARAM( mbedtls_ecdh_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_ecdh_free(NULL));
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void ecdh_invalid_param( )
+void ecdh_invalid_param()
 {
     mbedtls_ecp_group grp;
     mbedtls_ecdh_context ctx;
@@ -61,124 +61,124 @@
     size_t olen;
     unsigned char buf[42] = { 0 };
     const unsigned char *buf_null = NULL;
-    size_t const buflen = sizeof( buf );
+    size_t const buflen = sizeof(buf);
     int invalid_side = 42;
     mbedtls_ecp_group_id valid_grp = MBEDTLS_ECP_DP_SECP192R1;
 
-    mbedtls_ecp_keypair_init( &kp );
-    mbedtls_ecdh_init( &ctx );
-    TEST_INVALID_PARAM( mbedtls_ecdh_init( NULL ) );
+    mbedtls_ecp_keypair_init(&kp);
+    mbedtls_ecdh_init(&ctx);
+    TEST_INVALID_PARAM(mbedtls_ecdh_init(NULL));
 
 #if defined(MBEDTLS_ECP_RESTARTABLE)
-    TEST_INVALID_PARAM( mbedtls_ecdh_enable_restart( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_ecdh_enable_restart(NULL));
 #endif /* MBEDTLS_ECP_RESTARTABLE */
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_gen_public( NULL, &m, &P,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_gen_public( &grp, NULL, &P,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_gen_public( &grp, &m, NULL,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_gen_public( &grp, &m, &P,
-                                                     NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_gen_public(NULL, &m, &P,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_gen_public(&grp, NULL, &P,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_gen_public(&grp, &m, NULL,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_gen_public(&grp, &m, &P,
+                                                   NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_compute_shared( NULL, &m, &P, &m,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_compute_shared( &grp, NULL, &P, &m,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_compute_shared( &grp, &m, NULL, &m,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_compute_shared( &grp, &m, &P, NULL,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_compute_shared(NULL, &m, &P, &m,
+                                                       mbedtls_test_rnd_std_rand,
+                                                       NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_compute_shared(&grp, NULL, &P, &m,
+                                                       mbedtls_test_rnd_std_rand,
+                                                       NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_compute_shared(&grp, &m, NULL, &m,
+                                                       mbedtls_test_rnd_std_rand,
+                                                       NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_compute_shared(&grp, &m, &P, NULL,
+                                                       mbedtls_test_rnd_std_rand,
+                                                       NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_setup( NULL, valid_grp ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_setup(NULL, valid_grp));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdh_make_params( NULL, &olen, buf, buflen,
-                                   mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_make_params(NULL, &olen, buf, buflen,
+                                                    mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdh_make_params( &ctx, NULL, buf, buflen,
-                                   mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_make_params(&ctx, NULL, buf, buflen,
+                                                    mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdh_make_params( &ctx, &olen, NULL, buflen,
-                                   mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_make_params(&ctx, &olen, NULL, buflen,
+                                                    mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdh_make_params( &ctx, &olen, buf, buflen, NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_make_params(&ctx, &olen, buf, buflen, NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_read_params( NULL,
-                                                  (const unsigned char**) &buf,
-                                                  buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_read_params( &ctx, &buf_null,
-                                                      buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_read_params( &ctx, NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_read_params( &ctx,
-                                                  (const unsigned char**) &buf,
-                                                  NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_read_params(NULL,
+                                                    (const unsigned char **) &buf,
+                                                    buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_read_params(&ctx, &buf_null,
+                                                    buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_read_params(&ctx, NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_read_params(&ctx,
+                                                    (const unsigned char **) &buf,
+                                                    NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_get_params( NULL, &kp,
-                                                     MBEDTLS_ECDH_OURS ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_get_params( &ctx, NULL,
-                                                     MBEDTLS_ECDH_OURS ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_get_params( &ctx, &kp,
-                                                     invalid_side ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_get_params(NULL, &kp,
+                                                   MBEDTLS_ECDH_OURS));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_get_params(&ctx, NULL,
+                                                   MBEDTLS_ECDH_OURS));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_get_params(&ctx, &kp,
+                                                   invalid_side));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdh_make_public( NULL, &olen, buf, buflen,
-                                   mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_make_public(NULL, &olen, buf, buflen,
+                                                    mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdh_make_public( &ctx, NULL, buf, buflen,
-                                   mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_make_public(&ctx, NULL, buf, buflen,
+                                                    mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdh_make_public( &ctx, &olen, NULL, buflen,
-                                   mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_make_public(&ctx, &olen, NULL, buflen,
+                                                    mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdh_make_public( &ctx, &olen, buf, buflen, NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_make_public(&ctx, &olen, buf, buflen, NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_read_public( NULL, buf, buflen ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_read_public( &ctx, NULL, buflen ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_read_public(NULL, buf, buflen));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_read_public(&ctx, NULL, buflen));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdh_calc_secret( NULL, &olen, buf, buflen,
-                                   mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_calc_secret(NULL, &olen, buf, buflen,
+                                                    mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdh_calc_secret( &ctx, NULL, buf, buflen,
-                                   mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_calc_secret(&ctx, NULL, buf, buflen,
+                                                    mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdh_calc_secret( &ctx, &olen, NULL, buflen,
-                                   mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdh_calc_secret(&ctx, &olen, NULL, buflen,
+                                                    mbedtls_test_rnd_std_rand, NULL));
 
 exit:
     return;
@@ -186,59 +186,59 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecdh_primitive_random( int id )
+void ecdh_primitive_random(int id)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point qA, qB;
     mbedtls_mpi dA, dB, zA, zB;
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_point_init( &qA ); mbedtls_ecp_point_init( &qB );
-    mbedtls_mpi_init( &dA ); mbedtls_mpi_init( &dB );
-    mbedtls_mpi_init( &zA ); mbedtls_mpi_init( &zB );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_point_init(&qA); mbedtls_ecp_point_init(&qB);
+    mbedtls_mpi_init(&dA); mbedtls_mpi_init(&dB);
+    mbedtls_mpi_init(&zA); mbedtls_mpi_init(&zB);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
 
-    TEST_ASSERT( mbedtls_ecdh_gen_public( &grp, &dA, &qA,
-                                          &mbedtls_test_rnd_pseudo_rand,
-                                          &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecdh_gen_public( &grp, &dB, &qB,
-                                          &mbedtls_test_rnd_pseudo_rand,
-                                          &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecdh_compute_shared( &grp, &zA, &qB, &dA,
-                                              &mbedtls_test_rnd_pseudo_rand,
-                                              &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecdh_compute_shared( &grp, &zB, &qA, &dB,
-                                      NULL, NULL ) == 0 );
+    TEST_ASSERT(mbedtls_ecdh_gen_public(&grp, &dA, &qA,
+                                        &mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecdh_gen_public(&grp, &dB, &qB,
+                                        &mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecdh_compute_shared(&grp, &zA, &qB, &dA,
+                                            &mbedtls_test_rnd_pseudo_rand,
+                                            &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecdh_compute_shared(&grp, &zB, &qA, &dB,
+                                            NULL, NULL) == 0);
 
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &zA, &zB ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&zA, &zB) == 0);
 
 exit:
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_ecp_point_free( &qA ); mbedtls_ecp_point_free( &qB );
-    mbedtls_mpi_free( &dA ); mbedtls_mpi_free( &dB );
-    mbedtls_mpi_free( &zA ); mbedtls_mpi_free( &zB );
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_ecp_point_free(&qA); mbedtls_ecp_point_free(&qB);
+    mbedtls_mpi_free(&dA); mbedtls_mpi_free(&dB);
+    mbedtls_mpi_free(&zA); mbedtls_mpi_free(&zB);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecdh_primitive_testvec( int id, data_t * rnd_buf_A, char * xA_str,
-                             char * yA_str, data_t * rnd_buf_B,
-                             char * xB_str, char * yB_str, char * z_str )
+void ecdh_primitive_testvec(int id, data_t *rnd_buf_A, char *xA_str,
+                            char *yA_str, data_t *rnd_buf_B,
+                            char *xB_str, char *yB_str, char *z_str)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point qA, qB;
     mbedtls_mpi dA, dB, zA, zB, check;
     mbedtls_test_rnd_buf_info rnd_info_A, rnd_info_B;
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_point_init( &qA ); mbedtls_ecp_point_init( &qB );
-    mbedtls_mpi_init( &dA ); mbedtls_mpi_init( &dB );
-    mbedtls_mpi_init( &zA ); mbedtls_mpi_init( &zB ); mbedtls_mpi_init( &check );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_point_init(&qA); mbedtls_ecp_point_init(&qB);
+    mbedtls_mpi_init(&dA); mbedtls_mpi_init(&dB);
+    mbedtls_mpi_init(&zA); mbedtls_mpi_init(&zB); mbedtls_mpi_init(&check);
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
 
     rnd_info_A.buf = rnd_buf_A->x;
     rnd_info_A.length = rnd_buf_A->len;
@@ -246,14 +246,14 @@
     rnd_info_A.fallback_p_rng = NULL;
 
     /* Fix rnd_buf_A->x by shifting it left if necessary */
-    if( grp.nbits % 8 != 0 )
-    {
-        unsigned char shift = 8 - ( grp.nbits % 8 );
+    if (grp.nbits % 8 != 0) {
+        unsigned char shift = 8 - (grp.nbits % 8);
         size_t i;
 
-        for( i = 0; i < rnd_info_A.length - 1; i++ )
+        for (i = 0; i < rnd_info_A.length - 1; i++) {
             rnd_buf_A->x[i] = rnd_buf_A->x[i] << shift
-                         | rnd_buf_A->x[i+1] >> ( 8 - shift );
+                              | rnd_buf_A->x[i+1] >> (8 - shift);
+        }
 
         rnd_buf_A->x[rnd_info_A.length-1] <<= shift;
     }
@@ -264,52 +264,52 @@
     rnd_info_B.fallback_p_rng = NULL;
 
     /* Fix rnd_buf_B->x by shifting it left if necessary */
-    if( grp.nbits % 8 != 0 )
-    {
-        unsigned char shift = 8 - ( grp.nbits % 8 );
+    if (grp.nbits % 8 != 0) {
+        unsigned char shift = 8 - (grp.nbits % 8);
         size_t i;
 
-        for( i = 0; i < rnd_info_B.length - 1; i++ )
+        for (i = 0; i < rnd_info_B.length - 1; i++) {
             rnd_buf_B->x[i] = rnd_buf_B->x[i] << shift
-                         | rnd_buf_B->x[i+1] >> ( 8 - shift );
+                              | rnd_buf_B->x[i+1] >> (8 - shift);
+        }
 
         rnd_buf_B->x[rnd_info_B.length-1] <<= shift;
     }
 
-    TEST_ASSERT( mbedtls_ecdh_gen_public( &grp, &dA, &qA,
-                                          mbedtls_test_rnd_buffer_rand,
-                                          &rnd_info_A ) == 0 );
-    TEST_ASSERT( ! mbedtls_ecp_is_zero( &qA ) );
-    TEST_ASSERT( mbedtls_test_read_mpi( &check, xA_str ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &qA.X, &check ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &check, yA_str ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &qA.Y, &check ) == 0 );
+    TEST_ASSERT(mbedtls_ecdh_gen_public(&grp, &dA, &qA,
+                                        mbedtls_test_rnd_buffer_rand,
+                                        &rnd_info_A) == 0);
+    TEST_ASSERT(!mbedtls_ecp_is_zero(&qA));
+    TEST_ASSERT(mbedtls_test_read_mpi(&check, xA_str) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&qA.X, &check) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&check, yA_str) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&qA.Y, &check) == 0);
 
-    TEST_ASSERT( mbedtls_ecdh_gen_public( &grp, &dB, &qB,
-                                          mbedtls_test_rnd_buffer_rand,
-                                          &rnd_info_B ) == 0 );
-    TEST_ASSERT( ! mbedtls_ecp_is_zero( &qB ) );
-    TEST_ASSERT( mbedtls_test_read_mpi( &check, xB_str ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &qB.X, &check ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &check, yB_str ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &qB.Y, &check ) == 0 );
+    TEST_ASSERT(mbedtls_ecdh_gen_public(&grp, &dB, &qB,
+                                        mbedtls_test_rnd_buffer_rand,
+                                        &rnd_info_B) == 0);
+    TEST_ASSERT(!mbedtls_ecp_is_zero(&qB));
+    TEST_ASSERT(mbedtls_test_read_mpi(&check, xB_str) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&qB.X, &check) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&check, yB_str) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&qB.Y, &check) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &check, z_str ) == 0 );
-    TEST_ASSERT( mbedtls_ecdh_compute_shared( &grp, &zA, &qB, &dA, NULL, NULL ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &zA, &check ) == 0 );
-    TEST_ASSERT( mbedtls_ecdh_compute_shared( &grp, &zB, &qA, &dB, NULL, NULL ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &zB, &check ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&check, z_str) == 0);
+    TEST_ASSERT(mbedtls_ecdh_compute_shared(&grp, &zA, &qB, &dA, NULL, NULL) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&zA, &check) == 0);
+    TEST_ASSERT(mbedtls_ecdh_compute_shared(&grp, &zB, &qA, &dB, NULL, NULL) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&zB, &check) == 0);
 
 exit:
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_ecp_point_free( &qA ); mbedtls_ecp_point_free( &qB );
-    mbedtls_mpi_free( &dA ); mbedtls_mpi_free( &dB );
-    mbedtls_mpi_free( &zA ); mbedtls_mpi_free( &zB ); mbedtls_mpi_free( &check );
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_ecp_point_free(&qA); mbedtls_ecp_point_free(&qB);
+    mbedtls_mpi_free(&dA); mbedtls_mpi_free(&dB);
+    mbedtls_mpi_free(&zA); mbedtls_mpi_free(&zB); mbedtls_mpi_free(&check);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecdh_exchange( int id )
+void ecdh_exchange(int id)
 {
     mbedtls_ecdh_context srv, cli;
     unsigned char buf[1000];
@@ -319,41 +319,41 @@
     unsigned char res_buf[1000];
     size_t res_len;
 
-    mbedtls_ecdh_init( &srv );
-    mbedtls_ecdh_init( &cli );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    mbedtls_ecdh_init(&srv);
+    mbedtls_ecdh_init(&cli);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    TEST_ASSERT( mbedtls_ecdh_setup( &srv, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecdh_setup(&srv, id) == 0);
 
-    memset( buf, 0x00, sizeof( buf ) ); vbuf = buf;
-    TEST_ASSERT( mbedtls_ecdh_make_params( &srv, &len, buf, 1000,
-                                           &mbedtls_test_rnd_pseudo_rand,
-                                           &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecdh_read_params( &cli, &vbuf, buf + len ) == 0 );
+    memset(buf, 0x00, sizeof(buf)); vbuf = buf;
+    TEST_ASSERT(mbedtls_ecdh_make_params(&srv, &len, buf, 1000,
+                                         &mbedtls_test_rnd_pseudo_rand,
+                                         &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecdh_read_params(&cli, &vbuf, buf + len) == 0);
 
-    memset( buf, 0x00, sizeof( buf ) );
-    TEST_ASSERT( mbedtls_ecdh_make_public( &cli, &len, buf, 1000,
-                                           &mbedtls_test_rnd_pseudo_rand,
-                                           &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecdh_read_public( &srv, buf, len ) == 0 );
+    memset(buf, 0x00, sizeof(buf));
+    TEST_ASSERT(mbedtls_ecdh_make_public(&cli, &len, buf, 1000,
+                                         &mbedtls_test_rnd_pseudo_rand,
+                                         &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecdh_read_public(&srv, buf, len) == 0);
 
-    TEST_ASSERT( mbedtls_ecdh_calc_secret( &srv, &len, buf, 1000,
-                                           &mbedtls_test_rnd_pseudo_rand,
-                                           &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecdh_calc_secret( &cli, &res_len, res_buf, 1000,
-                                           NULL, NULL ) == 0 );
-    TEST_ASSERT( len == res_len );
-    TEST_ASSERT( memcmp( buf, res_buf, len ) == 0 );
+    TEST_ASSERT(mbedtls_ecdh_calc_secret(&srv, &len, buf, 1000,
+                                         &mbedtls_test_rnd_pseudo_rand,
+                                         &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecdh_calc_secret(&cli, &res_len, res_buf, 1000,
+                                         NULL, NULL) == 0);
+    TEST_ASSERT(len == res_len);
+    TEST_ASSERT(memcmp(buf, res_buf, len) == 0);
 
 exit:
-    mbedtls_ecdh_free( &srv );
-    mbedtls_ecdh_free( &cli );
+    mbedtls_ecdh_free(&srv);
+    mbedtls_ecdh_free(&cli);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECP_RESTARTABLE */
-void ecdh_restart( int id, data_t *dA, data_t *dB, data_t *z,
-                   int enable, int max_ops, int min_restart, int max_restart )
+void ecdh_restart(int id, data_t *dA, data_t *dB, data_t *z,
+                  int enable, int max_ops, int min_restart, int max_restart)
 {
     int ret;
     mbedtls_ecdh_context srv, cli;
@@ -364,9 +364,9 @@
     int cnt_restart;
     mbedtls_ecp_group grp;
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecdh_init( &srv );
-    mbedtls_ecdh_init( &cli );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecdh_init(&srv);
+    mbedtls_ecdh_init(&cli);
 
     rnd_info_A.fallback_f_rng = mbedtls_test_rnd_std_rand;
     rnd_info_A.fallback_p_rng = NULL;
@@ -380,103 +380,102 @@
 
     /* The ECDH context is not guaranteed to have an mbedtls_ecp_group structure
      * in every configuration, therefore we load it separately. */
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
 
     /* Otherwise we would have to fix the random buffer,
      * as in ecdh_primitive_testvec. */
-    TEST_ASSERT( grp.nbits % 8 == 0 );
+    TEST_ASSERT(grp.nbits % 8 == 0);
 
-    TEST_ASSERT( mbedtls_ecdh_setup( &srv, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecdh_setup(&srv, id) == 0);
 
     /* set up restart parameters */
-    mbedtls_ecp_set_max_ops( max_ops );
+    mbedtls_ecp_set_max_ops(max_ops);
 
-    if( enable )
-    {
-        mbedtls_ecdh_enable_restart( &srv );
-        mbedtls_ecdh_enable_restart( &cli );
+    if (enable) {
+        mbedtls_ecdh_enable_restart(&srv);
+        mbedtls_ecdh_enable_restart(&cli);
     }
 
     /* server writes its parameters */
-    memset( buf, 0x00, sizeof( buf ) );
+    memset(buf, 0x00, sizeof(buf));
     len = 0;
 
     cnt_restart = 0;
     do {
-        ret = mbedtls_ecdh_make_params( &srv, &len, buf, sizeof( buf ),
-                                        mbedtls_test_rnd_buffer_rand,
-                                        &rnd_info_A );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart );
+        ret = mbedtls_ecdh_make_params(&srv, &len, buf, sizeof(buf),
+                                       mbedtls_test_rnd_buffer_rand,
+                                       &rnd_info_A);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart);
 
-    TEST_ASSERT( ret == 0 );
-    TEST_ASSERT( cnt_restart >= min_restart );
-    TEST_ASSERT( cnt_restart <= max_restart );
+    TEST_ASSERT(ret == 0);
+    TEST_ASSERT(cnt_restart >= min_restart);
+    TEST_ASSERT(cnt_restart <= max_restart);
 
     /* client read server params */
     vbuf = buf;
-    TEST_ASSERT( mbedtls_ecdh_read_params( &cli, &vbuf, buf + len ) == 0 );
+    TEST_ASSERT(mbedtls_ecdh_read_params(&cli, &vbuf, buf + len) == 0);
 
     /* client writes its key share */
-    memset( buf, 0x00, sizeof( buf ) );
+    memset(buf, 0x00, sizeof(buf));
     len = 0;
 
     cnt_restart = 0;
     do {
-        ret = mbedtls_ecdh_make_public( &cli, &len, buf, sizeof( buf ),
-                                        mbedtls_test_rnd_buffer_rand,
-                                        &rnd_info_B );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart );
+        ret = mbedtls_ecdh_make_public(&cli, &len, buf, sizeof(buf),
+                                       mbedtls_test_rnd_buffer_rand,
+                                       &rnd_info_B);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart);
 
-    TEST_ASSERT( ret == 0 );
-    TEST_ASSERT( cnt_restart >= min_restart );
-    TEST_ASSERT( cnt_restart <= max_restart );
+    TEST_ASSERT(ret == 0);
+    TEST_ASSERT(cnt_restart >= min_restart);
+    TEST_ASSERT(cnt_restart <= max_restart);
 
     /* server reads client key share */
-    TEST_ASSERT( mbedtls_ecdh_read_public( &srv, buf, len ) == 0 );
+    TEST_ASSERT(mbedtls_ecdh_read_public(&srv, buf, len) == 0);
 
     /* server computes shared secret */
-    memset( buf, 0, sizeof( buf ) );
+    memset(buf, 0, sizeof(buf));
     len = 0;
 
     cnt_restart = 0;
     do {
-        ret = mbedtls_ecdh_calc_secret( &srv, &len, buf, sizeof( buf ),
-                                              NULL, NULL );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart );
+        ret = mbedtls_ecdh_calc_secret(&srv, &len, buf, sizeof(buf),
+                                       NULL, NULL);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart);
 
-    TEST_ASSERT( ret == 0 );
-    TEST_ASSERT( cnt_restart >= min_restart );
-    TEST_ASSERT( cnt_restart <= max_restart );
+    TEST_ASSERT(ret == 0);
+    TEST_ASSERT(cnt_restart >= min_restart);
+    TEST_ASSERT(cnt_restart <= max_restart);
 
-    TEST_ASSERT( len == z->len );
-    TEST_ASSERT( memcmp( buf, z->x, len ) == 0 );
+    TEST_ASSERT(len == z->len);
+    TEST_ASSERT(memcmp(buf, z->x, len) == 0);
 
     /* client computes shared secret */
-    memset( buf, 0, sizeof( buf ) );
+    memset(buf, 0, sizeof(buf));
     len = 0;
 
     cnt_restart = 0;
     do {
-        ret = mbedtls_ecdh_calc_secret( &cli, &len, buf, sizeof( buf ),
-                                              NULL, NULL );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart );
+        ret = mbedtls_ecdh_calc_secret(&cli, &len, buf, sizeof(buf),
+                                       NULL, NULL);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart);
 
-    TEST_ASSERT( ret == 0 );
-    TEST_ASSERT( cnt_restart >= min_restart );
-    TEST_ASSERT( cnt_restart <= max_restart );
+    TEST_ASSERT(ret == 0);
+    TEST_ASSERT(cnt_restart >= min_restart);
+    TEST_ASSERT(cnt_restart <= max_restart);
 
-    TEST_ASSERT( len == z->len );
-    TEST_ASSERT( memcmp( buf, z->x, len ) == 0 );
+    TEST_ASSERT(len == z->len);
+    TEST_ASSERT(memcmp(buf, z->x, len) == 0);
 
 exit:
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_ecdh_free( &srv );
-    mbedtls_ecdh_free( &cli );
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_ecdh_free(&srv);
+    mbedtls_ecdh_free(&cli);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECDH_LEGACY_CONTEXT */
-void ecdh_exchange_legacy( int id )
+void ecdh_exchange_legacy(int id)
 {
     mbedtls_ecdh_context srv, cli;
     unsigned char buf[1000];
@@ -485,43 +484,43 @@
 
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    mbedtls_ecdh_init( &srv );
-    mbedtls_ecdh_init( &cli );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    mbedtls_ecdh_init(&srv);
+    mbedtls_ecdh_init(&cli);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &srv.grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&srv.grp, id) == 0);
 
-    memset( buf, 0x00, sizeof( buf ) ); vbuf = buf;
-    TEST_ASSERT( mbedtls_ecdh_make_params( &srv, &len, buf, 1000,
-                                           &mbedtls_test_rnd_pseudo_rand,
-                                           &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecdh_read_params( &cli, &vbuf, buf + len ) == 0 );
+    memset(buf, 0x00, sizeof(buf)); vbuf = buf;
+    TEST_ASSERT(mbedtls_ecdh_make_params(&srv, &len, buf, 1000,
+                                         &mbedtls_test_rnd_pseudo_rand,
+                                         &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecdh_read_params(&cli, &vbuf, buf + len) == 0);
 
-    memset( buf, 0x00, sizeof( buf ) );
-    TEST_ASSERT( mbedtls_ecdh_make_public( &cli, &len, buf, 1000,
-                                           &mbedtls_test_rnd_pseudo_rand,
-                                           &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecdh_read_public( &srv, buf, len ) == 0 );
+    memset(buf, 0x00, sizeof(buf));
+    TEST_ASSERT(mbedtls_ecdh_make_public(&cli, &len, buf, 1000,
+                                         &mbedtls_test_rnd_pseudo_rand,
+                                         &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecdh_read_public(&srv, buf, len) == 0);
 
-    TEST_ASSERT( mbedtls_ecdh_calc_secret( &srv, &len, buf, 1000,
-                                           &mbedtls_test_rnd_pseudo_rand,
-                                           &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecdh_calc_secret( &cli, &len, buf, 1000, NULL,
-                                           NULL ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &srv.z, &cli.z ) == 0 );
+    TEST_ASSERT(mbedtls_ecdh_calc_secret(&srv, &len, buf, 1000,
+                                         &mbedtls_test_rnd_pseudo_rand,
+                                         &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecdh_calc_secret(&cli, &len, buf, 1000, NULL,
+                                         NULL) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&srv.z, &cli.z) == 0);
 
 exit:
-    mbedtls_ecdh_free( &srv );
-    mbedtls_ecdh_free( &cli );
+    mbedtls_ecdh_free(&srv);
+    mbedtls_ecdh_free(&cli);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecdh_exchange_calc_secret( int grp_id,
-                                data_t *our_private_key,
-                                data_t *their_point,
-                                int ours_first,
-                                data_t *expected )
+void ecdh_exchange_calc_secret(int grp_id,
+                               data_t *our_private_key,
+                               data_t *their_point,
+                               int ours_first,
+                               data_t *expected)
 {
     mbedtls_test_rnd_pseudo_info rnd_info;
     mbedtls_ecp_keypair our_key;
@@ -530,92 +529,90 @@
     unsigned char shared_secret[MBEDTLS_ECP_MAX_BYTES];
     size_t shared_secret_length = 0;
 
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
-    mbedtls_ecdh_init( &ecdh );
-    mbedtls_ecp_keypair_init( &our_key );
-    mbedtls_ecp_keypair_init( &their_key );
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
+    mbedtls_ecdh_init(&ecdh);
+    mbedtls_ecp_keypair_init(&our_key);
+    mbedtls_ecp_keypair_init(&their_key);
 
-    if( ! load_private_key( grp_id, our_private_key, &our_key, &rnd_info ) )
+    if (!load_private_key(grp_id, our_private_key, &our_key, &rnd_info)) {
         goto exit;
-    if( ! load_public_key( grp_id, their_point, &their_key ) )
+    }
+    if (!load_public_key(grp_id, their_point, &their_key)) {
         goto exit;
+    }
 
     /* Import the keys to the ECDH calculation. */
-    if( ours_first )
-    {
-        TEST_ASSERT( mbedtls_ecdh_get_params(
-                         &ecdh, &our_key, MBEDTLS_ECDH_OURS ) == 0 );
-        TEST_ASSERT( mbedtls_ecdh_get_params(
-                         &ecdh, &their_key, MBEDTLS_ECDH_THEIRS ) == 0 );
-    }
-    else
-    {
-        TEST_ASSERT( mbedtls_ecdh_get_params(
-                         &ecdh, &their_key, MBEDTLS_ECDH_THEIRS ) == 0 );
-        TEST_ASSERT( mbedtls_ecdh_get_params(
-                         &ecdh, &our_key, MBEDTLS_ECDH_OURS ) == 0 );
+    if (ours_first) {
+        TEST_ASSERT(mbedtls_ecdh_get_params(
+                        &ecdh, &our_key, MBEDTLS_ECDH_OURS) == 0);
+        TEST_ASSERT(mbedtls_ecdh_get_params(
+                        &ecdh, &their_key, MBEDTLS_ECDH_THEIRS) == 0);
+    } else {
+        TEST_ASSERT(mbedtls_ecdh_get_params(
+                        &ecdh, &their_key, MBEDTLS_ECDH_THEIRS) == 0);
+        TEST_ASSERT(mbedtls_ecdh_get_params(
+                        &ecdh, &our_key, MBEDTLS_ECDH_OURS) == 0);
     }
 
     /* Perform the ECDH calculation. */
-    TEST_ASSERT( mbedtls_ecdh_calc_secret(
-                     &ecdh,
-                     &shared_secret_length,
-                     shared_secret, sizeof( shared_secret ),
-                     &mbedtls_test_rnd_pseudo_rand, &rnd_info ) == 0 );
-    TEST_ASSERT( shared_secret_length == expected->len );
-    TEST_ASSERT( memcmp( expected->x, shared_secret,
-                         shared_secret_length ) == 0 );
+    TEST_ASSERT(mbedtls_ecdh_calc_secret(
+                    &ecdh,
+                    &shared_secret_length,
+                    shared_secret, sizeof(shared_secret),
+                    &mbedtls_test_rnd_pseudo_rand, &rnd_info) == 0);
+    TEST_ASSERT(shared_secret_length == expected->len);
+    TEST_ASSERT(memcmp(expected->x, shared_secret,
+                       shared_secret_length) == 0);
 
 exit:
-    mbedtls_ecdh_free( &ecdh );
-    mbedtls_ecp_keypair_free( &our_key );
-    mbedtls_ecp_keypair_free( &their_key );
+    mbedtls_ecdh_free(&ecdh);
+    mbedtls_ecp_keypair_free(&our_key);
+    mbedtls_ecp_keypair_free(&their_key);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecdh_exchange_get_params_fail( int our_grp_id,
-                                    data_t *our_private_key,
-                                    int their_grp_id,
-                                    data_t *their_point,
-                                    int ours_first,
-                                    int expected_ret )
+void ecdh_exchange_get_params_fail(int our_grp_id,
+                                   data_t *our_private_key,
+                                   int their_grp_id,
+                                   data_t *their_point,
+                                   int ours_first,
+                                   int expected_ret)
 {
     mbedtls_test_rnd_pseudo_info rnd_info;
     mbedtls_ecp_keypair our_key;
     mbedtls_ecp_keypair their_key;
     mbedtls_ecdh_context ecdh;
 
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
-    mbedtls_ecdh_init( &ecdh );
-    mbedtls_ecp_keypair_init( &our_key );
-    mbedtls_ecp_keypair_init( &their_key );
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
+    mbedtls_ecdh_init(&ecdh);
+    mbedtls_ecp_keypair_init(&our_key);
+    mbedtls_ecp_keypair_init(&their_key);
 
-    if( ! load_private_key( our_grp_id, our_private_key, &our_key, &rnd_info ) )
+    if (!load_private_key(our_grp_id, our_private_key, &our_key, &rnd_info)) {
         goto exit;
-    if( ! load_public_key( their_grp_id, their_point, &their_key ) )
-        goto exit;
-
-    if( ours_first )
-    {
-        TEST_ASSERT( mbedtls_ecdh_get_params(
-                         &ecdh, &our_key, MBEDTLS_ECDH_OURS ) == 0 );
-        TEST_ASSERT( mbedtls_ecdh_get_params(
-                         &ecdh, &their_key, MBEDTLS_ECDH_THEIRS ) ==
-                     expected_ret );
     }
-    else
-    {
-        TEST_ASSERT( mbedtls_ecdh_get_params(
-                         &ecdh, &their_key, MBEDTLS_ECDH_THEIRS ) == 0 );
-        TEST_ASSERT( mbedtls_ecdh_get_params(
-                         &ecdh, &our_key, MBEDTLS_ECDH_OURS ) ==
-                     expected_ret );
+    if (!load_public_key(their_grp_id, their_point, &their_key)) {
+        goto exit;
+    }
+
+    if (ours_first) {
+        TEST_ASSERT(mbedtls_ecdh_get_params(
+                        &ecdh, &our_key, MBEDTLS_ECDH_OURS) == 0);
+        TEST_ASSERT(mbedtls_ecdh_get_params(
+                        &ecdh, &their_key, MBEDTLS_ECDH_THEIRS) ==
+                    expected_ret);
+    } else {
+        TEST_ASSERT(mbedtls_ecdh_get_params(
+                        &ecdh, &their_key, MBEDTLS_ECDH_THEIRS) == 0);
+        TEST_ASSERT(mbedtls_ecdh_get_params(
+                        &ecdh, &our_key, MBEDTLS_ECDH_OURS) ==
+                    expected_ret);
     }
 
 exit:
-    mbedtls_ecdh_free( &ecdh );
-    mbedtls_ecp_keypair_free( &our_key );
-    mbedtls_ecp_keypair_free( &their_key );
+    mbedtls_ecdh_free(&ecdh);
+    mbedtls_ecp_keypair_free(&our_key);
+    mbedtls_ecp_keypair_free(&their_key);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_ecdsa.function b/tests/suites/test_suite_ecdsa.function
index 1ca7c39..470495d 100644
--- a/tests/suites/test_suite_ecdsa.function
+++ b/tests/suites/test_suite_ecdsa.function
@@ -8,7 +8,7 @@
  */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void ecdsa_invalid_param( )
+void ecdsa_invalid_param()
 {
     mbedtls_ecdsa_context ctx;
     mbedtls_ecp_keypair key;
@@ -20,204 +20,204 @@
     size_t slen;
     unsigned char buf[42] = { 0 };
 
-    mbedtls_ecdsa_init( &ctx );
-    mbedtls_ecp_keypair_init( &key );
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_point_init( &P );
-    mbedtls_mpi_init( &m );
+    mbedtls_ecdsa_init(&ctx);
+    mbedtls_ecp_keypair_init(&key);
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_point_init(&P);
+    mbedtls_mpi_init(&m);
 
-    TEST_INVALID_PARAM( mbedtls_ecdsa_init( NULL ) );
-    TEST_VALID_PARAM( mbedtls_ecdsa_free( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_ecdsa_init(NULL));
+    TEST_VALID_PARAM(mbedtls_ecdsa_free(NULL));
 
 #if defined(MBEDTLS_ECP_RESTARTABLE)
-    TEST_INVALID_PARAM( mbedtls_ecdsa_restart_init( NULL ) );
-    TEST_VALID_PARAM( mbedtls_ecdsa_restart_free( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_ecdsa_restart_init(NULL));
+    TEST_VALID_PARAM(mbedtls_ecdsa_restart_free(NULL));
 #endif /* MBEDTLS_ECP_RESTARTABLE */
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdsa_sign( NULL, &m, &m, &m,
-                                                buf, sizeof( buf ),
-                                                mbedtls_test_rnd_std_rand,
-                                                NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdsa_sign( &grp, NULL, &m, &m,
-                                                buf, sizeof( buf ),
-                                                mbedtls_test_rnd_std_rand,
-                                                NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_sign( &grp, &m, NULL, &m,
-                                                buf, sizeof( buf ),
-                                                mbedtls_test_rnd_std_rand,
-                                                NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_sign( &grp, &m, &m, NULL,
-                                                buf, sizeof( buf ),
-                                                mbedtls_test_rnd_std_rand,
-                                                NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_sign( &grp, &m, &m, &m,
-                                                NULL, sizeof( buf ),
-                                                mbedtls_test_rnd_std_rand,
-                                                NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_sign( &grp, &m, &m, &m,
-                                                buf, sizeof( buf ),
-                                                NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_sign(NULL, &m, &m, &m,
+                                              buf, sizeof(buf),
+                                              mbedtls_test_rnd_std_rand,
+                                              NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_sign(&grp, NULL, &m, &m,
+                                              buf, sizeof(buf),
+                                              mbedtls_test_rnd_std_rand,
+                                              NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_sign(&grp, &m, NULL, &m,
+                                              buf, sizeof(buf),
+                                              mbedtls_test_rnd_std_rand,
+                                              NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_sign(&grp, &m, &m, NULL,
+                                              buf, sizeof(buf),
+                                              mbedtls_test_rnd_std_rand,
+                                              NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_sign(&grp, &m, &m, &m,
+                                              NULL, sizeof(buf),
+                                              mbedtls_test_rnd_std_rand,
+                                              NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_sign(&grp, &m, &m, &m,
+                                              buf, sizeof(buf),
+                                              NULL, NULL));
 
 #if defined(MBEDTLS_ECDSA_DETERMINISTIC)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_sign_det_ext( NULL, &m, &m, &m,
-                                                   buf, sizeof( buf ),
-                                                   valid_md,
-                                                   mbedtls_test_rnd_std_rand,
-                                                   NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_sign_det_ext( &grp, NULL, &m, &m,
-                                                   buf, sizeof( buf ),
-                                                   valid_md,
-                                                   mbedtls_test_rnd_std_rand,
-                                                   NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_sign_det_ext( &grp, &m, NULL, &m,
-                                                   buf, sizeof( buf ),
-                                                   valid_md,
-                                                   mbedtls_test_rnd_std_rand,
-                                                   NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_sign_det_ext( &grp, &m, &m, NULL,
-                                                   buf, sizeof( buf ),
-                                                   valid_md,
-                                                   mbedtls_test_rnd_std_rand,
-                                                   NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_sign_det_ext( &grp, &m, &m, &m,
-                                                   NULL, sizeof( buf ),
-                                                   valid_md,
-                                                   mbedtls_test_rnd_std_rand,
-                                                   NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_sign_det_ext(NULL, &m, &m, &m,
+                                                      buf, sizeof(buf),
+                                                      valid_md,
+                                                      mbedtls_test_rnd_std_rand,
+                                                      NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_sign_det_ext(&grp, NULL, &m, &m,
+                                                      buf, sizeof(buf),
+                                                      valid_md,
+                                                      mbedtls_test_rnd_std_rand,
+                                                      NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_sign_det_ext(&grp, &m, NULL, &m,
+                                                      buf, sizeof(buf),
+                                                      valid_md,
+                                                      mbedtls_test_rnd_std_rand,
+                                                      NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_sign_det_ext(&grp, &m, &m, NULL,
+                                                      buf, sizeof(buf),
+                                                      valid_md,
+                                                      mbedtls_test_rnd_std_rand,
+                                                      NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_sign_det_ext(&grp, &m, &m, &m,
+                                                      NULL, sizeof(buf),
+                                                      valid_md,
+                                                      mbedtls_test_rnd_std_rand,
+                                                      NULL));
 #endif /* MBEDTLS_ECDSA_DETERMINISTIC */
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_verify( NULL,
-                                                  buf, sizeof( buf ),
-                                                  &P, &m, &m ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_verify( &grp,
-                                                  NULL, sizeof( buf ),
-                                                  &P, &m, &m ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_verify( &grp,
-                                                  buf, sizeof( buf ),
-                                                  NULL, &m, &m ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_verify( &grp,
-                                                  buf, sizeof( buf ),
-                                                  &P, NULL, &m ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_verify( &grp,
-                                                  buf, sizeof( buf ),
-                                                  &P, &m, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_verify(NULL,
+                                                buf, sizeof(buf),
+                                                &P, &m, &m));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_verify(&grp,
+                                                NULL, sizeof(buf),
+                                                &P, &m, &m));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_verify(&grp,
+                                                buf, sizeof(buf),
+                                                NULL, &m, &m));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_verify(&grp,
+                                                buf, sizeof(buf),
+                                                &P, NULL, &m));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_verify(&grp,
+                                                buf, sizeof(buf),
+                                                &P, &m, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdsa_write_signature( NULL, valid_md, buf, sizeof( buf ),
-                                        buf, &slen, mbedtls_test_rnd_std_rand,
-                                        NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_write_signature(NULL, valid_md, buf, sizeof(buf),
+                                                         buf, &slen, mbedtls_test_rnd_std_rand,
+                                                         NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdsa_write_signature( &ctx, valid_md, NULL, sizeof( buf ),
-                                        buf, &slen, mbedtls_test_rnd_std_rand,
-                                        NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_write_signature(&ctx, valid_md, NULL, sizeof(buf),
+                                                         buf, &slen, mbedtls_test_rnd_std_rand,
+                                                         NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdsa_write_signature( &ctx, valid_md, buf, sizeof( buf ),
-                                        NULL, &slen, mbedtls_test_rnd_std_rand,
-                                        NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_write_signature(&ctx, valid_md, buf, sizeof(buf),
+                                                         NULL, &slen, mbedtls_test_rnd_std_rand,
+                                                         NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdsa_write_signature( &ctx, valid_md, buf, sizeof( buf ),
-                                        buf, NULL, mbedtls_test_rnd_std_rand,
-                                        NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_write_signature(&ctx, valid_md, buf, sizeof(buf),
+                                                         buf, NULL, mbedtls_test_rnd_std_rand,
+                                                         NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdsa_write_signature_restartable( NULL, valid_md, buf,
-                                                    sizeof( buf ), buf, &slen,
-                                                    mbedtls_test_rnd_std_rand,
-                                                    NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_write_signature_restartable(NULL, valid_md, buf,
+                                                                     sizeof(buf), buf, &slen,
+                                                                     mbedtls_test_rnd_std_rand,
+                                                                     NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdsa_write_signature_restartable( &ctx, valid_md, NULL,
-                                                    sizeof( buf ), buf, &slen,
-                                                    mbedtls_test_rnd_std_rand,
-                                                    NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_write_signature_restartable(&ctx, valid_md, NULL,
+                                                                     sizeof(buf), buf, &slen,
+                                                                     mbedtls_test_rnd_std_rand,
+                                                                     NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdsa_write_signature_restartable( &ctx, valid_md, buf,
-                                                    sizeof( buf ), NULL, &slen,
-                                                    mbedtls_test_rnd_std_rand,
-                                                    NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_write_signature_restartable(&ctx, valid_md, buf,
+                                                                     sizeof(buf), NULL, &slen,
+                                                                     mbedtls_test_rnd_std_rand,
+                                                                     NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-         mbedtls_ecdsa_write_signature_restartable( &ctx, valid_md, buf,
-                                                    sizeof( buf ), buf, NULL,
-                                                    mbedtls_test_rnd_std_rand,
-                                                    NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_write_signature_restartable(&ctx, valid_md, buf,
+                                                                     sizeof(buf), buf, NULL,
+                                                                     mbedtls_test_rnd_std_rand,
+                                                                     NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_read_signature( NULL,
-                                                        buf, sizeof( buf ),
-                                                        buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_read_signature( &ctx,
-                                                        NULL, sizeof( buf ),
-                                                        buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_read_signature( &ctx,
-                                                        buf, sizeof( buf ),
-                                                        NULL, sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_read_signature(NULL,
+                                                        buf, sizeof(buf),
+                                                        buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_read_signature(&ctx,
+                                                        NULL, sizeof(buf),
+                                                        buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_read_signature(&ctx,
+                                                        buf, sizeof(buf),
+                                                        NULL, sizeof(buf)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_read_signature_restartable( NULL,
-                                                        buf, sizeof( buf ),
-                                                        buf, sizeof( buf ),
-                                                        NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_read_signature_restartable( &ctx,
-                                                        NULL, sizeof( buf ),
-                                                        buf, sizeof( buf ),
-                                                        NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_read_signature_restartable( &ctx,
-                                                        buf, sizeof( buf ),
-                                                        NULL, sizeof( buf ),
-                                                        NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_read_signature_restartable(NULL,
+                                                                    buf, sizeof(buf),
+                                                                    buf, sizeof(buf),
+                                                                    NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_read_signature_restartable(&ctx,
+                                                                    NULL, sizeof(buf),
+                                                                    buf, sizeof(buf),
+                                                                    NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_read_signature_restartable(&ctx,
+                                                                    buf, sizeof(buf),
+                                                                    NULL, sizeof(buf),
+                                                                    NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_genkey( NULL, valid_group,
-                                             mbedtls_test_rnd_std_rand,
-                                             NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_genkey( &ctx, valid_group,
-                                                  NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_genkey(NULL, valid_group,
+                                                mbedtls_test_rnd_std_rand,
+                                                NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_genkey(&ctx, valid_group,
+                                                NULL, NULL));
 
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_from_keypair( NULL, &key ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                       mbedtls_ecdsa_from_keypair( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_from_keypair(NULL, &key));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecdsa_from_keypair(&ctx, NULL));
 
 exit:
-    mbedtls_ecdsa_free( &ctx );
-    mbedtls_ecp_keypair_free( &key );
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_ecp_point_free( &P );
-    mbedtls_mpi_free( &m );
+    mbedtls_ecdsa_free(&ctx);
+    mbedtls_ecp_keypair_free(&key);
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_ecp_point_free(&P);
+    mbedtls_mpi_free(&m);
 
     return;
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecdsa_prim_zero( int id )
+void ecdsa_prim_zero(int id)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point Q;
@@ -225,31 +225,31 @@
     mbedtls_test_rnd_pseudo_info rnd_info;
     unsigned char buf[MBEDTLS_MD_MAX_SIZE];
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_point_init( &Q );
-    mbedtls_mpi_init( &d ); mbedtls_mpi_init( &r ); mbedtls_mpi_init( &s );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
-    memset( buf, 0, sizeof( buf ) );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_point_init(&Q);
+    mbedtls_mpi_init(&d); mbedtls_mpi_init(&r); mbedtls_mpi_init(&s);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
+    memset(buf, 0, sizeof(buf));
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_gen_keypair( &grp, &d, &Q,
-                                          &mbedtls_test_rnd_pseudo_rand,
-                                          &rnd_info ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
+    TEST_ASSERT(mbedtls_ecp_gen_keypair(&grp, &d, &Q,
+                                        &mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info) == 0);
 
-    TEST_ASSERT( mbedtls_ecdsa_sign( &grp, &r, &s, &d, buf, sizeof( buf ),
-                                     &mbedtls_test_rnd_pseudo_rand,
-                                     &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecdsa_verify( &grp, buf, sizeof( buf ), &Q, &r, &s ) == 0 );
+    TEST_ASSERT(mbedtls_ecdsa_sign(&grp, &r, &s, &d, buf, sizeof(buf),
+                                   &mbedtls_test_rnd_pseudo_rand,
+                                   &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecdsa_verify(&grp, buf, sizeof(buf), &Q, &r, &s) == 0);
 
 exit:
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_ecp_point_free( &Q );
-    mbedtls_mpi_free( &d ); mbedtls_mpi_free( &r ); mbedtls_mpi_free( &s );
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_ecp_point_free(&Q);
+    mbedtls_mpi_free(&d); mbedtls_mpi_free(&r); mbedtls_mpi_free(&s);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecdsa_prim_random( int id )
+void ecdsa_prim_random(int id)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point Q;
@@ -257,152 +257,151 @@
     mbedtls_test_rnd_pseudo_info rnd_info;
     unsigned char buf[MBEDTLS_MD_MAX_SIZE];
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_point_init( &Q );
-    mbedtls_mpi_init( &d ); mbedtls_mpi_init( &r ); mbedtls_mpi_init( &s );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
-    memset( buf, 0, sizeof( buf ) );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_point_init(&Q);
+    mbedtls_mpi_init(&d); mbedtls_mpi_init(&r); mbedtls_mpi_init(&s);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
+    memset(buf, 0, sizeof(buf));
 
     /* prepare material for signature */
-    TEST_ASSERT( mbedtls_test_rnd_pseudo_rand( &rnd_info,
-                                               buf, sizeof( buf ) ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_gen_keypair( &grp, &d, &Q,
-                                          &mbedtls_test_rnd_pseudo_rand,
-                                          &rnd_info ) == 0 );
+    TEST_ASSERT(mbedtls_test_rnd_pseudo_rand(&rnd_info,
+                                             buf, sizeof(buf)) == 0);
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
+    TEST_ASSERT(mbedtls_ecp_gen_keypair(&grp, &d, &Q,
+                                        &mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info) == 0);
 
-    TEST_ASSERT( mbedtls_ecdsa_sign( &grp, &r, &s, &d, buf, sizeof( buf ),
-                                     &mbedtls_test_rnd_pseudo_rand,
-                                     &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecdsa_verify( &grp, buf, sizeof( buf ), &Q, &r, &s ) == 0 );
+    TEST_ASSERT(mbedtls_ecdsa_sign(&grp, &r, &s, &d, buf, sizeof(buf),
+                                   &mbedtls_test_rnd_pseudo_rand,
+                                   &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecdsa_verify(&grp, buf, sizeof(buf), &Q, &r, &s) == 0);
 
 exit:
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_ecp_point_free( &Q );
-    mbedtls_mpi_free( &d ); mbedtls_mpi_free( &r ); mbedtls_mpi_free( &s );
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_ecp_point_free(&Q);
+    mbedtls_mpi_free(&d); mbedtls_mpi_free(&r); mbedtls_mpi_free(&s);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecdsa_prim_test_vectors( int id, char * d_str, char * xQ_str,
-                              char * yQ_str, data_t * rnd_buf,
-                              data_t * hash, char * r_str, char * s_str,
-                              int result )
+void ecdsa_prim_test_vectors(int id, char *d_str, char *xQ_str,
+                             char *yQ_str, data_t *rnd_buf,
+                             data_t *hash, char *r_str, char *s_str,
+                             int result)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point Q;
     mbedtls_mpi d, r, s, r_check, s_check, zero;
     mbedtls_test_rnd_buf_info rnd_info;
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_point_init( &Q );
-    mbedtls_mpi_init( &d ); mbedtls_mpi_init( &r ); mbedtls_mpi_init( &s );
-    mbedtls_mpi_init( &r_check ); mbedtls_mpi_init( &s_check );
-    mbedtls_mpi_init( &zero );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_point_init(&Q);
+    mbedtls_mpi_init(&d); mbedtls_mpi_init(&r); mbedtls_mpi_init(&s);
+    mbedtls_mpi_init(&r_check); mbedtls_mpi_init(&s_check);
+    mbedtls_mpi_init(&zero);
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_point_read_string( &Q, 16, xQ_str, yQ_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &d, d_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &r_check, r_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &s_check, s_str ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
+    TEST_ASSERT(mbedtls_ecp_point_read_string(&Q, 16, xQ_str, yQ_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&d, d_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&r_check, r_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&s_check, s_str) == 0);
     rnd_info.fallback_f_rng = mbedtls_test_rnd_std_rand;
     rnd_info.fallback_p_rng = NULL;
     rnd_info.buf = rnd_buf->x;
     rnd_info.length = rnd_buf->len;
 
     /* Fix rnd_buf->x by shifting it left if necessary */
-    if( grp.nbits % 8 != 0 )
-    {
-        unsigned char shift = 8 - ( grp.nbits % 8 );
+    if (grp.nbits % 8 != 0) {
+        unsigned char shift = 8 - (grp.nbits % 8);
         size_t i;
 
-        for( i = 0; i < rnd_info.length - 1; i++ )
-            rnd_buf->x[i] = rnd_buf->x[i] << shift | rnd_buf->x[i+1] >> ( 8 - shift );
+        for (i = 0; i < rnd_info.length - 1; i++) {
+            rnd_buf->x[i] = rnd_buf->x[i] << shift | rnd_buf->x[i+1] >> (8 - shift);
+        }
 
         rnd_buf->x[rnd_info.length-1] <<= shift;
     }
 
-    TEST_ASSERT( mbedtls_ecdsa_sign( &grp, &r, &s, &d, hash->x, hash->len,
-                 mbedtls_test_rnd_buffer_rand, &rnd_info ) == result );
+    TEST_ASSERT(mbedtls_ecdsa_sign(&grp, &r, &s, &d, hash->x, hash->len,
+                                   mbedtls_test_rnd_buffer_rand, &rnd_info) == result);
 
-    if ( result == 0)
-    {
+    if (result == 0) {
         /* Check we generated the expected values */
-        TEST_EQUAL( mbedtls_mpi_cmp_mpi( &r, &r_check ), 0 );
-        TEST_EQUAL( mbedtls_mpi_cmp_mpi( &s, &s_check ), 0 );
+        TEST_EQUAL(mbedtls_mpi_cmp_mpi(&r, &r_check), 0);
+        TEST_EQUAL(mbedtls_mpi_cmp_mpi(&s, &s_check), 0);
 
         /* Valid signature */
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len,
-                                          &Q, &r_check, &s_check ), 0 );
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len,
+                                        &Q, &r_check, &s_check), 0);
 
         /* Invalid signature: wrong public key (G instead of Q) */
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len,
-                    &grp.G, &r_check, &s_check ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len,
+                                        &grp.G, &r_check, &s_check), MBEDTLS_ERR_ECP_VERIFY_FAILED);
 
         /* Invalid signatures: r or s or both one off */
-        TEST_EQUAL( mbedtls_mpi_sub_int( &r, &r_check, 1 ), 0 );
-        TEST_EQUAL( mbedtls_mpi_add_int( &s, &s_check, 1 ), 0 );
+        TEST_EQUAL(mbedtls_mpi_sub_int(&r, &r_check, 1), 0);
+        TEST_EQUAL(mbedtls_mpi_add_int(&s, &s_check, 1), 0);
 
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &r, &s_check ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &r_check, &s ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &r, &s ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &r, &s_check), MBEDTLS_ERR_ECP_VERIFY_FAILED);
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &r_check, &s), MBEDTLS_ERR_ECP_VERIFY_FAILED);
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &r, &s), MBEDTLS_ERR_ECP_VERIFY_FAILED);
 
         /* Invalid signatures: r, s or both (CVE-2022-21449) are zero */
-        TEST_EQUAL( mbedtls_mpi_lset( &zero, 0 ), 0 );
+        TEST_EQUAL(mbedtls_mpi_lset(&zero, 0), 0);
 
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &zero, &s_check ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &r_check, &zero ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &zero, &zero ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &zero, &s_check), MBEDTLS_ERR_ECP_VERIFY_FAILED);
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &r_check, &zero), MBEDTLS_ERR_ECP_VERIFY_FAILED);
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &zero, &zero), MBEDTLS_ERR_ECP_VERIFY_FAILED);
 
         /* Invalid signatures: r, s or both are == N */
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &grp.N, &s_check ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &r_check, &grp.N ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &grp.N, &grp.N ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &grp.N, &s_check), MBEDTLS_ERR_ECP_VERIFY_FAILED);
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &r_check, &grp.N), MBEDTLS_ERR_ECP_VERIFY_FAILED);
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &grp.N, &grp.N), MBEDTLS_ERR_ECP_VERIFY_FAILED);
 
         /* Invalid signatures: r, s or both are negative */
-        TEST_EQUAL( mbedtls_mpi_sub_mpi( &r, &r_check, &grp.N ), 0 );
-        TEST_EQUAL( mbedtls_mpi_sub_mpi( &s, &s_check, &grp.N ), 0 );
+        TEST_EQUAL(mbedtls_mpi_sub_mpi(&r, &r_check, &grp.N), 0);
+        TEST_EQUAL(mbedtls_mpi_sub_mpi(&s, &s_check, &grp.N), 0);
 
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &r, &s_check ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &r_check, &s ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &r, &s ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &r, &s_check), MBEDTLS_ERR_ECP_VERIFY_FAILED);
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &r_check, &s), MBEDTLS_ERR_ECP_VERIFY_FAILED);
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &r, &s), MBEDTLS_ERR_ECP_VERIFY_FAILED);
 
         /* Invalid signatures: r or s or both are > N */
-        TEST_EQUAL( mbedtls_mpi_add_mpi( &r, &r_check, &grp.N ), 0 );
-        TEST_EQUAL( mbedtls_mpi_add_mpi( &s, &s_check, &grp.N ), 0 );
+        TEST_EQUAL(mbedtls_mpi_add_mpi(&r, &r_check, &grp.N), 0);
+        TEST_EQUAL(mbedtls_mpi_add_mpi(&s, &s_check, &grp.N), 0);
 
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &r, &s_check ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &r_check, &s ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
-        TEST_EQUAL( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q,
-                    &r, &s ), MBEDTLS_ERR_ECP_VERIFY_FAILED );
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &r, &s_check), MBEDTLS_ERR_ECP_VERIFY_FAILED);
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &r_check, &s), MBEDTLS_ERR_ECP_VERIFY_FAILED);
+        TEST_EQUAL(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q,
+                                        &r, &s), MBEDTLS_ERR_ECP_VERIFY_FAILED);
     }
 
 exit:
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_ecp_point_free( &Q );
-    mbedtls_mpi_free( &d ); mbedtls_mpi_free( &r ); mbedtls_mpi_free( &s );
-    mbedtls_mpi_free( &r_check ); mbedtls_mpi_free( &s_check );
-    mbedtls_mpi_free( &zero );
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_ecp_point_free(&Q);
+    mbedtls_mpi_free(&d); mbedtls_mpi_free(&r); mbedtls_mpi_free(&s);
+    mbedtls_mpi_free(&r_check); mbedtls_mpi_free(&s_check);
+    mbedtls_mpi_free(&zero);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECDSA_DETERMINISTIC */
-void ecdsa_det_test_vectors( int id, char * d_str, int md_alg, char * msg,
-                             char * r_str, char * s_str )
+void ecdsa_det_test_vectors(int id, char *d_str, int md_alg, char *msg,
+                            char *r_str, char *s_str)
 {
     mbedtls_ecp_group grp;
     mbedtls_mpi d, r, s, r_check, s_check;
@@ -410,40 +409,40 @@
     size_t hlen;
     const mbedtls_md_info_t *md_info;
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_mpi_init( &d ); mbedtls_mpi_init( &r ); mbedtls_mpi_init( &s );
-    mbedtls_mpi_init( &r_check ); mbedtls_mpi_init( &s_check );
-    memset( hash, 0, sizeof( hash ) );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_mpi_init(&d); mbedtls_mpi_init(&r); mbedtls_mpi_init(&s);
+    mbedtls_mpi_init(&r_check); mbedtls_mpi_init(&s_check);
+    memset(hash, 0, sizeof(hash));
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &d, d_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &r_check, r_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &s_check, s_str ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&d, d_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&r_check, r_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&s_check, s_str) == 0);
 
-    md_info = mbedtls_md_info_from_type( md_alg );
-    TEST_ASSERT( md_info != NULL );
-    hlen = mbedtls_md_get_size( md_info );
-    TEST_ASSERT( mbedtls_md( md_info, (const unsigned char *) msg,
-                 strlen( msg ), hash ) == 0 );
+    md_info = mbedtls_md_info_from_type(md_alg);
+    TEST_ASSERT(md_info != NULL);
+    hlen = mbedtls_md_get_size(md_info);
+    TEST_ASSERT(mbedtls_md(md_info, (const unsigned char *) msg,
+                           strlen(msg), hash) == 0);
 
     TEST_ASSERT(
-                mbedtls_ecdsa_sign_det_ext( &grp, &r, &s, &d, hash, hlen,
-                                            md_alg, mbedtls_test_rnd_std_rand,
-                                            NULL )
-                == 0 );
+        mbedtls_ecdsa_sign_det_ext(&grp, &r, &s, &d, hash, hlen,
+                                   md_alg, mbedtls_test_rnd_std_rand,
+                                   NULL)
+        == 0);
 
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &r, &r_check ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &s, &s_check ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&r, &r_check) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&s, &s_check) == 0);
 
 exit:
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_mpi_free( &d ); mbedtls_mpi_free( &r ); mbedtls_mpi_free( &s );
-    mbedtls_mpi_free( &r_check ); mbedtls_mpi_free( &s_check );
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_mpi_free(&d); mbedtls_mpi_free(&r); mbedtls_mpi_free(&s);
+    mbedtls_mpi_free(&r_check); mbedtls_mpi_free(&s_check);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA256_C */
-void ecdsa_write_read_zero( int id )
+void ecdsa_write_read_zero(int id)
 {
     mbedtls_ecdsa_context ctx;
     mbedtls_test_rnd_pseudo_info rnd_info;
@@ -451,59 +450,60 @@
     unsigned char sig[200];
     size_t sig_len, i;
 
-    mbedtls_ecdsa_init( &ctx );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
-    memset( hash, 0, sizeof( hash ) );
-    memset( sig, 0x2a, sizeof( sig ) );
+    mbedtls_ecdsa_init(&ctx);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
+    memset(hash, 0, sizeof(hash));
+    memset(sig, 0x2a, sizeof(sig));
 
     /* generate signing key */
-    TEST_ASSERT( mbedtls_ecdsa_genkey( &ctx, id,
-                                       &mbedtls_test_rnd_pseudo_rand,
-                                       &rnd_info ) == 0 );
+    TEST_ASSERT(mbedtls_ecdsa_genkey(&ctx, id,
+                                     &mbedtls_test_rnd_pseudo_rand,
+                                     &rnd_info) == 0);
 
     /* generate and write signature, then read and verify it */
-    TEST_ASSERT( mbedtls_ecdsa_write_signature( &ctx, MBEDTLS_MD_SHA256,
-                 hash, sizeof( hash ),
-                 sig, &sig_len, &mbedtls_test_rnd_pseudo_rand,
-                 &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecdsa_read_signature( &ctx, hash, sizeof( hash ),
-                 sig, sig_len ) == 0 );
+    TEST_ASSERT(mbedtls_ecdsa_write_signature(&ctx, MBEDTLS_MD_SHA256,
+                                              hash, sizeof(hash),
+                                              sig, &sig_len, &mbedtls_test_rnd_pseudo_rand,
+                                              &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecdsa_read_signature(&ctx, hash, sizeof(hash),
+                                             sig, sig_len) == 0);
 
     /* check we didn't write past the announced length */
-    for( i = sig_len; i < sizeof( sig ); i++ )
-        TEST_ASSERT( sig[i] == 0x2a );
+    for (i = sig_len; i < sizeof(sig); i++) {
+        TEST_ASSERT(sig[i] == 0x2a);
+    }
 
     /* try verification with invalid length */
-    TEST_ASSERT( mbedtls_ecdsa_read_signature( &ctx, hash, sizeof( hash ),
-                 sig, sig_len - 1 ) != 0 );
-    TEST_ASSERT( mbedtls_ecdsa_read_signature( &ctx, hash, sizeof( hash ),
-                 sig, sig_len + 1 ) != 0 );
+    TEST_ASSERT(mbedtls_ecdsa_read_signature(&ctx, hash, sizeof(hash),
+                                             sig, sig_len - 1) != 0);
+    TEST_ASSERT(mbedtls_ecdsa_read_signature(&ctx, hash, sizeof(hash),
+                                             sig, sig_len + 1) != 0);
 
     /* try invalid sequence tag */
     sig[0]++;
-    TEST_ASSERT( mbedtls_ecdsa_read_signature( &ctx, hash, sizeof( hash ),
-                 sig, sig_len ) != 0 );
+    TEST_ASSERT(mbedtls_ecdsa_read_signature(&ctx, hash, sizeof(hash),
+                                             sig, sig_len) != 0);
     sig[0]--;
 
     /* try modifying r */
     sig[10]++;
-    TEST_ASSERT( mbedtls_ecdsa_read_signature( &ctx, hash, sizeof( hash ),
-                 sig, sig_len ) == MBEDTLS_ERR_ECP_VERIFY_FAILED );
+    TEST_ASSERT(mbedtls_ecdsa_read_signature(&ctx, hash, sizeof(hash),
+                                             sig, sig_len) == MBEDTLS_ERR_ECP_VERIFY_FAILED);
     sig[10]--;
 
     /* try modifying s */
     sig[sig_len - 1]++;
-    TEST_ASSERT( mbedtls_ecdsa_read_signature( &ctx, hash, sizeof( hash ),
-                 sig, sig_len ) == MBEDTLS_ERR_ECP_VERIFY_FAILED );
+    TEST_ASSERT(mbedtls_ecdsa_read_signature(&ctx, hash, sizeof(hash),
+                                             sig, sig_len) == MBEDTLS_ERR_ECP_VERIFY_FAILED);
     sig[sig_len - 1]--;
 
 exit:
-    mbedtls_ecdsa_free( &ctx );
+    mbedtls_ecdsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA256_C */
-void ecdsa_write_read_random( int id )
+void ecdsa_write_read_random(int id)
 {
     mbedtls_ecdsa_context ctx;
     mbedtls_test_rnd_pseudo_info rnd_info;
@@ -511,127 +511,131 @@
     unsigned char sig[200];
     size_t sig_len, i;
 
-    mbedtls_ecdsa_init( &ctx );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
-    memset( hash, 0, sizeof( hash ) );
-    memset( sig, 0x2a, sizeof( sig ) );
+    mbedtls_ecdsa_init(&ctx);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
+    memset(hash, 0, sizeof(hash));
+    memset(sig, 0x2a, sizeof(sig));
 
     /* prepare material for signature */
-    TEST_ASSERT( mbedtls_test_rnd_pseudo_rand( &rnd_info,
-                                               hash, sizeof( hash ) ) == 0 );
+    TEST_ASSERT(mbedtls_test_rnd_pseudo_rand(&rnd_info,
+                                             hash, sizeof(hash)) == 0);
 
     /* generate signing key */
-    TEST_ASSERT( mbedtls_ecdsa_genkey( &ctx, id,
-                                       &mbedtls_test_rnd_pseudo_rand,
-                                       &rnd_info ) == 0 );
+    TEST_ASSERT(mbedtls_ecdsa_genkey(&ctx, id,
+                                     &mbedtls_test_rnd_pseudo_rand,
+                                     &rnd_info) == 0);
 
     /* generate and write signature, then read and verify it */
-    TEST_ASSERT( mbedtls_ecdsa_write_signature( &ctx, MBEDTLS_MD_SHA256,
-                 hash, sizeof( hash ),
-                 sig, &sig_len, &mbedtls_test_rnd_pseudo_rand,
-                 &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecdsa_read_signature( &ctx, hash, sizeof( hash ),
-                 sig, sig_len ) == 0 );
+    TEST_ASSERT(mbedtls_ecdsa_write_signature(&ctx, MBEDTLS_MD_SHA256,
+                                              hash, sizeof(hash),
+                                              sig, &sig_len, &mbedtls_test_rnd_pseudo_rand,
+                                              &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecdsa_read_signature(&ctx, hash, sizeof(hash),
+                                             sig, sig_len) == 0);
 
     /* check we didn't write past the announced length */
-    for( i = sig_len; i < sizeof( sig ); i++ )
-        TEST_ASSERT( sig[i] == 0x2a );
+    for (i = sig_len; i < sizeof(sig); i++) {
+        TEST_ASSERT(sig[i] == 0x2a);
+    }
 
     /* try verification with invalid length */
-    TEST_ASSERT( mbedtls_ecdsa_read_signature( &ctx, hash, sizeof( hash ),
-                 sig, sig_len - 1 ) != 0 );
-    TEST_ASSERT( mbedtls_ecdsa_read_signature( &ctx, hash, sizeof( hash ),
-                 sig, sig_len + 1 ) != 0 );
+    TEST_ASSERT(mbedtls_ecdsa_read_signature(&ctx, hash, sizeof(hash),
+                                             sig, sig_len - 1) != 0);
+    TEST_ASSERT(mbedtls_ecdsa_read_signature(&ctx, hash, sizeof(hash),
+                                             sig, sig_len + 1) != 0);
 
     /* try invalid sequence tag */
     sig[0]++;
-    TEST_ASSERT( mbedtls_ecdsa_read_signature( &ctx, hash, sizeof( hash ),
-                 sig, sig_len ) != 0 );
+    TEST_ASSERT(mbedtls_ecdsa_read_signature(&ctx, hash, sizeof(hash),
+                                             sig, sig_len) != 0);
     sig[0]--;
 
     /* try modifying r */
     sig[10]++;
-    TEST_ASSERT( mbedtls_ecdsa_read_signature( &ctx, hash, sizeof( hash ),
-                 sig, sig_len ) == MBEDTLS_ERR_ECP_VERIFY_FAILED );
+    TEST_ASSERT(mbedtls_ecdsa_read_signature(&ctx, hash, sizeof(hash),
+                                             sig, sig_len) == MBEDTLS_ERR_ECP_VERIFY_FAILED);
     sig[10]--;
 
     /* try modifying s */
     sig[sig_len - 1]++;
-    TEST_ASSERT( mbedtls_ecdsa_read_signature( &ctx, hash, sizeof( hash ),
-                 sig, sig_len ) == MBEDTLS_ERR_ECP_VERIFY_FAILED );
+    TEST_ASSERT(mbedtls_ecdsa_read_signature(&ctx, hash, sizeof(hash),
+                                             sig, sig_len) == MBEDTLS_ERR_ECP_VERIFY_FAILED);
     sig[sig_len - 1]--;
 
 exit:
-    mbedtls_ecdsa_free( &ctx );
+    mbedtls_ecdsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECP_RESTARTABLE */
-void ecdsa_read_restart( int id, data_t *pk, data_t *hash, data_t *sig,
-                         int max_ops, int min_restart, int max_restart )
+void ecdsa_read_restart(int id, data_t *pk, data_t *hash, data_t *sig,
+                        int max_ops, int min_restart, int max_restart)
 {
     mbedtls_ecdsa_context ctx;
     mbedtls_ecdsa_restart_ctx rs_ctx;
     int ret, cnt_restart;
 
-    mbedtls_ecdsa_init( &ctx );
-    mbedtls_ecdsa_restart_init( &rs_ctx );
+    mbedtls_ecdsa_init(&ctx);
+    mbedtls_ecdsa_restart_init(&rs_ctx);
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &ctx.grp, id ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_point_read_binary( &ctx.grp, &ctx.Q,
-                                                pk->x, pk->len ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&ctx.grp, id) == 0);
+    TEST_ASSERT(mbedtls_ecp_point_read_binary(&ctx.grp, &ctx.Q,
+                                              pk->x, pk->len) == 0);
 
-    mbedtls_ecp_set_max_ops( max_ops );
+    mbedtls_ecp_set_max_ops(max_ops);
 
     cnt_restart = 0;
     do {
-        ret = mbedtls_ecdsa_read_signature_restartable( &ctx,
-                            hash->x, hash->len, sig->x, sig->len, &rs_ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart );
+        ret = mbedtls_ecdsa_read_signature_restartable(&ctx,
+                                                       hash->x, hash->len, sig->x, sig->len,
+                                                       &rs_ctx);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart);
 
-    TEST_ASSERT( ret == 0 );
-    TEST_ASSERT( cnt_restart >= min_restart );
-    TEST_ASSERT( cnt_restart <= max_restart );
+    TEST_ASSERT(ret == 0);
+    TEST_ASSERT(cnt_restart >= min_restart);
+    TEST_ASSERT(cnt_restart <= max_restart);
 
     /* try modifying r */
 
-    TEST_ASSERT( sig->len > 10 );
+    TEST_ASSERT(sig->len > 10);
     sig->x[10]++;
     do {
-        ret = mbedtls_ecdsa_read_signature_restartable( &ctx,
-                            hash->x, hash->len, sig->x, sig->len, &rs_ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS );
-    TEST_ASSERT( ret == MBEDTLS_ERR_ECP_VERIFY_FAILED );
+        ret = mbedtls_ecdsa_read_signature_restartable(&ctx,
+                                                       hash->x, hash->len, sig->x, sig->len,
+                                                       &rs_ctx);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS);
+    TEST_ASSERT(ret == MBEDTLS_ERR_ECP_VERIFY_FAILED);
     sig->x[10]--;
 
     /* try modifying s */
     sig->x[sig->len - 1]++;
     do {
-        ret = mbedtls_ecdsa_read_signature_restartable( &ctx,
-                            hash->x, hash->len, sig->x, sig->len, &rs_ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS );
-    TEST_ASSERT( ret == MBEDTLS_ERR_ECP_VERIFY_FAILED );
+        ret = mbedtls_ecdsa_read_signature_restartable(&ctx,
+                                                       hash->x, hash->len, sig->x, sig->len,
+                                                       &rs_ctx);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS);
+    TEST_ASSERT(ret == MBEDTLS_ERR_ECP_VERIFY_FAILED);
     sig->x[sig->len - 1]--;
 
     /* Do we leak memory when aborting an operation?
      * This test only makes sense when we actually restart */
-    if( min_restart > 0 )
-    {
-        ret = mbedtls_ecdsa_read_signature_restartable( &ctx,
-                            hash->x, hash->len, sig->x, sig->len, &rs_ctx );
-        TEST_ASSERT( ret == MBEDTLS_ERR_ECP_IN_PROGRESS );
+    if (min_restart > 0) {
+        ret = mbedtls_ecdsa_read_signature_restartable(&ctx,
+                                                       hash->x, hash->len, sig->x, sig->len,
+                                                       &rs_ctx);
+        TEST_ASSERT(ret == MBEDTLS_ERR_ECP_IN_PROGRESS);
     }
 
 exit:
-    mbedtls_ecdsa_free( &ctx );
-    mbedtls_ecdsa_restart_free( &rs_ctx );
+    mbedtls_ecdsa_free(&ctx);
+    mbedtls_ecdsa_restart_free(&rs_ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECP_RESTARTABLE:MBEDTLS_ECDSA_DETERMINISTIC */
-void ecdsa_write_restart( int id, char *d_str, int md_alg,
-                          char *msg, data_t *sig_check,
-                          int max_ops, int min_restart, int max_restart )
+void ecdsa_write_restart(int id, char *d_str, int md_alg,
+                         char *msg, data_t *sig_check,
+                         int max_ops, int min_restart, int max_restart)
 {
     int ret, cnt_restart;
     mbedtls_ecdsa_restart_ctx rs_ctx;
@@ -641,86 +645,99 @@
     size_t hlen, slen;
     const mbedtls_md_info_t *md_info;
 
-    mbedtls_ecdsa_restart_init( &rs_ctx );
-    mbedtls_ecdsa_init( &ctx );
-    memset( hash, 0, sizeof( hash ) );
-    memset( sig, 0, sizeof( sig ) );
+    mbedtls_ecdsa_restart_init(&rs_ctx);
+    mbedtls_ecdsa_init(&ctx);
+    memset(hash, 0, sizeof(hash));
+    memset(sig, 0, sizeof(sig));
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &ctx.grp, id ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &ctx.d, d_str ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&ctx.grp, id) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&ctx.d, d_str) == 0);
 
-    md_info = mbedtls_md_info_from_type( md_alg );
-    TEST_ASSERT( md_info != NULL );
+    md_info = mbedtls_md_info_from_type(md_alg);
+    TEST_ASSERT(md_info != NULL);
 
-    hlen = mbedtls_md_get_size( md_info );
-    TEST_ASSERT( mbedtls_md( md_info,
-                             (const unsigned char *) msg, strlen( msg ),
-                             hash ) == 0 );
+    hlen = mbedtls_md_get_size(md_info);
+    TEST_ASSERT(mbedtls_md(md_info,
+                           (const unsigned char *) msg, strlen(msg),
+                           hash) == 0);
 
-    mbedtls_ecp_set_max_ops( max_ops );
+    mbedtls_ecp_set_max_ops(max_ops);
 
-    slen = sizeof( sig );
+    slen = sizeof(sig);
     cnt_restart = 0;
     do {
-        ret = mbedtls_ecdsa_write_signature_restartable( &ctx,
-                md_alg, hash, hlen, sig, &slen, NULL, NULL, &rs_ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart );
+        ret = mbedtls_ecdsa_write_signature_restartable(&ctx,
+                                                        md_alg,
+                                                        hash,
+                                                        hlen,
+                                                        sig,
+                                                        &slen,
+                                                        NULL,
+                                                        NULL,
+                                                        &rs_ctx);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart);
 
-    TEST_ASSERT( ret == 0 );
-    TEST_ASSERT( slen == sig_check->len );
-    TEST_ASSERT( memcmp( sig, sig_check->x, slen ) == 0 );
+    TEST_ASSERT(ret == 0);
+    TEST_ASSERT(slen == sig_check->len);
+    TEST_ASSERT(memcmp(sig, sig_check->x, slen) == 0);
 
-    TEST_ASSERT( cnt_restart >= min_restart );
-    TEST_ASSERT( cnt_restart <= max_restart );
+    TEST_ASSERT(cnt_restart >= min_restart);
+    TEST_ASSERT(cnt_restart <= max_restart);
 
     /* Do we leak memory when aborting an operation?
      * This test only makes sense when we actually restart */
-    if( min_restart > 0 )
-    {
-        ret = mbedtls_ecdsa_write_signature_restartable( &ctx,
-                md_alg, hash, hlen, sig, &slen, NULL, NULL, &rs_ctx );
-        TEST_ASSERT( ret == MBEDTLS_ERR_ECP_IN_PROGRESS );
+    if (min_restart > 0) {
+        ret = mbedtls_ecdsa_write_signature_restartable(&ctx,
+                                                        md_alg,
+                                                        hash,
+                                                        hlen,
+                                                        sig,
+                                                        &slen,
+                                                        NULL,
+                                                        NULL,
+                                                        &rs_ctx);
+        TEST_ASSERT(ret == MBEDTLS_ERR_ECP_IN_PROGRESS);
     }
 
 exit:
-    mbedtls_ecdsa_restart_free( &rs_ctx );
-    mbedtls_ecdsa_free( &ctx );
+    mbedtls_ecdsa_restart_free(&rs_ctx);
+    mbedtls_ecdsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecdsa_verify( int grp_id, char * x, char * y, char * r, char * s, data_t * content, int expected )
+void ecdsa_verify(int grp_id, char *x, char *y, char *r, char *s, data_t *content, int expected)
 {
     mbedtls_ecdsa_context ctx;
     mbedtls_mpi sig_r, sig_s;
 
-    mbedtls_ecdsa_init( &ctx );
-    mbedtls_mpi_init( &sig_r );
-    mbedtls_mpi_init( &sig_s );
+    mbedtls_ecdsa_init(&ctx);
+    mbedtls_mpi_init(&sig_r);
+    mbedtls_mpi_init(&sig_s);
 
     /* Prepare ECP group context */
-    TEST_EQUAL( mbedtls_ecp_group_load( &ctx.grp, grp_id ), 0 );
+    TEST_EQUAL(mbedtls_ecp_group_load(&ctx.grp, grp_id), 0);
 
     /* Prepare public key */
-    TEST_EQUAL( mbedtls_test_read_mpi( &ctx.Q.X, x ), 0 );
-    TEST_EQUAL( mbedtls_test_read_mpi( &ctx.Q.Y, y ), 0 );
-    TEST_EQUAL( mbedtls_mpi_lset( &ctx.Q.Z, 1 ), 0 );
+    TEST_EQUAL(mbedtls_test_read_mpi(&ctx.Q.X, x), 0);
+    TEST_EQUAL(mbedtls_test_read_mpi(&ctx.Q.Y, y), 0);
+    TEST_EQUAL(mbedtls_mpi_lset(&ctx.Q.Z, 1), 0);
 
     /* Prepare signature R & S */
-    TEST_EQUAL( mbedtls_test_read_mpi( &sig_r, r ), 0 );
-    TEST_EQUAL( mbedtls_test_read_mpi( &sig_s, s ), 0 );
+    TEST_EQUAL(mbedtls_test_read_mpi(&sig_r, r), 0);
+    TEST_EQUAL(mbedtls_test_read_mpi(&sig_s, s), 0);
 
     /* Test whether public key has expected validity */
-    TEST_EQUAL( mbedtls_ecp_check_pubkey( &ctx.grp, &ctx.Q ),
-        expected == MBEDTLS_ERR_ECP_INVALID_KEY ? MBEDTLS_ERR_ECP_INVALID_KEY : 0 );
+    TEST_EQUAL(mbedtls_ecp_check_pubkey(&ctx.grp, &ctx.Q),
+               expected == MBEDTLS_ERR_ECP_INVALID_KEY ? MBEDTLS_ERR_ECP_INVALID_KEY : 0);
 
     /* Verification */
-    int result = mbedtls_ecdsa_verify( &ctx.grp, content->x, content->len, &ctx.Q, &sig_r, &sig_s );
+    int result = mbedtls_ecdsa_verify(&ctx.grp, content->x, content->len, &ctx.Q, &sig_r, &sig_s);
 
-    TEST_EQUAL( result, expected );
+    TEST_EQUAL(result, expected);
 exit:
-    mbedtls_ecdsa_free( &ctx );
-    mbedtls_mpi_free( &sig_r );
-    mbedtls_mpi_free( &sig_s );
+    mbedtls_ecdsa_free(&ctx);
+    mbedtls_mpi_free(&sig_r);
+    mbedtls_mpi_free(&sig_s);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_ecjpake.function b/tests/suites/test_suite_ecjpake.function
index 2246f2d..16f52b2 100644
--- a/tests/suites/test_suite_ecjpake.function
+++ b/tests/suites/test_suite_ecjpake.function
@@ -63,33 +63,33 @@
 };
 
 /* Load my private and public keys, and peer's public keys */
-static int ecjpake_test_load( mbedtls_ecjpake_context *ctx,
-                              const unsigned char *xm1, size_t len_xm1,
-                              const unsigned char *xm2, size_t len_xm2,
-                              const unsigned char *Xm1, size_t len_Xm1,
-                              const unsigned char *Xm2, size_t len_Xm2,
-                              const unsigned char *Xp1, size_t len_Xp1,
-                              const unsigned char *Xp2, size_t len_Xp2 )
+static int ecjpake_test_load(mbedtls_ecjpake_context *ctx,
+                             const unsigned char *xm1, size_t len_xm1,
+                             const unsigned char *xm2, size_t len_xm2,
+                             const unsigned char *Xm1, size_t len_Xm1,
+                             const unsigned char *Xm2, size_t len_Xm2,
+                             const unsigned char *Xp1, size_t len_Xp1,
+                             const unsigned char *Xp2, size_t len_Xp2)
 {
     int ret;
 
-    MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary( &ctx->xm1, xm1, len_xm1 ) );
-    MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary( &ctx->xm2, xm2, len_xm2 ) );
+    MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->xm1, xm1, len_xm1));
+    MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&ctx->xm2, xm2, len_xm2));
 
-    MBEDTLS_MPI_CHK( mbedtls_ecp_point_read_binary( &ctx->grp,
-                     &ctx->Xm1, Xm1, len_Xm1 ) );
-    MBEDTLS_MPI_CHK( mbedtls_ecp_point_read_binary( &ctx->grp,
-                     &ctx->Xm2, Xm2, len_Xm2 ) );
-    MBEDTLS_MPI_CHK( mbedtls_ecp_point_read_binary( &ctx->grp,
-                     &ctx->Xp1, Xp1, len_Xp1 ) );
-    MBEDTLS_MPI_CHK( mbedtls_ecp_point_read_binary( &ctx->grp,
-                     &ctx->Xp2, Xp2, len_Xp2 ) );
+    MBEDTLS_MPI_CHK(mbedtls_ecp_point_read_binary(&ctx->grp,
+                                                  &ctx->Xm1, Xm1, len_Xm1));
+    MBEDTLS_MPI_CHK(mbedtls_ecp_point_read_binary(&ctx->grp,
+                                                  &ctx->Xm2, Xm2, len_Xm2));
+    MBEDTLS_MPI_CHK(mbedtls_ecp_point_read_binary(&ctx->grp,
+                                                  &ctx->Xp1, Xp1, len_Xp1));
+    MBEDTLS_MPI_CHK(mbedtls_ecp_point_read_binary(&ctx->grp,
+                                                  &ctx->Xp2, Xp2, len_Xp2));
 
 cleanup:
-    return( ret );
+    return ret;
 }
 
-#define ADD_SIZE( x )   x, sizeof( x )
+#define ADD_SIZE(x)   x, sizeof(x)
 #endif /* MBEDTLS_ECP_DP_SECP256R1_ENABLED && MBEDTLS_SHA256_C */
 /* END_HEADER */
 
@@ -99,101 +99,101 @@
  */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void ecjpake_invalid_param( )
+void ecjpake_invalid_param()
 {
     mbedtls_ecjpake_context ctx;
     unsigned char buf[42] = { 0 };
     size_t olen;
-    size_t const len = sizeof( buf );
+    size_t const len = sizeof(buf);
     mbedtls_ecjpake_role valid_role = MBEDTLS_ECJPAKE_SERVER;
     mbedtls_ecjpake_role invalid_role = (mbedtls_ecjpake_role) 42;
     mbedtls_md_type_t valid_md = MBEDTLS_MD_SHA256;
     mbedtls_ecp_group_id valid_group = MBEDTLS_ECP_DP_SECP256R1;
 
-    mbedtls_ecjpake_init( &ctx );
+    mbedtls_ecjpake_init(&ctx);
 
-    TEST_INVALID_PARAM( mbedtls_ecjpake_init( NULL ) );
-    TEST_VALID_PARAM( mbedtls_ecjpake_free( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_ecjpake_init(NULL));
+    TEST_VALID_PARAM(mbedtls_ecjpake_free(NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecjpake_setup( NULL,
-                                                   valid_role,
-                                                   valid_md,
-                                                   valid_group,
-                                                   buf, len ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecjpake_setup( &ctx,
-                                                   invalid_role,
-                                                   valid_md,
-                                                   valid_group,
-                                                   buf, len ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecjpake_setup( &ctx,
-                                                   valid_role,
-                                                   valid_md,
-                                                   valid_group,
-                                                   NULL, len ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_setup(NULL,
+                                                 valid_role,
+                                                 valid_md,
+                                                 valid_group,
+                                                 buf, len));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_setup(&ctx,
+                                                 invalid_role,
+                                                 valid_md,
+                                                 valid_group,
+                                                 buf, len));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_setup(&ctx,
+                                                 valid_role,
+                                                 valid_md,
+                                                 valid_group,
+                                                 NULL, len));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecjpake_check( NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_check(NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecjpake_write_round_one( NULL, buf, len, &olen,
-                                         mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_write_round_one(NULL, buf, len, &olen,
+                                                           mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecjpake_write_round_one( &ctx, NULL, len, &olen,
-                                         mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_write_round_one(&ctx, NULL, len, &olen,
+                                                           mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecjpake_write_round_one( &ctx, buf, len, NULL,
-                                         mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_write_round_one(&ctx, buf, len, NULL,
+                                                           mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecjpake_write_round_one( &ctx, buf, len, &olen, NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_write_round_one(&ctx, buf, len, &olen, NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecjpake_write_round_two( NULL, buf, len, &olen,
-                                         mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_write_round_two(NULL, buf, len, &olen,
+                                                           mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecjpake_write_round_two( &ctx, NULL, len, &olen,
-                                         mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_write_round_two(&ctx, NULL, len, &olen,
+                                                           mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecjpake_write_round_two( &ctx, buf, len, NULL,
-                                         mbedtls_test_rnd_std_rand, NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecjpake_write_round_two( &ctx, buf, len, &olen, NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_write_round_two(&ctx, buf, len, NULL,
+                                                           mbedtls_test_rnd_std_rand, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_write_round_two(&ctx, buf, len, &olen, NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecjpake_read_round_one( NULL,
-                                                            buf, len ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecjpake_read_round_one( &ctx,
-                                                            NULL, len ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_read_round_one(NULL,
+                                                          buf, len));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_read_round_one(&ctx,
+                                                          NULL, len));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecjpake_read_round_two( NULL,
-                                                            buf, len ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecjpake_read_round_two( &ctx,
-                                                            NULL, len ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_read_round_two(NULL,
+                                                          buf, len));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_read_round_two(&ctx,
+                                                          NULL, len));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecjpake_derive_secret( NULL, buf, len, &olen,
-                                       mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_derive_secret(NULL, buf, len, &olen,
+                                                         mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecjpake_derive_secret( &ctx, NULL, len, &olen,
-                                       mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_derive_secret(&ctx, NULL, len, &olen,
+                                                         mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecjpake_derive_secret( &ctx, buf, len, NULL,
-                                       mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_derive_secret(&ctx, buf, len, NULL,
+                                                         mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecjpake_derive_secret( &ctx, buf, len, &olen, NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecjpake_derive_secret(&ctx, buf, len, &olen, NULL, NULL));
 
 exit:
     return;
@@ -201,98 +201,102 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void ecjpake_selftest(  )
+void ecjpake_selftest()
 {
-    TEST_ASSERT( mbedtls_ecjpake_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_ecjpake_self_test(1) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C */
-void read_bad_md( data_t *msg )
+void read_bad_md(data_t *msg)
 {
     mbedtls_ecjpake_context corrupt_ctx;
-    const unsigned char * pw = NULL;
+    const unsigned char *pw = NULL;
     const size_t pw_len = 0;
     int any_role = MBEDTLS_ECJPAKE_CLIENT;
 
-    mbedtls_ecjpake_init( &corrupt_ctx );
-    TEST_ASSERT( mbedtls_ecjpake_setup( &corrupt_ctx, any_role,
-                 MBEDTLS_MD_SHA256, MBEDTLS_ECP_DP_SECP256R1, pw, pw_len ) == 0 );
+    mbedtls_ecjpake_init(&corrupt_ctx);
+    TEST_ASSERT(mbedtls_ecjpake_setup(&corrupt_ctx, any_role,
+                                      MBEDTLS_MD_SHA256, MBEDTLS_ECP_DP_SECP256R1, pw,
+                                      pw_len) == 0);
     corrupt_ctx.md_info = NULL;
 
-    TEST_ASSERT( mbedtls_ecjpake_read_round_one( &corrupt_ctx, msg->x,
-                 msg->len ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_ecjpake_read_round_one(&corrupt_ctx, msg->x,
+                                               msg->len) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
 
 exit:
-    mbedtls_ecjpake_free( &corrupt_ctx );
+    mbedtls_ecjpake_free(&corrupt_ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C */
-void read_round_one( int role, data_t * msg, int ref_ret )
+void read_round_one(int role, data_t *msg, int ref_ret)
 {
     mbedtls_ecjpake_context ctx;
-    const unsigned char * pw = NULL;
+    const unsigned char *pw = NULL;
     const size_t pw_len = 0;
 
-    mbedtls_ecjpake_init( &ctx );
+    mbedtls_ecjpake_init(&ctx);
 
-    TEST_ASSERT( mbedtls_ecjpake_setup( &ctx, role,
-                 MBEDTLS_MD_SHA256, MBEDTLS_ECP_DP_SECP256R1, pw, pw_len ) == 0 );
+    TEST_ASSERT(mbedtls_ecjpake_setup(&ctx, role,
+                                      MBEDTLS_MD_SHA256, MBEDTLS_ECP_DP_SECP256R1, pw,
+                                      pw_len) == 0);
 
-    TEST_ASSERT( mbedtls_ecjpake_read_round_one( &ctx, msg->x, msg->len ) == ref_ret );
+    TEST_ASSERT(mbedtls_ecjpake_read_round_one(&ctx, msg->x, msg->len) == ref_ret);
 
 exit:
-    mbedtls_ecjpake_free( &ctx );
+    mbedtls_ecjpake_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C */
-void read_round_two_cli( data_t * msg, int ref_ret )
+void read_round_two_cli(data_t *msg, int ref_ret)
 {
     mbedtls_ecjpake_context ctx;
-    const unsigned char * pw = NULL;
+    const unsigned char *pw = NULL;
     const size_t pw_len = 0;
 
-    mbedtls_ecjpake_init( &ctx );
+    mbedtls_ecjpake_init(&ctx);
 
-    TEST_ASSERT( mbedtls_ecjpake_setup( &ctx, MBEDTLS_ECJPAKE_CLIENT,
-                 MBEDTLS_MD_SHA256, MBEDTLS_ECP_DP_SECP256R1, pw, pw_len ) == 0 );
+    TEST_ASSERT(mbedtls_ecjpake_setup(&ctx, MBEDTLS_ECJPAKE_CLIENT,
+                                      MBEDTLS_MD_SHA256, MBEDTLS_ECP_DP_SECP256R1, pw,
+                                      pw_len) == 0);
 
-    TEST_ASSERT( ecjpake_test_load( &ctx,
-                 ADD_SIZE( ecjpake_test_x1 ), ADD_SIZE( ecjpake_test_x2 ),
-                 ADD_SIZE( ecjpake_test_X1 ), ADD_SIZE( ecjpake_test_X2 ),
-                 ADD_SIZE( ecjpake_test_X3 ), ADD_SIZE( ecjpake_test_X4 ) )
-            == 0 );
+    TEST_ASSERT(ecjpake_test_load(&ctx,
+                                  ADD_SIZE(ecjpake_test_x1), ADD_SIZE(ecjpake_test_x2),
+                                  ADD_SIZE(ecjpake_test_X1), ADD_SIZE(ecjpake_test_X2),
+                                  ADD_SIZE(ecjpake_test_X3), ADD_SIZE(ecjpake_test_X4))
+                == 0);
 
-    TEST_ASSERT( mbedtls_ecjpake_read_round_two( &ctx, msg->x, msg->len ) == ref_ret );
+    TEST_ASSERT(mbedtls_ecjpake_read_round_two(&ctx, msg->x, msg->len) == ref_ret);
 
 exit:
-    mbedtls_ecjpake_free( &ctx );
+    mbedtls_ecjpake_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C */
-void read_round_two_srv( data_t * msg, int ref_ret )
+void read_round_two_srv(data_t *msg, int ref_ret)
 {
     mbedtls_ecjpake_context ctx;
-    const unsigned char * pw = NULL;
+    const unsigned char *pw = NULL;
     const size_t pw_len = 0;
 
-    mbedtls_ecjpake_init( &ctx );
+    mbedtls_ecjpake_init(&ctx);
 
-    TEST_ASSERT( mbedtls_ecjpake_setup( &ctx, MBEDTLS_ECJPAKE_SERVER,
-                 MBEDTLS_MD_SHA256, MBEDTLS_ECP_DP_SECP256R1, pw, pw_len ) == 0 );
+    TEST_ASSERT(mbedtls_ecjpake_setup(&ctx, MBEDTLS_ECJPAKE_SERVER,
+                                      MBEDTLS_MD_SHA256, MBEDTLS_ECP_DP_SECP256R1, pw,
+                                      pw_len) == 0);
 
-    TEST_ASSERT( ecjpake_test_load( &ctx,
-                 ADD_SIZE( ecjpake_test_x3 ), ADD_SIZE( ecjpake_test_x4 ),
-                 ADD_SIZE( ecjpake_test_X3 ), ADD_SIZE( ecjpake_test_X4 ),
-                 ADD_SIZE( ecjpake_test_X1 ), ADD_SIZE( ecjpake_test_X2 ) )
-            == 0 );
+    TEST_ASSERT(ecjpake_test_load(&ctx,
+                                  ADD_SIZE(ecjpake_test_x3), ADD_SIZE(ecjpake_test_x4),
+                                  ADD_SIZE(ecjpake_test_X3), ADD_SIZE(ecjpake_test_X4),
+                                  ADD_SIZE(ecjpake_test_X1), ADD_SIZE(ecjpake_test_X2))
+                == 0);
 
-    TEST_ASSERT( mbedtls_ecjpake_read_round_two( &ctx, msg->x, msg->len ) == ref_ret );
+    TEST_ASSERT(mbedtls_ecjpake_read_round_two(&ctx, msg->x, msg->len) == ref_ret);
 
 exit:
-    mbedtls_ecjpake_free( &ctx );
+    mbedtls_ecjpake_free(&ctx);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_ecp.function b/tests/suites/test_suite_ecp.function
index 0bce782..6110a78 100644
--- a/tests/suites/test_suite_ecp.function
+++ b/tests/suites/test_suite_ecp.function
@@ -6,52 +6,67 @@
 #include "ecp_invasive.h"
 
 #if defined(MBEDTLS_TEST_HOOKS) &&                  \
-    ( defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) ||  \
-      defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) ||  \
-      defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) )
+    (defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) ||  \
+    defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) ||  \
+    defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED))
 #define HAVE_FIX_NEGATIVE
 #endif
 
 #define ECP_PF_UNKNOWN     -1
 
-#define ECP_PT_RESET( x )           \
-    mbedtls_ecp_point_free( x );    \
-    mbedtls_ecp_point_init( x );
+#define ECP_PT_RESET(x)           \
+    mbedtls_ecp_point_free(x);    \
+    mbedtls_ecp_point_init(x);
 
 /* Auxiliary function to compare two mbedtls_ecp_group objects. */
-inline static int mbedtls_ecp_group_cmp( mbedtls_ecp_group *grp1,
-                                         mbedtls_ecp_group *grp2 )
+inline static int mbedtls_ecp_group_cmp(mbedtls_ecp_group *grp1,
+                                        mbedtls_ecp_group *grp2)
 {
-    if( mbedtls_mpi_cmp_mpi( &grp1->P, &grp2->P ) != 0 )
+    if (mbedtls_mpi_cmp_mpi(&grp1->P, &grp2->P) != 0) {
         return 1;
-    if( mbedtls_mpi_cmp_mpi( &grp1->A, &grp2->A ) != 0 )
+    }
+    if (mbedtls_mpi_cmp_mpi(&grp1->A, &grp2->A) != 0) {
         return 1;
-    if( mbedtls_mpi_cmp_mpi( &grp1->B, &grp2->B ) != 0 )
+    }
+    if (mbedtls_mpi_cmp_mpi(&grp1->B, &grp2->B) != 0) {
         return 1;
-    if( mbedtls_mpi_cmp_mpi( &grp1->N, &grp2->N ) != 0 )
+    }
+    if (mbedtls_mpi_cmp_mpi(&grp1->N, &grp2->N) != 0) {
         return 1;
-    if( mbedtls_ecp_point_cmp( &grp1->G, &grp2->G ) != 0 )
+    }
+    if (mbedtls_ecp_point_cmp(&grp1->G, &grp2->G) != 0) {
         return 1;
-    if( grp1->id != grp2->id )
+    }
+    if (grp1->id != grp2->id) {
         return 1;
-    if( grp1->pbits != grp2->pbits )
+    }
+    if (grp1->pbits != grp2->pbits) {
         return 1;
-    if( grp1->nbits != grp2->nbits )
+    }
+    if (grp1->nbits != grp2->nbits) {
         return 1;
-    if( grp1->h != grp2->h )
+    }
+    if (grp1->h != grp2->h) {
         return 1;
-    if( grp1->modp != grp2->modp )
+    }
+    if (grp1->modp != grp2->modp) {
         return 1;
-    if( grp1->t_pre != grp2->t_pre )
+    }
+    if (grp1->t_pre != grp2->t_pre) {
         return 1;
-    if( grp1->t_post != grp2->t_post )
+    }
+    if (grp1->t_post != grp2->t_post) {
         return 1;
-    if( grp1->t_data != grp2->t_data )
+    }
+    if (grp1->t_data != grp2->t_data) {
         return 1;
-    if( grp1->T_size != grp2->T_size )
+    }
+    if (grp1->T_size != grp2->T_size) {
         return 1;
-    if( grp1->T != grp2->T )
+    }
+    if (grp1->T != grp2->T) {
         return 1;
+    }
 
     return 0;
 }
@@ -64,14 +79,14 @@
  */
 
 /* BEGIN_CASE */
-void ecp_valid_param( )
+void ecp_valid_param()
 {
-    TEST_VALID_PARAM( mbedtls_ecp_group_free( NULL ) );
-    TEST_VALID_PARAM( mbedtls_ecp_keypair_free( NULL ) );
-    TEST_VALID_PARAM( mbedtls_ecp_point_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_ecp_group_free(NULL));
+    TEST_VALID_PARAM(mbedtls_ecp_keypair_free(NULL));
+    TEST_VALID_PARAM(mbedtls_ecp_point_free(NULL));
 
 #if defined(MBEDTLS_ECP_RESTARTABLE)
-    TEST_VALID_PARAM( mbedtls_ecp_restart_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_ecp_restart_free(NULL));
 #endif /* MBEDTLS_ECP_RESTARTABLE */
 
 exit:
@@ -80,7 +95,7 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void ecp_invalid_param( )
+void ecp_invalid_param()
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_keypair kp;
@@ -97,316 +112,316 @@
     mbedtls_ecp_restart_ctx restart_ctx;
 #endif /* MBEDTLS_ECP_RESTARTABLE */
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_point_init( &P );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_point_init(&P);
 
-    TEST_INVALID_PARAM( mbedtls_ecp_point_init( NULL ) );
-    TEST_INVALID_PARAM( mbedtls_ecp_keypair_init( NULL ) );
-    TEST_INVALID_PARAM( mbedtls_ecp_group_init( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_ecp_point_init(NULL));
+    TEST_INVALID_PARAM(mbedtls_ecp_keypair_init(NULL));
+    TEST_INVALID_PARAM(mbedtls_ecp_group_init(NULL));
 
 #if defined(MBEDTLS_ECP_RESTARTABLE)
-    TEST_INVALID_PARAM( mbedtls_ecp_restart_init( NULL ) );
-    TEST_INVALID_PARAM( mbedtls_ecp_check_budget( NULL, &restart_ctx, 42 ) );
+    TEST_INVALID_PARAM(mbedtls_ecp_restart_init(NULL));
+    TEST_INVALID_PARAM(mbedtls_ecp_check_budget(NULL, &restart_ctx, 42));
 #endif /* MBEDTLS_ECP_RESTARTABLE */
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_copy( NULL, &P ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_copy( &P, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_copy(NULL, &P));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_copy(&P, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_group_copy( NULL, &grp ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_group_copy( &grp, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_group_copy(NULL, &grp));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_group_copy(&grp, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_gen_privkey( NULL,
-                                                     &m,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_gen_privkey( &grp,
-                                                     NULL,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_gen_privkey( &grp,
-                                                     &m,
-                                                     NULL,
-                                                     NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_gen_privkey(NULL,
+                                                   &m,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_gen_privkey(&grp,
+                                                   NULL,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_gen_privkey(&grp,
+                                                   &m,
+                                                   NULL,
+                                                   NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_set_zero( NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_is_zero( NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_set_zero(NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_is_zero(NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_point_cmp( NULL, &P ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_point_cmp( &P, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_point_cmp(NULL, &P));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_point_cmp(&P, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_point_read_string( NULL, 2,
-                                                           x, x ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_point_read_string( &P, 2,
-                                                           NULL, x ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_point_read_string( &P, 2,
-                                                           x, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_point_read_string(NULL, 2,
+                                                         x, x));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_point_read_string(&P, 2,
+                                                         NULL, x));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_point_read_string(&P, 2,
+                                                         x, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_point_write_binary( NULL, &P,
-                                                      valid_fmt,
-                                                      &olen,
-                                                      buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_point_write_binary( &grp, NULL,
-                                                      valid_fmt,
-                                                      &olen,
-                                                      buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_point_write_binary( &grp, &P,
-                                                      invalid_fmt,
-                                                      &olen,
-                                                      buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_point_write_binary( &grp, &P,
-                                                      valid_fmt,
-                                                      NULL,
-                                                      buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_point_write_binary( &grp, &P,
-                                                      valid_fmt,
-                                                      &olen,
-                                                      NULL, sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_point_write_binary(NULL, &P,
+                                                          valid_fmt,
+                                                          &olen,
+                                                          buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_point_write_binary(&grp, NULL,
+                                                          valid_fmt,
+                                                          &olen,
+                                                          buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_point_write_binary(&grp, &P,
+                                                          invalid_fmt,
+                                                          &olen,
+                                                          buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_point_write_binary(&grp, &P,
+                                                          valid_fmt,
+                                                          NULL,
+                                                          buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_point_write_binary(&grp, &P,
+                                                          valid_fmt,
+                                                          &olen,
+                                                          NULL, sizeof(buf)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_point_read_binary( NULL, &P, buf,
-                                                     sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_point_read_binary( &grp, NULL, buf,
-                                                     sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_point_read_binary( &grp, &P, NULL,
-                                                     sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_point_read_binary(NULL, &P, buf,
+                                                         sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_point_read_binary(&grp, NULL, buf,
+                                                         sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_point_read_binary(&grp, &P, NULL,
+                                                         sizeof(buf)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_read_point( NULL, &P,
-                                                 (const unsigned char **) &buf,
-                                                 sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_read_point( &grp, NULL,
-                                                 (const unsigned char **) &buf,
-                                                 sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_read_point( &grp, &P, &null_buf,
-                                                        sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_read_point( &grp, &P, NULL,
-                                                    sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_read_point(NULL, &P,
+                                                      (const unsigned char **) &buf,
+                                                      sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_read_point(&grp, NULL,
+                                                      (const unsigned char **) &buf,
+                                                      sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_read_point(&grp, &P, &null_buf,
+                                                      sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_read_point(&grp, &P, NULL,
+                                                      sizeof(buf)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_write_point( NULL, &P,
-                                                     valid_fmt,
-                                                     &olen,
-                                                     buf,
-                                                     sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_write_point( &grp, NULL,
-                                                     valid_fmt,
-                                                     &olen,
-                                                     buf,
-                                                     sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_write_point( &grp, &P,
-                                                     invalid_fmt,
-                                                     &olen,
-                                                     buf,
-                                                     sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_write_point( &grp, &P,
-                                                     valid_fmt,
-                                                     NULL,
-                                                     buf,
-                                                     sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_write_point( &grp, &P,
-                                                     valid_fmt,
-                                                     &olen,
-                                                     NULL,
-                                                     sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_write_point(NULL, &P,
+                                                       valid_fmt,
+                                                       &olen,
+                                                       buf,
+                                                       sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_write_point(&grp, NULL,
+                                                       valid_fmt,
+                                                       &olen,
+                                                       buf,
+                                                       sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_write_point(&grp, &P,
+                                                       invalid_fmt,
+                                                       &olen,
+                                                       buf,
+                                                       sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_write_point(&grp, &P,
+                                                       valid_fmt,
+                                                       NULL,
+                                                       buf,
+                                                       sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_write_point(&grp, &P,
+                                                       valid_fmt,
+                                                       &olen,
+                                                       NULL,
+                                                       sizeof(buf)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_group_load( NULL, valid_group ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_group_load(NULL, valid_group));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_read_group( NULL,
-                                                 (const unsigned char **) &buf,
-                                                 sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_read_group( &grp, NULL,
-                                                        sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_read_group( &grp, &null_buf,
-                                                        sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_read_group(NULL,
+                                                      (const unsigned char **) &buf,
+                                                      sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_read_group(&grp, NULL,
+                                                      sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_read_group(&grp, &null_buf,
+                                                      sizeof(buf)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_read_group_id( NULL,
-                                                 (const unsigned char **) &buf,
-                                                 sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_read_group_id( &valid_group, NULL,
-                                                        sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_read_group_id( &valid_group,
-                                                           &null_buf,
-                                                           sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_read_group_id(NULL,
+                                                         (const unsigned char **) &buf,
+                                                         sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_read_group_id(&valid_group, NULL,
+                                                         sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_read_group_id(&valid_group,
+                                                         &null_buf,
+                                                         sizeof(buf)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_write_group( NULL, &olen,
-                                                       buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_write_group( &grp, NULL,
-                                                       buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_write_group( &grp, &olen,
-                                                       NULL, sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_write_group(NULL, &olen,
+                                                       buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_write_group(&grp, NULL,
+                                                       buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_tls_write_group(&grp, &olen,
+                                                       NULL, sizeof(buf)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_mul( NULL, &P, &m, &P,
-                                             mbedtls_test_rnd_std_rand,
-                                             NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_mul( &grp, NULL, &m, &P,
-                                             mbedtls_test_rnd_std_rand,
-                                             NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_mul( &grp, &P, NULL, &P,
-                                             mbedtls_test_rnd_std_rand,
-                                             NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_mul( &grp, &P, &m, NULL,
-                                             mbedtls_test_rnd_std_rand,
-                                             NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_mul(NULL, &P, &m, &P,
+                                           mbedtls_test_rnd_std_rand,
+                                           NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_mul(&grp, NULL, &m, &P,
+                                           mbedtls_test_rnd_std_rand,
+                                           NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_mul(&grp, &P, NULL, &P,
+                                           mbedtls_test_rnd_std_rand,
+                                           NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_mul(&grp, &P, &m, NULL,
+                                           mbedtls_test_rnd_std_rand,
+                                           NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_mul_restartable( NULL, &P, &m, &P,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL , NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_mul_restartable( &grp, NULL, &m, &P,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL , NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_mul_restartable( &grp, &P, NULL, &P,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL , NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_mul_restartable( &grp, &P, &m, NULL,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL , NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_mul_restartable(NULL, &P, &m, &P,
+                                                       mbedtls_test_rnd_std_rand,
+                                                       NULL, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_mul_restartable(&grp, NULL, &m, &P,
+                                                       mbedtls_test_rnd_std_rand,
+                                                       NULL, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_mul_restartable(&grp, &P, NULL, &P,
+                                                       mbedtls_test_rnd_std_rand,
+                                                       NULL, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_mul_restartable(&grp, &P, &m, NULL,
+                                                       mbedtls_test_rnd_std_rand,
+                                                       NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_muladd( NULL, &P, &m, &P,
-                                                &m, &P ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_muladd( &grp, NULL, &m, &P,
-                                                &m, &P ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_muladd( &grp, &P, NULL, &P,
-                                                &m, &P ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_muladd( &grp, &P, &m, NULL,
-                                                &m, &P ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_muladd( &grp, &P, &m, &P,
-                                                NULL, &P ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_muladd( &grp, &P, &m, &P,
-                                                &m, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_muladd(NULL, &P, &m, &P,
+                                              &m, &P));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_muladd(&grp, NULL, &m, &P,
+                                              &m, &P));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_muladd(&grp, &P, NULL, &P,
+                                              &m, &P));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_muladd(&grp, &P, &m, NULL,
+                                              &m, &P));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_muladd(&grp, &P, &m, &P,
+                                              NULL, &P));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_muladd(&grp, &P, &m, &P,
+                                              &m, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_muladd_restartable( NULL, &P, &m, &P,
-                                                            &m, &P, NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_muladd_restartable( &grp, NULL, &m, &P,
-                                                            &m, &P, NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_muladd_restartable( &grp, &P, NULL, &P,
-                                                            &m, &P, NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_muladd_restartable( &grp, &P, &m, NULL,
-                                                            &m, &P, NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_muladd_restartable( &grp, &P, &m, &P,
-                                                            NULL, &P, NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_muladd_restartable( &grp, &P, &m, &P,
-                                                            &m, NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_muladd_restartable(NULL, &P, &m, &P,
+                                                          &m, &P, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_muladd_restartable(&grp, NULL, &m, &P,
+                                                          &m, &P, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_muladd_restartable(&grp, &P, NULL, &P,
+                                                          &m, &P, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_muladd_restartable(&grp, &P, &m, NULL,
+                                                          &m, &P, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_muladd_restartable(&grp, &P, &m, &P,
+                                                          NULL, &P, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_muladd_restartable(&grp, &P, &m, &P,
+                                                          &m, NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_check_pubkey( NULL, &P ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_check_pubkey( &grp, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_check_pubkey(NULL, &P));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_check_pubkey(&grp, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_check_pub_priv( NULL, &kp ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_check_pub_priv( &kp, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_check_pub_priv(NULL, &kp));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_check_pub_priv(&kp, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_check_privkey( NULL, &m ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_check_privkey( &grp, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_check_privkey(NULL, &m));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_check_privkey(&grp, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecp_gen_keypair_base( NULL, &P, &m, &P,
-                                      mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_gen_keypair_base(NULL, &P, &m, &P,
+                                                        mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecp_gen_keypair_base( &grp, NULL, &m, &P,
-                                      mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_gen_keypair_base(&grp, NULL, &m, &P,
+                                                        mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecp_gen_keypair_base( &grp, &P, NULL, &P,
-                                      mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_gen_keypair_base(&grp, &P, NULL, &P,
+                                                        mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecp_gen_keypair_base( &grp, &P, &m, NULL,
-                                      mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_gen_keypair_base(&grp, &P, &m, NULL,
+                                                        mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-        mbedtls_ecp_gen_keypair_base( &grp, &P, &m, &P, NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_gen_keypair_base(&grp, &P, &m, &P, NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_gen_keypair( NULL,
-                                                     &m, &P,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_gen_keypair( &grp,
-                                                     NULL, &P,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_gen_keypair( &grp,
-                                                     &m, NULL,
-                                                     mbedtls_test_rnd_std_rand,
-                                                     NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_gen_keypair( &grp,
-                                                     &m, &P,
-                                                     NULL,
-                                                     NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_gen_keypair(NULL,
+                                                   &m, &P,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_gen_keypair(&grp,
+                                                   NULL, &P,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_gen_keypair(&grp,
+                                                   &m, NULL,
+                                                   mbedtls_test_rnd_std_rand,
+                                                   NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_gen_keypair(&grp,
+                                                   &m, &P,
+                                                   NULL,
+                                                   NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_gen_key( valid_group, NULL,
-                                                 mbedtls_test_rnd_std_rand,
-                                                 NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_gen_key( valid_group, &kp,
-                                                 NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_gen_key(valid_group, NULL,
+                                               mbedtls_test_rnd_std_rand,
+                                               NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+                           mbedtls_ecp_gen_key(valid_group, &kp,
+                                               NULL, NULL));
 
 exit:
     return;
@@ -414,55 +429,55 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_ecp_curve_info( int id, int tls_id, int size, char * name )
+void mbedtls_ecp_curve_info(int id, int tls_id, int size, char *name)
 {
     const mbedtls_ecp_curve_info *by_id, *by_tls, *by_name;
 
-    by_id   = mbedtls_ecp_curve_info_from_grp_id( id     );
-    by_tls  = mbedtls_ecp_curve_info_from_tls_id( tls_id );
-    by_name = mbedtls_ecp_curve_info_from_name(   name   );
-    TEST_ASSERT( by_id   != NULL );
-    TEST_ASSERT( by_tls  != NULL );
-    TEST_ASSERT( by_name != NULL );
+    by_id   = mbedtls_ecp_curve_info_from_grp_id(id);
+    by_tls  = mbedtls_ecp_curve_info_from_tls_id(tls_id);
+    by_name = mbedtls_ecp_curve_info_from_name(name);
+    TEST_ASSERT(by_id   != NULL);
+    TEST_ASSERT(by_tls  != NULL);
+    TEST_ASSERT(by_name != NULL);
 
-    TEST_ASSERT( by_id == by_tls  );
-    TEST_ASSERT( by_id == by_name );
+    TEST_ASSERT(by_id == by_tls);
+    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 );
+    TEST_ASSERT(by_id->bit_size == size);
+    TEST_ASSERT(size <= MBEDTLS_ECP_MAX_BITS);
+    TEST_ASSERT(size <= MBEDTLS_ECP_MAX_BYTES * 8);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecp_check_pub( int grp_id, char * x_hex, char * y_hex, char * z_hex,
-                    int ret )
+void ecp_check_pub(int grp_id, char *x_hex, char *y_hex, char *z_hex,
+                   int ret)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point P;
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_point_init( &P );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_point_init(&P);
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, grp_id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, grp_id) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &P.X, x_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &P.Y, y_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &P.Z, z_hex ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P.X, x_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&P.Y, y_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&P.Z, z_hex) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &grp, &P ) == ret );
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&grp, &P) == ret);
 
 exit:
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_ecp_point_free( &P );
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_ecp_point_free(&P);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECP_RESTARTABLE */
-void ecp_test_vect_restart( int id,
-                            char *dA_str, char *xA_str, char *yA_str,
-                            char *dB_str,  char *xZ_str, char *yZ_str,
-                            int max_ops, int min_restarts, int max_restarts )
+void ecp_test_vect_restart(int id,
+                           char *dA_str, char *xA_str, char *yA_str,
+                           char *dB_str,  char *xZ_str, char *yZ_str,
+                           int max_ops, int min_restarts, int max_restarts)
 {
     /*
      * Test for early restart. Based on test vectors like ecp_test_vect(),
@@ -489,75 +504,74 @@
     int cnt_restarts;
     int ret;
 
-    mbedtls_ecp_restart_init( &ctx );
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_point_init( &R ); mbedtls_ecp_point_init( &P );
-    mbedtls_mpi_init( &dA ); mbedtls_mpi_init( &xA ); mbedtls_mpi_init( &yA );
-    mbedtls_mpi_init( &dB ); mbedtls_mpi_init( &xZ ); mbedtls_mpi_init( &yZ );
+    mbedtls_ecp_restart_init(&ctx);
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_point_init(&R); mbedtls_ecp_point_init(&P);
+    mbedtls_mpi_init(&dA); mbedtls_mpi_init(&xA); mbedtls_mpi_init(&yA);
+    mbedtls_mpi_init(&dB); mbedtls_mpi_init(&xZ); mbedtls_mpi_init(&yZ);
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &dA, dA_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xA, xA_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &yA, yA_str ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&dA, dA_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xA, xA_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&yA, yA_str) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &dB, dB_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xZ, xZ_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &yZ, yZ_str ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&dB, dB_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xZ, xZ_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&yZ, yZ_str) == 0);
 
-    mbedtls_ecp_set_max_ops( (unsigned) max_ops );
+    mbedtls_ecp_set_max_ops((unsigned) max_ops);
 
     /* Base point case */
     cnt_restarts = 0;
     do {
-        ECP_PT_RESET( &R );
-        ret = mbedtls_ecp_mul_restartable( &grp, &R, &dA, &grp.G, NULL, NULL, &ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restarts );
+        ECP_PT_RESET(&R);
+        ret = mbedtls_ecp_mul_restartable(&grp, &R, &dA, &grp.G, NULL, NULL, &ctx);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restarts);
 
-    TEST_ASSERT( ret == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.X, &xA ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.Y, &yA ) == 0 );
+    TEST_ASSERT(ret == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.X, &xA) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.Y, &yA) == 0);
 
-    TEST_ASSERT( cnt_restarts >= min_restarts );
-    TEST_ASSERT( cnt_restarts <= max_restarts );
+    TEST_ASSERT(cnt_restarts >= min_restarts);
+    TEST_ASSERT(cnt_restarts <= max_restarts);
 
     /* Non-base point case */
-    mbedtls_ecp_copy( &P, &R );
+    mbedtls_ecp_copy(&P, &R);
     cnt_restarts = 0;
     do {
-        ECP_PT_RESET( &R );
-        ret = mbedtls_ecp_mul_restartable( &grp, &R, &dB, &P, NULL, NULL, &ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restarts );
+        ECP_PT_RESET(&R);
+        ret = mbedtls_ecp_mul_restartable(&grp, &R, &dB, &P, NULL, NULL, &ctx);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restarts);
 
-    TEST_ASSERT( ret == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.X, &xZ ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.Y, &yZ ) == 0 );
+    TEST_ASSERT(ret == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.X, &xZ) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.Y, &yZ) == 0);
 
-    TEST_ASSERT( cnt_restarts >= min_restarts );
-    TEST_ASSERT( cnt_restarts <= max_restarts );
+    TEST_ASSERT(cnt_restarts >= min_restarts);
+    TEST_ASSERT(cnt_restarts <= max_restarts);
 
     /* Do we leak memory when aborting an operation?
      * This test only makes sense when we actually restart */
-    if( min_restarts > 0 )
-    {
-        ret = mbedtls_ecp_mul_restartable( &grp, &R, &dB, &P, NULL, NULL, &ctx );
-        TEST_ASSERT( ret == MBEDTLS_ERR_ECP_IN_PROGRESS );
+    if (min_restarts > 0) {
+        ret = mbedtls_ecp_mul_restartable(&grp, &R, &dB, &P, NULL, NULL, &ctx);
+        TEST_ASSERT(ret == MBEDTLS_ERR_ECP_IN_PROGRESS);
     }
 
 exit:
-    mbedtls_ecp_restart_free( &ctx );
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_ecp_point_free( &R ); mbedtls_ecp_point_free( &P );
-    mbedtls_mpi_free( &dA ); mbedtls_mpi_free( &xA ); mbedtls_mpi_free( &yA );
-    mbedtls_mpi_free( &dB ); mbedtls_mpi_free( &xZ ); mbedtls_mpi_free( &yZ );
+    mbedtls_ecp_restart_free(&ctx);
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_ecp_point_free(&R); mbedtls_ecp_point_free(&P);
+    mbedtls_mpi_free(&dA); mbedtls_mpi_free(&xA); mbedtls_mpi_free(&yA);
+    mbedtls_mpi_free(&dB); mbedtls_mpi_free(&xZ); mbedtls_mpi_free(&yZ);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECP_RESTARTABLE:MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED */
-void ecp_muladd_restart( int id, char *xR_str, char *yR_str,
-                         char *u1_str, char *u2_str,
-                         char *xQ_str, char *yQ_str,
-                         int max_ops, int min_restarts, int max_restarts )
+void ecp_muladd_restart(int id, char *xR_str, char *yR_str,
+                        char *u1_str, char *u2_str,
+                        char *xQ_str, char *yQ_str,
+                        int max_ops, int min_restarts, int max_restarts)
 {
     /*
      * Compute R = u1 * G + u2 * Q
@@ -572,246 +586,244 @@
     int cnt_restarts;
     int ret;
 
-    mbedtls_ecp_restart_init( &ctx );
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_point_init( &R );
-    mbedtls_ecp_point_init( &Q );
-    mbedtls_mpi_init( &u1 ); mbedtls_mpi_init( &u2 );
-    mbedtls_mpi_init( &xR ); mbedtls_mpi_init( &yR );
+    mbedtls_ecp_restart_init(&ctx);
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_point_init(&R);
+    mbedtls_ecp_point_init(&Q);
+    mbedtls_mpi_init(&u1); mbedtls_mpi_init(&u2);
+    mbedtls_mpi_init(&xR); mbedtls_mpi_init(&yR);
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &u1, u1_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &u2, u2_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xR, xR_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &yR, yR_str ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&u1, u1_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&u2, u2_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xR, xR_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&yR, yR_str) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q.X, xQ_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q.Y, yQ_str ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_lset( &Q.Z, 1 ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q.X, xQ_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q.Y, yQ_str) == 0);
+    TEST_ASSERT(mbedtls_mpi_lset(&Q.Z, 1) == 0);
 
-    mbedtls_ecp_set_max_ops( (unsigned) max_ops );
+    mbedtls_ecp_set_max_ops((unsigned) max_ops);
 
     cnt_restarts = 0;
     do {
-        ECP_PT_RESET( &R );
-        ret = mbedtls_ecp_muladd_restartable( &grp, &R,
-                                              &u1, &grp.G, &u2, &Q, &ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restarts );
+        ECP_PT_RESET(&R);
+        ret = mbedtls_ecp_muladd_restartable(&grp, &R,
+                                             &u1, &grp.G, &u2, &Q, &ctx);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restarts);
 
-    TEST_ASSERT( ret == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.X, &xR ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.Y, &yR ) == 0 );
+    TEST_ASSERT(ret == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.X, &xR) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.Y, &yR) == 0);
 
-    TEST_ASSERT( cnt_restarts >= min_restarts );
-    TEST_ASSERT( cnt_restarts <= max_restarts );
+    TEST_ASSERT(cnt_restarts >= min_restarts);
+    TEST_ASSERT(cnt_restarts <= max_restarts);
 
     /* Do we leak memory when aborting an operation?
      * This test only makes sense when we actually restart */
-    if( min_restarts > 0 )
-    {
-        ret = mbedtls_ecp_muladd_restartable( &grp, &R,
-                                              &u1, &grp.G, &u2, &Q, &ctx );
-        TEST_ASSERT( ret == MBEDTLS_ERR_ECP_IN_PROGRESS );
+    if (min_restarts > 0) {
+        ret = mbedtls_ecp_muladd_restartable(&grp, &R,
+                                             &u1, &grp.G, &u2, &Q, &ctx);
+        TEST_ASSERT(ret == MBEDTLS_ERR_ECP_IN_PROGRESS);
     }
 
 exit:
-    mbedtls_ecp_restart_free( &ctx );
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_ecp_point_free( &R );
-    mbedtls_ecp_point_free( &Q );
-    mbedtls_mpi_free( &u1 ); mbedtls_mpi_free( &u2 );
-    mbedtls_mpi_free( &xR ); mbedtls_mpi_free( &yR );
+    mbedtls_ecp_restart_free(&ctx);
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_ecp_point_free(&R);
+    mbedtls_ecp_point_free(&Q);
+    mbedtls_mpi_free(&u1); mbedtls_mpi_free(&u2);
+    mbedtls_mpi_free(&xR); mbedtls_mpi_free(&yR);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecp_test_vect( int id, char * dA_str, char * xA_str, char * yA_str,
-                    char * dB_str, char * xB_str, char * yB_str,
-                    char * xZ_str, char * yZ_str )
+void ecp_test_vect(int id, char *dA_str, char *xA_str, char *yA_str,
+                   char *dB_str, char *xB_str, char *yB_str,
+                   char *xZ_str, char *yZ_str)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point R;
     mbedtls_mpi dA, xA, yA, dB, xB, yB, xZ, yZ;
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    mbedtls_ecp_group_init( &grp ); mbedtls_ecp_point_init( &R );
-    mbedtls_mpi_init( &dA ); mbedtls_mpi_init( &xA ); mbedtls_mpi_init( &yA ); mbedtls_mpi_init( &dB );
-    mbedtls_mpi_init( &xB ); mbedtls_mpi_init( &yB ); mbedtls_mpi_init( &xZ ); mbedtls_mpi_init( &yZ );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    mbedtls_ecp_group_init(&grp); mbedtls_ecp_point_init(&R);
+    mbedtls_mpi_init(&dA); mbedtls_mpi_init(&xA); mbedtls_mpi_init(&yA); mbedtls_mpi_init(&dB);
+    mbedtls_mpi_init(&xB); mbedtls_mpi_init(&yB); mbedtls_mpi_init(&xZ); mbedtls_mpi_init(&yZ);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &grp, &grp.G ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&grp, &grp.G) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &dA, dA_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xA, xA_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &yA, yA_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &dB, dB_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xB, xB_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &yB, yB_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xZ, xZ_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &yZ, yZ_str ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&dA, dA_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xA, xA_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&yA, yA_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&dB, dB_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xB, xB_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&yB, yB_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xZ, xZ_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&yZ, yZ_str) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_mul( &grp, &R, &dA, &grp.G,
-                          &mbedtls_test_rnd_pseudo_rand, &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.X, &xA ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.Y, &yA ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &grp, &R ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_mul( &grp, &R, &dB, &R, NULL, NULL ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.X, &xZ ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.Y, &yZ ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &grp, &R ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_mul(&grp, &R, &dA, &grp.G,
+                                &mbedtls_test_rnd_pseudo_rand, &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.X, &xA) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.Y, &yA) == 0);
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&grp, &R) == 0);
+    TEST_ASSERT(mbedtls_ecp_mul(&grp, &R, &dB, &R, NULL, NULL) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.X, &xZ) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.Y, &yZ) == 0);
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&grp, &R) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_mul( &grp, &R, &dB, &grp.G, NULL, NULL ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.X, &xB ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.Y, &yB ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &grp, &R ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_mul( &grp, &R, &dA, &R,
-                          &mbedtls_test_rnd_pseudo_rand, &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.X, &xZ ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.Y, &yZ ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &grp, &R ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_mul(&grp, &R, &dB, &grp.G, NULL, NULL) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.X, &xB) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.Y, &yB) == 0);
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&grp, &R) == 0);
+    TEST_ASSERT(mbedtls_ecp_mul(&grp, &R, &dA, &R,
+                                &mbedtls_test_rnd_pseudo_rand, &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.X, &xZ) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.Y, &yZ) == 0);
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&grp, &R) == 0);
 
 exit:
-    mbedtls_ecp_group_free( &grp ); mbedtls_ecp_point_free( &R );
-    mbedtls_mpi_free( &dA ); mbedtls_mpi_free( &xA ); mbedtls_mpi_free( &yA ); mbedtls_mpi_free( &dB );
-    mbedtls_mpi_free( &xB ); mbedtls_mpi_free( &yB ); mbedtls_mpi_free( &xZ ); mbedtls_mpi_free( &yZ );
+    mbedtls_ecp_group_free(&grp); mbedtls_ecp_point_free(&R);
+    mbedtls_mpi_free(&dA); mbedtls_mpi_free(&xA); mbedtls_mpi_free(&yA); mbedtls_mpi_free(&dB);
+    mbedtls_mpi_free(&xB); mbedtls_mpi_free(&yB); mbedtls_mpi_free(&xZ); mbedtls_mpi_free(&yZ);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecp_test_vec_x( int id, char * dA_hex, char * xA_hex, char * dB_hex,
-                     char * xB_hex, char * xS_hex )
+void ecp_test_vec_x(int id, char *dA_hex, char *xA_hex, char *dB_hex,
+                    char *xB_hex, char *xS_hex)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point R;
     mbedtls_mpi dA, xA, dB, xB, xS;
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    mbedtls_ecp_group_init( &grp ); mbedtls_ecp_point_init( &R );
-    mbedtls_mpi_init( &dA ); mbedtls_mpi_init( &xA );
-    mbedtls_mpi_init( &dB ); mbedtls_mpi_init( &xB );
-    mbedtls_mpi_init( &xS );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    mbedtls_ecp_group_init(&grp); mbedtls_ecp_point_init(&R);
+    mbedtls_mpi_init(&dA); mbedtls_mpi_init(&xA);
+    mbedtls_mpi_init(&dB); mbedtls_mpi_init(&xB);
+    mbedtls_mpi_init(&xS);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &grp, &grp.G ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&grp, &grp.G) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &dA, dA_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &dB, dB_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xA, xA_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xB, xB_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xS, xS_hex ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&dA, dA_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&dB, dB_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xA, xA_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xB, xB_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xS, xS_hex) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_mul( &grp, &R, &dA, &grp.G,
-                          &mbedtls_test_rnd_pseudo_rand, &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &grp, &R ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.X, &xA ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_mul(&grp, &R, &dA, &grp.G,
+                                &mbedtls_test_rnd_pseudo_rand, &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&grp, &R) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.X, &xA) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_mul( &grp, &R, &dB, &R,
-                          &mbedtls_test_rnd_pseudo_rand, &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &grp, &R ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.X, &xS ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_mul(&grp, &R, &dB, &R,
+                                &mbedtls_test_rnd_pseudo_rand, &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&grp, &R) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.X, &xS) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_mul( &grp, &R, &dB, &grp.G, NULL, NULL ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &grp, &R ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.X, &xB ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_mul(&grp, &R, &dB, &grp.G, NULL, NULL) == 0);
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&grp, &R) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.X, &xB) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_mul( &grp, &R, &dA, &R, NULL, NULL ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &grp, &R ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R.X, &xS ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_mul(&grp, &R, &dA, &R, NULL, NULL) == 0);
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&grp, &R) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R.X, &xS) == 0);
 
 exit:
-    mbedtls_ecp_group_free( &grp ); mbedtls_ecp_point_free( &R );
-    mbedtls_mpi_free( &dA ); mbedtls_mpi_free( &xA );
-    mbedtls_mpi_free( &dB ); mbedtls_mpi_free( &xB );
-    mbedtls_mpi_free( &xS );
+    mbedtls_ecp_group_free(&grp); mbedtls_ecp_point_free(&R);
+    mbedtls_mpi_free(&dA); mbedtls_mpi_free(&xA);
+    mbedtls_mpi_free(&dB); mbedtls_mpi_free(&xB);
+    mbedtls_mpi_free(&xS);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecp_test_mul( int id, data_t * n_hex,
-                   data_t *  Px_hex, data_t *  Py_hex, data_t *  Pz_hex,
-                   data_t * nPx_hex, data_t * nPy_hex, data_t * nPz_hex,
-                   int expected_ret )
+void ecp_test_mul(int id, data_t *n_hex,
+                  data_t *Px_hex, data_t *Py_hex, data_t *Pz_hex,
+                  data_t *nPx_hex, data_t *nPy_hex, data_t *nPz_hex,
+                  int expected_ret)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point P, nP, R;
     mbedtls_mpi n;
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    mbedtls_ecp_group_init( &grp ); mbedtls_ecp_point_init( &R );
-    mbedtls_ecp_point_init( &P ); mbedtls_ecp_point_init( &nP );
-    mbedtls_mpi_init( &n );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    mbedtls_ecp_group_init(&grp); mbedtls_ecp_point_init(&R);
+    mbedtls_ecp_point_init(&P); mbedtls_ecp_point_init(&nP);
+    mbedtls_mpi_init(&n);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &grp, &grp.G ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&grp, &grp.G) == 0);
 
-    TEST_ASSERT( mbedtls_mpi_read_binary( &n, n_hex->x, n_hex->len ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_read_binary(&n, n_hex->x, n_hex->len) == 0);
 
-    TEST_ASSERT( mbedtls_mpi_read_binary( &P.X, Px_hex->x, Px_hex->len ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &P.Y, Py_hex->x, Py_hex->len ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &P.Z, Pz_hex->x, Pz_hex->len ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &nP.X, nPx_hex->x, nPx_hex->len )
-                 == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &nP.Y, nPy_hex->x, nPy_hex->len )
-                 == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &nP.Z, nPz_hex->x, nPz_hex->len )
-                 == 0 );
+    TEST_ASSERT(mbedtls_mpi_read_binary(&P.X, Px_hex->x, Px_hex->len) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&P.Y, Py_hex->x, Py_hex->len) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&P.Z, Pz_hex->x, Pz_hex->len) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&nP.X, nPx_hex->x, nPx_hex->len)
+                == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&nP.Y, nPy_hex->x, nPy_hex->len)
+                == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&nP.Z, nPz_hex->x, nPz_hex->len)
+                == 0);
 
-    TEST_ASSERT( mbedtls_ecp_mul( &grp, &R, &n, &P,
-                                  &mbedtls_test_rnd_pseudo_rand, &rnd_info )
-                 == expected_ret );
+    TEST_ASSERT(mbedtls_ecp_mul(&grp, &R, &n, &P,
+                                &mbedtls_test_rnd_pseudo_rand, &rnd_info)
+                == expected_ret);
 
-    if( expected_ret == 0 )
-    {
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &nP.X, &R.X ) == 0 );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &nP.Y, &R.Y ) == 0 );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &nP.Z, &R.Z ) == 0 );
+    if (expected_ret == 0) {
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&nP.X, &R.X) == 0);
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&nP.Y, &R.Y) == 0);
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&nP.Z, &R.Z) == 0);
     }
 
 exit:
-    mbedtls_ecp_group_free( &grp ); mbedtls_ecp_point_free( &R );
-    mbedtls_ecp_point_free( &P ); mbedtls_ecp_point_free( &nP );
-    mbedtls_mpi_free( &n );
+    mbedtls_ecp_group_free(&grp); mbedtls_ecp_point_free(&R);
+    mbedtls_ecp_point_free(&P); mbedtls_ecp_point_free(&nP);
+    mbedtls_mpi_free(&n);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecp_test_mul_rng( int id, data_t * d_hex)
+void ecp_test_mul_rng(int id, data_t *d_hex)
 {
     mbedtls_ecp_group grp;
     mbedtls_mpi d;
     mbedtls_ecp_point Q;
 
-    mbedtls_ecp_group_init( &grp ); mbedtls_mpi_init( &d );
-    mbedtls_ecp_point_init( &Q );
+    mbedtls_ecp_group_init(&grp); mbedtls_mpi_init(&d);
+    mbedtls_ecp_point_init(&Q);
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &grp, &grp.G ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&grp, &grp.G) == 0);
 
-    TEST_ASSERT( mbedtls_mpi_read_binary( &d, d_hex->x, d_hex->len ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_read_binary(&d, d_hex->x, d_hex->len) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_mul( &grp, &Q, &d, &grp.G,
-                                  &mbedtls_test_rnd_zero_rand, NULL )
-                 == MBEDTLS_ERR_ECP_RANDOM_FAILED );
+    TEST_ASSERT(mbedtls_ecp_mul(&grp, &Q, &d, &grp.G,
+                                &mbedtls_test_rnd_zero_rand, NULL)
+                == MBEDTLS_ERR_ECP_RANDOM_FAILED);
 
 exit:
-    mbedtls_ecp_group_free( &grp ); mbedtls_mpi_free( &d );
-    mbedtls_ecp_point_free( &Q );
+    mbedtls_ecp_group_free(&grp); mbedtls_mpi_free(&d);
+    mbedtls_ecp_point_free(&Q);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED */
-void ecp_muladd( int id,
-                 data_t *u1_bin, data_t *P1_bin,
-                 data_t *u2_bin, data_t *P2_bin,
-                 data_t *expected_result )
+void ecp_muladd(int id,
+                data_t *u1_bin, data_t *P1_bin,
+                data_t *u2_bin, data_t *P2_bin,
+                data_t *expected_result)
 {
     /* Compute R = u1 * P1 + u2 * P2 */
     mbedtls_ecp_group grp;
@@ -820,152 +832,147 @@
     uint8_t actual_result[MBEDTLS_ECP_MAX_PT_LEN];
     size_t len;
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_point_init( &P1 );
-    mbedtls_ecp_point_init( &P2 );
-    mbedtls_ecp_point_init( &R );
-    mbedtls_mpi_init( &u1 );
-    mbedtls_mpi_init( &u2 );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_point_init(&P1);
+    mbedtls_ecp_point_init(&P2);
+    mbedtls_ecp_point_init(&R);
+    mbedtls_mpi_init(&u1);
+    mbedtls_mpi_init(&u2);
 
-    TEST_EQUAL( 0, mbedtls_ecp_group_load( &grp, id ) );
-    TEST_EQUAL( 0, mbedtls_mpi_read_binary( &u1, u1_bin->x, u1_bin->len ) );
-    TEST_EQUAL( 0, mbedtls_mpi_read_binary( &u2, u2_bin->x, u2_bin->len ) );
-    TEST_EQUAL( 0, mbedtls_ecp_point_read_binary( &grp, &P1,
-                                                  P1_bin->x, P1_bin->len ) );
-    TEST_EQUAL( 0, mbedtls_ecp_point_read_binary( &grp, &P2,
-                                                  P2_bin->x, P2_bin->len ) );
+    TEST_EQUAL(0, mbedtls_ecp_group_load(&grp, id));
+    TEST_EQUAL(0, mbedtls_mpi_read_binary(&u1, u1_bin->x, u1_bin->len));
+    TEST_EQUAL(0, mbedtls_mpi_read_binary(&u2, u2_bin->x, u2_bin->len));
+    TEST_EQUAL(0, mbedtls_ecp_point_read_binary(&grp, &P1,
+                                                P1_bin->x, P1_bin->len));
+    TEST_EQUAL(0, mbedtls_ecp_point_read_binary(&grp, &P2,
+                                                P2_bin->x, P2_bin->len));
 
-    TEST_EQUAL( 0, mbedtls_ecp_muladd( &grp, &R, &u1, &P1, &u2, &P2 ) );
-    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 );
+    TEST_EQUAL(0, mbedtls_ecp_muladd(&grp, &R, &u1, &P1, &u2, &P2));
+    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 );
+    ASSERT_COMPARE(expected_result->x, expected_result->len,
+                   actual_result, len);
 
 exit:
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_ecp_point_free( &P1 );
-    mbedtls_ecp_point_free( &P2 );
-    mbedtls_ecp_point_free( &R );
-    mbedtls_mpi_free( &u1 );
-    mbedtls_mpi_free( &u2 );
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_ecp_point_free(&P1);
+    mbedtls_ecp_point_free(&P2);
+    mbedtls_ecp_point_free(&R);
+    mbedtls_mpi_free(&u1);
+    mbedtls_mpi_free(&u2);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecp_fast_mod( int id, char * N_str )
+void ecp_fast_mod(int id, char *N_str)
 {
     mbedtls_ecp_group grp;
     mbedtls_mpi N, R;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &R );
-    mbedtls_ecp_group_init( &grp );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&R);
+    mbedtls_ecp_group_init(&grp);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, N_str ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
-    TEST_ASSERT( grp.modp != NULL );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, N_str) == 0);
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
+    TEST_ASSERT(grp.modp != NULL);
 
     /*
      * Store correct result before we touch N
      */
-    TEST_ASSERT( mbedtls_mpi_mod_mpi( &R, &N, &grp.P ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_mod_mpi(&R, &N, &grp.P) == 0);
 
-    TEST_ASSERT( grp.modp( &N ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_bitlen( &N ) <= grp.pbits + 3 );
+    TEST_ASSERT(grp.modp(&N) == 0);
+    TEST_ASSERT(mbedtls_mpi_bitlen(&N) <= grp.pbits + 3);
 
     /*
      * Use mod rather than addition/subtraction in case previous test fails
      */
-    TEST_ASSERT( mbedtls_mpi_mod_mpi( &N, &N, &grp.P ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &N, &R ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_mod_mpi(&N, &N, &grp.P) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&N, &R) == 0);
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &R );
-    mbedtls_ecp_group_free( &grp );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&R);
+    mbedtls_ecp_group_free(&grp);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecp_write_binary( int id, char * x, char * y, char * z, int format,
-                       data_t * out, int blen, int ret )
+void ecp_write_binary(int id, char *x, char *y, char *z, int format,
+                      data_t *out, int blen, int ret)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point P;
     unsigned char buf[256];
     size_t olen;
 
-    memset( buf, 0, sizeof( buf ) );
+    memset(buf, 0, sizeof(buf));
 
-    mbedtls_ecp_group_init( &grp ); mbedtls_ecp_point_init( &P );
+    mbedtls_ecp_group_init(&grp); mbedtls_ecp_point_init(&P);
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &P.X, x ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &P.Y, y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &P.Z, z ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P.X, x) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&P.Y, y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&P.Z, z) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_point_write_binary( &grp, &P, format,
-                                   &olen, buf, blen ) == ret );
+    TEST_ASSERT(mbedtls_ecp_point_write_binary(&grp, &P, format,
+                                               &olen, buf, blen) == ret);
 
-    if( ret == 0 )
-    {
-        TEST_ASSERT( olen <= MBEDTLS_ECP_MAX_PT_LEN );
-        TEST_ASSERT( mbedtls_test_hexcmp( buf, out->x, olen, out->len ) == 0 );
+    if (ret == 0) {
+        TEST_ASSERT(olen <= MBEDTLS_ECP_MAX_PT_LEN);
+        TEST_ASSERT(mbedtls_test_hexcmp(buf, out->x, olen, out->len) == 0);
     }
 
 exit:
-    mbedtls_ecp_group_free( &grp ); mbedtls_ecp_point_free( &P );
+    mbedtls_ecp_group_free(&grp); mbedtls_ecp_point_free(&P);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecp_read_binary( int id, data_t * buf, char * x, char * y, char * z,
-                      int ret )
+void ecp_read_binary(int id, data_t *buf, char *x, char *y, char *z,
+                     int ret)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point P;
     mbedtls_mpi X, Y, Z;
 
 
-    mbedtls_ecp_group_init( &grp ); mbedtls_ecp_point_init( &P );
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Z );
+    mbedtls_ecp_group_init(&grp); mbedtls_ecp_point_init(&P);
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y); mbedtls_mpi_init(&Z);
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, x ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Z, z ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, x) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Z, z) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_point_read_binary( &grp, &P, buf->x, buf->len ) == ret );
+    TEST_ASSERT(mbedtls_ecp_point_read_binary(&grp, &P, buf->x, buf->len) == ret);
 
-    if( ret == 0 )
-    {
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &P.X, &X ) == 0 );
-        if( mbedtls_ecp_get_type( &grp ) == MBEDTLS_ECP_TYPE_MONTGOMERY )
-        {
-            TEST_ASSERT( mbedtls_mpi_cmp_int( &Y, 0 ) == 0 );
-            TEST_ASSERT( P.Y.p == NULL );
-            TEST_ASSERT( mbedtls_mpi_cmp_int( &Z, 1 ) == 0 );
-            TEST_ASSERT( mbedtls_mpi_cmp_int( &P.Z, 1 ) == 0 );
-        }
-        else
-        {
-            TEST_ASSERT( mbedtls_mpi_cmp_mpi( &P.Y, &Y ) == 0 );
-            TEST_ASSERT( mbedtls_mpi_cmp_mpi( &P.Z, &Z ) == 0 );
+    if (ret == 0) {
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&P.X, &X) == 0);
+        if (mbedtls_ecp_get_type(&grp) == MBEDTLS_ECP_TYPE_MONTGOMERY) {
+            TEST_ASSERT(mbedtls_mpi_cmp_int(&Y, 0) == 0);
+            TEST_ASSERT(P.Y.p == NULL);
+            TEST_ASSERT(mbedtls_mpi_cmp_int(&Z, 1) == 0);
+            TEST_ASSERT(mbedtls_mpi_cmp_int(&P.Z, 1) == 0);
+        } else {
+            TEST_ASSERT(mbedtls_mpi_cmp_mpi(&P.Y, &Y) == 0);
+            TEST_ASSERT(mbedtls_mpi_cmp_mpi(&P.Z, &Z) == 0);
         }
     }
 
 exit:
-    mbedtls_ecp_group_free( &grp ); mbedtls_ecp_point_free( &P );
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y ); mbedtls_mpi_free( &Z );
+    mbedtls_ecp_group_free(&grp); mbedtls_ecp_point_free(&P);
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y); mbedtls_mpi_free(&Z);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_ecp_tls_read_point( int id, data_t * buf, char * x, char * y,
-                                 char * z, int ret )
+void mbedtls_ecp_tls_read_point(int id, data_t *buf, char *x, char *y,
+                                char *z, int ret)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point P;
@@ -973,33 +980,32 @@
     const unsigned char *vbuf = buf->x;
 
 
-    mbedtls_ecp_group_init( &grp ); mbedtls_ecp_point_init( &P );
-    mbedtls_mpi_init( &X ); mbedtls_mpi_init( &Y ); mbedtls_mpi_init( &Z );
+    mbedtls_ecp_group_init(&grp); mbedtls_ecp_point_init(&P);
+    mbedtls_mpi_init(&X); mbedtls_mpi_init(&Y); mbedtls_mpi_init(&Z);
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, x ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Z, z ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, x) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Z, z) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_tls_read_point( &grp, &P, &vbuf, buf->len ) == ret );
+    TEST_ASSERT(mbedtls_ecp_tls_read_point(&grp, &P, &vbuf, buf->len) == ret);
 
-    if( ret == 0 )
-    {
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &P.X, &X ) == 0 );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &P.Y, &Y ) == 0 );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &P.Z, &Z ) == 0 );
-        TEST_ASSERT( (uint32_t)( vbuf - buf->x ) == buf->len );
+    if (ret == 0) {
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&P.X, &X) == 0);
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&P.Y, &Y) == 0);
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&P.Z, &Z) == 0);
+        TEST_ASSERT((uint32_t) (vbuf - buf->x) == buf->len);
     }
 
 exit:
-    mbedtls_ecp_group_free( &grp ); mbedtls_ecp_point_free( &P );
-    mbedtls_mpi_free( &X ); mbedtls_mpi_free( &Y ); mbedtls_mpi_free( &Z );
+    mbedtls_ecp_group_free(&grp); mbedtls_ecp_point_free(&P);
+    mbedtls_mpi_free(&X); mbedtls_mpi_free(&Y); mbedtls_mpi_free(&Z);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecp_tls_write_read_point( int id )
+void ecp_tls_write_read_point(int id)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point pt;
@@ -1007,75 +1013,74 @@
     const unsigned char *vbuf;
     size_t olen;
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_point_init( &pt );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_point_init(&pt);
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
 
-    memset( buf, 0x00, sizeof( buf ) ); vbuf = buf;
-    TEST_ASSERT( mbedtls_ecp_tls_write_point( &grp, &grp.G,
-                    MBEDTLS_ECP_PF_COMPRESSED, &olen, buf, 256 ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_tls_read_point( &grp, &pt, &vbuf, olen )
-                 == MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE );
-    TEST_ASSERT( vbuf == buf + olen );
+    memset(buf, 0x00, sizeof(buf)); vbuf = buf;
+    TEST_ASSERT(mbedtls_ecp_tls_write_point(&grp, &grp.G,
+                                            MBEDTLS_ECP_PF_COMPRESSED, &olen, buf, 256) == 0);
+    TEST_ASSERT(mbedtls_ecp_tls_read_point(&grp, &pt, &vbuf, olen)
+                == MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE);
+    TEST_ASSERT(vbuf == buf + olen);
 
-    memset( buf, 0x00, sizeof( buf ) ); vbuf = buf;
-    TEST_ASSERT( mbedtls_ecp_tls_write_point( &grp, &grp.G,
-                    MBEDTLS_ECP_PF_UNCOMPRESSED, &olen, buf, 256 ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_tls_read_point( &grp, &pt, &vbuf, olen ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &grp.G.X, &pt.X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &grp.G.Y, &pt.Y ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &grp.G.Z, &pt.Z ) == 0 );
-    TEST_ASSERT( vbuf == buf + olen );
+    memset(buf, 0x00, sizeof(buf)); vbuf = buf;
+    TEST_ASSERT(mbedtls_ecp_tls_write_point(&grp, &grp.G,
+                                            MBEDTLS_ECP_PF_UNCOMPRESSED, &olen, buf, 256) == 0);
+    TEST_ASSERT(mbedtls_ecp_tls_read_point(&grp, &pt, &vbuf, olen) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&grp.G.X, &pt.X) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&grp.G.Y, &pt.Y) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&grp.G.Z, &pt.Z) == 0);
+    TEST_ASSERT(vbuf == buf + olen);
 
-    memset( buf, 0x00, sizeof( buf ) ); vbuf = buf;
-    TEST_ASSERT( mbedtls_ecp_set_zero( &pt ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_tls_write_point( &grp, &pt,
-                    MBEDTLS_ECP_PF_COMPRESSED, &olen, buf, 256 ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_tls_read_point( &grp, &pt, &vbuf, olen ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_is_zero( &pt ) );
-    TEST_ASSERT( vbuf == buf + olen );
+    memset(buf, 0x00, sizeof(buf)); vbuf = buf;
+    TEST_ASSERT(mbedtls_ecp_set_zero(&pt) == 0);
+    TEST_ASSERT(mbedtls_ecp_tls_write_point(&grp, &pt,
+                                            MBEDTLS_ECP_PF_COMPRESSED, &olen, buf, 256) == 0);
+    TEST_ASSERT(mbedtls_ecp_tls_read_point(&grp, &pt, &vbuf, olen) == 0);
+    TEST_ASSERT(mbedtls_ecp_is_zero(&pt));
+    TEST_ASSERT(vbuf == buf + olen);
 
-    memset( buf, 0x00, sizeof( buf ) ); vbuf = buf;
-    TEST_ASSERT( mbedtls_ecp_set_zero( &pt ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_tls_write_point( &grp, &pt,
-                    MBEDTLS_ECP_PF_UNCOMPRESSED, &olen, buf, 256 ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_tls_read_point( &grp, &pt, &vbuf, olen ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_is_zero( &pt ) );
-    TEST_ASSERT( vbuf == buf + olen );
+    memset(buf, 0x00, sizeof(buf)); vbuf = buf;
+    TEST_ASSERT(mbedtls_ecp_set_zero(&pt) == 0);
+    TEST_ASSERT(mbedtls_ecp_tls_write_point(&grp, &pt,
+                                            MBEDTLS_ECP_PF_UNCOMPRESSED, &olen, buf, 256) == 0);
+    TEST_ASSERT(mbedtls_ecp_tls_read_point(&grp, &pt, &vbuf, olen) == 0);
+    TEST_ASSERT(mbedtls_ecp_is_zero(&pt));
+    TEST_ASSERT(vbuf == buf + olen);
 
 exit:
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_ecp_point_free( &pt );
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_ecp_point_free(&pt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_ecp_tls_read_group( data_t * buf, int result, int bits,
-                                 int record_len )
+void mbedtls_ecp_tls_read_group(data_t *buf, int result, int bits,
+                                int record_len)
 {
     mbedtls_ecp_group grp;
     const unsigned char *vbuf = buf->x;
     int ret;
 
-    mbedtls_ecp_group_init( &grp );
+    mbedtls_ecp_group_init(&grp);
 
-    ret = mbedtls_ecp_tls_read_group( &grp, &vbuf, buf->len );
+    ret = mbedtls_ecp_tls_read_group(&grp, &vbuf, buf->len);
 
-    TEST_ASSERT( ret == result );
-    if( ret == 0)
-    {
-        TEST_ASSERT( mbedtls_mpi_bitlen( &grp.P ) == (size_t) bits );
-        TEST_ASSERT( vbuf - buf->x ==  record_len);
+    TEST_ASSERT(ret == result);
+    if (ret == 0) {
+        TEST_ASSERT(mbedtls_mpi_bitlen(&grp.P) == (size_t) bits);
+        TEST_ASSERT(vbuf - buf->x ==  record_len);
     }
 
 exit:
-    mbedtls_ecp_group_free( &grp );
+    mbedtls_ecp_group_free(&grp);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecp_tls_write_read_group( int id )
+void ecp_tls_write_read_group(int id)
 {
     mbedtls_ecp_group grp1, grp2;
     unsigned char buf[10];
@@ -1083,33 +1088,32 @@
     size_t len;
     int ret;
 
-    mbedtls_ecp_group_init( &grp1 );
-    mbedtls_ecp_group_init( &grp2 );
-    memset( buf, 0x00, sizeof( buf ) );
+    mbedtls_ecp_group_init(&grp1);
+    mbedtls_ecp_group_init(&grp2);
+    memset(buf, 0x00, sizeof(buf));
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp1, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp1, id) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_tls_write_group( &grp1, &len, buf, 10 ) == 0 );
-    ret = mbedtls_ecp_tls_read_group( &grp2, &vbuf, len );
-    TEST_ASSERT( ret == 0 );
+    TEST_ASSERT(mbedtls_ecp_tls_write_group(&grp1, &len, buf, 10) == 0);
+    ret = mbedtls_ecp_tls_read_group(&grp2, &vbuf, len);
+    TEST_ASSERT(ret == 0);
 
-    if( ret == 0 )
-    {
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &grp1.N, &grp2.N ) == 0 );
-        TEST_ASSERT( grp1.id == grp2.id );
+    if (ret == 0) {
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&grp1.N, &grp2.N) == 0);
+        TEST_ASSERT(grp1.id == grp2.id);
     }
 
 exit:
-    mbedtls_ecp_group_free( &grp1 );
-    mbedtls_ecp_group_free( &grp2 );
+    mbedtls_ecp_group_free(&grp1);
+    mbedtls_ecp_group_free(&grp2);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECDH_C:MBEDTLS_ECDSA_C */
-void mbedtls_ecp_group_metadata( int id, int bit_size, int crv_type,
-                                 char* P, char* A, char* B,
-                                 char* G_x, char* G_y, char* N,
-                                 int tls_id )
+void mbedtls_ecp_group_metadata(int id, int bit_size, int crv_type,
+                                char *P, char *A, char *B,
+                                char *G_x, char *G_y, char *N,
+                                int tls_id)
 {
     mbedtls_ecp_group grp, grp_read, grp_cpy;
     const mbedtls_ecp_group_id *g_id;
@@ -1122,316 +1126,317 @@
     const unsigned char *vbuf = buf;
     size_t olen;
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_group_init( &grp_read );
-    mbedtls_ecp_group_init( &grp_cpy );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_group_init(&grp_read);
+    mbedtls_ecp_group_init(&grp_cpy);
 
-    mbedtls_mpi_init( &exp_P );
-    mbedtls_mpi_init( &exp_A );
-    mbedtls_mpi_init( &exp_B );
-    mbedtls_mpi_init( &exp_G_x );
-    mbedtls_mpi_init( &exp_G_y );
-    mbedtls_mpi_init( &exp_N );
+    mbedtls_mpi_init(&exp_P);
+    mbedtls_mpi_init(&exp_A);
+    mbedtls_mpi_init(&exp_B);
+    mbedtls_mpi_init(&exp_G_x);
+    mbedtls_mpi_init(&exp_G_y);
+    mbedtls_mpi_init(&exp_N);
 
     // Read expected parameters
-    TEST_EQUAL( mbedtls_test_read_mpi( &exp_P, P ), 0 );
-    TEST_EQUAL( mbedtls_test_read_mpi( &exp_A, A ), 0 );
-    TEST_EQUAL( mbedtls_test_read_mpi( &exp_G_x, G_x ), 0 );
-    TEST_EQUAL( mbedtls_test_read_mpi( &exp_N, N ), 0 );
-    TEST_EQUAL( mbedtls_test_read_mpi( &exp_B, B ), 0 );
-    TEST_EQUAL( mbedtls_test_read_mpi( &exp_G_y, G_y ), 0 );
+    TEST_EQUAL(mbedtls_test_read_mpi(&exp_P, P), 0);
+    TEST_EQUAL(mbedtls_test_read_mpi(&exp_A, A), 0);
+    TEST_EQUAL(mbedtls_test_read_mpi(&exp_G_x, G_x), 0);
+    TEST_EQUAL(mbedtls_test_read_mpi(&exp_N, N), 0);
+    TEST_EQUAL(mbedtls_test_read_mpi(&exp_B, B), 0);
+    TEST_EQUAL(mbedtls_test_read_mpi(&exp_G_y, G_y), 0);
 
     // Convert exp_A to internal representation (A+2)/4
-    if( crv_type == MBEDTLS_ECP_TYPE_MONTGOMERY )
-    {
-        TEST_EQUAL( mbedtls_mpi_add_int( &exp_A, &exp_A, 2 ), 0 );
-        TEST_EQUAL( mbedtls_mpi_div_int( &exp_A, NULL, &exp_A, 4 ), 0 );
+    if (crv_type == MBEDTLS_ECP_TYPE_MONTGOMERY) {
+        TEST_EQUAL(mbedtls_mpi_add_int(&exp_A, &exp_A, 2), 0);
+        TEST_EQUAL(mbedtls_mpi_div_int(&exp_A, NULL, &exp_A, 4), 0);
     }
 
     // Load group
-    TEST_EQUAL( mbedtls_ecp_group_load( &grp, id ), 0 );
+    TEST_EQUAL(mbedtls_ecp_group_load(&grp, id), 0);
 
     // Compare group with expected parameters
     // A is NULL for SECPxxxR1 curves
     // B and G_y are NULL for curve25519 and curve448
-    TEST_EQUAL( mbedtls_mpi_cmp_mpi( &exp_P, &grp.P ), 0 );
-    if( *A != 0 )
-        TEST_EQUAL( mbedtls_mpi_cmp_mpi( &exp_A, &grp.A ), 0 );
-    if( *B != 0 )
-        TEST_EQUAL( mbedtls_mpi_cmp_mpi( &exp_B, &grp.B ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_mpi( &exp_G_x, &grp.G.X ), 0 );
-    if( *G_y != 0 )
-        TEST_EQUAL( mbedtls_mpi_cmp_mpi( &exp_G_y, &grp.G.Y ), 0 );
-    TEST_EQUAL( mbedtls_mpi_cmp_mpi( &exp_N, &grp.N ), 0 );
+    TEST_EQUAL(mbedtls_mpi_cmp_mpi(&exp_P, &grp.P), 0);
+    if (*A != 0) {
+        TEST_EQUAL(mbedtls_mpi_cmp_mpi(&exp_A, &grp.A), 0);
+    }
+    if (*B != 0) {
+        TEST_EQUAL(mbedtls_mpi_cmp_mpi(&exp_B, &grp.B), 0);
+    }
+    TEST_EQUAL(mbedtls_mpi_cmp_mpi(&exp_G_x, &grp.G.X), 0);
+    if (*G_y != 0) {
+        TEST_EQUAL(mbedtls_mpi_cmp_mpi(&exp_G_y, &grp.G.Y), 0);
+    }
+    TEST_EQUAL(mbedtls_mpi_cmp_mpi(&exp_N, &grp.N), 0);
 
     // Load curve info and compare with known values
-    crv = mbedtls_ecp_curve_info_from_grp_id( id );
-    TEST_EQUAL( crv->grp_id, id );
-    TEST_EQUAL( crv->bit_size, bit_size );
-    TEST_EQUAL( crv->tls_id, tls_id );
+    crv = mbedtls_ecp_curve_info_from_grp_id(id);
+    TEST_EQUAL(crv->grp_id, id);
+    TEST_EQUAL(crv->bit_size, bit_size);
+    TEST_EQUAL(crv->tls_id, tls_id);
 
     // Load curve from TLS ID and name, and compare IDs
-    crv_tls_id = mbedtls_ecp_curve_info_from_tls_id( crv->tls_id );
-    crv_name = mbedtls_ecp_curve_info_from_name( crv->name );
-    TEST_EQUAL( crv_tls_id->grp_id, id );
-    TEST_EQUAL( crv_name->grp_id, id );
+    crv_tls_id = mbedtls_ecp_curve_info_from_tls_id(crv->tls_id);
+    crv_name = mbedtls_ecp_curve_info_from_name(crv->name);
+    TEST_EQUAL(crv_tls_id->grp_id, id);
+    TEST_EQUAL(crv_name->grp_id, id);
 
     // Validate write_group against test data
-    TEST_EQUAL( mbedtls_ecp_tls_write_group( &grp, &olen,
-                                             buf, sizeof( buf ) ),
-                0 );
-    TEST_EQUAL( mbedtls_test_hexcmp( buf, ecparameters, olen,
-                                     sizeof( ecparameters ) ),
-                0 );
+    TEST_EQUAL(mbedtls_ecp_tls_write_group(&grp, &olen,
+                                           buf, sizeof(buf)),
+               0);
+    TEST_EQUAL(mbedtls_test_hexcmp(buf, ecparameters, olen,
+                                   sizeof(ecparameters)),
+               0);
 
     // Read group from buffer and compare with expected ID
-    TEST_EQUAL( mbedtls_ecp_tls_read_group_id( &read_g_id, &vbuf, olen ),
-                0 );
-    TEST_EQUAL( read_g_id, id );
+    TEST_EQUAL(mbedtls_ecp_tls_read_group_id(&read_g_id, &vbuf, olen),
+               0);
+    TEST_EQUAL(read_g_id, id);
     vbuf = buf;
-    TEST_EQUAL( mbedtls_ecp_tls_read_group( &grp_read, &vbuf, olen ),
-                0 );
-    TEST_EQUAL( grp_read.id, id );
+    TEST_EQUAL(mbedtls_ecp_tls_read_group(&grp_read, &vbuf, olen),
+               0);
+    TEST_EQUAL(grp_read.id, id);
 
     // Check curve type, and if it can be used for ECDH/ECDSA
-    TEST_EQUAL( mbedtls_ecp_get_type( &grp ), crv_type );
-    TEST_EQUAL( mbedtls_ecdh_can_do( id ), 1 );
-    TEST_EQUAL( mbedtls_ecdsa_can_do( id ),
-                crv_type == MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS );
+    TEST_EQUAL(mbedtls_ecp_get_type(&grp), crv_type);
+    TEST_EQUAL(mbedtls_ecdh_can_do(id), 1);
+    TEST_EQUAL(mbedtls_ecdsa_can_do(id),
+               crv_type == MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS);
 
     // Copy group and compare with original
-    TEST_EQUAL( mbedtls_ecp_group_copy( &grp_cpy, &grp ), 0 );
-    TEST_EQUAL( mbedtls_ecp_group_cmp( &grp, &grp_cpy ), 0 );
+    TEST_EQUAL(mbedtls_ecp_group_copy(&grp_cpy, &grp), 0);
+    TEST_EQUAL(mbedtls_ecp_group_cmp(&grp, &grp_cpy), 0);
 
     // Check curve is in curve list and group ID list
-    for( crv = mbedtls_ecp_curve_list(  );
-          crv->grp_id != MBEDTLS_ECP_DP_NONE &&
-          crv->grp_id != (unsigned) id;
-          crv++ );
-    TEST_EQUAL( crv->grp_id, id );
-    for( g_id = mbedtls_ecp_grp_id_list(  );
+    for (crv = mbedtls_ecp_curve_list();
+         crv->grp_id != MBEDTLS_ECP_DP_NONE &&
+         crv->grp_id != (unsigned) id;
+         crv++) {
+        ;
+    }
+    TEST_EQUAL(crv->grp_id, id);
+    for (g_id = mbedtls_ecp_grp_id_list();
          *g_id != MBEDTLS_ECP_DP_NONE && *g_id != (unsigned) id;
-         g_id++ );
-    TEST_EQUAL( *g_id, (unsigned) id );
+         g_id++) {
+        ;
+    }
+    TEST_EQUAL(*g_id, (unsigned) id);
 
 exit:
-    mbedtls_ecp_group_free( &grp ); mbedtls_ecp_group_free( &grp_cpy );
-    mbedtls_ecp_group_free( &grp_read );
-    mbedtls_mpi_free( &exp_P ); mbedtls_mpi_free( &exp_A );
-    mbedtls_mpi_free( &exp_B ); mbedtls_mpi_free( &exp_G_x );
-    mbedtls_mpi_free( &exp_G_y ); mbedtls_mpi_free( &exp_N );
+    mbedtls_ecp_group_free(&grp); mbedtls_ecp_group_free(&grp_cpy);
+    mbedtls_ecp_group_free(&grp_read);
+    mbedtls_mpi_free(&exp_P); mbedtls_mpi_free(&exp_A);
+    mbedtls_mpi_free(&exp_B); mbedtls_mpi_free(&exp_G_x);
+    mbedtls_mpi_free(&exp_G_y); mbedtls_mpi_free(&exp_N);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_ecp_check_privkey( int id, char * key_hex, int ret )
+void mbedtls_ecp_check_privkey(int id, char *key_hex, int ret)
 {
     mbedtls_ecp_group grp;
     mbedtls_mpi d;
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_mpi_init( &d );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_mpi_init(&d);
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &d, key_hex ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&d, key_hex) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_check_privkey( &grp, &d ) == ret );
+    TEST_ASSERT(mbedtls_ecp_check_privkey(&grp, &d) == ret);
 
 exit:
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_mpi_free( &d );
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_mpi_free(&d);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_ecp_check_pub_priv( int id_pub, char * Qx_pub, char * Qy_pub,
-                                 int id, char * d, char * Qx, char * Qy,
-                                 int ret )
+void mbedtls_ecp_check_pub_priv(int id_pub, char *Qx_pub, char *Qy_pub,
+                                int id, char *d, char *Qx, char *Qy,
+                                int ret)
 {
     mbedtls_ecp_keypair pub, prv;
 
-    mbedtls_ecp_keypair_init( &pub );
-    mbedtls_ecp_keypair_init( &prv );
+    mbedtls_ecp_keypair_init(&pub);
+    mbedtls_ecp_keypair_init(&prv);
 
-    if( id_pub != MBEDTLS_ECP_DP_NONE )
-        TEST_ASSERT( mbedtls_ecp_group_load( &pub.grp, id_pub ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_point_read_string( &pub.Q, 16, Qx_pub, Qy_pub ) == 0 );
+    if (id_pub != MBEDTLS_ECP_DP_NONE) {
+        TEST_ASSERT(mbedtls_ecp_group_load(&pub.grp, id_pub) == 0);
+    }
+    TEST_ASSERT(mbedtls_ecp_point_read_string(&pub.Q, 16, Qx_pub, Qy_pub) == 0);
 
-    if( id != MBEDTLS_ECP_DP_NONE )
-        TEST_ASSERT( mbedtls_ecp_group_load( &prv.grp, id ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_point_read_string( &prv.Q, 16, Qx, Qy ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &prv.d, d ) == 0 );
+    if (id != MBEDTLS_ECP_DP_NONE) {
+        TEST_ASSERT(mbedtls_ecp_group_load(&prv.grp, id) == 0);
+    }
+    TEST_ASSERT(mbedtls_ecp_point_read_string(&prv.Q, 16, Qx, Qy) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&prv.d, d) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_check_pub_priv( &pub, &prv ) == ret );
+    TEST_ASSERT(mbedtls_ecp_check_pub_priv(&pub, &prv) == ret);
 
 exit:
-    mbedtls_ecp_keypair_free( &pub );
-    mbedtls_ecp_keypair_free( &prv );
+    mbedtls_ecp_keypair_free(&pub);
+    mbedtls_ecp_keypair_free(&prv);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_ecp_gen_keypair( int id )
+void mbedtls_ecp_gen_keypair(int id)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point Q;
     mbedtls_mpi d;
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_point_init( &Q );
-    mbedtls_mpi_init( &d );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_point_init(&Q);
+    mbedtls_mpi_init(&d);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_gen_keypair( &grp, &d, &Q,
-                                          &mbedtls_test_rnd_pseudo_rand,
-                                          &rnd_info ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_gen_keypair(&grp, &d, &Q,
+                                        &mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &grp, &Q ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_check_privkey( &grp, &d ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&grp, &Q) == 0);
+    TEST_ASSERT(mbedtls_ecp_check_privkey(&grp, &d) == 0);
 
 exit:
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_ecp_point_free( &Q );
-    mbedtls_mpi_free( &d );
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_ecp_point_free(&Q);
+    mbedtls_mpi_free(&d);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_ecp_gen_key( int id )
+void mbedtls_ecp_gen_key(int id)
 {
     mbedtls_ecp_keypair key;
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    mbedtls_ecp_keypair_init( &key );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    mbedtls_ecp_keypair_init(&key);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    TEST_ASSERT( mbedtls_ecp_gen_key( id, &key,
-                                      &mbedtls_test_rnd_pseudo_rand,
-                                      &rnd_info ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_gen_key(id, &key,
+                                    &mbedtls_test_rnd_pseudo_rand,
+                                    &rnd_info) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_check_pubkey( &key.grp, &key.Q ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_check_privkey( &key.grp, &key.d ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_check_pubkey(&key.grp, &key.Q) == 0);
+    TEST_ASSERT(mbedtls_ecp_check_privkey(&key.grp, &key.d) == 0);
 
 exit:
-    mbedtls_ecp_keypair_free( &key );
+    mbedtls_ecp_keypair_free(&key);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_ecp_read_key( int grp_id, data_t* in_key, int expected, int canonical )
+void mbedtls_ecp_read_key(int grp_id, data_t *in_key, int expected, int canonical)
 {
     int ret = 0;
     mbedtls_ecp_keypair key;
     mbedtls_ecp_keypair key2;
 
-    mbedtls_ecp_keypair_init( &key );
-    mbedtls_ecp_keypair_init( &key2 );
+    mbedtls_ecp_keypair_init(&key);
+    mbedtls_ecp_keypair_init(&key2);
 
-    ret = mbedtls_ecp_read_key( grp_id, &key, in_key->x, in_key->len );
-    TEST_ASSERT( ret == expected );
+    ret = mbedtls_ecp_read_key(grp_id, &key, in_key->x, in_key->len);
+    TEST_ASSERT(ret == expected);
 
-    if( expected == 0 )
-    {
-        ret = mbedtls_ecp_check_privkey( &key.grp, &key.d );
-        TEST_ASSERT( ret == 0 );
+    if (expected == 0) {
+        ret = mbedtls_ecp_check_privkey(&key.grp, &key.d);
+        TEST_ASSERT(ret == 0);
 
-        if( canonical )
-        {
+        if (canonical) {
             unsigned char buf[MBEDTLS_ECP_MAX_BYTES];
 
-            ret = mbedtls_ecp_write_key( &key, buf, in_key->len );
-            TEST_ASSERT( ret == 0 );
+            ret = mbedtls_ecp_write_key(&key, buf, in_key->len);
+            TEST_ASSERT(ret == 0);
 
-            ASSERT_COMPARE( in_key->x, in_key->len,
-                            buf, in_key->len );
-        }
-        else
-        {
+            ASSERT_COMPARE(in_key->x, in_key->len,
+                           buf, in_key->len);
+        } else {
             unsigned char export1[MBEDTLS_ECP_MAX_BYTES];
             unsigned char export2[MBEDTLS_ECP_MAX_BYTES];
 
-            ret = mbedtls_ecp_write_key( &key, export1, in_key->len );
-            TEST_ASSERT( ret == 0 );
+            ret = mbedtls_ecp_write_key(&key, export1, in_key->len);
+            TEST_ASSERT(ret == 0);
 
-            ret = mbedtls_ecp_read_key( grp_id, &key2, export1, in_key->len );
-            TEST_ASSERT( ret == expected );
+            ret = mbedtls_ecp_read_key(grp_id, &key2, export1, in_key->len);
+            TEST_ASSERT(ret == expected);
 
-            ret = mbedtls_ecp_write_key( &key2, export2, in_key->len );
-            TEST_ASSERT( ret == 0 );
+            ret = mbedtls_ecp_write_key(&key2, export2, in_key->len);
+            TEST_ASSERT(ret == 0);
 
-            ASSERT_COMPARE( export1, in_key->len,
-                            export2, in_key->len );
+            ASSERT_COMPARE(export1, in_key->len,
+                           export2, in_key->len);
         }
     }
 
 exit:
-    mbedtls_ecp_keypair_free( &key );
-    mbedtls_ecp_keypair_free( &key2 );
+    mbedtls_ecp_keypair_free(&key);
+    mbedtls_ecp_keypair_free(&key2);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:HAVE_FIX_NEGATIVE */
-void fix_negative( data_t *N_bin, int c, int bits )
+void fix_negative(data_t *N_bin, int c, int bits)
 {
     mbedtls_mpi C, M, N;
 
-    mbedtls_mpi_init( &C );
-    mbedtls_mpi_init( &M );
-    mbedtls_mpi_init( &N );
+    mbedtls_mpi_init(&C);
+    mbedtls_mpi_init(&M);
+    mbedtls_mpi_init(&N);
 
     /* C = - c * 2^bits (positive since c is negative) */
-    TEST_EQUAL( 0, mbedtls_mpi_lset( &C, -c ) );
-    TEST_EQUAL( 0, mbedtls_mpi_shift_l( &C, bits ) );
+    TEST_EQUAL(0, mbedtls_mpi_lset(&C, -c));
+    TEST_EQUAL(0, mbedtls_mpi_shift_l(&C, bits));
 
-    TEST_EQUAL( 0, mbedtls_mpi_read_binary( &N, N_bin->x, N_bin->len ) );
-    TEST_EQUAL( 0, mbedtls_mpi_grow( &N, C.n ) );
+    TEST_EQUAL(0, mbedtls_mpi_read_binary(&N, N_bin->x, N_bin->len));
+    TEST_EQUAL(0, mbedtls_mpi_grow(&N, C.n));
 
     /* M = N - C = - ( C - N ) (expected result of fix_negative) */
-    TEST_EQUAL( 0, mbedtls_mpi_sub_mpi( &M, &N, &C ) );
+    TEST_EQUAL(0, mbedtls_mpi_sub_mpi(&M, &N, &C));
 
-    mbedtls_ecp_fix_negative( &N, c, bits );
+    mbedtls_ecp_fix_negative(&N, c, bits);
 
-    TEST_EQUAL( 0, mbedtls_mpi_cmp_mpi( &N, &M ) );
+    TEST_EQUAL(0, mbedtls_mpi_cmp_mpi(&N, &M));
 
 exit:
-    mbedtls_mpi_free( &C );
-    mbedtls_mpi_free( &M );
-    mbedtls_mpi_free( &N );
+    mbedtls_mpi_free(&C);
+    mbedtls_mpi_free(&M);
+    mbedtls_mpi_free(&N);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_TEST_HOOKS:MBEDTLS_ECP_MONTGOMERY_ENABLED */
-void genkey_mx_known_answer( int bits, data_t *seed, data_t *expected )
+void genkey_mx_known_answer(int bits, data_t *seed, data_t *expected)
 {
     mbedtls_test_rnd_buf_info rnd_info;
     mbedtls_mpi d;
     int ret;
     uint8_t *actual = NULL;
 
-    mbedtls_mpi_init( &d );
+    mbedtls_mpi_init(&d);
     rnd_info.buf = seed->x;
     rnd_info.length = seed->len;
     rnd_info.fallback_f_rng = NULL;
     rnd_info.fallback_p_rng = NULL;
 
-    ASSERT_ALLOC( actual, expected->len );
+    ASSERT_ALLOC(actual, expected->len);
 
-    ret = mbedtls_ecp_gen_privkey_mx( bits, &d,
-                                      mbedtls_test_rnd_buffer_rand, &rnd_info );
+    ret = mbedtls_ecp_gen_privkey_mx(bits, &d,
+                                     mbedtls_test_rnd_buffer_rand, &rnd_info);
 
-    if( expected->len == 0 )
-    {
+    if (expected->len == 0) {
         /* Expecting an error (happens if there isn't enough randomness) */
-        TEST_ASSERT( ret != 0 );
-    }
-    else
-    {
-        TEST_EQUAL( ret, 0 );
-        TEST_EQUAL( (size_t) bits + 1, mbedtls_mpi_bitlen( &d ) );
-        TEST_EQUAL( 0, mbedtls_mpi_write_binary( &d, actual, expected->len ) );
+        TEST_ASSERT(ret != 0);
+    } else {
+        TEST_EQUAL(ret, 0);
+        TEST_EQUAL((size_t) bits + 1, mbedtls_mpi_bitlen(&d));
+        TEST_EQUAL(0, mbedtls_mpi_write_binary(&d, actual, expected->len));
         /* Test the exact result. This assumes that the output of the
          * RNG is used in a specific way, which is overly constraining.
          * The advantage is that it's easier to test the expected properties
@@ -1442,109 +1447,109 @@
          *   (can be enforced by checking these bits).
          * - Other bits must be random (by testing with different RNG outputs,
          *   we validate that those bits are indeed influenced by the RNG). */
-        ASSERT_COMPARE( expected->x, expected->len,
-                        actual, expected->len );
+        ASSERT_COMPARE(expected->x, expected->len,
+                       actual, expected->len);
     }
 
 exit:
-    mbedtls_free( actual );
-    mbedtls_mpi_free( &d );
+    mbedtls_free(actual);
+    mbedtls_mpi_free(&d);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecp_set_zero( int id, data_t * P_bin )
+void ecp_set_zero(int id, data_t *P_bin)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point pt, zero_pt, nonzero_pt;
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecp_point_init( &pt );
-    mbedtls_ecp_point_init( &zero_pt );
-    mbedtls_ecp_point_init( &nonzero_pt );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecp_point_init(&pt);
+    mbedtls_ecp_point_init(&zero_pt);
+    mbedtls_ecp_point_init(&nonzero_pt);
 
     // Set zero and non-zero points for comparison
-    TEST_EQUAL( mbedtls_ecp_set_zero( &zero_pt ), 0 );
-    TEST_EQUAL( mbedtls_ecp_group_load( &grp, id ), 0 );
-    TEST_EQUAL( mbedtls_ecp_point_read_binary( &grp, &nonzero_pt,
-                                               P_bin->x, P_bin->len ), 0 );
-    TEST_EQUAL( mbedtls_ecp_is_zero( &zero_pt ), 1 );
-    TEST_EQUAL( mbedtls_ecp_is_zero( &nonzero_pt ), 0 );
+    TEST_EQUAL(mbedtls_ecp_set_zero(&zero_pt), 0);
+    TEST_EQUAL(mbedtls_ecp_group_load(&grp, id), 0);
+    TEST_EQUAL(mbedtls_ecp_point_read_binary(&grp, &nonzero_pt,
+                                             P_bin->x, P_bin->len), 0);
+    TEST_EQUAL(mbedtls_ecp_is_zero(&zero_pt), 1);
+    TEST_EQUAL(mbedtls_ecp_is_zero(&nonzero_pt), 0);
 
     // Test initialized point
-    TEST_EQUAL( mbedtls_ecp_set_zero( &pt ), 0 );
-    TEST_EQUAL( mbedtls_ecp_is_zero( &pt ), 1 );
-    TEST_EQUAL( mbedtls_ecp_point_cmp( &zero_pt, &pt ), 0 );
-    TEST_EQUAL( mbedtls_ecp_point_cmp( &nonzero_pt, &zero_pt ),
-                MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
+    TEST_EQUAL(mbedtls_ecp_set_zero(&pt), 0);
+    TEST_EQUAL(mbedtls_ecp_is_zero(&pt), 1);
+    TEST_EQUAL(mbedtls_ecp_point_cmp(&zero_pt, &pt), 0);
+    TEST_EQUAL(mbedtls_ecp_point_cmp(&nonzero_pt, &zero_pt),
+               MBEDTLS_ERR_ECP_BAD_INPUT_DATA);
 
     // Test zeroed point
-    TEST_EQUAL( mbedtls_ecp_set_zero( &pt ), 0 );
-    TEST_EQUAL( mbedtls_ecp_is_zero( &pt ), 1 );
-    TEST_EQUAL( mbedtls_ecp_point_cmp( &zero_pt, &pt ), 0 );
-    TEST_EQUAL( mbedtls_ecp_point_cmp( &nonzero_pt, &pt ),
-                MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
+    TEST_EQUAL(mbedtls_ecp_set_zero(&pt), 0);
+    TEST_EQUAL(mbedtls_ecp_is_zero(&pt), 1);
+    TEST_EQUAL(mbedtls_ecp_point_cmp(&zero_pt, &pt), 0);
+    TEST_EQUAL(mbedtls_ecp_point_cmp(&nonzero_pt, &pt),
+               MBEDTLS_ERR_ECP_BAD_INPUT_DATA);
 
     // Set point to non-zero value
-    TEST_EQUAL( mbedtls_ecp_point_read_binary( &grp, &pt,
-                                               P_bin->x, P_bin->len ), 0 );
-    TEST_EQUAL( mbedtls_ecp_is_zero( &pt ), 0 );
-    TEST_EQUAL( mbedtls_ecp_point_cmp( &zero_pt, &pt ),
-                MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
-    TEST_EQUAL( mbedtls_ecp_point_cmp( &nonzero_pt, &pt), 0 );
+    TEST_EQUAL(mbedtls_ecp_point_read_binary(&grp, &pt,
+                                             P_bin->x, P_bin->len), 0);
+    TEST_EQUAL(mbedtls_ecp_is_zero(&pt), 0);
+    TEST_EQUAL(mbedtls_ecp_point_cmp(&zero_pt, &pt),
+               MBEDTLS_ERR_ECP_BAD_INPUT_DATA);
+    TEST_EQUAL(mbedtls_ecp_point_cmp(&nonzero_pt, &pt), 0);
 
     // Test non-zero point
-    TEST_EQUAL( mbedtls_ecp_set_zero( &pt ), 0 );
-    TEST_EQUAL( mbedtls_ecp_is_zero( &pt ), 1 );
-    TEST_EQUAL( mbedtls_ecp_point_cmp( &zero_pt, &pt ), 0 );
-    TEST_EQUAL( mbedtls_ecp_point_cmp( &nonzero_pt, &pt ),
-                MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
+    TEST_EQUAL(mbedtls_ecp_set_zero(&pt), 0);
+    TEST_EQUAL(mbedtls_ecp_is_zero(&pt), 1);
+    TEST_EQUAL(mbedtls_ecp_point_cmp(&zero_pt, &pt), 0);
+    TEST_EQUAL(mbedtls_ecp_point_cmp(&nonzero_pt, &pt),
+               MBEDTLS_ERR_ECP_BAD_INPUT_DATA);
 
     // Test freed non-zero point
-    TEST_EQUAL( mbedtls_ecp_point_read_binary( &grp, &pt,
-                                               P_bin->x, P_bin->len ), 0 );
-    mbedtls_ecp_point_free( &pt );
-    TEST_EQUAL( mbedtls_ecp_set_zero( &pt ), 0 );
-    TEST_EQUAL( mbedtls_ecp_is_zero( &pt ), 1 );
-    TEST_EQUAL( mbedtls_ecp_point_cmp( &zero_pt, &pt ), 0 );
-    TEST_EQUAL( mbedtls_ecp_point_cmp( &nonzero_pt, &pt),
-                MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
+    TEST_EQUAL(mbedtls_ecp_point_read_binary(&grp, &pt,
+                                             P_bin->x, P_bin->len), 0);
+    mbedtls_ecp_point_free(&pt);
+    TEST_EQUAL(mbedtls_ecp_set_zero(&pt), 0);
+    TEST_EQUAL(mbedtls_ecp_is_zero(&pt), 1);
+    TEST_EQUAL(mbedtls_ecp_point_cmp(&zero_pt, &pt), 0);
+    TEST_EQUAL(mbedtls_ecp_point_cmp(&nonzero_pt, &pt),
+               MBEDTLS_ERR_ECP_BAD_INPUT_DATA);
 
 exit:
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_ecp_point_free( &pt );
-    mbedtls_ecp_point_free( &zero_pt );
-    mbedtls_ecp_point_free( &nonzero_pt );
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_ecp_point_free(&pt);
+    mbedtls_ecp_point_free(&zero_pt);
+    mbedtls_ecp_point_free(&nonzero_pt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void ecp_selftest(  )
+void ecp_selftest()
 {
-    TEST_ASSERT( mbedtls_ecp_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_self_test(1) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ecp_check_order( int id, char * expected_order_hex )
+void ecp_check_order(int id, char *expected_order_hex)
 {
     mbedtls_ecp_group grp;
     mbedtls_mpi expected_n;
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_mpi_init( &expected_n );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_mpi_init(&expected_n);
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &expected_n, expected_order_hex ) == 0);
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&expected_n, expected_order_hex) == 0);
 
     // check sign bits are well-formed (i.e. 1 or -1) - see #5810
-    TEST_ASSERT( grp.N.s == -1 || grp.N.s == 1);
-    TEST_ASSERT( expected_n.s == -1 || expected_n.s == 1);
+    TEST_ASSERT(grp.N.s == -1 || grp.N.s == 1);
+    TEST_ASSERT(expected_n.s == -1 || expected_n.s == 1);
 
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &grp.N, &expected_n ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&grp.N, &expected_n) == 0);
 
 exit:
-    mbedtls_ecp_group_free( &grp );
-    mbedtls_mpi_free( &expected_n );
+    mbedtls_ecp_group_free(&grp);
+    mbedtls_mpi_free(&expected_n);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_entropy.function b/tests/suites/test_suite_entropy.function
index e5e88bb..b04ed54 100644
--- a/tests/suites/test_suite_entropy.function
+++ b/tests/suites/test_suite_entropy.function
@@ -4,15 +4,13 @@
 #include "mbedtls/md.h"
 #include "string.h"
 
-typedef enum
-{
+typedef enum {
     DUMMY_CONSTANT_LENGTH, /* Output context->length bytes */
     DUMMY_REQUESTED_LENGTH, /* Output whatever length was requested */
     DUMMY_FAIL, /* Return an error code */
 } entropy_dummy_instruction;
 
-typedef struct
-{
+typedef struct {
     entropy_dummy_instruction instruction;
     size_t length; /* Length to return for DUMMY_CONSTANT_LENGTH */
     size_t calls; /* Incremented at each call */
@@ -24,14 +22,13 @@
  * If data is NULL, write exactly the requested length.
  * Otherwise, write the length indicated by data or error if negative
  */
-static int entropy_dummy_source( void *arg, unsigned char *output,
-                                 size_t len, size_t *olen )
+static int entropy_dummy_source(void *arg, unsigned char *output,
+                                size_t len, size_t *olen)
 {
     entropy_dummy_context *context = arg;
     ++context->calls;
 
-    switch( context->instruction )
-    {
+    switch (context->instruction) {
         case DUMMY_CONSTANT_LENGTH:
             *olen = context->length;
             break;
@@ -39,11 +36,11 @@
             *olen = len;
             break;
         case DUMMY_FAIL:
-            return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
+            return MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
     }
 
-    memset( output, 0x2a, *olen );
-    return( 0 );
+    memset(output, 0x2a, *olen);
+    return 0;
 }
 
 /*
@@ -57,7 +54,7 @@
  * This might break memory checks in the future if sources need 'free-ing' then
  * as well.
  */
-static void entropy_clear_sources( mbedtls_entropy_context *ctx )
+static void entropy_clear_sources(mbedtls_entropy_context *ctx)
 {
     ctx->source_count = 0;
 }
@@ -68,63 +65,71 @@
  */
 static unsigned char buffer_seed[MBEDTLS_ENTROPY_BLOCK_SIZE];
 
-int buffer_nv_seed_read( unsigned char *buf, size_t buf_len )
+int buffer_nv_seed_read(unsigned char *buf, size_t buf_len)
 {
-    if( buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE )
-        return( -1 );
+    if (buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE) {
+        return -1;
+    }
 
-    memcpy( buf, buffer_seed, MBEDTLS_ENTROPY_BLOCK_SIZE );
-    return( 0 );
+    memcpy(buf, buffer_seed, MBEDTLS_ENTROPY_BLOCK_SIZE);
+    return 0;
 }
 
-int buffer_nv_seed_write( unsigned char *buf, size_t buf_len )
+int buffer_nv_seed_write(unsigned char *buf, size_t buf_len)
 {
-    if( buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE )
-        return( -1 );
+    if (buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE) {
+        return -1;
+    }
 
-    memcpy( buffer_seed, buf, MBEDTLS_ENTROPY_BLOCK_SIZE );
-    return( 0 );
+    memcpy(buffer_seed, buf, MBEDTLS_ENTROPY_BLOCK_SIZE);
+    return 0;
 }
 
 /*
  * NV seed read/write helpers that fill the base seedfile
  */
-static int write_nv_seed( unsigned char *buf, size_t buf_len )
+static int write_nv_seed(unsigned char *buf, size_t buf_len)
 {
     FILE *f;
 
-    if( buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE )
-        return( -1 );
+    if (buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE) {
+        return -1;
+    }
 
-    if( ( f = fopen( MBEDTLS_PLATFORM_STD_NV_SEED_FILE, "w" ) ) == NULL )
-        return( -1 );
+    if ((f = fopen(MBEDTLS_PLATFORM_STD_NV_SEED_FILE, "w")) == NULL) {
+        return -1;
+    }
 
-    if( fwrite( buf, 1, MBEDTLS_ENTROPY_BLOCK_SIZE, f ) !=
-                    MBEDTLS_ENTROPY_BLOCK_SIZE )
-        return( -1 );
+    if (fwrite(buf, 1, MBEDTLS_ENTROPY_BLOCK_SIZE, f) !=
+        MBEDTLS_ENTROPY_BLOCK_SIZE) {
+        return -1;
+    }
 
-    fclose( f );
+    fclose(f);
 
-    return( 0 );
+    return 0;
 }
 
-int read_nv_seed( unsigned char *buf, size_t buf_len )
+int read_nv_seed(unsigned char *buf, size_t buf_len)
 {
     FILE *f;
 
-    if( buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE )
-        return( -1 );
+    if (buf_len != MBEDTLS_ENTROPY_BLOCK_SIZE) {
+        return -1;
+    }
 
-    if( ( f = fopen( MBEDTLS_PLATFORM_STD_NV_SEED_FILE, "rb" ) ) == NULL )
-        return( -1 );
+    if ((f = fopen(MBEDTLS_PLATFORM_STD_NV_SEED_FILE, "rb")) == NULL) {
+        return -1;
+    }
 
-    if( fread( buf, 1, MBEDTLS_ENTROPY_BLOCK_SIZE, f ) !=
-                    MBEDTLS_ENTROPY_BLOCK_SIZE )
-        return( -1 );
+    if (fread(buf, 1, MBEDTLS_ENTROPY_BLOCK_SIZE, f) !=
+        MBEDTLS_ENTROPY_BLOCK_SIZE) {
+        return -1;
+    }
 
-    fclose( f );
+    fclose(f);
 
-    return( 0 );
+    return 0;
 }
 #endif /* MBEDTLS_ENTROPY_NV_SEED */
 /* END_HEADER */
@@ -135,7 +140,7 @@
  */
 
 /* BEGIN_CASE */
-void entropy_init_free( int reinit )
+void entropy_init_free(int reinit)
 {
     mbedtls_entropy_context ctx;
 
@@ -143,12 +148,13 @@
      * to call mbedtls_entropy_free() unconditionally on an error path without
      * checking whether it has already been called in the success path. */
 
-    mbedtls_entropy_init( &ctx );
-    mbedtls_entropy_free( &ctx );
+    mbedtls_entropy_init(&ctx);
+    mbedtls_entropy_free(&ctx);
 
-    if( reinit )
-        mbedtls_entropy_init( &ctx );
-    mbedtls_entropy_free( &ctx );
+    if (reinit) {
+        mbedtls_entropy_init(&ctx);
+    }
+    mbedtls_entropy_free(&ctx);
 
     /* This test case always succeeds, functionally speaking. A plausible
      * bug might trigger an invalid pointer dereference or a memory leak. */
@@ -157,189 +163,190 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_NV_SEED:MBEDTLS_FS_IO */
-void entropy_seed_file( char * path, int ret )
+void entropy_seed_file(char *path, int ret)
 {
     mbedtls_entropy_context ctx;
 
-    mbedtls_entropy_init( &ctx );
+    mbedtls_entropy_init(&ctx);
 
-    TEST_ASSERT( mbedtls_entropy_write_seed_file( &ctx, path ) == ret );
-    TEST_ASSERT( mbedtls_entropy_update_seed_file( &ctx, path ) == ret );
+    TEST_ASSERT(mbedtls_entropy_write_seed_file(&ctx, path) == ret);
+    TEST_ASSERT(mbedtls_entropy_update_seed_file(&ctx, path) == ret);
 
 exit:
-    mbedtls_entropy_free( &ctx );
+    mbedtls_entropy_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_NV_SEED:MBEDTLS_FS_IO */
-void entropy_write_base_seed_file( int ret )
+void entropy_write_base_seed_file(int ret)
 {
     mbedtls_entropy_context ctx;
 
-    mbedtls_entropy_init( &ctx );
+    mbedtls_entropy_init(&ctx);
 
-    TEST_ASSERT( mbedtls_entropy_write_seed_file( &ctx, MBEDTLS_PLATFORM_STD_NV_SEED_FILE ) == ret );
-    TEST_ASSERT( mbedtls_entropy_update_seed_file( &ctx, MBEDTLS_PLATFORM_STD_NV_SEED_FILE ) == ret );
+    TEST_ASSERT(mbedtls_entropy_write_seed_file(&ctx, MBEDTLS_PLATFORM_STD_NV_SEED_FILE) == ret);
+    TEST_ASSERT(mbedtls_entropy_update_seed_file(&ctx, MBEDTLS_PLATFORM_STD_NV_SEED_FILE) == ret);
 
 exit:
-    mbedtls_entropy_free( &ctx );
+    mbedtls_entropy_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void entropy_no_sources( )
+void entropy_no_sources()
 {
     mbedtls_entropy_context ctx;
     unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE];
 
-    mbedtls_entropy_init( &ctx );
-    entropy_clear_sources( &ctx );
-    TEST_EQUAL( mbedtls_entropy_func( &ctx, buf, sizeof( buf ) ),
-                MBEDTLS_ERR_ENTROPY_NO_SOURCES_DEFINED );
+    mbedtls_entropy_init(&ctx);
+    entropy_clear_sources(&ctx);
+    TEST_EQUAL(mbedtls_entropy_func(&ctx, buf, sizeof(buf)),
+               MBEDTLS_ERR_ENTROPY_NO_SOURCES_DEFINED);
 
 exit:
-    mbedtls_entropy_free( &ctx );
+    mbedtls_entropy_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void entropy_too_many_sources(  )
+void entropy_too_many_sources()
 {
     mbedtls_entropy_context ctx;
     size_t i;
-    entropy_dummy_context dummy = {DUMMY_REQUESTED_LENGTH, 0, 0};
+    entropy_dummy_context dummy = { DUMMY_REQUESTED_LENGTH, 0, 0 };
 
-    mbedtls_entropy_init( &ctx );
+    mbedtls_entropy_init(&ctx);
 
     /*
      * It's hard to tell precisely when the error will occur,
      * since we don't know how many sources were automatically added.
      */
-    for( i = 0; i < MBEDTLS_ENTROPY_MAX_SOURCES; i++ )
-        (void) mbedtls_entropy_add_source( &ctx, entropy_dummy_source, &dummy,
-                                           16, MBEDTLS_ENTROPY_SOURCE_WEAK );
+    for (i = 0; i < MBEDTLS_ENTROPY_MAX_SOURCES; i++) {
+        (void) mbedtls_entropy_add_source(&ctx, entropy_dummy_source, &dummy,
+                                          16, MBEDTLS_ENTROPY_SOURCE_WEAK);
+    }
 
-    TEST_ASSERT( mbedtls_entropy_add_source( &ctx, entropy_dummy_source, &dummy,
-                                             16, MBEDTLS_ENTROPY_SOURCE_WEAK )
-                 == MBEDTLS_ERR_ENTROPY_MAX_SOURCES );
+    TEST_ASSERT(mbedtls_entropy_add_source(&ctx, entropy_dummy_source, &dummy,
+                                           16, MBEDTLS_ENTROPY_SOURCE_WEAK)
+                == MBEDTLS_ERR_ENTROPY_MAX_SOURCES);
 
 exit:
-    mbedtls_entropy_free( &ctx );
+    mbedtls_entropy_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:ENTROPY_HAVE_STRONG */
-void entropy_func_len( int len, int ret )
+void entropy_func_len(int len, int ret)
 {
     mbedtls_entropy_context ctx;
     unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE + 10] = { 0 };
     unsigned char acc[MBEDTLS_ENTROPY_BLOCK_SIZE + 10] = { 0 };
     size_t i, j;
 
-    mbedtls_entropy_init( &ctx );
+    mbedtls_entropy_init(&ctx);
 
     /*
      * See comments in mbedtls_entropy_self_test()
      */
-    for( i = 0; i < 8; i++ )
-    {
-        TEST_ASSERT( mbedtls_entropy_func( &ctx, buf, len ) == ret );
-        for( j = 0; j < sizeof( buf ); j++ )
+    for (i = 0; i < 8; i++) {
+        TEST_ASSERT(mbedtls_entropy_func(&ctx, buf, len) == ret);
+        for (j = 0; j < sizeof(buf); j++) {
             acc[j] |= buf[j];
+        }
     }
 
-    if( ret == 0 )
-        for( j = 0; j < (size_t) len; j++ )
-            TEST_ASSERT( acc[j] != 0 );
+    if (ret == 0) {
+        for (j = 0; j < (size_t) len; j++) {
+            TEST_ASSERT(acc[j] != 0);
+        }
+    }
 
-    for( j = len; j < sizeof( buf ); j++ )
-        TEST_ASSERT( acc[j] == 0 );
+    for (j = len; j < sizeof(buf); j++) {
+        TEST_ASSERT(acc[j] == 0);
+    }
 
 exit:
-    mbedtls_entropy_free( &ctx );
+    mbedtls_entropy_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void entropy_source_fail( char * path )
+void entropy_source_fail(char *path)
 {
     mbedtls_entropy_context ctx;
     unsigned char buf[16];
-    entropy_dummy_context dummy = {DUMMY_FAIL, 0, 0};
+    entropy_dummy_context dummy = { DUMMY_FAIL, 0, 0 };
 
-    mbedtls_entropy_init( &ctx );
+    mbedtls_entropy_init(&ctx);
 
-    TEST_ASSERT( mbedtls_entropy_add_source( &ctx, entropy_dummy_source,
-                                             &dummy, 16,
-                                             MBEDTLS_ENTROPY_SOURCE_WEAK )
-                 == 0 );
+    TEST_ASSERT(mbedtls_entropy_add_source(&ctx, entropy_dummy_source,
+                                           &dummy, 16,
+                                           MBEDTLS_ENTROPY_SOURCE_WEAK)
+                == 0);
 
-    TEST_ASSERT( mbedtls_entropy_func( &ctx, buf, sizeof( buf ) )
-                 == MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
-    TEST_ASSERT( mbedtls_entropy_gather( &ctx )
-                 == MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
+    TEST_ASSERT(mbedtls_entropy_func(&ctx, buf, sizeof(buf))
+                == MBEDTLS_ERR_ENTROPY_SOURCE_FAILED);
+    TEST_ASSERT(mbedtls_entropy_gather(&ctx)
+                == MBEDTLS_ERR_ENTROPY_SOURCE_FAILED);
 #if defined(MBEDTLS_FS_IO) && defined(MBEDTLS_ENTROPY_NV_SEED)
-    TEST_ASSERT( mbedtls_entropy_write_seed_file( &ctx, path )
-                 == MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
-    TEST_ASSERT( mbedtls_entropy_update_seed_file( &ctx, path )
-                 == MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
+    TEST_ASSERT(mbedtls_entropy_write_seed_file(&ctx, path)
+                == MBEDTLS_ERR_ENTROPY_SOURCE_FAILED);
+    TEST_ASSERT(mbedtls_entropy_update_seed_file(&ctx, path)
+                == MBEDTLS_ERR_ENTROPY_SOURCE_FAILED);
 #else
     ((void) path);
 #endif
 
 exit:
-    mbedtls_entropy_free( &ctx );
+    mbedtls_entropy_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void entropy_threshold( int threshold, int chunk_size, int result )
+void entropy_threshold(int threshold, int chunk_size, int result)
 {
     mbedtls_entropy_context ctx;
     entropy_dummy_context strong =
-        {DUMMY_CONSTANT_LENGTH, MBEDTLS_ENTROPY_BLOCK_SIZE, 0};
-    entropy_dummy_context weak = {DUMMY_CONSTANT_LENGTH, chunk_size, 0};
+    { DUMMY_CONSTANT_LENGTH, MBEDTLS_ENTROPY_BLOCK_SIZE, 0 };
+    entropy_dummy_context weak = { DUMMY_CONSTANT_LENGTH, chunk_size, 0 };
     unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE] = { 0 };
     int ret;
 
-    mbedtls_entropy_init( &ctx );
-    entropy_clear_sources( &ctx );
+    mbedtls_entropy_init(&ctx);
+    entropy_clear_sources(&ctx);
 
     /* Set strong source that reaches its threshold immediately and
      * a weak source whose threshold is a test parameter. */
-    TEST_ASSERT( mbedtls_entropy_add_source( &ctx, entropy_dummy_source,
-                                     &strong, 1,
-                                     MBEDTLS_ENTROPY_SOURCE_STRONG ) == 0 );
-    TEST_ASSERT( mbedtls_entropy_add_source( &ctx, entropy_dummy_source,
-                                     &weak, threshold,
-                                     MBEDTLS_ENTROPY_SOURCE_WEAK ) == 0 );
+    TEST_ASSERT(mbedtls_entropy_add_source(&ctx, entropy_dummy_source,
+                                           &strong, 1,
+                                           MBEDTLS_ENTROPY_SOURCE_STRONG) == 0);
+    TEST_ASSERT(mbedtls_entropy_add_source(&ctx, entropy_dummy_source,
+                                           &weak, threshold,
+                                           MBEDTLS_ENTROPY_SOURCE_WEAK) == 0);
 
-    ret = mbedtls_entropy_func( &ctx, buf, sizeof( buf ) );
+    ret = mbedtls_entropy_func(&ctx, buf, sizeof(buf));
 
-    if( result >= 0 )
-    {
-        TEST_ASSERT( ret == 0 );
+    if (result >= 0) {
+        TEST_ASSERT(ret == 0);
 #if defined(MBEDTLS_ENTROPY_NV_SEED)
         /* If the NV seed functionality is enabled, there are two entropy
          * updates: before and after updating the NV seed. */
         result *= 2;
 #endif
-        TEST_ASSERT( weak.calls == (size_t) result );
-    }
-    else
-    {
-        TEST_ASSERT( ret == result );
+        TEST_ASSERT(weak.calls == (size_t) result);
+    } else {
+        TEST_ASSERT(ret == result);
     }
 
 exit:
-    mbedtls_entropy_free( &ctx );
+    mbedtls_entropy_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void entropy_calls( int strength1, int strength2,
-                    int threshold, int chunk_size,
-                    int result )
+void entropy_calls(int strength1, int strength2,
+                   int threshold, int chunk_size,
+                   int result)
 {
     /*
      * if result >= 0: result = expected number of calls to source 1
@@ -347,101 +354,98 @@
      */
 
     mbedtls_entropy_context ctx;
-    entropy_dummy_context dummy1 = {DUMMY_CONSTANT_LENGTH, chunk_size, 0};
-    entropy_dummy_context dummy2 = {DUMMY_CONSTANT_LENGTH, chunk_size, 0};
+    entropy_dummy_context dummy1 = { DUMMY_CONSTANT_LENGTH, chunk_size, 0 };
+    entropy_dummy_context dummy2 = { DUMMY_CONSTANT_LENGTH, chunk_size, 0 };
     unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE] = { 0 };
     int ret;
 
-    mbedtls_entropy_init( &ctx );
-    entropy_clear_sources( &ctx );
+    mbedtls_entropy_init(&ctx);
+    entropy_clear_sources(&ctx);
 
-    TEST_ASSERT( mbedtls_entropy_add_source( &ctx, entropy_dummy_source,
-                                             &dummy1, threshold,
-                                             strength1 ) == 0 );
-    TEST_ASSERT( mbedtls_entropy_add_source( &ctx, entropy_dummy_source,
-                                             &dummy2, threshold,
-                                             strength2 ) == 0 );
+    TEST_ASSERT(mbedtls_entropy_add_source(&ctx, entropy_dummy_source,
+                                           &dummy1, threshold,
+                                           strength1) == 0);
+    TEST_ASSERT(mbedtls_entropy_add_source(&ctx, entropy_dummy_source,
+                                           &dummy2, threshold,
+                                           strength2) == 0);
 
-    ret = mbedtls_entropy_func( &ctx, buf, sizeof( buf ) );
+    ret = mbedtls_entropy_func(&ctx, buf, sizeof(buf));
 
-    if( result >= 0 )
-    {
-        TEST_ASSERT( ret == 0 );
+    if (result >= 0) {
+        TEST_ASSERT(ret == 0);
 #if defined(MBEDTLS_ENTROPY_NV_SEED)
         /* If the NV seed functionality is enabled, there are two entropy
          * updates: before and after updating the NV seed. */
         result *= 2;
 #endif
-        TEST_ASSERT( dummy1.calls == (size_t) result );
-    }
-    else
-    {
-        TEST_ASSERT( ret == result );
+        TEST_ASSERT(dummy1.calls == (size_t) result);
+    } else {
+        TEST_ASSERT(ret == result);
     }
 
 exit:
-    mbedtls_entropy_free( &ctx );
+    mbedtls_entropy_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_NV_SEED:MBEDTLS_FS_IO */
-void nv_seed_file_create(  )
+void nv_seed_file_create()
 {
     unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE];
 
-    memset( buf, 0, MBEDTLS_ENTROPY_BLOCK_SIZE );
+    memset(buf, 0, MBEDTLS_ENTROPY_BLOCK_SIZE);
 
-    TEST_ASSERT( write_nv_seed( buf, MBEDTLS_ENTROPY_BLOCK_SIZE ) == 0 );
+    TEST_ASSERT(write_nv_seed(buf, MBEDTLS_ENTROPY_BLOCK_SIZE) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_NV_SEED:MBEDTLS_FS_IO:MBEDTLS_PLATFORM_NV_SEED_ALT */
-void entropy_nv_seed_std_io(  )
+void entropy_nv_seed_std_io()
 {
     unsigned char io_seed[MBEDTLS_ENTROPY_BLOCK_SIZE];
     unsigned char check_seed[MBEDTLS_ENTROPY_BLOCK_SIZE];
 
-    memset( io_seed, 1, MBEDTLS_ENTROPY_BLOCK_SIZE );
-    memset( check_seed, 0, MBEDTLS_ENTROPY_BLOCK_SIZE );
+    memset(io_seed, 1, MBEDTLS_ENTROPY_BLOCK_SIZE);
+    memset(check_seed, 0, MBEDTLS_ENTROPY_BLOCK_SIZE);
 
-    mbedtls_platform_set_nv_seed( mbedtls_platform_std_nv_seed_read,
-                                  mbedtls_platform_std_nv_seed_write );
+    mbedtls_platform_set_nv_seed(mbedtls_platform_std_nv_seed_read,
+                                 mbedtls_platform_std_nv_seed_write);
 
     /* Check if platform NV read and write manipulate the same data */
-    TEST_ASSERT( write_nv_seed( io_seed, MBEDTLS_ENTROPY_BLOCK_SIZE ) == 0 );
-    TEST_ASSERT( mbedtls_nv_seed_read( check_seed, MBEDTLS_ENTROPY_BLOCK_SIZE ) ==
-                    MBEDTLS_ENTROPY_BLOCK_SIZE );
+    TEST_ASSERT(write_nv_seed(io_seed, MBEDTLS_ENTROPY_BLOCK_SIZE) == 0);
+    TEST_ASSERT(mbedtls_nv_seed_read(check_seed, MBEDTLS_ENTROPY_BLOCK_SIZE) ==
+                MBEDTLS_ENTROPY_BLOCK_SIZE);
 
-    TEST_ASSERT( memcmp( io_seed, check_seed, MBEDTLS_ENTROPY_BLOCK_SIZE ) == 0 );
+    TEST_ASSERT(memcmp(io_seed, check_seed, MBEDTLS_ENTROPY_BLOCK_SIZE) == 0);
 
-    memset( check_seed, 0, MBEDTLS_ENTROPY_BLOCK_SIZE );
+    memset(check_seed, 0, MBEDTLS_ENTROPY_BLOCK_SIZE);
 
     /* Check if platform NV write and raw read manipulate the same data */
-    TEST_ASSERT( mbedtls_nv_seed_write( io_seed, MBEDTLS_ENTROPY_BLOCK_SIZE ) ==
-                    MBEDTLS_ENTROPY_BLOCK_SIZE );
-    TEST_ASSERT( read_nv_seed( check_seed, MBEDTLS_ENTROPY_BLOCK_SIZE ) == 0 );
+    TEST_ASSERT(mbedtls_nv_seed_write(io_seed, MBEDTLS_ENTROPY_BLOCK_SIZE) ==
+                MBEDTLS_ENTROPY_BLOCK_SIZE);
+    TEST_ASSERT(read_nv_seed(check_seed, MBEDTLS_ENTROPY_BLOCK_SIZE) == 0);
 
-    TEST_ASSERT( memcmp( io_seed, check_seed, MBEDTLS_ENTROPY_BLOCK_SIZE ) == 0 );
+    TEST_ASSERT(memcmp(io_seed, check_seed, MBEDTLS_ENTROPY_BLOCK_SIZE) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_MD_C:MBEDTLS_ENTROPY_NV_SEED:MBEDTLS_PLATFORM_NV_SEED_ALT */
-void entropy_nv_seed( data_t * read_seed )
+void entropy_nv_seed(data_t *read_seed)
 {
 #if defined(MBEDTLS_ENTROPY_SHA512_ACCUMULATOR)
     const mbedtls_md_info_t *md_info =
-        mbedtls_md_info_from_type( MBEDTLS_MD_SHA512 );
+        mbedtls_md_info_from_type(MBEDTLS_MD_SHA512);
 #elif defined(MBEDTLS_ENTROPY_SHA256_ACCUMULATOR)
     const mbedtls_md_info_t *md_info =
-        mbedtls_md_info_from_type( MBEDTLS_MD_SHA256 );
+        mbedtls_md_info_from_type(MBEDTLS_MD_SHA256);
 #else
 #error "Unsupported entropy accumulator"
 #endif
     mbedtls_md_context_t accumulator;
     mbedtls_entropy_context ctx;
-    int (*original_mbedtls_nv_seed_read)( unsigned char *buf, size_t buf_len ) =
+    int (*original_mbedtls_nv_seed_read)(unsigned char *buf, size_t buf_len) =
         mbedtls_nv_seed_read;
-    int (*original_mbedtls_nv_seed_write)( unsigned char *buf, size_t buf_len ) =
+    int (*original_mbedtls_nv_seed_write)(unsigned char *buf, size_t buf_len) =
         mbedtls_nv_seed_write;
 
     unsigned char header[2];
@@ -451,80 +455,80 @@
     unsigned char check_seed[MBEDTLS_ENTROPY_BLOCK_SIZE];
     unsigned char check_entropy[MBEDTLS_ENTROPY_BLOCK_SIZE];
 
-    memset( entropy, 0, MBEDTLS_ENTROPY_BLOCK_SIZE );
-    memset( buf, 0, MBEDTLS_ENTROPY_BLOCK_SIZE );
-    memset( empty, 0, MBEDTLS_ENTROPY_BLOCK_SIZE );
-    memset( check_seed, 2, MBEDTLS_ENTROPY_BLOCK_SIZE );
-    memset( check_entropy, 3, MBEDTLS_ENTROPY_BLOCK_SIZE );
+    memset(entropy, 0, MBEDTLS_ENTROPY_BLOCK_SIZE);
+    memset(buf, 0, MBEDTLS_ENTROPY_BLOCK_SIZE);
+    memset(empty, 0, MBEDTLS_ENTROPY_BLOCK_SIZE);
+    memset(check_seed, 2, MBEDTLS_ENTROPY_BLOCK_SIZE);
+    memset(check_entropy, 3, MBEDTLS_ENTROPY_BLOCK_SIZE);
 
     // Make sure we read/write NV seed from our buffers
-    mbedtls_platform_set_nv_seed( buffer_nv_seed_read, buffer_nv_seed_write );
+    mbedtls_platform_set_nv_seed(buffer_nv_seed_read, buffer_nv_seed_write);
 
-    mbedtls_md_init( &accumulator );
-    mbedtls_entropy_init( &ctx );
-    entropy_clear_sources( &ctx );
+    mbedtls_md_init(&accumulator);
+    mbedtls_entropy_init(&ctx);
+    entropy_clear_sources(&ctx);
 
-    TEST_ASSERT( mbedtls_entropy_add_source( &ctx, mbedtls_nv_seed_poll, NULL,
-                                             MBEDTLS_ENTROPY_BLOCK_SIZE,
-                                             MBEDTLS_ENTROPY_SOURCE_STRONG ) == 0 );
+    TEST_ASSERT(mbedtls_entropy_add_source(&ctx, mbedtls_nv_seed_poll, NULL,
+                                           MBEDTLS_ENTROPY_BLOCK_SIZE,
+                                           MBEDTLS_ENTROPY_SOURCE_STRONG) == 0);
 
     // Set the initial NV seed to read
-    TEST_ASSERT( read_seed->len >= MBEDTLS_ENTROPY_BLOCK_SIZE );
-    memcpy( buffer_seed, read_seed->x, MBEDTLS_ENTROPY_BLOCK_SIZE );
+    TEST_ASSERT(read_seed->len >= MBEDTLS_ENTROPY_BLOCK_SIZE);
+    memcpy(buffer_seed, read_seed->x, MBEDTLS_ENTROPY_BLOCK_SIZE);
 
     // Do an entropy run
-    TEST_ASSERT( mbedtls_entropy_func( &ctx, entropy, sizeof( entropy ) ) == 0 );
+    TEST_ASSERT(mbedtls_entropy_func(&ctx, entropy, sizeof(entropy)) == 0);
     // Determine what should have happened with manual entropy internal logic
 
     // Init accumulator
     header[1] = MBEDTLS_ENTROPY_BLOCK_SIZE;
-    TEST_ASSERT( mbedtls_md_setup( &accumulator, md_info, 0 ) == 0 );
+    TEST_ASSERT(mbedtls_md_setup(&accumulator, md_info, 0) == 0);
 
     // First run for updating write_seed
     header[0] = 0;
-    TEST_ASSERT( mbedtls_md_starts( &accumulator ) == 0 );
-    TEST_ASSERT( mbedtls_md_update( &accumulator, header, 2 ) == 0 );
-    TEST_ASSERT( mbedtls_md_update( &accumulator,
-                                    read_seed->x, MBEDTLS_ENTROPY_BLOCK_SIZE ) == 0 );
-    TEST_ASSERT( mbedtls_md_finish( &accumulator, buf ) == 0 );
+    TEST_ASSERT(mbedtls_md_starts(&accumulator) == 0);
+    TEST_ASSERT(mbedtls_md_update(&accumulator, header, 2) == 0);
+    TEST_ASSERT(mbedtls_md_update(&accumulator,
+                                  read_seed->x, MBEDTLS_ENTROPY_BLOCK_SIZE) == 0);
+    TEST_ASSERT(mbedtls_md_finish(&accumulator, buf) == 0);
 
-    TEST_ASSERT( mbedtls_md_starts( &accumulator ) == 0 );
-    TEST_ASSERT( mbedtls_md_update( &accumulator,
-                                    buf, MBEDTLS_ENTROPY_BLOCK_SIZE ) == 0 );
+    TEST_ASSERT(mbedtls_md_starts(&accumulator) == 0);
+    TEST_ASSERT(mbedtls_md_update(&accumulator,
+                                  buf, MBEDTLS_ENTROPY_BLOCK_SIZE) == 0);
 
-    TEST_ASSERT( mbedtls_md( md_info, buf, MBEDTLS_ENTROPY_BLOCK_SIZE,
-                             check_seed ) == 0 );
+    TEST_ASSERT(mbedtls_md(md_info, buf, MBEDTLS_ENTROPY_BLOCK_SIZE,
+                           check_seed) == 0);
 
     // Second run for actual entropy (triggers mbedtls_entropy_update_nv_seed)
     header[0] = MBEDTLS_ENTROPY_SOURCE_MANUAL;
-    TEST_ASSERT( mbedtls_md_update( &accumulator, header, 2 ) == 0 );
-    TEST_ASSERT( mbedtls_md_update( &accumulator,
-                                    empty, MBEDTLS_ENTROPY_BLOCK_SIZE ) == 0 );
+    TEST_ASSERT(mbedtls_md_update(&accumulator, header, 2) == 0);
+    TEST_ASSERT(mbedtls_md_update(&accumulator,
+                                  empty, MBEDTLS_ENTROPY_BLOCK_SIZE) == 0);
 
     header[0] = 0;
-    TEST_ASSERT( mbedtls_md_update( &accumulator, header, 2 ) == 0 );
-    TEST_ASSERT( mbedtls_md_update( &accumulator,
-                                    check_seed, MBEDTLS_ENTROPY_BLOCK_SIZE ) == 0 );
-    TEST_ASSERT( mbedtls_md_finish( &accumulator, buf ) == 0 );
+    TEST_ASSERT(mbedtls_md_update(&accumulator, header, 2) == 0);
+    TEST_ASSERT(mbedtls_md_update(&accumulator,
+                                  check_seed, MBEDTLS_ENTROPY_BLOCK_SIZE) == 0);
+    TEST_ASSERT(mbedtls_md_finish(&accumulator, buf) == 0);
 
-    TEST_ASSERT( mbedtls_md( md_info, buf, MBEDTLS_ENTROPY_BLOCK_SIZE,
-                             check_entropy ) == 0 );
+    TEST_ASSERT(mbedtls_md(md_info, buf, MBEDTLS_ENTROPY_BLOCK_SIZE,
+                           check_entropy) == 0);
 
     // Check result of both NV file and entropy received with the manual calculations
-    TEST_ASSERT( memcmp( check_seed, buffer_seed, MBEDTLS_ENTROPY_BLOCK_SIZE ) == 0 );
-    TEST_ASSERT( memcmp( check_entropy, entropy, MBEDTLS_ENTROPY_BLOCK_SIZE ) == 0 );
+    TEST_ASSERT(memcmp(check_seed, buffer_seed, MBEDTLS_ENTROPY_BLOCK_SIZE) == 0);
+    TEST_ASSERT(memcmp(check_entropy, entropy, MBEDTLS_ENTROPY_BLOCK_SIZE) == 0);
 
 exit:
-    mbedtls_md_free( &accumulator );
-    mbedtls_entropy_free( &ctx );
+    mbedtls_md_free(&accumulator);
+    mbedtls_entropy_free(&ctx);
     mbedtls_nv_seed_read = original_mbedtls_nv_seed_read;
     mbedtls_nv_seed_write = original_mbedtls_nv_seed_write;
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:ENTROPY_HAVE_STRONG:MBEDTLS_SELF_TEST */
-void entropy_selftest( int result )
+void entropy_selftest(int result)
 {
-    TEST_ASSERT( mbedtls_entropy_self_test( 1 ) == result );
+    TEST_ASSERT(mbedtls_entropy_self_test(1) == result);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_error.function b/tests/suites/test_suite_error.function
index 68831ce..4c38ab0 100644
--- a/tests/suites/test_suite_error.function
+++ b/tests/suites/test_suite_error.function
@@ -8,14 +8,14 @@
  */
 
 /* BEGIN_CASE */
-void error_strerror( int code, char * result_str )
+void error_strerror(int code, char *result_str)
 {
     char buf[500];
 
-    memset( buf, 0, sizeof( buf ) );
+    memset(buf, 0, sizeof(buf));
 
-    mbedtls_strerror( code, buf, 500 );
+    mbedtls_strerror(code, buf, 500);
 
-    TEST_ASSERT( strcmp( buf, result_str ) == 0 );
+    TEST_ASSERT(strcmp(buf, result_str) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_gcm.function b/tests/suites/test_suite_gcm.function
index afe862d..b0c7bbc 100644
--- a/tests/suites/test_suite_gcm.function
+++ b/tests/suites/test_suite_gcm.function
@@ -8,107 +8,114 @@
  */
 
 /* BEGIN_CASE */
-void gcm_bad_parameters( int cipher_id, int direction,
-                         data_t *key_str, data_t *src_str,
-                         data_t *iv_str, data_t *add_str,
-                         int tag_len_bits, int gcm_result )
+void gcm_bad_parameters(int cipher_id, int direction,
+                        data_t *key_str, data_t *src_str,
+                        data_t *iv_str, data_t *add_str,
+                        int tag_len_bits, int gcm_result)
 {
     unsigned char output[128];
     unsigned char tag_output[16];
     mbedtls_gcm_context ctx;
     size_t tag_len = tag_len_bits / 8;
 
-    mbedtls_gcm_init( &ctx );
+    mbedtls_gcm_init(&ctx);
 
-    memset( output, 0x00, sizeof( output ) );
-    memset( tag_output, 0x00, sizeof( tag_output ) );
+    memset(output, 0x00, sizeof(output));
+    memset(tag_output, 0x00, sizeof(tag_output));
 
-    TEST_ASSERT( mbedtls_gcm_setkey( &ctx, cipher_id, key_str->x, key_str->len * 8 ) == 0 );
-    TEST_ASSERT( mbedtls_gcm_crypt_and_tag( &ctx, direction, src_str->len, iv_str->x, iv_str->len,
-                 add_str->x, add_str->len, src_str->x, output, tag_len, tag_output ) == gcm_result );
+    TEST_ASSERT(mbedtls_gcm_setkey(&ctx, cipher_id, key_str->x, key_str->len * 8) == 0);
+    TEST_ASSERT(mbedtls_gcm_crypt_and_tag(&ctx, direction, src_str->len, iv_str->x, iv_str->len,
+                                          add_str->x, add_str->len, src_str->x, output, tag_len,
+                                          tag_output) == gcm_result);
 
 exit:
-    mbedtls_gcm_free( &ctx );
+    mbedtls_gcm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void gcm_encrypt_and_tag( int cipher_id, data_t * key_str,
-                          data_t * src_str, data_t * iv_str,
-                          data_t * add_str, data_t * dst,
-                          int tag_len_bits, data_t * tag,
-                          int init_result )
+void gcm_encrypt_and_tag(int cipher_id, data_t *key_str,
+                         data_t *src_str, data_t *iv_str,
+                         data_t *add_str, data_t *dst,
+                         int tag_len_bits, data_t *tag,
+                         int init_result)
 {
     unsigned char output[128];
     unsigned char tag_output[16];
     mbedtls_gcm_context ctx;
     size_t tag_len = tag_len_bits / 8;
 
-    mbedtls_gcm_init( &ctx );
+    mbedtls_gcm_init(&ctx);
 
     memset(output, 0x00, 128);
     memset(tag_output, 0x00, 16);
 
 
-    TEST_ASSERT( mbedtls_gcm_setkey( &ctx, cipher_id, key_str->x, key_str->len * 8 ) == init_result );
-    if( init_result == 0 )
-    {
-        TEST_ASSERT( mbedtls_gcm_crypt_and_tag( &ctx, MBEDTLS_GCM_ENCRYPT, src_str->len, iv_str->x, iv_str->len, add_str->x, add_str->len, src_str->x, output, tag_len, tag_output ) == 0 );
+    TEST_ASSERT(mbedtls_gcm_setkey(&ctx, cipher_id, key_str->x, key_str->len * 8) == init_result);
+    if (init_result == 0) {
+        TEST_ASSERT(mbedtls_gcm_crypt_and_tag(&ctx, MBEDTLS_GCM_ENCRYPT, src_str->len, iv_str->x,
+                                              iv_str->len, add_str->x, add_str->len, src_str->x,
+                                              output, tag_len, tag_output) == 0);
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x,
-                                          src_str->len, dst->len ) == 0 );
-        TEST_ASSERT( mbedtls_test_hexcmp( tag_output, tag->x,
-                                          tag_len, tag->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x,
+                                        src_str->len, dst->len) == 0);
+        TEST_ASSERT(mbedtls_test_hexcmp(tag_output, tag->x,
+                                        tag_len, tag->len) == 0);
     }
 
 exit:
-    mbedtls_gcm_free( &ctx );
+    mbedtls_gcm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void gcm_decrypt_and_verify( int cipher_id, data_t * key_str,
-                             data_t * src_str, data_t * iv_str,
-                             data_t * add_str, int tag_len_bits,
-                             data_t * tag_str, char * result,
-                             data_t * pt_result, int init_result )
+void gcm_decrypt_and_verify(int cipher_id, data_t *key_str,
+                            data_t *src_str, data_t *iv_str,
+                            data_t *add_str, int tag_len_bits,
+                            data_t *tag_str, char *result,
+                            data_t *pt_result, int init_result)
 {
     unsigned char output[128];
     mbedtls_gcm_context ctx;
     int ret;
     size_t tag_len = tag_len_bits / 8;
 
-    mbedtls_gcm_init( &ctx );
+    mbedtls_gcm_init(&ctx);
 
     memset(output, 0x00, 128);
 
 
-    TEST_ASSERT( mbedtls_gcm_setkey( &ctx, cipher_id, key_str->x, key_str->len * 8 ) == init_result );
-    if( init_result == 0 )
-    {
-        ret = mbedtls_gcm_auth_decrypt( &ctx, src_str->len, iv_str->x, iv_str->len, add_str->x, add_str->len, tag_str->x, tag_len, src_str->x, output );
+    TEST_ASSERT(mbedtls_gcm_setkey(&ctx, cipher_id, key_str->x, key_str->len * 8) == init_result);
+    if (init_result == 0) {
+        ret = mbedtls_gcm_auth_decrypt(&ctx,
+                                       src_str->len,
+                                       iv_str->x,
+                                       iv_str->len,
+                                       add_str->x,
+                                       add_str->len,
+                                       tag_str->x,
+                                       tag_len,
+                                       src_str->x,
+                                       output);
 
-        if( strcmp( "FAIL", result ) == 0 )
-        {
-            TEST_ASSERT( ret == MBEDTLS_ERR_GCM_AUTH_FAILED );
-        }
-        else
-        {
-            TEST_ASSERT( ret == 0 );
+        if (strcmp("FAIL", result) == 0) {
+            TEST_ASSERT(ret == MBEDTLS_ERR_GCM_AUTH_FAILED);
+        } else {
+            TEST_ASSERT(ret == 0);
 
-            TEST_ASSERT( mbedtls_test_hexcmp( output, pt_result->x,
-                                              src_str->len,
-                                              pt_result->len ) == 0 );
+            TEST_ASSERT(mbedtls_test_hexcmp(output, pt_result->x,
+                                            src_str->len,
+                                            pt_result->len) == 0);
         }
     }
 
 exit:
-    mbedtls_gcm_free( &ctx );
+    mbedtls_gcm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void gcm_invalid_param( )
+void gcm_invalid_param()
 {
     mbedtls_gcm_context ctx;
     unsigned char valid_buffer[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
@@ -117,168 +124,168 @@
     int valid_len = sizeof(valid_buffer);
     int valid_bitlen = 128, invalid_bitlen = 1;
 
-    mbedtls_gcm_init( &ctx );
+    mbedtls_gcm_init(&ctx);
 
     /* mbedtls_gcm_init() */
-    TEST_INVALID_PARAM( mbedtls_gcm_init( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_gcm_init(NULL));
 
     /* mbedtls_gcm_setkey */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_setkey( NULL, valid_cipher, valid_buffer, valid_bitlen ) );
+        mbedtls_gcm_setkey(NULL, valid_cipher, valid_buffer, valid_bitlen));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_setkey( &ctx, valid_cipher, NULL, valid_bitlen ) );
+        mbedtls_gcm_setkey(&ctx, valid_cipher, NULL, valid_bitlen));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_setkey( &ctx, valid_cipher, valid_buffer, invalid_bitlen ) );
+        mbedtls_gcm_setkey(&ctx, valid_cipher, valid_buffer, invalid_bitlen));
 
     /* mbedtls_gcm_crypt_and_tag() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_crypt_and_tag( NULL, valid_mode, valid_len,
-                                   valid_buffer, valid_len,
-                                   valid_buffer, valid_len,
-                                   valid_buffer, valid_buffer,
-                                   valid_len, valid_buffer ) );
+        mbedtls_gcm_crypt_and_tag(NULL, valid_mode, valid_len,
+                                  valid_buffer, valid_len,
+                                  valid_buffer, valid_len,
+                                  valid_buffer, valid_buffer,
+                                  valid_len, valid_buffer));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_crypt_and_tag( &ctx, valid_mode, valid_len,
-                                   NULL, valid_len,
-                                   valid_buffer, valid_len,
-                                   valid_buffer, valid_buffer,
-                                   valid_len, valid_buffer ) );
+        mbedtls_gcm_crypt_and_tag(&ctx, valid_mode, valid_len,
+                                  NULL, valid_len,
+                                  valid_buffer, valid_len,
+                                  valid_buffer, valid_buffer,
+                                  valid_len, valid_buffer));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_crypt_and_tag( &ctx, valid_mode, valid_len,
-                                   valid_buffer, valid_len,
-                                   NULL, valid_len,
-                                   valid_buffer, valid_buffer,
-                                   valid_len, valid_buffer ) );
+        mbedtls_gcm_crypt_and_tag(&ctx, valid_mode, valid_len,
+                                  valid_buffer, valid_len,
+                                  NULL, valid_len,
+                                  valid_buffer, valid_buffer,
+                                  valid_len, valid_buffer));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_crypt_and_tag( &ctx, valid_mode, valid_len,
-                                   valid_buffer, valid_len,
-                                   valid_buffer, valid_len,
-                                   NULL, valid_buffer,
-                                   valid_len, valid_buffer ) );
+        mbedtls_gcm_crypt_and_tag(&ctx, valid_mode, valid_len,
+                                  valid_buffer, valid_len,
+                                  valid_buffer, valid_len,
+                                  NULL, valid_buffer,
+                                  valid_len, valid_buffer));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_crypt_and_tag( &ctx, valid_mode, valid_len,
-                                   valid_buffer, valid_len,
-                                   valid_buffer, valid_len,
-                                   valid_buffer, NULL,
-                                   valid_len, valid_buffer ) );
+        mbedtls_gcm_crypt_and_tag(&ctx, valid_mode, valid_len,
+                                  valid_buffer, valid_len,
+                                  valid_buffer, valid_len,
+                                  valid_buffer, NULL,
+                                  valid_len, valid_buffer));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_crypt_and_tag( &ctx, valid_mode, valid_len,
-                                   valid_buffer, valid_len,
-                                   valid_buffer, valid_len,
-                                   valid_buffer, valid_buffer,
-                                   valid_len, NULL ) );
+        mbedtls_gcm_crypt_and_tag(&ctx, valid_mode, valid_len,
+                                  valid_buffer, valid_len,
+                                  valid_buffer, valid_len,
+                                  valid_buffer, valid_buffer,
+                                  valid_len, NULL));
 
     /* mbedtls_gcm_auth_decrypt() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_auth_decrypt( NULL, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_buffer) );
+        mbedtls_gcm_auth_decrypt(NULL, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_buffer));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_auth_decrypt( &ctx, valid_len,
-                                  NULL, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_buffer) );
+        mbedtls_gcm_auth_decrypt(&ctx, valid_len,
+                                 NULL, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_buffer));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_auth_decrypt( &ctx, valid_len,
-                                  valid_buffer, valid_len,
-                                  NULL, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_buffer) );
+        mbedtls_gcm_auth_decrypt(&ctx, valid_len,
+                                 valid_buffer, valid_len,
+                                 NULL, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_buffer));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_auth_decrypt( &ctx, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_len,
-                                  NULL, valid_len,
-                                  valid_buffer, valid_buffer) );
+        mbedtls_gcm_auth_decrypt(&ctx, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_len,
+                                 NULL, valid_len,
+                                 valid_buffer, valid_buffer));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_auth_decrypt( &ctx, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_len,
-                                  NULL, valid_buffer) );
+        mbedtls_gcm_auth_decrypt(&ctx, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_len,
+                                 NULL, valid_buffer));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_auth_decrypt( &ctx, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, valid_len,
-                                  valid_buffer, NULL) );
+        mbedtls_gcm_auth_decrypt(&ctx, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, valid_len,
+                                 valid_buffer, NULL));
 
     /* mbedtls_gcm_starts() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_starts( NULL, valid_mode,
-                            valid_buffer, valid_len,
-                            valid_buffer, valid_len ) );
+        mbedtls_gcm_starts(NULL, valid_mode,
+                           valid_buffer, valid_len,
+                           valid_buffer, valid_len));
 
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_starts( &ctx, valid_mode,
-                            NULL, valid_len,
-                            valid_buffer, valid_len ) );
+        mbedtls_gcm_starts(&ctx, valid_mode,
+                           NULL, valid_len,
+                           valid_buffer, valid_len));
 
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_starts( &ctx, valid_mode,
-                            valid_buffer, valid_len,
-                            NULL, valid_len ) );
+        mbedtls_gcm_starts(&ctx, valid_mode,
+                           valid_buffer, valid_len,
+                           NULL, valid_len));
 
     /* mbedtls_gcm_update() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_update( NULL, valid_len,
-                            valid_buffer, valid_buffer ) );
+        mbedtls_gcm_update(NULL, valid_len,
+                           valid_buffer, valid_buffer));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_update( &ctx, valid_len,
-                            NULL, valid_buffer ) );
+        mbedtls_gcm_update(&ctx, valid_len,
+                           NULL, valid_buffer));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_update( &ctx, valid_len,
-                            valid_buffer, NULL ) );
+        mbedtls_gcm_update(&ctx, valid_len,
+                           valid_buffer, NULL));
 
     /* mbedtls_gcm_finish() */
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_finish( NULL, valid_buffer, valid_len ) );
+        mbedtls_gcm_finish(NULL, valid_buffer, valid_len));
     TEST_INVALID_PARAM_RET(
         MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_finish( &ctx, NULL, valid_len ) );
+        mbedtls_gcm_finish(&ctx, NULL, valid_len));
 
 exit:
-    mbedtls_gcm_free( &ctx );
+    mbedtls_gcm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void gcm_valid_param( )
+void gcm_valid_param()
 {
-    TEST_VALID_PARAM( mbedtls_gcm_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_gcm_free(NULL));
 exit:
     return;
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST:MBEDTLS_AES_C */
-void gcm_selftest(  )
+void gcm_selftest()
 {
-    TEST_ASSERT( mbedtls_gcm_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_gcm_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_hkdf.function b/tests/suites/test_suite_hkdf.function
index 4c597c3..2bfbf3c 100644
--- a/tests/suites/test_suite_hkdf.function
+++ b/tests/suites/test_suite_hkdf.function
@@ -9,29 +9,29 @@
  */
 
 /* BEGIN_CASE */
-void test_hkdf( int md_alg, data_t *ikm, data_t *salt, data_t *info,
-                data_t *expected_okm )
+void test_hkdf(int md_alg, data_t *ikm, data_t *salt, data_t *info,
+               data_t *expected_okm)
 {
     int ret;
     unsigned char okm[128] = { '\0' };
 
-    const mbedtls_md_info_t *md = mbedtls_md_info_from_type( md_alg );
-    TEST_ASSERT( md != NULL );
+    const mbedtls_md_info_t *md = mbedtls_md_info_from_type(md_alg);
+    TEST_ASSERT(md != NULL);
 
-    TEST_ASSERT( expected_okm->len <= sizeof( okm ) );
+    TEST_ASSERT(expected_okm->len <= sizeof(okm));
 
-    ret = mbedtls_hkdf( md, salt->x, salt->len, ikm->x, ikm->len,
-                        info->x, info->len, okm, expected_okm->len );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_hkdf(md, salt->x, salt->len, ikm->x, ikm->len,
+                       info->x, info->len, okm, expected_okm->len);
+    TEST_ASSERT(ret == 0);
 
-    ASSERT_COMPARE( okm            , expected_okm->len,
-                    expected_okm->x, expected_okm->len );
+    ASSERT_COMPARE(okm, expected_okm->len,
+                   expected_okm->x, expected_okm->len);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void test_hkdf_extract( int md_alg, char *hex_ikm_string,
-                        char *hex_salt_string, char *hex_prk_string )
+void test_hkdf_extract(int md_alg, char *hex_ikm_string,
+                       char *hex_salt_string, char *hex_prk_string)
 {
     int ret;
     unsigned char *ikm = NULL;
@@ -40,20 +40,20 @@
     unsigned char *output_prk = NULL;
     size_t ikm_len, salt_len, prk_len, output_prk_len;
 
-    const mbedtls_md_info_t *md = mbedtls_md_info_from_type( md_alg );
-    TEST_ASSERT( md != NULL );
+    const mbedtls_md_info_t *md = mbedtls_md_info_from_type(md_alg);
+    TEST_ASSERT(md != NULL);
 
-    output_prk_len = mbedtls_md_get_size( md );
-    output_prk = mbedtls_calloc( 1, output_prk_len );
+    output_prk_len = mbedtls_md_get_size(md);
+    output_prk = mbedtls_calloc(1, output_prk_len);
 
-    ikm = mbedtls_test_unhexify_alloc( hex_ikm_string, &ikm_len );
-    salt = mbedtls_test_unhexify_alloc( hex_salt_string, &salt_len );
-    prk = mbedtls_test_unhexify_alloc( hex_prk_string, &prk_len );
+    ikm = mbedtls_test_unhexify_alloc(hex_ikm_string, &ikm_len);
+    salt = mbedtls_test_unhexify_alloc(hex_salt_string, &salt_len);
+    prk = mbedtls_test_unhexify_alloc(hex_prk_string, &prk_len);
 
-    ret = mbedtls_hkdf_extract( md, salt, salt_len, ikm, ikm_len, output_prk );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_hkdf_extract(md, salt, salt_len, ikm, ikm_len, output_prk);
+    TEST_ASSERT(ret == 0);
 
-    ASSERT_COMPARE( output_prk, output_prk_len, prk, prk_len );
+    ASSERT_COMPARE(output_prk, output_prk_len, prk, prk_len);
 
 exit:
     mbedtls_free(ikm);
@@ -64,8 +64,8 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void test_hkdf_expand( int md_alg, char *hex_info_string,
-                       char *hex_prk_string, char *hex_okm_string )
+void test_hkdf_expand(int md_alg, char *hex_info_string,
+                      char *hex_prk_string, char *hex_okm_string)
 {
     enum { OKM_LEN  = 1024 };
     int ret;
@@ -75,21 +75,21 @@
     unsigned char *output_okm = NULL;
     size_t info_len, prk_len, okm_len;
 
-    const mbedtls_md_info_t *md = mbedtls_md_info_from_type( md_alg );
-    TEST_ASSERT( md != NULL );
+    const mbedtls_md_info_t *md = mbedtls_md_info_from_type(md_alg);
+    TEST_ASSERT(md != NULL);
 
-    output_okm = mbedtls_calloc( OKM_LEN, 1 );
+    output_okm = mbedtls_calloc(OKM_LEN, 1);
 
-    prk = mbedtls_test_unhexify_alloc( hex_prk_string, &prk_len );
-    info = mbedtls_test_unhexify_alloc( hex_info_string, &info_len );
-    okm = mbedtls_test_unhexify_alloc( hex_okm_string, &okm_len );
-    TEST_ASSERT( prk_len == mbedtls_md_get_size( md ) );
-    TEST_ASSERT( okm_len < OKM_LEN );
+    prk = mbedtls_test_unhexify_alloc(hex_prk_string, &prk_len);
+    info = mbedtls_test_unhexify_alloc(hex_info_string, &info_len);
+    okm = mbedtls_test_unhexify_alloc(hex_okm_string, &okm_len);
+    TEST_ASSERT(prk_len == mbedtls_md_get_size(md));
+    TEST_ASSERT(okm_len < OKM_LEN);
 
-    ret = mbedtls_hkdf_expand( md, prk, prk_len, info, info_len,
-                               output_okm, OKM_LEN );
-    TEST_ASSERT( ret == 0 );
-    ASSERT_COMPARE( output_okm, okm_len, okm, okm_len );
+    ret = mbedtls_hkdf_expand(md, prk, prk_len, info, info_len,
+                              output_okm, OKM_LEN);
+    TEST_ASSERT(ret == 0);
+    ASSERT_COMPARE(output_okm, okm_len, okm, okm_len);
 
 exit:
     mbedtls_free(info);
@@ -100,7 +100,7 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void test_hkdf_extract_ret( int hash_len, int ret )
+void test_hkdf_extract_ret(int hash_len, int ret)
 {
     int output_ret;
     unsigned char *salt = NULL;
@@ -109,17 +109,17 @@
     size_t salt_len, ikm_len;
     struct mbedtls_md_info_t fake_md_info;
 
-    memset( &fake_md_info, 0, sizeof( fake_md_info ) );
+    memset(&fake_md_info, 0, sizeof(fake_md_info));
     fake_md_info.type = MBEDTLS_MD_NONE;
     fake_md_info.size = hash_len;
 
-    prk = mbedtls_calloc( MBEDTLS_MD_MAX_SIZE, 1 );
+    prk = mbedtls_calloc(MBEDTLS_MD_MAX_SIZE, 1);
     salt_len = 0;
     ikm_len = 0;
 
-    output_ret = mbedtls_hkdf_extract( &fake_md_info, salt, salt_len,
-                                       ikm, ikm_len, prk );
-    TEST_ASSERT( output_ret == ret );
+    output_ret = mbedtls_hkdf_extract(&fake_md_info, salt, salt_len,
+                                      ikm, ikm_len, prk);
+    TEST_ASSERT(output_ret == ret);
 
 exit:
     mbedtls_free(prk);
@@ -127,7 +127,7 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void test_hkdf_expand_ret( int hash_len, int prk_len, int okm_len, int ret )
+void test_hkdf_expand_ret(int hash_len, int prk_len, int okm_len, int ret)
 {
     int output_ret;
     unsigned char *info = NULL;
@@ -136,21 +136,23 @@
     size_t info_len;
     struct mbedtls_md_info_t fake_md_info;
 
-    memset( &fake_md_info, 0, sizeof( fake_md_info ) );
+    memset(&fake_md_info, 0, sizeof(fake_md_info));
     fake_md_info.type = MBEDTLS_MD_NONE;
     fake_md_info.size = hash_len;
 
     info_len = 0;
 
-    if (prk_len > 0)
-        prk = mbedtls_calloc( prk_len, 1 );
+    if (prk_len > 0) {
+        prk = mbedtls_calloc(prk_len, 1);
+    }
 
-    if (okm_len > 0)
-        okm = mbedtls_calloc( okm_len, 1 );
+    if (okm_len > 0) {
+        okm = mbedtls_calloc(okm_len, 1);
+    }
 
-    output_ret = mbedtls_hkdf_expand( &fake_md_info, prk, prk_len,
-                                      info, info_len, okm, okm_len );
-    TEST_ASSERT( output_ret == ret );
+    output_ret = mbedtls_hkdf_expand(&fake_md_info, prk, prk_len,
+                                     info, info_len, okm, okm_len);
+    TEST_ASSERT(output_ret == ret);
 
 exit:
     mbedtls_free(prk);
diff --git a/tests/suites/test_suite_hmac_drbg.function b/tests/suites/test_suite_hmac_drbg.function
index b83d760..830155a 100644
--- a/tests/suites/test_suite_hmac_drbg.function
+++ b/tests/suites/test_suite_hmac_drbg.function
@@ -2,25 +2,25 @@
 #include "mbedtls/hmac_drbg.h"
 #include "string.h"
 
-typedef struct
-{
+typedef struct {
     unsigned char *p;
     size_t len;
 } entropy_ctx;
 
-static int mbedtls_test_entropy_func( void *data, unsigned char *buf, size_t len )
+static int mbedtls_test_entropy_func(void *data, unsigned char *buf, size_t len)
 {
     entropy_ctx *ctx = (entropy_ctx *) data;
 
-    if( len > ctx->len )
-        return( -1 );
+    if (len > ctx->len) {
+        return -1;
+    }
 
-    memcpy( buf, ctx->p, len );
+    memcpy(buf, ctx->p, len);
 
     ctx->p += len;
     ctx->len -= len;
 
-    return( 0 );
+    return 0;
 }
 /* END_HEADER */
 
@@ -30,7 +30,7 @@
  */
 
 /* BEGIN_CASE */
-void hmac_drbg_entropy_usage( int md_alg )
+void hmac_drbg_entropy_usage(int md_alg)
 {
     unsigned char out[16];
     unsigned char buf[1024];
@@ -41,112 +41,111 @@
     size_t default_entropy_len;
     size_t expected_consumed_entropy = 0;
 
-    mbedtls_hmac_drbg_init( &ctx );
-    memset( buf, 0, sizeof( buf ) );
-    memset( out, 0, sizeof( out ) );
+    mbedtls_hmac_drbg_init(&ctx);
+    memset(buf, 0, sizeof(buf));
+    memset(out, 0, sizeof(out));
 
-    entropy.len = sizeof( buf );
+    entropy.len = sizeof(buf);
     entropy.p = buf;
 
-    md_info = mbedtls_md_info_from_type( md_alg );
-    TEST_ASSERT( md_info != NULL );
-    if( mbedtls_md_get_size( md_info ) <= 20 )
+    md_info = mbedtls_md_info_from_type(md_alg);
+    TEST_ASSERT(md_info != NULL);
+    if (mbedtls_md_get_size(md_info) <= 20) {
         default_entropy_len = 16;
-    else if( mbedtls_md_get_size( md_info ) <= 28 )
+    } else if (mbedtls_md_get_size(md_info) <= 28) {
         default_entropy_len = 24;
-    else
+    } else {
         default_entropy_len = 32;
+    }
 
     /* Set reseed interval before seed */
-    mbedtls_hmac_drbg_set_reseed_interval( &ctx, 2 * reps );
+    mbedtls_hmac_drbg_set_reseed_interval(&ctx, 2 * reps);
 
     /* Init must use entropy */
-    TEST_ASSERT( mbedtls_hmac_drbg_seed( &ctx, md_info, mbedtls_test_entropy_func, &entropy,
-                                 NULL, 0 ) == 0 );
+    TEST_ASSERT(mbedtls_hmac_drbg_seed(&ctx, md_info, mbedtls_test_entropy_func, &entropy,
+                                       NULL, 0) == 0);
     /* default_entropy_len of entropy, plus half as much for the nonce */
     expected_consumed_entropy += default_entropy_len * 3 / 2;
-    TEST_EQUAL( sizeof( buf )  - entropy.len, expected_consumed_entropy );
+    TEST_EQUAL(sizeof(buf)  - entropy.len, expected_consumed_entropy);
 
     /* By default, PR is off, and reseed interval was set to
      * 2 * reps so the next few calls should not use entropy */
-    for( i = 0; i < reps; i++ )
-    {
-        TEST_ASSERT( mbedtls_hmac_drbg_random( &ctx, out, sizeof( out ) - 4 ) == 0 );
-        TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, out, sizeof( out ) - 4,
-                                                buf, 16 ) == 0 );
+    for (i = 0; i < reps; i++) {
+        TEST_ASSERT(mbedtls_hmac_drbg_random(&ctx, out, sizeof(out) - 4) == 0);
+        TEST_ASSERT(mbedtls_hmac_drbg_random_with_add(&ctx, out, sizeof(out) - 4,
+                                                      buf, 16) == 0);
     }
-    TEST_EQUAL( sizeof( buf )  - entropy.len, expected_consumed_entropy );
+    TEST_EQUAL(sizeof(buf)  - entropy.len, expected_consumed_entropy);
 
     /* While at it, make sure we didn't write past the requested length */
-    TEST_ASSERT( out[sizeof( out ) - 4] == 0 );
-    TEST_ASSERT( out[sizeof( out ) - 3] == 0 );
-    TEST_ASSERT( out[sizeof( out ) - 2] == 0 );
-    TEST_ASSERT( out[sizeof( out ) - 1] == 0 );
+    TEST_ASSERT(out[sizeof(out) - 4] == 0);
+    TEST_ASSERT(out[sizeof(out) - 3] == 0);
+    TEST_ASSERT(out[sizeof(out) - 2] == 0);
+    TEST_ASSERT(out[sizeof(out) - 1] == 0);
 
     /* There have been 2 * reps calls to random. The next call should reseed */
-    TEST_ASSERT( mbedtls_hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+    TEST_ASSERT(mbedtls_hmac_drbg_random(&ctx, out, sizeof(out)) == 0);
     expected_consumed_entropy += default_entropy_len;
-    TEST_EQUAL( sizeof( buf )  - entropy.len, expected_consumed_entropy );
+    TEST_EQUAL(sizeof(buf)  - entropy.len, expected_consumed_entropy);
 
     /* Set reseed interval after seed */
-    mbedtls_hmac_drbg_set_reseed_interval( &ctx, 4 * reps + 1);
+    mbedtls_hmac_drbg_set_reseed_interval(&ctx, 4 * reps + 1);
 
     /* The new few calls should not reseed */
-    for( i = 0; i < (2 * reps); i++ )
-    {
-        TEST_ASSERT( mbedtls_hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
-        TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, out, sizeof( out ) ,
-                                                buf, 16 ) == 0 );
+    for (i = 0; i < (2 * reps); i++) {
+        TEST_ASSERT(mbedtls_hmac_drbg_random(&ctx, out, sizeof(out)) == 0);
+        TEST_ASSERT(mbedtls_hmac_drbg_random_with_add(&ctx, out, sizeof(out),
+                                                      buf, 16) == 0);
     }
-    TEST_EQUAL( sizeof( buf )  - entropy.len, expected_consumed_entropy );
+    TEST_EQUAL(sizeof(buf)  - entropy.len, expected_consumed_entropy);
 
     /* Now enable PR, so the next few calls should all reseed */
-    mbedtls_hmac_drbg_set_prediction_resistance( &ctx, MBEDTLS_HMAC_DRBG_PR_ON );
-    TEST_ASSERT( mbedtls_hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+    mbedtls_hmac_drbg_set_prediction_resistance(&ctx, MBEDTLS_HMAC_DRBG_PR_ON);
+    TEST_ASSERT(mbedtls_hmac_drbg_random(&ctx, out, sizeof(out)) == 0);
     expected_consumed_entropy += default_entropy_len;
-    TEST_EQUAL( sizeof( buf )  - entropy.len, expected_consumed_entropy );
+    TEST_EQUAL(sizeof(buf)  - entropy.len, expected_consumed_entropy);
 
     /* Finally, check setting entropy_len */
-    mbedtls_hmac_drbg_set_entropy_len( &ctx, 42 );
-    TEST_ASSERT( mbedtls_hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+    mbedtls_hmac_drbg_set_entropy_len(&ctx, 42);
+    TEST_ASSERT(mbedtls_hmac_drbg_random(&ctx, out, sizeof(out)) == 0);
     expected_consumed_entropy += 42;
-    TEST_EQUAL( sizeof( buf )  - entropy.len, expected_consumed_entropy );
+    TEST_EQUAL(sizeof(buf)  - entropy.len, expected_consumed_entropy);
 
-    mbedtls_hmac_drbg_set_entropy_len( &ctx, 13 );
-    TEST_ASSERT( mbedtls_hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+    mbedtls_hmac_drbg_set_entropy_len(&ctx, 13);
+    TEST_ASSERT(mbedtls_hmac_drbg_random(&ctx, out, sizeof(out)) == 0);
     expected_consumed_entropy += 13;
-    TEST_EQUAL( sizeof( buf )  - entropy.len, expected_consumed_entropy );
+    TEST_EQUAL(sizeof(buf)  - entropy.len, expected_consumed_entropy);
 
 exit:
-    mbedtls_hmac_drbg_free( &ctx );
+    mbedtls_hmac_drbg_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO */
-void hmac_drbg_seed_file( int md_alg, char * path, int ret )
+void hmac_drbg_seed_file(int md_alg, char *path, int ret)
 {
     const mbedtls_md_info_t *md_info;
     mbedtls_hmac_drbg_context ctx;
 
-    mbedtls_hmac_drbg_init( &ctx );
+    mbedtls_hmac_drbg_init(&ctx);
 
-    md_info = mbedtls_md_info_from_type( md_alg );
-    TEST_ASSERT( md_info != NULL );
+    md_info = mbedtls_md_info_from_type(md_alg);
+    TEST_ASSERT(md_info != NULL);
 
-    TEST_ASSERT( mbedtls_hmac_drbg_seed( &ctx, md_info,
-                                         mbedtls_test_rnd_std_rand, NULL,
-                                         NULL, 0 ) == 0 );
+    TEST_ASSERT(mbedtls_hmac_drbg_seed(&ctx, md_info,
+                                       mbedtls_test_rnd_std_rand, NULL,
+                                       NULL, 0) == 0);
 
-    TEST_ASSERT( mbedtls_hmac_drbg_write_seed_file( &ctx, path ) == ret );
-    TEST_ASSERT( mbedtls_hmac_drbg_update_seed_file( &ctx, path ) == ret );
+    TEST_ASSERT(mbedtls_hmac_drbg_write_seed_file(&ctx, path) == ret);
+    TEST_ASSERT(mbedtls_hmac_drbg_update_seed_file(&ctx, path) == ret);
 
 exit:
-    mbedtls_hmac_drbg_free( &ctx );
+    mbedtls_hmac_drbg_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hmac_drbg_buf( int md_alg )
+void hmac_drbg_buf(int md_alg)
 {
     unsigned char out[16];
     unsigned char buf[100];
@@ -154,30 +153,31 @@
     mbedtls_hmac_drbg_context ctx;
     size_t i;
 
-    mbedtls_hmac_drbg_init( &ctx );
-    memset( buf, 0, sizeof( buf ) );
-    memset( out, 0, sizeof( out ) );
+    mbedtls_hmac_drbg_init(&ctx);
+    memset(buf, 0, sizeof(buf));
+    memset(out, 0, sizeof(out));
 
-    md_info = mbedtls_md_info_from_type( md_alg );
-    TEST_ASSERT( md_info != NULL );
-    TEST_ASSERT( mbedtls_hmac_drbg_seed_buf( &ctx, md_info, buf, sizeof( buf ) ) == 0 );
+    md_info = mbedtls_md_info_from_type(md_alg);
+    TEST_ASSERT(md_info != NULL);
+    TEST_ASSERT(mbedtls_hmac_drbg_seed_buf(&ctx, md_info, buf, sizeof(buf)) == 0);
 
     /* Make sure it never tries to reseed (would segfault otherwise) */
-    mbedtls_hmac_drbg_set_reseed_interval( &ctx, 3 );
-    mbedtls_hmac_drbg_set_prediction_resistance( &ctx, MBEDTLS_HMAC_DRBG_PR_ON );
+    mbedtls_hmac_drbg_set_reseed_interval(&ctx, 3);
+    mbedtls_hmac_drbg_set_prediction_resistance(&ctx, MBEDTLS_HMAC_DRBG_PR_ON);
 
-    for( i = 0; i < 30; i++ )
-        TEST_ASSERT( mbedtls_hmac_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
+    for (i = 0; i < 30; i++) {
+        TEST_ASSERT(mbedtls_hmac_drbg_random(&ctx, out, sizeof(out)) == 0);
+    }
 
 exit:
-    mbedtls_hmac_drbg_free( &ctx );
+    mbedtls_hmac_drbg_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hmac_drbg_no_reseed( int md_alg, data_t * entropy,
-                          data_t * custom, data_t * add1,
-                          data_t * add2, data_t * output )
+void hmac_drbg_no_reseed(int md_alg, data_t *entropy,
+                         data_t *custom, data_t *add1,
+                         data_t *add2, data_t *output)
 {
     unsigned char data[1024];
     unsigned char my_output[512];
@@ -185,111 +185,111 @@
     const mbedtls_md_info_t *md_info;
     mbedtls_hmac_drbg_context ctx;
 
-    mbedtls_hmac_drbg_init( &ctx );
+    mbedtls_hmac_drbg_init(&ctx);
 
     p_entropy.p = entropy->x;
     p_entropy.len = entropy->len;
 
-    md_info = mbedtls_md_info_from_type( md_alg );
-    TEST_ASSERT( md_info != NULL );
+    md_info = mbedtls_md_info_from_type(md_alg);
+    TEST_ASSERT(md_info != NULL);
 
     /* Test the simplified buffer-based variant */
-    memcpy( data, entropy->x, p_entropy.len );
-    memcpy( data + p_entropy.len, custom->x, custom->len );
-    TEST_ASSERT( mbedtls_hmac_drbg_seed_buf( &ctx, md_info,
-                                     data, p_entropy.len + custom->len ) == 0 );
-    TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, output->len,
-                                            add1->x, add1->len ) == 0 );
-    TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, output->len,
-                                            add2->x, add2->len ) == 0 );
+    memcpy(data, entropy->x, p_entropy.len);
+    memcpy(data + p_entropy.len, custom->x, custom->len);
+    TEST_ASSERT(mbedtls_hmac_drbg_seed_buf(&ctx, md_info,
+                                           data, p_entropy.len + custom->len) == 0);
+    TEST_ASSERT(mbedtls_hmac_drbg_random_with_add(&ctx, my_output, output->len,
+                                                  add1->x, add1->len) == 0);
+    TEST_ASSERT(mbedtls_hmac_drbg_random_with_add(&ctx, my_output, output->len,
+                                                  add2->x, add2->len) == 0);
 
     /* Reset context for second run */
-    mbedtls_hmac_drbg_free( &ctx );
+    mbedtls_hmac_drbg_free(&ctx);
 
-    TEST_ASSERT( memcmp( my_output, output->x, output->len ) == 0 );
+    TEST_ASSERT(memcmp(my_output, output->x, output->len) == 0);
 
     /* And now the normal entropy-based variant */
-    TEST_ASSERT( mbedtls_hmac_drbg_seed( &ctx, md_info, mbedtls_test_entropy_func, &p_entropy,
-                                 custom->x, custom->len ) == 0 );
-    TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, output->len,
-                                            add1->x, add1->len ) == 0 );
-    TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, output->len,
-                                            add2->x, add2->len ) == 0 );
-    TEST_ASSERT( memcmp( my_output, output->x, output->len ) == 0 );
+    TEST_ASSERT(mbedtls_hmac_drbg_seed(&ctx, md_info, mbedtls_test_entropy_func, &p_entropy,
+                                       custom->x, custom->len) == 0);
+    TEST_ASSERT(mbedtls_hmac_drbg_random_with_add(&ctx, my_output, output->len,
+                                                  add1->x, add1->len) == 0);
+    TEST_ASSERT(mbedtls_hmac_drbg_random_with_add(&ctx, my_output, output->len,
+                                                  add2->x, add2->len) == 0);
+    TEST_ASSERT(memcmp(my_output, output->x, output->len) == 0);
 
 exit:
-    mbedtls_hmac_drbg_free( &ctx );
+    mbedtls_hmac_drbg_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hmac_drbg_nopr( int md_alg, data_t * entropy, data_t * custom,
-                     data_t * add1, data_t * add2, data_t * add3,
-                     data_t * output )
+void hmac_drbg_nopr(int md_alg, data_t *entropy, data_t *custom,
+                    data_t *add1, data_t *add2, data_t *add3,
+                    data_t *output)
 {
     unsigned char my_output[512];
     entropy_ctx p_entropy;
     const mbedtls_md_info_t *md_info;
     mbedtls_hmac_drbg_context ctx;
 
-    mbedtls_hmac_drbg_init( &ctx );
+    mbedtls_hmac_drbg_init(&ctx);
 
     p_entropy.p = entropy->x;
     p_entropy.len = entropy->len;
 
-    md_info = mbedtls_md_info_from_type( md_alg );
-    TEST_ASSERT( md_info != NULL );
+    md_info = mbedtls_md_info_from_type(md_alg);
+    TEST_ASSERT(md_info != NULL);
 
-    TEST_ASSERT( mbedtls_hmac_drbg_seed( &ctx, md_info, mbedtls_test_entropy_func, &p_entropy,
-                                 custom->x, custom->len ) == 0 );
-    TEST_ASSERT( mbedtls_hmac_drbg_reseed( &ctx, add1->x, add1->len ) == 0 );
-    TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, output->len,
-                                            add2->x, add2->len ) == 0 );
-    TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, output->len,
-                                            add3->x, add3->len ) == 0 );
+    TEST_ASSERT(mbedtls_hmac_drbg_seed(&ctx, md_info, mbedtls_test_entropy_func, &p_entropy,
+                                       custom->x, custom->len) == 0);
+    TEST_ASSERT(mbedtls_hmac_drbg_reseed(&ctx, add1->x, add1->len) == 0);
+    TEST_ASSERT(mbedtls_hmac_drbg_random_with_add(&ctx, my_output, output->len,
+                                                  add2->x, add2->len) == 0);
+    TEST_ASSERT(mbedtls_hmac_drbg_random_with_add(&ctx, my_output, output->len,
+                                                  add3->x, add3->len) == 0);
 
-    TEST_ASSERT( memcmp( my_output, output->x, output->len ) == 0 );
+    TEST_ASSERT(memcmp(my_output, output->x, output->len) == 0);
 
 exit:
-    mbedtls_hmac_drbg_free( &ctx );
+    mbedtls_hmac_drbg_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hmac_drbg_pr( int md_alg, data_t * entropy, data_t * custom,
-                   data_t * add1, data_t * add2, data_t * output )
+void hmac_drbg_pr(int md_alg, data_t *entropy, data_t *custom,
+                  data_t *add1, data_t *add2, data_t *output)
 {
     unsigned char my_output[512];
     entropy_ctx p_entropy;
     const mbedtls_md_info_t *md_info;
     mbedtls_hmac_drbg_context ctx;
 
-    mbedtls_hmac_drbg_init( &ctx );
+    mbedtls_hmac_drbg_init(&ctx);
 
     p_entropy.p = entropy->x;
     p_entropy.len = entropy->len;
 
-    md_info = mbedtls_md_info_from_type( md_alg );
-    TEST_ASSERT( md_info != NULL );
+    md_info = mbedtls_md_info_from_type(md_alg);
+    TEST_ASSERT(md_info != NULL);
 
-    TEST_ASSERT( mbedtls_hmac_drbg_seed( &ctx, md_info, mbedtls_test_entropy_func, &p_entropy,
-                                 custom->x, custom->len ) == 0 );
-    mbedtls_hmac_drbg_set_prediction_resistance( &ctx, MBEDTLS_HMAC_DRBG_PR_ON );
-    TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, output->len,
-                                            add1->x, add1->len ) == 0 );
-    TEST_ASSERT( mbedtls_hmac_drbg_random_with_add( &ctx, my_output, output->len,
-                                            add2->x, add2->len ) == 0 );
+    TEST_ASSERT(mbedtls_hmac_drbg_seed(&ctx, md_info, mbedtls_test_entropy_func, &p_entropy,
+                                       custom->x, custom->len) == 0);
+    mbedtls_hmac_drbg_set_prediction_resistance(&ctx, MBEDTLS_HMAC_DRBG_PR_ON);
+    TEST_ASSERT(mbedtls_hmac_drbg_random_with_add(&ctx, my_output, output->len,
+                                                  add1->x, add1->len) == 0);
+    TEST_ASSERT(mbedtls_hmac_drbg_random_with_add(&ctx, my_output, output->len,
+                                                  add2->x, add2->len) == 0);
 
-    TEST_ASSERT( memcmp( my_output, output->x, output->len ) == 0 );
+    TEST_ASSERT(memcmp(my_output, output->x, output->len) == 0);
 
 exit:
-    mbedtls_hmac_drbg_free( &ctx );
+    mbedtls_hmac_drbg_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void hmac_drbg_selftest(  )
+void hmac_drbg_selftest()
 {
-    TEST_ASSERT( mbedtls_hmac_drbg_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_hmac_drbg_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_md.function b/tests/suites/test_suite_md.function
index da3e852..c875389 100644
--- a/tests/suites/test_suite_md.function
+++ b/tests/suites/test_suite_md.function
@@ -8,15 +8,15 @@
  */
 
 /* BEGIN_CASE */
-void mbedtls_md_process(  )
+void mbedtls_md_process()
 {
     const int *md_type_ptr;
     const mbedtls_md_info_t *info;
     mbedtls_md_context_t ctx;
     unsigned char buf[150];
 
-    mbedtls_md_init( &ctx );
-    memset( buf, 0, sizeof( buf ) );
+    mbedtls_md_init(&ctx);
+    memset(buf, 0, sizeof(buf));
 
     /*
      * Very minimal testing of mbedtls_md_process, just make sure the various
@@ -26,159 +26,160 @@
      *
      * Also tests that mbedtls_md_list() only returns valid MDs.
      */
-    for( md_type_ptr = mbedtls_md_list(); *md_type_ptr != 0; md_type_ptr++ )
-    {
-        info = mbedtls_md_info_from_type( *md_type_ptr );
-        TEST_ASSERT( info != NULL );
-        TEST_ASSERT( mbedtls_md_setup( &ctx, info, 0 ) == 0 );
-        TEST_ASSERT( mbedtls_md_starts( &ctx ) == 0 );
-        TEST_ASSERT( mbedtls_md_process( &ctx, buf ) == 0 );
-        mbedtls_md_free( &ctx );
+    for (md_type_ptr = mbedtls_md_list(); *md_type_ptr != 0; md_type_ptr++) {
+        info = mbedtls_md_info_from_type(*md_type_ptr);
+        TEST_ASSERT(info != NULL);
+        TEST_ASSERT(mbedtls_md_setup(&ctx, info, 0) == 0);
+        TEST_ASSERT(mbedtls_md_starts(&ctx) == 0);
+        TEST_ASSERT(mbedtls_md_process(&ctx, buf) == 0);
+        mbedtls_md_free(&ctx);
     }
 
 exit:
-    mbedtls_md_free( &ctx );
+    mbedtls_md_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void md_null_args(  )
+void md_null_args()
 {
     mbedtls_md_context_t ctx;
-    const mbedtls_md_info_t *info = mbedtls_md_info_from_type( *( mbedtls_md_list() ) );
+    const mbedtls_md_info_t *info = mbedtls_md_info_from_type(*(mbedtls_md_list()));
     unsigned char buf[1] = { 0 };
 
-    mbedtls_md_init( &ctx );
+    mbedtls_md_init(&ctx);
 
-    TEST_ASSERT( mbedtls_md_get_size( NULL ) == 0 );
-    TEST_ASSERT( mbedtls_md_get_type( NULL ) == MBEDTLS_MD_NONE );
-    TEST_ASSERT( mbedtls_md_get_name( NULL ) == NULL );
+    TEST_ASSERT(mbedtls_md_get_size(NULL) == 0);
+    TEST_ASSERT(mbedtls_md_get_type(NULL) == MBEDTLS_MD_NONE);
+    TEST_ASSERT(mbedtls_md_get_name(NULL) == NULL);
 
-    TEST_ASSERT( mbedtls_md_info_from_string( NULL ) == NULL );
+    TEST_ASSERT(mbedtls_md_info_from_string(NULL) == NULL);
 
-    TEST_ASSERT( mbedtls_md_setup( &ctx, NULL, 0 ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
-    TEST_ASSERT( mbedtls_md_setup( NULL, info, 0 ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_md_setup(&ctx, NULL, 0) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
+    TEST_ASSERT(mbedtls_md_setup(NULL, info, 0) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_md_starts( NULL ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
-    TEST_ASSERT( mbedtls_md_starts( &ctx ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_md_starts(NULL) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
+    TEST_ASSERT(mbedtls_md_starts(&ctx) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_md_update( NULL, buf, 1 ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
-    TEST_ASSERT( mbedtls_md_update( &ctx, buf, 1 ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_md_update(NULL, buf, 1) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
+    TEST_ASSERT(mbedtls_md_update(&ctx, buf, 1) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_md_finish( NULL, buf ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
-    TEST_ASSERT( mbedtls_md_finish( &ctx, buf ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_md_finish(NULL, buf) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
+    TEST_ASSERT(mbedtls_md_finish(&ctx, buf) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_md( NULL, buf, 1, buf ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_md(NULL, buf, 1, buf) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
 
 #if defined(MBEDTLS_FS_IO)
-    TEST_ASSERT( mbedtls_md_file( NULL, "", buf ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_md_file(NULL, "", buf) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
 #endif
 
-    TEST_ASSERT( mbedtls_md_hmac_starts( NULL, buf, 1 )
-                 == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
-    TEST_ASSERT( mbedtls_md_hmac_starts( &ctx, buf, 1 )
-                 == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_md_hmac_starts(NULL, buf, 1)
+                == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
+    TEST_ASSERT(mbedtls_md_hmac_starts(&ctx, buf, 1)
+                == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_md_hmac_update( NULL, buf, 1 )
-                 == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
-    TEST_ASSERT( mbedtls_md_hmac_update( &ctx, buf, 1 )
-                 == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_md_hmac_update(NULL, buf, 1)
+                == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
+    TEST_ASSERT(mbedtls_md_hmac_update(&ctx, buf, 1)
+                == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_md_hmac_finish( NULL, buf )
-                 == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
-    TEST_ASSERT( mbedtls_md_hmac_finish( &ctx, buf )
-                 == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_md_hmac_finish(NULL, buf)
+                == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
+    TEST_ASSERT(mbedtls_md_hmac_finish(&ctx, buf)
+                == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_md_hmac_reset( NULL ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
-    TEST_ASSERT( mbedtls_md_hmac_reset( &ctx ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_md_hmac_reset(NULL) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
+    TEST_ASSERT(mbedtls_md_hmac_reset(&ctx) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_md_hmac( NULL, buf, 1, buf, 1, buf )
-                 == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_md_hmac(NULL, buf, 1, buf, 1, buf)
+                == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_md_process( NULL, buf ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
-    TEST_ASSERT( mbedtls_md_process( &ctx, buf ) == MBEDTLS_ERR_MD_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_md_process(NULL, buf) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
+    TEST_ASSERT(mbedtls_md_process(&ctx, buf) == MBEDTLS_ERR_MD_BAD_INPUT_DATA);
 
     /* Ok, this is not NULL arg but NULL return... */
-    TEST_ASSERT( mbedtls_md_info_from_type( MBEDTLS_MD_NONE ) == NULL );
-    TEST_ASSERT( mbedtls_md_info_from_string( "no such md" ) == NULL );
+    TEST_ASSERT(mbedtls_md_info_from_type(MBEDTLS_MD_NONE) == NULL);
+    TEST_ASSERT(mbedtls_md_info_from_string("no such md") == NULL);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void md_info( int md_type, char * md_name, int md_size )
+void md_info(int md_type, char *md_name, int md_size)
 {
     const mbedtls_md_info_t *md_info;
     const int *md_type_ptr;
     int found;
 
-    md_info = mbedtls_md_info_from_type( md_type );
-    TEST_ASSERT( md_info != NULL );
-    TEST_ASSERT( md_info == mbedtls_md_info_from_string( md_name ) );
+    md_info = mbedtls_md_info_from_type(md_type);
+    TEST_ASSERT(md_info != NULL);
+    TEST_ASSERT(md_info == mbedtls_md_info_from_string(md_name));
 
-    TEST_ASSERT( mbedtls_md_get_type( md_info ) == (mbedtls_md_type_t) md_type );
-    TEST_ASSERT( mbedtls_md_get_size( md_info ) == (unsigned char) md_size );
-    TEST_ASSERT( strcmp( mbedtls_md_get_name( md_info ), md_name ) == 0 );
+    TEST_ASSERT(mbedtls_md_get_type(md_info) == (mbedtls_md_type_t) md_type);
+    TEST_ASSERT(mbedtls_md_get_size(md_info) == (unsigned char) md_size);
+    TEST_ASSERT(strcmp(mbedtls_md_get_name(md_info), md_name) == 0);
 
     found = 0;
-    for( md_type_ptr = mbedtls_md_list(); *md_type_ptr != 0; md_type_ptr++ )
-        if( *md_type_ptr == md_type )
+    for (md_type_ptr = mbedtls_md_list(); *md_type_ptr != 0; md_type_ptr++) {
+        if (*md_type_ptr == md_type) {
             found = 1;
-    TEST_ASSERT( found == 1 );
+        }
+    }
+    TEST_ASSERT(found == 1);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void md_text( char * text_md_name, char * text_src_string,
-              data_t * hash )
+void md_text(char *text_md_name, char *text_src_string,
+             data_t *hash)
 {
     char md_name[100];
     unsigned char src_str[1000];
     unsigned char output[100];
     const mbedtls_md_info_t *md_info = NULL;
 
-    memset( md_name, 0x00, 100 );
-    memset( src_str, 0x00, 1000 );
-    memset( output, 0x00, 100 );
+    memset(md_name, 0x00, 100);
+    memset(src_str, 0x00, 1000);
+    memset(output, 0x00, 100);
 
-    strncpy( (char *) src_str, text_src_string, sizeof( src_str ) - 1 );
-    strncpy( (char *) md_name, text_md_name, sizeof( md_name ) - 1 );
+    strncpy((char *) src_str, text_src_string, sizeof(src_str) - 1);
+    strncpy((char *) md_name, text_md_name, sizeof(md_name) - 1);
     md_info = mbedtls_md_info_from_string(md_name);
-    TEST_ASSERT( md_info != NULL );
+    TEST_ASSERT(md_info != NULL);
 
-    TEST_ASSERT ( 0 == mbedtls_md( md_info, src_str, strlen( (char *) src_str ), output ) );
+    TEST_ASSERT(0 == mbedtls_md(md_info, src_str, strlen((char *) src_str), output));
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
-                                      mbedtls_md_get_size( md_info ),
-                                      hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
+                                    mbedtls_md_get_size(md_info),
+                                    hash->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void md_hex( char * text_md_name, data_t * src_str, data_t * hash )
+void md_hex(char *text_md_name, data_t *src_str, data_t *hash)
 {
     char md_name[100];
     unsigned char output[100];
     const mbedtls_md_info_t *md_info = NULL;
 
-    memset( md_name, 0x00, 100 );
-    memset( output, 0x00, 100 );
+    memset(md_name, 0x00, 100);
+    memset(output, 0x00, 100);
 
-    strncpy( (char *) md_name, text_md_name, sizeof( md_name ) - 1 );
-    md_info = mbedtls_md_info_from_string( md_name );
-    TEST_ASSERT( md_info != NULL );
+    strncpy((char *) md_name, text_md_name, sizeof(md_name) - 1);
+    md_info = mbedtls_md_info_from_string(md_name);
+    TEST_ASSERT(md_info != NULL);
 
-    TEST_ASSERT ( 0 == mbedtls_md( md_info, src_str->x, src_str->len, output ) );
+    TEST_ASSERT(0 == mbedtls_md(md_info, src_str->x, src_str->len, output));
 
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
-                                      mbedtls_md_get_size( md_info ),
-                                      hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
+                                    mbedtls_md_get_size(md_info),
+                                    hash->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void md_text_multi( char * text_md_name, char * text_src_string,
-                    data_t * hash )
+void md_text_multi(char *text_md_name, char *text_src_string,
+                   data_t *hash)
 {
     char md_name[100];
     unsigned char src_str[1000];
@@ -188,51 +189,51 @@
     const mbedtls_md_info_t *md_info = NULL;
     mbedtls_md_context_t ctx, ctx_copy;
 
-    mbedtls_md_init( &ctx );
-    mbedtls_md_init( &ctx_copy );
+    mbedtls_md_init(&ctx);
+    mbedtls_md_init(&ctx_copy);
 
-    memset( md_name, 0x00, 100 );
-    memset( src_str, 0x00, 1000 );
-    memset( output, 0x00, 100 );
+    memset(md_name, 0x00, 100);
+    memset(src_str, 0x00, 1000);
+    memset(output, 0x00, 100);
 
-    strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
-    strncpy( (char *) md_name, text_md_name, sizeof(md_name) - 1 );
-    len = strlen( (char *) src_str );
+    strncpy((char *) src_str, text_src_string, sizeof(src_str) - 1);
+    strncpy((char *) md_name, text_md_name, sizeof(md_name) - 1);
+    len = strlen((char *) src_str);
     halfway = len / 2;
 
     md_info = mbedtls_md_info_from_string(md_name);
-    TEST_ASSERT( md_info != NULL );
-    TEST_ASSERT ( 0 == mbedtls_md_setup( &ctx, md_info, 0 ) );
-    TEST_ASSERT ( 0 == mbedtls_md_setup( &ctx_copy, md_info, 0 ) );
+    TEST_ASSERT(md_info != NULL);
+    TEST_ASSERT(0 == mbedtls_md_setup(&ctx, md_info, 0));
+    TEST_ASSERT(0 == mbedtls_md_setup(&ctx_copy, md_info, 0));
 
-    TEST_ASSERT ( 0 == mbedtls_md_starts( &ctx ) );
-    TEST_ASSERT ( ctx.md_ctx != NULL );
-    TEST_ASSERT ( 0 == mbedtls_md_update( &ctx, src_str, halfway ) );
-    TEST_ASSERT ( 0 == mbedtls_md_clone( &ctx_copy, &ctx ) );
+    TEST_ASSERT(0 == mbedtls_md_starts(&ctx));
+    TEST_ASSERT(ctx.md_ctx != NULL);
+    TEST_ASSERT(0 == mbedtls_md_update(&ctx, src_str, halfway));
+    TEST_ASSERT(0 == mbedtls_md_clone(&ctx_copy, &ctx));
 
-    TEST_ASSERT ( 0 == mbedtls_md_update( &ctx, src_str + halfway, len - halfway ) );
-    TEST_ASSERT ( 0 == mbedtls_md_finish( &ctx, output ) );
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
-                                      mbedtls_md_get_size( md_info ),
-                                      hash->len) == 0 );
+    TEST_ASSERT(0 == mbedtls_md_update(&ctx, src_str + halfway, len - halfway));
+    TEST_ASSERT(0 == mbedtls_md_finish(&ctx, output));
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
+                                    mbedtls_md_get_size(md_info),
+                                    hash->len) == 0);
 
     /* Test clone */
-    memset( output, 0x00, 100 );
+    memset(output, 0x00, 100);
 
-    TEST_ASSERT ( 0 == mbedtls_md_update( &ctx_copy, src_str + halfway, len - halfway ) );
-    TEST_ASSERT ( 0 == mbedtls_md_finish( &ctx_copy, output ) );
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
-                                      mbedtls_md_get_size( md_info ),
-                                      hash->len ) == 0 );
+    TEST_ASSERT(0 == mbedtls_md_update(&ctx_copy, src_str + halfway, len - halfway));
+    TEST_ASSERT(0 == mbedtls_md_finish(&ctx_copy, output));
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
+                                    mbedtls_md_get_size(md_info),
+                                    hash->len) == 0);
 
 exit:
-    mbedtls_md_free( &ctx );
-    mbedtls_md_free( &ctx_copy );
+    mbedtls_md_free(&ctx);
+    mbedtls_md_free(&ctx_copy);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void md_hex_multi( char * text_md_name, data_t * src_str, data_t * hash )
+void md_hex_multi(char *text_md_name, data_t *src_str, data_t *hash)
 {
     char md_name[100];
     unsigned char output[100];
@@ -240,73 +241,74 @@
     mbedtls_md_context_t ctx, ctx_copy;
     int halfway;
 
-    mbedtls_md_init( &ctx );
-    mbedtls_md_init( &ctx_copy );
+    mbedtls_md_init(&ctx);
+    mbedtls_md_init(&ctx_copy);
 
-    memset( md_name, 0x00, 100 );
-    memset( output, 0x00, 100 );
+    memset(md_name, 0x00, 100);
+    memset(output, 0x00, 100);
 
-    strncpy( (char *) md_name, text_md_name, sizeof( md_name ) - 1 );
+    strncpy((char *) md_name, text_md_name, sizeof(md_name) - 1);
     md_info = mbedtls_md_info_from_string(md_name);
-    TEST_ASSERT( md_info != NULL );
-    TEST_ASSERT ( 0 == mbedtls_md_setup( &ctx, md_info, 0 ) );
-    TEST_ASSERT ( 0 == mbedtls_md_setup( &ctx_copy, md_info, 0 ) );
+    TEST_ASSERT(md_info != NULL);
+    TEST_ASSERT(0 == mbedtls_md_setup(&ctx, md_info, 0));
+    TEST_ASSERT(0 == mbedtls_md_setup(&ctx_copy, md_info, 0));
 
     halfway = src_str->len / 2;
 
-    TEST_ASSERT ( 0 == mbedtls_md_starts( &ctx ) );
-    TEST_ASSERT ( ctx.md_ctx != NULL );
-    TEST_ASSERT ( 0 == mbedtls_md_update( &ctx, src_str->x, halfway ) );
-    TEST_ASSERT ( 0 == mbedtls_md_clone( &ctx_copy, &ctx ) );
+    TEST_ASSERT(0 == mbedtls_md_starts(&ctx));
+    TEST_ASSERT(ctx.md_ctx != NULL);
+    TEST_ASSERT(0 == mbedtls_md_update(&ctx, src_str->x, halfway));
+    TEST_ASSERT(0 == mbedtls_md_clone(&ctx_copy, &ctx));
 
-    TEST_ASSERT ( 0 == mbedtls_md_update( &ctx, src_str->x + halfway, src_str->len - halfway) );
-    TEST_ASSERT ( 0 == mbedtls_md_finish( &ctx, output ) );
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
-                                      mbedtls_md_get_size( md_info ),
-                                      hash->len ) == 0 );
+    TEST_ASSERT(0 == mbedtls_md_update(&ctx, src_str->x + halfway, src_str->len - halfway));
+    TEST_ASSERT(0 == mbedtls_md_finish(&ctx, output));
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
+                                    mbedtls_md_get_size(md_info),
+                                    hash->len) == 0);
 
     /* Test clone */
-    memset( output, 0x00, 100 );
+    memset(output, 0x00, 100);
 
-    TEST_ASSERT ( 0 == mbedtls_md_update( &ctx_copy, src_str->x + halfway, src_str->len - halfway ) );
-    TEST_ASSERT ( 0 == mbedtls_md_finish( &ctx_copy, output ) );
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
-                                      mbedtls_md_get_size( md_info ),
-                                      hash->len ) == 0 );
+    TEST_ASSERT(0 == mbedtls_md_update(&ctx_copy, src_str->x + halfway, src_str->len - halfway));
+    TEST_ASSERT(0 == mbedtls_md_finish(&ctx_copy, output));
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
+                                    mbedtls_md_get_size(md_info),
+                                    hash->len) == 0);
 
 exit:
-    mbedtls_md_free( &ctx );
-    mbedtls_md_free( &ctx_copy );
+    mbedtls_md_free(&ctx);
+    mbedtls_md_free(&ctx_copy);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_md_hmac( char * text_md_name, int trunc_size,
-                      data_t * key_str, data_t * src_str,
-                      data_t * hash )
+void mbedtls_md_hmac(char *text_md_name, int trunc_size,
+                     data_t *key_str, data_t *src_str,
+                     data_t *hash)
 {
     char md_name[100];
     unsigned char output[100];
     const mbedtls_md_info_t *md_info = NULL;
 
-    memset( md_name, 0x00, 100 );
-    memset( output, 0x00, 100 );
+    memset(md_name, 0x00, 100);
+    memset(output, 0x00, 100);
 
-    strncpy( (char *) md_name, text_md_name, sizeof( md_name ) - 1 );
-    md_info = mbedtls_md_info_from_string( md_name );
-    TEST_ASSERT( md_info != NULL );
+    strncpy((char *) md_name, text_md_name, sizeof(md_name) - 1);
+    md_info = mbedtls_md_info_from_string(md_name);
+    TEST_ASSERT(md_info != NULL);
 
 
-    TEST_ASSERT ( mbedtls_md_hmac( md_info, key_str->x, key_str->len, src_str->x, src_str->len, output ) == 0 );
+    TEST_ASSERT(mbedtls_md_hmac(md_info, key_str->x, key_str->len, src_str->x, src_str->len,
+                                output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
-                                      trunc_size, hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
+                                    trunc_size, hash->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void md_hmac_multi( char * text_md_name, int trunc_size, data_t * key_str,
-                    data_t * src_str, data_t * hash )
+void md_hmac_multi(char *text_md_name, int trunc_size, data_t *key_str,
+                   data_t *src_str, data_t *hash)
 {
     char md_name[100];
     unsigned char output[100];
@@ -314,62 +316,62 @@
     mbedtls_md_context_t ctx;
     int halfway;
 
-    mbedtls_md_init( &ctx );
+    mbedtls_md_init(&ctx);
 
-    memset( md_name, 0x00, 100 );
-    memset( output, 0x00, 100 );
+    memset(md_name, 0x00, 100);
+    memset(output, 0x00, 100);
 
-    strncpy( (char *) md_name, text_md_name, sizeof( md_name ) - 1 );
-    md_info = mbedtls_md_info_from_string( md_name );
-    TEST_ASSERT( md_info != NULL );
-    TEST_ASSERT ( 0 == mbedtls_md_setup( &ctx, md_info, 1 ) );
+    strncpy((char *) md_name, text_md_name, sizeof(md_name) - 1);
+    md_info = mbedtls_md_info_from_string(md_name);
+    TEST_ASSERT(md_info != NULL);
+    TEST_ASSERT(0 == mbedtls_md_setup(&ctx, md_info, 1));
 
     halfway = src_str->len / 2;
 
-    TEST_ASSERT ( 0 == mbedtls_md_hmac_starts( &ctx, key_str->x, key_str->len ) );
-    TEST_ASSERT ( ctx.md_ctx != NULL );
-    TEST_ASSERT ( 0 == mbedtls_md_hmac_update( &ctx, src_str->x, halfway ) );
-    TEST_ASSERT ( 0 == mbedtls_md_hmac_update( &ctx, src_str->x + halfway, src_str->len - halfway ) );
-    TEST_ASSERT ( 0 == mbedtls_md_hmac_finish( &ctx, output ) );
+    TEST_ASSERT(0 == mbedtls_md_hmac_starts(&ctx, key_str->x, key_str->len));
+    TEST_ASSERT(ctx.md_ctx != NULL);
+    TEST_ASSERT(0 == mbedtls_md_hmac_update(&ctx, src_str->x, halfway));
+    TEST_ASSERT(0 == mbedtls_md_hmac_update(&ctx, src_str->x + halfway, src_str->len - halfway));
+    TEST_ASSERT(0 == mbedtls_md_hmac_finish(&ctx, output));
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
-                                      trunc_size, hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
+                                    trunc_size, hash->len) == 0);
 
     /* Test again, for reset() */
-    memset( output, 0x00, 100 );
+    memset(output, 0x00, 100);
 
-    TEST_ASSERT ( 0 == mbedtls_md_hmac_reset( &ctx ) );
-    TEST_ASSERT ( 0 == mbedtls_md_hmac_update( &ctx, src_str->x, halfway ) );
-    TEST_ASSERT ( 0 == mbedtls_md_hmac_update( &ctx, src_str->x + halfway, src_str->len - halfway ) );
-    TEST_ASSERT ( 0 == mbedtls_md_hmac_finish( &ctx, output ) );
+    TEST_ASSERT(0 == mbedtls_md_hmac_reset(&ctx));
+    TEST_ASSERT(0 == mbedtls_md_hmac_update(&ctx, src_str->x, halfway));
+    TEST_ASSERT(0 == mbedtls_md_hmac_update(&ctx, src_str->x + halfway, src_str->len - halfway));
+    TEST_ASSERT(0 == mbedtls_md_hmac_finish(&ctx, output));
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
-                                      trunc_size, hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
+                                    trunc_size, hash->len) == 0);
 
 exit:
-    mbedtls_md_free( &ctx );
+    mbedtls_md_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO */
-void mbedtls_md_file( char * text_md_name, char * filename,
-                      data_t * hash )
+void mbedtls_md_file(char *text_md_name, char *filename,
+                     data_t *hash)
 {
     char md_name[100];
     unsigned char output[100];
     const mbedtls_md_info_t *md_info = NULL;
 
-    memset( md_name, 0x00, 100 );
-    memset( output, 0x00, 100 );
+    memset(md_name, 0x00, 100);
+    memset(output, 0x00, 100);
 
-    strncpy( (char *) md_name, text_md_name, sizeof( md_name ) - 1 );
-    md_info = mbedtls_md_info_from_string( md_name );
-    TEST_ASSERT( md_info != NULL );
+    strncpy((char *) md_name, text_md_name, sizeof(md_name) - 1);
+    md_info = mbedtls_md_info_from_string(md_name);
+    TEST_ASSERT(md_info != NULL);
 
-    TEST_ASSERT( mbedtls_md_file( md_info, filename, output ) == 0 );
+    TEST_ASSERT(mbedtls_md_file(md_info, filename, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
-                                      mbedtls_md_get_size( md_info ),
-                                      hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
+                                    mbedtls_md_get_size(md_info),
+                                    hash->len) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_mdx.function b/tests/suites/test_suite_mdx.function
index aa35c58..452acf5 100644
--- a/tests/suites/test_suite_mdx.function
+++ b/tests/suites/test_suite_mdx.function
@@ -6,67 +6,67 @@
 /* END_HEADER */
 
 /* BEGIN_CASE depends_on:MBEDTLS_MD2_C */
-void md2_text( char * text_src_string, data_t * hash )
+void md2_text(char *text_src_string, data_t *hash)
 {
     int ret;
     unsigned char src_str[100];
     unsigned char output[16];
 
-    memset( src_str, 0x00, sizeof src_str );
-    memset( output, 0x00, sizeof output );
+    memset(src_str, 0x00, sizeof src_str);
+    memset(output, 0x00, sizeof output);
 
-    strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
+    strncpy((char *) src_str, text_src_string, sizeof(src_str) - 1);
 
-    ret = mbedtls_md2_ret( src_str, strlen( (char *) src_str ), output );
-    TEST_ASSERT( ret == 0 ) ;
+    ret = mbedtls_md2_ret(src_str, strlen((char *) src_str), output);
+    TEST_ASSERT(ret == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
-                                      sizeof  output, hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
+                                    sizeof output, hash->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_MD4_C */
-void md4_text( char * text_src_string, data_t * hash )
+void md4_text(char *text_src_string, data_t *hash)
 {
     int ret;
     unsigned char src_str[100];
     unsigned char output[16];
 
-    memset( src_str, 0x00, sizeof src_str );
-    memset( output, 0x00, sizeof output );
+    memset(src_str, 0x00, sizeof src_str);
+    memset(output, 0x00, sizeof output);
 
-    strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
+    strncpy((char *) src_str, text_src_string, sizeof(src_str) - 1);
 
-    ret = mbedtls_md4_ret( src_str, strlen( (char *) src_str ), output );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_md4_ret(src_str, strlen((char *) src_str), output);
+    TEST_ASSERT(ret == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
-                                      sizeof  output, hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
+                                    sizeof output, hash->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_MD5_C */
-void md5_text( char * text_src_string, data_t * hash )
+void md5_text(char *text_src_string, data_t *hash)
 {
     int ret;
     unsigned char src_str[100];
     unsigned char output[16];
 
-    memset( src_str, 0x00, sizeof src_str );
-    memset( output, 0x00, sizeof output );
+    memset(src_str, 0x00, sizeof src_str);
+    memset(output, 0x00, sizeof output);
 
-    strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
+    strncpy((char *) src_str, text_src_string, sizeof(src_str) - 1);
 
-    ret = mbedtls_md5_ret( src_str, strlen( (char *) src_str ), output );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_md5_ret(src_str, strlen((char *) src_str), output);
+    TEST_ASSERT(ret == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
-                                      sizeof  output, hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
+                                    sizeof output, hash->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_RIPEMD160_C */
-void ripemd160_text( char * text_src_string, data_t * hash )
+void ripemd160_text(char *text_src_string, data_t *hash)
 {
     int ret;
     unsigned char src_str[100];
@@ -75,40 +75,40 @@
     memset(src_str, 0x00, sizeof src_str);
     memset(output, 0x00, sizeof output);
 
-    strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
+    strncpy((char *) src_str, text_src_string, sizeof(src_str) - 1);
 
-    ret = mbedtls_ripemd160_ret( src_str, strlen( (char *) src_str ), output );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_ripemd160_ret(src_str, strlen((char *) src_str), output);
+    TEST_ASSERT(ret == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x,
-                                      sizeof output, hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
+                                    sizeof output, hash->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_MD2_C:MBEDTLS_SELF_TEST */
-void md2_selftest(  )
+void md2_selftest()
 {
-    TEST_ASSERT( mbedtls_md2_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_md2_self_test(1) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_MD4_C:MBEDTLS_SELF_TEST */
-void md4_selftest(  )
+void md4_selftest()
 {
-    TEST_ASSERT( mbedtls_md4_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_md4_self_test(1) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_MD5_C:MBEDTLS_SELF_TEST */
-void md5_selftest(  )
+void md5_selftest()
 {
-    TEST_ASSERT( mbedtls_md5_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_md5_self_test(1) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_RIPEMD160_C:MBEDTLS_SELF_TEST */
-void ripemd160_selftest(  )
+void ripemd160_selftest()
 {
-    TEST_ASSERT( mbedtls_ripemd160_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_ripemd160_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_memory_buffer_alloc.function b/tests/suites/test_suite_memory_buffer_alloc.function
index cc884c2..2b81097 100644
--- a/tests/suites/test_suite_memory_buffer_alloc.function
+++ b/tests/suites/test_suite_memory_buffer_alloc.function
@@ -10,34 +10,36 @@
  */
 
 /* BEGIN_SUITE_HELPERS */
-static int check_pointer( void *p )
+static int check_pointer(void *p)
 {
-    if( p == NULL )
-        return( -1 );
+    if (p == NULL) {
+        return -1;
+    }
 
-    if( (size_t) p % MBEDTLS_MEMORY_ALIGN_MULTIPLE != 0 )
-        return( -1 );
+    if ((size_t) p % MBEDTLS_MEMORY_ALIGN_MULTIPLE != 0) {
+        return -1;
+    }
 
-    return( 0 );
+    return 0;
 }
 /* END_SUITE_HELPERS */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void mbedtls_memory_buffer_alloc_self_test(  )
+void mbedtls_memory_buffer_alloc_self_test()
 {
-    TEST_ASSERT( mbedtls_memory_buffer_alloc_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_memory_buffer_alloc_self_test(1) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void memory_buffer_alloc_free_alloc( int a_bytes, int b_bytes, int c_bytes,
-                                     int d_bytes, int free_a, int free_b,
-                                     int free_c, int free_d, int e_bytes,
-                                     int f_bytes )
+void memory_buffer_alloc_free_alloc(int a_bytes, int b_bytes, int c_bytes,
+                                    int d_bytes, int free_a, int free_b,
+                                    int free_c, int free_d, int e_bytes,
+                                    int f_bytes)
 {
     unsigned char buf[1024];
     unsigned char *ptr_a = NULL, *ptr_b = NULL, *ptr_c = NULL, *ptr_d = NULL,
-                    *ptr_e = NULL, *ptr_f = NULL;
+                  *ptr_e = NULL, *ptr_f = NULL;
 
 #if defined(MBEDTLS_MEMORY_DEBUG)
     size_t reported_blocks;
@@ -45,98 +47,88 @@
 #endif
     size_t allocated_bytes = 0;
 
-    mbedtls_memory_buffer_alloc_init( buf, sizeof( buf ) );
+    mbedtls_memory_buffer_alloc_init(buf, sizeof(buf));
 
-    mbedtls_memory_buffer_set_verify( MBEDTLS_MEMORY_VERIFY_ALWAYS );
+    mbedtls_memory_buffer_set_verify(MBEDTLS_MEMORY_VERIFY_ALWAYS);
 
-    if( a_bytes > 0 )
-    {
-        ptr_a = mbedtls_calloc( a_bytes, sizeof(char) );
-        TEST_ASSERT( check_pointer( ptr_a ) == 0 );
+    if (a_bytes > 0) {
+        ptr_a = mbedtls_calloc(a_bytes, sizeof(char));
+        TEST_ASSERT(check_pointer(ptr_a) == 0);
 
         allocated_bytes += a_bytes * sizeof(char);
     }
 
-    if( b_bytes > 0 )
-    {
-        ptr_b = mbedtls_calloc( b_bytes, sizeof(char) );
-        TEST_ASSERT( check_pointer( ptr_b ) == 0 );
+    if (b_bytes > 0) {
+        ptr_b = mbedtls_calloc(b_bytes, sizeof(char));
+        TEST_ASSERT(check_pointer(ptr_b) == 0);
 
         allocated_bytes += b_bytes * sizeof(char);
     }
 
-    if( c_bytes > 0 )
-    {
-        ptr_c = mbedtls_calloc( c_bytes, sizeof(char) );
-        TEST_ASSERT( check_pointer( ptr_c ) == 0 );
+    if (c_bytes > 0) {
+        ptr_c = mbedtls_calloc(c_bytes, sizeof(char));
+        TEST_ASSERT(check_pointer(ptr_c) == 0);
 
         allocated_bytes += c_bytes * sizeof(char);
     }
 
-    if( d_bytes > 0 )
-    {
-        ptr_d = mbedtls_calloc( d_bytes, sizeof(char) );
-        TEST_ASSERT( check_pointer( ptr_d ) == 0 );
+    if (d_bytes > 0) {
+        ptr_d = mbedtls_calloc(d_bytes, sizeof(char));
+        TEST_ASSERT(check_pointer(ptr_d) == 0);
 
         allocated_bytes += d_bytes * sizeof(char);
     }
 
 #if defined(MBEDTLS_MEMORY_DEBUG)
-    mbedtls_memory_buffer_alloc_cur_get( &reported_bytes, &reported_blocks );
-    TEST_ASSERT( reported_bytes == allocated_bytes );
+    mbedtls_memory_buffer_alloc_cur_get(&reported_bytes, &reported_blocks);
+    TEST_ASSERT(reported_bytes == allocated_bytes);
 #endif
 
-    if( free_a )
-    {
-        mbedtls_free( ptr_a );
+    if (free_a) {
+        mbedtls_free(ptr_a);
         ptr_a = NULL;
-        TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
+        TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() == 0);
 
         allocated_bytes -= a_bytes * sizeof(char);
     }
 
-    if( free_b )
-    {
-        mbedtls_free( ptr_b );
+    if (free_b) {
+        mbedtls_free(ptr_b);
         ptr_b = NULL;
-        TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
+        TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() == 0);
 
         allocated_bytes -= b_bytes * sizeof(char);
     }
 
-    if( free_c )
-    {
-        mbedtls_free( ptr_c );
+    if (free_c) {
+        mbedtls_free(ptr_c);
         ptr_c = NULL;
-        TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
+        TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() == 0);
 
         allocated_bytes -= c_bytes * sizeof(char);
     }
 
-    if( free_d )
-    {
-        mbedtls_free( ptr_d );
+    if (free_d) {
+        mbedtls_free(ptr_d);
         ptr_d = NULL;
-        TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
+        TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() == 0);
 
         allocated_bytes -= d_bytes * sizeof(char);
     }
 
 #if defined(MBEDTLS_MEMORY_DEBUG)
-    mbedtls_memory_buffer_alloc_cur_get( &reported_bytes, &reported_blocks );
-    TEST_ASSERT( reported_bytes == allocated_bytes );
+    mbedtls_memory_buffer_alloc_cur_get(&reported_bytes, &reported_blocks);
+    TEST_ASSERT(reported_bytes == allocated_bytes);
 #endif
 
-    if( e_bytes > 0 )
-    {
-        ptr_e = mbedtls_calloc( e_bytes, sizeof(char) );
-        TEST_ASSERT( check_pointer( ptr_e ) == 0 );
+    if (e_bytes > 0) {
+        ptr_e = mbedtls_calloc(e_bytes, sizeof(char));
+        TEST_ASSERT(check_pointer(ptr_e) == 0);
     }
 
-    if( f_bytes > 0 )
-    {
-        ptr_f = mbedtls_calloc( f_bytes, sizeof(char) );
-        TEST_ASSERT( check_pointer( ptr_f ) == 0 );
+    if (f_bytes > 0) {
+        ptr_f = mbedtls_calloc(f_bytes, sizeof(char));
+        TEST_ASSERT(check_pointer(ptr_f) == 0);
     }
 
     /* Once blocks are reallocated, the block allocated to the memory request
@@ -144,61 +136,55 @@
      * bytes, and makes it hard to know what the reported size will be, so
      * we don't check the size after blocks have been reallocated. */
 
-    if( ptr_a != NULL )
-    {
-        mbedtls_free( ptr_a );
+    if (ptr_a != NULL) {
+        mbedtls_free(ptr_a);
         ptr_a = NULL;
-        TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
+        TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() == 0);
     }
 
-    if( ptr_b != NULL )
-    {
-        mbedtls_free( ptr_b );
+    if (ptr_b != NULL) {
+        mbedtls_free(ptr_b);
         ptr_b = NULL;
-        TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
+        TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() == 0);
     }
 
-    if( ptr_c != NULL )
-    {
-        mbedtls_free( ptr_c );
+    if (ptr_c != NULL) {
+        mbedtls_free(ptr_c);
         ptr_c = NULL;
-        TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
+        TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() == 0);
     }
 
-    if( ptr_d != NULL )
-    {
-        mbedtls_free( ptr_d );
+    if (ptr_d != NULL) {
+        mbedtls_free(ptr_d);
         ptr_d = NULL;
-        TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
+        TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() == 0);
     }
 
-    if( ptr_e != NULL )
-    {
-        mbedtls_free( ptr_e );
+    if (ptr_e != NULL) {
+        mbedtls_free(ptr_e);
         ptr_e = NULL;
-        TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
+        TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() == 0);
     }
 
-    if( ptr_f != NULL )
-    {
-        mbedtls_free( ptr_f );
+    if (ptr_f != NULL) {
+        mbedtls_free(ptr_f);
         ptr_f = NULL;
     }
 
 #if defined(MBEDTLS_MEMORY_DEBUG)
-    mbedtls_memory_buffer_alloc_cur_get( &reported_bytes, &reported_blocks );
-    TEST_ASSERT( reported_bytes == 0 );
+    mbedtls_memory_buffer_alloc_cur_get(&reported_bytes, &reported_blocks);
+    TEST_ASSERT(reported_bytes == 0);
 #endif
 
-    TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
+    TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() == 0);
 
 exit:
-    mbedtls_memory_buffer_alloc_free( );
+    mbedtls_memory_buffer_alloc_free();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void memory_buffer_alloc_oom_test(  )
+void memory_buffer_alloc_oom_test()
 {
     unsigned char buf[1024];
     unsigned char *ptr_a = NULL, *ptr_b = NULL, *ptr_c = NULL;
@@ -206,71 +192,70 @@
     size_t reported_blocks, reported_bytes;
 #endif
 
-    (void)ptr_c;
+    (void) ptr_c;
 
-    mbedtls_memory_buffer_alloc_init( buf, sizeof( buf ) );
+    mbedtls_memory_buffer_alloc_init(buf, sizeof(buf));
 
-    mbedtls_memory_buffer_set_verify( MBEDTLS_MEMORY_VERIFY_ALWAYS );
+    mbedtls_memory_buffer_set_verify(MBEDTLS_MEMORY_VERIFY_ALWAYS);
 
-    ptr_a = mbedtls_calloc( 432, sizeof(char) );
-    TEST_ASSERT( check_pointer( ptr_a ) == 0 );
+    ptr_a = mbedtls_calloc(432, sizeof(char));
+    TEST_ASSERT(check_pointer(ptr_a) == 0);
 
-    ptr_b = mbedtls_calloc( 432, sizeof(char) );
-    TEST_ASSERT( check_pointer( ptr_b ) == 0 );
+    ptr_b = mbedtls_calloc(432, sizeof(char));
+    TEST_ASSERT(check_pointer(ptr_b) == 0);
 
-    ptr_c = mbedtls_calloc( 431, sizeof(char) );
-    TEST_ASSERT( ptr_c == NULL );
+    ptr_c = mbedtls_calloc(431, sizeof(char));
+    TEST_ASSERT(ptr_c == NULL);
 
 #if defined(MBEDTLS_MEMORY_DEBUG)
-    mbedtls_memory_buffer_alloc_cur_get( &reported_bytes, &reported_blocks );
-    TEST_ASSERT( reported_bytes >= 864 && reported_bytes <= sizeof(buf) );
+    mbedtls_memory_buffer_alloc_cur_get(&reported_bytes, &reported_blocks);
+    TEST_ASSERT(reported_bytes >= 864 && reported_bytes <= sizeof(buf));
 #endif
 
-    mbedtls_free( ptr_a );
+    mbedtls_free(ptr_a);
     ptr_a = NULL;
-    TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
+    TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() == 0);
 
-    mbedtls_free( ptr_b );
+    mbedtls_free(ptr_b);
     ptr_b = NULL;
-    TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
+    TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() == 0);
 
 #if defined(MBEDTLS_MEMORY_DEBUG)
-    mbedtls_memory_buffer_alloc_cur_get( &reported_bytes, &reported_blocks );
-    TEST_ASSERT( reported_bytes == 0 );
+    mbedtls_memory_buffer_alloc_cur_get(&reported_bytes, &reported_blocks);
+    TEST_ASSERT(reported_bytes == 0);
 #endif
 
-    TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
+    TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() == 0);
 
 exit:
-    mbedtls_memory_buffer_alloc_free( );
+    mbedtls_memory_buffer_alloc_free();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void memory_buffer_heap_too_small( )
+void memory_buffer_heap_too_small()
 {
     unsigned char buf[1];
 
-    mbedtls_memory_buffer_alloc_init( buf, sizeof( buf ) );
+    mbedtls_memory_buffer_alloc_init(buf, sizeof(buf));
     /* With MBEDTLS_MEMORY_DEBUG enabled, this prints a message
      * "FATAL: verification of first header failed".
      */
-    TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() != 0 );
+    TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() != 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void memory_buffer_underalloc( )
+void memory_buffer_underalloc()
 {
     unsigned char buf[100];
     size_t i;
 
-    mbedtls_memory_buffer_alloc_init( buf, sizeof( buf ) );
-    for( i = 1; i < MBEDTLS_MEMORY_ALIGN_MULTIPLE; i++ )
-    {
-        TEST_ASSERT( mbedtls_calloc( 1,
-                     (size_t)-( MBEDTLS_MEMORY_ALIGN_MULTIPLE - i ) ) == NULL );
-        TEST_ASSERT( mbedtls_memory_buffer_alloc_verify() == 0 );
+    mbedtls_memory_buffer_alloc_init(buf, sizeof(buf));
+    for (i = 1; i < MBEDTLS_MEMORY_ALIGN_MULTIPLE; i++) {
+        TEST_ASSERT(mbedtls_calloc(1,
+                                   (size_t) -(MBEDTLS_MEMORY_ALIGN_MULTIPLE - i)) == NULL);
+        TEST_ASSERT(mbedtls_memory_buffer_alloc_verify() == 0);
     }
 
 exit:
diff --git a/tests/suites/test_suite_mps.function b/tests/suites/test_suite_mps.function
index 5ef3288..a9ccf22 100644
--- a/tests/suites/test_suite_mps.function
+++ b/tests/suites/test_suite_mps.function
@@ -25,7 +25,7 @@
  */
 
 /* BEGIN_CASE depends_on:TEST_SUITE_MPS_READER */
-void mbedtls_mps_reader_no_pausing_single_step_single_round( int with_acc )
+void mbedtls_mps_reader_no_pausing_single_step_single_round(int with_acc)
 {
     /* This test exercises the most basic use of the MPS reader:
      * - The 'producing' layer provides a buffer
@@ -46,29 +46,31 @@
     unsigned char *tmp;
     int paused;
     mbedtls_mps_reader rd;
-    for( size_t i=0; (unsigned) i < sizeof( bufA ); i++ )
+    for (size_t i = 0; (unsigned) i < sizeof(bufA); i++) {
         bufA[i] = (unsigned char) i;
+    }
 
     /* Preparation (lower layer) */
-    if( with_acc == 0 )
-        mbedtls_mps_reader_init( &rd, NULL, 0 );
-    else
-        mbedtls_mps_reader_init( &rd, acc, sizeof( acc ) );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufA, sizeof( bufA ) ) == 0 );
+    if (with_acc == 0) {
+        mbedtls_mps_reader_init(&rd, NULL, 0);
+    } else {
+        mbedtls_mps_reader_init(&rd, acc, sizeof(acc));
+    }
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufA, sizeof(bufA)) == 0);
     /* Consumption (upper layer) */
     /* Consume exactly what's available */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 100, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 100, bufA, 100 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 100, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 100, bufA, 100);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
     /* Wrapup (lower layer) */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, &paused ) == 0 );
-    TEST_ASSERT( paused == 0 );
-    mbedtls_mps_reader_free( &rd );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, &paused) == 0);
+    TEST_ASSERT(paused == 0);
+    mbedtls_mps_reader_free(&rd);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:TEST_SUITE_MPS_READER */
-void mbedtls_mps_reader_no_pausing_single_step_multiple_rounds( int with_acc )
+void mbedtls_mps_reader_no_pausing_single_step_multiple_rounds(int with_acc)
 {
     /* This test exercises multiple rounds of the basic use of the MPS reader:
      * - The 'producing' layer provides a buffer
@@ -89,37 +91,40 @@
     unsigned char acc[10];
     unsigned char *tmp;
     mbedtls_mps_reader rd;
-    for( size_t i=0; (unsigned) i < sizeof( bufA ); i++ )
+    for (size_t i = 0; (unsigned) i < sizeof(bufA); i++) {
         bufA[i] = (unsigned char) i;
-    for( size_t i=0; (unsigned) i < sizeof( bufB ); i++ )
-        bufB[i] = ~ ((unsigned char) i);
+    }
+    for (size_t i = 0; (unsigned) i < sizeof(bufB); i++) {
+        bufB[i] = ~((unsigned char) i);
+    }
 
     /* Preparation (lower layer) */
-    if( with_acc == 0 )
-        mbedtls_mps_reader_init( &rd, NULL, 0 );
-    else
-        mbedtls_mps_reader_init( &rd, acc, sizeof( acc ) );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufA, sizeof( bufA ) ) == 0 );
+    if (with_acc == 0) {
+        mbedtls_mps_reader_init(&rd, NULL, 0);
+    } else {
+        mbedtls_mps_reader_init(&rd, acc, sizeof(acc));
+    }
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufA, sizeof(bufA)) == 0);
     /* Consumption (upper layer) */
     /* Consume exactly what's available */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 100, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 100, bufA, 100 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 100, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 100, bufA, 100);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
     /* Preparation */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufB, sizeof( bufB ) ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufB, sizeof(bufB)) == 0);
     /* Consumption */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 100, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 100, bufB, 100 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 100, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 100, bufB, 100);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
     /* Wrapup (lower layer) */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
-    mbedtls_mps_reader_free( &rd );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
+    mbedtls_mps_reader_free(&rd);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:TEST_SUITE_MPS_READER */
-void mbedtls_mps_reader_no_pausing_multiple_steps_single_round( int with_acc )
+void mbedtls_mps_reader_no_pausing_multiple_steps_single_round(int with_acc)
 {
     /* This test exercises one round of the following:
      * - The 'producing' layer provides a buffer
@@ -144,31 +149,33 @@
     unsigned char *tmp;
     mbedtls_mps_size_t tmp_len;
     mbedtls_mps_reader rd;
-    for( size_t i=0; (unsigned) i < sizeof( buf ); i++ )
+    for (size_t i = 0; (unsigned) i < sizeof(buf); i++) {
         buf[i] = (unsigned char) i;
+    }
 
     /* Preparation (lower layer) */
-    if( with_acc == 0 )
-        mbedtls_mps_reader_init( &rd, NULL, 0 );
-    else
-        mbedtls_mps_reader_init( &rd, acc, sizeof( acc ) );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, buf, sizeof( buf ) ) == 0 );
+    if (with_acc == 0) {
+        mbedtls_mps_reader_init(&rd, NULL, 0);
+    } else {
+        mbedtls_mps_reader_init(&rd, acc, sizeof(acc));
+    }
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, buf, sizeof(buf)) == 0);
     /* Consumption (upper layer) */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 10, buf, 10 );
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 70, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 70, buf + 10, 70 );
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 30, &tmp, &tmp_len ) == 0 );
-    ASSERT_COMPARE( tmp, tmp_len, buf + 80, 20 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 10, buf, 10);
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 70, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 70, buf + 10, 70);
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 30, &tmp, &tmp_len) == 0);
+    ASSERT_COMPARE(tmp, tmp_len, buf + 80, 20);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
     /* Wrapup (lower layer) */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
-    mbedtls_mps_reader_free( &rd );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
+    mbedtls_mps_reader_free(&rd);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:TEST_SUITE_MPS_READER */
-void mbedtls_mps_reader_no_pausing_multiple_steps_multiple_rounds( int with_acc )
+void mbedtls_mps_reader_no_pausing_multiple_steps_multiple_rounds(int with_acc)
 {
     /* This test exercises one round of fetching a buffer in multiple chunks
      * and passing it back to the producer afterwards, followed by another
@@ -179,35 +186,38 @@
     unsigned char *tmp;
     mbedtls_mps_size_t tmp_len;
     mbedtls_mps_reader rd;
-    for( size_t i=0; (unsigned) i < sizeof( bufA ); i++ )
+    for (size_t i = 0; (unsigned) i < sizeof(bufA); i++) {
         bufA[i] = (unsigned char) i;
-    for( size_t i=0; (unsigned) i < sizeof( bufB ); i++ )
-        bufB[i] = ~ ((unsigned char) i);
+    }
+    for (size_t i = 0; (unsigned) i < sizeof(bufB); i++) {
+        bufB[i] = ~((unsigned char) i);
+    }
 
     /* Preparation (lower layer) */
-    if( with_acc == 0 )
-        mbedtls_mps_reader_init( &rd, NULL, 0 );
-    else
-        mbedtls_mps_reader_init( &rd, acc, sizeof( acc ) );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufA, sizeof( bufA ) ) == 0 );
+    if (with_acc == 0) {
+        mbedtls_mps_reader_init(&rd, NULL, 0);
+    } else {
+        mbedtls_mps_reader_init(&rd, acc, sizeof(acc));
+    }
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufA, sizeof(bufA)) == 0);
     /* Consumption (upper layer) */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 10, bufA, 10 );
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 70, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 70, bufA + 10, 70 );
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 30, &tmp, &tmp_len ) == 0 );
-    ASSERT_COMPARE( tmp, tmp_len, bufA + 80, 20 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 10, bufA, 10);
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 70, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 70, bufA + 10, 70);
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 30, &tmp, &tmp_len) == 0);
+    ASSERT_COMPARE(tmp, tmp_len, bufA + 80, 20);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
     /* Preparation */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufB, sizeof( bufB ) ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufB, sizeof(bufB)) == 0);
     /* Consumption */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 100, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 100, bufB, 100 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 100, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 100, bufB, 100);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
     /* Wrapup */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
-    mbedtls_mps_reader_free( &rd );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
+    mbedtls_mps_reader_free(&rd);
 }
 /* END_CASE */
 
@@ -224,22 +234,23 @@
     unsigned char buf[100];
     unsigned char *tmp;
     mbedtls_mps_reader rd;
-    for( size_t i=0; (unsigned) i < sizeof( buf ); i++ )
+    for (size_t i = 0; (unsigned) i < sizeof(buf); i++) {
         buf[i] = (unsigned char) i;
+    }
 
     /* Preparation (lower layer) */
-    mbedtls_mps_reader_init( &rd, NULL, 0 );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, buf, sizeof( buf ) ) == 0 );
+    mbedtls_mps_reader_init(&rd, NULL, 0);
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, buf, sizeof(buf)) == 0);
     /* Consumption (upper layer) */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 50, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 50, buf, 50 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 100, &tmp, NULL ) ==
-                 MBEDTLS_ERR_MPS_READER_OUT_OF_DATA );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 50, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 50, buf, 50);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 100, &tmp, NULL) ==
+                MBEDTLS_ERR_MPS_READER_OUT_OF_DATA);
     /* Wrapup (lower layer) */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) ==
-                 MBEDTLS_ERR_MPS_READER_NEED_ACCUMULATOR );
-    mbedtls_mps_reader_free( &rd );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) ==
+                MBEDTLS_ERR_MPS_READER_NEED_ACCUMULATOR);
+    mbedtls_mps_reader_free(&rd);
 }
 /* END_CASE */
 
@@ -264,28 +275,29 @@
     mbedtls_mps_reader rd;
     mbedtls_mps_size_t tmp_len;
 
-    for( size_t i=0; (unsigned) i < sizeof( buf ); i++ )
+    for (size_t i = 0; (unsigned) i < sizeof(buf); i++) {
         buf[i] = (unsigned char) i;
+    }
 
     /* Preparation (lower layer) */
-    mbedtls_mps_reader_init( &rd, acc, sizeof( acc ) );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, buf, sizeof( buf ) ) == 0 );
+    mbedtls_mps_reader_init(&rd, acc, sizeof(acc));
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, buf, sizeof(buf)) == 0);
     /* Consumption (upper layer) */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 50, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 50, buf, 50 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 10, buf + 50, 10 );
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 100, &tmp, NULL ) ==
-                 MBEDTLS_ERR_MPS_READER_OUT_OF_DATA );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 50, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 50, buf, 50);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 10, buf + 50, 10);
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 100, &tmp, NULL) ==
+                MBEDTLS_ERR_MPS_READER_OUT_OF_DATA);
     /* Wrapup (lower layer) */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) ==
-                 MBEDTLS_ERR_MPS_READER_ACCUMULATOR_TOO_SMALL );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) ==
+                MBEDTLS_ERR_MPS_READER_ACCUMULATOR_TOO_SMALL);
 
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 50, &tmp, &tmp_len ) == 0 );
-    ASSERT_COMPARE( tmp, tmp_len, buf + 50, 50 );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 50, &tmp, &tmp_len) == 0);
+    ASSERT_COMPARE(tmp, tmp_len, buf + 50, 50);
 
-    mbedtls_mps_reader_free( &rd );
+    mbedtls_mps_reader_free(&rd);
 }
 /* END_CASE */
 
@@ -304,28 +316,29 @@
     unsigned char *tmp;
     mbedtls_mps_reader rd;
 
-    for( size_t i=0; (unsigned) i < sizeof( buf ); i++ )
+    for (size_t i = 0; (unsigned) i < sizeof(buf); i++) {
         buf[i] = (unsigned char) i;
+    }
 
     /* Preparation (lower layer) */
-    mbedtls_mps_reader_init( &rd, acc, sizeof( acc ) );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, buf, sizeof( buf ) ) == 0 );
+    mbedtls_mps_reader_init(&rd, acc, sizeof(acc));
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, buf, sizeof(buf)) == 0);
     /* Consumption (upper layer) */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 50, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 50, buf, 50 );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 50, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 50, buf, 50);
     /* Excess request */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, (mbedtls_mps_size_t) -1, &tmp, NULL ) ==
-                 MBEDTLS_ERR_MPS_READER_OUT_OF_DATA );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, (mbedtls_mps_size_t) -1, &tmp, NULL) ==
+                MBEDTLS_ERR_MPS_READER_OUT_OF_DATA);
     /* Wrapup (lower layer) */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) ==
-                 MBEDTLS_ERR_MPS_READER_ACCUMULATOR_TOO_SMALL );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) ==
+                MBEDTLS_ERR_MPS_READER_ACCUMULATOR_TOO_SMALL);
 
-    mbedtls_mps_reader_free( &rd );
+    mbedtls_mps_reader_free(&rd);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:TEST_SUITE_MPS_READER */
-void mbedtls_mps_reader_pausing( int option )
+void mbedtls_mps_reader_pausing(int option)
 {
     /* This test exercises the behaviour of the reader when the
      * accumulator is used to fulfill a consumer's request.
@@ -349,108 +362,108 @@
     unsigned char acc[40];
     int paused;
     mbedtls_mps_reader rd;
-    for( size_t i=0; (unsigned) i < sizeof( bufA ); i++ )
+    for (size_t i = 0; (unsigned) i < sizeof(bufA); i++) {
         bufA[i] = (unsigned char) i;
-    for( size_t i=0; (unsigned) i < sizeof( bufB ); i++ )
-        bufB[i] = ~ ((unsigned char) i);
+    }
+    for (size_t i = 0; (unsigned) i < sizeof(bufB); i++) {
+        bufB[i] = ~((unsigned char) i);
+    }
 
     /* Preparation (lower layer) */
-    mbedtls_mps_reader_init( &rd, acc, sizeof( acc ) );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufA, sizeof( bufA ) ) == 0 );
+    mbedtls_mps_reader_init(&rd, acc, sizeof(acc));
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufA, sizeof(bufA)) == 0);
 
     /* Consumption (upper layer) */
     /* Ask for more than what's available. */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 80, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 80, bufA, 80 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 10, bufA + 80, 10 );
-    switch( option )
-    {
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 80, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 80, bufA, 80);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 10, bufA + 80, 10);
+    switch (option) {
         case 0:  /* Single uncommitted fetch at pausing */
         case 1:
-            TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+            TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
             break;
         default: /* Multiple uncommitted fetches at pausing */
             break;
     }
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) ==
-                 MBEDTLS_ERR_MPS_READER_OUT_OF_DATA );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) ==
+                MBEDTLS_ERR_MPS_READER_OUT_OF_DATA);
 
     /* Preparation */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, &paused ) == 0 );
-    TEST_ASSERT( paused == 1 );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufB, sizeof( bufB ) ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, &paused) == 0);
+    TEST_ASSERT(paused == 1);
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufB, sizeof(bufB)) == 0);
 
     /* Consumption */
-    switch( option )
-    {
+    switch (option) {
         case 0: /* Single fetch at pausing, re-fetch with commit. */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 90, 10 );
-            ASSERT_COMPARE( tmp + 10, 10, bufB, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 90, 10);
+            ASSERT_COMPARE(tmp + 10, 10, bufB, 10);
+            TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
             break;
 
         case 1: /* Single fetch at pausing, re-fetch without commit. */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 90, 10 );
-            ASSERT_COMPARE( tmp + 10, 10, bufB, 10 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 90, 10);
+            ASSERT_COMPARE(tmp + 10, 10, bufB, 10);
             break;
 
         case 2: /* Multiple fetches at pausing, repeat without commit. */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 80, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 90, 10 );
-            ASSERT_COMPARE( tmp + 10, 10, bufB, 10 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 80, 10);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 90, 10);
+            ASSERT_COMPARE(tmp + 10, 10, bufB, 10);
             break;
 
         case 3: /* Multiple fetches at pausing, repeat with commit 1. */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 80, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 90, 10 );
-            ASSERT_COMPARE( tmp + 10, 10, bufB, 10 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 80, 10);
+            TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 90, 10);
+            ASSERT_COMPARE(tmp + 10, 10, bufB, 10);
             break;
 
         case 4: /* Multiple fetches at pausing, repeat with commit 2. */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 80, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 90, 10 );
-            ASSERT_COMPARE( tmp + 10, 10, bufB, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 80, 10);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 90, 10);
+            ASSERT_COMPARE(tmp + 10, 10, bufB, 10);
+            TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
             break;
 
         case 5: /* Multiple fetches at pausing, repeat with commit 3. */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 80, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 90, 10 );
-            ASSERT_COMPARE( tmp + 10, 10, bufB, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 80, 10);
+            TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 90, 10);
+            ASSERT_COMPARE(tmp + 10, 10, bufB, 10);
+            TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
             break;
 
         default:
-            TEST_ASSERT( 0 );
+            TEST_ASSERT(0);
     }
 
     /* In all cases, fetch the rest of the second buffer. */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 90, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 90, bufB + 10, 90 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 90, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 90, bufB + 10, 90);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
 
     /* Wrapup */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
-    mbedtls_mps_reader_free( &rd );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
+    mbedtls_mps_reader_free(&rd);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:TEST_SUITE_MPS_READER */
-void mbedtls_mps_reader_pausing_multiple_feeds( int option )
+void mbedtls_mps_reader_pausing_multiple_feeds(int option)
 {
     /* This test exercises the behaviour of the MPS reader
      * in the following situation:
@@ -471,93 +484,91 @@
     unsigned char acc[70];
     mbedtls_mps_reader rd;
     mbedtls_mps_size_t fetch_len;
-    for( size_t i=0; (unsigned) i < sizeof( bufA ); i++ )
+    for (size_t i = 0; (unsigned) i < sizeof(bufA); i++) {
         bufA[i] = (unsigned char) i;
-    for( size_t i=0; (unsigned) i < sizeof( bufB ); i++ )
-        bufB[i] = ~ ((unsigned char) i);
+    }
+    for (size_t i = 0; (unsigned) i < sizeof(bufB); i++) {
+        bufB[i] = ~((unsigned char) i);
+    }
 
     /* Preparation (lower layer) */
-    mbedtls_mps_reader_init( &rd, acc, sizeof( acc ) );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufA, sizeof( bufA ) ) == 0 );
+    mbedtls_mps_reader_init(&rd, acc, sizeof(acc));
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufA, sizeof(bufA)) == 0);
 
     /* Consumption (upper layer) */
     /* Ask for more than what's available. */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 80, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 80, bufA, 80 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 80, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 80, bufA, 80);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
     /* 20 left, ask for 70 -> 50 overhead */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 70, &tmp, NULL ) ==
-                 MBEDTLS_ERR_MPS_READER_OUT_OF_DATA );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 70, &tmp, NULL) ==
+                MBEDTLS_ERR_MPS_READER_OUT_OF_DATA);
 
     /* Preparation */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
-    switch( option )
-    {
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
+    switch (option) {
         case 0: /* 10 + 10 + 80 byte feed */
-            TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufB, 10 ) ==
-                         MBEDTLS_ERR_MPS_READER_NEED_MORE );
-            TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufB + 10, 10 ) ==
-                         MBEDTLS_ERR_MPS_READER_NEED_MORE );
-            TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufB + 20, 80 ) == 0 );
+            TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufB, 10) ==
+                        MBEDTLS_ERR_MPS_READER_NEED_MORE);
+            TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufB + 10, 10) ==
+                        MBEDTLS_ERR_MPS_READER_NEED_MORE);
+            TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufB + 20, 80) == 0);
             break;
 
         case 1: /* 50 x 1byte */
-            for( size_t num_feed = 0; num_feed < 49; num_feed++ )
-            {
-                TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufB + num_feed, 1 ) ==
-                             MBEDTLS_ERR_MPS_READER_NEED_MORE );
+            for (size_t num_feed = 0; num_feed < 49; num_feed++) {
+                TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufB + num_feed, 1) ==
+                            MBEDTLS_ERR_MPS_READER_NEED_MORE);
             }
-            TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufB + 49, 1 ) == 0 );
+            TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufB + 49, 1) == 0);
             break;
 
         case 2: /* 49 x 1byte + 51bytes */
-            for( size_t num_feed = 0; num_feed < 49; num_feed++ )
-            {
-                TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufB + num_feed, 1 ) ==
-                             MBEDTLS_ERR_MPS_READER_NEED_MORE );
+            for (size_t num_feed = 0; num_feed < 49; num_feed++) {
+                TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufB + num_feed, 1) ==
+                            MBEDTLS_ERR_MPS_READER_NEED_MORE);
             }
-            TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufB + 49, 51 ) == 0 );
+            TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufB + 49, 51) == 0);
             break;
 
         default:
-            TEST_ASSERT( 0 );
+            TEST_ASSERT(0);
             break;
     }
 
     /* Consumption */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 70, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 20, bufA + 80, 20 );
-    ASSERT_COMPARE( tmp + 20, 50, bufB, 50 );
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 1000, &tmp, &fetch_len ) == 0 );
-    switch( option )
-    {
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 70, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 20, bufA + 80, 20);
+    ASSERT_COMPARE(tmp + 20, 50, bufB, 50);
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 1000, &tmp, &fetch_len) == 0);
+    switch (option) {
         case 0:
-            TEST_ASSERT( fetch_len == 50 );
+            TEST_ASSERT(fetch_len == 50);
             break;
 
         case 1:
-            TEST_ASSERT( fetch_len == 0 );
+            TEST_ASSERT(fetch_len == 0);
             break;
 
         case 2:
-            TEST_ASSERT( fetch_len == 50 );
+            TEST_ASSERT(fetch_len == 50);
             break;
 
         default:
-            TEST_ASSERT( 0 );
+            TEST_ASSERT(0);
             break;
     }
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
 
     /* Wrapup */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
-    mbedtls_mps_reader_free( &rd );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
+    mbedtls_mps_reader_free(&rd);
 }
 /* END_CASE */
 
 
 /* BEGIN_CASE depends_on:TEST_SUITE_MPS_READER */
-void mbedtls_mps_reader_reclaim_data_left( int option )
+void mbedtls_mps_reader_reclaim_data_left(int option)
 {
     /* This test exercises the behaviour of the MPS reader when a
      * call to mbedtls_mps_reader_reclaim() is made before all data
@@ -566,53 +577,53 @@
     unsigned char buf[100];
     unsigned char *tmp;
     mbedtls_mps_reader rd;
-    for( size_t i=0; (unsigned) i < sizeof( buf ); i++ )
+    for (size_t i = 0; (unsigned) i < sizeof(buf); i++) {
         buf[i] = (unsigned char) i;
+    }
 
     /* Preparation (lower layer) */
-    mbedtls_mps_reader_init( &rd, NULL, 0 );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, buf, sizeof( buf ) ) == 0 );
+    mbedtls_mps_reader_init(&rd, NULL, 0);
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, buf, sizeof(buf)) == 0);
 
     /* Consumption (upper layer) */
-    switch( option )
-    {
+    switch (option) {
         case 0:
             /* Fetch (but not commit) the entire buffer. */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, sizeof( buf ), &tmp, NULL )
-                         == 0 );
-            ASSERT_COMPARE( tmp, 100, buf, 100 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, sizeof(buf), &tmp, NULL)
+                        == 0);
+            ASSERT_COMPARE(tmp, 100, buf, 100);
             break;
 
         case 1:
             /* Fetch (but not commit) parts of the buffer. */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, sizeof( buf ) / 2,
-                                             &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, sizeof( buf ) / 2, buf, sizeof( buf ) / 2 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, sizeof(buf) / 2,
+                                               &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, sizeof(buf) / 2, buf, sizeof(buf) / 2);
             break;
 
         case 2:
             /* Fetch and commit parts of the buffer, then
              * fetch but not commit the rest of the buffer. */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, sizeof( buf ) / 2,
-                                             &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, sizeof( buf ) / 2, buf, sizeof( buf ) / 2 );
-            TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, sizeof( buf ) / 2,
-                                             &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, sizeof( buf ) / 2,
-                            buf + sizeof( buf ) / 2,
-                            sizeof( buf ) / 2 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, sizeof(buf) / 2,
+                                               &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, sizeof(buf) / 2, buf, sizeof(buf) / 2);
+            TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, sizeof(buf) / 2,
+                                               &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, sizeof(buf) / 2,
+                           buf + sizeof(buf) / 2,
+                           sizeof(buf) / 2);
             break;
 
         default:
-            TEST_ASSERT( 0 );
+            TEST_ASSERT(0);
             break;
     }
 
     /* Wrapup */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) ==
-                 MBEDTLS_ERR_MPS_READER_DATA_LEFT );
-    mbedtls_mps_reader_free( &rd );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) ==
+                MBEDTLS_ERR_MPS_READER_DATA_LEFT);
+    mbedtls_mps_reader_free(&rd);
 }
 /* END_CASE */
 
@@ -626,33 +637,34 @@
     unsigned char *tmp;
     mbedtls_mps_reader rd;
 
-    for( size_t i=0; (unsigned) i < sizeof( buf ); i++ )
+    for (size_t i = 0; (unsigned) i < sizeof(buf); i++) {
         buf[i] = (unsigned char) i;
+    }
 
     /* Preparation (lower layer) */
-    mbedtls_mps_reader_init( &rd, NULL, 0 );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, buf, sizeof( buf ) ) == 0 );
+    mbedtls_mps_reader_init(&rd, NULL, 0);
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, buf, sizeof(buf)) == 0);
     /* Consumption (upper layer) */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 50, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 50, buf, 50 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 50, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 50, buf + 50, 50 );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 50, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 50, buf, 50);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 50, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 50, buf + 50, 50);
     /* Preparation */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) ==
-                 MBEDTLS_ERR_MPS_READER_DATA_LEFT );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) ==
+                MBEDTLS_ERR_MPS_READER_DATA_LEFT);
     /* Consumption */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 50, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 50, buf + 50, 50 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 50, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 50, buf + 50, 50);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
     /* Wrapup */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
-    mbedtls_mps_reader_free( &rd );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
+    mbedtls_mps_reader_free(&rd);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:TEST_SUITE_MPS_READER */
-void mbedtls_mps_reader_multiple_pausing( int option )
+void mbedtls_mps_reader_multiple_pausing(int option)
 {
     /* This test exercises the behaviour of the MPS reader
      * in the following situation:
@@ -670,126 +682,128 @@
     unsigned char acc[50];
     mbedtls_mps_size_t tmp_len;
     mbedtls_mps_reader rd;
-    for( size_t i=0; (unsigned) i < sizeof( bufA ); i++ )
+    for (size_t i = 0; (unsigned) i < sizeof(bufA); i++) {
         bufA[i] = (unsigned char) i;
-    for( size_t i=0; (unsigned) i < sizeof( bufB ); i++ )
-        bufB[i] = ~ ((unsigned char) i);
-    for( size_t i=0; (unsigned) i < sizeof( bufC ); i++ )
-        bufC[i] = ~ ((unsigned char) i);
+    }
+    for (size_t i = 0; (unsigned) i < sizeof(bufB); i++) {
+        bufB[i] = ~((unsigned char) i);
+    }
+    for (size_t i = 0; (unsigned) i < sizeof(bufC); i++) {
+        bufC[i] = ~((unsigned char) i);
+    }
 
     /* Preparation (lower layer) */
-    mbedtls_mps_reader_init( &rd, acc, sizeof( acc ) );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufA, sizeof( bufA ) ) == 0 );
+    mbedtls_mps_reader_init(&rd, acc, sizeof(acc));
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufA, sizeof(bufA)) == 0);
 
     /* Consumption (upper layer) */
     /* Ask for more than what's available. */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 80, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 80, bufA, 80 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 10, bufA + 80, 10 );
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) ==
-                 MBEDTLS_ERR_MPS_READER_OUT_OF_DATA );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 80, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 80, bufA, 80);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 10, bufA + 80, 10);
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) ==
+                MBEDTLS_ERR_MPS_READER_OUT_OF_DATA);
 
     /* Preparation */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufB, sizeof( bufB ) ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufB, sizeof(bufB)) == 0);
 
-    switch( option )
-    {
+    switch (option) {
         case 0: /* Fetch same chunks, commit afterwards, and
                  * then exceed bounds of new buffer; accumulator
                  * large enough. */
 
             /* Consume */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, &tmp_len ) == 0 );
-            ASSERT_COMPARE( tmp, tmp_len, bufA + 80, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 90, 10 );
-            ASSERT_COMPARE( tmp + 10, 10, bufB, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) ==
-                         MBEDTLS_ERR_MPS_READER_OUT_OF_DATA );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, &tmp_len) == 0);
+            ASSERT_COMPARE(tmp, tmp_len, bufA + 80, 10);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 90, 10);
+            ASSERT_COMPARE(tmp + 10, 10, bufB, 10);
+            TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) ==
+                        MBEDTLS_ERR_MPS_READER_OUT_OF_DATA);
 
             /* Prepare */
-            TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
-            TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufC, sizeof( bufC ) ) == 0 );;
+            TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
+            TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufC, sizeof(bufC)) == 0);;
 
             /* Consume */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufB + 10, 10 );
-            ASSERT_COMPARE( tmp + 10, 10, bufC, 10 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufB + 10, 10);
+            ASSERT_COMPARE(tmp + 10, 10, bufC, 10);
             break;
 
         case 1: /* Fetch same chunks, commit afterwards, and
                  * then exceed bounds of new buffer; accumulator
                  * not large enough. */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 80, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 90, 10 );
-            ASSERT_COMPARE( tmp + 10, 10, bufB, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 51, &tmp, NULL ) ==
-                         MBEDTLS_ERR_MPS_READER_OUT_OF_DATA );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 80, 10);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 90, 10);
+            ASSERT_COMPARE(tmp + 10, 10, bufB, 10);
+            TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 51, &tmp, NULL) ==
+                        MBEDTLS_ERR_MPS_READER_OUT_OF_DATA);
 
             /* Prepare */
-            TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) ==
-                         MBEDTLS_ERR_MPS_READER_ACCUMULATOR_TOO_SMALL );
+            TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) ==
+                        MBEDTLS_ERR_MPS_READER_ACCUMULATOR_TOO_SMALL);
             break;
 
         case 2: /* Fetch same chunks, don't commit afterwards, and
                  * then exceed bounds of new buffer; accumulator
                  * large enough. */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 80, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 90, 10 );
-            ASSERT_COMPARE( tmp + 10, 10, bufB, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) ==
-                         MBEDTLS_ERR_MPS_READER_OUT_OF_DATA );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 80, 10);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 90, 10);
+            ASSERT_COMPARE(tmp + 10, 10, bufB, 10);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) ==
+                        MBEDTLS_ERR_MPS_READER_OUT_OF_DATA);
 
             /* Prepare */
-            TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
-            TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufC, sizeof( bufC ) ) == 0 );;
+            TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
+            TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufC, sizeof(bufC)) == 0);;
 
             /* Consume */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 50, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 20, bufA + 80, 20 );
-            ASSERT_COMPARE( tmp + 20, 20, bufB, 20 );
-            ASSERT_COMPARE( tmp + 40, 10, bufC, 10 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 50, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 20, bufA + 80, 20);
+            ASSERT_COMPARE(tmp + 20, 20, bufB, 20);
+            ASSERT_COMPARE(tmp + 40, 10, bufC, 10);
             break;
 
         case 3: /* Fetch same chunks, don't commit afterwards, and
                  * then exceed bounds of new buffer; accumulator
                  * not large enough. */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 80, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 10, bufA + 90, 10 );
-            ASSERT_COMPARE( tmp + 10, 10, bufB, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 21, &tmp, NULL ) ==
-                         MBEDTLS_ERR_MPS_READER_OUT_OF_DATA );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 80, 10);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 10, bufA + 90, 10);
+            ASSERT_COMPARE(tmp + 10, 10, bufB, 10);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 21, &tmp, NULL) ==
+                        MBEDTLS_ERR_MPS_READER_OUT_OF_DATA);
 
             /* Prepare */
-            TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) ==
-                         MBEDTLS_ERR_MPS_READER_ACCUMULATOR_TOO_SMALL );
+            TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) ==
+                        MBEDTLS_ERR_MPS_READER_ACCUMULATOR_TOO_SMALL);
             break;
 
         default:
-            TEST_ASSERT( 0 );
+            TEST_ASSERT(0);
             break;
     }
 
-    mbedtls_mps_reader_free( &rd );
+    mbedtls_mps_reader_free(&rd);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:TEST_SUITE_MPS_READER:MBEDTLS_MPS_STATE_VALIDATION */
-void mbedtls_mps_reader_random_usage( int num_out_chunks,
-                                      int max_chunk_size,
-                                      int max_request,
-                                      int acc_size )
+void mbedtls_mps_reader_random_usage(int num_out_chunks,
+                                     int max_chunk_size,
+                                     int max_request,
+                                     int acc_size)
 
 {
     /* Randomly pass a reader object back and forth between lower and
@@ -829,130 +843,108 @@
                         * returning the reader to the upper layer. */
     mbedtls_mps_reader rd;
 
-    if( acc_size > 0 )
-    {
-        ASSERT_ALLOC( acc, acc_size );
+    if (acc_size > 0) {
+        ASSERT_ALLOC(acc, acc_size);
     }
 
     /* This probably needs to be changed because we want
      * our tests to be deterministic. */
     //    srand( time( NULL ) );
 
-    ASSERT_ALLOC( outgoing, num_out_chunks * max_chunk_size );
-    ASSERT_ALLOC( incoming, num_out_chunks * max_chunk_size );
+    ASSERT_ALLOC(outgoing, num_out_chunks * max_chunk_size);
+    ASSERT_ALLOC(incoming, num_out_chunks * max_chunk_size);
 
-    mbedtls_mps_reader_init( &rd, acc, acc_size );
+    mbedtls_mps_reader_init(&rd, acc, acc_size);
 
     cur_out_chunk = 0;
     in_commit = 0;
     in_fetch = 0;
     out_pos = 0;
-    while( cur_out_chunk < (unsigned) num_out_chunks )
-    {
-        if( mode == 0 )
-        {
+    while (cur_out_chunk < (unsigned) num_out_chunks) {
+        if (mode == 0) {
             /* Choose randomly between reclaim and feed */
             rand_op = rand() % 2;
 
-            if( rand_op == 0 )
-            {
+            if (rand_op == 0) {
                 /* Reclaim */
-                ret = mbedtls_mps_reader_reclaim( &rd, NULL );
+                ret = mbedtls_mps_reader_reclaim(&rd, NULL);
 
-                if( ret == 0 )
-                {
-                    TEST_ASSERT( cur_chunk != NULL );
-                    mbedtls_free( cur_chunk );
+                if (ret == 0) {
+                    TEST_ASSERT(cur_chunk != NULL);
+                    mbedtls_free(cur_chunk);
                     cur_chunk = NULL;
                 }
                 reclaimed = 1;
-            }
-            else
-            {
+            } else {
                 /* Feed reader with a random chunk */
                 unsigned char *tmp = NULL;
                 size_t tmp_size;
-                if( cur_out_chunk == (unsigned) num_out_chunks )
+                if (cur_out_chunk == (unsigned) num_out_chunks) {
                     continue;
+                }
 
-                tmp_size = ( rand() % max_chunk_size ) + 1;
-                ASSERT_ALLOC( tmp, tmp_size );
+                tmp_size = (rand() % max_chunk_size) + 1;
+                ASSERT_ALLOC(tmp, tmp_size);
 
-                TEST_ASSERT( mbedtls_test_rnd_std_rand( NULL, tmp, tmp_size ) == 0 );
-                ret = mbedtls_mps_reader_feed( &rd, tmp, tmp_size );
+                TEST_ASSERT(mbedtls_test_rnd_std_rand(NULL, tmp, tmp_size) == 0);
+                ret = mbedtls_mps_reader_feed(&rd, tmp, tmp_size);
 
-                if( ret == 0 || ret == MBEDTLS_ERR_MPS_READER_NEED_MORE )
-                {
+                if (ret == 0 || ret == MBEDTLS_ERR_MPS_READER_NEED_MORE) {
                     cur_out_chunk++;
-                    memcpy( outgoing + out_pos, tmp, tmp_size );
+                    memcpy(outgoing + out_pos, tmp, tmp_size);
                     out_pos += tmp_size;
                 }
 
-                if( ret == 0 )
-                {
-                    TEST_ASSERT( cur_chunk == NULL );
+                if (ret == 0) {
+                    TEST_ASSERT(cur_chunk == NULL);
                     cur_chunk = tmp;
-                }
-                else
-                {
-                    mbedtls_free( tmp );
+                } else {
+                    mbedtls_free(tmp);
                 }
 
             }
 
             /* Randomly switch to consumption mode if reclaim
              * was called at least once. */
-            if( reclaimed == 1 && rand() % 3 == 0 )
-            {
+            if (reclaimed == 1 && rand() % 3 == 0) {
                 in_fetch = 0;
                 mode = 1;
             }
-        }
-        else
-        {
+        } else {
             /* Choose randomly between get tolerating fewer data,
              * get not tolerating fewer data, and commit. */
             rand_op = rand() % 3;
-            if( rand_op == 0 || rand_op == 1 )
-            {
+            if (rand_op == 0 || rand_op == 1) {
                 mbedtls_mps_size_t get_size, real_size;
                 unsigned char *chunk_get;
-                get_size = ( rand() % max_request ) + 1;
-                if( rand_op == 0 )
-                {
-                    ret = mbedtls_mps_reader_get( &rd, get_size, &chunk_get,
-                                              &real_size );
-                }
-                else
-                {
+                get_size = (rand() % max_request) + 1;
+                if (rand_op == 0) {
+                    ret = mbedtls_mps_reader_get(&rd, get_size, &chunk_get,
+                                                 &real_size);
+                } else {
                     real_size = get_size;
-                    ret = mbedtls_mps_reader_get( &rd, get_size, &chunk_get, NULL );
+                    ret = mbedtls_mps_reader_get(&rd, get_size, &chunk_get, NULL);
                 }
 
                 /* Check if output is in accordance with what was written */
-                if( ret == 0 )
-                {
-                    memcpy( incoming + in_commit + in_fetch,
-                            chunk_get, real_size );
-                    TEST_ASSERT( memcmp( incoming + in_commit + in_fetch,
-                                         outgoing + in_commit + in_fetch,
-                                         real_size ) == 0 );
+                if (ret == 0) {
+                    memcpy(incoming + in_commit + in_fetch,
+                           chunk_get, real_size);
+                    TEST_ASSERT(memcmp(incoming + in_commit + in_fetch,
+                                       outgoing + in_commit + in_fetch,
+                                       real_size) == 0);
                     in_fetch += real_size;
                 }
-            }
-            else if( rand_op == 2 ) /* Commit */
-            {
-                ret = mbedtls_mps_reader_commit( &rd );
-                if( ret == 0 )
-                {
+            } else if (rand_op == 2) { /* Commit */
+                ret = mbedtls_mps_reader_commit(&rd);
+                if (ret == 0) {
                     in_commit += in_fetch;
                     in_fetch = 0;
                 }
             }
 
             /* Randomly switch back to preparation */
-            if( rand() % 3 == 0 )
-            {
+            if (rand() % 3 == 0) {
                 reclaimed = 0;
                 mode = 0;
             }
@@ -960,16 +952,16 @@
     }
 
     /* Cleanup */
-    mbedtls_mps_reader_free( &rd );
-    mbedtls_free( incoming );
-    mbedtls_free( outgoing );
-    mbedtls_free( acc );
-    mbedtls_free( cur_chunk );
+    mbedtls_mps_reader_free(&rd);
+    mbedtls_free(incoming);
+    mbedtls_free(outgoing);
+    mbedtls_free(acc);
+    mbedtls_free(cur_chunk);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:TEST_SUITE_MPS_READER */
-void mbedtls_reader_inconsistent_usage( int option )
+void mbedtls_reader_inconsistent_usage(int option)
 {
     /* This test exercises the behaviour of the MPS reader
      * in the following situation:
@@ -989,130 +981,130 @@
     unsigned char acc[40];
     mbedtls_mps_reader rd;
     int success = 0;
-    for( size_t i=0; (unsigned) i < sizeof( bufA ); i++ )
+    for (size_t i = 0; (unsigned) i < sizeof(bufA); i++) {
         bufA[i] = (unsigned char) i;
-    for( size_t i=0; (unsigned) i < sizeof( bufB ); i++ )
-        bufB[i] = ~ ((unsigned char) i);
+    }
+    for (size_t i = 0; (unsigned) i < sizeof(bufB); i++) {
+        bufB[i] = ~((unsigned char) i);
+    }
 
     /* Preparation (lower layer) */
-    mbedtls_mps_reader_init( &rd, acc, sizeof( acc ) );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufA, sizeof( bufA ) ) == 0 );
+    mbedtls_mps_reader_init(&rd, acc, sizeof(acc));
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufA, sizeof(bufA)) == 0);
     /* Consumption (upper layer) */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 80, &tmp, NULL ) == 0 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, NULL ) == 0 );
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 20, &tmp, NULL ) ==
-                 MBEDTLS_ERR_MPS_READER_OUT_OF_DATA );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 80, &tmp, NULL) == 0);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, NULL) == 0);
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 20, &tmp, NULL) ==
+                MBEDTLS_ERR_MPS_READER_OUT_OF_DATA);
     /* Preparation */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, bufB, sizeof( bufB ) ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, bufB, sizeof(bufB)) == 0);
     /* Consumption */
-    switch( option )
-    {
+    switch (option) {
         case 0:
             /* Ask for buffered data in a single chunk, no commit */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 30, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 20, bufA + 80, 20 );
-            ASSERT_COMPARE( tmp + 20, 10, bufB, 10 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 30, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 20, bufA + 80, 20);
+            ASSERT_COMPARE(tmp + 20, 10, bufB, 10);
             success = 1;
             break;
 
         case 1:
             /* Ask for buffered data in a single chunk, with commit */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 30, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 20, bufA + 80, 20 );
-            ASSERT_COMPARE( tmp + 20, 10, bufB, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 30, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 20, bufA + 80, 20);
+            ASSERT_COMPARE(tmp + 20, 10, bufB, 10);
+            TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
             success = 1;
             break;
 
         case 2:
             /* Ask for more than was requested when pausing, #1 */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 31, &tmp, NULL ) ==
-                         MBEDTLS_ERR_MPS_READER_INCONSISTENT_REQUESTS );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 31, &tmp, NULL) ==
+                        MBEDTLS_ERR_MPS_READER_INCONSISTENT_REQUESTS);
             break;
 
         case 3:
             /* Ask for more than was requested when pausing #2 */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, (mbedtls_mps_size_t) -1, &tmp, NULL ) ==
-                         MBEDTLS_ERR_MPS_READER_INCONSISTENT_REQUESTS );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, (mbedtls_mps_size_t) -1, &tmp, NULL) ==
+                        MBEDTLS_ERR_MPS_READER_INCONSISTENT_REQUESTS);
             break;
 
         case 4:
             /* Asking for buffered data in different
              * chunks than before CAN fail. */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 15, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 15, bufA + 80, 15 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 10, &tmp, NULL ) ==
-                         MBEDTLS_ERR_MPS_READER_INCONSISTENT_REQUESTS );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 15, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 15, bufA + 80, 15);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 10, &tmp, NULL) ==
+                        MBEDTLS_ERR_MPS_READER_INCONSISTENT_REQUESTS);
             break;
 
         case 5:
             /* Asking for buffered data different chunks
              * than before NEED NOT fail - no commits */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 15, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 15, bufA + 80, 15 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 15, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 5, bufA + 95, 5 );
-            ASSERT_COMPARE( tmp + 5, 10, bufB, 10 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 15, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 15, bufA + 80, 15);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 15, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 5, bufA + 95, 5);
+            ASSERT_COMPARE(tmp + 5, 10, bufB, 10);
             success = 1;
             break;
 
         case 6:
             /* Asking for buffered data different chunks
              * than before NEED NOT fail - intermediate commit */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 15, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 15, bufA + 80, 15 );
-            TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 15, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 5, bufA + 95, 5 );
-            ASSERT_COMPARE( tmp + 5, 10, bufB, 10 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 15, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 15, bufA + 80, 15);
+            TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 15, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 5, bufA + 95, 5);
+            ASSERT_COMPARE(tmp + 5, 10, bufB, 10);
             success = 1;
             break;
 
         case 7:
             /* Asking for buffered data different chunks
              * than before NEED NOT fail - end commit */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 15, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 15, bufA + 80, 15 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 15, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 5, bufA + 95, 5 );
-            ASSERT_COMPARE( tmp + 5, 10, bufB, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 15, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 15, bufA + 80, 15);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 15, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 5, bufA + 95, 5);
+            ASSERT_COMPARE(tmp + 5, 10, bufB, 10);
+            TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
             success = 1;
             break;
 
         case 8:
             /* Asking for buffered data different chunks
              * than before NEED NOT fail - intermediate & end commit */
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 15, &tmp, NULL ) == 0 );
-            ASSERT_COMPARE( tmp, 15, bufA + 80, 15 );
-            TEST_ASSERT( mbedtls_mps_reader_get( &rd, 15, &tmp, NULL ) == 0 );
-            TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
-            ASSERT_COMPARE( tmp, 5, bufA + 95, 5 );
-            ASSERT_COMPARE( tmp + 5, 10, bufB, 10 );
-            TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 15, &tmp, NULL) == 0);
+            ASSERT_COMPARE(tmp, 15, bufA + 80, 15);
+            TEST_ASSERT(mbedtls_mps_reader_get(&rd, 15, &tmp, NULL) == 0);
+            TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
+            ASSERT_COMPARE(tmp, 5, bufA + 95, 5);
+            ASSERT_COMPARE(tmp + 5, 10, bufB, 10);
+            TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
             success = 1;
             break;
 
         default:
-            TEST_ASSERT( 0 );
+            TEST_ASSERT(0);
             break;
     }
 
-    if( success == 1 )
-    {
+    if (success == 1) {
         /* In all succeeding cases, fetch the rest of the second buffer. */
-        TEST_ASSERT( mbedtls_mps_reader_get( &rd, 90, &tmp, NULL ) == 0 );
-        ASSERT_COMPARE( tmp, 90, bufB + 10, 90 );
-        TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+        TEST_ASSERT(mbedtls_mps_reader_get(&rd, 90, &tmp, NULL) == 0);
+        ASSERT_COMPARE(tmp, 90, bufB + 10, 90);
+        TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
 
         /* Wrapup */
-        TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
+        TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
     }
 
     /* Wrapup */
-    mbedtls_mps_reader_free( &rd );
+    mbedtls_mps_reader_free(&rd);
 }
 /* END_CASE */
 
@@ -1124,25 +1116,26 @@
     unsigned char buf[100];
     unsigned char *tmp;
     mbedtls_mps_reader rd;
-    for( size_t i=0; (unsigned) i < sizeof( buf ); i++ )
+    for (size_t i = 0; (unsigned) i < sizeof(buf); i++) {
         buf[i] = (unsigned char) i;
+    }
 
     /* Preparation (lower layer) */
-    mbedtls_mps_reader_init( &rd, NULL, 0 );
+    mbedtls_mps_reader_init(&rd, NULL, 0);
 
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, NULL, sizeof( buf ) ) ==
-                 MBEDTLS_ERR_MPS_READER_INVALID_ARG );
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, NULL, sizeof(buf)) ==
+                MBEDTLS_ERR_MPS_READER_INVALID_ARG);
 
     /* Subsequent feed-calls should still succeed. */
-    TEST_ASSERT( mbedtls_mps_reader_feed( &rd, buf, sizeof( buf ) ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_feed(&rd, buf, sizeof(buf)) == 0);
 
     /* Consumption (upper layer) */
-    TEST_ASSERT( mbedtls_mps_reader_get( &rd, 100, &tmp, NULL ) == 0 );
-    ASSERT_COMPARE( tmp, 100, buf, 100 );
-    TEST_ASSERT( mbedtls_mps_reader_commit( &rd ) == 0 );
+    TEST_ASSERT(mbedtls_mps_reader_get(&rd, 100, &tmp, NULL) == 0);
+    ASSERT_COMPARE(tmp, 100, buf, 100);
+    TEST_ASSERT(mbedtls_mps_reader_commit(&rd) == 0);
 
     /* Wrapup */
-    TEST_ASSERT( mbedtls_mps_reader_reclaim( &rd, NULL ) == 0 );
-    mbedtls_mps_reader_free( &rd );
+    TEST_ASSERT(mbedtls_mps_reader_reclaim(&rd, NULL) == 0);
+    mbedtls_mps_reader_free(&rd);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_net.function b/tests/suites/test_suite_net.function
index 08d48b3..fa09f5a 100644
--- a/tests/suites/test_suite_net.function
+++ b/tests/suites/test_suite_net.function
@@ -30,19 +30,18 @@
  *
  * \return              \c 0 on success, a negative error code on error.
  */
-static int open_file_on_fd( mbedtls_net_context *ctx, int wanted_fd )
+static int open_file_on_fd(mbedtls_net_context *ctx, int wanted_fd)
 {
-    int got_fd = open( "/dev/null", O_RDONLY );
-    TEST_ASSERT( got_fd >= 0 );
-    if( got_fd != wanted_fd )
-    {
-        TEST_ASSERT( dup2( got_fd, wanted_fd ) >= 0 );
-        TEST_ASSERT( close( got_fd ) >= 0 );
+    int got_fd = open("/dev/null", O_RDONLY);
+    TEST_ASSERT(got_fd >= 0);
+    if (got_fd != wanted_fd) {
+        TEST_ASSERT(dup2(got_fd, wanted_fd) >= 0);
+        TEST_ASSERT(close(got_fd) >= 0);
     }
     ctx->fd = wanted_fd;
-    return( 0 );
+    return 0;
 exit:
-    return( -1 );
+    return -1;
 }
 #endif /* MBEDTLS_PLATFORM_IS_UNIXLIKE */
 
@@ -54,16 +53,17 @@
  */
 
 /* BEGIN_CASE */
-void context_init_free( int reinit )
+void context_init_free(int reinit)
 {
     mbedtls_net_context ctx;
 
-    mbedtls_net_init( &ctx );
-    mbedtls_net_free( &ctx );
+    mbedtls_net_init(&ctx);
+    mbedtls_net_free(&ctx);
 
-    if( reinit )
-        mbedtls_net_init( &ctx );
-    mbedtls_net_free( &ctx );
+    if (reinit) {
+        mbedtls_net_init(&ctx);
+    }
+    mbedtls_net_free(&ctx);
 
     /* This test case always succeeds, functionally speaking. A plausible
      * bug might trigger an invalid pointer dereference or a memory leak. */
@@ -72,7 +72,7 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PLATFORM_IS_UNIXLIKE */
-void poll_beyond_fd_setsize( )
+void poll_beyond_fd_setsize()
 {
     /* Test that mbedtls_net_poll does not misbehave when given a file
      * descriptor greater or equal to FD_SETSIZE. This code is specific to
@@ -85,7 +85,7 @@
     mbedtls_net_context ctx;
     uint8_t buf[1];
 
-    mbedtls_net_init( &ctx );
+    mbedtls_net_init(&ctx);
 
     /* On many systems, by default, the maximum permitted file descriptor
      * number is less than FD_SETSIZE. If so, raise the limit if
@@ -99,17 +99,16 @@
      * might do); but we don't do such things in our test code, so the unit
      * test will run if it can.
      */
-    TEST_ASSERT( getrlimit( RLIMIT_NOFILE, &rlim_nofile ) == 0 );
-    if( rlim_nofile.rlim_cur < FD_SETSIZE + 1 )
-    {
+    TEST_ASSERT(getrlimit(RLIMIT_NOFILE, &rlim_nofile) == 0);
+    if (rlim_nofile.rlim_cur < FD_SETSIZE + 1) {
         rlim_t old_rlim_cur = rlim_nofile.rlim_cur;
         rlim_nofile.rlim_cur = FD_SETSIZE + 1;
-        TEST_ASSUME( setrlimit( RLIMIT_NOFILE, &rlim_nofile ) == 0 );
+        TEST_ASSUME(setrlimit(RLIMIT_NOFILE, &rlim_nofile) == 0);
         rlim_nofile.rlim_cur = old_rlim_cur;
         restore_rlim_nofile = 1;
     }
 
-    TEST_ASSERT( open_file_on_fd( &ctx, FD_SETSIZE ) == 0 );
+    TEST_ASSERT(open_file_on_fd(&ctx, FD_SETSIZE) == 0);
 
     /* In principle, mbedtls_net_poll() with valid arguments should succeed.
      * However, we know that on Unix-like platforms (and others), this function
@@ -122,16 +121,17 @@
      * is problematic on the particular platform where the code is running,
      * a memory sanitizer such as UBSan should catch it.
      */
-    ret = mbedtls_net_poll( &ctx, MBEDTLS_NET_POLL_READ, 0 );
-    TEST_EQUAL( ret, MBEDTLS_ERR_NET_POLL_FAILED );
+    ret = mbedtls_net_poll(&ctx, MBEDTLS_NET_POLL_READ, 0);
+    TEST_EQUAL(ret, MBEDTLS_ERR_NET_POLL_FAILED);
 
     /* mbedtls_net_recv_timeout() uses select() and fd_set in the same way. */
-    ret = mbedtls_net_recv_timeout( &ctx, buf, sizeof( buf ), 0 );
-    TEST_EQUAL( ret, MBEDTLS_ERR_NET_POLL_FAILED );
+    ret = mbedtls_net_recv_timeout(&ctx, buf, sizeof(buf), 0);
+    TEST_EQUAL(ret, MBEDTLS_ERR_NET_POLL_FAILED);
 
 exit:
-    mbedtls_net_free( &ctx );
-    if( restore_rlim_nofile )
-        setrlimit( RLIMIT_NOFILE, &rlim_nofile );
+    mbedtls_net_free(&ctx);
+    if (restore_rlim_nofile) {
+        setrlimit(RLIMIT_NOFILE, &rlim_nofile);
+    }
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_nist_kw.function b/tests/suites/test_suite_nist_kw.function
index 6a81052..f2b7944 100644
--- a/tests/suites/test_suite_nist_kw.function
+++ b/tests/suites/test_suite_nist_kw.function
@@ -8,14 +8,14 @@
  */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST:MBEDTLS_AES_C */
-void mbedtls_nist_kw_self_test( )
+void mbedtls_nist_kw_self_test()
 {
-    TEST_ASSERT( mbedtls_nist_kw_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_self_test(1) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_AES_C */
-void mbedtls_nist_kw_mix_contexts( )
+void mbedtls_nist_kw_mix_contexts()
 {
     mbedtls_nist_kw_context ctx1, ctx2;
     unsigned char key[16];
@@ -24,129 +24,126 @@
     unsigned char ciphertext2[40];
     size_t output_len, i;
 
-    memset( plaintext, 0, sizeof( plaintext ) );
-    memset( ciphertext1, 0, sizeof( ciphertext1 ) );
-    memset( ciphertext2, 0, sizeof( ciphertext2 ) );
-    memset( key, 0, sizeof( key ) );
+    memset(plaintext, 0, sizeof(plaintext));
+    memset(ciphertext1, 0, sizeof(ciphertext1));
+    memset(ciphertext2, 0, sizeof(ciphertext2));
+    memset(key, 0, sizeof(key));
 
     /*
      * 1. Check wrap and unwrap with two separate contexts
      */
-    mbedtls_nist_kw_init( &ctx1 );
-    mbedtls_nist_kw_init( &ctx2 );
+    mbedtls_nist_kw_init(&ctx1);
+    mbedtls_nist_kw_init(&ctx2);
 
-    TEST_ASSERT( mbedtls_nist_kw_setkey( &ctx1,
-                                         MBEDTLS_CIPHER_ID_AES,
-                                         key, sizeof( key ) * 8,
-                                         1 ) == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_setkey(&ctx1,
+                                       MBEDTLS_CIPHER_ID_AES,
+                                       key, sizeof(key) * 8,
+                                       1) == 0);
 
-    TEST_ASSERT( mbedtls_nist_kw_wrap( &ctx1, MBEDTLS_KW_MODE_KW,
-                                       plaintext, sizeof( plaintext ),
-                                       ciphertext1, &output_len,
-                                       sizeof( ciphertext1 ) ) == 0 );
-    TEST_ASSERT( output_len == sizeof( ciphertext1 ) );
+    TEST_ASSERT(mbedtls_nist_kw_wrap(&ctx1, MBEDTLS_KW_MODE_KW,
+                                     plaintext, sizeof(plaintext),
+                                     ciphertext1, &output_len,
+                                     sizeof(ciphertext1)) == 0);
+    TEST_ASSERT(output_len == sizeof(ciphertext1));
 
-    TEST_ASSERT( mbedtls_nist_kw_setkey( &ctx2,
-                                         MBEDTLS_CIPHER_ID_AES,
-                                         key, sizeof( key ) * 8,
-                                         0 ) == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_setkey(&ctx2,
+                                       MBEDTLS_CIPHER_ID_AES,
+                                       key, sizeof(key) * 8,
+                                       0) == 0);
 
-    TEST_ASSERT( mbedtls_nist_kw_unwrap( &ctx2, MBEDTLS_KW_MODE_KW,
-                                         ciphertext1, output_len,
-                                         plaintext, &output_len,
-                                         sizeof( plaintext ) ) == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_unwrap(&ctx2, MBEDTLS_KW_MODE_KW,
+                                       ciphertext1, output_len,
+                                       plaintext, &output_len,
+                                       sizeof(plaintext)) == 0);
 
-    TEST_ASSERT( output_len == sizeof( plaintext ) );
-    for( i = 0; i < sizeof( plaintext ); i++ )
-    {
-        TEST_ASSERT( plaintext[i] == 0 );
+    TEST_ASSERT(output_len == sizeof(plaintext));
+    for (i = 0; i < sizeof(plaintext); i++) {
+        TEST_ASSERT(plaintext[i] == 0);
     }
-    mbedtls_nist_kw_free( &ctx1 );
-    mbedtls_nist_kw_free( &ctx2 );
+    mbedtls_nist_kw_free(&ctx1);
+    mbedtls_nist_kw_free(&ctx2);
 
     /*
      * 2. Check wrapping with two modes, on same context
      */
-    mbedtls_nist_kw_init( &ctx1 );
-    mbedtls_nist_kw_init( &ctx2 );
-    output_len = sizeof( ciphertext1 );
+    mbedtls_nist_kw_init(&ctx1);
+    mbedtls_nist_kw_init(&ctx2);
+    output_len = sizeof(ciphertext1);
 
-    TEST_ASSERT( mbedtls_nist_kw_setkey( &ctx1,
-                                         MBEDTLS_CIPHER_ID_AES,
-                                         key, sizeof( key ) * 8,
-                                         1 ) == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_setkey(&ctx1,
+                                       MBEDTLS_CIPHER_ID_AES,
+                                       key, sizeof(key) * 8,
+                                       1) == 0);
 
-    TEST_ASSERT( mbedtls_nist_kw_wrap( &ctx1, MBEDTLS_KW_MODE_KW,
-                                       plaintext, sizeof( plaintext ),
-                                       ciphertext1, &output_len,
-                                       sizeof( ciphertext1 ) ) == 0 );
-    TEST_ASSERT( output_len == sizeof( ciphertext1 ) );
+    TEST_ASSERT(mbedtls_nist_kw_wrap(&ctx1, MBEDTLS_KW_MODE_KW,
+                                     plaintext, sizeof(plaintext),
+                                     ciphertext1, &output_len,
+                                     sizeof(ciphertext1)) == 0);
+    TEST_ASSERT(output_len == sizeof(ciphertext1));
 
-    TEST_ASSERT( mbedtls_nist_kw_wrap( &ctx1, MBEDTLS_KW_MODE_KWP,
-                                       plaintext, sizeof( plaintext ),
-                                       ciphertext2, &output_len,
-                                       sizeof( ciphertext2 ) ) == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_wrap(&ctx1, MBEDTLS_KW_MODE_KWP,
+                                     plaintext, sizeof(plaintext),
+                                     ciphertext2, &output_len,
+                                     sizeof(ciphertext2)) == 0);
 
-    TEST_ASSERT( output_len == sizeof( ciphertext2 ) );
+    TEST_ASSERT(output_len == sizeof(ciphertext2));
 
-    TEST_ASSERT( mbedtls_nist_kw_setkey( &ctx2,
-                                         MBEDTLS_CIPHER_ID_AES,
-                                         key, sizeof( key ) * 8,
-                                         0 ) == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_setkey(&ctx2,
+                                       MBEDTLS_CIPHER_ID_AES,
+                                       key, sizeof(key) * 8,
+                                       0) == 0);
 
-    TEST_ASSERT( mbedtls_nist_kw_unwrap( &ctx2, MBEDTLS_KW_MODE_KW,
-                                         ciphertext1, sizeof( ciphertext1 ),
-                                         plaintext, &output_len,
-                                         sizeof( plaintext ) ) == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_unwrap(&ctx2, MBEDTLS_KW_MODE_KW,
+                                       ciphertext1, sizeof(ciphertext1),
+                                       plaintext, &output_len,
+                                       sizeof(plaintext)) == 0);
 
-    TEST_ASSERT( output_len == sizeof( plaintext ) );
+    TEST_ASSERT(output_len == sizeof(plaintext));
 
-    for( i = 0; i < sizeof( plaintext ); i++ )
-    {
-        TEST_ASSERT( plaintext[i] == 0 );
+    for (i = 0; i < sizeof(plaintext); i++) {
+        TEST_ASSERT(plaintext[i] == 0);
     }
 
-    TEST_ASSERT( mbedtls_nist_kw_unwrap( &ctx2, MBEDTLS_KW_MODE_KWP,
-                                         ciphertext2, sizeof( ciphertext2 ),
-                                         plaintext, &output_len,
-                                         sizeof( plaintext ) ) == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_unwrap(&ctx2, MBEDTLS_KW_MODE_KWP,
+                                       ciphertext2, sizeof(ciphertext2),
+                                       plaintext, &output_len,
+                                       sizeof(plaintext)) == 0);
 
-    TEST_ASSERT( output_len == sizeof( plaintext ) );
+    TEST_ASSERT(output_len == sizeof(plaintext));
 
-    for( i = 0; i < sizeof( plaintext ); i++ )
-    {
-        TEST_ASSERT( plaintext[i] == 0 );
+    for (i = 0; i < sizeof(plaintext); i++) {
+        TEST_ASSERT(plaintext[i] == 0);
     }
 
 exit:
-    mbedtls_nist_kw_free( &ctx1 );
-    mbedtls_nist_kw_free( &ctx2 );
+    mbedtls_nist_kw_free(&ctx1);
+    mbedtls_nist_kw_free(&ctx2);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_nist_kw_setkey( int cipher_id, int key_size,
-                             int is_wrap, int result )
+void mbedtls_nist_kw_setkey(int cipher_id, int key_size,
+                            int is_wrap, int result)
 {
     mbedtls_nist_kw_context ctx;
     unsigned char key[32];
     int ret;
 
-    mbedtls_nist_kw_init( &ctx );
+    mbedtls_nist_kw_init(&ctx);
 
-    memset( key, 0x2A, sizeof( key ) );
-    TEST_ASSERT( (unsigned) key_size <= 8 * sizeof( key ) );
+    memset(key, 0x2A, sizeof(key));
+    TEST_ASSERT((unsigned) key_size <= 8 * sizeof(key));
 
-    ret = mbedtls_nist_kw_setkey( &ctx, cipher_id, key, key_size, is_wrap );
-    TEST_ASSERT( ret == result );
+    ret = mbedtls_nist_kw_setkey(&ctx, cipher_id, key, key_size, is_wrap);
+    TEST_ASSERT(ret == result);
 
 exit:
-    mbedtls_nist_kw_free( &ctx );
+    mbedtls_nist_kw_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_AES_C */
-void nist_kw_plaintext_lengths( int in_len, int out_len, int mode, int res )
+void nist_kw_plaintext_lengths(int in_len, int out_len, int mode, int res)
 {
     mbedtls_nist_kw_context ctx;
     unsigned char key[16];
@@ -154,50 +151,46 @@
     unsigned char *ciphertext = NULL;
     size_t output_len = out_len;
 
-    mbedtls_nist_kw_init( &ctx );
+    mbedtls_nist_kw_init(&ctx);
 
-    memset( key, 0, sizeof( key ) );
+    memset(key, 0, sizeof(key));
 
-    if( in_len != 0 )
-    {
-        plaintext = mbedtls_calloc( 1, in_len );
-        TEST_ASSERT( plaintext != NULL );
+    if (in_len != 0) {
+        plaintext = mbedtls_calloc(1, in_len);
+        TEST_ASSERT(plaintext != NULL);
     }
 
-    if( out_len != 0 )
-    {
-        ciphertext = mbedtls_calloc( 1, output_len );
-        TEST_ASSERT( ciphertext != NULL );
+    if (out_len != 0) {
+        ciphertext = mbedtls_calloc(1, output_len);
+        TEST_ASSERT(ciphertext != NULL);
     }
 
-    TEST_ASSERT( mbedtls_nist_kw_setkey( &ctx, MBEDTLS_CIPHER_ID_AES,
-                                         key, 8 * sizeof( key ), 1 ) == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_setkey(&ctx, MBEDTLS_CIPHER_ID_AES,
+                                       key, 8 * sizeof(key), 1) == 0);
 
-    TEST_ASSERT( mbedtls_nist_kw_wrap( &ctx, mode, plaintext, in_len,
-                                      ciphertext, &output_len,
-                                      output_len ) == res );
-    if( res == 0 )
-    {
-        if( mode == MBEDTLS_KW_MODE_KWP )
-            TEST_ASSERT( output_len == (size_t) in_len + 8 -
-                         ( in_len % 8 ) + 8 );
-        else
-            TEST_ASSERT( output_len == (size_t) in_len + 8 );
-    }
-    else
-    {
-        TEST_ASSERT( output_len == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_wrap(&ctx, mode, plaintext, in_len,
+                                     ciphertext, &output_len,
+                                     output_len) == res);
+    if (res == 0) {
+        if (mode == MBEDTLS_KW_MODE_KWP) {
+            TEST_ASSERT(output_len == (size_t) in_len + 8 -
+                        (in_len % 8) + 8);
+        } else {
+            TEST_ASSERT(output_len == (size_t) in_len + 8);
+        }
+    } else {
+        TEST_ASSERT(output_len == 0);
     }
 
 exit:
-    mbedtls_free( ciphertext );
-    mbedtls_free( plaintext );
-    mbedtls_nist_kw_free( &ctx );
+    mbedtls_free(ciphertext);
+    mbedtls_free(plaintext);
+    mbedtls_nist_kw_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_AES_C */
-void nist_kw_ciphertext_lengths( int in_len, int out_len, int mode, int res )
+void nist_kw_ciphertext_lengths(int in_len, int out_len, int mode, int res)
 {
     mbedtls_nist_kw_context ctx;
     unsigned char key[16];
@@ -206,111 +199,105 @@
     int unwrap_ret;
     size_t output_len = out_len;
 
-    mbedtls_nist_kw_init( &ctx );
+    mbedtls_nist_kw_init(&ctx);
 
-    memset( key, 0, sizeof( key ) );
+    memset(key, 0, sizeof(key));
 
-    if( out_len != 0 )
-    {
-        plaintext = mbedtls_calloc( 1, output_len );
-        TEST_ASSERT( plaintext != NULL );
+    if (out_len != 0) {
+        plaintext = mbedtls_calloc(1, output_len);
+        TEST_ASSERT(plaintext != NULL);
     }
-    if( in_len != 0 )
-    {
-        ciphertext = mbedtls_calloc( 1, in_len );
-        TEST_ASSERT( ciphertext != NULL );
+    if (in_len != 0) {
+        ciphertext = mbedtls_calloc(1, in_len);
+        TEST_ASSERT(ciphertext != NULL);
     }
 
-    TEST_ASSERT( mbedtls_nist_kw_setkey( &ctx, MBEDTLS_CIPHER_ID_AES,
-                                         key, 8 * sizeof( key ), 0 ) == 0 );
-    unwrap_ret = mbedtls_nist_kw_unwrap( &ctx, mode, ciphertext, in_len,
-                                         plaintext, &output_len,
-                                         output_len );
+    TEST_ASSERT(mbedtls_nist_kw_setkey(&ctx, MBEDTLS_CIPHER_ID_AES,
+                                       key, 8 * sizeof(key), 0) == 0);
+    unwrap_ret = mbedtls_nist_kw_unwrap(&ctx, mode, ciphertext, in_len,
+                                        plaintext, &output_len,
+                                        output_len);
 
-    if( res == 0 )
-        TEST_ASSERT( unwrap_ret == MBEDTLS_ERR_CIPHER_AUTH_FAILED );
-    else
-        TEST_ASSERT( unwrap_ret == res );
+    if (res == 0) {
+        TEST_ASSERT(unwrap_ret == MBEDTLS_ERR_CIPHER_AUTH_FAILED);
+    } else {
+        TEST_ASSERT(unwrap_ret == res);
+    }
 
-    TEST_ASSERT( output_len == 0 );
+    TEST_ASSERT(output_len == 0);
 
 exit:
-    mbedtls_free( ciphertext );
-    mbedtls_free( plaintext );
-    mbedtls_nist_kw_free( &ctx );
+    mbedtls_free(ciphertext);
+    mbedtls_free(plaintext);
+    mbedtls_nist_kw_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_nist_kw_wrap( int cipher_id, int mode, data_t *key, data_t *msg,
-                           data_t *expected_result )
+void mbedtls_nist_kw_wrap(int cipher_id, int mode, data_t *key, data_t *msg,
+                          data_t *expected_result)
 {
     unsigned char result[528];
     mbedtls_nist_kw_context ctx;
     size_t result_len, i, padlen;
 
-    mbedtls_nist_kw_init( &ctx );
+    mbedtls_nist_kw_init(&ctx);
 
-    memset( result, '+', sizeof( result ) );
+    memset(result, '+', sizeof(result));
 
-    TEST_ASSERT( mbedtls_nist_kw_setkey( &ctx, cipher_id,
-                                         key->x, key->len * 8, 1 ) == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_setkey(&ctx, cipher_id,
+                                       key->x, key->len * 8, 1) == 0);
 
     /* Test with input == output */
-    TEST_ASSERT( mbedtls_nist_kw_wrap( &ctx, mode, msg->x, msg->len,
-                 result, &result_len, sizeof( result ) ) == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_wrap(&ctx, mode, msg->x, msg->len,
+                                     result, &result_len, sizeof(result)) == 0);
 
-    TEST_ASSERT( result_len == expected_result->len );
+    TEST_ASSERT(result_len == expected_result->len);
 
-    TEST_ASSERT( memcmp( expected_result->x, result, result_len ) == 0 );
+    TEST_ASSERT(memcmp(expected_result->x, result, result_len) == 0);
 
-    padlen = ( msg->len % 8 != 0 ) ? 8 - (msg->len % 8 ) : 0;
+    padlen = (msg->len % 8 != 0) ? 8 - (msg->len % 8) : 0;
     /* Check that the function didn't write beyond the end of the buffer. */
-    for( i = msg->len + 8 + padlen; i < sizeof( result ); i++ )
-    {
-        TEST_ASSERT( result[i] == '+' );
+    for (i = msg->len + 8 + padlen; i < sizeof(result); i++) {
+        TEST_ASSERT(result[i] == '+');
     }
 
 exit:
-    mbedtls_nist_kw_free( &ctx );
+    mbedtls_nist_kw_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_nist_kw_unwrap( int cipher_id, int mode, data_t *key, data_t *msg,
-                             data_t *expected_result, int expected_ret )
+void mbedtls_nist_kw_unwrap(int cipher_id, int mode, data_t *key, data_t *msg,
+                            data_t *expected_result, int expected_ret)
 {
     unsigned char result[528];
     mbedtls_nist_kw_context ctx;
     size_t result_len, i;
 
-    mbedtls_nist_kw_init( &ctx );
+    mbedtls_nist_kw_init(&ctx);
 
-    memset( result, '+', sizeof( result ) );
+    memset(result, '+', sizeof(result));
 
-    TEST_ASSERT( mbedtls_nist_kw_setkey( &ctx, cipher_id,
-                                         key->x, key->len * 8, 0 ) == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_setkey(&ctx, cipher_id,
+                                       key->x, key->len * 8, 0) == 0);
 
     /* Test with input == output */
-    TEST_ASSERT( mbedtls_nist_kw_unwrap( &ctx, mode, msg->x, msg->len,
-                 result, &result_len, sizeof( result ) ) == expected_ret );
-    if( expected_ret == 0 )
-    {
-        TEST_ASSERT( result_len == expected_result->len );
-        TEST_ASSERT( memcmp( expected_result->x, result, result_len ) == 0 );
-    }
-    else
-    {
-        TEST_ASSERT( result_len == 0 );
+    TEST_ASSERT(mbedtls_nist_kw_unwrap(&ctx, mode, msg->x, msg->len,
+                                       result, &result_len, sizeof(result)) == expected_ret);
+    if (expected_ret == 0) {
+        TEST_ASSERT(result_len == expected_result->len);
+        TEST_ASSERT(memcmp(expected_result->x, result, result_len) == 0);
+    } else {
+        TEST_ASSERT(result_len == 0);
     }
 
     /* Check that the function didn't write beyond the end of the buffer. */
-    for( i = msg->len - 8; i < sizeof( result ); i++ )
-    {
-        TEST_ASSERT( result[i] == '+' );
+    for (i = msg->len - 8; i < sizeof(result); i++) {
+        TEST_ASSERT(result[i] == '+');
     }
 
 exit:
-    mbedtls_nist_kw_free( &ctx );
+    mbedtls_nist_kw_free(&ctx);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_oid.function b/tests/suites/test_suite_oid.function
index 9e8d437..fac5ed4 100644
--- a/tests/suites/test_suite_oid.function
+++ b/tests/suites/test_suite_oid.function
@@ -11,7 +11,7 @@
  */
 
 /* BEGIN_CASE */
-void oid_get_certificate_policies( data_t *oid, char *result_str )
+void oid_get_certificate_policies(data_t *oid, char *result_str)
 {
     mbedtls_asn1_buf asn1_buf = { 0, 0, NULL };
     int ret;
@@ -21,21 +21,18 @@
     asn1_buf.p = oid->x;
     asn1_buf.len = oid->len;
 
-    ret = mbedtls_oid_get_certificate_policies( &asn1_buf, &desc );
-    if( strlen( result_str ) == 0 )
-    {
-        TEST_ASSERT( ret == MBEDTLS_ERR_OID_NOT_FOUND );
-    }
-    else
-    {
-        TEST_ASSERT( ret == 0 );
-        TEST_ASSERT( strcmp( ( char* )desc, result_str ) == 0 );
+    ret = mbedtls_oid_get_certificate_policies(&asn1_buf, &desc);
+    if (strlen(result_str) == 0) {
+        TEST_ASSERT(ret == MBEDTLS_ERR_OID_NOT_FOUND);
+    } else {
+        TEST_ASSERT(ret == 0);
+        TEST_ASSERT(strcmp((char *) desc, result_str) == 0);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void oid_get_extended_key_usage( data_t *oid, char *result_str )
+void oid_get_extended_key_usage(data_t *oid, char *result_str)
 {
     mbedtls_asn1_buf asn1_buf = { 0, 0, NULL };
     int ret;
@@ -45,21 +42,18 @@
     asn1_buf.p = oid->x;
     asn1_buf.len = oid->len;
 
-    ret = mbedtls_oid_get_extended_key_usage( &asn1_buf, &desc );
-    if( strlen( result_str ) == 0 )
-    {
-        TEST_ASSERT( ret == MBEDTLS_ERR_OID_NOT_FOUND );
-    }
-    else
-    {
-        TEST_ASSERT( ret == 0 );
-        TEST_ASSERT( strcmp( ( char * )desc, result_str ) == 0 );
+    ret = mbedtls_oid_get_extended_key_usage(&asn1_buf, &desc);
+    if (strlen(result_str) == 0) {
+        TEST_ASSERT(ret == MBEDTLS_ERR_OID_NOT_FOUND);
+    } else {
+        TEST_ASSERT(ret == 0);
+        TEST_ASSERT(strcmp((char *) desc, result_str) == 0);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void oid_get_x509_extension( data_t *oid, int exp_type )
+void oid_get_x509_extension(data_t *oid, int exp_type)
 {
     mbedtls_asn1_buf ext_oid = { 0, 0, NULL };
     int ret;
@@ -69,21 +63,18 @@
     ext_oid.p = oid->x;
     ext_oid.len = oid->len;
 
-    ret = mbedtls_oid_get_x509_ext_type( &ext_oid, &ext_type );
-    if( exp_type == 0 )
-    {
-        TEST_ASSERT( ret == MBEDTLS_ERR_OID_NOT_FOUND );
-    }
-    else
-    {
-        TEST_ASSERT( ret == 0 );
-        TEST_ASSERT( ext_type == exp_type );
+    ret = mbedtls_oid_get_x509_ext_type(&ext_oid, &ext_type);
+    if (exp_type == 0) {
+        TEST_ASSERT(ret == MBEDTLS_ERR_OID_NOT_FOUND);
+    } else {
+        TEST_ASSERT(ret == 0);
+        TEST_ASSERT(ext_type == exp_type);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void oid_get_md_alg_id( data_t *oid, int exp_md_id )
+void oid_get_md_alg_id(data_t *oid, int exp_md_id)
 {
     mbedtls_asn1_buf md_oid = { 0, 0, NULL };
     int ret;
@@ -93,17 +84,14 @@
     md_oid.p = oid->x;
     md_oid.len = oid->len;
 
-    ret = mbedtls_oid_get_md_alg( &md_oid, &md_id );
+    ret = mbedtls_oid_get_md_alg(&md_oid, &md_id);
 
-    if( exp_md_id < 0 )
-    {
-        TEST_ASSERT( ret == MBEDTLS_ERR_OID_NOT_FOUND );
-        TEST_ASSERT( md_id == 0);
-    }
-    else
-    {
-        TEST_ASSERT( ret == 0 );
-        TEST_ASSERT( (mbedtls_md_type_t)exp_md_id == md_id );
+    if (exp_md_id < 0) {
+        TEST_ASSERT(ret == MBEDTLS_ERR_OID_NOT_FOUND);
+        TEST_ASSERT(md_id == 0);
+    } else {
+        TEST_ASSERT(ret == 0);
+        TEST_ASSERT((mbedtls_md_type_t) exp_md_id == md_id);
     }
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_pem.function b/tests/suites/test_suite_pem.function
index 947f1fb..8aac3cf 100644
--- a/tests/suites/test_suite_pem.function
+++ b/tests/suites/test_suite_pem.function
@@ -6,48 +6,48 @@
 /* END_HEADER */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PEM_WRITE_C */
-void mbedtls_pem_write_buffer( char * start, char * end, data_t * buf,
-                               char * result_str )
+void mbedtls_pem_write_buffer(char *start, char *end, data_t *buf,
+                              char *result_str)
 {
     unsigned char *check_buf = NULL;
     int ret;
     size_t olen = 0, olen2 = 0;
 
 
-    ret = mbedtls_pem_write_buffer( start, end, buf->x, buf->len, NULL, 0, &olen );
-    TEST_ASSERT( ret == MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL );
+    ret = mbedtls_pem_write_buffer(start, end, buf->x, buf->len, NULL, 0, &olen);
+    TEST_ASSERT(ret == MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL);
 
-    check_buf = (unsigned char *) mbedtls_calloc( 1, olen );
-    TEST_ASSERT( check_buf != NULL );
+    check_buf = (unsigned char *) mbedtls_calloc(1, olen);
+    TEST_ASSERT(check_buf != NULL);
 
-    ret = mbedtls_pem_write_buffer( start, end, buf->x, buf->len, check_buf, olen, &olen2 );
+    ret = mbedtls_pem_write_buffer(start, end, buf->x, buf->len, check_buf, olen, &olen2);
 
-    TEST_ASSERT( olen2 <= olen );
-    TEST_ASSERT( olen > strlen( (char*) result_str ) );
-    TEST_ASSERT( ret == 0 );
-    TEST_ASSERT( strncmp( (char *) check_buf, (char *) result_str, olen ) == 0 );
+    TEST_ASSERT(olen2 <= olen);
+    TEST_ASSERT(olen > strlen((char *) result_str));
+    TEST_ASSERT(ret == 0);
+    TEST_ASSERT(strncmp((char *) check_buf, (char *) result_str, olen) == 0);
 
 exit:
-    mbedtls_free( check_buf );
+    mbedtls_free(check_buf);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_AES_C:MBEDTLS_DES_C:MBEDTLS_MD5_C:MBEDTLS_CIPHER_MODE_CBC */
-void mbedtls_pem_read_buffer( char *header, char *footer, char *data,
-                              char *pwd, int res )
+void mbedtls_pem_read_buffer(char *header, char *footer, char *data,
+                             char *pwd, int res)
 {
     mbedtls_pem_context ctx;
     int ret;
     size_t use_len = 0;
-    size_t pwd_len = strlen( pwd );
+    size_t pwd_len = strlen(pwd);
 
-    mbedtls_pem_init( &ctx );
+    mbedtls_pem_init(&ctx);
 
-    ret = mbedtls_pem_read_buffer( &ctx, header, footer, (unsigned char *)data,
-                (unsigned char *)pwd, pwd_len, &use_len );
-    TEST_ASSERT( ret == res );
+    ret = mbedtls_pem_read_buffer(&ctx, header, footer, (unsigned char *) data,
+                                  (unsigned char *) pwd, pwd_len, &use_len);
+    TEST_ASSERT(ret == res);
 
 exit:
-    mbedtls_pem_free( &ctx );
+    mbedtls_pem_free(&ctx);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_pk.function b/tests/suites/test_suite_pk.function
index 9cb90aa..57e95f0 100644
--- a/tests/suites/test_suite_pk.function
+++ b/tests/suites/test_suite_pk.function
@@ -29,59 +29,60 @@
  *                  generation function.
  * \return          -1 if the key type is not recognized.
  */
-static int pk_genkey( mbedtls_pk_context *pk, int parameter )
+static int pk_genkey(mbedtls_pk_context *pk, int parameter)
 {
     ((void) pk);
     (void) parameter;
 
 #if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_GENPRIME)
-    if( mbedtls_pk_get_type( pk ) == MBEDTLS_PK_RSA )
-        return mbedtls_rsa_gen_key( mbedtls_pk_rsa( *pk ),
-                                    mbedtls_test_rnd_std_rand, NULL,
-                                    parameter, 3 );
-#endif
-#if defined(MBEDTLS_ECP_C)
-    if( mbedtls_pk_get_type( pk ) == MBEDTLS_PK_ECKEY ||
-        mbedtls_pk_get_type( pk ) == MBEDTLS_PK_ECKEY_DH ||
-        mbedtls_pk_get_type( pk ) == MBEDTLS_PK_ECDSA )
-    {
-        int ret;
-        if( ( ret = mbedtls_ecp_group_load( &mbedtls_pk_ec( *pk )->grp,
-                                            parameter ) ) != 0 )
-            return( ret );
-
-        return mbedtls_ecp_gen_keypair( &mbedtls_pk_ec( *pk )->grp,
-                                        &mbedtls_pk_ec( *pk )->d,
-                                        &mbedtls_pk_ec( *pk )->Q,
-                                        mbedtls_test_rnd_std_rand, NULL );
+    if (mbedtls_pk_get_type(pk) == MBEDTLS_PK_RSA) {
+        return mbedtls_rsa_gen_key(mbedtls_pk_rsa(*pk),
+                                   mbedtls_test_rnd_std_rand, NULL,
+                                   parameter, 3);
     }
 #endif
-    return( -1 );
+#if defined(MBEDTLS_ECP_C)
+    if (mbedtls_pk_get_type(pk) == MBEDTLS_PK_ECKEY ||
+        mbedtls_pk_get_type(pk) == MBEDTLS_PK_ECKEY_DH ||
+        mbedtls_pk_get_type(pk) == MBEDTLS_PK_ECDSA) {
+        int ret;
+        if ((ret = mbedtls_ecp_group_load(&mbedtls_pk_ec(*pk)->grp,
+                                          parameter)) != 0) {
+            return ret;
+        }
+
+        return mbedtls_ecp_gen_keypair(&mbedtls_pk_ec(*pk)->grp,
+                                       &mbedtls_pk_ec(*pk)->d,
+                                       &mbedtls_pk_ec(*pk)->Q,
+                                       mbedtls_test_rnd_std_rand, NULL);
+    }
+#endif
+    return -1;
 }
 
 #if defined(MBEDTLS_RSA_C)
-int mbedtls_rsa_decrypt_func( void *ctx, int mode, size_t *olen,
-                       const unsigned char *input, unsigned char *output,
-                       size_t output_max_len )
+int mbedtls_rsa_decrypt_func(void *ctx, int mode, size_t *olen,
+                             const unsigned char *input, unsigned char *output,
+                             size_t output_max_len)
 {
-    return( mbedtls_rsa_pkcs1_decrypt( (mbedtls_rsa_context *) ctx,
-                                       mbedtls_test_rnd_std_rand, NULL, mode,
-                                       olen, input, output, output_max_len ) );
+    return mbedtls_rsa_pkcs1_decrypt((mbedtls_rsa_context *) ctx,
+                                     mbedtls_test_rnd_std_rand, NULL, mode,
+                                     olen, input, output, output_max_len);
 }
-int mbedtls_rsa_sign_func( void *ctx,
-                   int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
-                   int mode, mbedtls_md_type_t md_alg, unsigned int hashlen,
-                   const unsigned char *hash, unsigned char *sig )
+int mbedtls_rsa_sign_func(void *ctx,
+                          int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
+                          int mode, mbedtls_md_type_t md_alg, unsigned int hashlen,
+                          const unsigned char *hash, unsigned char *sig)
 {
     ((void) f_rng);
     ((void) p_rng);
-    return( mbedtls_rsa_pkcs1_sign( (mbedtls_rsa_context *) ctx,
-                                    mbedtls_test_rnd_std_rand, NULL, mode,
-                                    md_alg, hashlen, hash, sig ) );
+    return mbedtls_rsa_pkcs1_sign((mbedtls_rsa_context *) ctx,
+                                  mbedtls_test_rnd_std_rand, NULL, mode,
+                                  md_alg, hashlen, hash, sig);
 }
-size_t mbedtls_rsa_key_len_func( void *ctx )
+size_t mbedtls_rsa_key_len_func(void *ctx)
 {
-    return( ((const mbedtls_rsa_context *) ctx)->len );
+    return ((const mbedtls_rsa_context *) ctx)->len;
 }
 #endif /* MBEDTLS_RSA_C */
 
@@ -92,22 +93,22 @@
  * or 0 if the key generation failed.
  * The key uses NIST P-256 and is usable for signing with SHA-256.
  */
-mbedtls_svc_key_id_t pk_psa_genkey( void )
+mbedtls_svc_key_id_t pk_psa_genkey(void)
 {
     mbedtls_svc_key_id_t key;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     const psa_key_type_t type =
-        PSA_KEY_TYPE_ECC_KEY_PAIR( PSA_ECC_FAMILY_SECP_R1 );
+        PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1);
     const size_t bits = 256;
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_HASH );
-    psa_set_key_algorithm( &attributes, PSA_ALG_ECDSA(PSA_ALG_SHA_256) );
-    psa_set_key_type( &attributes, type );
-    psa_set_key_bits( &attributes, bits );
-    PSA_ASSERT( psa_generate_key( &attributes, &key ) );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_HASH);
+    psa_set_key_algorithm(&attributes, PSA_ALG_ECDSA(PSA_ALG_SHA_256));
+    psa_set_key_type(&attributes, type);
+    psa_set_key_bits(&attributes, bits);
+    PSA_ASSERT(psa_generate_key(&attributes, &key));
 
 exit:
-    return( key );
+    return key;
 }
 #endif /* MBEDTLS_USE_PSA_CRYPTO */
 /* END_HEADER */
@@ -118,7 +119,7 @@
  */
 
 /* BEGIN_CASE depends_on:MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED */
-void pk_psa_utils(  )
+void pk_psa_utils()
 {
     mbedtls_pk_context pk, pk2;
     mbedtls_svc_key_id_t key;
@@ -132,205 +133,206 @@
     size_t len;
     mbedtls_pk_debug_item dbg;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    mbedtls_pk_init( &pk );
-    mbedtls_pk_init( &pk2 );
+    mbedtls_pk_init(&pk);
+    mbedtls_pk_init(&pk2);
 
-    TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
+    TEST_ASSERT(psa_crypto_init() == PSA_SUCCESS);
 
-    TEST_ASSERT( mbedtls_pk_setup_opaque( &pk, MBEDTLS_SVC_KEY_ID_INIT ) ==
-                 MBEDTLS_ERR_PK_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_pk_setup_opaque(&pk, MBEDTLS_SVC_KEY_ID_INIT) ==
+                MBEDTLS_ERR_PK_BAD_INPUT_DATA);
 
-    mbedtls_pk_free( &pk );
-    mbedtls_pk_init( &pk );
+    mbedtls_pk_free(&pk);
+    mbedtls_pk_init(&pk);
 
     key = pk_psa_genkey();
-    if( mbedtls_svc_key_id_is_null( key ) )
+    if (mbedtls_svc_key_id_is_null(key)) {
         goto exit;
+    }
 
-    TEST_ASSERT( mbedtls_pk_setup_opaque( &pk, key ) == 0 );
+    TEST_ASSERT(mbedtls_pk_setup_opaque(&pk, key) == 0);
 
-    TEST_ASSERT( mbedtls_pk_get_type( &pk ) == MBEDTLS_PK_OPAQUE );
-    TEST_ASSERT( strcmp( mbedtls_pk_get_name( &pk), name ) == 0 );
+    TEST_ASSERT(mbedtls_pk_get_type(&pk) == MBEDTLS_PK_OPAQUE);
+    TEST_ASSERT(strcmp(mbedtls_pk_get_name(&pk), name) == 0);
 
-    TEST_ASSERT( mbedtls_pk_get_bitlen( &pk ) == bitlen );
-    TEST_ASSERT( mbedtls_pk_get_len( &pk ) == bitlen / 8 );
+    TEST_ASSERT(mbedtls_pk_get_bitlen(&pk) == bitlen);
+    TEST_ASSERT(mbedtls_pk_get_len(&pk) == bitlen / 8);
 
-    TEST_ASSERT( mbedtls_pk_can_do( &pk, MBEDTLS_PK_ECKEY ) == 1 );
-    TEST_ASSERT( mbedtls_pk_can_do( &pk, MBEDTLS_PK_ECDSA ) == 1 );
-    TEST_ASSERT( mbedtls_pk_can_do( &pk, MBEDTLS_PK_RSA ) == 0 );
+    TEST_ASSERT(mbedtls_pk_can_do(&pk, MBEDTLS_PK_ECKEY) == 1);
+    TEST_ASSERT(mbedtls_pk_can_do(&pk, MBEDTLS_PK_ECDSA) == 1);
+    TEST_ASSERT(mbedtls_pk_can_do(&pk, MBEDTLS_PK_RSA) == 0);
 
     /* unsupported operations: verify, decrypt, encrypt */
-    TEST_ASSERT( mbedtls_pk_verify( &pk, md_alg,
-                                    b1, sizeof( b1), b2, sizeof( b2 ) )
-                 == MBEDTLS_ERR_PK_TYPE_MISMATCH );
-    TEST_ASSERT( mbedtls_pk_decrypt( &pk, b1, sizeof( b1 ),
-                                     b2, &len, sizeof( b2 ),
-                                     NULL, NULL )
-                 == MBEDTLS_ERR_PK_TYPE_MISMATCH );
-    TEST_ASSERT( mbedtls_pk_encrypt( &pk, b1, sizeof( b1 ),
-                                     b2, &len, sizeof( b2 ),
-                                     NULL, NULL )
-                 == MBEDTLS_ERR_PK_TYPE_MISMATCH );
+    TEST_ASSERT(mbedtls_pk_verify(&pk, md_alg,
+                                  b1, sizeof(b1), b2, sizeof(b2))
+                == MBEDTLS_ERR_PK_TYPE_MISMATCH);
+    TEST_ASSERT(mbedtls_pk_decrypt(&pk, b1, sizeof(b1),
+                                   b2, &len, sizeof(b2),
+                                   NULL, NULL)
+                == MBEDTLS_ERR_PK_TYPE_MISMATCH);
+    TEST_ASSERT(mbedtls_pk_encrypt(&pk, b1, sizeof(b1),
+                                   b2, &len, sizeof(b2),
+                                   NULL, NULL)
+                == MBEDTLS_ERR_PK_TYPE_MISMATCH);
 
     /* unsupported functions: check_pair, debug */
-    TEST_ASSERT( mbedtls_pk_setup( &pk2,
-                 mbedtls_pk_info_from_type( MBEDTLS_PK_ECKEY ) ) == 0 );
-    TEST_ASSERT( mbedtls_pk_check_pair( &pk, &pk2 )
-                 == MBEDTLS_ERR_PK_TYPE_MISMATCH );
-    TEST_ASSERT( mbedtls_pk_debug( &pk, &dbg )
-                 == MBEDTLS_ERR_PK_TYPE_MISMATCH );
+    TEST_ASSERT(mbedtls_pk_setup(&pk2,
+                                 mbedtls_pk_info_from_type(MBEDTLS_PK_ECKEY)) == 0);
+    TEST_ASSERT(mbedtls_pk_check_pair(&pk, &pk2)
+                == MBEDTLS_ERR_PK_TYPE_MISMATCH);
+    TEST_ASSERT(mbedtls_pk_debug(&pk, &dbg)
+                == MBEDTLS_ERR_PK_TYPE_MISMATCH);
 
     /* test that freeing the context does not destroy the key */
-    mbedtls_pk_free( &pk );
-    TEST_ASSERT( PSA_SUCCESS == psa_get_key_attributes( key, &attributes ) );
-    TEST_ASSERT( PSA_SUCCESS == psa_destroy_key( key ) );
+    mbedtls_pk_free(&pk);
+    TEST_ASSERT(PSA_SUCCESS == psa_get_key_attributes(key, &attributes));
+    TEST_ASSERT(PSA_SUCCESS == psa_destroy_key(key));
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    mbedtls_pk_free( &pk ); /* redundant except upon error */
-    mbedtls_pk_free( &pk2 );
-    USE_PSA_DONE( );
+    mbedtls_pk_free(&pk);   /* redundant except upon error */
+    mbedtls_pk_free(&pk2);
+    USE_PSA_DONE();
 }
 /* END_CASE */
 
 
 /* BEGIN_CASE */
-void valid_parameters( )
+void valid_parameters()
 {
     mbedtls_pk_context pk;
     unsigned char buf[1];
     size_t len;
     void *options = NULL;
 
-    mbedtls_pk_init( &pk );
+    mbedtls_pk_init(&pk);
 
-    TEST_VALID_PARAM( mbedtls_pk_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_pk_free(NULL));
 
 #if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE)
-    TEST_VALID_PARAM( mbedtls_pk_restart_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_pk_restart_free(NULL));
 #endif
 
-    TEST_ASSERT( mbedtls_pk_setup( &pk, NULL ) ==
-                 MBEDTLS_ERR_PK_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_pk_setup(&pk, NULL) ==
+                MBEDTLS_ERR_PK_BAD_INPUT_DATA);
 
     /* In informational functions, we accept NULL where a context pointer
      * is expected because that's what the library has done forever.
      * We do not document that NULL is accepted, so we may wish to change
      * the behavior in a future version. */
-    TEST_ASSERT( mbedtls_pk_get_bitlen( NULL ) == 0 );
-    TEST_ASSERT( mbedtls_pk_get_len( NULL ) == 0 );
-    TEST_ASSERT( mbedtls_pk_can_do( NULL, MBEDTLS_PK_NONE ) == 0 );
+    TEST_ASSERT(mbedtls_pk_get_bitlen(NULL) == 0);
+    TEST_ASSERT(mbedtls_pk_get_len(NULL) == 0);
+    TEST_ASSERT(mbedtls_pk_can_do(NULL, MBEDTLS_PK_NONE) == 0);
 
-    TEST_ASSERT( mbedtls_pk_sign_restartable( &pk,
+    TEST_ASSERT(mbedtls_pk_sign_restartable(&pk,
+                                            MBEDTLS_MD_NONE,
+                                            NULL, 0,
+                                            buf, &len,
+                                            mbedtls_test_rnd_std_rand, NULL,
+                                            NULL) ==
+                MBEDTLS_ERR_PK_BAD_INPUT_DATA);
+
+    TEST_ASSERT(mbedtls_pk_sign_restartable(&pk,
+                                            MBEDTLS_MD_NONE,
+                                            NULL, 0,
+                                            buf, &len,
+                                            mbedtls_test_rnd_std_rand, NULL,
+                                            NULL) ==
+                MBEDTLS_ERR_PK_BAD_INPUT_DATA);
+
+    TEST_ASSERT(mbedtls_pk_sign(&pk,
+                                MBEDTLS_MD_NONE,
+                                NULL, 0,
+                                buf, &len,
+                                mbedtls_test_rnd_std_rand, NULL) ==
+                MBEDTLS_ERR_PK_BAD_INPUT_DATA);
+
+    TEST_ASSERT(mbedtls_pk_verify_restartable(&pk,
                                               MBEDTLS_MD_NONE,
                                               NULL, 0,
-                                              buf, &len,
-                                              mbedtls_test_rnd_std_rand, NULL,
-                                              NULL ) ==
-                 MBEDTLS_ERR_PK_BAD_INPUT_DATA );
+                                              buf, sizeof(buf),
+                                              NULL) ==
+                MBEDTLS_ERR_PK_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_pk_sign_restartable( &pk,
-                                              MBEDTLS_MD_NONE,
-                                              NULL, 0,
-                                              buf, &len,
-                                              mbedtls_test_rnd_std_rand, NULL,
-                                              NULL ) ==
-                 MBEDTLS_ERR_PK_BAD_INPUT_DATA );
-
-    TEST_ASSERT( mbedtls_pk_sign( &pk,
+    TEST_ASSERT(mbedtls_pk_verify(&pk,
                                   MBEDTLS_MD_NONE,
                                   NULL, 0,
-                                  buf, &len,
-                                  mbedtls_test_rnd_std_rand, NULL ) ==
-                 MBEDTLS_ERR_PK_BAD_INPUT_DATA );
+                                  buf, sizeof(buf)) ==
+                MBEDTLS_ERR_PK_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_pk_verify_restartable( &pk,
-                                                MBEDTLS_MD_NONE,
-                                                NULL, 0,
-                                                buf, sizeof( buf ),
-                                                NULL ) ==
-                 MBEDTLS_ERR_PK_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_pk_verify_ext(MBEDTLS_PK_NONE, options,
+                                      &pk,
+                                      MBEDTLS_MD_NONE,
+                                      NULL, 0,
+                                      buf, sizeof(buf)) ==
+                MBEDTLS_ERR_PK_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_pk_verify( &pk,
-                                    MBEDTLS_MD_NONE,
-                                    NULL, 0,
-                                    buf, sizeof( buf ) ) ==
-                 MBEDTLS_ERR_PK_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_pk_encrypt(&pk,
+                                   NULL, 0,
+                                   NULL, &len, 0,
+                                   mbedtls_test_rnd_std_rand, NULL) ==
+                MBEDTLS_ERR_PK_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_pk_verify_ext( MBEDTLS_PK_NONE, options,
-                                        &pk,
-                                        MBEDTLS_MD_NONE,
-                                        NULL, 0,
-                                        buf, sizeof( buf ) ) ==
-                 MBEDTLS_ERR_PK_BAD_INPUT_DATA );
-
-    TEST_ASSERT( mbedtls_pk_encrypt( &pk,
-                                     NULL, 0,
-                                     NULL, &len, 0,
-                                     mbedtls_test_rnd_std_rand, NULL ) ==
-                 MBEDTLS_ERR_PK_BAD_INPUT_DATA );
-
-    TEST_ASSERT( mbedtls_pk_decrypt( &pk,
-                                     NULL, 0,
-                                     NULL, &len, 0,
-                                     mbedtls_test_rnd_std_rand, NULL ) ==
-                 MBEDTLS_ERR_PK_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_pk_decrypt(&pk,
+                                   NULL, 0,
+                                   NULL, &len, 0,
+                                   mbedtls_test_rnd_std_rand, NULL) ==
+                MBEDTLS_ERR_PK_BAD_INPUT_DATA);
 
 #if defined(MBEDTLS_PK_PARSE_C)
-    TEST_ASSERT( mbedtls_pk_parse_key( &pk, NULL, 0, NULL, 1 ) ==
-                 MBEDTLS_ERR_PK_KEY_INVALID_FORMAT );
+    TEST_ASSERT(mbedtls_pk_parse_key(&pk, NULL, 0, NULL, 1) ==
+                MBEDTLS_ERR_PK_KEY_INVALID_FORMAT);
 
-    TEST_ASSERT( mbedtls_pk_parse_public_key( &pk, NULL, 0 ) ==
-                 MBEDTLS_ERR_PK_KEY_INVALID_FORMAT );
+    TEST_ASSERT(mbedtls_pk_parse_public_key(&pk, NULL, 0) ==
+                MBEDTLS_ERR_PK_KEY_INVALID_FORMAT);
 #endif /* MBEDTLS_PK_PARSE_C */
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PK_WRITE_C */
-void valid_parameters_pkwrite( data_t *key_data )
+void valid_parameters_pkwrite(data_t *key_data)
 {
     mbedtls_pk_context pk;
 
     /* For the write tests to be effective, we need a valid key pair. */
-    mbedtls_pk_init( &pk );
-    TEST_ASSERT( mbedtls_pk_parse_key( &pk,
-                                       key_data->x, key_data->len,
-                                       NULL, 0 ) == 0 );
+    mbedtls_pk_init(&pk);
+    TEST_ASSERT(mbedtls_pk_parse_key(&pk,
+                                     key_data->x, key_data->len,
+                                     NULL, 0) == 0);
 
-    TEST_ASSERT( mbedtls_pk_write_key_der( &pk, NULL, 0 ) ==
-                 MBEDTLS_ERR_ASN1_BUF_TOO_SMALL );
+    TEST_ASSERT(mbedtls_pk_write_key_der(&pk, NULL, 0) ==
+                MBEDTLS_ERR_ASN1_BUF_TOO_SMALL);
 
-    TEST_ASSERT( mbedtls_pk_write_pubkey_der( &pk, NULL, 0 ) ==
-                 MBEDTLS_ERR_ASN1_BUF_TOO_SMALL );
+    TEST_ASSERT(mbedtls_pk_write_pubkey_der(&pk, NULL, 0) ==
+                MBEDTLS_ERR_ASN1_BUF_TOO_SMALL);
 
 #if defined(MBEDTLS_PEM_WRITE_C)
-    TEST_ASSERT( mbedtls_pk_write_key_pem( &pk, NULL, 0 ) ==
-                 MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL );
+    TEST_ASSERT(mbedtls_pk_write_key_pem(&pk, NULL, 0) ==
+                MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL);
 
-    TEST_ASSERT( mbedtls_pk_write_pubkey_pem( &pk, NULL, 0 ) ==
-                 MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL );
+    TEST_ASSERT(mbedtls_pk_write_pubkey_pem(&pk, NULL, 0) ==
+                MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL);
 #endif /* MBEDTLS_PEM_WRITE_C */
 
 exit:
-    mbedtls_pk_free( &pk );
+    mbedtls_pk_free(&pk);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void invalid_parameters( )
+void invalid_parameters()
 {
     size_t len;
     unsigned char *null_buf = NULL;
     unsigned char buf[1];
     unsigned char *p = buf;
-    char str[1] = {0};
+    char str[1] = { 0 };
     mbedtls_pk_context pk;
     mbedtls_md_type_t valid_md = MBEDTLS_MD_SHA256;
     void *options = buf;
@@ -339,253 +341,253 @@
     (void) p;
     (void) str;
 
-    mbedtls_pk_init( &pk );
+    mbedtls_pk_init(&pk);
 
-    TEST_INVALID_PARAM( mbedtls_pk_init( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_pk_init(NULL));
 
 #if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE)
-    TEST_INVALID_PARAM( mbedtls_pk_restart_init( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_pk_restart_init(NULL));
 #endif
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_setup( NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_setup(NULL, NULL));
 
 #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_setup_rsa_alt( NULL, buf,
-                                                      NULL, NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_setup_rsa_alt(NULL, buf,
+                                                    NULL, NULL, NULL));
 #endif
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_verify_restartable( NULL,
-                                                           MBEDTLS_MD_NONE,
-                                                           buf, sizeof( buf ),
-                                                           buf, sizeof( buf ),
-                                                           NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_verify_restartable( &pk,
-                                                           MBEDTLS_MD_NONE,
-                                                           NULL, sizeof( buf ),
-                                                           buf, sizeof( buf ),
-                                                           NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_verify_restartable( &pk,
-                                                           valid_md,
-                                                           NULL, 0,
-                                                           buf, sizeof( buf ),
-                                                           NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_verify_restartable( &pk,
-                                                           MBEDTLS_MD_NONE,
-                                                           buf, sizeof( buf ),
-                                                           NULL, sizeof( buf ),
-                                                           NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_verify_restartable(NULL,
+                                                         MBEDTLS_MD_NONE,
+                                                         buf, sizeof(buf),
+                                                         buf, sizeof(buf),
+                                                         NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_verify_restartable(&pk,
+                                                         MBEDTLS_MD_NONE,
+                                                         NULL, sizeof(buf),
+                                                         buf, sizeof(buf),
+                                                         NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_verify_restartable(&pk,
+                                                         valid_md,
+                                                         NULL, 0,
+                                                         buf, sizeof(buf),
+                                                         NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_verify_restartable(&pk,
+                                                         MBEDTLS_MD_NONE,
+                                                         buf, sizeof(buf),
+                                                         NULL, sizeof(buf),
+                                                         NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_verify( NULL,
-                                               MBEDTLS_MD_NONE,
-                                               buf, sizeof( buf ),
-                                               buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_verify( &pk,
-                                               MBEDTLS_MD_NONE,
-                                               NULL, sizeof( buf ),
-                                               buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_verify( &pk,
-                                               valid_md,
-                                               NULL, 0,
-                                               buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_verify( &pk,
-                                               MBEDTLS_MD_NONE,
-                                               buf, sizeof( buf ),
-                                               NULL, sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_verify(NULL,
+                                             MBEDTLS_MD_NONE,
+                                             buf, sizeof(buf),
+                                             buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_verify(&pk,
+                                             MBEDTLS_MD_NONE,
+                                             NULL, sizeof(buf),
+                                             buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_verify(&pk,
+                                             valid_md,
+                                             NULL, 0,
+                                             buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_verify(&pk,
+                                             MBEDTLS_MD_NONE,
+                                             buf, sizeof(buf),
+                                             NULL, sizeof(buf)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_verify_ext( MBEDTLS_PK_NONE, options,
-                                                   NULL,
-                                                   MBEDTLS_MD_NONE,
-                                                   buf, sizeof( buf ),
-                                                   buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_verify_ext( MBEDTLS_PK_NONE, options,
-                                                   &pk,
-                                                   MBEDTLS_MD_NONE,
-                                                   NULL, sizeof( buf ),
-                                                   buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_verify_ext( MBEDTLS_PK_NONE, options,
-                                                   &pk,
-                                                   valid_md,
-                                                   NULL, 0,
-                                                   buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_verify_ext( MBEDTLS_PK_NONE, options,
-                                                   &pk,
-                                                   MBEDTLS_MD_NONE,
-                                                   buf, sizeof( buf ),
-                                                   NULL, sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_verify_ext(MBEDTLS_PK_NONE, options,
+                                                 NULL,
+                                                 MBEDTLS_MD_NONE,
+                                                 buf, sizeof(buf),
+                                                 buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_verify_ext(MBEDTLS_PK_NONE, options,
+                                                 &pk,
+                                                 MBEDTLS_MD_NONE,
+                                                 NULL, sizeof(buf),
+                                                 buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_verify_ext(MBEDTLS_PK_NONE, options,
+                                                 &pk,
+                                                 valid_md,
+                                                 NULL, 0,
+                                                 buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_verify_ext(MBEDTLS_PK_NONE, options,
+                                                 &pk,
+                                                 MBEDTLS_MD_NONE,
+                                                 buf, sizeof(buf),
+                                                 NULL, sizeof(buf)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_sign_restartable( NULL, MBEDTLS_MD_NONE, buf, sizeof( buf ),
-                                     buf, &len, mbedtls_test_rnd_std_rand,
-                                     NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_sign_restartable(NULL, MBEDTLS_MD_NONE, buf, sizeof(buf),
+                                                       buf, &len, mbedtls_test_rnd_std_rand,
+                                                       NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_sign_restartable( &pk, MBEDTLS_MD_NONE, NULL, sizeof( buf ),
-                                     buf, &len, mbedtls_test_rnd_std_rand,
-                                     NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_sign_restartable(&pk, MBEDTLS_MD_NONE, NULL, sizeof(buf),
+                                                       buf, &len, mbedtls_test_rnd_std_rand,
+                                                       NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_sign_restartable( &pk, valid_md, NULL, 0, buf, &len,
-                                     mbedtls_test_rnd_std_rand, NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_sign_restartable(&pk, valid_md, NULL, 0, buf, &len,
+                                                       mbedtls_test_rnd_std_rand, NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_sign_restartable( &pk, MBEDTLS_MD_NONE, buf, sizeof( buf ),
-                                     NULL, &len, mbedtls_test_rnd_std_rand,
-                                     NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_sign_restartable(&pk, MBEDTLS_MD_NONE, buf, sizeof(buf),
+                                                       NULL, &len, mbedtls_test_rnd_std_rand,
+                                                       NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_sign( NULL, MBEDTLS_MD_NONE, buf, sizeof( buf ),
-                         buf, &len, mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_sign(NULL, MBEDTLS_MD_NONE, buf, sizeof(buf),
+                                           buf, &len, mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_sign( &pk, MBEDTLS_MD_NONE, NULL, sizeof( buf ),
-                         buf, &len, mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_sign(&pk, MBEDTLS_MD_NONE, NULL, sizeof(buf),
+                                           buf, &len, mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_sign( &pk, valid_md, NULL, 0, buf, &len,
-                         mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_sign(&pk, valid_md, NULL, 0, buf, &len,
+                                           mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_sign( &pk, MBEDTLS_MD_NONE, buf, sizeof( buf ), NULL, &len,
-                         mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_sign(&pk, MBEDTLS_MD_NONE, buf, sizeof(buf), NULL, &len,
+                                           mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_decrypt( NULL, buf, sizeof( buf ), buf, &len, sizeof( buf ),
-                            mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_decrypt(NULL, buf, sizeof(buf), buf, &len, sizeof(buf),
+                                              mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_decrypt( &pk, NULL, sizeof( buf ), buf, &len, sizeof( buf ),
-                            mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_decrypt(&pk, NULL, sizeof(buf), buf, &len, sizeof(buf),
+                                              mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_decrypt( &pk, buf, sizeof( buf ), NULL, &len, sizeof( buf ),
-                            mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_decrypt(&pk, buf, sizeof(buf), NULL, &len, sizeof(buf),
+                                              mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_decrypt( &pk, buf, sizeof( buf ), buf, NULL, sizeof( buf ),
-                            mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_decrypt(&pk, buf, sizeof(buf), buf, NULL, sizeof(buf),
+                                              mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_encrypt( NULL, buf, sizeof( buf ), buf, &len, sizeof( buf ),
-                            mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_encrypt(NULL, buf, sizeof(buf), buf, &len, sizeof(buf),
+                                              mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_encrypt( &pk, NULL, sizeof( buf ), buf, &len, sizeof( buf ),
-                            mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_encrypt(&pk, NULL, sizeof(buf), buf, &len, sizeof(buf),
+                                              mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_encrypt( &pk, buf, sizeof( buf ), NULL, &len, sizeof( buf ),
-                            mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_encrypt(&pk, buf, sizeof(buf), NULL, &len, sizeof(buf),
+                                              mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-        mbedtls_pk_encrypt( &pk, buf, sizeof( buf ), buf, NULL, sizeof( buf ),
-                            mbedtls_test_rnd_std_rand, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_encrypt(&pk, buf, sizeof(buf), buf, NULL, sizeof(buf),
+                                              mbedtls_test_rnd_std_rand, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_check_pair( NULL, &pk ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_check_pair( &pk, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_check_pair(NULL, &pk));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_check_pair(&pk, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_debug( NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_debug(NULL, NULL));
 
 #if defined(MBEDTLS_PK_PARSE_C)
 #if defined(MBEDTLS_FS_IO)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_load_file( NULL, &p, &len ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_load_file( str, NULL, &len ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_load_file( str, &p, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_load_file(NULL, &p, &len));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_load_file(str, NULL, &len));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_load_file(str, &p, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_parse_keyfile( NULL, str, NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_parse_keyfile( &pk, NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_parse_keyfile(NULL, str, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_parse_keyfile(&pk, NULL, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_parse_public_keyfile( NULL, str ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_parse_public_keyfile( &pk, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_parse_public_keyfile(NULL, str));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_parse_public_keyfile(&pk, NULL));
 #endif
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_parse_subpubkey( NULL, buf, &pk ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_parse_subpubkey( &null_buf, buf, &pk ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_parse_subpubkey( &p, NULL, &pk ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_parse_subpubkey( &p, buf, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_parse_subpubkey(NULL, buf, &pk));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_parse_subpubkey(&null_buf, buf, &pk));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_parse_subpubkey(&p, NULL, &pk));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_parse_subpubkey(&p, buf, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_parse_key( NULL,
-                                                  buf, sizeof( buf ),
-                                                  buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_parse_key( &pk,
-                                                  NULL, sizeof( buf ),
-                                                  buf, sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_parse_key(NULL,
+                                                buf, sizeof(buf),
+                                                buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_parse_key(&pk,
+                                                NULL, sizeof(buf),
+                                                buf, sizeof(buf)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_parse_public_key( NULL,
-                                                         buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_parse_public_key( &pk,
-                                                         NULL, sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_parse_public_key(NULL,
+                                                       buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_parse_public_key(&pk,
+                                                       NULL, sizeof(buf)));
 #endif /* MBEDTLS_PK_PARSE_C */
 
 #if defined(MBEDTLS_PK_WRITE_C)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_write_pubkey( NULL, p, &pk ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_write_pubkey( &null_buf, p, &pk ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_write_pubkey( &p, NULL, &pk ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_write_pubkey( &p, p, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_write_pubkey(NULL, p, &pk));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_write_pubkey(&null_buf, p, &pk));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_write_pubkey(&p, NULL, &pk));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_write_pubkey(&p, p, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_write_pubkey_der( NULL,
-                                                         buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_write_pubkey_der( &pk,
-                                                         NULL, sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_write_pubkey_der(NULL,
+                                                       buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_write_pubkey_der(&pk,
+                                                       NULL, sizeof(buf)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_write_key_der( NULL,
-                                                      buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_write_key_der( &pk,
-                                                      NULL, sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_write_key_der(NULL,
+                                                    buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_write_key_der(&pk,
+                                                    NULL, sizeof(buf)));
 
 #if defined(MBEDTLS_PEM_WRITE_C)
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_write_pubkey_pem( NULL,
-                                                         buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_write_pubkey_pem( &pk,
-                                                         NULL, sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_write_pubkey_pem(NULL,
+                                                       buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_write_pubkey_pem(&pk,
+                                                       NULL, sizeof(buf)));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_write_key_pem( NULL,
-                                                      buf, sizeof( buf ) ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_PK_BAD_INPUT_DATA,
-                            mbedtls_pk_write_key_pem( &pk,
-                                                      NULL, sizeof( buf ) ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_write_key_pem(NULL,
+                                                    buf, sizeof(buf)));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_PK_BAD_INPUT_DATA,
+                           mbedtls_pk_write_key_pem(&pk,
+                                                    NULL, sizeof(buf)));
 #endif /* MBEDTLS_PEM_WRITE_C */
 
 #endif /* MBEDTLS_PK_WRITE_C */
@@ -593,60 +595,59 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void pk_utils( int type, int parameter, int bitlen, int len, char * name )
+void pk_utils(int type, int parameter, int bitlen, int len, char *name)
 {
     mbedtls_pk_context pk;
 
-    mbedtls_pk_init( &pk );
+    mbedtls_pk_init(&pk);
 
-    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( type ) ) == 0 );
-    TEST_ASSERT( pk_genkey( &pk, parameter ) == 0 );
+    TEST_ASSERT(mbedtls_pk_setup(&pk, mbedtls_pk_info_from_type(type)) == 0);
+    TEST_ASSERT(pk_genkey(&pk, parameter) == 0);
 
-    TEST_ASSERT( (int) mbedtls_pk_get_type( &pk ) == type );
-    TEST_ASSERT( mbedtls_pk_can_do( &pk, type ) );
-    TEST_ASSERT( mbedtls_pk_get_bitlen( &pk ) == (unsigned) bitlen );
-    TEST_ASSERT( mbedtls_pk_get_len( &pk ) == (unsigned) len );
-    TEST_ASSERT( strcmp( mbedtls_pk_get_name( &pk), name ) == 0 );
+    TEST_ASSERT((int) mbedtls_pk_get_type(&pk) == type);
+    TEST_ASSERT(mbedtls_pk_can_do(&pk, type));
+    TEST_ASSERT(mbedtls_pk_get_bitlen(&pk) == (unsigned) bitlen);
+    TEST_ASSERT(mbedtls_pk_get_len(&pk) == (unsigned) len);
+    TEST_ASSERT(strcmp(mbedtls_pk_get_name(&pk), name) == 0);
 
 exit:
-    mbedtls_pk_free( &pk );
+    mbedtls_pk_free(&pk);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PK_PARSE_C:MBEDTLS_FS_IO */
-void mbedtls_pk_check_pair( char * pub_file, char * prv_file, int ret )
+void mbedtls_pk_check_pair(char *pub_file, char *prv_file, int ret)
 {
     mbedtls_pk_context pub, prv, alt;
 
-    mbedtls_pk_init( &pub );
-    mbedtls_pk_init( &prv );
-    mbedtls_pk_init( &alt );
+    mbedtls_pk_init(&pub);
+    mbedtls_pk_init(&prv);
+    mbedtls_pk_init(&alt);
 
-    TEST_ASSERT( mbedtls_pk_parse_public_keyfile( &pub, pub_file ) == 0 );
-    TEST_ASSERT( mbedtls_pk_parse_keyfile( &prv, prv_file, NULL ) == 0 );
+    TEST_ASSERT(mbedtls_pk_parse_public_keyfile(&pub, pub_file) == 0);
+    TEST_ASSERT(mbedtls_pk_parse_keyfile(&prv, prv_file, NULL) == 0);
 
-    TEST_ASSERT( mbedtls_pk_check_pair( &pub, &prv ) == ret );
+    TEST_ASSERT(mbedtls_pk_check_pair(&pub, &prv) == ret);
 
 #if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
-    if( mbedtls_pk_get_type( &prv ) == MBEDTLS_PK_RSA )
-    {
-        TEST_ASSERT( mbedtls_pk_setup_rsa_alt( &alt, mbedtls_pk_rsa( prv ),
-                     mbedtls_rsa_decrypt_func, mbedtls_rsa_sign_func,
-                     mbedtls_rsa_key_len_func ) == 0 );
-        TEST_ASSERT( mbedtls_pk_check_pair( &pub, &alt ) == ret );
+    if (mbedtls_pk_get_type(&prv) == MBEDTLS_PK_RSA) {
+        TEST_ASSERT(mbedtls_pk_setup_rsa_alt(&alt, mbedtls_pk_rsa(prv),
+                                             mbedtls_rsa_decrypt_func, mbedtls_rsa_sign_func,
+                                             mbedtls_rsa_key_len_func) == 0);
+        TEST_ASSERT(mbedtls_pk_check_pair(&pub, &alt) == ret);
     }
 #endif
 
-    mbedtls_pk_free( &pub );
-    mbedtls_pk_free( &prv );
-    mbedtls_pk_free( &alt );
+    mbedtls_pk_free(&pub);
+    mbedtls_pk_free(&prv);
+    mbedtls_pk_free(&alt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_RSA_C */
-void pk_rsa_verify_test_vec( data_t * message_str, int digest, int mod,
-                             char * input_N, char * input_E,
-                             data_t * result_str, int result )
+void pk_rsa_verify_test_vec(data_t *message_str, int digest, int mod,
+                            char *input_N, char *input_E,
+                            data_t *result_str, int result)
 {
     unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
     mbedtls_rsa_context *rsa;
@@ -656,46 +657,49 @@
     mbedtls_pk_restart_ctx ctx;
 
     rs_ctx = &ctx;
-    mbedtls_pk_restart_init( rs_ctx );
+    mbedtls_pk_restart_init(rs_ctx);
     // this setting would ensure restart would happen if ECC was used
-    mbedtls_ecp_set_max_ops( 1 );
+    mbedtls_ecp_set_max_ops(1);
 #endif
 
-    mbedtls_pk_init( &pk );
+    mbedtls_pk_init(&pk);
 
-    memset( hash_result, 0x00, MBEDTLS_MD_MAX_SIZE );
+    memset(hash_result, 0x00, MBEDTLS_MD_MAX_SIZE);
 
-    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
-    rsa = mbedtls_pk_rsa( pk );
+    TEST_ASSERT(mbedtls_pk_setup(&pk, mbedtls_pk_info_from_type(MBEDTLS_PK_RSA)) == 0);
+    rsa = mbedtls_pk_rsa(pk);
 
     rsa->len = mod / 8;
-    TEST_ASSERT( mbedtls_test_read_mpi( &rsa->N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &rsa->E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&rsa->N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&rsa->E, input_E) == 0);
 
 
-    if( mbedtls_md_info_from_type( digest ) != NULL )
-        TEST_ASSERT( mbedtls_md( mbedtls_md_info_from_type( digest ), message_str->x, message_str->len, hash_result ) == 0 );
+    if (mbedtls_md_info_from_type(digest) != NULL) {
+        TEST_ASSERT(mbedtls_md(mbedtls_md_info_from_type(digest), message_str->x, message_str->len,
+                               hash_result) == 0);
+    }
 
-    TEST_ASSERT( mbedtls_pk_verify( &pk, digest, hash_result, 0,
-                            result_str->x, mbedtls_pk_get_len( &pk ) ) == result );
+    TEST_ASSERT(mbedtls_pk_verify(&pk, digest, hash_result, 0,
+                                  result_str->x, mbedtls_pk_get_len(&pk)) == result);
 
-    TEST_ASSERT( mbedtls_pk_verify_restartable( &pk, digest, hash_result, 0,
-                    result_str->x, mbedtls_pk_get_len( &pk ), rs_ctx ) == result );
+    TEST_ASSERT(mbedtls_pk_verify_restartable(&pk, digest, hash_result, 0,
+                                              result_str->x, mbedtls_pk_get_len(
+                                                  &pk), rs_ctx) == result);
 
 exit:
 #if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE)
-    mbedtls_pk_restart_free( rs_ctx );
+    mbedtls_pk_restart_free(rs_ctx);
 #endif
-    mbedtls_pk_free( &pk );
+    mbedtls_pk_free(&pk);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_RSA_C */
-void pk_rsa_verify_ext_test_vec( data_t * message_str, int digest,
-                                 int mod, char * input_N,
-                                 char * input_E, data_t * result_str,
-                                 int pk_type, int mgf1_hash_id,
-                                 int salt_len, int result )
+void pk_rsa_verify_ext_test_vec(data_t *message_str, int digest,
+                                int mod, char *input_N,
+                                char *input_E, data_t *result_str,
+                                int pk_type, int mgf1_hash_id,
+                                int salt_len, int result)
 {
     unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
     mbedtls_rsa_context *rsa;
@@ -704,85 +708,79 @@
     void *options;
     size_t hash_len;
 
-    mbedtls_pk_init( &pk );
+    mbedtls_pk_init(&pk);
 
-    memset( hash_result, 0x00, sizeof( hash_result ) );
+    memset(hash_result, 0x00, sizeof(hash_result));
 
-    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
-    rsa = mbedtls_pk_rsa( pk );
+    TEST_ASSERT(mbedtls_pk_setup(&pk, mbedtls_pk_info_from_type(MBEDTLS_PK_RSA)) == 0);
+    rsa = mbedtls_pk_rsa(pk);
 
     rsa->len = mod / 8;
-    TEST_ASSERT( mbedtls_test_read_mpi( &rsa->N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &rsa->E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&rsa->N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&rsa->E, input_E) == 0);
 
 
-    if( digest != MBEDTLS_MD_NONE )
-    {
-        TEST_ASSERT( mbedtls_md( mbedtls_md_info_from_type( digest ),
-                     message_str->x, message_str->len, hash_result ) == 0 );
+    if (digest != MBEDTLS_MD_NONE) {
+        TEST_ASSERT(mbedtls_md(mbedtls_md_info_from_type(digest),
+                               message_str->x, message_str->len, hash_result) == 0);
         hash_len = 0;
-    }
-    else
-    {
-        memcpy( hash_result, message_str->x, message_str->len );
+    } else {
+        memcpy(hash_result, message_str->x, message_str->len);
         hash_len = message_str->len;
     }
 
-    if( mgf1_hash_id < 0 )
-    {
+    if (mgf1_hash_id < 0) {
         options = NULL;
-    }
-    else
-    {
+    } else {
         options = &pss_opts;
 
         pss_opts.mgf1_hash_id = mgf1_hash_id;
         pss_opts.expected_salt_len = salt_len;
     }
 
-    TEST_ASSERT( mbedtls_pk_verify_ext( pk_type, options, &pk,
-                                digest, hash_result, hash_len,
-                                result_str->x, mbedtls_pk_get_len( &pk ) ) == result );
+    TEST_ASSERT(mbedtls_pk_verify_ext(pk_type, options, &pk,
+                                      digest, hash_result, hash_len,
+                                      result_str->x, mbedtls_pk_get_len(&pk)) == result);
 
 exit:
-    mbedtls_pk_free( &pk );
+    mbedtls_pk_free(&pk);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECDSA_C */
-void pk_ec_test_vec( int type, int id, data_t * key, data_t * hash,
-                     data_t * sig, int ret )
+void pk_ec_test_vec(int type, int id, data_t *key, data_t *hash,
+                    data_t *sig, int ret)
 {
     mbedtls_pk_context pk;
     mbedtls_ecp_keypair *eckey;
 
-    mbedtls_pk_init( &pk );
-    USE_PSA_INIT( );
+    mbedtls_pk_init(&pk);
+    USE_PSA_INIT();
 
-    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( type ) ) == 0 );
+    TEST_ASSERT(mbedtls_pk_setup(&pk, mbedtls_pk_info_from_type(type)) == 0);
 
-    TEST_ASSERT( mbedtls_pk_can_do( &pk, MBEDTLS_PK_ECDSA ) );
-    eckey = mbedtls_pk_ec( pk );
+    TEST_ASSERT(mbedtls_pk_can_do(&pk, MBEDTLS_PK_ECDSA));
+    eckey = mbedtls_pk_ec(pk);
 
-    TEST_ASSERT( mbedtls_ecp_group_load( &eckey->grp, id ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_point_read_binary( &eckey->grp, &eckey->Q,
-                                        key->x, key->len ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&eckey->grp, id) == 0);
+    TEST_ASSERT(mbedtls_ecp_point_read_binary(&eckey->grp, &eckey->Q,
+                                              key->x, key->len) == 0);
 
     // MBEDTLS_MD_NONE is used since it will be ignored.
-    TEST_ASSERT( mbedtls_pk_verify( &pk, MBEDTLS_MD_NONE,
-                            hash->x, hash->len, sig->x, sig->len ) == ret );
+    TEST_ASSERT(mbedtls_pk_verify(&pk, MBEDTLS_MD_NONE,
+                                  hash->x, hash->len, sig->x, sig->len) == ret);
 
 exit:
-    mbedtls_pk_free( &pk );
-    USE_PSA_DONE( );
+    mbedtls_pk_free(&pk);
+    USE_PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ECP_RESTARTABLE:MBEDTLS_ECDSA_C:MBEDTLS_ECDSA_DETERMINISTIC */
-void pk_sign_verify_restart( int pk_type, int grp_id, char *d_str,
-                              char *QX_str, char *QY_str,
-                              int md_alg, char *msg, data_t *sig_check,
-                              int max_ops, int min_restart, int max_restart )
+void pk_sign_verify_restart(int pk_type, int grp_id, char *d_str,
+                            char *QX_str, char *QY_str,
+                            int md_alg, char *msg, data_t *sig_check,
+                            int max_ops, int min_restart, int max_restart)
 {
     int ret, cnt_restart;
     mbedtls_pk_restart_ctx rs_ctx;
@@ -792,94 +790,93 @@
     size_t hlen, slen;
     const mbedtls_md_info_t *md_info;
 
-    mbedtls_pk_restart_init( &rs_ctx );
-    mbedtls_pk_init( &prv );
-    mbedtls_pk_init( &pub );
-    memset( hash, 0, sizeof( hash ) );
-    memset( sig, 0, sizeof( sig ) );
+    mbedtls_pk_restart_init(&rs_ctx);
+    mbedtls_pk_init(&prv);
+    mbedtls_pk_init(&pub);
+    memset(hash, 0, sizeof(hash));
+    memset(sig, 0, sizeof(sig));
 
-    TEST_ASSERT( mbedtls_pk_setup( &prv, mbedtls_pk_info_from_type( pk_type ) ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_group_load( &mbedtls_pk_ec( prv )->grp, grp_id ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &mbedtls_pk_ec( prv )->d, d_str ) == 0 );
+    TEST_ASSERT(mbedtls_pk_setup(&prv, mbedtls_pk_info_from_type(pk_type)) == 0);
+    TEST_ASSERT(mbedtls_ecp_group_load(&mbedtls_pk_ec(prv)->grp, grp_id) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&mbedtls_pk_ec(prv)->d, d_str) == 0);
 
-    TEST_ASSERT( mbedtls_pk_setup( &pub, mbedtls_pk_info_from_type( pk_type ) ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_group_load( &mbedtls_pk_ec( pub )->grp, grp_id ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_point_read_string( &mbedtls_pk_ec( pub )->Q, 16, QX_str, QY_str ) == 0 );
+    TEST_ASSERT(mbedtls_pk_setup(&pub, mbedtls_pk_info_from_type(pk_type)) == 0);
+    TEST_ASSERT(mbedtls_ecp_group_load(&mbedtls_pk_ec(pub)->grp, grp_id) == 0);
+    TEST_ASSERT(mbedtls_ecp_point_read_string(&mbedtls_pk_ec(pub)->Q, 16, QX_str, QY_str) == 0);
 
-    md_info = mbedtls_md_info_from_type( md_alg );
-    TEST_ASSERT( md_info != NULL );
+    md_info = mbedtls_md_info_from_type(md_alg);
+    TEST_ASSERT(md_info != NULL);
 
-    hlen = mbedtls_md_get_size( md_info );
-    TEST_ASSERT( mbedtls_md( md_info,
-                             (const unsigned char *) msg, strlen( msg ),
-                             hash ) == 0 );
+    hlen = mbedtls_md_get_size(md_info);
+    TEST_ASSERT(mbedtls_md(md_info,
+                           (const unsigned char *) msg, strlen(msg),
+                           hash) == 0);
 
-    mbedtls_ecp_set_max_ops( max_ops );
+    mbedtls_ecp_set_max_ops(max_ops);
 
-    slen = sizeof( sig );
+    slen = sizeof(sig);
     cnt_restart = 0;
     do {
-        ret = mbedtls_pk_sign_restartable( &prv, md_alg, hash, hlen,
-                                            sig, &slen, NULL, NULL, &rs_ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart );
+        ret = mbedtls_pk_sign_restartable(&prv, md_alg, hash, hlen,
+                                          sig, &slen, NULL, NULL, &rs_ctx);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart);
 
-    TEST_ASSERT( ret == 0 );
-    TEST_ASSERT( slen == sig_check->len );
-    TEST_ASSERT( memcmp( sig, sig_check->x, slen ) == 0 );
+    TEST_ASSERT(ret == 0);
+    TEST_ASSERT(slen == sig_check->len);
+    TEST_ASSERT(memcmp(sig, sig_check->x, slen) == 0);
 
-    TEST_ASSERT( cnt_restart >= min_restart );
-    TEST_ASSERT( cnt_restart <= max_restart );
+    TEST_ASSERT(cnt_restart >= min_restart);
+    TEST_ASSERT(cnt_restart <= max_restart);
 
     cnt_restart = 0;
     do {
-        ret = mbedtls_pk_verify_restartable( &pub, md_alg,
-                                 hash, hlen, sig, slen, &rs_ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart );
+        ret = mbedtls_pk_verify_restartable(&pub, md_alg,
+                                            hash, hlen, sig, slen, &rs_ctx);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart);
 
-    TEST_ASSERT( ret == 0 );
-    TEST_ASSERT( cnt_restart >= min_restart );
-    TEST_ASSERT( cnt_restart <= max_restart );
+    TEST_ASSERT(ret == 0);
+    TEST_ASSERT(cnt_restart >= min_restart);
+    TEST_ASSERT(cnt_restart <= max_restart);
 
     hash[0]++;
     do {
-        ret = mbedtls_pk_verify_restartable( &pub, md_alg,
-                                 hash, hlen, sig, slen, &rs_ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS );
-    TEST_ASSERT( ret != 0 );
+        ret = mbedtls_pk_verify_restartable(&pub, md_alg,
+                                            hash, hlen, sig, slen, &rs_ctx);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS);
+    TEST_ASSERT(ret != 0);
     hash[0]--;
 
     sig[0]++;
     do {
-        ret = mbedtls_pk_verify_restartable( &pub, md_alg,
-                                 hash, hlen, sig, slen, &rs_ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS );
-    TEST_ASSERT( ret != 0 );
+        ret = mbedtls_pk_verify_restartable(&pub, md_alg,
+                                            hash, hlen, sig, slen, &rs_ctx);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS);
+    TEST_ASSERT(ret != 0);
     sig[0]--;
 
     /* Do we leak memory when aborting? try verify then sign
      * This test only makes sense when we actually restart */
-    if( min_restart > 0 )
-    {
-        ret = mbedtls_pk_verify_restartable( &pub, md_alg,
-                                 hash, hlen, sig, slen, &rs_ctx );
-        TEST_ASSERT( ret == MBEDTLS_ERR_ECP_IN_PROGRESS );
-        mbedtls_pk_restart_free( &rs_ctx );
+    if (min_restart > 0) {
+        ret = mbedtls_pk_verify_restartable(&pub, md_alg,
+                                            hash, hlen, sig, slen, &rs_ctx);
+        TEST_ASSERT(ret == MBEDTLS_ERR_ECP_IN_PROGRESS);
+        mbedtls_pk_restart_free(&rs_ctx);
 
-        slen = sizeof( sig );
-        ret = mbedtls_pk_sign_restartable( &prv, md_alg, hash, hlen,
-                                            sig, &slen, NULL, NULL, &rs_ctx );
-        TEST_ASSERT( ret == MBEDTLS_ERR_ECP_IN_PROGRESS );
+        slen = sizeof(sig);
+        ret = mbedtls_pk_sign_restartable(&prv, md_alg, hash, hlen,
+                                          sig, &slen, NULL, NULL, &rs_ctx);
+        TEST_ASSERT(ret == MBEDTLS_ERR_ECP_IN_PROGRESS);
     }
 
 exit:
-    mbedtls_pk_restart_free( &rs_ctx );
-    mbedtls_pk_free( &prv );
-    mbedtls_pk_free( &pub );
+    mbedtls_pk_restart_free(&rs_ctx);
+    mbedtls_pk_free(&prv);
+    mbedtls_pk_free(&pub);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA256_C */
-void pk_sign_verify( int type, int parameter, int sign_ret, int verify_ret )
+void pk_sign_verify(int type, int parameter, int sign_ret, int verify_ret)
 {
     mbedtls_pk_context pk;
     size_t sig_len, hash_len;
@@ -891,88 +888,88 @@
     mbedtls_pk_restart_ctx ctx;
 
     rs_ctx = &ctx;
-    mbedtls_pk_restart_init( rs_ctx );
+    mbedtls_pk_restart_init(rs_ctx);
     /* This value is large enough that the operation will complete in one run.
      * See comments at the top of ecp_test_vect_restart in
      * test_suite_ecp.function for estimates of operation counts. */
-    mbedtls_ecp_set_max_ops( 42000 );
+    mbedtls_ecp_set_max_ops(42000);
 #endif
 
-    hash_len = mbedtls_md_get_size( mbedtls_md_info_from_type( md ) );
-    ASSERT_ALLOC( hash, hash_len );
+    hash_len = mbedtls_md_get_size(mbedtls_md_info_from_type(md));
+    ASSERT_ALLOC(hash, hash_len);
 
-    mbedtls_pk_init( &pk );
-    USE_PSA_INIT( );
+    mbedtls_pk_init(&pk);
+    USE_PSA_INIT();
 
-    memset( hash, 0x2a, hash_len );
-    memset( sig, 0, sizeof sig );
+    memset(hash, 0x2a, hash_len);
+    memset(sig, 0, sizeof sig);
 
-    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( type ) ) == 0 );
-    TEST_ASSERT( pk_genkey( &pk, parameter ) == 0 );
+    TEST_ASSERT(mbedtls_pk_setup(&pk, mbedtls_pk_info_from_type(type)) == 0);
+    TEST_ASSERT(pk_genkey(&pk, parameter) == 0);
 
-    TEST_ASSERT( mbedtls_pk_sign_restartable( &pk, md,
-                 hash, hash_len, sig, &sig_len,
-                 mbedtls_test_rnd_std_rand, NULL, rs_ctx ) == sign_ret );
-    if( sign_ret == 0 )
-        TEST_ASSERT( sig_len <= MBEDTLS_PK_SIGNATURE_MAX_SIZE );
-    else
+    TEST_ASSERT(mbedtls_pk_sign_restartable(&pk, md,
+                                            hash, hash_len, sig, &sig_len,
+                                            mbedtls_test_rnd_std_rand, NULL, rs_ctx) == sign_ret);
+    if (sign_ret == 0) {
+        TEST_ASSERT(sig_len <= MBEDTLS_PK_SIGNATURE_MAX_SIZE);
+    } else {
         sig_len = MBEDTLS_PK_SIGNATURE_MAX_SIZE;
+    }
 
-    TEST_ASSERT( mbedtls_pk_verify( &pk, md,
-                            hash, hash_len, sig, sig_len ) == verify_ret );
+    TEST_ASSERT(mbedtls_pk_verify(&pk, md,
+                                  hash, hash_len, sig, sig_len) == verify_ret);
 
-    if( verify_ret == 0 )
-    {
+    if (verify_ret == 0) {
         hash[0]++;
-        TEST_ASSERT( mbedtls_pk_verify( &pk, md,
-                                hash, hash_len, sig, sig_len ) != 0 );
+        TEST_ASSERT(mbedtls_pk_verify(&pk, md,
+                                      hash, hash_len, sig, sig_len) != 0);
         hash[0]--;
 
         sig[0]++;
-        TEST_ASSERT( mbedtls_pk_verify( &pk, md,
-                                hash, hash_len, sig, sig_len ) != 0 );
+        TEST_ASSERT(mbedtls_pk_verify(&pk, md,
+                                      hash, hash_len, sig, sig_len) != 0);
         sig[0]--;
     }
 
-    TEST_ASSERT( mbedtls_pk_sign( &pk, md, hash, hash_len,
-                                  sig, &sig_len,
-                                  mbedtls_test_rnd_std_rand,
-                                  NULL ) == sign_ret );
-    if( sign_ret == 0 )
-        TEST_ASSERT( sig_len <= MBEDTLS_PK_SIGNATURE_MAX_SIZE );
-    else
+    TEST_ASSERT(mbedtls_pk_sign(&pk, md, hash, hash_len,
+                                sig, &sig_len,
+                                mbedtls_test_rnd_std_rand,
+                                NULL) == sign_ret);
+    if (sign_ret == 0) {
+        TEST_ASSERT(sig_len <= MBEDTLS_PK_SIGNATURE_MAX_SIZE);
+    } else {
         sig_len = MBEDTLS_PK_SIGNATURE_MAX_SIZE;
+    }
 
-    TEST_ASSERT( mbedtls_pk_verify_restartable( &pk, md,
-                 hash, hash_len, sig, sig_len, rs_ctx ) == verify_ret );
+    TEST_ASSERT(mbedtls_pk_verify_restartable(&pk, md,
+                                              hash, hash_len, sig, sig_len, rs_ctx) == verify_ret);
 
-    if( verify_ret == 0 )
-    {
+    if (verify_ret == 0) {
         hash[0]++;
-        TEST_ASSERT( mbedtls_pk_verify_restartable( &pk, md,
-                     hash, hash_len, sig, sig_len, rs_ctx ) != 0 );
+        TEST_ASSERT(mbedtls_pk_verify_restartable(&pk, md,
+                                                  hash, hash_len, sig, sig_len, rs_ctx) != 0);
         hash[0]--;
 
         sig[0]++;
-        TEST_ASSERT( mbedtls_pk_verify_restartable( &pk, md,
-                     hash, hash_len, sig, sig_len, rs_ctx ) != 0 );
+        TEST_ASSERT(mbedtls_pk_verify_restartable(&pk, md,
+                                                  hash, hash_len, sig, sig_len, rs_ctx) != 0);
         sig[0]--;
     }
 
 exit:
 #if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE)
-    mbedtls_pk_restart_free( rs_ctx );
+    mbedtls_pk_restart_free(rs_ctx);
 #endif
-    mbedtls_pk_free( &pk );
-    mbedtls_free( hash );
-    USE_PSA_DONE( );
+    mbedtls_pk_free(&pk);
+    mbedtls_free(hash);
+    USE_PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_RSA_C */
-void pk_rsa_encrypt_test_vec( data_t * message, int mod,
-                              char * input_N, char * input_E,
-                              data_t * result, int ret )
+void pk_rsa_encrypt_test_vec(data_t *message, int mod,
+                             char *input_N, char *input_E,
+                             data_t *result, int ret)
 {
     unsigned char output[300];
     mbedtls_test_rnd_pseudo_info rnd_info;
@@ -980,34 +977,34 @@
     mbedtls_pk_context pk;
     size_t olen;
 
-    memset( &rnd_info,  0, sizeof( mbedtls_test_rnd_pseudo_info ) );
-    memset( output,     0, sizeof( output ) );
+    memset(&rnd_info,  0, sizeof(mbedtls_test_rnd_pseudo_info));
+    memset(output,     0, sizeof(output));
 
 
-    mbedtls_pk_init( &pk );
-    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
-    rsa = mbedtls_pk_rsa( pk );
+    mbedtls_pk_init(&pk);
+    TEST_ASSERT(mbedtls_pk_setup(&pk, mbedtls_pk_info_from_type(MBEDTLS_PK_RSA)) == 0);
+    rsa = mbedtls_pk_rsa(pk);
 
     rsa->len = mod / 8;
-    TEST_ASSERT( mbedtls_test_read_mpi( &rsa->N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &rsa->E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&rsa->N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&rsa->E, input_E) == 0);
 
-    TEST_ASSERT( mbedtls_pk_encrypt( &pk, message->x, message->len,
-                            output, &olen, sizeof( output ),
-                            mbedtls_test_rnd_pseudo_rand, &rnd_info ) == ret );
-    TEST_ASSERT( olen == result->len );
-    TEST_ASSERT( memcmp( output, result->x, olen ) == 0 );
+    TEST_ASSERT(mbedtls_pk_encrypt(&pk, message->x, message->len,
+                                   output, &olen, sizeof(output),
+                                   mbedtls_test_rnd_pseudo_rand, &rnd_info) == ret);
+    TEST_ASSERT(olen == result->len);
+    TEST_ASSERT(memcmp(output, result->x, olen) == 0);
 
 exit:
-    mbedtls_pk_free( &pk );
+    mbedtls_pk_free(&pk);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_RSA_C */
-void pk_rsa_decrypt_test_vec( data_t * cipher, int mod,
-                              char * input_P, char * input_Q,
-                              char * input_N, char * input_E,
-                              data_t * clear, int ret )
+void pk_rsa_decrypt_test_vec(data_t *cipher, int mod,
+                             char *input_P, char *input_Q,
+                             char *input_N, char *input_E,
+                             data_t *clear, int ret)
 {
     unsigned char output[256];
     mbedtls_test_rnd_pseudo_info rnd_info;
@@ -1016,49 +1013,48 @@
     mbedtls_pk_context pk;
     size_t olen;
 
-    mbedtls_pk_init( &pk );
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &P );
-    mbedtls_mpi_init( &Q ); mbedtls_mpi_init( &E );
+    mbedtls_pk_init(&pk);
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E);
 
-    memset( &rnd_info,  0, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    memset(&rnd_info,  0, sizeof(mbedtls_test_rnd_pseudo_info));
 
 
     /* init pk-rsa context */
-    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
-    rsa = mbedtls_pk_rsa( pk );
+    TEST_ASSERT(mbedtls_pk_setup(&pk, mbedtls_pk_info_from_type(MBEDTLS_PK_RSA)) == 0);
+    rsa = mbedtls_pk_rsa(pk);
 
     /* load public key */
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
 
     /* load private key */
-    TEST_ASSERT( mbedtls_test_read_mpi( &P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_import( rsa, &N, &P, &Q, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( rsa ) == (size_t) ( mod / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_complete( rsa ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_rsa_import(rsa, &N, &P, &Q, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(rsa) == (size_t) (mod / 8));
+    TEST_ASSERT(mbedtls_rsa_complete(rsa) == 0);
 
     /* decryption test */
-    memset( output, 0, sizeof( output ) );
+    memset(output, 0, sizeof(output));
     olen = 0;
-    TEST_ASSERT( mbedtls_pk_decrypt( &pk, cipher->x, cipher->len,
-                            output, &olen, sizeof( output ),
-                            mbedtls_test_rnd_pseudo_rand, &rnd_info ) == ret );
-    if( ret == 0 )
-    {
-        TEST_ASSERT( olen == clear->len );
-        TEST_ASSERT( memcmp( output, clear->x, olen ) == 0 );
+    TEST_ASSERT(mbedtls_pk_decrypt(&pk, cipher->x, cipher->len,
+                                   output, &olen, sizeof(output),
+                                   mbedtls_test_rnd_pseudo_rand, &rnd_info) == ret);
+    if (ret == 0) {
+        TEST_ASSERT(olen == clear->len);
+        TEST_ASSERT(memcmp(output, clear->x, olen) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &P );
-    mbedtls_mpi_free( &Q ); mbedtls_mpi_free( &E );
-    mbedtls_pk_free( &pk );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&P);
+    mbedtls_mpi_free(&Q); mbedtls_mpi_free(&E);
+    mbedtls_pk_free(&pk);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void pk_ec_nocrypt( int type )
+void pk_ec_nocrypt(int type)
 {
     mbedtls_pk_context pk;
     unsigned char output[100];
@@ -1067,65 +1063,66 @@
     size_t olen = 0;
     int ret = MBEDTLS_ERR_PK_TYPE_MISMATCH;
 
-    mbedtls_pk_init( &pk );
+    mbedtls_pk_init(&pk);
 
-    memset( &rnd_info,  0, sizeof( mbedtls_test_rnd_pseudo_info ) );
-    memset( output,     0, sizeof( output ) );
-    memset( input,      0, sizeof( input ) );
+    memset(&rnd_info,  0, sizeof(mbedtls_test_rnd_pseudo_info));
+    memset(output,     0, sizeof(output));
+    memset(input,      0, sizeof(input));
 
-    TEST_ASSERT( mbedtls_pk_setup( &pk, mbedtls_pk_info_from_type( type ) ) == 0 );
+    TEST_ASSERT(mbedtls_pk_setup(&pk, mbedtls_pk_info_from_type(type)) == 0);
 
-    TEST_ASSERT( mbedtls_pk_encrypt( &pk, input, sizeof( input ),
-                            output, &olen, sizeof( output ),
-                            mbedtls_test_rnd_pseudo_rand, &rnd_info ) == ret );
+    TEST_ASSERT(mbedtls_pk_encrypt(&pk, input, sizeof(input),
+                                   output, &olen, sizeof(output),
+                                   mbedtls_test_rnd_pseudo_rand, &rnd_info) == ret);
 
-    TEST_ASSERT( mbedtls_pk_decrypt( &pk, input, sizeof( input ),
-                            output, &olen, sizeof( output ),
-                            mbedtls_test_rnd_pseudo_rand, &rnd_info ) == ret );
+    TEST_ASSERT(mbedtls_pk_decrypt(&pk, input, sizeof(input),
+                                   output, &olen, sizeof(output),
+                                   mbedtls_test_rnd_pseudo_rand, &rnd_info) == ret);
 
 exit:
-    mbedtls_pk_free( &pk );
+    mbedtls_pk_free(&pk);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_RSA_C */
-void pk_rsa_overflow( )
+void pk_rsa_overflow()
 {
     mbedtls_pk_context pk;
     size_t hash_len = SIZE_MAX, sig_len = SIZE_MAX;
     unsigned char hash[50], sig[100];
 
-    if( SIZE_MAX <= UINT_MAX )
+    if (SIZE_MAX <= UINT_MAX) {
         return;
+    }
 
-    memset( hash, 0x2a, sizeof hash );
-    memset( sig, 0, sizeof sig );
+    memset(hash, 0x2a, sizeof hash);
+    memset(sig, 0, sizeof sig);
 
-    mbedtls_pk_init( &pk );
+    mbedtls_pk_init(&pk);
 
-    TEST_ASSERT( mbedtls_pk_setup( &pk,
-                 mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
+    TEST_ASSERT(mbedtls_pk_setup(&pk,
+                                 mbedtls_pk_info_from_type(MBEDTLS_PK_RSA)) == 0);
 
 #if defined(MBEDTLS_PKCS1_V21)
-    TEST_ASSERT( mbedtls_pk_verify_ext( MBEDTLS_PK_RSASSA_PSS, NULL, &pk,
-                    MBEDTLS_MD_NONE, hash, hash_len, sig, sig_len ) ==
-                 MBEDTLS_ERR_PK_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_pk_verify_ext(MBEDTLS_PK_RSASSA_PSS, NULL, &pk,
+                                      MBEDTLS_MD_NONE, hash, hash_len, sig, sig_len) ==
+                MBEDTLS_ERR_PK_BAD_INPUT_DATA);
 #endif /* MBEDTLS_PKCS1_V21 */
 
-    TEST_ASSERT( mbedtls_pk_verify( &pk, MBEDTLS_MD_NONE, hash, hash_len,
-                    sig, sig_len ) == MBEDTLS_ERR_PK_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_pk_verify(&pk, MBEDTLS_MD_NONE, hash, hash_len,
+                                  sig, sig_len) == MBEDTLS_ERR_PK_BAD_INPUT_DATA);
 
-    TEST_ASSERT( mbedtls_pk_sign( &pk, MBEDTLS_MD_NONE, hash, hash_len, sig,
-                                  &sig_len, mbedtls_test_rnd_std_rand, NULL )
-                 == MBEDTLS_ERR_PK_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_pk_sign(&pk, MBEDTLS_MD_NONE, hash, hash_len, sig,
+                                &sig_len, mbedtls_test_rnd_std_rand, NULL)
+                == MBEDTLS_ERR_PK_BAD_INPUT_DATA);
 
 exit:
-    mbedtls_pk_free( &pk );
+    mbedtls_pk_free(&pk);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_RSA_C:MBEDTLS_PK_RSA_ALT_SUPPORT */
-void pk_rsa_alt(  )
+void pk_rsa_alt()
 {
     /*
      * An rsa_alt context can only do private operations (decrypt, sign).
@@ -1140,74 +1137,75 @@
     size_t sig_len, ciph_len, test_len;
     int ret = MBEDTLS_ERR_PK_TYPE_MISMATCH;
 
-    mbedtls_rsa_init( &raw, MBEDTLS_RSA_PKCS_V15, MBEDTLS_MD_NONE );
-    mbedtls_pk_init( &rsa ); mbedtls_pk_init( &alt );
+    mbedtls_rsa_init(&raw, MBEDTLS_RSA_PKCS_V15, MBEDTLS_MD_NONE);
+    mbedtls_pk_init(&rsa); mbedtls_pk_init(&alt);
 
-    memset( hash, 0x2a, sizeof hash );
-    memset( sig, 0, sizeof sig );
-    memset( msg, 0x2a, sizeof msg );
-    memset( ciph, 0, sizeof ciph );
-    memset( test, 0, sizeof test );
+    memset(hash, 0x2a, sizeof hash);
+    memset(sig, 0, sizeof sig);
+    memset(msg, 0x2a, sizeof msg);
+    memset(ciph, 0, sizeof ciph);
+    memset(test, 0, sizeof test);
 
     /* Initialize PK RSA context with random key */
-    TEST_ASSERT( mbedtls_pk_setup( &rsa,
-                              mbedtls_pk_info_from_type( MBEDTLS_PK_RSA ) ) == 0 );
-    TEST_ASSERT( pk_genkey( &rsa, RSA_KEY_SIZE ) == 0 );
+    TEST_ASSERT(mbedtls_pk_setup(&rsa,
+                                 mbedtls_pk_info_from_type(MBEDTLS_PK_RSA)) == 0);
+    TEST_ASSERT(pk_genkey(&rsa, RSA_KEY_SIZE) == 0);
 
     /* Extract key to the raw rsa context */
-    TEST_ASSERT( mbedtls_rsa_copy( &raw, mbedtls_pk_rsa( rsa ) ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_copy(&raw, mbedtls_pk_rsa(rsa)) == 0);
 
     /* Initialize PK RSA_ALT context */
-    TEST_ASSERT( mbedtls_pk_setup_rsa_alt( &alt, (void *) &raw,
-                 mbedtls_rsa_decrypt_func, mbedtls_rsa_sign_func, mbedtls_rsa_key_len_func ) == 0 );
+    TEST_ASSERT(mbedtls_pk_setup_rsa_alt(&alt, (void *) &raw,
+                                         mbedtls_rsa_decrypt_func, mbedtls_rsa_sign_func,
+                                         mbedtls_rsa_key_len_func) == 0);
 
     /* Test administrative functions */
-    TEST_ASSERT( mbedtls_pk_can_do( &alt, MBEDTLS_PK_RSA ) );
-    TEST_ASSERT( mbedtls_pk_get_bitlen( &alt ) == RSA_KEY_SIZE );
-    TEST_ASSERT( mbedtls_pk_get_len( &alt ) == RSA_KEY_LEN );
-    TEST_ASSERT( mbedtls_pk_get_type( &alt ) == MBEDTLS_PK_RSA_ALT );
-    TEST_ASSERT( strcmp( mbedtls_pk_get_name( &alt ), "RSA-alt" ) == 0 );
+    TEST_ASSERT(mbedtls_pk_can_do(&alt, MBEDTLS_PK_RSA));
+    TEST_ASSERT(mbedtls_pk_get_bitlen(&alt) == RSA_KEY_SIZE);
+    TEST_ASSERT(mbedtls_pk_get_len(&alt) == RSA_KEY_LEN);
+    TEST_ASSERT(mbedtls_pk_get_type(&alt) == MBEDTLS_PK_RSA_ALT);
+    TEST_ASSERT(strcmp(mbedtls_pk_get_name(&alt), "RSA-alt") == 0);
 
     /* Test signature */
 #if SIZE_MAX > UINT_MAX
-    TEST_ASSERT( mbedtls_pk_sign( &alt, MBEDTLS_MD_NONE, hash, SIZE_MAX, sig,
-                                  &sig_len, mbedtls_test_rnd_std_rand, NULL )
-                 == MBEDTLS_ERR_PK_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_pk_sign(&alt, MBEDTLS_MD_NONE, hash, SIZE_MAX, sig,
+                                &sig_len, mbedtls_test_rnd_std_rand, NULL)
+                == MBEDTLS_ERR_PK_BAD_INPUT_DATA);
 #endif /* SIZE_MAX > UINT_MAX */
-    TEST_ASSERT( mbedtls_pk_sign( &alt, MBEDTLS_MD_NONE, hash, sizeof hash, sig,
-                                  &sig_len, mbedtls_test_rnd_std_rand, NULL )
-                 == 0 );
-    TEST_ASSERT( sig_len == RSA_KEY_LEN );
-    TEST_ASSERT( mbedtls_pk_verify( &rsa, MBEDTLS_MD_NONE,
-                            hash, sizeof hash, sig, sig_len ) == 0 );
+    TEST_ASSERT(mbedtls_pk_sign(&alt, MBEDTLS_MD_NONE, hash, sizeof hash, sig,
+                                &sig_len, mbedtls_test_rnd_std_rand, NULL)
+                == 0);
+    TEST_ASSERT(sig_len == RSA_KEY_LEN);
+    TEST_ASSERT(mbedtls_pk_verify(&rsa, MBEDTLS_MD_NONE,
+                                  hash, sizeof hash, sig, sig_len) == 0);
 
     /* Test decrypt */
-    TEST_ASSERT( mbedtls_pk_encrypt( &rsa, msg, sizeof msg,
-                             ciph, &ciph_len, sizeof ciph,
-                             mbedtls_test_rnd_std_rand, NULL ) == 0 );
-    TEST_ASSERT( mbedtls_pk_decrypt( &alt, ciph, ciph_len,
-                             test, &test_len, sizeof test,
-                             mbedtls_test_rnd_std_rand, NULL ) == 0 );
-    TEST_ASSERT( test_len == sizeof msg );
-    TEST_ASSERT( memcmp( test, msg, test_len ) == 0 );
+    TEST_ASSERT(mbedtls_pk_encrypt(&rsa, msg, sizeof msg,
+                                   ciph, &ciph_len, sizeof ciph,
+                                   mbedtls_test_rnd_std_rand, NULL) == 0);
+    TEST_ASSERT(mbedtls_pk_decrypt(&alt, ciph, ciph_len,
+                                   test, &test_len, sizeof test,
+                                   mbedtls_test_rnd_std_rand, NULL) == 0);
+    TEST_ASSERT(test_len == sizeof msg);
+    TEST_ASSERT(memcmp(test, msg, test_len) == 0);
 
     /* Test forbidden operations */
-    TEST_ASSERT( mbedtls_pk_encrypt( &alt, msg, sizeof msg,
-                             ciph, &ciph_len, sizeof ciph,
-                             mbedtls_test_rnd_std_rand, NULL ) == ret );
-    TEST_ASSERT( mbedtls_pk_verify( &alt, MBEDTLS_MD_NONE,
-                            hash, sizeof hash, sig, sig_len ) == ret );
-    TEST_ASSERT( mbedtls_pk_debug( &alt, dbg_items ) == ret );
+    TEST_ASSERT(mbedtls_pk_encrypt(&alt, msg, sizeof msg,
+                                   ciph, &ciph_len, sizeof ciph,
+                                   mbedtls_test_rnd_std_rand, NULL) == ret);
+    TEST_ASSERT(mbedtls_pk_verify(&alt, MBEDTLS_MD_NONE,
+                                  hash, sizeof hash, sig, sig_len) == ret);
+    TEST_ASSERT(mbedtls_pk_debug(&alt, dbg_items) == ret);
 
 exit:
-    mbedtls_rsa_free( &raw );
-    mbedtls_pk_free( &rsa ); mbedtls_pk_free( &alt );
+    mbedtls_rsa_free(&raw);
+    mbedtls_pk_free(&rsa); mbedtls_pk_free(&alt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA256_C:MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_ECDSA_C */
-void pk_psa_sign( int grpid_arg,
-                  int psa_curve_arg, int expected_bits_arg )
+void pk_psa_sign(int grpid_arg,
+                 int psa_curve_arg, int expected_bits_arg)
 {
     mbedtls_ecp_group_id grpid = grpid_arg;
     mbedtls_pk_context pk;
@@ -1220,7 +1218,7 @@
     int ret;
     mbedtls_svc_key_id_t key_id;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    psa_key_type_t expected_type = PSA_KEY_TYPE_ECC_KEY_PAIR( psa_curve_arg );
+    psa_key_type_t expected_type = PSA_KEY_TYPE_ECC_KEY_PAIR(psa_curve_arg);
     size_t expected_bits = expected_bits_arg;
 
     /*
@@ -1231,69 +1229,69 @@
      * - parse it to a PK context and verify the signature this way
      */
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Create legacy EC public/private key in PK context. */
-    mbedtls_pk_init( &pk );
-    TEST_ASSERT( mbedtls_pk_setup( &pk,
-                      mbedtls_pk_info_from_type( MBEDTLS_PK_ECKEY ) ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_gen_key( grpid,
-                                      (mbedtls_ecp_keypair*) pk.pk_ctx,
-                                      mbedtls_test_rnd_std_rand, NULL ) == 0 );
+    mbedtls_pk_init(&pk);
+    TEST_ASSERT(mbedtls_pk_setup(&pk,
+                                 mbedtls_pk_info_from_type(MBEDTLS_PK_ECKEY)) == 0);
+    TEST_ASSERT(mbedtls_ecp_gen_key(grpid,
+                                    (mbedtls_ecp_keypair *) pk.pk_ctx,
+                                    mbedtls_test_rnd_std_rand, NULL) == 0);
 
     /* Export underlying public key for re-importing in a legacy context. */
-    ret = mbedtls_pk_write_pubkey_der( &pk, pkey_legacy,
-                                       sizeof( pkey_legacy ) );
-    TEST_ASSERT( ret >= 0 );
+    ret = mbedtls_pk_write_pubkey_der(&pk, pkey_legacy,
+                                      sizeof(pkey_legacy));
+    TEST_ASSERT(ret >= 0);
     klen_legacy = (size_t) ret;
     /* mbedtls_pk_write_pubkey_der() writes backwards in the data buffer. */
-    pkey_legacy_start = pkey_legacy + sizeof( pkey_legacy ) - klen_legacy;
+    pkey_legacy_start = pkey_legacy + sizeof(pkey_legacy) - klen_legacy;
 
     /* Turn PK context into an opaque one. */
-    TEST_ASSERT( mbedtls_pk_wrap_as_opaque( &pk, &key_id,
-                                            PSA_ALG_SHA_256 ) == 0 );
+    TEST_ASSERT(mbedtls_pk_wrap_as_opaque(&pk, &key_id,
+                                          PSA_ALG_SHA_256) == 0);
 
-    PSA_ASSERT( psa_get_key_attributes( key_id, &attributes ) );
-    TEST_EQUAL( psa_get_key_type( &attributes ), expected_type );
-    TEST_EQUAL( psa_get_key_bits( &attributes ), expected_bits );
-    TEST_EQUAL( psa_get_key_lifetime( &attributes ),
-                PSA_KEY_LIFETIME_VOLATILE );
+    PSA_ASSERT(psa_get_key_attributes(key_id, &attributes));
+    TEST_EQUAL(psa_get_key_type(&attributes), expected_type);
+    TEST_EQUAL(psa_get_key_bits(&attributes), expected_bits);
+    TEST_EQUAL(psa_get_key_lifetime(&attributes),
+               PSA_KEY_LIFETIME_VOLATILE);
 
-    memset( hash, 0x2a, sizeof hash );
-    memset( sig, 0, sizeof sig );
+    memset(hash, 0x2a, sizeof hash);
+    memset(sig, 0, sizeof sig);
 
-    TEST_ASSERT( mbedtls_pk_sign( &pk, MBEDTLS_MD_SHA256,
-                 hash, sizeof hash, sig, &sig_len,
-                 NULL, NULL ) == 0 );
+    TEST_ASSERT(mbedtls_pk_sign(&pk, MBEDTLS_MD_SHA256,
+                                hash, sizeof hash, sig, &sig_len,
+                                NULL, NULL) == 0);
 
     /* Export underlying public key for re-importing in a psa context. */
-    ret = mbedtls_pk_write_pubkey_der( &pk, pkey_psa,
-                                       sizeof( pkey_psa ) );
-    TEST_ASSERT( ret >= 0 );
+    ret = mbedtls_pk_write_pubkey_der(&pk, pkey_psa,
+                                      sizeof(pkey_psa));
+    TEST_ASSERT(ret >= 0);
     klen_psa = (size_t) ret;
     /* mbedtls_pk_write_pubkey_der() writes backwards in the data buffer. */
-    pkey_psa_start = pkey_psa + sizeof( pkey_psa ) - klen_psa;
+    pkey_psa_start = pkey_psa + sizeof(pkey_psa) - klen_psa;
 
-    TEST_ASSERT( klen_psa == klen_legacy );
-    TEST_ASSERT( memcmp( pkey_psa_start, pkey_legacy_start, klen_psa ) == 0 );
+    TEST_ASSERT(klen_psa == klen_legacy);
+    TEST_ASSERT(memcmp(pkey_psa_start, pkey_legacy_start, klen_psa) == 0);
 
-    mbedtls_pk_free( &pk );
-    TEST_ASSERT( PSA_SUCCESS == psa_destroy_key( key_id ) );
+    mbedtls_pk_free(&pk);
+    TEST_ASSERT(PSA_SUCCESS == psa_destroy_key(key_id));
 
-    mbedtls_pk_init( &pk );
-    TEST_ASSERT( mbedtls_pk_parse_public_key( &pk, pkey_legacy_start,
-                                              klen_legacy ) == 0 );
-    TEST_ASSERT( mbedtls_pk_verify( &pk, MBEDTLS_MD_SHA256,
-                            hash, sizeof hash, sig, sig_len ) == 0 );
+    mbedtls_pk_init(&pk);
+    TEST_ASSERT(mbedtls_pk_parse_public_key(&pk, pkey_legacy_start,
+                                            klen_legacy) == 0);
+    TEST_ASSERT(mbedtls_pk_verify(&pk, MBEDTLS_MD_SHA256,
+                                  hash, sizeof hash, sig, sig_len) == 0);
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    mbedtls_pk_free( &pk );
-    USE_PSA_DONE( );
+    mbedtls_pk_free(&pk);
+    USE_PSA_DONE();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_pkcs12.function b/tests/suites/test_suite_pkcs12.function
index 385f86a..17d2ed7 100644
--- a/tests/suites/test_suite_pkcs12.function
+++ b/tests/suites/test_suite_pkcs12.function
@@ -2,10 +2,9 @@
 #include "mbedtls/pkcs12.h"
 #include "mbedtls/error.h"
 
-typedef enum
-{
-   USE_NULL_INPUT = 0,
-   USE_GIVEN_INPUT = 1,
+typedef enum {
+    USE_NULL_INPUT = 0,
+    USE_GIVEN_INPUT = 1,
 } input_usage_method_t;
 
 /* END_HEADER */
@@ -16,34 +15,36 @@
  */
 
 /* BEGIN_CASE */
-void pkcs12_derive_key( int md_type, int key_size_arg,
-                        data_t *password_arg, int password_usage,
-                        data_t *salt_arg, int salt_usage,
-                        int iterations,
-                        data_t* expected_output, int expected_status )
+void pkcs12_derive_key(int md_type, int key_size_arg,
+                       data_t *password_arg, int password_usage,
+                       data_t *salt_arg, int salt_usage,
+                       int iterations,
+                       data_t *expected_output, int expected_status)
 
 {
-   unsigned char *output_data = NULL;
+    unsigned char *output_data = NULL;
 
-   unsigned char *password = NULL;
-   size_t password_len = 0;
-   unsigned char *salt = NULL;
-   size_t salt_len = 0;
-   size_t key_size = key_size_arg;
+    unsigned char *password = NULL;
+    size_t password_len = 0;
+    unsigned char *salt = NULL;
+    size_t salt_len = 0;
+    size_t key_size = key_size_arg;
 
-   if( password_usage == USE_GIVEN_INPUT )
-      password = password_arg->x;
+    if (password_usage == USE_GIVEN_INPUT) {
+        password = password_arg->x;
+    }
 
-   password_len = password_arg->len;
+    password_len = password_arg->len;
 
-   if( salt_usage == USE_GIVEN_INPUT )
-      salt = salt_arg->x;
+    if (salt_usage == USE_GIVEN_INPUT) {
+        salt = salt_arg->x;
+    }
 
-   salt_len = salt_arg->len;
+    salt_len = salt_arg->len;
 
-   ASSERT_ALLOC( output_data, key_size );
+    ASSERT_ALLOC(output_data, key_size);
 
-   int ret = mbedtls_pkcs12_derivation( output_data,
+    int ret = mbedtls_pkcs12_derivation(output_data,
                                         key_size,
                                         password,
                                         password_len,
@@ -51,18 +52,17 @@
                                         salt_len,
                                         md_type,
                                         MBEDTLS_PKCS12_DERIVE_KEY,
-                                        iterations );
+                                        iterations);
 
-   TEST_EQUAL( ret, expected_status );
+    TEST_EQUAL(ret, expected_status);
 
-   if( expected_status == 0 )
-   {
-      ASSERT_COMPARE( expected_output->x, expected_output->len,
-                      output_data, key_size );
-   }
+    if (expected_status == 0) {
+        ASSERT_COMPARE(expected_output->x, expected_output->len,
+                       output_data, key_size);
+    }
 
 exit:
-   mbedtls_free( output_data );
+    mbedtls_free(output_data);
 
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_pkcs1_v15.function b/tests/suites/test_suite_pkcs1_v15.function
index 9fc4faa..83fc73a 100644
--- a/tests/suites/test_suite_pkcs1_v15.function
+++ b/tests/suites/test_suite_pkcs1_v15.function
@@ -9,10 +9,10 @@
  */
 
 /* BEGIN_CASE */
-void pkcs1_rsaes_v15_encrypt( int mod, char * input_N,
-                              char * input_E, int hash,
-                              data_t * message_str, data_t * rnd_buf,
-                              data_t * result_str, int result )
+void pkcs1_rsaes_v15_encrypt(int mod, char *input_N,
+                             char *input_E, int hash,
+                             data_t *message_str, data_t *rnd_buf,
+                             data_t *result_str, int result)
 {
     unsigned char output[128];
     mbedtls_rsa_context ctx;
@@ -24,41 +24,41 @@
     info.buf = rnd_buf->x;
     info.length = rnd_buf->len;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V15, hash );
-    memset( output, 0x00, sizeof( output ) );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V15, hash);
+    memset(output, 0x00, sizeof(output));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, NULL, NULL, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( ( mod + 7 ) / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, NULL, NULL, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) ((mod + 7) / 8));
+    TEST_ASSERT(mbedtls_rsa_check_pubkey(&ctx) == 0);
 
-    if( message_str->len == 0 )
+    if (message_str->len == 0) {
         message_str->x = NULL;
-    TEST_ASSERT( mbedtls_rsa_pkcs1_encrypt( &ctx,
-                                            &mbedtls_test_rnd_buffer_rand,
-                                            &info, MBEDTLS_RSA_PUBLIC,
-                                            message_str->len, message_str->x,
-                                            output ) == result );
+    }
+    TEST_ASSERT(mbedtls_rsa_pkcs1_encrypt(&ctx,
+                                          &mbedtls_test_rnd_buffer_rand,
+                                          &info, MBEDTLS_RSA_PUBLIC,
+                                          message_str->len, message_str->x,
+                                          output) == result);
 
-    if( result == 0 )
-    {
-        TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                          ctx.len, result_str->len ) == 0 );
+    if (result == 0) {
+        TEST_ASSERT(mbedtls_test_hexcmp(output, result_str->x,
+                                        ctx.len, result_str->len) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void pkcs1_rsaes_v15_decrypt( int mod, char * input_P, char * input_Q,
-                              char * input_N, char * input_E, int hash,
-                              data_t * result_str, char * seed,
-                              data_t * message_str, int result )
+void pkcs1_rsaes_v15_decrypt(int mod, char *input_P, char *input_Q,
+                             char *input_N, char *input_E, int hash,
+                             data_t *result_str, char *seed,
+                             data_t *message_str, int result)
 {
     unsigned char output[128];
     mbedtls_rsa_context ctx;
@@ -67,60 +67,56 @@
     mbedtls_mpi N, P, Q, E;
     ((void) seed);
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &P );
-    mbedtls_mpi_init( &Q ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V15, hash );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V15, hash);
 
-    memset( output, 0x00, sizeof( output ) );
-    memset( &rnd_info, 0, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    memset(output, 0x00, sizeof(output));
+    memset(&rnd_info, 0, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, &P, &Q, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( ( mod + 7 ) / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_complete( &ctx ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) ((mod + 7) / 8));
+    TEST_ASSERT(mbedtls_rsa_complete(&ctx) == 0);
+    TEST_ASSERT(mbedtls_rsa_check_privkey(&ctx) == 0);
 
-    if( result_str->len == 0 )
-    {
-        TEST_ASSERT( mbedtls_rsa_pkcs1_decrypt( &ctx,
-                                                &mbedtls_test_rnd_pseudo_rand,
-                                                &rnd_info,
-                                                MBEDTLS_RSA_PRIVATE,
-                                                &output_len, message_str->x,
-                                                NULL, 0 ) == result );
-    }
-    else
-    {
-        TEST_ASSERT( mbedtls_rsa_pkcs1_decrypt( &ctx,
-                                                &mbedtls_test_rnd_pseudo_rand,
-                                                &rnd_info, MBEDTLS_RSA_PRIVATE,
-                                                &output_len, message_str->x,
-                                                output, 1000 ) == result );
-        if( result == 0 )
-        {
-            TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                              output_len,
-                                              result_str->len) == 0 );
+    if (result_str->len == 0) {
+        TEST_ASSERT(mbedtls_rsa_pkcs1_decrypt(&ctx,
+                                              &mbedtls_test_rnd_pseudo_rand,
+                                              &rnd_info,
+                                              MBEDTLS_RSA_PRIVATE,
+                                              &output_len, message_str->x,
+                                              NULL, 0) == result);
+    } else {
+        TEST_ASSERT(mbedtls_rsa_pkcs1_decrypt(&ctx,
+                                              &mbedtls_test_rnd_pseudo_rand,
+                                              &rnd_info, MBEDTLS_RSA_PRIVATE,
+                                              &output_len, message_str->x,
+                                              output, 1000) == result);
+        if (result == 0) {
+            TEST_ASSERT(mbedtls_test_hexcmp(output, result_str->x,
+                                            output_len,
+                                            result_str->len) == 0);
         }
     }
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &P );
-    mbedtls_mpi_free( &Q ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&P);
+    mbedtls_mpi_free(&Q); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void pkcs1_v15_decode( int mode,
-                       data_t *input,
-                       int expected_plaintext_length_arg,
-                       int output_size_arg,
-                       int expected_result )
+void pkcs1_v15_decode(int mode,
+                      data_t *input,
+                      int expected_plaintext_length_arg,
+                      int output_size_arg,
+                      int expected_result)
 {
     size_t expected_plaintext_length = expected_plaintext_length_arg;
     size_t output_size = output_size_arg;
@@ -190,48 +186,46 @@
     unsigned char final[128];
     size_t output_length = 0x7EA0;
 
-    memset( &rnd_info, 0, sizeof( mbedtls_test_rnd_pseudo_info ) );
-    mbedtls_mpi_init( &Nmpi ); mbedtls_mpi_init( &Empi );
-    mbedtls_mpi_init( &Pmpi ); mbedtls_mpi_init( &Qmpi );
-    mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V15, 0 );
+    memset(&rnd_info, 0, sizeof(mbedtls_test_rnd_pseudo_info));
+    mbedtls_mpi_init(&Nmpi); mbedtls_mpi_init(&Empi);
+    mbedtls_mpi_init(&Pmpi); mbedtls_mpi_init(&Qmpi);
+    mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V15, 0);
 
-    TEST_ASSERT( mbedtls_mpi_read_binary( &Nmpi, N, sizeof( N ) ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &Empi, E, sizeof( E ) ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &Pmpi, P, sizeof( P ) ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &Qmpi, Q, sizeof( Q ) ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_read_binary(&Nmpi, N, sizeof(N)) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&Empi, E, sizeof(E)) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&Pmpi, P, sizeof(P)) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&Qmpi, Q, sizeof(Q)) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &Nmpi, &Pmpi, &Qmpi,
-                                     NULL, &Empi ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_complete( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &Nmpi, &Pmpi, &Qmpi,
+                                   NULL, &Empi) == 0);
+    TEST_ASSERT(mbedtls_rsa_complete(&ctx) == 0);
 
-    TEST_ASSERT( input->len <= sizeof( N ) );
-    memcpy( original, input->x, input->len );
-    memset( original + input->len, 'd', sizeof( original ) - input->len );
-    if( mode == MBEDTLS_RSA_PRIVATE )
-        TEST_ASSERT( mbedtls_rsa_public( &ctx, original, intermediate ) == 0 );
-    else
-        TEST_ASSERT( mbedtls_rsa_private( &ctx, &mbedtls_test_rnd_pseudo_rand,
-                                          &rnd_info, original,
-                                          intermediate ) == 0 );
-
-    memcpy( final, default_content, sizeof( final ) );
-    TEST_ASSERT( mbedtls_rsa_pkcs1_decrypt( &ctx,
-                                            &mbedtls_test_rnd_pseudo_rand,
-                                            &rnd_info, mode, &output_length,
-                                            intermediate, final,
-                                            output_size ) == expected_result );
-    if( expected_result == 0 )
-    {
-        TEST_ASSERT( output_length == expected_plaintext_length );
-        TEST_ASSERT( memcmp( original + sizeof( N ) - output_length,
-                             final,
-                             output_length ) == 0 );
+    TEST_ASSERT(input->len <= sizeof(N));
+    memcpy(original, input->x, input->len);
+    memset(original + input->len, 'd', sizeof(original) - input->len);
+    if (mode == MBEDTLS_RSA_PRIVATE) {
+        TEST_ASSERT(mbedtls_rsa_public(&ctx, original, intermediate) == 0);
+    } else {
+        TEST_ASSERT(mbedtls_rsa_private(&ctx, &mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info, original,
+                                        intermediate) == 0);
     }
-    else if( expected_result == MBEDTLS_ERR_RSA_INVALID_PADDING ||
-             expected_result == MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE )
-    {
+
+    memcpy(final, default_content, sizeof(final));
+    TEST_ASSERT(mbedtls_rsa_pkcs1_decrypt(&ctx,
+                                          &mbedtls_test_rnd_pseudo_rand,
+                                          &rnd_info, mode, &output_length,
+                                          intermediate, final,
+                                          output_size) == expected_result);
+    if (expected_result == 0) {
+        TEST_ASSERT(output_length == expected_plaintext_length);
+        TEST_ASSERT(memcmp(original + sizeof(N) - output_length,
+                           final,
+                           output_length) == 0);
+    } else if (expected_result == MBEDTLS_ERR_RSA_INVALID_PADDING ||
+               expected_result == MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE) {
         size_t max_payload_length =
-            output_size > sizeof( N ) - 11 ? sizeof( N ) - 11 : output_size;
+            output_size > sizeof(N) - 11 ? sizeof(N) - 11 : output_size;
         size_t i;
         size_t count = 0;
 
@@ -240,34 +234,36 @@
          * implementation currently does. Alternative implementations
          * may produce different output, so we only perform these precise
          * checks when using the default implementation. */
-        TEST_ASSERT( output_length == max_payload_length );
-        for( i = 0; i < max_payload_length; i++ )
-            TEST_ASSERT( final[i] == 0 );
+        TEST_ASSERT(output_length == max_payload_length);
+        for (i = 0; i < max_payload_length; i++) {
+            TEST_ASSERT(final[i] == 0);
+        }
 #endif
         /* Even in alternative implementations, the outputs must have
          * changed, otherwise it indicates at least a timing vulnerability
          * because no write to the outputs is performed in the bad case. */
-        TEST_ASSERT( output_length != 0x7EA0 );
-        for( i = 0; i < max_payload_length; i++ )
-            count += ( final[i] == default_content[i] );
+        TEST_ASSERT(output_length != 0x7EA0);
+        for (i = 0; i < max_payload_length; i++) {
+            count += (final[i] == default_content[i]);
+        }
         /* If more than 16 bytes are unchanged in final, that's evidence
          * that final wasn't overwritten. */
-        TEST_ASSERT( count < 16 );
+        TEST_ASSERT(count < 16);
     }
 
 exit:
-    mbedtls_mpi_free( &Nmpi ); mbedtls_mpi_free( &Empi );
-    mbedtls_mpi_free( &Pmpi ); mbedtls_mpi_free( &Qmpi );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&Nmpi); mbedtls_mpi_free(&Empi);
+    mbedtls_mpi_free(&Pmpi); mbedtls_mpi_free(&Qmpi);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void pkcs1_rsassa_v15_sign( int mod, char * input_P,
-                            char * input_Q, char * input_N,
-                            char * input_E, int digest, int hash,
-                            data_t * message_str, data_t * rnd_buf,
-                            data_t * result_str, int result )
+void pkcs1_rsassa_v15_sign(int mod, char *input_P,
+                           char *input_Q, char *input_N,
+                           char *input_E, int digest, int hash,
+                           data_t *message_str, data_t *rnd_buf,
+                           data_t *result_str, int result)
 {
     unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
     unsigned char output[128];
@@ -280,72 +276,76 @@
     info.buf = rnd_buf->x;
     info.length = rnd_buf->len;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &P );
-    mbedtls_mpi_init( &Q ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V15, hash );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V15, hash);
 
-    memset( hash_result, 0x00, sizeof( hash_result ) );
-    memset( output, 0x00, sizeof( output ) );
+    memset(hash_result, 0x00, sizeof(hash_result));
+    memset(output, 0x00, sizeof(output));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, &P, &Q, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( ( mod + 7 ) / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_complete( &ctx ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) ((mod + 7) / 8));
+    TEST_ASSERT(mbedtls_rsa_complete(&ctx) == 0);
+    TEST_ASSERT(mbedtls_rsa_check_privkey(&ctx) == 0);
 
 
-    if( mbedtls_md_info_from_type( digest ) != NULL )
-        TEST_ASSERT( mbedtls_md( mbedtls_md_info_from_type( digest ), message_str->x, message_str->len, hash_result ) == 0 );
+    if (mbedtls_md_info_from_type(digest) != NULL) {
+        TEST_ASSERT(mbedtls_md(mbedtls_md_info_from_type(digest), message_str->x, message_str->len,
+                               hash_result) == 0);
+    }
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_sign( &ctx, &mbedtls_test_rnd_buffer_rand,
-                                         &info, MBEDTLS_RSA_PRIVATE, digest,
-                                         0, hash_result, output ) == result );
-    if( result == 0 )
-    {
+    TEST_ASSERT(mbedtls_rsa_pkcs1_sign(&ctx, &mbedtls_test_rnd_buffer_rand,
+                                       &info, MBEDTLS_RSA_PRIVATE, digest,
+                                       0, hash_result, output) == result);
+    if (result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                          ctx.len, result_str->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, result_str->x,
+                                        ctx.len, result_str->len) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &P );
-    mbedtls_mpi_free( &Q ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&P);
+    mbedtls_mpi_free(&Q); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void pkcs1_rsassa_v15_verify( int mod, char * input_N, char * input_E,
-                              int digest, int hash, data_t * message_str,
-                              char * salt, data_t * result_str, int result )
+void pkcs1_rsassa_v15_verify(int mod, char *input_N, char *input_E,
+                             int digest, int hash, data_t *message_str,
+                             char *salt, data_t *result_str, int result)
 {
     unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
     mbedtls_rsa_context ctx;
     mbedtls_mpi N, E;
     ((void) salt);
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V15, hash );
-    memset( hash_result, 0x00, sizeof( hash_result ) );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V15, hash);
+    memset(hash_result, 0x00, sizeof(hash_result));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, NULL, NULL, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( ( mod + 7 ) / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, NULL, NULL, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) ((mod + 7) / 8));
+    TEST_ASSERT(mbedtls_rsa_check_pubkey(&ctx) == 0);
 
 
-    if( mbedtls_md_info_from_type( digest ) != NULL )
-        TEST_ASSERT( mbedtls_md( mbedtls_md_info_from_type( digest ), message_str->x, message_str->len, hash_result ) == 0 );
+    if (mbedtls_md_info_from_type(digest) != NULL) {
+        TEST_ASSERT(mbedtls_md(mbedtls_md_info_from_type(digest), message_str->x, message_str->len,
+                               hash_result) == 0);
+    }
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_verify( &ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC, digest, 0, hash_result, result_str->x ) == result );
+    TEST_ASSERT(mbedtls_rsa_pkcs1_verify(&ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC, digest, 0,
+                                         hash_result, result_str->x) == result);
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_pkcs1_v21.function b/tests/suites/test_suite_pkcs1_v21.function
index c23a4ad..bf99df6 100644
--- a/tests/suites/test_suite_pkcs1_v21.function
+++ b/tests/suites/test_suite_pkcs1_v21.function
@@ -9,9 +9,9 @@
  */
 
 /* BEGIN_CASE */
-void pkcs1_rsaes_oaep_encrypt( int mod, data_t * input_N, data_t * input_E,
-                               int hash, data_t * message_str, data_t * rnd_buf,
-                               data_t * result_str, int result )
+void pkcs1_rsaes_oaep_encrypt(int mod, data_t *input_N, data_t *input_E,
+                              int hash, data_t *message_str, data_t *rnd_buf,
+                              data_t *result_str, int result)
 {
     unsigned char output[256];
     mbedtls_rsa_context ctx;
@@ -23,39 +23,39 @@
     info.buf = rnd_buf->x;
     info.length = rnd_buf->len;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V21, hash );
-    memset( output, 0x00, sizeof( output ) );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V21, hash);
+    memset(output, 0x00, sizeof(output));
 
-    TEST_ASSERT( mbedtls_mpi_read_binary( &N, input_N->x, input_N->len ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &E, input_E->x, input_E->len ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, NULL, NULL, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( ( mod + 7 ) / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_read_binary(&N, input_N->x, input_N->len) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&E, input_E->x, input_E->len) == 0);
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, NULL, NULL, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) ((mod + 7) / 8));
+    TEST_ASSERT(mbedtls_rsa_check_pubkey(&ctx) == 0);
 
-    if( message_str->len == 0 )
+    if (message_str->len == 0) {
         message_str->x = NULL;
-    TEST_ASSERT( mbedtls_rsa_pkcs1_encrypt( &ctx,
-                                            &mbedtls_test_rnd_buffer_rand,
-                                            &info, MBEDTLS_RSA_PUBLIC,
-                                            message_str->len, message_str->x,
-                                            output ) == result );
-    if( result == 0 )
-    {
-        ASSERT_COMPARE( output, ctx.len, result_str->x, result_str->len );
+    }
+    TEST_ASSERT(mbedtls_rsa_pkcs1_encrypt(&ctx,
+                                          &mbedtls_test_rnd_buffer_rand,
+                                          &info, MBEDTLS_RSA_PUBLIC,
+                                          message_str->len, message_str->x,
+                                          output) == result);
+    if (result == 0) {
+        ASSERT_COMPARE(output, ctx.len, result_str->x, result_str->len);
     }
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void pkcs1_rsaes_oaep_decrypt( int mod, data_t * input_P, data_t * input_Q,
-                               data_t * input_N, data_t * input_E, int hash,
-                               data_t * result_str, char * seed, data_t * message_str,
-                               int result )
+void pkcs1_rsaes_oaep_decrypt(int mod, data_t *input_P, data_t *input_Q,
+                              data_t *input_N, data_t *input_E, int hash,
+                              data_t *result_str, char *seed, data_t *message_str,
+                              int result)
 {
     unsigned char output[64];
     mbedtls_rsa_context ctx;
@@ -64,61 +64,57 @@
     mbedtls_mpi N, P, Q, E;
     ((void) seed);
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &P );
-    mbedtls_mpi_init( &Q ); mbedtls_mpi_init( &E );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E);
 
-    mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V21, hash );
+    mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V21, hash);
 
-    memset( output, 0x00, sizeof( output ) );
-    memset( &rnd_info, 0, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    memset(output, 0x00, sizeof(output));
+    memset(&rnd_info, 0, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    TEST_ASSERT( mbedtls_mpi_read_binary( &P, input_P->x, input_P->len ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &Q, input_Q->x, input_Q->len ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &N, input_N->x, input_N->len ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &E, input_E->x, input_E->len ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_read_binary(&P, input_P->x, input_P->len) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&Q, input_Q->x, input_Q->len) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&N, input_N->x, input_N->len) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&E, input_E->x, input_E->len) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, &P, &Q, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( ( mod + 7 ) / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_complete( &ctx ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) ((mod + 7) / 8));
+    TEST_ASSERT(mbedtls_rsa_complete(&ctx) == 0);
+    TEST_ASSERT(mbedtls_rsa_check_privkey(&ctx) == 0);
 
-    if( result_str->len == 0 )
-    {
-        TEST_ASSERT( mbedtls_rsa_pkcs1_decrypt( &ctx,
-                                                &mbedtls_test_rnd_pseudo_rand,
-                                                &rnd_info,
-                                                MBEDTLS_RSA_PRIVATE,
-                                                &output_len, message_str->x,
-                                                NULL, 0 ) == result );
-    }
-    else
-    {
-        TEST_ASSERT( mbedtls_rsa_pkcs1_decrypt( &ctx,
-                                                &mbedtls_test_rnd_pseudo_rand,
-                                                &rnd_info,
-                                                MBEDTLS_RSA_PRIVATE,
-                                                &output_len, message_str->x,
-                                                output,
-                                                sizeof( output ) ) == result );
-        if( result == 0 )
-        {
-            ASSERT_COMPARE( output, output_len, result_str->x, result_str->len );
+    if (result_str->len == 0) {
+        TEST_ASSERT(mbedtls_rsa_pkcs1_decrypt(&ctx,
+                                              &mbedtls_test_rnd_pseudo_rand,
+                                              &rnd_info,
+                                              MBEDTLS_RSA_PRIVATE,
+                                              &output_len, message_str->x,
+                                              NULL, 0) == result);
+    } else {
+        TEST_ASSERT(mbedtls_rsa_pkcs1_decrypt(&ctx,
+                                              &mbedtls_test_rnd_pseudo_rand,
+                                              &rnd_info,
+                                              MBEDTLS_RSA_PRIVATE,
+                                              &output_len, message_str->x,
+                                              output,
+                                              sizeof(output)) == result);
+        if (result == 0) {
+            ASSERT_COMPARE(output, output_len, result_str->x, result_str->len);
         }
     }
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &P );
-    mbedtls_mpi_free( &Q ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&P);
+    mbedtls_mpi_free(&Q); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void pkcs1_rsassa_pss_sign( int mod, data_t * input_P, data_t * input_Q,
-                            data_t * input_N, data_t * input_E, int digest,
-                            int hash, data_t * message_str, data_t * rnd_buf,
-                            data_t * result_str, int fixed_salt_length,
-                            int result )
+void pkcs1_rsassa_pss_sign(int mod, data_t *input_P, data_t *input_Q,
+                           data_t *input_N, data_t *input_E, int digest,
+                           int hash, data_t *message_str, data_t *rnd_buf,
+                           data_t *result_str, int fixed_salt_length,
+                           int result)
 {
     unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
     unsigned char output[512];
@@ -131,136 +127,135 @@
     info.buf = rnd_buf->x;
     info.length = rnd_buf->len;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &P );
-    mbedtls_mpi_init( &Q ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V21, hash );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V21, hash);
 
-    memset( hash_result, 0x00, sizeof( hash_result ) );
-    memset( output, 0x00, sizeof( output ) );
+    memset(hash_result, 0x00, sizeof(hash_result));
+    memset(output, 0x00, sizeof(output));
 
-    TEST_ASSERT( mbedtls_mpi_read_binary( &P, input_P->x, input_P->len ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &Q, input_Q->x, input_Q->len ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &N, input_N->x, input_N->len ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &E, input_E->x, input_E->len ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_read_binary(&P, input_P->x, input_P->len) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&Q, input_Q->x, input_Q->len) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&N, input_N->x, input_N->len) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&E, input_E->x, input_E->len) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, &P, &Q, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( ( mod + 7 ) / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_complete( &ctx ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) ((mod + 7) / 8));
+    TEST_ASSERT(mbedtls_rsa_complete(&ctx) == 0);
+    TEST_ASSERT(mbedtls_rsa_check_privkey(&ctx) == 0);
 
-    if( mbedtls_md_info_from_type( digest ) != NULL )
-        TEST_ASSERT( mbedtls_md( mbedtls_md_info_from_type( digest ), message_str->x, message_str->len, hash_result ) == 0 );
+    if (mbedtls_md_info_from_type(digest) != NULL) {
+        TEST_ASSERT(mbedtls_md(mbedtls_md_info_from_type(digest), message_str->x, message_str->len,
+                               hash_result) == 0);
+    }
 
-    if (fixed_salt_length == MBEDTLS_RSA_SALT_LEN_ANY)
-    {
-        TEST_ASSERT( mbedtls_rsa_pkcs1_sign( &ctx, &mbedtls_test_rnd_buffer_rand,
-                                             &info, MBEDTLS_RSA_PRIVATE, digest, 0,
-                                             hash_result, output ) == result );
-        if( result == 0 )
-        {
-            ASSERT_COMPARE( output, ctx.len, result_str->x, result_str->len );
+    if (fixed_salt_length == MBEDTLS_RSA_SALT_LEN_ANY) {
+        TEST_ASSERT(mbedtls_rsa_pkcs1_sign(&ctx, &mbedtls_test_rnd_buffer_rand,
+                                           &info, MBEDTLS_RSA_PRIVATE, digest, 0,
+                                           hash_result, output) == result);
+        if (result == 0) {
+            ASSERT_COMPARE(output, ctx.len, result_str->x, result_str->len);
         }
 
         info.buf = rnd_buf->x;
         info.length = rnd_buf->len;
     }
 
-    TEST_ASSERT( mbedtls_rsa_rsassa_pss_sign_ext( &ctx, &mbedtls_test_rnd_buffer_rand,
-                                                  &info, digest, 0, hash_result,
-                                                  fixed_salt_length, output ) == result );
-    if( result == 0 )
-    {
-        ASSERT_COMPARE( output, ctx.len, result_str->x, result_str->len );
+    TEST_ASSERT(mbedtls_rsa_rsassa_pss_sign_ext(&ctx, &mbedtls_test_rnd_buffer_rand,
+                                                &info, digest, 0, hash_result,
+                                                fixed_salt_length, output) == result);
+    if (result == 0) {
+        ASSERT_COMPARE(output, ctx.len, result_str->x, result_str->len);
     }
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &P );
-    mbedtls_mpi_free( &Q ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&P);
+    mbedtls_mpi_free(&Q); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void pkcs1_rsassa_pss_verify( int mod, data_t * input_N, data_t * input_E,
-                              int digest, int hash, data_t * message_str,
-                              char * salt, data_t * result_str, int result )
+void pkcs1_rsassa_pss_verify(int mod, data_t *input_N, data_t *input_E,
+                             int digest, int hash, data_t *message_str,
+                             char *salt, data_t *result_str, int result)
 {
     unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
     mbedtls_rsa_context ctx;
     mbedtls_mpi N, E;
     ((void) salt);
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V21, hash );
-    memset( hash_result, 0x00, sizeof( hash_result ) );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V21, hash);
+    memset(hash_result, 0x00, sizeof(hash_result));
 
-    TEST_ASSERT( mbedtls_mpi_read_binary( &N, input_N->x, input_N->len ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &E, input_E->x, input_E->len ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_read_binary(&N, input_N->x, input_N->len) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&E, input_E->x, input_E->len) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, NULL, NULL, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( ( mod + 7 ) / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, NULL, NULL, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) ((mod + 7) / 8));
+    TEST_ASSERT(mbedtls_rsa_check_pubkey(&ctx) == 0);
 
 
-    if( mbedtls_md_info_from_type( digest ) != NULL )
-        TEST_ASSERT( mbedtls_md( mbedtls_md_info_from_type( digest ), message_str->x, message_str->len, hash_result ) == 0 );
+    if (mbedtls_md_info_from_type(digest) != NULL) {
+        TEST_ASSERT(mbedtls_md(mbedtls_md_info_from_type(digest), message_str->x, message_str->len,
+                               hash_result) == 0);
+    }
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_verify( &ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC, digest, 0, hash_result, result_str->x ) == result );
+    TEST_ASSERT(mbedtls_rsa_pkcs1_verify(&ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC, digest, 0,
+                                         hash_result, result_str->x) == result);
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void pkcs1_rsassa_pss_verify_ext( int mod, data_t * input_N, data_t * input_E,
-                                  int msg_digest_id, int ctx_hash,
-                                  int mgf_hash, int salt_len,
-                                  data_t * message_str,
-                                  data_t * result_str, int result_simple,
-                                  int result_full )
+void pkcs1_rsassa_pss_verify_ext(int mod, data_t *input_N, data_t *input_E,
+                                 int msg_digest_id, int ctx_hash,
+                                 int mgf_hash, int salt_len,
+                                 data_t *message_str,
+                                 data_t *result_str, int result_simple,
+                                 int result_full)
 {
     unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
     mbedtls_rsa_context ctx;
     size_t hash_len;
     mbedtls_mpi N, E;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V21, ctx_hash );
-    memset( hash_result, 0x00, sizeof( hash_result ) );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V21, ctx_hash);
+    memset(hash_result, 0x00, sizeof(hash_result));
 
-    TEST_ASSERT( mbedtls_mpi_read_binary( &N, input_N->x, input_N->len ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &E, input_E->x, input_E->len ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_read_binary(&N, input_N->x, input_N->len) == 0);
+    TEST_ASSERT(mbedtls_mpi_read_binary(&E, input_E->x, input_E->len) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, NULL, NULL, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( ( mod + 7 ) / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, NULL, NULL, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) ((mod + 7) / 8));
+    TEST_ASSERT(mbedtls_rsa_check_pubkey(&ctx) == 0);
 
 
-    if( msg_digest_id != MBEDTLS_MD_NONE )
-    {
-        TEST_ASSERT( mbedtls_md( mbedtls_md_info_from_type( msg_digest_id ),
-                     message_str->x, message_str->len, hash_result ) == 0 );
+    if (msg_digest_id != MBEDTLS_MD_NONE) {
+        TEST_ASSERT(mbedtls_md(mbedtls_md_info_from_type(msg_digest_id),
+                               message_str->x, message_str->len, hash_result) == 0);
         hash_len = 0;
-    }
-    else
-    {
-        memcpy( hash_result, message_str->x, message_str->len );
+    } else {
+        memcpy(hash_result, message_str->x, message_str->len);
         hash_len = message_str->len;
     }
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_verify( &ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC,
-                                   msg_digest_id, hash_len, hash_result,
-                                   result_str->x ) == result_simple );
+    TEST_ASSERT(mbedtls_rsa_pkcs1_verify(&ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC,
+                                         msg_digest_id, hash_len, hash_result,
+                                         result_str->x) == result_simple);
 
-    TEST_ASSERT( mbedtls_rsa_rsassa_pss_verify_ext( &ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC,
-                                        msg_digest_id, hash_len, hash_result,
-                                        mgf_hash, salt_len,
-                                        result_str->x ) == result_full );
+    TEST_ASSERT(mbedtls_rsa_rsassa_pss_verify_ext(&ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC,
+                                                  msg_digest_id, hash_len, hash_result,
+                                                  mgf_hash, salt_len,
+                                                  result_str->x) == result_full);
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_pkcs5.function b/tests/suites/test_suite_pkcs5.function
index 0b0c937..5d10da4 100644
--- a/tests/suites/test_suite_pkcs5.function
+++ b/tests/suites/test_suite_pkcs5.function
@@ -8,33 +8,33 @@
  */
 
 /* BEGIN_CASE */
-void pbkdf2_hmac( int hash, data_t * pw_str, data_t * salt_str,
-                  int it_cnt, int key_len, data_t * result_key_string )
+void pbkdf2_hmac(int hash, data_t *pw_str, data_t *salt_str,
+                 int it_cnt, int key_len, data_t *result_key_string)
 {
     mbedtls_md_context_t ctx;
     const mbedtls_md_info_t *info;
 
     unsigned char key[100];
 
-    mbedtls_md_init( &ctx );
+    mbedtls_md_init(&ctx);
 
-    info = mbedtls_md_info_from_type( hash );
-    TEST_ASSERT( info != NULL );
-    TEST_ASSERT( mbedtls_md_setup( &ctx, info, 1 ) == 0 );
-    TEST_ASSERT( mbedtls_pkcs5_pbkdf2_hmac( &ctx, pw_str->x, pw_str->len, salt_str->x, salt_str->len,
-                                     it_cnt, key_len, key ) == 0 );
+    info = mbedtls_md_info_from_type(hash);
+    TEST_ASSERT(info != NULL);
+    TEST_ASSERT(mbedtls_md_setup(&ctx, info, 1) == 0);
+    TEST_ASSERT(mbedtls_pkcs5_pbkdf2_hmac(&ctx, pw_str->x, pw_str->len, salt_str->x, salt_str->len,
+                                          it_cnt, key_len, key) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( key, result_key_string->x,
-                                      key_len, result_key_string->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(key, result_key_string->x,
+                                    key_len, result_key_string->len) == 0);
 
 exit:
-    mbedtls_md_free( &ctx );
+    mbedtls_md_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ASN1_PARSE_C */
-void mbedtls_pkcs5_pbes2( int params_tag, data_t *params_hex, data_t *pw,
-                  data_t *data, int ref_ret, data_t *ref_out )
+void mbedtls_pkcs5_pbes2(int params_tag, data_t *params_hex, data_t *pw,
+                         data_t *data, int ref_ret, data_t *ref_out)
 {
     int my_ret;
     mbedtls_asn1_buf params;
@@ -44,23 +44,24 @@
     params.p = params_hex->x;
     params.len = params_hex->len;
 
-    my_out = mbedtls_test_zero_alloc( ref_out->len );
+    my_out = mbedtls_test_zero_alloc(ref_out->len);
 
-    my_ret = mbedtls_pkcs5_pbes2( &params, MBEDTLS_PKCS5_DECRYPT,
-                          pw->x, pw->len, data->x, data->len, my_out );
-    TEST_ASSERT( my_ret == ref_ret );
+    my_ret = mbedtls_pkcs5_pbes2(&params, MBEDTLS_PKCS5_DECRYPT,
+                                 pw->x, pw->len, data->x, data->len, my_out);
+    TEST_ASSERT(my_ret == ref_ret);
 
-    if( ref_ret == 0 )
-        TEST_ASSERT( memcmp( my_out, ref_out->x, ref_out->len ) == 0 );
+    if (ref_ret == 0) {
+        TEST_ASSERT(memcmp(my_out, ref_out->x, ref_out->len) == 0);
+    }
 
 exit:
-    mbedtls_free( my_out );
+    mbedtls_free(my_out);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void pkcs5_selftest(  )
+void pkcs5_selftest()
 {
-    TEST_ASSERT( mbedtls_pkcs5_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_pkcs5_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_pkparse.function b/tests/suites/test_suite_pkparse.function
index 4650d33..f2f5e97 100644
--- a/tests/suites/test_suite_pkparse.function
+++ b/tests/suites/test_suite_pkparse.function
@@ -10,119 +10,116 @@
  */
 
 /* BEGIN_CASE depends_on:MBEDTLS_RSA_C:MBEDTLS_FS_IO */
-void pk_parse_keyfile_rsa( char * key_file, char * password, int result )
+void pk_parse_keyfile_rsa(char *key_file, char *password, int result)
 {
     mbedtls_pk_context ctx;
     int res;
     char *pwd = password;
 
-    mbedtls_pk_init( &ctx );
+    mbedtls_pk_init(&ctx);
 
-    if( strcmp( pwd, "NULL" ) == 0 )
+    if (strcmp(pwd, "NULL") == 0) {
         pwd = NULL;
+    }
 
-    res = mbedtls_pk_parse_keyfile( &ctx, key_file, pwd );
+    res = mbedtls_pk_parse_keyfile(&ctx, key_file, pwd);
 
-    TEST_ASSERT( res == result );
+    TEST_ASSERT(res == result);
 
-    if( res == 0 )
-    {
+    if (res == 0) {
         mbedtls_rsa_context *rsa;
-        TEST_ASSERT( mbedtls_pk_can_do( &ctx, MBEDTLS_PK_RSA ) );
-        rsa = mbedtls_pk_rsa( ctx );
-        TEST_ASSERT( mbedtls_rsa_check_privkey( rsa ) == 0 );
+        TEST_ASSERT(mbedtls_pk_can_do(&ctx, MBEDTLS_PK_RSA));
+        rsa = mbedtls_pk_rsa(ctx);
+        TEST_ASSERT(mbedtls_rsa_check_privkey(rsa) == 0);
     }
 
 exit:
-    mbedtls_pk_free( &ctx );
+    mbedtls_pk_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_RSA_C:MBEDTLS_FS_IO */
-void pk_parse_public_keyfile_rsa( char * key_file, int result )
+void pk_parse_public_keyfile_rsa(char *key_file, int result)
 {
     mbedtls_pk_context ctx;
     int res;
 
-    mbedtls_pk_init( &ctx );
+    mbedtls_pk_init(&ctx);
 
-    res = mbedtls_pk_parse_public_keyfile( &ctx, key_file );
+    res = mbedtls_pk_parse_public_keyfile(&ctx, key_file);
 
-    TEST_ASSERT( res == result );
+    TEST_ASSERT(res == result);
 
-    if( res == 0 )
-    {
+    if (res == 0) {
         mbedtls_rsa_context *rsa;
-        TEST_ASSERT( mbedtls_pk_can_do( &ctx, MBEDTLS_PK_RSA ) );
-        rsa = mbedtls_pk_rsa( ctx );
-        TEST_ASSERT( mbedtls_rsa_check_pubkey( rsa ) == 0 );
+        TEST_ASSERT(mbedtls_pk_can_do(&ctx, MBEDTLS_PK_RSA));
+        rsa = mbedtls_pk_rsa(ctx);
+        TEST_ASSERT(mbedtls_rsa_check_pubkey(rsa) == 0);
     }
 
 exit:
-    mbedtls_pk_free( &ctx );
+    mbedtls_pk_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_ECP_C */
-void pk_parse_public_keyfile_ec( char * key_file, int result )
+void pk_parse_public_keyfile_ec(char *key_file, int result)
 {
     mbedtls_pk_context ctx;
     int res;
 
-    mbedtls_pk_init( &ctx );
+    mbedtls_pk_init(&ctx);
 
-    res = mbedtls_pk_parse_public_keyfile( &ctx, key_file );
+    res = mbedtls_pk_parse_public_keyfile(&ctx, key_file);
 
-    TEST_ASSERT( res == result );
+    TEST_ASSERT(res == result);
 
-    if( res == 0 )
-    {
+    if (res == 0) {
         mbedtls_ecp_keypair *eckey;
-        TEST_ASSERT( mbedtls_pk_can_do( &ctx, MBEDTLS_PK_ECKEY ) );
-        eckey = mbedtls_pk_ec( ctx );
-        TEST_ASSERT( mbedtls_ecp_check_pubkey( &eckey->grp, &eckey->Q ) == 0 );
+        TEST_ASSERT(mbedtls_pk_can_do(&ctx, MBEDTLS_PK_ECKEY));
+        eckey = mbedtls_pk_ec(ctx);
+        TEST_ASSERT(mbedtls_ecp_check_pubkey(&eckey->grp, &eckey->Q) == 0);
     }
 
 exit:
-    mbedtls_pk_free( &ctx );
+    mbedtls_pk_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_ECP_C */
-void pk_parse_keyfile_ec( char * key_file, char * password, int result )
+void pk_parse_keyfile_ec(char *key_file, char *password, int result)
 {
     mbedtls_pk_context ctx;
     int res;
 
-    mbedtls_pk_init( &ctx );
+    mbedtls_pk_init(&ctx);
 
-    res = mbedtls_pk_parse_keyfile( &ctx, key_file, password );
+    res = mbedtls_pk_parse_keyfile(&ctx, key_file, password);
 
-    TEST_ASSERT( res == result );
+    TEST_ASSERT(res == result);
 
-    if( res == 0 )
-    {
+    if (res == 0) {
         mbedtls_ecp_keypair *eckey;
-        TEST_ASSERT( mbedtls_pk_can_do( &ctx, MBEDTLS_PK_ECKEY ) );
-        eckey = mbedtls_pk_ec( ctx );
-        TEST_ASSERT( mbedtls_ecp_check_privkey( &eckey->grp, &eckey->d ) == 0 );
+        TEST_ASSERT(mbedtls_pk_can_do(&ctx, MBEDTLS_PK_ECKEY));
+        eckey = mbedtls_pk_ec(ctx);
+        TEST_ASSERT(mbedtls_ecp_check_privkey(&eckey->grp, &eckey->d) == 0);
     }
 
 exit:
-    mbedtls_pk_free( &ctx );
+    mbedtls_pk_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void pk_parse_key( data_t * buf, int result )
+void pk_parse_key(data_t *buf, int result)
 {
     mbedtls_pk_context pk;
 
-    mbedtls_pk_init( &pk );
+    mbedtls_pk_init(&pk);
 
-    TEST_ASSERT( mbedtls_pk_parse_key( &pk, buf->x, buf->len, NULL, 0 ) == result );
+    TEST_ASSERT(mbedtls_pk_parse_key(&pk, buf->x, buf->len, NULL, 0) == result);
 
 exit:
-    mbedtls_pk_free( &pk );
+    mbedtls_pk_free(&pk);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_pkwrite.function b/tests/suites/test_suite_pkwrite.function
index 2bad4ed..a49846b 100644
--- a/tests/suites/test_suite_pkwrite.function
+++ b/tests/suites/test_suite_pkwrite.function
@@ -10,7 +10,7 @@
  */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PEM_WRITE_C */
-void pk_write_pubkey_check( char * key_file )
+void pk_write_pubkey_check(char *key_file)
 {
     mbedtls_pk_context key;
     unsigned char buf[5000];
@@ -19,38 +19,37 @@
     FILE *f;
     size_t ilen, pem_len, buf_index;
 
-    memset( buf, 0, sizeof( buf ) );
-    memset( check_buf, 0, sizeof( check_buf ) );
+    memset(buf, 0, sizeof(buf));
+    memset(check_buf, 0, sizeof(check_buf));
 
-    mbedtls_pk_init( &key );
-    TEST_ASSERT( mbedtls_pk_parse_public_keyfile( &key, key_file ) == 0 );
+    mbedtls_pk_init(&key);
+    TEST_ASSERT(mbedtls_pk_parse_public_keyfile(&key, key_file) == 0);
 
-    ret = mbedtls_pk_write_pubkey_pem( &key, buf, sizeof( buf ));
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_pk_write_pubkey_pem(&key, buf, sizeof(buf));
+    TEST_ASSERT(ret == 0);
 
-    pem_len = strlen( (char *) buf );
+    pem_len = strlen((char *) buf);
 
     // check that the rest of the buffer remains clear
-    for( buf_index = pem_len; buf_index < sizeof( buf ); ++buf_index )
-    {
-        TEST_ASSERT( buf[buf_index] == 0 );
+    for (buf_index = pem_len; buf_index < sizeof(buf); ++buf_index) {
+        TEST_ASSERT(buf[buf_index] == 0);
     }
 
-    f = fopen( key_file, "r" );
-    TEST_ASSERT( f != NULL );
-    ilen = fread( check_buf, 1, sizeof( check_buf ), f );
-    fclose( f );
+    f = fopen(key_file, "r");
+    TEST_ASSERT(f != NULL);
+    ilen = fread(check_buf, 1, sizeof(check_buf), f);
+    fclose(f);
 
-    TEST_ASSERT( ilen == pem_len );
-    TEST_ASSERT( memcmp( (char *) buf, (char *) check_buf, ilen ) == 0 );
+    TEST_ASSERT(ilen == pem_len);
+    TEST_ASSERT(memcmp((char *) buf, (char *) check_buf, ilen) == 0);
 
 exit:
-    mbedtls_pk_free( &key );
+    mbedtls_pk_free(&key);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PEM_WRITE_C */
-void pk_write_key_check( char * key_file )
+void pk_write_key_check(char *key_file)
 {
     mbedtls_pk_context key;
     unsigned char buf[5000];
@@ -59,32 +58,31 @@
     FILE *f;
     size_t ilen, pem_len, buf_index;
 
-    memset( buf, 0, sizeof( buf ) );
-    memset( check_buf, 0, sizeof( check_buf ) );
+    memset(buf, 0, sizeof(buf));
+    memset(check_buf, 0, sizeof(check_buf));
 
-    mbedtls_pk_init( &key );
-    TEST_ASSERT( mbedtls_pk_parse_keyfile( &key, key_file, NULL ) == 0 );
+    mbedtls_pk_init(&key);
+    TEST_ASSERT(mbedtls_pk_parse_keyfile(&key, key_file, NULL) == 0);
 
-    ret = mbedtls_pk_write_key_pem( &key, buf, sizeof( buf ));
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_pk_write_key_pem(&key, buf, sizeof(buf));
+    TEST_ASSERT(ret == 0);
 
-    pem_len = strlen( (char *) buf );
+    pem_len = strlen((char *) buf);
 
     // check that the rest of the buffer remains clear
-    for( buf_index = pem_len; buf_index < sizeof( buf ); ++buf_index )
-    {
-        TEST_ASSERT( buf[buf_index] == 0 );
+    for (buf_index = pem_len; buf_index < sizeof(buf); ++buf_index) {
+        TEST_ASSERT(buf[buf_index] == 0);
     }
 
-    f = fopen( key_file, "r" );
-    TEST_ASSERT( f != NULL );
-    ilen = fread( check_buf, 1, sizeof( check_buf ), f );
-    fclose( f );
+    f = fopen(key_file, "r");
+    TEST_ASSERT(f != NULL);
+    ilen = fread(check_buf, 1, sizeof(check_buf), f);
+    fclose(f);
 
-    TEST_ASSERT( ilen == strlen( (char *) buf ) );
-    TEST_ASSERT( memcmp( (char *) buf, (char *) check_buf, ilen ) == 0 );
+    TEST_ASSERT(ilen == strlen((char *) buf));
+    TEST_ASSERT(memcmp((char *) buf, (char *) check_buf, ilen) == 0);
 
 exit:
-    mbedtls_pk_free( &key );
+    mbedtls_pk_free(&key);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_poly1305.function b/tests/suites/test_suite_poly1305.function
index 4b8995b..1a0e388 100644
--- a/tests/suites/test_suite_poly1305.function
+++ b/tests/suites/test_suite_poly1305.function
@@ -9,35 +9,35 @@
  */
 
 /* BEGIN_CASE */
-void mbedtls_poly1305( data_t *key, data_t *expected_mac, data_t *src_str )
+void mbedtls_poly1305(data_t *key, data_t *expected_mac, data_t *src_str)
 {
     unsigned char mac[16]; /* size set by the standard */
     mbedtls_poly1305_context ctx;
 
-    memset( mac, 0x00, sizeof( mac ) );
+    memset(mac, 0x00, sizeof(mac));
 
     /*
      * Test the integrated API
      */
-    TEST_ASSERT( mbedtls_poly1305_mac( key->x, src_str->x,
-                                       src_str->len, mac ) == 0 );
+    TEST_ASSERT(mbedtls_poly1305_mac(key->x, src_str->x,
+                                     src_str->len, mac) == 0);
 
-    ASSERT_COMPARE( mac, expected_mac->len,
-                    expected_mac->x, expected_mac->len );
+    ASSERT_COMPARE(mac, expected_mac->len,
+                   expected_mac->x, expected_mac->len);
 
     /*
      * Test the streaming API
      */
-    mbedtls_poly1305_init( &ctx );
+    mbedtls_poly1305_init(&ctx);
 
-    TEST_ASSERT( mbedtls_poly1305_starts( &ctx, key->x ) == 0 );
+    TEST_ASSERT(mbedtls_poly1305_starts(&ctx, key->x) == 0);
 
-    TEST_ASSERT( mbedtls_poly1305_update( &ctx, src_str->x, src_str->len ) == 0 );
+    TEST_ASSERT(mbedtls_poly1305_update(&ctx, src_str->x, src_str->len) == 0);
 
-    TEST_ASSERT( mbedtls_poly1305_finish( &ctx, mac ) == 0 );
+    TEST_ASSERT(mbedtls_poly1305_finish(&ctx, mac) == 0);
 
-    ASSERT_COMPARE( mac, expected_mac->len,
-                    expected_mac->x, expected_mac->len );
+    ASSERT_COMPARE(mac, expected_mac->len,
+                   expected_mac->x, expected_mac->len);
 
     /*
      * Test the streaming API again, piecewise
@@ -45,37 +45,35 @@
 
     /* Don't free/init the context, in order to test that starts() does the
      * right thing. */
-    if( src_str->len >= 1 )
-    {
-        TEST_ASSERT( mbedtls_poly1305_starts( &ctx, key->x ) == 0 );
+    if (src_str->len >= 1) {
+        TEST_ASSERT(mbedtls_poly1305_starts(&ctx, key->x) == 0);
 
-        TEST_ASSERT( mbedtls_poly1305_update( &ctx, src_str->x, 1 ) == 0 );
-        TEST_ASSERT( mbedtls_poly1305_update( &ctx, src_str->x + 1, src_str->len - 1 ) == 0 );
+        TEST_ASSERT(mbedtls_poly1305_update(&ctx, src_str->x, 1) == 0);
+        TEST_ASSERT(mbedtls_poly1305_update(&ctx, src_str->x + 1, src_str->len - 1) == 0);
 
-        TEST_ASSERT( mbedtls_poly1305_finish( &ctx, mac ) == 0 );
+        TEST_ASSERT(mbedtls_poly1305_finish(&ctx, mac) == 0);
 
-        ASSERT_COMPARE( mac, expected_mac->len,
-                        expected_mac->x, expected_mac->len );
+        ASSERT_COMPARE(mac, expected_mac->len,
+                       expected_mac->x, expected_mac->len);
     }
 
     /*
      * Again with more pieces
      */
-    if( src_str->len >= 2 )
-    {
-        TEST_ASSERT( mbedtls_poly1305_starts( &ctx, key->x ) == 0 );
+    if (src_str->len >= 2) {
+        TEST_ASSERT(mbedtls_poly1305_starts(&ctx, key->x) == 0);
 
-        TEST_ASSERT( mbedtls_poly1305_update( &ctx, src_str->x, 1 ) == 0 );
-        TEST_ASSERT( mbedtls_poly1305_update( &ctx, src_str->x + 1, 1 ) == 0 );
-        TEST_ASSERT( mbedtls_poly1305_update( &ctx, src_str->x + 2, src_str->len - 2 ) == 0 );
+        TEST_ASSERT(mbedtls_poly1305_update(&ctx, src_str->x, 1) == 0);
+        TEST_ASSERT(mbedtls_poly1305_update(&ctx, src_str->x + 1, 1) == 0);
+        TEST_ASSERT(mbedtls_poly1305_update(&ctx, src_str->x + 2, src_str->len - 2) == 0);
 
-        TEST_ASSERT( mbedtls_poly1305_finish( &ctx, mac ) == 0 );
+        TEST_ASSERT(mbedtls_poly1305_finish(&ctx, mac) == 0);
 
-        ASSERT_COMPARE( mac, expected_mac->len,
-                        expected_mac->x, expected_mac->len );
+        ASSERT_COMPARE(mac, expected_mac->len,
+                       expected_mac->x, expected_mac->len);
     }
 
-    mbedtls_poly1305_free( &ctx );
+    mbedtls_poly1305_free(&ctx);
 }
 /* END_CASE */
 
@@ -85,33 +83,33 @@
     unsigned char src[1];
     unsigned char key[32];
     unsigned char mac[16];
-    size_t src_len = sizeof( src );
+    size_t src_len = sizeof(src);
     mbedtls_poly1305_context ctx;
 
-    TEST_INVALID_PARAM( mbedtls_poly1305_init( NULL ) );
-    TEST_VALID_PARAM( mbedtls_poly1305_free( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_poly1305_init(NULL));
+    TEST_VALID_PARAM(mbedtls_poly1305_free(NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                 mbedtls_poly1305_starts( NULL, key ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                 mbedtls_poly1305_starts( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_poly1305_starts(NULL, key));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_poly1305_starts(&ctx, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                 mbedtls_poly1305_update( NULL, src, 0 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                 mbedtls_poly1305_update( &ctx, NULL, src_len ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_poly1305_update(NULL, src, 0));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_poly1305_update(&ctx, NULL, src_len));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                 mbedtls_poly1305_finish( NULL, mac ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                 mbedtls_poly1305_finish( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_poly1305_finish(NULL, mac));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_poly1305_finish(&ctx, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                 mbedtls_poly1305_mac( NULL, src, 0, mac ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                 mbedtls_poly1305_mac( key, NULL, src_len, mac ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
-                 mbedtls_poly1305_mac( key, src, 0, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_poly1305_mac(NULL, src, 0, mac));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_poly1305_mac(key, NULL, src_len, mac));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA,
+                           mbedtls_poly1305_mac(key, src, 0, NULL));
 
 exit:
     return;
@@ -121,6 +119,6 @@
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
 void poly1305_selftest()
 {
-    TEST_ASSERT( mbedtls_poly1305_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_poly1305_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index 41183fd..214096c 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -22,8 +22,8 @@
 
 /* Assert that an operation is (not) active.
  * This serves as a proxy for checking if the operation is aborted. */
-#define ASSERT_OPERATION_IS_ACTIVE(   operation ) TEST_ASSERT( operation.id != 0 )
-#define ASSERT_OPERATION_IS_INACTIVE( operation ) TEST_ASSERT( operation.id == 0 )
+#define ASSERT_OPERATION_IS_ACTIVE(operation) TEST_ASSERT(operation.id != 0)
+#define ASSERT_OPERATION_IS_INACTIVE(operation) TEST_ASSERT(operation.id == 0)
 
 /** An invalid export length that will never be set by psa_export_key(). */
 static const size_t INVALID_EXPORT_LENGTH = ~0U;
@@ -39,50 +39,54 @@
  * \return          1 if the buffer is all-bits-zero.
  * \return          0 if there is at least one nonzero byte.
  */
-static int mem_is_char( void *buffer, unsigned char c, size_t size )
+static int mem_is_char(void *buffer, unsigned char c, size_t size)
 {
     size_t i;
-    for( i = 0; i < size; i++ )
-    {
-        if( ( (unsigned char *) buffer )[i] != c )
-            return( 0 );
+    for (i = 0; i < size; i++) {
+        if (((unsigned char *) buffer)[i] != c) {
+            return 0;
+        }
     }
-    return( 1 );
+    return 1;
 }
 #if defined(MBEDTLS_ASN1_WRITE_C)
 /* Write the ASN.1 INTEGER with the value 2^(bits-1)+x backwards from *p. */
-static int asn1_write_10x( unsigned char **p,
-                           unsigned char *start,
-                           size_t bits,
-                           unsigned char x )
+static int asn1_write_10x(unsigned char **p,
+                          unsigned char *start,
+                          size_t bits,
+                          unsigned char x)
 {
     int ret;
     int len = bits / 8 + 1;
-    if( bits == 0 )
-        return( MBEDTLS_ERR_ASN1_INVALID_DATA );
-    if( bits <= 8 && x >= 1 << ( bits - 1 ) )
-        return( MBEDTLS_ERR_ASN1_INVALID_DATA );
-    if( *p < start || *p - start < (ptrdiff_t) len )
-        return( MBEDTLS_ERR_ASN1_BUF_TOO_SMALL );
+    if (bits == 0) {
+        return MBEDTLS_ERR_ASN1_INVALID_DATA;
+    }
+    if (bits <= 8 && x >= 1 << (bits - 1)) {
+        return MBEDTLS_ERR_ASN1_INVALID_DATA;
+    }
+    if (*p < start || *p - start < (ptrdiff_t) len) {
+        return MBEDTLS_ERR_ASN1_BUF_TOO_SMALL;
+    }
     *p -= len;
-    ( *p )[len-1] = x;
-    if( bits % 8 == 0 )
-        ( *p )[1] |= 1;
-    else
-        ( *p )[0] |= 1 << ( bits % 8 );
-    MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) );
-    MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start,
-                                                       MBEDTLS_ASN1_INTEGER ) );
-    return( len );
+    (*p)[len-1] = x;
+    if (bits % 8 == 0) {
+        (*p)[1] |= 1;
+    } else {
+        (*p)[0] |= 1 << (bits % 8);
+    }
+    MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(p, start, len));
+    MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_tag(p, start,
+                                                     MBEDTLS_ASN1_INTEGER));
+    return len;
 }
 
-static int construct_fake_rsa_key( unsigned char *buffer,
-                                   size_t buffer_size,
-                                   unsigned char **p,
-                                   size_t bits,
-                                   int keypair )
+static int construct_fake_rsa_key(unsigned char *buffer,
+                                  size_t buffer_size,
+                                  unsigned char **p,
+                                  size_t bits,
+                                  int keypair)
 {
-    size_t half_bits = ( bits + 1 ) / 2;
+    size_t half_bits = (bits + 1) / 2;
     int ret;
     int len = 0;
     /* Construct something that looks like a DER encoding of
@@ -103,134 +107,132 @@
      * version, modulus and publicExponent.
      */
     *p = buffer + buffer_size;
-    if( keypair )
-    {
-        MBEDTLS_ASN1_CHK_ADD( len, /* pq */
-                              asn1_write_10x( p, buffer, half_bits, 1 ) );
-        MBEDTLS_ASN1_CHK_ADD( len, /* dq */
-                              asn1_write_10x( p, buffer, half_bits, 1 ) );
-        MBEDTLS_ASN1_CHK_ADD( len, /* dp */
-                              asn1_write_10x( p, buffer, half_bits, 1 ) );
-        MBEDTLS_ASN1_CHK_ADD( len, /* q */
-                              asn1_write_10x( p, buffer, half_bits, 1 ) );
-        MBEDTLS_ASN1_CHK_ADD( len, /* p != q to pass mbedtls sanity checks */
-                              asn1_write_10x( p, buffer, half_bits, 3 ) );
-        MBEDTLS_ASN1_CHK_ADD( len, /* d */
-                              asn1_write_10x( p, buffer, bits, 1 ) );
+    if (keypair) {
+        MBEDTLS_ASN1_CHK_ADD(len,  /* pq */
+                             asn1_write_10x(p, buffer, half_bits, 1));
+        MBEDTLS_ASN1_CHK_ADD(len,  /* dq */
+                             asn1_write_10x(p, buffer, half_bits, 1));
+        MBEDTLS_ASN1_CHK_ADD(len,  /* dp */
+                             asn1_write_10x(p, buffer, half_bits, 1));
+        MBEDTLS_ASN1_CHK_ADD(len,  /* q */
+                             asn1_write_10x(p, buffer, half_bits, 1));
+        MBEDTLS_ASN1_CHK_ADD(len,  /* p != q to pass mbedtls sanity checks */
+                             asn1_write_10x(p, buffer, half_bits, 3));
+        MBEDTLS_ASN1_CHK_ADD(len,  /* d */
+                             asn1_write_10x(p, buffer, bits, 1));
     }
-    MBEDTLS_ASN1_CHK_ADD( len, /* e = 65537 */
-                          asn1_write_10x( p, buffer, 17, 1 ) );
-    MBEDTLS_ASN1_CHK_ADD( len, /* n */
-                          asn1_write_10x( p, buffer, bits, 1 ) );
-    if( keypair )
-        MBEDTLS_ASN1_CHK_ADD( len, /* version = 0 */
-                              mbedtls_asn1_write_int( p, buffer, 0 ) );
-    MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, buffer, len ) );
+    MBEDTLS_ASN1_CHK_ADD(len,  /* e = 65537 */
+                         asn1_write_10x(p, buffer, 17, 1));
+    MBEDTLS_ASN1_CHK_ADD(len,  /* n */
+                         asn1_write_10x(p, buffer, bits, 1));
+    if (keypair) {
+        MBEDTLS_ASN1_CHK_ADD(len,  /* version = 0 */
+                             mbedtls_asn1_write_int(p, buffer, 0));
+    }
+    MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(p, buffer, len));
     {
         const unsigned char tag =
             MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE;
-        MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, buffer, tag ) );
+        MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_tag(p, buffer, tag));
     }
-    return( len );
+    return len;
 }
 #endif /* MBEDTLS_ASN1_WRITE_C */
 
-int exercise_mac_setup( psa_key_type_t key_type,
-                        const unsigned char *key_bytes,
-                        size_t key_length,
-                        psa_algorithm_t alg,
-                        psa_mac_operation_t *operation,
-                        psa_status_t *status )
+int exercise_mac_setup(psa_key_type_t key_type,
+                       const unsigned char *key_bytes,
+                       size_t key_length,
+                       psa_algorithm_t alg,
+                       psa_mac_operation_t *operation,
+                       psa_status_t *status)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
-    PSA_ASSERT( psa_import_key( &attributes, key_bytes, key_length, &key ) );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
+    PSA_ASSERT(psa_import_key(&attributes, key_bytes, key_length, &key));
 
-    *status = psa_mac_sign_setup( operation, key, alg );
+    *status = psa_mac_sign_setup(operation, key, alg);
     /* Whether setup succeeded or failed, abort must succeed. */
-    PSA_ASSERT( psa_mac_abort( operation ) );
+    PSA_ASSERT(psa_mac_abort(operation));
     /* If setup failed, reproduce the failure, so that the caller can
      * test the resulting state of the operation object. */
-    if( *status != PSA_SUCCESS )
-    {
-        TEST_EQUAL( psa_mac_sign_setup( operation, key, alg ), *status );
+    if (*status != PSA_SUCCESS) {
+        TEST_EQUAL(psa_mac_sign_setup(operation, key, alg), *status);
     }
 
-    psa_destroy_key( key );
-    return( 1 );
+    psa_destroy_key(key);
+    return 1;
 
 exit:
-    psa_destroy_key( key );
-    return( 0 );
+    psa_destroy_key(key);
+    return 0;
 }
 
-int exercise_cipher_setup( psa_key_type_t key_type,
-                           const unsigned char *key_bytes,
-                           size_t key_length,
-                           psa_algorithm_t alg,
-                           psa_cipher_operation_t *operation,
-                           psa_status_t *status )
+int exercise_cipher_setup(psa_key_type_t key_type,
+                          const unsigned char *key_bytes,
+                          size_t key_length,
+                          psa_algorithm_t alg,
+                          psa_cipher_operation_t *operation,
+                          psa_status_t *status)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
-    PSA_ASSERT( psa_import_key( &attributes, key_bytes, key_length, &key ) );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
+    PSA_ASSERT(psa_import_key(&attributes, key_bytes, key_length, &key));
 
-    *status = psa_cipher_encrypt_setup( operation, key, alg );
+    *status = psa_cipher_encrypt_setup(operation, key, alg);
     /* Whether setup succeeded or failed, abort must succeed. */
-    PSA_ASSERT( psa_cipher_abort( operation ) );
+    PSA_ASSERT(psa_cipher_abort(operation));
     /* If setup failed, reproduce the failure, so that the caller can
      * test the resulting state of the operation object. */
-    if( *status != PSA_SUCCESS )
-    {
-        TEST_EQUAL( psa_cipher_encrypt_setup( operation, key, alg ),
-                    *status );
+    if (*status != PSA_SUCCESS) {
+        TEST_EQUAL(psa_cipher_encrypt_setup(operation, key, alg),
+                   *status);
     }
 
-    psa_destroy_key( key );
-    return( 1 );
+    psa_destroy_key(key);
+    return 1;
 
 exit:
-    psa_destroy_key( key );
-    return( 0 );
+    psa_destroy_key(key);
+    return 0;
 }
 
-static int test_operations_on_invalid_key( mbedtls_svc_key_id_t key )
+static int test_operations_on_invalid_key(mbedtls_svc_key_id_t key)
 {
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    mbedtls_svc_key_id_t key_id = mbedtls_svc_key_id_make( 1, 0x6964 );
+    mbedtls_svc_key_id_t key_id = mbedtls_svc_key_id_make(1, 0x6964);
     uint8_t buffer[1];
     size_t length;
     int ok = 0;
 
-    psa_set_key_id( &attributes, key_id );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
-    psa_set_key_algorithm( &attributes, PSA_ALG_CTR );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_AES );
-    TEST_EQUAL( psa_get_key_attributes( key, &attributes ),
-                PSA_ERROR_INVALID_HANDLE );
+    psa_set_key_id(&attributes, key_id);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT);
+    psa_set_key_algorithm(&attributes, PSA_ALG_CTR);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_AES);
+    TEST_EQUAL(psa_get_key_attributes(key, &attributes),
+               PSA_ERROR_INVALID_HANDLE);
     TEST_EQUAL(
-        MBEDTLS_SVC_KEY_ID_GET_KEY_ID( psa_get_key_id( &attributes ) ), 0 );
+        MBEDTLS_SVC_KEY_ID_GET_KEY_ID(psa_get_key_id(&attributes)), 0);
     TEST_EQUAL(
-        MBEDTLS_SVC_KEY_ID_GET_OWNER_ID( psa_get_key_id( &attributes ) ), 0 );
-    TEST_EQUAL( psa_get_key_lifetime( &attributes ), 0 );
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes ), 0 );
-    TEST_EQUAL( psa_get_key_algorithm( &attributes ), 0 );
-    TEST_EQUAL( psa_get_key_type( &attributes ), 0 );
-    TEST_EQUAL( psa_get_key_bits( &attributes ), 0 );
+        MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(psa_get_key_id(&attributes)), 0);
+    TEST_EQUAL(psa_get_key_lifetime(&attributes), 0);
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes), 0);
+    TEST_EQUAL(psa_get_key_algorithm(&attributes), 0);
+    TEST_EQUAL(psa_get_key_type(&attributes), 0);
+    TEST_EQUAL(psa_get_key_bits(&attributes), 0);
 
-    TEST_EQUAL( psa_export_key( key, buffer, sizeof( buffer ), &length ),
-                PSA_ERROR_INVALID_HANDLE );
-    TEST_EQUAL( psa_export_public_key( key,
-                                       buffer, sizeof( buffer ), &length ),
-                PSA_ERROR_INVALID_HANDLE );
+    TEST_EQUAL(psa_export_key(key, buffer, sizeof(buffer), &length),
+               PSA_ERROR_INVALID_HANDLE);
+    TEST_EQUAL(psa_export_public_key(key,
+                                     buffer, sizeof(buffer), &length),
+               PSA_ERROR_INVALID_HANDLE);
 
     ok = 1;
 
@@ -239,34 +241,34 @@
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    return( ok );
+    return ok;
 }
 
 /* Assert that a key isn't reported as having a slot number. */
 #if defined(MBEDTLS_PSA_CRYPTO_SE_C)
-#define ASSERT_NO_SLOT_NUMBER( attributes )                             \
+#define ASSERT_NO_SLOT_NUMBER(attributes)                             \
     do                                                                  \
     {                                                                   \
         psa_key_slot_number_t ASSERT_NO_SLOT_NUMBER_slot_number;        \
-        TEST_EQUAL( psa_get_key_slot_number(                            \
-                        attributes,                                     \
-                        &ASSERT_NO_SLOT_NUMBER_slot_number ),           \
-                    PSA_ERROR_INVALID_ARGUMENT );                       \
+        TEST_EQUAL(psa_get_key_slot_number(                            \
+                       attributes,                                     \
+                       &ASSERT_NO_SLOT_NUMBER_slot_number),           \
+                   PSA_ERROR_INVALID_ARGUMENT);                       \
     }                                                                   \
-    while( 0 )
+    while (0)
 #else /* MBEDTLS_PSA_CRYPTO_SE_C */
-#define ASSERT_NO_SLOT_NUMBER( attributes )     \
-    ( (void) 0 )
+#define ASSERT_NO_SLOT_NUMBER(attributes)     \
+    ((void) 0)
 #endif /* MBEDTLS_PSA_CRYPTO_SE_C */
 
 /* An overapproximation of the amount of storage needed for a key of the
  * given type and with the given content. The API doesn't make it easy
  * to find a good value for the size. The current implementation doesn't
  * care about the value anyway. */
-#define KEY_BITS_FROM_DATA( type, data )        \
-    ( data )->len
+#define KEY_BITS_FROM_DATA(type, data)        \
+    (data)->len
 
 typedef enum {
     IMPORT_KEY = 0,
@@ -282,7 +284,7 @@
  */
 
 /* BEGIN_CASE */
-void static_checks( )
+void static_checks()
 {
     size_t max_truncated_mac_size =
         PSA_ALG_MAC_TRUNCATION_MASK >> PSA_MAC_TRUNCATION_OFFSET;
@@ -290,75 +292,75 @@
     /* Check that the length for a truncated MAC always fits in the algorithm
      * encoding. The shifted mask is the maximum truncated value. The
      * untruncated algorithm may be one byte larger. */
-    TEST_LE_U( PSA_MAC_MAX_SIZE, 1 + max_truncated_mac_size );
+    TEST_LE_U(PSA_MAC_MAX_SIZE, 1 + max_truncated_mac_size);
 
 #if defined(MBEDTLS_TEST_DEPRECATED)
     /* Check deprecated constants. */
-    TEST_EQUAL( PSA_ERROR_UNKNOWN_ERROR, PSA_ERROR_GENERIC_ERROR );
-    TEST_EQUAL( PSA_ERROR_OCCUPIED_SLOT, PSA_ERROR_ALREADY_EXISTS );
-    TEST_EQUAL( PSA_ERROR_EMPTY_SLOT, PSA_ERROR_DOES_NOT_EXIST );
-    TEST_EQUAL( PSA_ERROR_INSUFFICIENT_CAPACITY, PSA_ERROR_INSUFFICIENT_DATA );
-    TEST_EQUAL( PSA_ERROR_TAMPERING_DETECTED, PSA_ERROR_CORRUPTION_DETECTED );
-    TEST_EQUAL( PSA_KEY_USAGE_SIGN, PSA_KEY_USAGE_SIGN_HASH );
-    TEST_EQUAL( PSA_KEY_USAGE_VERIFY, PSA_KEY_USAGE_VERIFY_HASH );
-    TEST_EQUAL( PSA_ASYMMETRIC_SIGNATURE_MAX_SIZE, PSA_SIGNATURE_MAX_SIZE );
+    TEST_EQUAL(PSA_ERROR_UNKNOWN_ERROR, PSA_ERROR_GENERIC_ERROR);
+    TEST_EQUAL(PSA_ERROR_OCCUPIED_SLOT, PSA_ERROR_ALREADY_EXISTS);
+    TEST_EQUAL(PSA_ERROR_EMPTY_SLOT, PSA_ERROR_DOES_NOT_EXIST);
+    TEST_EQUAL(PSA_ERROR_INSUFFICIENT_CAPACITY, PSA_ERROR_INSUFFICIENT_DATA);
+    TEST_EQUAL(PSA_ERROR_TAMPERING_DETECTED, PSA_ERROR_CORRUPTION_DETECTED);
+    TEST_EQUAL(PSA_KEY_USAGE_SIGN, PSA_KEY_USAGE_SIGN_HASH);
+    TEST_EQUAL(PSA_KEY_USAGE_VERIFY, PSA_KEY_USAGE_VERIFY_HASH);
+    TEST_EQUAL(PSA_ASYMMETRIC_SIGNATURE_MAX_SIZE, PSA_SIGNATURE_MAX_SIZE);
 
-    TEST_EQUAL( PSA_ECC_CURVE_SECP160K1, PSA_ECC_FAMILY_SECP_K1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECP192K1, PSA_ECC_FAMILY_SECP_K1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECP224K1, PSA_ECC_FAMILY_SECP_K1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECP256K1, PSA_ECC_FAMILY_SECP_K1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECP160R1, PSA_ECC_FAMILY_SECP_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECP192R1, PSA_ECC_FAMILY_SECP_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECP224R1, PSA_ECC_FAMILY_SECP_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECP256R1, PSA_ECC_FAMILY_SECP_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECP384R1, PSA_ECC_FAMILY_SECP_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECP521R1, PSA_ECC_FAMILY_SECP_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECP160R2, PSA_ECC_FAMILY_SECP_R2 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT163K1, PSA_ECC_FAMILY_SECT_K1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT233K1, PSA_ECC_FAMILY_SECT_K1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT239K1, PSA_ECC_FAMILY_SECT_K1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT283K1, PSA_ECC_FAMILY_SECT_K1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT409K1, PSA_ECC_FAMILY_SECT_K1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT571K1, PSA_ECC_FAMILY_SECT_K1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT163R1, PSA_ECC_FAMILY_SECT_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT193R1, PSA_ECC_FAMILY_SECT_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT233R1, PSA_ECC_FAMILY_SECT_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT283R1, PSA_ECC_FAMILY_SECT_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT409R1, PSA_ECC_FAMILY_SECT_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT571R1, PSA_ECC_FAMILY_SECT_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT163R2, PSA_ECC_FAMILY_SECT_R2 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT193R2, PSA_ECC_FAMILY_SECT_R2 );
-    TEST_EQUAL( PSA_ECC_CURVE_BRAINPOOL_P256R1, PSA_ECC_FAMILY_BRAINPOOL_P_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_BRAINPOOL_P384R1, PSA_ECC_FAMILY_BRAINPOOL_P_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_BRAINPOOL_P512R1, PSA_ECC_FAMILY_BRAINPOOL_P_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_CURVE25519, PSA_ECC_FAMILY_MONTGOMERY );
-    TEST_EQUAL( PSA_ECC_CURVE_CURVE448, PSA_ECC_FAMILY_MONTGOMERY );
+    TEST_EQUAL(PSA_ECC_CURVE_SECP160K1, PSA_ECC_FAMILY_SECP_K1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECP192K1, PSA_ECC_FAMILY_SECP_K1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECP224K1, PSA_ECC_FAMILY_SECP_K1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECP256K1, PSA_ECC_FAMILY_SECP_K1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECP160R1, PSA_ECC_FAMILY_SECP_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECP192R1, PSA_ECC_FAMILY_SECP_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECP224R1, PSA_ECC_FAMILY_SECP_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECP256R1, PSA_ECC_FAMILY_SECP_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECP384R1, PSA_ECC_FAMILY_SECP_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECP521R1, PSA_ECC_FAMILY_SECP_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECP160R2, PSA_ECC_FAMILY_SECP_R2);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT163K1, PSA_ECC_FAMILY_SECT_K1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT233K1, PSA_ECC_FAMILY_SECT_K1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT239K1, PSA_ECC_FAMILY_SECT_K1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT283K1, PSA_ECC_FAMILY_SECT_K1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT409K1, PSA_ECC_FAMILY_SECT_K1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT571K1, PSA_ECC_FAMILY_SECT_K1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT163R1, PSA_ECC_FAMILY_SECT_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT193R1, PSA_ECC_FAMILY_SECT_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT233R1, PSA_ECC_FAMILY_SECT_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT283R1, PSA_ECC_FAMILY_SECT_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT409R1, PSA_ECC_FAMILY_SECT_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT571R1, PSA_ECC_FAMILY_SECT_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT163R2, PSA_ECC_FAMILY_SECT_R2);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT193R2, PSA_ECC_FAMILY_SECT_R2);
+    TEST_EQUAL(PSA_ECC_CURVE_BRAINPOOL_P256R1, PSA_ECC_FAMILY_BRAINPOOL_P_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_BRAINPOOL_P384R1, PSA_ECC_FAMILY_BRAINPOOL_P_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_BRAINPOOL_P512R1, PSA_ECC_FAMILY_BRAINPOOL_P_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_CURVE25519, PSA_ECC_FAMILY_MONTGOMERY);
+    TEST_EQUAL(PSA_ECC_CURVE_CURVE448, PSA_ECC_FAMILY_MONTGOMERY);
 
-    TEST_EQUAL( PSA_ECC_CURVE_SECP_K1, PSA_ECC_FAMILY_SECP_K1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECP_R1, PSA_ECC_FAMILY_SECP_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECP_R2, PSA_ECC_FAMILY_SECP_R2 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT_K1, PSA_ECC_FAMILY_SECT_K1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT_R1, PSA_ECC_FAMILY_SECT_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_SECT_R2, PSA_ECC_FAMILY_SECT_R2 );
-    TEST_EQUAL( PSA_ECC_CURVE_BRAINPOOL_P_R1, PSA_ECC_FAMILY_BRAINPOOL_P_R1 );
-    TEST_EQUAL( PSA_ECC_CURVE_MONTGOMERY, PSA_ECC_FAMILY_MONTGOMERY );
+    TEST_EQUAL(PSA_ECC_CURVE_SECP_K1, PSA_ECC_FAMILY_SECP_K1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECP_R1, PSA_ECC_FAMILY_SECP_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECP_R2, PSA_ECC_FAMILY_SECP_R2);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT_K1, PSA_ECC_FAMILY_SECT_K1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT_R1, PSA_ECC_FAMILY_SECT_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_SECT_R2, PSA_ECC_FAMILY_SECT_R2);
+    TEST_EQUAL(PSA_ECC_CURVE_BRAINPOOL_P_R1, PSA_ECC_FAMILY_BRAINPOOL_P_R1);
+    TEST_EQUAL(PSA_ECC_CURVE_MONTGOMERY, PSA_ECC_FAMILY_MONTGOMERY);
 
-    TEST_EQUAL( PSA_DH_GROUP_FFDHE2048, PSA_DH_FAMILY_RFC7919 );
-    TEST_EQUAL( PSA_DH_GROUP_FFDHE3072, PSA_DH_FAMILY_RFC7919 );
-    TEST_EQUAL( PSA_DH_GROUP_FFDHE4096, PSA_DH_FAMILY_RFC7919 );
-    TEST_EQUAL( PSA_DH_GROUP_FFDHE6144, PSA_DH_FAMILY_RFC7919 );
-    TEST_EQUAL( PSA_DH_GROUP_FFDHE8192, PSA_DH_FAMILY_RFC7919 );
+    TEST_EQUAL(PSA_DH_GROUP_FFDHE2048, PSA_DH_FAMILY_RFC7919);
+    TEST_EQUAL(PSA_DH_GROUP_FFDHE3072, PSA_DH_FAMILY_RFC7919);
+    TEST_EQUAL(PSA_DH_GROUP_FFDHE4096, PSA_DH_FAMILY_RFC7919);
+    TEST_EQUAL(PSA_DH_GROUP_FFDHE6144, PSA_DH_FAMILY_RFC7919);
+    TEST_EQUAL(PSA_DH_GROUP_FFDHE8192, PSA_DH_FAMILY_RFC7919);
 
-    TEST_EQUAL( PSA_DH_GROUP_RFC7919, PSA_DH_FAMILY_RFC7919 );
-    TEST_EQUAL( PSA_DH_GROUP_CUSTOM, PSA_DH_FAMILY_CUSTOM );
+    TEST_EQUAL(PSA_DH_GROUP_RFC7919, PSA_DH_FAMILY_RFC7919);
+    TEST_EQUAL(PSA_DH_GROUP_CUSTOM, PSA_DH_FAMILY_CUSTOM);
 #endif
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void import_with_policy( int type_arg,
-                         int usage_arg, int alg_arg,
-                         int expected_status_arg )
+void import_with_policy(int type_arg,
+                        int usage_arg, int alg_arg,
+                        int expected_status_arg)
 {
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_attributes_t got_attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -367,48 +369,49 @@
     psa_key_usage_t usage = usage_arg;
     psa_algorithm_t alg = alg_arg;
     psa_status_t expected_status = expected_status_arg;
-    const uint8_t key_material[16] = {0};
+    const uint8_t key_material[16] = { 0 };
     psa_status_t status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_type( &attributes, type );
-    psa_set_key_usage_flags( &attributes, usage );
-    psa_set_key_algorithm( &attributes, alg );
+    psa_set_key_type(&attributes, type);
+    psa_set_key_usage_flags(&attributes, usage);
+    psa_set_key_algorithm(&attributes, alg);
 
-    status = psa_import_key( &attributes,
-                             key_material, sizeof( key_material ),
-                             &key );
-    TEST_EQUAL( status, expected_status );
-    if( status != PSA_SUCCESS )
+    status = psa_import_key(&attributes,
+                            key_material, sizeof(key_material),
+                            &key);
+    TEST_EQUAL(status, expected_status);
+    if (status != PSA_SUCCESS) {
         goto exit;
+    }
 
-    PSA_ASSERT( psa_get_key_attributes( key, &got_attributes ) );
-    TEST_EQUAL( psa_get_key_type( &got_attributes ), type );
-    TEST_EQUAL( psa_get_key_usage_flags( &got_attributes ),
-                mbedtls_test_update_key_usage_flags( usage ) );
-    TEST_EQUAL( psa_get_key_algorithm( &got_attributes ), alg );
-    ASSERT_NO_SLOT_NUMBER( &got_attributes );
+    PSA_ASSERT(psa_get_key_attributes(key, &got_attributes));
+    TEST_EQUAL(psa_get_key_type(&got_attributes), type);
+    TEST_EQUAL(psa_get_key_usage_flags(&got_attributes),
+               mbedtls_test_update_key_usage_flags(usage));
+    TEST_EQUAL(psa_get_key_algorithm(&got_attributes), alg);
+    ASSERT_NO_SLOT_NUMBER(&got_attributes);
 
-    PSA_ASSERT( psa_destroy_key( key ) );
-    test_operations_on_invalid_key( key );
+    PSA_ASSERT(psa_destroy_key(key));
+    test_operations_on_invalid_key(key);
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &got_attributes );
+    psa_reset_key_attributes(&got_attributes);
 
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void import_with_data( data_t *data, int type_arg,
-                       int attr_bits_arg,
-                       int expected_status_arg )
+void import_with_data(data_t *data, int type_arg,
+                      int attr_bits_arg,
+                      int expected_status_arg)
 {
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_attributes_t got_attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -418,41 +421,43 @@
     psa_status_t expected_status = expected_status_arg;
     psa_status_t status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_type( &attributes, type );
-    psa_set_key_bits( &attributes, attr_bits );
+    psa_set_key_type(&attributes, type);
+    psa_set_key_bits(&attributes, attr_bits);
 
-    status = psa_import_key( &attributes, data->x, data->len, &key );
-    TEST_EQUAL( status, expected_status );
-    if( status != PSA_SUCCESS )
+    status = psa_import_key(&attributes, data->x, data->len, &key);
+    TEST_EQUAL(status, expected_status);
+    if (status != PSA_SUCCESS) {
         goto exit;
+    }
 
-    PSA_ASSERT( psa_get_key_attributes( key, &got_attributes ) );
-    TEST_EQUAL( psa_get_key_type( &got_attributes ), type );
-    if( attr_bits != 0 )
-        TEST_EQUAL( attr_bits, psa_get_key_bits( &got_attributes ) );
-    ASSERT_NO_SLOT_NUMBER( &got_attributes );
+    PSA_ASSERT(psa_get_key_attributes(key, &got_attributes));
+    TEST_EQUAL(psa_get_key_type(&got_attributes), type);
+    if (attr_bits != 0) {
+        TEST_EQUAL(attr_bits, psa_get_key_bits(&got_attributes));
+    }
+    ASSERT_NO_SLOT_NUMBER(&got_attributes);
 
-    PSA_ASSERT( psa_destroy_key( key ) );
-    test_operations_on_invalid_key( key );
+    PSA_ASSERT(psa_destroy_key(key));
+    test_operations_on_invalid_key(key);
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &got_attributes );
+    psa_reset_key_attributes(&got_attributes);
 
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
 /* Construct and attempt to import a large unstructured key. */
-void import_large_key( int type_arg, int byte_size_arg,
-                       int expected_status_arg )
+void import_large_key(int type_arg, int byte_size_arg,
+                      int expected_status_arg)
 {
     psa_key_type_t type = type_arg;
     size_t byte_size = byte_size_arg;
@@ -466,31 +471,32 @@
 
     /* Skip the test case if the target running the test cannot
      * accommodate large keys due to heap size constraints */
-    ASSERT_ALLOC_WEAK( buffer, buffer_size );
-    memset( buffer, 'K', byte_size );
+    ASSERT_ALLOC_WEAK(buffer, buffer_size);
+    memset(buffer, 'K', byte_size);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Try importing the key */
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
-    psa_set_key_type( &attributes, type );
-    status = psa_import_key( &attributes, buffer, byte_size, &key );
-    TEST_ASSUME( status != PSA_ERROR_INSUFFICIENT_MEMORY );
-    TEST_EQUAL( status, expected_status );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
+    psa_set_key_type(&attributes, type);
+    status = psa_import_key(&attributes, buffer, byte_size, &key);
+    TEST_ASSUME(status != PSA_ERROR_INSUFFICIENT_MEMORY);
+    TEST_EQUAL(status, expected_status);
 
-    if( status == PSA_SUCCESS )
-    {
-        PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-        TEST_EQUAL( psa_get_key_type( &attributes ), type );
-        TEST_EQUAL( psa_get_key_bits( &attributes ),
-                    PSA_BYTES_TO_BITS( byte_size ) );
-        ASSERT_NO_SLOT_NUMBER( &attributes );
-        memset( buffer, 0, byte_size + 1 );
-        PSA_ASSERT( psa_export_key( key, buffer, byte_size, &n ) );
-        for( n = 0; n < byte_size; n++ )
-            TEST_EQUAL( buffer[n], 'K' );
-        for( n = byte_size; n < buffer_size; n++ )
-            TEST_EQUAL( buffer[n], 0 );
+    if (status == PSA_SUCCESS) {
+        PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+        TEST_EQUAL(psa_get_key_type(&attributes), type);
+        TEST_EQUAL(psa_get_key_bits(&attributes),
+                   PSA_BYTES_TO_BITS(byte_size));
+        ASSERT_NO_SLOT_NUMBER(&attributes);
+        memset(buffer, 0, byte_size + 1);
+        PSA_ASSERT(psa_export_key(key, buffer, byte_size, &n));
+        for (n = 0; n < byte_size; n++) {
+            TEST_EQUAL(buffer[n], 'K');
+        }
+        for (n = byte_size; n < buffer_size; n++) {
+            TEST_EQUAL(buffer[n], 0);
+        }
     }
 
 exit:
@@ -498,11 +504,11 @@
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    psa_destroy_key( key );
-    PSA_DONE( );
-    mbedtls_free( buffer );
+    psa_destroy_key(key);
+    PSA_DONE();
+    mbedtls_free(buffer);
 }
 /* END_CASE */
 
@@ -510,7 +516,7 @@
 /* Import an RSA key with a valid structure (but not valid numbers
  * inside, beyond having sensible size and parity). This is expected to
  * fail for large keys. */
-void import_rsa_made_up( int bits_arg, int keypair, int expected_status_arg )
+void import_rsa_made_up(int bits_arg, int keypair, int expected_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     size_t bits = bits_arg;
@@ -519,43 +525,44 @@
     psa_key_type_t type =
         keypair ? PSA_KEY_TYPE_RSA_KEY_PAIR : PSA_KEY_TYPE_RSA_PUBLIC_KEY;
     size_t buffer_size = /* Slight overapproximations */
-        keypair ? bits * 9 / 16 + 80 : bits / 8 + 20;
+                         keypair ? bits * 9 / 16 + 80 : bits / 8 + 20;
     unsigned char *buffer = NULL;
     unsigned char *p;
     int ret;
     size_t length;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    ASSERT_ALLOC( buffer, buffer_size );
+    PSA_ASSERT(psa_crypto_init());
+    ASSERT_ALLOC(buffer, buffer_size);
 
-    TEST_ASSERT( ( ret = construct_fake_rsa_key( buffer, buffer_size, &p,
-                                                 bits, keypair ) ) >= 0 );
+    TEST_ASSERT((ret = construct_fake_rsa_key(buffer, buffer_size, &p,
+                                              bits, keypair)) >= 0);
     length = ret;
 
     /* Try importing the key */
-    psa_set_key_type( &attributes, type );
-    status = psa_import_key( &attributes, p, length, &key );
-    TEST_EQUAL( status, expected_status );
+    psa_set_key_type(&attributes, type);
+    status = psa_import_key(&attributes, p, length, &key);
+    TEST_EQUAL(status, expected_status);
 
-    if( status == PSA_SUCCESS )
-        PSA_ASSERT( psa_destroy_key( key ) );
+    if (status == PSA_SUCCESS) {
+        PSA_ASSERT(psa_destroy_key(key));
+    }
 
 exit:
-    mbedtls_free( buffer );
-    PSA_DONE( );
+    mbedtls_free(buffer);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void import_export( data_t *data,
-                    int type_arg,
-                    int usage_arg, int alg_arg,
-                    int expected_bits,
-                    int export_size_delta,
-                    int expected_export_status_arg,
-                    /*whether reexport must give the original input exactly*/
-                    int canonical_input )
+void import_export(data_t *data,
+                   int type_arg,
+                   int usage_arg, int alg_arg,
+                   int expected_bits,
+                   int export_size_delta,
+                   int expected_export_status_arg,
+                   /*whether reexport must give the original input exactly*/
+                   int canonical_input)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t type = type_arg;
@@ -571,39 +578,39 @@
     psa_key_attributes_t got_attributes = PSA_KEY_ATTRIBUTES_INIT;
 
     export_size = (ptrdiff_t) data->len + export_size_delta;
-    ASSERT_ALLOC( exported, export_size );
-    if( ! canonical_input )
-        ASSERT_ALLOC( reexported, export_size );
-    PSA_ASSERT( psa_crypto_init( ) );
+    ASSERT_ALLOC(exported, export_size);
+    if (!canonical_input) {
+        ASSERT_ALLOC(reexported, export_size);
+    }
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, usage_arg );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, type );
+    psa_set_key_usage_flags(&attributes, usage_arg);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, type);
 
     /* Import the key */
-    PSA_ASSERT( psa_import_key( &attributes, data->x, data->len, &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, data->x, data->len, &key));
 
     /* Test the key information */
-    PSA_ASSERT( psa_get_key_attributes( key, &got_attributes ) );
-    TEST_EQUAL( psa_get_key_type( &got_attributes ), type );
-    TEST_EQUAL( psa_get_key_bits( &got_attributes ), (size_t) expected_bits );
-    ASSERT_NO_SLOT_NUMBER( &got_attributes );
+    PSA_ASSERT(psa_get_key_attributes(key, &got_attributes));
+    TEST_EQUAL(psa_get_key_type(&got_attributes), type);
+    TEST_EQUAL(psa_get_key_bits(&got_attributes), (size_t) expected_bits);
+    ASSERT_NO_SLOT_NUMBER(&got_attributes);
 
     /* Export the key */
-    status = psa_export_key( key, exported, export_size, &exported_length );
-    TEST_EQUAL( status, expected_export_status );
+    status = psa_export_key(key, exported, export_size, &exported_length);
+    TEST_EQUAL(status, expected_export_status);
 
     /* The exported length must be set by psa_export_key() to a value between 0
      * and export_size. On errors, the exported length must be 0. */
-    TEST_ASSERT( exported_length != INVALID_EXPORT_LENGTH );
-    TEST_ASSERT( status == PSA_SUCCESS || exported_length == 0 );
-    TEST_LE_U( exported_length, export_size );
+    TEST_ASSERT(exported_length != INVALID_EXPORT_LENGTH);
+    TEST_ASSERT(status == PSA_SUCCESS || exported_length == 0);
+    TEST_LE_U(exported_length, export_size);
 
-    TEST_ASSERT( mem_is_char( exported + exported_length, 0,
-                              export_size - exported_length ) );
-    if( status != PSA_SUCCESS )
-    {
-        TEST_EQUAL( exported_length, 0 );
+    TEST_ASSERT(mem_is_char(exported + exported_length, 0,
+                            export_size - exported_length));
+    if (status != PSA_SUCCESS) {
+        TEST_EQUAL(exported_length, 0);
         goto destroy;
     }
 
@@ -611,54 +618,54 @@
      * this validates the canonical representations. For canonical inputs,
      * this doesn't directly validate the implementation, but it still helps
      * by cross-validating the test data with the sanity check code. */
-    if( ! mbedtls_test_psa_exercise_key( key, usage_arg, 0 ) )
+    if (!mbedtls_test_psa_exercise_key(key, usage_arg, 0)) {
         goto exit;
-
-    if( canonical_input )
-        ASSERT_COMPARE( data->x, data->len, exported, exported_length );
-    else
-    {
-        mbedtls_svc_key_id_t key2 = MBEDTLS_SVC_KEY_ID_INIT;
-        PSA_ASSERT( psa_import_key( &attributes, exported, exported_length,
-                                    &key2 ) );
-        PSA_ASSERT( psa_export_key( key2,
-                                    reexported,
-                                    export_size,
-                                    &reexported_length ) );
-        ASSERT_COMPARE( exported, exported_length,
-                        reexported, reexported_length );
-        PSA_ASSERT( psa_destroy_key( key2 ) );
     }
-    TEST_ASSERT( exported_length <=
-                 PSA_EXPORT_KEY_OUTPUT_SIZE( type,
-                                             psa_get_key_bits( &got_attributes ) ) );
-    TEST_LE_U( exported_length, PSA_EXPORT_KEY_PAIR_MAX_SIZE );
+
+    if (canonical_input) {
+        ASSERT_COMPARE(data->x, data->len, exported, exported_length);
+    } else {
+        mbedtls_svc_key_id_t key2 = MBEDTLS_SVC_KEY_ID_INIT;
+        PSA_ASSERT(psa_import_key(&attributes, exported, exported_length,
+                                  &key2));
+        PSA_ASSERT(psa_export_key(key2,
+                                  reexported,
+                                  export_size,
+                                  &reexported_length));
+        ASSERT_COMPARE(exported, exported_length,
+                       reexported, reexported_length);
+        PSA_ASSERT(psa_destroy_key(key2));
+    }
+    TEST_ASSERT(exported_length <=
+                PSA_EXPORT_KEY_OUTPUT_SIZE(type,
+                                           psa_get_key_bits(&got_attributes)));
+    TEST_LE_U(exported_length, PSA_EXPORT_KEY_PAIR_MAX_SIZE);
 
 destroy:
     /* Destroy the key */
-    PSA_ASSERT( psa_destroy_key( key ) );
-    test_operations_on_invalid_key( key );
+    PSA_ASSERT(psa_destroy_key(key));
+    test_operations_on_invalid_key(key);
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &got_attributes );
+    psa_reset_key_attributes(&got_attributes);
 
-    mbedtls_free( exported );
-    mbedtls_free( reexported );
-    PSA_DONE( );
+    mbedtls_free(exported);
+    mbedtls_free(reexported);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void import_export_public_key( data_t *data,
-                               int type_arg, // key pair or public key
-                               int alg_arg,
-                               int export_size_delta,
-                               int expected_export_status_arg,
-                               data_t *expected_public_key )
+void import_export_public_key(data_t *data,
+                              int type_arg,  // key pair or public key
+                              int alg_arg,
+                              int export_size_delta,
+                              int expected_export_status_arg,
+                              data_t *expected_public_key)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t type = type_arg;
@@ -670,35 +677,34 @@
     size_t exported_length = INVALID_EXPORT_LENGTH;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, type);
 
     /* Import the key */
-    PSA_ASSERT( psa_import_key( &attributes, data->x, data->len, &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, data->x, data->len, &key));
 
     /* Export the public key */
-    ASSERT_ALLOC( exported, export_size );
-    status = psa_export_public_key( key,
-                                    exported, export_size,
-                                    &exported_length );
-    TEST_EQUAL( status, expected_export_status );
-    if( status == PSA_SUCCESS )
-    {
-        psa_key_type_t public_type = PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR( type );
+    ASSERT_ALLOC(exported, export_size);
+    status = psa_export_public_key(key,
+                                   exported, export_size,
+                                   &exported_length);
+    TEST_EQUAL(status, expected_export_status);
+    if (status == PSA_SUCCESS) {
+        psa_key_type_t public_type = PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type);
         size_t bits;
-        PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-        bits = psa_get_key_bits( &attributes );
-        TEST_LE_U( expected_public_key->len,
-                   PSA_EXPORT_KEY_OUTPUT_SIZE( public_type, bits ) );
-        TEST_LE_U( expected_public_key->len,
-                   PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE( public_type, bits ) );
-        TEST_LE_U( expected_public_key->len,
-                   PSA_EXPORT_PUBLIC_KEY_MAX_SIZE );
-        ASSERT_COMPARE( expected_public_key->x, expected_public_key->len,
-                        exported, exported_length );
+        PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+        bits = psa_get_key_bits(&attributes);
+        TEST_LE_U(expected_public_key->len,
+                  PSA_EXPORT_KEY_OUTPUT_SIZE(public_type, bits));
+        TEST_LE_U(expected_public_key->len,
+                  PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(public_type, bits));
+        TEST_LE_U(expected_public_key->len,
+                  PSA_EXPORT_PUBLIC_KEY_MAX_SIZE);
+        ASSERT_COMPARE(expected_public_key->x, expected_public_key->len,
+                       exported, exported_length);
     }
 
 exit:
@@ -706,67 +712,68 @@
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    mbedtls_free( exported );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    mbedtls_free(exported);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void import_and_exercise_key( data_t *data,
-                              int type_arg,
-                              int bits_arg,
-                              int alg_arg )
+void import_and_exercise_key(data_t *data,
+                             int type_arg,
+                             int bits_arg,
+                             int alg_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t type = type_arg;
     size_t bits = bits_arg;
     psa_algorithm_t alg = alg_arg;
-    psa_key_usage_t usage = mbedtls_test_psa_usage_to_exercise( type, alg );
+    psa_key_usage_t usage = mbedtls_test_psa_usage_to_exercise(type, alg);
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_attributes_t got_attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, usage );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, type );
+    psa_set_key_usage_flags(&attributes, usage);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, type);
 
     /* Import the key */
-    PSA_ASSERT( psa_import_key( &attributes, data->x, data->len, &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, data->x, data->len, &key));
 
     /* Test the key information */
-    PSA_ASSERT( psa_get_key_attributes( key, &got_attributes ) );
-    TEST_EQUAL( psa_get_key_type( &got_attributes ), type );
-    TEST_EQUAL( psa_get_key_bits( &got_attributes ), bits );
+    PSA_ASSERT(psa_get_key_attributes(key, &got_attributes));
+    TEST_EQUAL(psa_get_key_type(&got_attributes), type);
+    TEST_EQUAL(psa_get_key_bits(&got_attributes), bits);
 
     /* Do something with the key according to its type and permitted usage. */
-    if( ! mbedtls_test_psa_exercise_key( key, usage, alg ) )
+    if (!mbedtls_test_psa_exercise_key(key, usage, alg)) {
         goto exit;
+    }
 
-    PSA_ASSERT( psa_destroy_key( key ) );
-    test_operations_on_invalid_key( key );
+    PSA_ASSERT(psa_destroy_key(key));
+    test_operations_on_invalid_key(key);
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &got_attributes );
+    psa_reset_key_attributes(&got_attributes);
 
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void effective_key_attributes( int type_arg, int expected_type_arg,
-                               int bits_arg, int expected_bits_arg,
-                               int usage_arg, int expected_usage_arg,
-                               int alg_arg, int expected_alg_arg )
+void effective_key_attributes(int type_arg, int expected_type_arg,
+                              int bits_arg, int expected_bits_arg,
+                              int usage_arg, int expected_usage_arg,
+                              int alg_arg, int expected_alg_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = type_arg;
@@ -779,89 +786,89 @@
     psa_key_usage_t expected_usage = expected_usage_arg;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, usage );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
-    psa_set_key_bits( &attributes, bits );
+    psa_set_key_usage_flags(&attributes, usage);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
+    psa_set_key_bits(&attributes, bits);
 
-    PSA_ASSERT( psa_generate_key( &attributes, &key ) );
-    psa_reset_key_attributes( &attributes );
+    PSA_ASSERT(psa_generate_key(&attributes, &key));
+    psa_reset_key_attributes(&attributes);
 
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    TEST_EQUAL( psa_get_key_type( &attributes ), expected_key_type );
-    TEST_EQUAL( psa_get_key_bits( &attributes ), expected_bits );
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes ), expected_usage );
-    TEST_EQUAL( psa_get_key_algorithm( &attributes ), expected_alg );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    TEST_EQUAL(psa_get_key_type(&attributes), expected_key_type);
+    TEST_EQUAL(psa_get_key_bits(&attributes), expected_bits);
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes), expected_usage);
+    TEST_EQUAL(psa_get_key_algorithm(&attributes), expected_alg);
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void check_key_policy( int type_arg, int bits_arg,
-                       int usage_arg, int alg_arg )
+void check_key_policy(int type_arg, int bits_arg,
+                      int usage_arg, int alg_arg)
 {
-    test_effective_key_attributes( type_arg, type_arg, bits_arg, bits_arg,
-                                   usage_arg,
-                                   mbedtls_test_update_key_usage_flags( usage_arg ),
-                                   alg_arg, alg_arg );
+    test_effective_key_attributes(type_arg, type_arg, bits_arg, bits_arg,
+                                  usage_arg,
+                                  mbedtls_test_update_key_usage_flags(usage_arg),
+                                  alg_arg, alg_arg);
     goto exit;
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void key_attributes_init( )
+void key_attributes_init()
 {
     /* Test each valid way of initializing the object, except for `= {0}`, as
      * Clang 5 complains when `-Wmissing-field-initializers` is used, even
      * though it's OK by the C standard. We could test for this, but we'd need
      * to suppress the Clang warning for the test. */
-    psa_key_attributes_t func = psa_key_attributes_init( );
+    psa_key_attributes_t func = psa_key_attributes_init();
     psa_key_attributes_t init = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_attributes_t zero;
 
-    memset( &zero, 0, sizeof( zero ) );
+    memset(&zero, 0, sizeof(zero));
 
-    TEST_EQUAL( psa_get_key_lifetime( &func ), PSA_KEY_LIFETIME_VOLATILE );
-    TEST_EQUAL( psa_get_key_lifetime( &init ), PSA_KEY_LIFETIME_VOLATILE );
-    TEST_EQUAL( psa_get_key_lifetime( &zero ), PSA_KEY_LIFETIME_VOLATILE );
+    TEST_EQUAL(psa_get_key_lifetime(&func), PSA_KEY_LIFETIME_VOLATILE);
+    TEST_EQUAL(psa_get_key_lifetime(&init), PSA_KEY_LIFETIME_VOLATILE);
+    TEST_EQUAL(psa_get_key_lifetime(&zero), PSA_KEY_LIFETIME_VOLATILE);
 
-    TEST_EQUAL( psa_get_key_type( &func ), 0 );
-    TEST_EQUAL( psa_get_key_type( &init ), 0 );
-    TEST_EQUAL( psa_get_key_type( &zero ), 0 );
+    TEST_EQUAL(psa_get_key_type(&func), 0);
+    TEST_EQUAL(psa_get_key_type(&init), 0);
+    TEST_EQUAL(psa_get_key_type(&zero), 0);
 
-    TEST_EQUAL( psa_get_key_bits( &func ), 0 );
-    TEST_EQUAL( psa_get_key_bits( &init ), 0 );
-    TEST_EQUAL( psa_get_key_bits( &zero ), 0 );
+    TEST_EQUAL(psa_get_key_bits(&func), 0);
+    TEST_EQUAL(psa_get_key_bits(&init), 0);
+    TEST_EQUAL(psa_get_key_bits(&zero), 0);
 
-    TEST_EQUAL( psa_get_key_usage_flags( &func ), 0 );
-    TEST_EQUAL( psa_get_key_usage_flags( &init ), 0 );
-    TEST_EQUAL( psa_get_key_usage_flags( &zero ), 0 );
+    TEST_EQUAL(psa_get_key_usage_flags(&func), 0);
+    TEST_EQUAL(psa_get_key_usage_flags(&init), 0);
+    TEST_EQUAL(psa_get_key_usage_flags(&zero), 0);
 
-    TEST_EQUAL( psa_get_key_algorithm( &func ), 0 );
-    TEST_EQUAL( psa_get_key_algorithm( &init ), 0 );
-    TEST_EQUAL( psa_get_key_algorithm( &zero ), 0 );
+    TEST_EQUAL(psa_get_key_algorithm(&func), 0);
+    TEST_EQUAL(psa_get_key_algorithm(&init), 0);
+    TEST_EQUAL(psa_get_key_algorithm(&zero), 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mac_key_policy( int policy_usage_arg,
-                     int policy_alg_arg,
-                     int key_type_arg,
-                     data_t *key_data,
-                     int exercise_alg_arg,
-                     int expected_status_sign_arg,
-                     int expected_status_verify_arg )
+void mac_key_policy(int policy_usage_arg,
+                    int policy_alg_arg,
+                    int key_type_arg,
+                    data_t *key_data,
+                    int exercise_alg_arg,
+                    int expected_status_sign_arg,
+                    int expected_status_verify_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -875,57 +882,58 @@
     psa_status_t expected_status_verify = expected_status_verify_arg;
     unsigned char mac[PSA_MAC_MAX_SIZE];
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, policy_usage );
-    psa_set_key_algorithm( &attributes, policy_alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, policy_usage);
+    psa_set_key_algorithm(&attributes, policy_alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes ),
-                mbedtls_test_update_key_usage_flags( policy_usage ) );
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes),
+               mbedtls_test_update_key_usage_flags(policy_usage));
 
-    status = psa_mac_sign_setup( &operation, key, exercise_alg );
-    TEST_EQUAL( status, expected_status_sign );
+    status = psa_mac_sign_setup(&operation, key, exercise_alg);
+    TEST_EQUAL(status, expected_status_sign);
 
     /* Calculate the MAC, one-shot case. */
-    uint8_t input[128] = {0};
+    uint8_t input[128] = { 0 };
     size_t mac_len;
-    TEST_EQUAL( psa_mac_compute( key, exercise_alg,
-                                 input, 128,
-                                 mac, PSA_MAC_MAX_SIZE, &mac_len ),
-                expected_status_sign );
+    TEST_EQUAL(psa_mac_compute(key, exercise_alg,
+                               input, 128,
+                               mac, PSA_MAC_MAX_SIZE, &mac_len),
+               expected_status_sign);
 
     /* Verify correct MAC, one-shot case. */
-    status = psa_mac_verify( key, exercise_alg, input, 128,
-                                mac, mac_len );
+    status = psa_mac_verify(key, exercise_alg, input, 128,
+                            mac, mac_len);
 
-    if( expected_status_sign != PSA_SUCCESS && expected_status_verify == PSA_SUCCESS )
-        TEST_EQUAL( status, PSA_ERROR_INVALID_SIGNATURE );
-    else
-        TEST_EQUAL( status, expected_status_verify );
+    if (expected_status_sign != PSA_SUCCESS && expected_status_verify == PSA_SUCCESS) {
+        TEST_EQUAL(status, PSA_ERROR_INVALID_SIGNATURE);
+    } else {
+        TEST_EQUAL(status, expected_status_verify);
+    }
 
-    psa_mac_abort( &operation );
+    psa_mac_abort(&operation);
 
-    memset( mac, 0, sizeof( mac ) );
-    status = psa_mac_verify_setup( &operation, key, exercise_alg );
-    TEST_EQUAL( status, expected_status_verify );
+    memset(mac, 0, sizeof(mac));
+    status = psa_mac_verify_setup(&operation, key, exercise_alg);
+    TEST_EQUAL(status, expected_status_verify);
 
 exit:
-    psa_mac_abort( &operation );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_mac_abort(&operation);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_key_policy( int policy_usage_arg,
-                        int policy_alg,
-                        int key_type,
-                        data_t *key_data,
-                        int exercise_alg )
+void cipher_key_policy(int policy_usage_arg,
+                       int policy_alg,
+                       int key_type,
+                       data_t *key_data,
+                       int exercise_alg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -933,115 +941,119 @@
     psa_key_usage_t policy_usage = policy_usage_arg;
     psa_status_t status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, policy_usage );
-    psa_set_key_algorithm( &attributes, policy_alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, policy_usage);
+    psa_set_key_algorithm(&attributes, policy_alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
     /* Check if no key usage flag implication is done */
-    TEST_EQUAL( policy_usage,
-                mbedtls_test_update_key_usage_flags( policy_usage ) );
+    TEST_EQUAL(policy_usage,
+               mbedtls_test_update_key_usage_flags(policy_usage));
 
-    status = psa_cipher_encrypt_setup( &operation, key, exercise_alg );
-    if( policy_alg == exercise_alg &&
-        ( policy_usage & PSA_KEY_USAGE_ENCRYPT ) != 0 )
-        PSA_ASSERT( status );
-    else
-        TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
-    psa_cipher_abort( &operation );
+    status = psa_cipher_encrypt_setup(&operation, key, exercise_alg);
+    if (policy_alg == exercise_alg &&
+        (policy_usage & PSA_KEY_USAGE_ENCRYPT) != 0) {
+        PSA_ASSERT(status);
+    } else {
+        TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
+    }
+    psa_cipher_abort(&operation);
 
-    status = psa_cipher_decrypt_setup( &operation, key, exercise_alg );
-    if( policy_alg == exercise_alg &&
-        ( policy_usage & PSA_KEY_USAGE_DECRYPT ) != 0 )
-        PSA_ASSERT( status );
-    else
-        TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
+    status = psa_cipher_decrypt_setup(&operation, key, exercise_alg);
+    if (policy_alg == exercise_alg &&
+        (policy_usage & PSA_KEY_USAGE_DECRYPT) != 0) {
+        PSA_ASSERT(status);
+    } else {
+        TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
+    }
 
 exit:
-    psa_cipher_abort( &operation );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_cipher_abort(&operation);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void aead_key_policy( int policy_usage_arg,
-                      int policy_alg,
-                      int key_type,
-                      data_t *key_data,
-                      int nonce_length_arg,
-                      int tag_length_arg,
-                      int exercise_alg,
-                      int expected_status_arg )
+void aead_key_policy(int policy_usage_arg,
+                     int policy_alg,
+                     int key_type,
+                     data_t *key_data,
+                     int nonce_length_arg,
+                     int tag_length_arg,
+                     int exercise_alg,
+                     int expected_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_usage_t policy_usage = policy_usage_arg;
     psa_status_t status;
     psa_status_t expected_status = expected_status_arg;
-    unsigned char nonce[16] = {0};
+    unsigned char nonce[16] = { 0 };
     size_t nonce_length = nonce_length_arg;
     unsigned char tag[16];
     size_t tag_length = tag_length_arg;
     size_t output_length;
 
-    TEST_LE_U( nonce_length, sizeof( nonce ) );
-    TEST_LE_U( tag_length, sizeof( tag ) );
+    TEST_LE_U(nonce_length, sizeof(nonce));
+    TEST_LE_U(tag_length, sizeof(tag));
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, policy_usage );
-    psa_set_key_algorithm( &attributes, policy_alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, policy_usage);
+    psa_set_key_algorithm(&attributes, policy_alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
     /* Check if no key usage implication is done */
-    TEST_EQUAL( policy_usage,
-                mbedtls_test_update_key_usage_flags( policy_usage ) );
+    TEST_EQUAL(policy_usage,
+               mbedtls_test_update_key_usage_flags(policy_usage));
 
-    status = psa_aead_encrypt( key, exercise_alg,
-                               nonce, nonce_length,
-                               NULL, 0,
-                               NULL, 0,
-                               tag, tag_length,
-                               &output_length );
-    if( ( policy_usage & PSA_KEY_USAGE_ENCRYPT ) != 0 )
-        TEST_EQUAL( status, expected_status );
-    else
-        TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
+    status = psa_aead_encrypt(key, exercise_alg,
+                              nonce, nonce_length,
+                              NULL, 0,
+                              NULL, 0,
+                              tag, tag_length,
+                              &output_length);
+    if ((policy_usage & PSA_KEY_USAGE_ENCRYPT) != 0) {
+        TEST_EQUAL(status, expected_status);
+    } else {
+        TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
+    }
 
-    memset( tag, 0, sizeof( tag ) );
-    status = psa_aead_decrypt( key, exercise_alg,
-                               nonce, nonce_length,
-                               NULL, 0,
-                               tag, tag_length,
-                               NULL, 0,
-                               &output_length );
-    if( ( policy_usage & PSA_KEY_USAGE_DECRYPT ) == 0 )
-        TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
-    else if( expected_status == PSA_SUCCESS )
-        TEST_EQUAL( status, PSA_ERROR_INVALID_SIGNATURE );
-    else
-        TEST_EQUAL( status, expected_status );
+    memset(tag, 0, sizeof(tag));
+    status = psa_aead_decrypt(key, exercise_alg,
+                              nonce, nonce_length,
+                              NULL, 0,
+                              tag, tag_length,
+                              NULL, 0,
+                              &output_length);
+    if ((policy_usage & PSA_KEY_USAGE_DECRYPT) == 0) {
+        TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
+    } else if (expected_status == PSA_SUCCESS) {
+        TEST_EQUAL(status, PSA_ERROR_INVALID_SIGNATURE);
+    } else {
+        TEST_EQUAL(status, expected_status);
+    }
 
 exit:
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void asymmetric_encryption_key_policy( int policy_usage_arg,
-                                       int policy_alg,
-                                       int key_type,
-                                       data_t *key_data,
-                                       int exercise_alg )
+void asymmetric_encryption_key_policy(int policy_usage_arg,
+                                      int policy_alg,
+                                      int key_type,
+                                      data_t *key_data,
+                                      int exercise_alg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -1052,204 +1064,210 @@
     unsigned char *buffer = NULL;
     size_t output_length;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, policy_usage );
-    psa_set_key_algorithm( &attributes, policy_alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, policy_usage);
+    psa_set_key_algorithm(&attributes, policy_alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
     /* Check if no key usage implication is done */
-    TEST_EQUAL( policy_usage,
-                mbedtls_test_update_key_usage_flags( policy_usage ) );
+    TEST_EQUAL(policy_usage,
+               mbedtls_test_update_key_usage_flags(policy_usage));
 
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
-    buffer_length = PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE( key_type, key_bits,
-                                                        exercise_alg );
-    ASSERT_ALLOC( buffer, buffer_length );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
+    buffer_length = PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE(key_type, key_bits,
+                                                       exercise_alg);
+    ASSERT_ALLOC(buffer, buffer_length);
 
-    status = psa_asymmetric_encrypt( key, exercise_alg,
-                                     NULL, 0,
-                                     NULL, 0,
-                                     buffer, buffer_length,
-                                     &output_length );
-    if( policy_alg == exercise_alg &&
-        ( policy_usage & PSA_KEY_USAGE_ENCRYPT ) != 0 )
-        PSA_ASSERT( status );
-    else
-        TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
+    status = psa_asymmetric_encrypt(key, exercise_alg,
+                                    NULL, 0,
+                                    NULL, 0,
+                                    buffer, buffer_length,
+                                    &output_length);
+    if (policy_alg == exercise_alg &&
+        (policy_usage & PSA_KEY_USAGE_ENCRYPT) != 0) {
+        PSA_ASSERT(status);
+    } else {
+        TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
+    }
 
-    if( buffer_length != 0 )
-        memset( buffer, 0, buffer_length );
-    status = psa_asymmetric_decrypt( key, exercise_alg,
-                                     buffer, buffer_length,
-                                     NULL, 0,
-                                     buffer, buffer_length,
-                                     &output_length );
-    if( policy_alg == exercise_alg &&
-        ( policy_usage & PSA_KEY_USAGE_DECRYPT ) != 0 )
-        TEST_EQUAL( status, PSA_ERROR_INVALID_PADDING );
-    else
-        TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
+    if (buffer_length != 0) {
+        memset(buffer, 0, buffer_length);
+    }
+    status = psa_asymmetric_decrypt(key, exercise_alg,
+                                    buffer, buffer_length,
+                                    NULL, 0,
+                                    buffer, buffer_length,
+                                    &output_length);
+    if (policy_alg == exercise_alg &&
+        (policy_usage & PSA_KEY_USAGE_DECRYPT) != 0) {
+        TEST_EQUAL(status, PSA_ERROR_INVALID_PADDING);
+    } else {
+        TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
+    }
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    psa_destroy_key( key );
-    PSA_DONE( );
-    mbedtls_free( buffer );
+    psa_destroy_key(key);
+    PSA_DONE();
+    mbedtls_free(buffer);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void asymmetric_signature_key_policy( int policy_usage_arg,
-                                      int policy_alg,
-                                      int key_type,
-                                      data_t *key_data,
-                                      int exercise_alg,
-                                      int payload_length_arg,
-                                      int expected_usage_arg )
+void asymmetric_signature_key_policy(int policy_usage_arg,
+                                     int policy_alg,
+                                     int key_type,
+                                     data_t *key_data,
+                                     int exercise_alg,
+                                     int payload_length_arg,
+                                     int expected_usage_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_usage_t policy_usage = policy_usage_arg;
     psa_key_usage_t expected_usage = expected_usage_arg;
     psa_status_t status;
-    unsigned char payload[PSA_HASH_MAX_SIZE] = {1};
+    unsigned char payload[PSA_HASH_MAX_SIZE] = { 1 };
     /* If `payload_length_arg > 0`, `exercise_alg` is supposed to be
      * compatible with the policy and `payload_length_arg` is supposed to be
      * a valid input length to sign. If `payload_length_arg <= 0`,
      * `exercise_alg` is supposed to be forbidden by the policy. */
     int compatible_alg = payload_length_arg > 0;
     size_t payload_length = compatible_alg ? payload_length_arg : 0;
-    unsigned char signature[PSA_SIGNATURE_MAX_SIZE] = {0};
+    unsigned char signature[PSA_SIGNATURE_MAX_SIZE] = { 0 };
     size_t signature_length;
 
     /* Check if all implicit usage flags are deployed
        in the expected usage flags. */
-    TEST_EQUAL( expected_usage,
-                mbedtls_test_update_key_usage_flags( policy_usage ) );
+    TEST_EQUAL(expected_usage,
+               mbedtls_test_update_key_usage_flags(policy_usage));
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, policy_usage );
-    psa_set_key_algorithm( &attributes, policy_alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, policy_usage);
+    psa_set_key_algorithm(&attributes, policy_alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes ), expected_usage );
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes), expected_usage);
 
-    status = psa_sign_hash( key, exercise_alg,
-                            payload, payload_length,
-                            signature, sizeof( signature ),
-                            &signature_length );
-    if( compatible_alg && ( expected_usage & PSA_KEY_USAGE_SIGN_HASH ) != 0 )
-        PSA_ASSERT( status );
-    else
-        TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
+    status = psa_sign_hash(key, exercise_alg,
+                           payload, payload_length,
+                           signature, sizeof(signature),
+                           &signature_length);
+    if (compatible_alg && (expected_usage & PSA_KEY_USAGE_SIGN_HASH) != 0) {
+        PSA_ASSERT(status);
+    } else {
+        TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
+    }
 
-    memset( signature, 0, sizeof( signature ) );
-    status = psa_verify_hash( key, exercise_alg,
-                              payload, payload_length,
-                              signature, sizeof( signature ) );
-    if( compatible_alg && ( expected_usage & PSA_KEY_USAGE_VERIFY_HASH ) != 0 )
-        TEST_EQUAL( status, PSA_ERROR_INVALID_SIGNATURE );
-    else
-        TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
+    memset(signature, 0, sizeof(signature));
+    status = psa_verify_hash(key, exercise_alg,
+                             payload, payload_length,
+                             signature, sizeof(signature));
+    if (compatible_alg && (expected_usage & PSA_KEY_USAGE_VERIFY_HASH) != 0) {
+        TEST_EQUAL(status, PSA_ERROR_INVALID_SIGNATURE);
+    } else {
+        TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
+    }
 
-    if( PSA_ALG_IS_SIGN_HASH( exercise_alg ) &&
-        PSA_ALG_IS_HASH( PSA_ALG_SIGN_GET_HASH( exercise_alg ) ) )
-    {
-        status = psa_sign_message( key, exercise_alg,
-                                   payload, payload_length,
-                                   signature, sizeof( signature ),
-                                   &signature_length );
-        if( compatible_alg && ( expected_usage & PSA_KEY_USAGE_SIGN_MESSAGE ) != 0 )
-            PSA_ASSERT( status );
-        else
-            TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
+    if (PSA_ALG_IS_SIGN_HASH(exercise_alg) &&
+        PSA_ALG_IS_HASH(PSA_ALG_SIGN_GET_HASH(exercise_alg))) {
+        status = psa_sign_message(key, exercise_alg,
+                                  payload, payload_length,
+                                  signature, sizeof(signature),
+                                  &signature_length);
+        if (compatible_alg && (expected_usage & PSA_KEY_USAGE_SIGN_MESSAGE) != 0) {
+            PSA_ASSERT(status);
+        } else {
+            TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
+        }
 
-        memset( signature, 0, sizeof( signature ) );
-        status = psa_verify_message( key, exercise_alg,
-                                     payload, payload_length,
-                                     signature, sizeof( signature ) );
-        if( compatible_alg && ( expected_usage & PSA_KEY_USAGE_VERIFY_MESSAGE ) != 0 )
-            TEST_EQUAL( status, PSA_ERROR_INVALID_SIGNATURE );
-        else
-            TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
+        memset(signature, 0, sizeof(signature));
+        status = psa_verify_message(key, exercise_alg,
+                                    payload, payload_length,
+                                    signature, sizeof(signature));
+        if (compatible_alg && (expected_usage & PSA_KEY_USAGE_VERIFY_MESSAGE) != 0) {
+            TEST_EQUAL(status, PSA_ERROR_INVALID_SIGNATURE);
+        } else {
+            TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
+        }
     }
 
 exit:
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void derive_key_policy( int policy_usage,
-                        int policy_alg,
-                        int key_type,
-                        data_t *key_data,
-                        int exercise_alg )
+void derive_key_policy(int policy_usage,
+                       int policy_alg,
+                       int key_type,
+                       data_t *key_data,
+                       int exercise_alg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
     psa_status_t status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, policy_usage );
-    psa_set_key_algorithm( &attributes, policy_alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, policy_usage);
+    psa_set_key_algorithm(&attributes, policy_alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    PSA_ASSERT( psa_key_derivation_setup( &operation, exercise_alg ) );
+    PSA_ASSERT(psa_key_derivation_setup(&operation, exercise_alg));
 
-    if( PSA_ALG_IS_TLS12_PRF( exercise_alg ) ||
-            PSA_ALG_IS_TLS12_PSK_TO_MS( exercise_alg ) )
-    {
-        PSA_ASSERT( psa_key_derivation_input_bytes(
-                                            &operation,
-                                            PSA_KEY_DERIVATION_INPUT_SEED,
-                                            (const uint8_t*) "", 0) );
+    if (PSA_ALG_IS_TLS12_PRF(exercise_alg) ||
+        PSA_ALG_IS_TLS12_PSK_TO_MS(exercise_alg)) {
+        PSA_ASSERT(psa_key_derivation_input_bytes(
+                       &operation,
+                       PSA_KEY_DERIVATION_INPUT_SEED,
+                       (const uint8_t *) "", 0));
     }
 
-    status = psa_key_derivation_input_key( &operation,
-                                           PSA_KEY_DERIVATION_INPUT_SECRET,
-                                           key );
+    status = psa_key_derivation_input_key(&operation,
+                                          PSA_KEY_DERIVATION_INPUT_SECRET,
+                                          key);
 
-    if( policy_alg == exercise_alg &&
-        ( policy_usage & PSA_KEY_USAGE_DERIVE ) != 0 )
-        PSA_ASSERT( status );
-    else
-        TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
+    if (policy_alg == exercise_alg &&
+        (policy_usage & PSA_KEY_USAGE_DERIVE) != 0) {
+        PSA_ASSERT(status);
+    } else {
+        TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
+    }
 
 exit:
-    psa_key_derivation_abort( &operation );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_key_derivation_abort(&operation);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void agreement_key_policy( int policy_usage,
-                           int policy_alg,
-                           int key_type_arg,
-                           data_t *key_data,
-                           int exercise_alg,
-                           int expected_status_arg )
+void agreement_key_policy(int policy_usage,
+                          int policy_alg,
+                          int key_type_arg,
+                          data_t *key_data,
+                          int exercise_alg,
+                          int expected_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -1258,30 +1276,30 @@
     psa_status_t status;
     psa_status_t expected_status = expected_status_arg;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, policy_usage );
-    psa_set_key_algorithm( &attributes, policy_alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, policy_usage);
+    psa_set_key_algorithm(&attributes, policy_alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    PSA_ASSERT( psa_key_derivation_setup( &operation, exercise_alg ) );
-    status = mbedtls_test_psa_key_agreement_with_self( &operation, key );
+    PSA_ASSERT(psa_key_derivation_setup(&operation, exercise_alg));
+    status = mbedtls_test_psa_key_agreement_with_self(&operation, key);
 
-    TEST_EQUAL( status, expected_status );
+    TEST_EQUAL(status, expected_status);
 
 exit:
-    psa_key_derivation_abort( &operation );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_key_derivation_abort(&operation);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void key_policy_alg2( int key_type_arg, data_t *key_data,
-                      int usage_arg, int alg_arg, int alg2_arg )
+void key_policy_alg2(int key_type_arg, data_t *key_data,
+                     int usage_arg, int alg_arg, int alg2_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -1291,46 +1309,48 @@
     psa_algorithm_t alg = alg_arg;
     psa_algorithm_t alg2 = alg2_arg;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, usage );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_enrollment_algorithm( &attributes, alg2 );
-    psa_set_key_type( &attributes, key_type );
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    psa_set_key_usage_flags(&attributes, usage);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_enrollment_algorithm(&attributes, alg2);
+    psa_set_key_type(&attributes, key_type);
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
     /* Update the usage flags to obtain implicit usage flags */
-    usage = mbedtls_test_update_key_usage_flags( usage );
-    PSA_ASSERT( psa_get_key_attributes( key, &got_attributes ) );
-    TEST_EQUAL( psa_get_key_usage_flags( &got_attributes ), usage );
-    TEST_EQUAL( psa_get_key_algorithm( &got_attributes ), alg );
-    TEST_EQUAL( psa_get_key_enrollment_algorithm( &got_attributes ), alg2 );
+    usage = mbedtls_test_update_key_usage_flags(usage);
+    PSA_ASSERT(psa_get_key_attributes(key, &got_attributes));
+    TEST_EQUAL(psa_get_key_usage_flags(&got_attributes), usage);
+    TEST_EQUAL(psa_get_key_algorithm(&got_attributes), alg);
+    TEST_EQUAL(psa_get_key_enrollment_algorithm(&got_attributes), alg2);
 
-    if( ! mbedtls_test_psa_exercise_key( key, usage, alg ) )
+    if (!mbedtls_test_psa_exercise_key(key, usage, alg)) {
         goto exit;
-    if( ! mbedtls_test_psa_exercise_key( key, usage, alg2 ) )
+    }
+    if (!mbedtls_test_psa_exercise_key(key, usage, alg2)) {
         goto exit;
+    }
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &got_attributes );
+    psa_reset_key_attributes(&got_attributes);
 
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void raw_agreement_key_policy( int policy_usage,
-                               int policy_alg,
-                               int key_type_arg,
-                               data_t *key_data,
-                               int exercise_alg,
-                               int expected_status_arg )
+void raw_agreement_key_policy(int policy_usage,
+                              int policy_alg,
+                              int key_type_arg,
+                              data_t *key_data,
+                              int exercise_alg,
+                              int expected_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -1339,35 +1359,35 @@
     psa_status_t status;
     psa_status_t expected_status = expected_status_arg;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, policy_usage );
-    psa_set_key_algorithm( &attributes, policy_alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, policy_usage);
+    psa_set_key_algorithm(&attributes, policy_alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    status = mbedtls_test_psa_raw_key_agreement_with_self( exercise_alg, key );
+    status = mbedtls_test_psa_raw_key_agreement_with_self(exercise_alg, key);
 
-    TEST_EQUAL( status, expected_status );
+    TEST_EQUAL(status, expected_status);
 
 exit:
-    psa_key_derivation_abort( &operation );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_key_derivation_abort(&operation);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void copy_success( int source_usage_arg,
-                   int source_alg_arg, int source_alg2_arg,
-                   int type_arg, data_t *material,
-                   int copy_attributes,
-                   int target_usage_arg,
-                   int target_alg_arg, int target_alg2_arg,
-                   int expected_usage_arg,
-                   int expected_alg_arg, int expected_alg2_arg )
+void copy_success(int source_usage_arg,
+                  int source_alg_arg, int source_alg2_arg,
+                  int type_arg, data_t *material,
+                  int copy_attributes,
+                  int target_usage_arg,
+                  int target_alg_arg, int target_alg2_arg,
+                  int expected_usage_arg,
+                  int expected_alg_arg, int expected_alg2_arg)
 {
     psa_key_attributes_t source_attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_attributes_t target_attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -1378,195 +1398,199 @@
     mbedtls_svc_key_id_t target_key = MBEDTLS_SVC_KEY_ID_INIT;
     uint8_t *export_buffer = NULL;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Prepare the source key. */
-    psa_set_key_usage_flags( &source_attributes, source_usage_arg );
-    psa_set_key_algorithm( &source_attributes, source_alg_arg );
-    psa_set_key_enrollment_algorithm( &source_attributes, source_alg2_arg );
-    psa_set_key_type( &source_attributes, type_arg );
-    PSA_ASSERT( psa_import_key( &source_attributes,
-                                material->x, material->len,
-                                &source_key ) );
-    PSA_ASSERT( psa_get_key_attributes( source_key, &source_attributes ) );
+    psa_set_key_usage_flags(&source_attributes, source_usage_arg);
+    psa_set_key_algorithm(&source_attributes, source_alg_arg);
+    psa_set_key_enrollment_algorithm(&source_attributes, source_alg2_arg);
+    psa_set_key_type(&source_attributes, type_arg);
+    PSA_ASSERT(psa_import_key(&source_attributes,
+                              material->x, material->len,
+                              &source_key));
+    PSA_ASSERT(psa_get_key_attributes(source_key, &source_attributes));
 
     /* Prepare the target attributes. */
-    if( copy_attributes )
-    {
+    if (copy_attributes) {
         target_attributes = source_attributes;
         /* Set volatile lifetime to reset the key identifier to 0. */
-        psa_set_key_lifetime( &target_attributes, PSA_KEY_LIFETIME_VOLATILE );
+        psa_set_key_lifetime(&target_attributes, PSA_KEY_LIFETIME_VOLATILE);
     }
 
-    if( target_usage_arg != -1 )
-        psa_set_key_usage_flags( &target_attributes, target_usage_arg );
-    if( target_alg_arg != -1 )
-        psa_set_key_algorithm( &target_attributes, target_alg_arg );
-    if( target_alg2_arg != -1 )
-        psa_set_key_enrollment_algorithm( &target_attributes, target_alg2_arg );
+    if (target_usage_arg != -1) {
+        psa_set_key_usage_flags(&target_attributes, target_usage_arg);
+    }
+    if (target_alg_arg != -1) {
+        psa_set_key_algorithm(&target_attributes, target_alg_arg);
+    }
+    if (target_alg2_arg != -1) {
+        psa_set_key_enrollment_algorithm(&target_attributes, target_alg2_arg);
+    }
 
     /* Copy the key. */
-    PSA_ASSERT( psa_copy_key( source_key,
-                              &target_attributes, &target_key ) );
+    PSA_ASSERT(psa_copy_key(source_key,
+                            &target_attributes, &target_key));
 
     /* Destroy the source to ensure that this doesn't affect the target. */
-    PSA_ASSERT( psa_destroy_key( source_key ) );
+    PSA_ASSERT(psa_destroy_key(source_key));
 
     /* Test that the target slot has the expected content and policy. */
-    PSA_ASSERT( psa_get_key_attributes( target_key, &target_attributes ) );
-    TEST_EQUAL( psa_get_key_type( &source_attributes ),
-                psa_get_key_type( &target_attributes ) );
-    TEST_EQUAL( psa_get_key_bits( &source_attributes ),
-                psa_get_key_bits( &target_attributes ) );
-    TEST_EQUAL( expected_usage, psa_get_key_usage_flags( &target_attributes ) );
-    TEST_EQUAL( expected_alg, psa_get_key_algorithm( &target_attributes ) );
-    TEST_EQUAL( expected_alg2,
-                psa_get_key_enrollment_algorithm( &target_attributes ) );
-    if( expected_usage & PSA_KEY_USAGE_EXPORT )
-    {
+    PSA_ASSERT(psa_get_key_attributes(target_key, &target_attributes));
+    TEST_EQUAL(psa_get_key_type(&source_attributes),
+               psa_get_key_type(&target_attributes));
+    TEST_EQUAL(psa_get_key_bits(&source_attributes),
+               psa_get_key_bits(&target_attributes));
+    TEST_EQUAL(expected_usage, psa_get_key_usage_flags(&target_attributes));
+    TEST_EQUAL(expected_alg, psa_get_key_algorithm(&target_attributes));
+    TEST_EQUAL(expected_alg2,
+               psa_get_key_enrollment_algorithm(&target_attributes));
+    if (expected_usage & PSA_KEY_USAGE_EXPORT) {
         size_t length;
-        ASSERT_ALLOC( export_buffer, material->len );
-        PSA_ASSERT( psa_export_key( target_key, export_buffer,
-                                    material->len, &length ) );
-        ASSERT_COMPARE( material->x, material->len,
-                        export_buffer, length );
+        ASSERT_ALLOC(export_buffer, material->len);
+        PSA_ASSERT(psa_export_key(target_key, export_buffer,
+                                  material->len, &length));
+        ASSERT_COMPARE(material->x, material->len,
+                       export_buffer, length);
     }
 
-    if( ! mbedtls_test_psa_exercise_key( target_key, expected_usage, expected_alg ) )
+    if (!mbedtls_test_psa_exercise_key(target_key, expected_usage, expected_alg)) {
         goto exit;
-    if( ! mbedtls_test_psa_exercise_key( target_key, expected_usage, expected_alg2 ) )
+    }
+    if (!mbedtls_test_psa_exercise_key(target_key, expected_usage, expected_alg2)) {
         goto exit;
+    }
 
-    PSA_ASSERT( psa_destroy_key( target_key ) );
+    PSA_ASSERT(psa_destroy_key(target_key));
 
 exit:
     /*
      * Source and target key attributes may have been returned by
      * psa_get_key_attributes() thus reset them as required.
      */
-    psa_reset_key_attributes( &source_attributes );
-    psa_reset_key_attributes( &target_attributes );
+    psa_reset_key_attributes(&source_attributes);
+    psa_reset_key_attributes(&target_attributes);
 
-    PSA_DONE( );
-    mbedtls_free( export_buffer );
+    PSA_DONE();
+    mbedtls_free(export_buffer);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void copy_fail( int source_usage_arg,
-                int source_alg_arg, int source_alg2_arg,
-                int type_arg, data_t *material,
-                int target_type_arg, int target_bits_arg,
-                int target_usage_arg,
-                int target_alg_arg, int target_alg2_arg,
-                int target_id_arg, int target_lifetime_arg,
-                int expected_status_arg )
+void copy_fail(int source_usage_arg,
+               int source_alg_arg, int source_alg2_arg,
+               int type_arg, data_t *material,
+               int target_type_arg, int target_bits_arg,
+               int target_usage_arg,
+               int target_alg_arg, int target_alg2_arg,
+               int target_id_arg, int target_lifetime_arg,
+               int expected_status_arg)
 {
     psa_key_attributes_t source_attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_attributes_t target_attributes = PSA_KEY_ATTRIBUTES_INIT;
     mbedtls_svc_key_id_t source_key = MBEDTLS_SVC_KEY_ID_INIT;
     mbedtls_svc_key_id_t target_key = MBEDTLS_SVC_KEY_ID_INIT;
-    mbedtls_svc_key_id_t key_id = mbedtls_svc_key_id_make( 1, target_id_arg );
+    mbedtls_svc_key_id_t key_id = mbedtls_svc_key_id_make(1, target_id_arg);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Prepare the source key. */
-    psa_set_key_usage_flags( &source_attributes, source_usage_arg );
-    psa_set_key_algorithm( &source_attributes, source_alg_arg );
-    psa_set_key_enrollment_algorithm( &source_attributes, source_alg2_arg );
-    psa_set_key_type( &source_attributes, type_arg );
-    PSA_ASSERT( psa_import_key( &source_attributes,
-                                material->x, material->len,
-                                &source_key ) );
+    psa_set_key_usage_flags(&source_attributes, source_usage_arg);
+    psa_set_key_algorithm(&source_attributes, source_alg_arg);
+    psa_set_key_enrollment_algorithm(&source_attributes, source_alg2_arg);
+    psa_set_key_type(&source_attributes, type_arg);
+    PSA_ASSERT(psa_import_key(&source_attributes,
+                              material->x, material->len,
+                              &source_key));
 
     /* Prepare the target attributes. */
-    psa_set_key_id( &target_attributes, key_id );
-    psa_set_key_lifetime( &target_attributes, target_lifetime_arg );
-    psa_set_key_type( &target_attributes, target_type_arg );
-    psa_set_key_bits( &target_attributes, target_bits_arg );
-    psa_set_key_usage_flags( &target_attributes, target_usage_arg );
-    psa_set_key_algorithm( &target_attributes, target_alg_arg );
-    psa_set_key_enrollment_algorithm( &target_attributes, target_alg2_arg );
+    psa_set_key_id(&target_attributes, key_id);
+    psa_set_key_lifetime(&target_attributes, target_lifetime_arg);
+    psa_set_key_type(&target_attributes, target_type_arg);
+    psa_set_key_bits(&target_attributes, target_bits_arg);
+    psa_set_key_usage_flags(&target_attributes, target_usage_arg);
+    psa_set_key_algorithm(&target_attributes, target_alg_arg);
+    psa_set_key_enrollment_algorithm(&target_attributes, target_alg2_arg);
 
     /* Try to copy the key. */
-    TEST_EQUAL( psa_copy_key( source_key,
-                              &target_attributes, &target_key ),
-                expected_status_arg );
+    TEST_EQUAL(psa_copy_key(source_key,
+                            &target_attributes, &target_key),
+               expected_status_arg);
 
-    PSA_ASSERT( psa_destroy_key( source_key ) );
+    PSA_ASSERT(psa_destroy_key(source_key));
 
 exit:
-    psa_reset_key_attributes( &source_attributes );
-    psa_reset_key_attributes( &target_attributes );
-    PSA_DONE( );
+    psa_reset_key_attributes(&source_attributes);
+    psa_reset_key_attributes(&target_attributes);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hash_operation_init( )
+void hash_operation_init()
 {
     const uint8_t input[1] = { 0 };
     /* Test each valid way of initializing the object, except for `= {0}`, as
      * Clang 5 complains when `-Wmissing-field-initializers` is used, even
      * though it's OK by the C standard. We could test for this, but we'd need
      * to suppress the Clang warning for the test. */
-    psa_hash_operation_t func = psa_hash_operation_init( );
+    psa_hash_operation_t func = psa_hash_operation_init();
     psa_hash_operation_t init = PSA_HASH_OPERATION_INIT;
     psa_hash_operation_t zero;
 
-    memset( &zero, 0, sizeof( zero ) );
+    memset(&zero, 0, sizeof(zero));
 
     /* A freshly-initialized hash operation should not be usable. */
-    TEST_EQUAL( psa_hash_update( &func, input, sizeof( input ) ),
-                PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( psa_hash_update( &init, input, sizeof( input ) ),
-                PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( psa_hash_update( &zero, input, sizeof( input ) ),
-                PSA_ERROR_BAD_STATE );
+    TEST_EQUAL(psa_hash_update(&func, input, sizeof(input)),
+               PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(psa_hash_update(&init, input, sizeof(input)),
+               PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(psa_hash_update(&zero, input, sizeof(input)),
+               PSA_ERROR_BAD_STATE);
 
     /* A default hash operation should be abortable without error. */
-    PSA_ASSERT( psa_hash_abort( &func ) );
-    PSA_ASSERT( psa_hash_abort( &init ) );
-    PSA_ASSERT( psa_hash_abort( &zero ) );
+    PSA_ASSERT(psa_hash_abort(&func));
+    PSA_ASSERT(psa_hash_abort(&init));
+    PSA_ASSERT(psa_hash_abort(&zero));
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hash_setup( int alg_arg,
-                 int expected_status_arg )
+void hash_setup(int alg_arg,
+                int expected_status_arg)
 {
     psa_algorithm_t alg = alg_arg;
     psa_status_t expected_status = expected_status_arg;
     psa_hash_operation_t operation = PSA_HASH_OPERATION_INIT;
     psa_status_t status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    status = psa_hash_setup( &operation, alg );
-    TEST_EQUAL( status, expected_status );
+    status = psa_hash_setup(&operation, alg);
+    TEST_EQUAL(status, expected_status);
 
     /* Whether setup succeeded or failed, abort must succeed. */
-    PSA_ASSERT( psa_hash_abort( &operation ) );
+    PSA_ASSERT(psa_hash_abort(&operation));
 
     /* If setup failed, reproduce the failure, so as to
      * test the resulting state of the operation object. */
-    if( status != PSA_SUCCESS )
-        TEST_EQUAL( psa_hash_setup( &operation, alg ), status );
+    if (status != PSA_SUCCESS) {
+        TEST_EQUAL(psa_hash_setup(&operation, alg), status);
+    }
 
     /* Now the operation object should be reusable. */
 #if defined(KNOWN_SUPPORTED_HASH_ALG)
-    PSA_ASSERT( psa_hash_setup( &operation, KNOWN_SUPPORTED_HASH_ALG ) );
-    PSA_ASSERT( psa_hash_abort( &operation ) );
+    PSA_ASSERT(psa_hash_setup(&operation, KNOWN_SUPPORTED_HASH_ALG));
+    PSA_ASSERT(psa_hash_abort(&operation));
 #endif
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hash_compute_fail( int alg_arg, data_t *input,
-                        int output_size_arg, int expected_status_arg )
+void hash_compute_fail(int alg_arg, data_t *input,
+                       int output_size_arg, int expected_status_arg)
 {
     psa_algorithm_t alg = alg_arg;
     uint8_t *output = NULL;
@@ -1575,100 +1599,99 @@
     psa_status_t expected_status = expected_status_arg;
     psa_status_t status;
 
-    ASSERT_ALLOC( output, output_size );
+    ASSERT_ALLOC(output, output_size);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    status = psa_hash_compute( alg, input->x, input->len,
-                               output, output_size, &output_length );
-    TEST_EQUAL( status, expected_status );
-    TEST_LE_U( output_length, output_size );
+    status = psa_hash_compute(alg, input->x, input->len,
+                              output, output_size, &output_length);
+    TEST_EQUAL(status, expected_status);
+    TEST_LE_U(output_length, output_size);
 
 exit:
-    mbedtls_free( output );
-    PSA_DONE( );
+    mbedtls_free(output);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hash_compare_fail( int alg_arg, data_t *input,
-                        data_t *reference_hash,
-                        int expected_status_arg )
+void hash_compare_fail(int alg_arg, data_t *input,
+                       data_t *reference_hash,
+                       int expected_status_arg)
 {
     psa_algorithm_t alg = alg_arg;
     psa_status_t expected_status = expected_status_arg;
     psa_status_t status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    status = psa_hash_compare( alg, input->x, input->len,
-                               reference_hash->x, reference_hash->len );
-    TEST_EQUAL( status, expected_status );
+    status = psa_hash_compare(alg, input->x, input->len,
+                              reference_hash->x, reference_hash->len);
+    TEST_EQUAL(status, expected_status);
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hash_compute_compare( int alg_arg, data_t *input,
-                           data_t *expected_output )
+void hash_compute_compare(int alg_arg, data_t *input,
+                          data_t *expected_output)
 {
     psa_algorithm_t alg = alg_arg;
     uint8_t output[PSA_HASH_MAX_SIZE + 1];
     size_t output_length = INVALID_EXPORT_LENGTH;
     size_t i;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Compute with tight buffer */
-    PSA_ASSERT( psa_hash_compute( alg, input->x, input->len,
-                                  output, PSA_HASH_LENGTH( alg ),
-                                  &output_length ) );
-    TEST_EQUAL( output_length, PSA_HASH_LENGTH( alg ) );
-    ASSERT_COMPARE( output, output_length,
-                    expected_output->x, expected_output->len );
+    PSA_ASSERT(psa_hash_compute(alg, input->x, input->len,
+                                output, PSA_HASH_LENGTH(alg),
+                                &output_length));
+    TEST_EQUAL(output_length, PSA_HASH_LENGTH(alg));
+    ASSERT_COMPARE(output, output_length,
+                   expected_output->x, expected_output->len);
 
     /* Compute with larger buffer */
-    PSA_ASSERT( psa_hash_compute( alg, input->x, input->len,
-                                  output, sizeof( output ),
-                                  &output_length ) );
-    TEST_EQUAL( output_length, PSA_HASH_LENGTH( alg ) );
-    ASSERT_COMPARE( output, output_length,
-                    expected_output->x, expected_output->len );
+    PSA_ASSERT(psa_hash_compute(alg, input->x, input->len,
+                                output, sizeof(output),
+                                &output_length));
+    TEST_EQUAL(output_length, PSA_HASH_LENGTH(alg));
+    ASSERT_COMPARE(output, output_length,
+                   expected_output->x, expected_output->len);
 
     /* Compare with correct hash */
-    PSA_ASSERT( psa_hash_compare( alg, input->x, input->len,
-                                  output, output_length ) );
+    PSA_ASSERT(psa_hash_compare(alg, input->x, input->len,
+                                output, output_length));
 
     /* Compare with trailing garbage */
-    TEST_EQUAL( psa_hash_compare( alg, input->x, input->len,
-                                  output, output_length + 1 ),
-                PSA_ERROR_INVALID_SIGNATURE );
+    TEST_EQUAL(psa_hash_compare(alg, input->x, input->len,
+                                output, output_length + 1),
+               PSA_ERROR_INVALID_SIGNATURE);
 
     /* Compare with truncated hash */
-    TEST_EQUAL( psa_hash_compare( alg, input->x, input->len,
-                                  output, output_length - 1 ),
-                PSA_ERROR_INVALID_SIGNATURE );
+    TEST_EQUAL(psa_hash_compare(alg, input->x, input->len,
+                                output, output_length - 1),
+               PSA_ERROR_INVALID_SIGNATURE);
 
     /* Compare with corrupted value */
-    for( i = 0; i < output_length; i++ )
-    {
-        mbedtls_test_set_step( i );
+    for (i = 0; i < output_length; i++) {
+        mbedtls_test_set_step(i);
         output[i] ^= 1;
-        TEST_EQUAL( psa_hash_compare( alg, input->x, input->len,
-                                      output, output_length ),
-                    PSA_ERROR_INVALID_SIGNATURE );
+        TEST_EQUAL(psa_hash_compare(alg, input->x, input->len,
+                                    output, output_length),
+                   PSA_ERROR_INVALID_SIGNATURE);
         output[i] ^= 1;
     }
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:PSA_WANT_ALG_SHA_256 */
-void hash_bad_order( )
+void hash_bad_order()
 {
     psa_algorithm_t alg = PSA_ALG_SHA_256;
     unsigned char input[] = "";
@@ -1676,103 +1699,104 @@
     const unsigned char valid_hash[] = {
         0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8,
         0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c,
-        0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55 };
+        0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55
+    };
     unsigned char hash[sizeof(valid_hash)] = { 0 };
     size_t hash_len;
     psa_hash_operation_t operation = PSA_HASH_OPERATION_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Call setup twice in a row. */
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
-    ASSERT_OPERATION_IS_ACTIVE( operation );
-    TEST_EQUAL( psa_hash_setup( &operation, alg ),
-                PSA_ERROR_BAD_STATE );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
-    PSA_ASSERT( psa_hash_abort( &operation ) );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
+    ASSERT_OPERATION_IS_ACTIVE(operation);
+    TEST_EQUAL(psa_hash_setup(&operation, alg),
+               PSA_ERROR_BAD_STATE);
+    ASSERT_OPERATION_IS_INACTIVE(operation);
+    PSA_ASSERT(psa_hash_abort(&operation));
+    ASSERT_OPERATION_IS_INACTIVE(operation);
 
     /* Call update without calling setup beforehand. */
-    TEST_EQUAL( psa_hash_update( &operation, input, sizeof( input ) ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_hash_abort( &operation ) );
+    TEST_EQUAL(psa_hash_update(&operation, input, sizeof(input)),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_hash_abort(&operation));
 
     /* Check that update calls abort on error. */
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
     operation.id = UINT_MAX;
-    ASSERT_OPERATION_IS_ACTIVE( operation );
-    TEST_EQUAL( psa_hash_update( &operation, input, sizeof( input ) ),
-                PSA_ERROR_BAD_STATE );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
-    PSA_ASSERT( psa_hash_abort( &operation ) );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
+    ASSERT_OPERATION_IS_ACTIVE(operation);
+    TEST_EQUAL(psa_hash_update(&operation, input, sizeof(input)),
+               PSA_ERROR_BAD_STATE);
+    ASSERT_OPERATION_IS_INACTIVE(operation);
+    PSA_ASSERT(psa_hash_abort(&operation));
+    ASSERT_OPERATION_IS_INACTIVE(operation);
 
     /* Call update after finish. */
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
-    PSA_ASSERT( psa_hash_finish( &operation,
-                                 hash, sizeof( hash ), &hash_len ) );
-    TEST_EQUAL( psa_hash_update( &operation, input, sizeof( input ) ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_hash_abort( &operation ) );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
+    PSA_ASSERT(psa_hash_finish(&operation,
+                               hash, sizeof(hash), &hash_len));
+    TEST_EQUAL(psa_hash_update(&operation, input, sizeof(input)),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_hash_abort(&operation));
 
     /* Call verify without calling setup beforehand. */
-    TEST_EQUAL( psa_hash_verify( &operation,
-                                 valid_hash, sizeof( valid_hash ) ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_hash_abort( &operation ) );
+    TEST_EQUAL(psa_hash_verify(&operation,
+                               valid_hash, sizeof(valid_hash)),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_hash_abort(&operation));
 
     /* Call verify after finish. */
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
-    PSA_ASSERT( psa_hash_finish( &operation,
-                                 hash, sizeof( hash ), &hash_len ) );
-    TEST_EQUAL( psa_hash_verify( &operation,
-                                 valid_hash, sizeof( valid_hash ) ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_hash_abort( &operation ) );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
+    PSA_ASSERT(psa_hash_finish(&operation,
+                               hash, sizeof(hash), &hash_len));
+    TEST_EQUAL(psa_hash_verify(&operation,
+                               valid_hash, sizeof(valid_hash)),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_hash_abort(&operation));
 
     /* Call verify twice in a row. */
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
-    ASSERT_OPERATION_IS_ACTIVE( operation );
-    PSA_ASSERT( psa_hash_verify( &operation,
-                                 valid_hash, sizeof( valid_hash ) ) );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
-    TEST_EQUAL( psa_hash_verify( &operation,
-                                 valid_hash, sizeof( valid_hash ) ),
-                PSA_ERROR_BAD_STATE );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
-    PSA_ASSERT( psa_hash_abort( &operation ) );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
+    ASSERT_OPERATION_IS_ACTIVE(operation);
+    PSA_ASSERT(psa_hash_verify(&operation,
+                               valid_hash, sizeof(valid_hash)));
+    ASSERT_OPERATION_IS_INACTIVE(operation);
+    TEST_EQUAL(psa_hash_verify(&operation,
+                               valid_hash, sizeof(valid_hash)),
+               PSA_ERROR_BAD_STATE);
+    ASSERT_OPERATION_IS_INACTIVE(operation);
+    PSA_ASSERT(psa_hash_abort(&operation));
 
     /* Call finish without calling setup beforehand. */
-    TEST_EQUAL( psa_hash_finish( &operation,
-                                 hash, sizeof( hash ), &hash_len ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_hash_abort( &operation ) );
+    TEST_EQUAL(psa_hash_finish(&operation,
+                               hash, sizeof(hash), &hash_len),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_hash_abort(&operation));
 
     /* Call finish twice in a row. */
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
-    PSA_ASSERT( psa_hash_finish( &operation,
-                                 hash, sizeof( hash ), &hash_len ) );
-    TEST_EQUAL( psa_hash_finish( &operation,
-                                 hash, sizeof( hash ), &hash_len ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_hash_abort( &operation ) );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
+    PSA_ASSERT(psa_hash_finish(&operation,
+                               hash, sizeof(hash), &hash_len));
+    TEST_EQUAL(psa_hash_finish(&operation,
+                               hash, sizeof(hash), &hash_len),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_hash_abort(&operation));
 
     /* Call finish after calling verify. */
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
-    PSA_ASSERT( psa_hash_verify( &operation,
-                                 valid_hash, sizeof( valid_hash ) ) );
-    TEST_EQUAL( psa_hash_finish( &operation,
-                                 hash, sizeof( hash ), &hash_len ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_hash_abort( &operation ) );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
+    PSA_ASSERT(psa_hash_verify(&operation,
+                               valid_hash, sizeof(valid_hash)));
+    TEST_EQUAL(psa_hash_finish(&operation,
+                               hash, sizeof(hash), &hash_len),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_hash_abort(&operation));
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:PSA_WANT_ALG_SHA_256 */
-void hash_verify_bad_args( )
+void hash_verify_bad_args()
 {
     psa_algorithm_t alg = PSA_ALG_SHA_256;
     /* SHA-256 hash of an empty string with 2 extra bytes (0xaa and 0xbb)
@@ -1780,60 +1804,61 @@
     unsigned char hash[] = {
         0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8,
         0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c,
-        0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55, 0xaa, 0xbb };
-    size_t expected_size = PSA_HASH_LENGTH( alg );
+        0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55, 0xaa, 0xbb
+    };
+    size_t expected_size = PSA_HASH_LENGTH(alg);
     psa_hash_operation_t operation = PSA_HASH_OPERATION_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* psa_hash_verify with a smaller hash than expected */
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
-    ASSERT_OPERATION_IS_ACTIVE( operation );
-    TEST_EQUAL( psa_hash_verify( &operation, hash, expected_size - 1 ),
-                PSA_ERROR_INVALID_SIGNATURE );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
-    PSA_ASSERT( psa_hash_abort( &operation ) );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
+    ASSERT_OPERATION_IS_ACTIVE(operation);
+    TEST_EQUAL(psa_hash_verify(&operation, hash, expected_size - 1),
+               PSA_ERROR_INVALID_SIGNATURE);
+    ASSERT_OPERATION_IS_INACTIVE(operation);
+    PSA_ASSERT(psa_hash_abort(&operation));
+    ASSERT_OPERATION_IS_INACTIVE(operation);
 
     /* psa_hash_verify with a non-matching hash */
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
-    TEST_EQUAL( psa_hash_verify( &operation, hash + 1, expected_size ),
-                PSA_ERROR_INVALID_SIGNATURE );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
+    TEST_EQUAL(psa_hash_verify(&operation, hash + 1, expected_size),
+               PSA_ERROR_INVALID_SIGNATURE);
 
     /* psa_hash_verify with a hash longer than expected */
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
-    TEST_EQUAL( psa_hash_verify( &operation, hash, sizeof( hash ) ),
-                PSA_ERROR_INVALID_SIGNATURE );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
+    TEST_EQUAL(psa_hash_verify(&operation, hash, sizeof(hash)),
+               PSA_ERROR_INVALID_SIGNATURE);
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:PSA_WANT_ALG_SHA_256 */
-void hash_finish_bad_args( )
+void hash_finish_bad_args()
 {
     psa_algorithm_t alg = PSA_ALG_SHA_256;
     unsigned char hash[PSA_HASH_MAX_SIZE];
-    size_t expected_size = PSA_HASH_LENGTH( alg );
+    size_t expected_size = PSA_HASH_LENGTH(alg);
     psa_hash_operation_t operation = PSA_HASH_OPERATION_INIT;
     size_t hash_len;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* psa_hash_finish with a smaller hash buffer than expected */
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
-    TEST_EQUAL( psa_hash_finish( &operation,
-                                 hash, expected_size - 1, &hash_len ),
-                PSA_ERROR_BUFFER_TOO_SMALL );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
+    TEST_EQUAL(psa_hash_finish(&operation,
+                               hash, expected_size - 1, &hash_len),
+               PSA_ERROR_BUFFER_TOO_SMALL);
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:PSA_WANT_ALG_SHA_256 */
-void hash_clone_source_state( )
+void hash_clone_source_state()
 {
     psa_algorithm_t alg = PSA_ALG_SHA_256;
     unsigned char hash[PSA_HASH_MAX_SIZE];
@@ -1844,41 +1869,41 @@
     psa_hash_operation_t op_aborted = PSA_HASH_OPERATION_INIT;
     size_t hash_len;
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    PSA_ASSERT( psa_hash_setup( &op_source, alg ) );
+    PSA_ASSERT(psa_crypto_init());
+    PSA_ASSERT(psa_hash_setup(&op_source, alg));
 
-    PSA_ASSERT( psa_hash_setup( &op_setup, alg ) );
-    PSA_ASSERT( psa_hash_setup( &op_finished, alg ) );
-    PSA_ASSERT( psa_hash_finish( &op_finished,
-                                 hash, sizeof( hash ), &hash_len ) );
-    PSA_ASSERT( psa_hash_setup( &op_aborted, alg ) );
-    PSA_ASSERT( psa_hash_abort( &op_aborted ) );
+    PSA_ASSERT(psa_hash_setup(&op_setup, alg));
+    PSA_ASSERT(psa_hash_setup(&op_finished, alg));
+    PSA_ASSERT(psa_hash_finish(&op_finished,
+                               hash, sizeof(hash), &hash_len));
+    PSA_ASSERT(psa_hash_setup(&op_aborted, alg));
+    PSA_ASSERT(psa_hash_abort(&op_aborted));
 
-    TEST_EQUAL( psa_hash_clone( &op_source, &op_setup ),
-                PSA_ERROR_BAD_STATE );
+    TEST_EQUAL(psa_hash_clone(&op_source, &op_setup),
+               PSA_ERROR_BAD_STATE);
 
-    PSA_ASSERT( psa_hash_clone( &op_source, &op_init ) );
-    PSA_ASSERT( psa_hash_finish( &op_init,
-                                 hash, sizeof( hash ), &hash_len ) );
-    PSA_ASSERT( psa_hash_clone( &op_source, &op_finished ) );
-    PSA_ASSERT( psa_hash_finish( &op_finished,
-                                 hash, sizeof( hash ), &hash_len ) );
-    PSA_ASSERT( psa_hash_clone( &op_source, &op_aborted ) );
-    PSA_ASSERT( psa_hash_finish( &op_aborted,
-                                 hash, sizeof( hash ), &hash_len ) );
+    PSA_ASSERT(psa_hash_clone(&op_source, &op_init));
+    PSA_ASSERT(psa_hash_finish(&op_init,
+                               hash, sizeof(hash), &hash_len));
+    PSA_ASSERT(psa_hash_clone(&op_source, &op_finished));
+    PSA_ASSERT(psa_hash_finish(&op_finished,
+                               hash, sizeof(hash), &hash_len));
+    PSA_ASSERT(psa_hash_clone(&op_source, &op_aborted));
+    PSA_ASSERT(psa_hash_finish(&op_aborted,
+                               hash, sizeof(hash), &hash_len));
 
 exit:
-    psa_hash_abort( &op_source );
-    psa_hash_abort( &op_init );
-    psa_hash_abort( &op_setup );
-    psa_hash_abort( &op_finished );
-    psa_hash_abort( &op_aborted );
-    PSA_DONE( );
+    psa_hash_abort(&op_source);
+    psa_hash_abort(&op_init);
+    psa_hash_abort(&op_setup);
+    psa_hash_abort(&op_finished);
+    psa_hash_abort(&op_aborted);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:PSA_WANT_ALG_SHA_256 */
-void hash_clone_target_state( )
+void hash_clone_target_state()
 {
     psa_algorithm_t alg = PSA_ALG_SHA_256;
     unsigned char hash[PSA_HASH_MAX_SIZE];
@@ -1889,37 +1914,37 @@
     psa_hash_operation_t op_target = PSA_HASH_OPERATION_INIT;
     size_t hash_len;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    PSA_ASSERT( psa_hash_setup( &op_setup, alg ) );
-    PSA_ASSERT( psa_hash_setup( &op_finished, alg ) );
-    PSA_ASSERT( psa_hash_finish( &op_finished,
-                                 hash, sizeof( hash ), &hash_len ) );
-    PSA_ASSERT( psa_hash_setup( &op_aborted, alg ) );
-    PSA_ASSERT( psa_hash_abort( &op_aborted ) );
+    PSA_ASSERT(psa_hash_setup(&op_setup, alg));
+    PSA_ASSERT(psa_hash_setup(&op_finished, alg));
+    PSA_ASSERT(psa_hash_finish(&op_finished,
+                               hash, sizeof(hash), &hash_len));
+    PSA_ASSERT(psa_hash_setup(&op_aborted, alg));
+    PSA_ASSERT(psa_hash_abort(&op_aborted));
 
-    PSA_ASSERT( psa_hash_clone( &op_setup, &op_target ) );
-    PSA_ASSERT( psa_hash_finish( &op_target,
-                                 hash, sizeof( hash ), &hash_len ) );
+    PSA_ASSERT(psa_hash_clone(&op_setup, &op_target));
+    PSA_ASSERT(psa_hash_finish(&op_target,
+                               hash, sizeof(hash), &hash_len));
 
-    TEST_EQUAL( psa_hash_clone( &op_init, &op_target ), PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( psa_hash_clone( &op_finished, &op_target ),
-                PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( psa_hash_clone( &op_aborted, &op_target ),
-                PSA_ERROR_BAD_STATE );
+    TEST_EQUAL(psa_hash_clone(&op_init, &op_target), PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(psa_hash_clone(&op_finished, &op_target),
+               PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(psa_hash_clone(&op_aborted, &op_target),
+               PSA_ERROR_BAD_STATE);
 
 exit:
-    psa_hash_abort( &op_target );
-    psa_hash_abort( &op_init );
-    psa_hash_abort( &op_setup );
-    psa_hash_abort( &op_finished );
-    psa_hash_abort( &op_aborted );
-    PSA_DONE( );
+    psa_hash_abort(&op_target);
+    psa_hash_abort(&op_init);
+    psa_hash_abort(&op_setup);
+    psa_hash_abort(&op_finished);
+    psa_hash_abort(&op_aborted);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mac_operation_init( )
+void mac_operation_init()
 {
     const uint8_t input[1] = { 0 };
 
@@ -1927,35 +1952,35 @@
      * Clang 5 complains when `-Wmissing-field-initializers` is used, even
      * though it's OK by the C standard. We could test for this, but we'd need
      * to suppress the Clang warning for the test. */
-    psa_mac_operation_t func = psa_mac_operation_init( );
+    psa_mac_operation_t func = psa_mac_operation_init();
     psa_mac_operation_t init = PSA_MAC_OPERATION_INIT;
     psa_mac_operation_t zero;
 
-    memset( &zero, 0, sizeof( zero ) );
+    memset(&zero, 0, sizeof(zero));
 
     /* A freshly-initialized MAC operation should not be usable. */
-    TEST_EQUAL( psa_mac_update( &func,
-                                input, sizeof( input ) ),
-                PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( psa_mac_update( &init,
-                                input, sizeof( input ) ),
-                PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( psa_mac_update( &zero,
-                                input, sizeof( input ) ),
-                PSA_ERROR_BAD_STATE );
+    TEST_EQUAL(psa_mac_update(&func,
+                              input, sizeof(input)),
+               PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(psa_mac_update(&init,
+                              input, sizeof(input)),
+               PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(psa_mac_update(&zero,
+                              input, sizeof(input)),
+               PSA_ERROR_BAD_STATE);
 
     /* A default MAC operation should be abortable without error. */
-    PSA_ASSERT( psa_mac_abort( &func ) );
-    PSA_ASSERT( psa_mac_abort( &init ) );
-    PSA_ASSERT( psa_mac_abort( &zero ) );
+    PSA_ASSERT(psa_mac_abort(&func));
+    PSA_ASSERT(psa_mac_abort(&init));
+    PSA_ASSERT(psa_mac_abort(&zero));
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mac_setup( int key_type_arg,
-                data_t *key,
-                int alg_arg,
-                int expected_status_arg )
+void mac_setup(int key_type_arg,
+               data_t *key,
+               int alg_arg,
+               int expected_status_arg)
 {
     psa_key_type_t key_type = key_type_arg;
     psa_algorithm_t alg = alg_arg;
@@ -1966,31 +1991,33 @@
     const uint8_t smoke_test_key_data[16] = "kkkkkkkkkkkkkkkk";
 #endif
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    if( ! exercise_mac_setup( key_type, key->x, key->len, alg,
-                              &operation, &status ) )
+    if (!exercise_mac_setup(key_type, key->x, key->len, alg,
+                            &operation, &status)) {
         goto exit;
-    TEST_EQUAL( status, expected_status );
+    }
+    TEST_EQUAL(status, expected_status);
 
     /* The operation object should be reusable. */
 #if defined(KNOWN_SUPPORTED_MAC_ALG)
-    if( ! exercise_mac_setup( KNOWN_SUPPORTED_MAC_KEY_TYPE,
-                              smoke_test_key_data,
-                              sizeof( smoke_test_key_data ),
-                              KNOWN_SUPPORTED_MAC_ALG,
-                              &operation, &status ) )
+    if (!exercise_mac_setup(KNOWN_SUPPORTED_MAC_KEY_TYPE,
+                            smoke_test_key_data,
+                            sizeof(smoke_test_key_data),
+                            KNOWN_SUPPORTED_MAC_ALG,
+                            &operation, &status)) {
         goto exit;
-    TEST_EQUAL( status, PSA_SUCCESS );
+    }
+    TEST_EQUAL(status, PSA_SUCCESS);
 #endif
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:PSA_WANT_KEY_TYPE_HMAC:PSA_WANT_ALG_HMAC:PSA_WANT_ALG_SHA_256 */
-void mac_bad_order( )
+void mac_bad_order()
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = PSA_KEY_TYPE_HMAC;
@@ -1998,7 +2025,8 @@
     const uint8_t key_data[] = {
         0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
         0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
-        0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa };
+        0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa
+    };
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_mac_operation_t operation = PSA_MAC_OPERATION_INIT;
     uint8_t sign_mac[PSA_MAC_MAX_SIZE + 10] = { 0 };
@@ -2007,119 +2035,120 @@
     const uint8_t verify_mac[] = {
         0x74, 0x65, 0x93, 0x8c, 0xeb, 0x1d, 0xb3, 0x76, 0x5a, 0x38, 0xe7, 0xdd,
         0x85, 0xc5, 0xad, 0x4f, 0x07, 0xe7, 0xd5, 0xb2, 0x64, 0xf0, 0x1a, 0x1a,
-        0x2c, 0xf9, 0x18, 0xca, 0x59, 0x7e, 0x5d, 0xf6 };
+        0x2c, 0xf9, 0x18, 0xca, 0x59, 0x7e, 0x5d, 0xf6
+    };
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    PSA_ASSERT(psa_crypto_init());
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data, sizeof( key_data ),
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data, sizeof(key_data),
+                              &key));
 
     /* Call update without calling setup beforehand. */
-    TEST_EQUAL( psa_mac_update( &operation, input, sizeof( input ) ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_mac_abort( &operation ) );
+    TEST_EQUAL(psa_mac_update(&operation, input, sizeof(input)),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_mac_abort(&operation));
 
     /* Call sign finish without calling setup beforehand. */
-    TEST_EQUAL( psa_mac_sign_finish( &operation, sign_mac, sizeof( sign_mac ),
-                                     &sign_mac_length),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_mac_abort( &operation ) );
+    TEST_EQUAL(psa_mac_sign_finish(&operation, sign_mac, sizeof(sign_mac),
+                                   &sign_mac_length),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_mac_abort(&operation));
 
     /* Call verify finish without calling setup beforehand. */
-    TEST_EQUAL( psa_mac_verify_finish( &operation,
-                                       verify_mac, sizeof( verify_mac ) ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_mac_abort( &operation ) );
+    TEST_EQUAL(psa_mac_verify_finish(&operation,
+                                     verify_mac, sizeof(verify_mac)),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_mac_abort(&operation));
 
     /* Call setup twice in a row. */
-    PSA_ASSERT( psa_mac_sign_setup( &operation, key, alg ) );
-    ASSERT_OPERATION_IS_ACTIVE( operation );
-    TEST_EQUAL( psa_mac_sign_setup( &operation, key, alg ),
-                PSA_ERROR_BAD_STATE );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
-    PSA_ASSERT( psa_mac_abort( &operation ) );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
+    PSA_ASSERT(psa_mac_sign_setup(&operation, key, alg));
+    ASSERT_OPERATION_IS_ACTIVE(operation);
+    TEST_EQUAL(psa_mac_sign_setup(&operation, key, alg),
+               PSA_ERROR_BAD_STATE);
+    ASSERT_OPERATION_IS_INACTIVE(operation);
+    PSA_ASSERT(psa_mac_abort(&operation));
+    ASSERT_OPERATION_IS_INACTIVE(operation);
 
     /* Call update after sign finish. */
-    PSA_ASSERT( psa_mac_sign_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_mac_update( &operation, input, sizeof( input ) ) );
-    PSA_ASSERT( psa_mac_sign_finish( &operation,
-                                     sign_mac, sizeof( sign_mac ),
-                                     &sign_mac_length ) );
-    TEST_EQUAL( psa_mac_update( &operation, input, sizeof( input ) ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_mac_abort( &operation ) );
+    PSA_ASSERT(psa_mac_sign_setup(&operation, key, alg));
+    PSA_ASSERT(psa_mac_update(&operation, input, sizeof(input)));
+    PSA_ASSERT(psa_mac_sign_finish(&operation,
+                                   sign_mac, sizeof(sign_mac),
+                                   &sign_mac_length));
+    TEST_EQUAL(psa_mac_update(&operation, input, sizeof(input)),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_mac_abort(&operation));
 
     /* Call update after verify finish. */
-    PSA_ASSERT( psa_mac_verify_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_mac_update( &operation, input, sizeof( input ) ) );
-    PSA_ASSERT( psa_mac_verify_finish( &operation,
-                                       verify_mac, sizeof( verify_mac ) ) );
-    TEST_EQUAL( psa_mac_update( &operation, input, sizeof( input ) ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_mac_abort( &operation ) );
+    PSA_ASSERT(psa_mac_verify_setup(&operation, key, alg));
+    PSA_ASSERT(psa_mac_update(&operation, input, sizeof(input)));
+    PSA_ASSERT(psa_mac_verify_finish(&operation,
+                                     verify_mac, sizeof(verify_mac)));
+    TEST_EQUAL(psa_mac_update(&operation, input, sizeof(input)),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_mac_abort(&operation));
 
     /* Call sign finish twice in a row. */
-    PSA_ASSERT( psa_mac_sign_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_mac_update( &operation, input, sizeof( input ) ) );
-    PSA_ASSERT( psa_mac_sign_finish( &operation,
-                                     sign_mac, sizeof( sign_mac ),
-                                     &sign_mac_length ) );
-    TEST_EQUAL( psa_mac_sign_finish( &operation,
-                                     sign_mac, sizeof( sign_mac ),
-                                     &sign_mac_length ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_mac_abort( &operation ) );
+    PSA_ASSERT(psa_mac_sign_setup(&operation, key, alg));
+    PSA_ASSERT(psa_mac_update(&operation, input, sizeof(input)));
+    PSA_ASSERT(psa_mac_sign_finish(&operation,
+                                   sign_mac, sizeof(sign_mac),
+                                   &sign_mac_length));
+    TEST_EQUAL(psa_mac_sign_finish(&operation,
+                                   sign_mac, sizeof(sign_mac),
+                                   &sign_mac_length),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_mac_abort(&operation));
 
     /* Call verify finish twice in a row. */
-    PSA_ASSERT( psa_mac_verify_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_mac_update( &operation, input, sizeof( input ) ) );
-    PSA_ASSERT( psa_mac_verify_finish( &operation,
-                                       verify_mac, sizeof( verify_mac ) ) );
-    TEST_EQUAL( psa_mac_verify_finish( &operation,
-                                       verify_mac, sizeof( verify_mac ) ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_mac_abort( &operation ) );
+    PSA_ASSERT(psa_mac_verify_setup(&operation, key, alg));
+    PSA_ASSERT(psa_mac_update(&operation, input, sizeof(input)));
+    PSA_ASSERT(psa_mac_verify_finish(&operation,
+                                     verify_mac, sizeof(verify_mac)));
+    TEST_EQUAL(psa_mac_verify_finish(&operation,
+                                     verify_mac, sizeof(verify_mac)),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_mac_abort(&operation));
 
     /* Setup sign but try verify. */
-    PSA_ASSERT( psa_mac_sign_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_mac_update( &operation, input, sizeof( input ) ) );
-    ASSERT_OPERATION_IS_ACTIVE( operation );
-    TEST_EQUAL( psa_mac_verify_finish( &operation,
-                                       verify_mac, sizeof( verify_mac ) ),
-                PSA_ERROR_BAD_STATE );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
-    PSA_ASSERT( psa_mac_abort( &operation ) );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
+    PSA_ASSERT(psa_mac_sign_setup(&operation, key, alg));
+    PSA_ASSERT(psa_mac_update(&operation, input, sizeof(input)));
+    ASSERT_OPERATION_IS_ACTIVE(operation);
+    TEST_EQUAL(psa_mac_verify_finish(&operation,
+                                     verify_mac, sizeof(verify_mac)),
+               PSA_ERROR_BAD_STATE);
+    ASSERT_OPERATION_IS_INACTIVE(operation);
+    PSA_ASSERT(psa_mac_abort(&operation));
+    ASSERT_OPERATION_IS_INACTIVE(operation);
 
     /* Setup verify but try sign. */
-    PSA_ASSERT( psa_mac_verify_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_mac_update( &operation, input, sizeof( input ) ) );
-    ASSERT_OPERATION_IS_ACTIVE( operation );
-    TEST_EQUAL( psa_mac_sign_finish( &operation,
-                                     sign_mac, sizeof( sign_mac ),
-                                     &sign_mac_length ),
-                PSA_ERROR_BAD_STATE );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
-    PSA_ASSERT( psa_mac_abort( &operation ) );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
+    PSA_ASSERT(psa_mac_verify_setup(&operation, key, alg));
+    PSA_ASSERT(psa_mac_update(&operation, input, sizeof(input)));
+    ASSERT_OPERATION_IS_ACTIVE(operation);
+    TEST_EQUAL(psa_mac_sign_finish(&operation,
+                                   sign_mac, sizeof(sign_mac),
+                                   &sign_mac_length),
+               PSA_ERROR_BAD_STATE);
+    ASSERT_OPERATION_IS_INACTIVE(operation);
+    PSA_ASSERT(psa_mac_abort(&operation));
+    ASSERT_OPERATION_IS_INACTIVE(operation);
 
-    PSA_ASSERT( psa_destroy_key( key ) );
+    PSA_ASSERT(psa_destroy_key(key));
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mac_sign( int key_type_arg,
-               data_t *key_data,
-               int alg_arg,
-               data_t *input,
-               data_t *expected_mac )
+void mac_sign(int key_type_arg,
+              data_t *key_data,
+              int alg_arg,
+              data_t *input,
+              data_t *expected_mac)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -2128,7 +2157,7 @@
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     uint8_t *actual_mac = NULL;
     size_t mac_buffer_size =
-        PSA_MAC_LENGTH( key_type, PSA_BYTES_TO_BITS( key_data->len ), alg );
+        PSA_MAC_LENGTH(key_type, PSA_BYTES_TO_BITS(key_data->len), alg);
     size_t mac_length = 0;
     const size_t output_sizes_to_test[] = {
         0,
@@ -2138,76 +2167,74 @@
         expected_mac->len + 1,
     };
 
-    TEST_LE_U( mac_buffer_size, PSA_MAC_MAX_SIZE );
+    TEST_LE_U(mac_buffer_size, PSA_MAC_MAX_SIZE);
     /* We expect PSA_MAC_LENGTH to be exact. */
-    TEST_ASSERT( expected_mac->len == mac_buffer_size );
+    TEST_ASSERT(expected_mac->len == mac_buffer_size);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    for( size_t i = 0; i < ARRAY_LENGTH( output_sizes_to_test ); i++ )
-    {
+    for (size_t i = 0; i < ARRAY_LENGTH(output_sizes_to_test); i++) {
         const size_t output_size = output_sizes_to_test[i];
         psa_status_t expected_status =
-            ( output_size >= expected_mac->len ? PSA_SUCCESS :
-              PSA_ERROR_BUFFER_TOO_SMALL );
+            (output_size >= expected_mac->len ? PSA_SUCCESS :
+             PSA_ERROR_BUFFER_TOO_SMALL);
 
-        mbedtls_test_set_step( output_size );
-        ASSERT_ALLOC( actual_mac, output_size );
+        mbedtls_test_set_step(output_size);
+        ASSERT_ALLOC(actual_mac, output_size);
 
         /* Calculate the MAC, one-shot case. */
-        TEST_EQUAL( psa_mac_compute( key, alg,
-                                     input->x, input->len,
-                                     actual_mac, output_size, &mac_length ),
-                    expected_status );
-        if( expected_status == PSA_SUCCESS )
-        {
-            ASSERT_COMPARE( expected_mac->x, expected_mac->len,
-                            actual_mac, mac_length );
+        TEST_EQUAL(psa_mac_compute(key, alg,
+                                   input->x, input->len,
+                                   actual_mac, output_size, &mac_length),
+                   expected_status);
+        if (expected_status == PSA_SUCCESS) {
+            ASSERT_COMPARE(expected_mac->x, expected_mac->len,
+                           actual_mac, mac_length);
         }
 
-        if( output_size > 0 )
-            memset( actual_mac, 0, output_size );
+        if (output_size > 0) {
+            memset(actual_mac, 0, output_size);
+        }
 
         /* Calculate the MAC, multi-part case. */
-        PSA_ASSERT( psa_mac_sign_setup( &operation, key, alg ) );
-        PSA_ASSERT( psa_mac_update( &operation,
-                                    input->x, input->len ) );
-        TEST_EQUAL( psa_mac_sign_finish( &operation,
-                                         actual_mac, output_size,
-                                         &mac_length ),
-                    expected_status );
-        PSA_ASSERT( psa_mac_abort( &operation ) );
+        PSA_ASSERT(psa_mac_sign_setup(&operation, key, alg));
+        PSA_ASSERT(psa_mac_update(&operation,
+                                  input->x, input->len));
+        TEST_EQUAL(psa_mac_sign_finish(&operation,
+                                       actual_mac, output_size,
+                                       &mac_length),
+                   expected_status);
+        PSA_ASSERT(psa_mac_abort(&operation));
 
-        if( expected_status == PSA_SUCCESS )
-        {
-            ASSERT_COMPARE( expected_mac->x, expected_mac->len,
-                            actual_mac, mac_length );
+        if (expected_status == PSA_SUCCESS) {
+            ASSERT_COMPARE(expected_mac->x, expected_mac->len,
+                           actual_mac, mac_length);
         }
-        mbedtls_free( actual_mac );
+        mbedtls_free(actual_mac);
         actual_mac = NULL;
     }
 
 exit:
-    psa_mac_abort( &operation );
-    psa_destroy_key( key );
-    PSA_DONE( );
-    mbedtls_free( actual_mac );
+    psa_mac_abort(&operation);
+    psa_destroy_key(key);
+    PSA_DONE();
+    mbedtls_free(actual_mac);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mac_verify( int key_type_arg,
-                 data_t *key_data,
-                 int alg_arg,
-                 data_t *input,
-                 data_t *expected_mac )
+void mac_verify(int key_type_arg,
+                data_t *key_data,
+                int alg_arg,
+                data_t *input,
+                data_t *expected_mac)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -2216,93 +2243,92 @@
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     uint8_t *perturbed_mac = NULL;
 
-    TEST_LE_U( expected_mac->len, PSA_MAC_MAX_SIZE );
+    TEST_LE_U(expected_mac->len, PSA_MAC_MAX_SIZE);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_VERIFY_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_VERIFY_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
     /* Verify correct MAC, one-shot case. */
-    PSA_ASSERT( psa_mac_verify( key, alg, input->x, input->len,
-                                expected_mac->x, expected_mac->len ) );
+    PSA_ASSERT(psa_mac_verify(key, alg, input->x, input->len,
+                              expected_mac->x, expected_mac->len));
 
     /* Verify correct MAC, multi-part case. */
-    PSA_ASSERT( psa_mac_verify_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_mac_update( &operation,
-                                input->x, input->len ) );
-    PSA_ASSERT( psa_mac_verify_finish( &operation,
-                                       expected_mac->x,
-                                       expected_mac->len ) );
+    PSA_ASSERT(psa_mac_verify_setup(&operation, key, alg));
+    PSA_ASSERT(psa_mac_update(&operation,
+                              input->x, input->len));
+    PSA_ASSERT(psa_mac_verify_finish(&operation,
+                                     expected_mac->x,
+                                     expected_mac->len));
 
     /* Test a MAC that's too short, one-shot case. */
-    TEST_EQUAL( psa_mac_verify( key, alg,
-                                input->x, input->len,
-                                expected_mac->x,
-                                expected_mac->len - 1 ),
-                PSA_ERROR_INVALID_SIGNATURE );
+    TEST_EQUAL(psa_mac_verify(key, alg,
+                              input->x, input->len,
+                              expected_mac->x,
+                              expected_mac->len - 1),
+               PSA_ERROR_INVALID_SIGNATURE);
 
     /* Test a MAC that's too short, multi-part case. */
-    PSA_ASSERT( psa_mac_verify_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_mac_update( &operation,
-                                input->x, input->len ) );
-    TEST_EQUAL( psa_mac_verify_finish( &operation,
-                                       expected_mac->x,
-                                       expected_mac->len - 1 ),
-                PSA_ERROR_INVALID_SIGNATURE );
+    PSA_ASSERT(psa_mac_verify_setup(&operation, key, alg));
+    PSA_ASSERT(psa_mac_update(&operation,
+                              input->x, input->len));
+    TEST_EQUAL(psa_mac_verify_finish(&operation,
+                                     expected_mac->x,
+                                     expected_mac->len - 1),
+               PSA_ERROR_INVALID_SIGNATURE);
 
     /* Test a MAC that's too long, one-shot case. */
-    ASSERT_ALLOC( perturbed_mac, expected_mac->len + 1 );
-    memcpy( perturbed_mac, expected_mac->x, expected_mac->len );
-    TEST_EQUAL( psa_mac_verify( key, alg,
-                                input->x, input->len,
-                                 perturbed_mac, expected_mac->len + 1 ),
-                PSA_ERROR_INVALID_SIGNATURE );
+    ASSERT_ALLOC(perturbed_mac, expected_mac->len + 1);
+    memcpy(perturbed_mac, expected_mac->x, expected_mac->len);
+    TEST_EQUAL(psa_mac_verify(key, alg,
+                              input->x, input->len,
+                              perturbed_mac, expected_mac->len + 1),
+               PSA_ERROR_INVALID_SIGNATURE);
 
     /* Test a MAC that's too long, multi-part case. */
-    PSA_ASSERT( psa_mac_verify_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_mac_update( &operation,
-                                input->x, input->len ) );
-    TEST_EQUAL( psa_mac_verify_finish( &operation,
-                                       perturbed_mac,
-                                       expected_mac->len + 1 ),
-                PSA_ERROR_INVALID_SIGNATURE );
+    PSA_ASSERT(psa_mac_verify_setup(&operation, key, alg));
+    PSA_ASSERT(psa_mac_update(&operation,
+                              input->x, input->len));
+    TEST_EQUAL(psa_mac_verify_finish(&operation,
+                                     perturbed_mac,
+                                     expected_mac->len + 1),
+               PSA_ERROR_INVALID_SIGNATURE);
 
     /* Test changing one byte. */
-    for( size_t i = 0; i < expected_mac->len; i++ )
-    {
-        mbedtls_test_set_step( i );
+    for (size_t i = 0; i < expected_mac->len; i++) {
+        mbedtls_test_set_step(i);
         perturbed_mac[i] ^= 1;
 
-        TEST_EQUAL( psa_mac_verify( key, alg,
-                                    input->x, input->len,
-                                    perturbed_mac, expected_mac->len ),
-                    PSA_ERROR_INVALID_SIGNATURE );
+        TEST_EQUAL(psa_mac_verify(key, alg,
+                                  input->x, input->len,
+                                  perturbed_mac, expected_mac->len),
+                   PSA_ERROR_INVALID_SIGNATURE);
 
-        PSA_ASSERT( psa_mac_verify_setup( &operation, key, alg ) );
-        PSA_ASSERT( psa_mac_update( &operation,
-                                    input->x, input->len ) );
-        TEST_EQUAL( psa_mac_verify_finish( &operation,
-                                           perturbed_mac,
-                                           expected_mac->len ),
-                    PSA_ERROR_INVALID_SIGNATURE );
+        PSA_ASSERT(psa_mac_verify_setup(&operation, key, alg));
+        PSA_ASSERT(psa_mac_update(&operation,
+                                  input->x, input->len));
+        TEST_EQUAL(psa_mac_verify_finish(&operation,
+                                         perturbed_mac,
+                                         expected_mac->len),
+                   PSA_ERROR_INVALID_SIGNATURE);
         perturbed_mac[i] ^= 1;
     }
 
 exit:
-    psa_mac_abort( &operation );
-    psa_destroy_key( key );
-    PSA_DONE( );
-    mbedtls_free( perturbed_mac );
+    psa_mac_abort(&operation);
+    psa_destroy_key(key);
+    PSA_DONE();
+    mbedtls_free(perturbed_mac);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_operation_init( )
+void cipher_operation_init()
 {
     const uint8_t input[1] = { 0 };
     unsigned char output[1] = { 0 };
@@ -2311,41 +2337,41 @@
      * Clang 5 complains when `-Wmissing-field-initializers` is used, even
      * though it's OK by the C standard. We could test for this, but we'd need
      * to suppress the Clang warning for the test. */
-    psa_cipher_operation_t func = psa_cipher_operation_init( );
+    psa_cipher_operation_t func = psa_cipher_operation_init();
     psa_cipher_operation_t init = PSA_CIPHER_OPERATION_INIT;
     psa_cipher_operation_t zero;
 
-    memset( &zero, 0, sizeof( zero ) );
+    memset(&zero, 0, sizeof(zero));
 
     /* A freshly-initialized cipher operation should not be usable. */
-    TEST_EQUAL( psa_cipher_update( &func,
-                                   input, sizeof( input ),
-                                   output, sizeof( output ),
-                                   &output_length ),
-                PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( psa_cipher_update( &init,
-                                   input, sizeof( input ),
-                                   output, sizeof( output ),
-                                   &output_length ),
-                PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( psa_cipher_update( &zero,
-                                   input, sizeof( input ),
-                                   output, sizeof( output ),
-                                   &output_length ),
-                PSA_ERROR_BAD_STATE );
+    TEST_EQUAL(psa_cipher_update(&func,
+                                 input, sizeof(input),
+                                 output, sizeof(output),
+                                 &output_length),
+               PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(psa_cipher_update(&init,
+                                 input, sizeof(input),
+                                 output, sizeof(output),
+                                 &output_length),
+               PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(psa_cipher_update(&zero,
+                                 input, sizeof(input),
+                                 output, sizeof(output),
+                                 &output_length),
+               PSA_ERROR_BAD_STATE);
 
     /* A default cipher operation should be abortable without error. */
-    PSA_ASSERT( psa_cipher_abort( &func ) );
-    PSA_ASSERT( psa_cipher_abort( &init ) );
-    PSA_ASSERT( psa_cipher_abort( &zero ) );
+    PSA_ASSERT(psa_cipher_abort(&func));
+    PSA_ASSERT(psa_cipher_abort(&init));
+    PSA_ASSERT(psa_cipher_abort(&zero));
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_setup( int key_type_arg,
-                   data_t *key,
-                   int alg_arg,
-                   int expected_status_arg )
+void cipher_setup(int key_type_arg,
+                  data_t *key,
+                  int alg_arg,
+                  int expected_status_arg)
 {
     psa_key_type_t key_type = key_type_arg;
     psa_algorithm_t alg = alg_arg;
@@ -2356,32 +2382,34 @@
     const uint8_t smoke_test_key_data[16] = "kkkkkkkkkkkkkkkk";
 #endif
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    if( ! exercise_cipher_setup( key_type, key->x, key->len, alg,
-                                 &operation, &status ) )
+    if (!exercise_cipher_setup(key_type, key->x, key->len, alg,
+                               &operation, &status)) {
         goto exit;
-    TEST_EQUAL( status, expected_status );
+    }
+    TEST_EQUAL(status, expected_status);
 
     /* The operation object should be reusable. */
 #if defined(KNOWN_SUPPORTED_CIPHER_ALG)
-    if( ! exercise_cipher_setup( KNOWN_SUPPORTED_CIPHER_KEY_TYPE,
-                                 smoke_test_key_data,
-                                 sizeof( smoke_test_key_data ),
-                                 KNOWN_SUPPORTED_CIPHER_ALG,
-                                 &operation, &status ) )
+    if (!exercise_cipher_setup(KNOWN_SUPPORTED_CIPHER_KEY_TYPE,
+                               smoke_test_key_data,
+                               sizeof(smoke_test_key_data),
+                               KNOWN_SUPPORTED_CIPHER_ALG,
+                               &operation, &status)) {
         goto exit;
-    TEST_EQUAL( status, PSA_SUCCESS );
+    }
+    TEST_EQUAL(status, PSA_SUCCESS);
 #endif
 
 exit:
-    psa_cipher_abort( &operation );
-    PSA_DONE( );
+    psa_cipher_abort(&operation);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:PSA_WANT_KEY_TYPE_AES:PSA_WANT_ALG_CBC_PKCS7 */
-void cipher_bad_order( )
+void cipher_bad_order()
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = PSA_KEY_TYPE_AES;
@@ -2391,173 +2419,175 @@
     unsigned char iv[PSA_BLOCK_CIPHER_BLOCK_LENGTH(PSA_KEY_TYPE_AES)] = { 0 };
     const uint8_t key_data[] = {
         0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
-        0xaa, 0xaa, 0xaa, 0xaa };
+        0xaa, 0xaa, 0xaa, 0xaa
+    };
     const uint8_t text[] = {
         0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb,
-        0xbb, 0xbb, 0xbb, 0xbb };
+        0xbb, 0xbb, 0xbb, 0xbb
+    };
     uint8_t buffer[PSA_BLOCK_CIPHER_BLOCK_LENGTH(PSA_KEY_TYPE_AES)] = { 0 };
     size_t length = 0;
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
-    PSA_ASSERT( psa_import_key( &attributes, key_data, sizeof( key_data ),
-                                &key ) );
+    PSA_ASSERT(psa_crypto_init());
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
+    PSA_ASSERT(psa_import_key(&attributes, key_data, sizeof(key_data),
+                              &key));
 
     /* Call encrypt setup twice in a row. */
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-    ASSERT_OPERATION_IS_ACTIVE( operation );
-    TEST_EQUAL( psa_cipher_encrypt_setup( &operation, key, alg ),
-                PSA_ERROR_BAD_STATE );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+    ASSERT_OPERATION_IS_ACTIVE(operation);
+    TEST_EQUAL(psa_cipher_encrypt_setup(&operation, key, alg),
+               PSA_ERROR_BAD_STATE);
+    ASSERT_OPERATION_IS_INACTIVE(operation);
+    PSA_ASSERT(psa_cipher_abort(&operation));
+    ASSERT_OPERATION_IS_INACTIVE(operation);
 
     /* Call decrypt setup twice in a row. */
-    PSA_ASSERT( psa_cipher_decrypt_setup( &operation, key, alg ) );
-    ASSERT_OPERATION_IS_ACTIVE( operation );
-    TEST_EQUAL( psa_cipher_decrypt_setup( &operation, key, alg ),
-                PSA_ERROR_BAD_STATE );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
+    PSA_ASSERT(psa_cipher_decrypt_setup(&operation, key, alg));
+    ASSERT_OPERATION_IS_ACTIVE(operation);
+    TEST_EQUAL(psa_cipher_decrypt_setup(&operation, key, alg),
+               PSA_ERROR_BAD_STATE);
+    ASSERT_OPERATION_IS_INACTIVE(operation);
+    PSA_ASSERT(psa_cipher_abort(&operation));
+    ASSERT_OPERATION_IS_INACTIVE(operation);
 
     /* Generate an IV without calling setup beforehand. */
-    TEST_EQUAL( psa_cipher_generate_iv( &operation,
-                                        buffer, sizeof( buffer ),
-                                        &length ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
+    TEST_EQUAL(psa_cipher_generate_iv(&operation,
+                                      buffer, sizeof(buffer),
+                                      &length),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_cipher_abort(&operation));
 
     /* Generate an IV twice in a row. */
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_cipher_generate_iv( &operation,
-                                        buffer, sizeof( buffer ),
-                                        &length ) );
-    ASSERT_OPERATION_IS_ACTIVE( operation );
-    TEST_EQUAL( psa_cipher_generate_iv( &operation,
-                                        buffer, sizeof( buffer ),
-                                        &length ),
-                PSA_ERROR_BAD_STATE );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+    PSA_ASSERT(psa_cipher_generate_iv(&operation,
+                                      buffer, sizeof(buffer),
+                                      &length));
+    ASSERT_OPERATION_IS_ACTIVE(operation);
+    TEST_EQUAL(psa_cipher_generate_iv(&operation,
+                                      buffer, sizeof(buffer),
+                                      &length),
+               PSA_ERROR_BAD_STATE);
+    ASSERT_OPERATION_IS_INACTIVE(operation);
+    PSA_ASSERT(psa_cipher_abort(&operation));
+    ASSERT_OPERATION_IS_INACTIVE(operation);
 
     /* Generate an IV after it's already set. */
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_cipher_set_iv( &operation,
-                                   iv, sizeof( iv ) ) );
-    TEST_EQUAL( psa_cipher_generate_iv( &operation,
-                                        buffer, sizeof( buffer ),
-                                        &length ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+    PSA_ASSERT(psa_cipher_set_iv(&operation,
+                                 iv, sizeof(iv)));
+    TEST_EQUAL(psa_cipher_generate_iv(&operation,
+                                      buffer, sizeof(buffer),
+                                      &length),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_cipher_abort(&operation));
 
     /* Set an IV without calling setup beforehand. */
-    TEST_EQUAL( psa_cipher_set_iv( &operation,
-                                   iv, sizeof( iv ) ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
+    TEST_EQUAL(psa_cipher_set_iv(&operation,
+                                 iv, sizeof(iv)),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_cipher_abort(&operation));
 
     /* Set an IV after it's already set. */
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_cipher_set_iv( &operation,
-                                   iv, sizeof( iv ) ) );
-    ASSERT_OPERATION_IS_ACTIVE( operation );
-    TEST_EQUAL( psa_cipher_set_iv( &operation,
-                                   iv, sizeof( iv ) ),
-                PSA_ERROR_BAD_STATE );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+    PSA_ASSERT(psa_cipher_set_iv(&operation,
+                                 iv, sizeof(iv)));
+    ASSERT_OPERATION_IS_ACTIVE(operation);
+    TEST_EQUAL(psa_cipher_set_iv(&operation,
+                                 iv, sizeof(iv)),
+               PSA_ERROR_BAD_STATE);
+    ASSERT_OPERATION_IS_INACTIVE(operation);
+    PSA_ASSERT(psa_cipher_abort(&operation));
+    ASSERT_OPERATION_IS_INACTIVE(operation);
 
     /* Set an IV after it's already generated. */
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_cipher_generate_iv( &operation,
-                                        buffer, sizeof( buffer ),
-                                        &length ) );
-    TEST_EQUAL( psa_cipher_set_iv( &operation,
-                                   iv, sizeof( iv ) ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+    PSA_ASSERT(psa_cipher_generate_iv(&operation,
+                                      buffer, sizeof(buffer),
+                                      &length));
+    TEST_EQUAL(psa_cipher_set_iv(&operation,
+                                 iv, sizeof(iv)),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_cipher_abort(&operation));
 
     /* Call update without calling setup beforehand. */
-    TEST_EQUAL( psa_cipher_update( &operation,
-                                   text, sizeof( text ),
-                                   buffer, sizeof( buffer ),
-                                   &length ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
+    TEST_EQUAL(psa_cipher_update(&operation,
+                                 text, sizeof(text),
+                                 buffer, sizeof(buffer),
+                                 &length),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_cipher_abort(&operation));
 
     /* Call update without an IV where an IV is required. */
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-    ASSERT_OPERATION_IS_ACTIVE( operation );
-    TEST_EQUAL( psa_cipher_update( &operation,
-                                   text, sizeof( text ),
-                                   buffer, sizeof( buffer ),
-                                   &length ),
-                PSA_ERROR_BAD_STATE );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+    ASSERT_OPERATION_IS_ACTIVE(operation);
+    TEST_EQUAL(psa_cipher_update(&operation,
+                                 text, sizeof(text),
+                                 buffer, sizeof(buffer),
+                                 &length),
+               PSA_ERROR_BAD_STATE);
+    ASSERT_OPERATION_IS_INACTIVE(operation);
+    PSA_ASSERT(psa_cipher_abort(&operation));
+    ASSERT_OPERATION_IS_INACTIVE(operation);
 
     /* Call update after finish. */
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_cipher_set_iv( &operation,
-                                   iv, sizeof( iv ) ) );
-    PSA_ASSERT( psa_cipher_finish( &operation,
-                                   buffer, sizeof( buffer ), &length ) );
-    TEST_EQUAL( psa_cipher_update( &operation,
-                                   text, sizeof( text ),
-                                   buffer, sizeof( buffer ),
-                                   &length ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+    PSA_ASSERT(psa_cipher_set_iv(&operation,
+                                 iv, sizeof(iv)));
+    PSA_ASSERT(psa_cipher_finish(&operation,
+                                 buffer, sizeof(buffer), &length));
+    TEST_EQUAL(psa_cipher_update(&operation,
+                                 text, sizeof(text),
+                                 buffer, sizeof(buffer),
+                                 &length),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_cipher_abort(&operation));
 
     /* Call finish without calling setup beforehand. */
-    TEST_EQUAL( psa_cipher_finish( &operation,
-                                   buffer, sizeof( buffer ), &length ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
+    TEST_EQUAL(psa_cipher_finish(&operation,
+                                 buffer, sizeof(buffer), &length),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_cipher_abort(&operation));
 
     /* Call finish without an IV where an IV is required. */
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
     /* Not calling update means we are encrypting an empty buffer, which is OK
      * for cipher modes with padding. */
-    ASSERT_OPERATION_IS_ACTIVE( operation );
-    TEST_EQUAL( psa_cipher_finish( &operation,
-                                   buffer, sizeof( buffer ), &length ),
-                PSA_ERROR_BAD_STATE );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
-    ASSERT_OPERATION_IS_INACTIVE( operation );
+    ASSERT_OPERATION_IS_ACTIVE(operation);
+    TEST_EQUAL(psa_cipher_finish(&operation,
+                                 buffer, sizeof(buffer), &length),
+               PSA_ERROR_BAD_STATE);
+    ASSERT_OPERATION_IS_INACTIVE(operation);
+    PSA_ASSERT(psa_cipher_abort(&operation));
+    ASSERT_OPERATION_IS_INACTIVE(operation);
 
     /* Call finish twice in a row. */
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_cipher_set_iv( &operation,
-                                   iv, sizeof( iv ) ) );
-    PSA_ASSERT( psa_cipher_finish( &operation,
-                                   buffer, sizeof( buffer ), &length ) );
-    TEST_EQUAL( psa_cipher_finish( &operation,
-                                   buffer, sizeof( buffer ), &length ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+    PSA_ASSERT(psa_cipher_set_iv(&operation,
+                                 iv, sizeof(iv)));
+    PSA_ASSERT(psa_cipher_finish(&operation,
+                                 buffer, sizeof(buffer), &length));
+    TEST_EQUAL(psa_cipher_finish(&operation,
+                                 buffer, sizeof(buffer), &length),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_cipher_abort(&operation));
 
-    PSA_ASSERT( psa_destroy_key( key ) );
+    PSA_ASSERT(psa_destroy_key(key));
 
 exit:
-    psa_cipher_abort( &operation );
-    PSA_DONE( );
+    psa_cipher_abort(&operation);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_encrypt_fail( int alg_arg,
-                          int key_type_arg,
-                          data_t *key_data,
-                          data_t *input,
-                          int expected_status_arg )
+void cipher_encrypt_fail(int alg_arg,
+                         int key_type_arg,
+                         data_t *key_data,
+                         data_t *input,
+                         int expected_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_status_t status;
@@ -2569,37 +2599,36 @@
     size_t output_length = 0;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    if ( PSA_ERROR_BAD_STATE != expected_status )
-    {
-        PSA_ASSERT( psa_crypto_init( ) );
+    if (PSA_ERROR_BAD_STATE != expected_status) {
+        PSA_ASSERT(psa_crypto_init());
 
-        psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
-        psa_set_key_algorithm( &attributes, alg );
-        psa_set_key_type( &attributes, key_type );
+        psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT);
+        psa_set_key_algorithm(&attributes, alg);
+        psa_set_key_type(&attributes, key_type);
 
-        output_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg,
-                                                             input->len );
-        ASSERT_ALLOC( output, output_buffer_size );
+        output_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg,
+                                                            input->len);
+        ASSERT_ALLOC(output, output_buffer_size);
 
-        PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                    &key ) );
+        PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                                  &key));
     }
 
-    status = psa_cipher_encrypt( key, alg, input->x, input->len, output,
-                                 output_buffer_size, &output_length );
+    status = psa_cipher_encrypt(key, alg, input->x, input->len, output,
+                                output_buffer_size, &output_length);
 
-    TEST_EQUAL( status, expected_status );
+    TEST_EQUAL(status, expected_status);
 
 exit:
-    mbedtls_free( output );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    mbedtls_free(output);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_alg_without_iv( int alg_arg, int key_type_arg, data_t *key_data,
-                            data_t *plaintext, data_t *ciphertext )
+void cipher_alg_without_iv(int alg_arg, int key_type_arg, data_t *key_data,
+                           data_t *plaintext, data_t *ciphertext)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -2611,110 +2640,110 @@
     size_t output_length, length;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Validate size macros */
-    TEST_LE_U( ciphertext->len,
-               PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, plaintext->len ) );
-    TEST_LE_U( PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, plaintext->len ),
-                 PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE( plaintext->len ) );
-    TEST_LE_U( plaintext->len,
-               PSA_CIPHER_DECRYPT_OUTPUT_SIZE( key_type, alg, ciphertext->len ) );
-    TEST_LE_U( PSA_CIPHER_DECRYPT_OUTPUT_SIZE( key_type, alg, ciphertext->len ),
-               PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE( ciphertext->len ) );
+    TEST_LE_U(ciphertext->len,
+              PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, plaintext->len));
+    TEST_LE_U(PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, plaintext->len),
+              PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(plaintext->len));
+    TEST_LE_U(plaintext->len,
+              PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, ciphertext->len));
+    TEST_LE_U(PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, ciphertext->len),
+              PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE(ciphertext->len));
 
 
     /* Set up key and output buffer */
-    psa_set_key_usage_flags( &attributes,
-                             PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-    output_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg,
-                                                         plaintext->len );
-    ASSERT_ALLOC( output, output_buffer_size );
+    psa_set_key_usage_flags(&attributes,
+                            PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+    output_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg,
+                                                        plaintext->len);
+    ASSERT_ALLOC(output, output_buffer_size);
 
     /* set_iv() is not allowed */
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-    TEST_EQUAL( psa_cipher_set_iv( &operation, iv, sizeof( iv ) ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_cipher_decrypt_setup( &operation, key, alg ) );
-    TEST_EQUAL( psa_cipher_set_iv( &operation, iv, sizeof( iv ) ),
-                PSA_ERROR_BAD_STATE );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+    TEST_EQUAL(psa_cipher_set_iv(&operation, iv, sizeof(iv)),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_cipher_decrypt_setup(&operation, key, alg));
+    TEST_EQUAL(psa_cipher_set_iv(&operation, iv, sizeof(iv)),
+               PSA_ERROR_BAD_STATE);
 
     /* generate_iv() is not allowed */
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-    TEST_EQUAL( psa_cipher_generate_iv( &operation, iv, sizeof( iv ),
-                                        &length ),
-                PSA_ERROR_BAD_STATE );
-    PSA_ASSERT( psa_cipher_decrypt_setup( &operation, key, alg ) );
-    TEST_EQUAL( psa_cipher_generate_iv( &operation, iv, sizeof( iv ),
-                                        &length ),
-                PSA_ERROR_BAD_STATE );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+    TEST_EQUAL(psa_cipher_generate_iv(&operation, iv, sizeof(iv),
+                                      &length),
+               PSA_ERROR_BAD_STATE);
+    PSA_ASSERT(psa_cipher_decrypt_setup(&operation, key, alg));
+    TEST_EQUAL(psa_cipher_generate_iv(&operation, iv, sizeof(iv),
+                                      &length),
+               PSA_ERROR_BAD_STATE);
 
     /* Multipart encryption */
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
     output_length = 0;
     length = ~0;
-    PSA_ASSERT( psa_cipher_update( &operation,
-                                   plaintext->x, plaintext->len,
-                                   output, output_buffer_size,
-                                   &length ) );
-    TEST_LE_U( length, output_buffer_size );
+    PSA_ASSERT(psa_cipher_update(&operation,
+                                 plaintext->x, plaintext->len,
+                                 output, output_buffer_size,
+                                 &length));
+    TEST_LE_U(length, output_buffer_size);
     output_length += length;
-    PSA_ASSERT( psa_cipher_finish( &operation,
-                                   mbedtls_buffer_offset( output, output_length ),
-                                   output_buffer_size - output_length,
-                                   &length ) );
+    PSA_ASSERT(psa_cipher_finish(&operation,
+                                 mbedtls_buffer_offset(output, output_length),
+                                 output_buffer_size - output_length,
+                                 &length));
     output_length += length;
-    ASSERT_COMPARE( ciphertext->x, ciphertext->len,
-                    output, output_length );
+    ASSERT_COMPARE(ciphertext->x, ciphertext->len,
+                   output, output_length);
 
     /* Multipart encryption */
-    PSA_ASSERT( psa_cipher_decrypt_setup( &operation, key, alg ) );
+    PSA_ASSERT(psa_cipher_decrypt_setup(&operation, key, alg));
     output_length = 0;
     length = ~0;
-    PSA_ASSERT( psa_cipher_update( &operation,
-                                   ciphertext->x, ciphertext->len,
-                                   output, output_buffer_size,
-                                   &length ) );
-    TEST_LE_U( length, output_buffer_size );
+    PSA_ASSERT(psa_cipher_update(&operation,
+                                 ciphertext->x, ciphertext->len,
+                                 output, output_buffer_size,
+                                 &length));
+    TEST_LE_U(length, output_buffer_size);
     output_length += length;
-    PSA_ASSERT( psa_cipher_finish( &operation,
-                                   mbedtls_buffer_offset( output, output_length ),
-                                   output_buffer_size - output_length,
-                                   &length ) );
+    PSA_ASSERT(psa_cipher_finish(&operation,
+                                 mbedtls_buffer_offset(output, output_length),
+                                 output_buffer_size - output_length,
+                                 &length));
     output_length += length;
-    ASSERT_COMPARE( plaintext->x, plaintext->len,
-                    output, output_length );
+    ASSERT_COMPARE(plaintext->x, plaintext->len,
+                   output, output_length);
 
     /* One-shot encryption */
     output_length = ~0;
-    PSA_ASSERT( psa_cipher_encrypt( key, alg, plaintext->x, plaintext->len,
-                                    output, output_buffer_size,
-                                    &output_length ) );
-    ASSERT_COMPARE( ciphertext->x, ciphertext->len,
-                    output, output_length );
+    PSA_ASSERT(psa_cipher_encrypt(key, alg, plaintext->x, plaintext->len,
+                                  output, output_buffer_size,
+                                  &output_length));
+    ASSERT_COMPARE(ciphertext->x, ciphertext->len,
+                   output, output_length);
 
     /* One-shot decryption */
     output_length = ~0;
-    PSA_ASSERT( psa_cipher_decrypt( key, alg, ciphertext->x, ciphertext->len,
-                                    output, output_buffer_size,
-                                    &output_length ) );
-    ASSERT_COMPARE( plaintext->x, plaintext->len,
-                    output, output_length );
+    PSA_ASSERT(psa_cipher_decrypt(key, alg, ciphertext->x, ciphertext->len,
+                                  output, output_buffer_size,
+                                  &output_length));
+    ASSERT_COMPARE(plaintext->x, plaintext->len,
+                   output, output_length);
 
 exit:
-    mbedtls_free( output );
-    psa_cipher_abort( &operation );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    mbedtls_free(output);
+    psa_cipher_abort(&operation);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_bad_key( int alg_arg, int key_type_arg, data_t *key_data )
+void cipher_bad_key(int alg_arg, int key_type_arg, data_t *key_data)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_algorithm_t alg = alg_arg;
@@ -2723,46 +2752,46 @@
     psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT;
     psa_status_t status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
     /* Usage of either of these two size macros would cause divide by zero
      * with incorrect key types previously. Input length should be irrelevant
      * here. */
-    TEST_EQUAL( PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, 16 ),
-                0 );
-    TEST_EQUAL( PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, 16 ), 0 );
+    TEST_EQUAL(PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, 16),
+               0);
+    TEST_EQUAL(PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, 16), 0);
 
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
     /* Should fail due to invalid alg type (to support invalid key type).
      * Encrypt or decrypt will end up in the same place. */
-    status = psa_cipher_encrypt_setup( &operation, key, alg );
+    status = psa_cipher_encrypt_setup(&operation, key, alg);
 
-    TEST_EQUAL( status, PSA_ERROR_INVALID_ARGUMENT );
+    TEST_EQUAL(status, PSA_ERROR_INVALID_ARGUMENT);
 
 exit:
-    psa_cipher_abort( &operation );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_cipher_abort(&operation);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_encrypt_validation( int alg_arg,
-                                int key_type_arg,
-                                data_t *key_data,
-                                data_t *input )
+void cipher_encrypt_validation(int alg_arg,
+                               int key_type_arg,
+                               data_t *key_data,
+                               data_t *input)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
     psa_algorithm_t alg = alg_arg;
-    size_t iv_size = PSA_CIPHER_IV_LENGTH ( key_type, alg );
+    size_t iv_size = PSA_CIPHER_IV_LENGTH(key_type, alg);
     unsigned char *output1 = NULL;
     size_t output1_buffer_size = 0;
     size_t output1_length = 0;
@@ -2773,74 +2802,74 @@
     psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    output1_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, input->len );
-    output2_buffer_size = PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, input->len ) +
-                          PSA_CIPHER_FINISH_OUTPUT_SIZE( key_type, alg );
-    ASSERT_ALLOC( output1, output1_buffer_size );
-    ASSERT_ALLOC( output2, output2_buffer_size );
+    output1_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input->len);
+    output2_buffer_size = PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input->len) +
+                          PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg);
+    ASSERT_ALLOC(output1, output1_buffer_size);
+    ASSERT_ALLOC(output2, output2_buffer_size);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
     /* The one-shot cipher encryption uses generated iv so validating
        the output is not possible. Validating with multipart encryption. */
-    PSA_ASSERT( psa_cipher_encrypt( key, alg, input->x, input->len, output1,
-                                    output1_buffer_size, &output1_length ) );
-    TEST_LE_U( output1_length,
-               PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, input->len ) );
-    TEST_LE_U( output1_length,
-               PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE( input->len ) );
+    PSA_ASSERT(psa_cipher_encrypt(key, alg, input->x, input->len, output1,
+                                  output1_buffer_size, &output1_length));
+    TEST_LE_U(output1_length,
+              PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input->len));
+    TEST_LE_U(output1_length,
+              PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(input->len));
 
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-    PSA_ASSERT( psa_cipher_set_iv( &operation, output1, iv_size ) );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+    PSA_ASSERT(psa_cipher_set_iv(&operation, output1, iv_size));
 
-    PSA_ASSERT( psa_cipher_update( &operation,
-                                   input->x, input->len,
-                                   output2, output2_buffer_size,
-                                   &function_output_length ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, input->len ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE( input->len ) );
+    PSA_ASSERT(psa_cipher_update(&operation,
+                                 input->x, input->len,
+                                 output2, output2_buffer_size,
+                                 &function_output_length));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input->len));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(input->len));
     output2_length += function_output_length;
 
-    PSA_ASSERT( psa_cipher_finish( &operation,
-                                   output2 + output2_length,
-                                   output2_buffer_size - output2_length,
-                                   &function_output_length ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_FINISH_OUTPUT_SIZE( key_type, alg ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE );
+    PSA_ASSERT(psa_cipher_finish(&operation,
+                                 output2 + output2_length,
+                                 output2_buffer_size - output2_length,
+                                 &function_output_length));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE);
     output2_length += function_output_length;
 
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
-    ASSERT_COMPARE( output1 + iv_size, output1_length - iv_size,
-                    output2, output2_length );
+    PSA_ASSERT(psa_cipher_abort(&operation));
+    ASSERT_COMPARE(output1 + iv_size, output1_length - iv_size,
+                   output2, output2_length);
 
 exit:
-    psa_cipher_abort( &operation );
-    mbedtls_free( output1 );
-    mbedtls_free( output2 );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_cipher_abort(&operation);
+    mbedtls_free(output1);
+    mbedtls_free(output2);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_encrypt_multipart( int alg_arg, int key_type_arg,
-                               data_t *key_data, data_t *iv,
-                               data_t *input,
-                               int first_part_size_arg,
-                               int output1_length_arg, int output2_length_arg,
-                               data_t *expected_output,
-                               int expected_status_arg )
+void cipher_encrypt_multipart(int alg_arg, int key_type_arg,
+                              data_t *key_data, data_t *iv,
+                              data_t *input,
+                              int first_part_size_arg,
+                              int output1_length_arg, int output2_length_arg,
+                              data_t *expected_output,
+                              int expected_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -2857,92 +2886,89 @@
     psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
 
-    if( iv->len > 0 )
-    {
-        PSA_ASSERT( psa_cipher_set_iv( &operation, iv->x, iv->len ) );
+    if (iv->len > 0) {
+        PSA_ASSERT(psa_cipher_set_iv(&operation, iv->x, iv->len));
     }
 
-    output_buffer_size = PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, input->len ) +
-                         PSA_CIPHER_FINISH_OUTPUT_SIZE( key_type, alg );
-    ASSERT_ALLOC( output, output_buffer_size );
+    output_buffer_size = PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input->len) +
+                         PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg);
+    ASSERT_ALLOC(output, output_buffer_size);
 
-    TEST_LE_U( first_part_size, input->len );
-    PSA_ASSERT( psa_cipher_update( &operation, input->x, first_part_size,
-                                   output, output_buffer_size,
-                                   &function_output_length ) );
-    TEST_ASSERT( function_output_length == output1_length );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, first_part_size ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE( first_part_size) );
+    TEST_LE_U(first_part_size, input->len);
+    PSA_ASSERT(psa_cipher_update(&operation, input->x, first_part_size,
+                                 output, output_buffer_size,
+                                 &function_output_length));
+    TEST_ASSERT(function_output_length == output1_length);
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, first_part_size));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(first_part_size));
     total_output_length += function_output_length;
 
-    if( first_part_size < input->len )
-    {
-        PSA_ASSERT( psa_cipher_update( &operation,
-                                       input->x + first_part_size,
-                                       input->len - first_part_size,
-                                       ( output_buffer_size == 0 ? NULL :
-                                         output + total_output_length ),
-                                       output_buffer_size - total_output_length,
-                                       &function_output_length ) );
-        TEST_ASSERT( function_output_length == output2_length );
-        TEST_LE_U( function_output_length,
-                   PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type,
-                                                  alg,
-                                                  input->len - first_part_size ) );
-        TEST_LE_U( function_output_length,
-                   PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE( input->len ) );
+    if (first_part_size < input->len) {
+        PSA_ASSERT(psa_cipher_update(&operation,
+                                     input->x + first_part_size,
+                                     input->len - first_part_size,
+                                     (output_buffer_size == 0 ? NULL :
+                                      output + total_output_length),
+                                     output_buffer_size - total_output_length,
+                                     &function_output_length));
+        TEST_ASSERT(function_output_length == output2_length);
+        TEST_LE_U(function_output_length,
+                  PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type,
+                                                alg,
+                                                input->len - first_part_size));
+        TEST_LE_U(function_output_length,
+                  PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(input->len));
         total_output_length += function_output_length;
     }
 
-    status = psa_cipher_finish( &operation,
-                                ( output_buffer_size == 0 ? NULL :
-                                  output + total_output_length ),
-                                output_buffer_size - total_output_length,
-                                &function_output_length );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_FINISH_OUTPUT_SIZE( key_type, alg ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE );
+    status = psa_cipher_finish(&operation,
+                               (output_buffer_size == 0 ? NULL :
+                                output + total_output_length),
+                               output_buffer_size - total_output_length,
+                               &function_output_length);
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE);
     total_output_length += function_output_length;
-    TEST_EQUAL( status, expected_status );
+    TEST_EQUAL(status, expected_status);
 
-    if( expected_status == PSA_SUCCESS )
-    {
-        PSA_ASSERT( psa_cipher_abort( &operation ) );
+    if (expected_status == PSA_SUCCESS) {
+        PSA_ASSERT(psa_cipher_abort(&operation));
 
-        ASSERT_COMPARE( expected_output->x, expected_output->len,
-                        output, total_output_length );
+        ASSERT_COMPARE(expected_output->x, expected_output->len,
+                       output, total_output_length);
     }
 
 exit:
-    psa_cipher_abort( &operation );
-    mbedtls_free( output );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_cipher_abort(&operation);
+    mbedtls_free(output);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_decrypt_multipart( int alg_arg, int key_type_arg,
-                               data_t *key_data, data_t *iv,
-                               data_t *input,
-                               int first_part_size_arg,
-                               int output1_length_arg, int output2_length_arg,
-                               data_t *expected_output,
-                               int expected_status_arg )
+void cipher_decrypt_multipart(int alg_arg, int key_type_arg,
+                              data_t *key_data, data_t *iv,
+                              data_t *input,
+                              int first_part_size_arg,
+                              int output1_length_arg, int output2_length_arg,
+                              data_t *expected_output,
+                              int expected_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -2959,202 +2985,196 @@
     psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    PSA_ASSERT( psa_cipher_decrypt_setup( &operation, key, alg ) );
+    PSA_ASSERT(psa_cipher_decrypt_setup(&operation, key, alg));
 
-    if( iv->len > 0 )
-    {
-        PSA_ASSERT( psa_cipher_set_iv( &operation, iv->x, iv->len ) );
+    if (iv->len > 0) {
+        PSA_ASSERT(psa_cipher_set_iv(&operation, iv->x, iv->len));
     }
 
-    output_buffer_size = PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, input->len ) +
-                         PSA_CIPHER_FINISH_OUTPUT_SIZE( key_type, alg );
-    ASSERT_ALLOC( output, output_buffer_size );
+    output_buffer_size = PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input->len) +
+                         PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg);
+    ASSERT_ALLOC(output, output_buffer_size);
 
-    TEST_LE_U( first_part_size, input->len );
-    PSA_ASSERT( psa_cipher_update( &operation,
-                                   input->x, first_part_size,
-                                   output, output_buffer_size,
-                                   &function_output_length ) );
-    TEST_ASSERT( function_output_length == output1_length );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, first_part_size ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE( first_part_size ) );
+    TEST_LE_U(first_part_size, input->len);
+    PSA_ASSERT(psa_cipher_update(&operation,
+                                 input->x, first_part_size,
+                                 output, output_buffer_size,
+                                 &function_output_length));
+    TEST_ASSERT(function_output_length == output1_length);
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, first_part_size));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(first_part_size));
     total_output_length += function_output_length;
 
-    if( first_part_size < input->len )
-    {
-        PSA_ASSERT( psa_cipher_update( &operation,
-                                       input->x + first_part_size,
-                                       input->len - first_part_size,
-                                       ( output_buffer_size == 0 ? NULL :
-                                         output + total_output_length ),
-                                       output_buffer_size - total_output_length,
-                                       &function_output_length ) );
-        TEST_ASSERT( function_output_length == output2_length );
-        TEST_LE_U( function_output_length,
-                   PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type,
-                                                  alg,
-                                                  input->len - first_part_size ) );
-        TEST_LE_U( function_output_length,
-                   PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE( input->len ) );
+    if (first_part_size < input->len) {
+        PSA_ASSERT(psa_cipher_update(&operation,
+                                     input->x + first_part_size,
+                                     input->len - first_part_size,
+                                     (output_buffer_size == 0 ? NULL :
+                                      output + total_output_length),
+                                     output_buffer_size - total_output_length,
+                                     &function_output_length));
+        TEST_ASSERT(function_output_length == output2_length);
+        TEST_LE_U(function_output_length,
+                  PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type,
+                                                alg,
+                                                input->len - first_part_size));
+        TEST_LE_U(function_output_length,
+                  PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(input->len));
         total_output_length += function_output_length;
     }
 
-    status = psa_cipher_finish( &operation,
-                                ( output_buffer_size == 0 ? NULL :
-                                  output + total_output_length ),
-                                output_buffer_size - total_output_length,
-                                &function_output_length );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_FINISH_OUTPUT_SIZE( key_type, alg ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE );
+    status = psa_cipher_finish(&operation,
+                               (output_buffer_size == 0 ? NULL :
+                                output + total_output_length),
+                               output_buffer_size - total_output_length,
+                               &function_output_length);
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE);
     total_output_length += function_output_length;
-    TEST_EQUAL( status, expected_status );
+    TEST_EQUAL(status, expected_status);
 
-    if( expected_status == PSA_SUCCESS )
-    {
-        PSA_ASSERT( psa_cipher_abort( &operation ) );
+    if (expected_status == PSA_SUCCESS) {
+        PSA_ASSERT(psa_cipher_abort(&operation));
 
-        ASSERT_COMPARE( expected_output->x, expected_output->len,
-                        output, total_output_length );
+        ASSERT_COMPARE(expected_output->x, expected_output->len,
+                       output, total_output_length);
     }
 
 exit:
-    psa_cipher_abort( &operation );
-    mbedtls_free( output );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_cipher_abort(&operation);
+    mbedtls_free(output);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_decrypt_fail( int alg_arg,
+void cipher_decrypt_fail(int alg_arg,
+                         int key_type_arg,
+                         data_t *key_data,
+                         data_t *iv,
+                         data_t *input_arg,
+                         int expected_status_arg)
+{
+    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
+    psa_status_t status;
+    psa_key_type_t key_type = key_type_arg;
+    psa_algorithm_t alg = alg_arg;
+    psa_status_t expected_status = expected_status_arg;
+    unsigned char *input = NULL;
+    size_t input_buffer_size = 0;
+    unsigned char *output = NULL;
+    size_t output_buffer_size = 0;
+    size_t output_length = 0;
+    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+
+    if (PSA_ERROR_BAD_STATE != expected_status) {
+        PSA_ASSERT(psa_crypto_init());
+
+        psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DECRYPT);
+        psa_set_key_algorithm(&attributes, alg);
+        psa_set_key_type(&attributes, key_type);
+
+        PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                                  &key));
+    }
+
+    /* Allocate input buffer and copy the iv and the plaintext */
+    input_buffer_size = ((size_t) input_arg->len + (size_t) iv->len);
+    if (input_buffer_size > 0) {
+        ASSERT_ALLOC(input, input_buffer_size);
+        memcpy(input, iv->x, iv->len);
+        memcpy(input + iv->len, input_arg->x, input_arg->len);
+    }
+
+    output_buffer_size = PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, input_buffer_size);
+    ASSERT_ALLOC(output, output_buffer_size);
+
+    status = psa_cipher_decrypt(key, alg, input, input_buffer_size, output,
+                                output_buffer_size, &output_length);
+    TEST_EQUAL(status, expected_status);
+
+exit:
+    mbedtls_free(input);
+    mbedtls_free(output);
+    psa_destroy_key(key);
+    PSA_DONE();
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
+void cipher_decrypt(int alg_arg,
+                    int key_type_arg,
+                    data_t *key_data,
+                    data_t *iv,
+                    data_t *input_arg,
+                    data_t *expected_output)
+{
+    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
+    psa_key_type_t key_type = key_type_arg;
+    psa_algorithm_t alg = alg_arg;
+    unsigned char *input = NULL;
+    size_t input_buffer_size = 0;
+    unsigned char *output = NULL;
+    size_t output_buffer_size = 0;
+    size_t output_length = 0;
+    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+
+    PSA_ASSERT(psa_crypto_init());
+
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
+
+    /* Allocate input buffer and copy the iv and the plaintext */
+    input_buffer_size = ((size_t) input_arg->len + (size_t) iv->len);
+    if (input_buffer_size > 0) {
+        ASSERT_ALLOC(input, input_buffer_size);
+        memcpy(input, iv->x, iv->len);
+        memcpy(input + iv->len, input_arg->x, input_arg->len);
+    }
+
+    output_buffer_size = PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, input_buffer_size);
+    ASSERT_ALLOC(output, output_buffer_size);
+
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+
+    PSA_ASSERT(psa_cipher_decrypt(key, alg, input, input_buffer_size, output,
+                                  output_buffer_size, &output_length));
+    TEST_LE_U(output_length,
+              PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, input_buffer_size));
+    TEST_LE_U(output_length,
+              PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE(input_buffer_size));
+
+    ASSERT_COMPARE(expected_output->x, expected_output->len,
+                   output, output_length);
+exit:
+    mbedtls_free(input);
+    mbedtls_free(output);
+    psa_destroy_key(key);
+    PSA_DONE();
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
+void cipher_verify_output(int alg_arg,
                           int key_type_arg,
                           data_t *key_data,
-                          data_t *iv,
-                          data_t *input_arg,
-                          int expected_status_arg )
-{
-    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
-    psa_status_t status;
-    psa_key_type_t key_type = key_type_arg;
-    psa_algorithm_t alg = alg_arg;
-    psa_status_t expected_status = expected_status_arg;
-    unsigned char *input = NULL;
-    size_t input_buffer_size = 0;
-    unsigned char *output = NULL;
-    size_t output_buffer_size = 0;
-    size_t output_length = 0;
-    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-
-    if ( PSA_ERROR_BAD_STATE != expected_status )
-    {
-        PSA_ASSERT( psa_crypto_init( ) );
-
-        psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DECRYPT );
-        psa_set_key_algorithm( &attributes, alg );
-        psa_set_key_type( &attributes, key_type );
-
-        PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                    &key ) );
-    }
-
-    /* Allocate input buffer and copy the iv and the plaintext */
-    input_buffer_size = ( (size_t) input_arg->len + (size_t) iv->len );
-    if ( input_buffer_size > 0 )
-    {
-        ASSERT_ALLOC( input, input_buffer_size );
-        memcpy( input, iv->x, iv->len );
-        memcpy( input + iv->len, input_arg->x, input_arg->len );
-    }
-
-    output_buffer_size = PSA_CIPHER_DECRYPT_OUTPUT_SIZE( key_type, alg, input_buffer_size );
-    ASSERT_ALLOC( output, output_buffer_size );
-
-    status = psa_cipher_decrypt( key, alg, input, input_buffer_size, output,
-                                 output_buffer_size, &output_length );
-    TEST_EQUAL( status, expected_status );
-
-exit:
-    mbedtls_free( input );
-    mbedtls_free( output );
-    psa_destroy_key( key );
-    PSA_DONE( );
-}
-/* END_CASE */
-
-/* BEGIN_CASE */
-void cipher_decrypt( int alg_arg,
-                     int key_type_arg,
-                     data_t *key_data,
-                     data_t *iv,
-                     data_t *input_arg,
-                     data_t *expected_output )
-{
-    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
-    psa_key_type_t key_type = key_type_arg;
-    psa_algorithm_t alg = alg_arg;
-    unsigned char *input = NULL;
-    size_t input_buffer_size = 0;
-    unsigned char *output = NULL;
-    size_t output_buffer_size = 0;
-    size_t output_length = 0;
-    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-
-    PSA_ASSERT( psa_crypto_init( ) );
-
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
-
-    /* Allocate input buffer and copy the iv and the plaintext */
-    input_buffer_size = ( (size_t) input_arg->len + (size_t) iv->len );
-    if ( input_buffer_size > 0 )
-    {
-        ASSERT_ALLOC( input, input_buffer_size );
-        memcpy( input, iv->x, iv->len );
-        memcpy( input + iv->len, input_arg->x, input_arg->len );
-    }
-
-    output_buffer_size = PSA_CIPHER_DECRYPT_OUTPUT_SIZE( key_type, alg, input_buffer_size );
-    ASSERT_ALLOC( output, output_buffer_size );
-
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-
-    PSA_ASSERT( psa_cipher_decrypt( key, alg, input, input_buffer_size, output,
-                                    output_buffer_size, &output_length ) );
-    TEST_LE_U( output_length,
-               PSA_CIPHER_DECRYPT_OUTPUT_SIZE( key_type, alg, input_buffer_size ) );
-    TEST_LE_U( output_length,
-               PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE( input_buffer_size ) );
-
-    ASSERT_COMPARE( expected_output->x, expected_output->len,
-                    output, output_length );
-exit:
-    mbedtls_free( input );
-    mbedtls_free( output );
-    psa_destroy_key( key );
-    PSA_DONE( );
-}
-/* END_CASE */
-
-/* BEGIN_CASE */
-void cipher_verify_output( int alg_arg,
-                           int key_type_arg,
-                           data_t *key_data,
-                           data_t *input )
+                          data_t *input)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -3167,58 +3187,58 @@
     size_t output2_length = 0;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-    output1_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, input->len );
-    ASSERT_ALLOC( output1, output1_size );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+    output1_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input->len);
+    ASSERT_ALLOC(output1, output1_size);
 
-    PSA_ASSERT( psa_cipher_encrypt( key, alg, input->x, input->len,
-                                    output1, output1_size,
-                                    &output1_length ) );
-    TEST_LE_U( output1_length,
-               PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, input->len ) );
-    TEST_LE_U( output1_length,
-               PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE( input->len ) );
+    PSA_ASSERT(psa_cipher_encrypt(key, alg, input->x, input->len,
+                                  output1, output1_size,
+                                  &output1_length));
+    TEST_LE_U(output1_length,
+              PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input->len));
+    TEST_LE_U(output1_length,
+              PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(input->len));
 
     output2_size = output1_length;
-    ASSERT_ALLOC( output2, output2_size );
+    ASSERT_ALLOC(output2, output2_size);
 
-    PSA_ASSERT( psa_cipher_decrypt( key, alg, output1, output1_length,
-                                    output2, output2_size,
-                                    &output2_length ) );
-    TEST_LE_U( output2_length,
-               PSA_CIPHER_DECRYPT_OUTPUT_SIZE( key_type, alg, output1_length ) );
-    TEST_LE_U( output2_length,
-               PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE( output1_length ) );
+    PSA_ASSERT(psa_cipher_decrypt(key, alg, output1, output1_length,
+                                  output2, output2_size,
+                                  &output2_length));
+    TEST_LE_U(output2_length,
+              PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, output1_length));
+    TEST_LE_U(output2_length,
+              PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE(output1_length));
 
-    ASSERT_COMPARE( input->x, input->len, output2, output2_length );
+    ASSERT_COMPARE(input->x, input->len, output2, output2_length);
 
 exit:
-    mbedtls_free( output1 );
-    mbedtls_free( output2 );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    mbedtls_free(output1);
+    mbedtls_free(output2);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_verify_output_multipart( int alg_arg,
-                                     int key_type_arg,
-                                     data_t *key_data,
-                                     data_t *input,
-                                     int first_part_size_arg )
+void cipher_verify_output_multipart(int alg_arg,
+                                    int key_type_arg,
+                                    data_t *key_data,
+                                    data_t *input,
+                                    int first_part_size_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
     psa_algorithm_t alg = alg_arg;
     size_t first_part_size = first_part_size_arg;
-    unsigned char iv[16] = {0};
+    unsigned char iv[16] = { 0 };
     size_t iv_size = 16;
     size_t iv_length = 0;
     unsigned char *output1 = NULL;
@@ -3232,132 +3252,130 @@
     psa_cipher_operation_t operation2 = PSA_CIPHER_OPERATION_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation1, key, alg ) );
-    PSA_ASSERT( psa_cipher_decrypt_setup( &operation2, key, alg ) );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation1, key, alg));
+    PSA_ASSERT(psa_cipher_decrypt_setup(&operation2, key, alg));
 
-    if( alg != PSA_ALG_ECB_NO_PADDING )
-    {
-        PSA_ASSERT( psa_cipher_generate_iv( &operation1,
-                                            iv, iv_size,
-                                            &iv_length ) );
+    if (alg != PSA_ALG_ECB_NO_PADDING) {
+        PSA_ASSERT(psa_cipher_generate_iv(&operation1,
+                                          iv, iv_size,
+                                          &iv_length));
     }
 
-    output1_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, input->len );
-    TEST_LE_U( output1_buffer_size,
-               PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE( input->len ) );
-    ASSERT_ALLOC( output1, output1_buffer_size );
+    output1_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input->len);
+    TEST_LE_U(output1_buffer_size,
+              PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(input->len));
+    ASSERT_ALLOC(output1, output1_buffer_size);
 
-    TEST_LE_U( first_part_size, input->len );
+    TEST_LE_U(first_part_size, input->len);
 
-    PSA_ASSERT( psa_cipher_update( &operation1, input->x, first_part_size,
-                                   output1, output1_buffer_size,
-                                   &function_output_length ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, first_part_size ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE( first_part_size ) );
+    PSA_ASSERT(psa_cipher_update(&operation1, input->x, first_part_size,
+                                 output1, output1_buffer_size,
+                                 &function_output_length));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, first_part_size));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(first_part_size));
     output1_length += function_output_length;
 
-    PSA_ASSERT( psa_cipher_update( &operation1,
-                                   input->x + first_part_size,
-                                   input->len - first_part_size,
-                                   output1, output1_buffer_size,
-                                   &function_output_length ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type,
-                                              alg,
-                                              input->len - first_part_size ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE( input->len - first_part_size ) );
+    PSA_ASSERT(psa_cipher_update(&operation1,
+                                 input->x + first_part_size,
+                                 input->len - first_part_size,
+                                 output1, output1_buffer_size,
+                                 &function_output_length));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type,
+                                            alg,
+                                            input->len - first_part_size));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(input->len - first_part_size));
     output1_length += function_output_length;
 
-    PSA_ASSERT( psa_cipher_finish( &operation1,
-                                   output1 + output1_length,
-                                   output1_buffer_size - output1_length,
-                                   &function_output_length ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_FINISH_OUTPUT_SIZE( key_type, alg ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE );
+    PSA_ASSERT(psa_cipher_finish(&operation1,
+                                 output1 + output1_length,
+                                 output1_buffer_size - output1_length,
+                                 &function_output_length));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE);
     output1_length += function_output_length;
 
-    PSA_ASSERT( psa_cipher_abort( &operation1 ) );
+    PSA_ASSERT(psa_cipher_abort(&operation1));
 
     output2_buffer_size = output1_length;
-    TEST_LE_U( output2_buffer_size,
-               PSA_CIPHER_DECRYPT_OUTPUT_SIZE( key_type, alg, output1_length ) );
-    TEST_LE_U( output2_buffer_size,
-               PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE( output1_length ) );
-    ASSERT_ALLOC( output2, output2_buffer_size );
+    TEST_LE_U(output2_buffer_size,
+              PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, output1_length));
+    TEST_LE_U(output2_buffer_size,
+              PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE(output1_length));
+    ASSERT_ALLOC(output2, output2_buffer_size);
 
-    if( iv_length > 0 )
-    {
-        PSA_ASSERT( psa_cipher_set_iv( &operation2,
-                                       iv, iv_length ) );
+    if (iv_length > 0) {
+        PSA_ASSERT(psa_cipher_set_iv(&operation2,
+                                     iv, iv_length));
     }
 
-    PSA_ASSERT( psa_cipher_update( &operation2, output1, first_part_size,
-                                   output2, output2_buffer_size,
-                                   &function_output_length ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, first_part_size ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE( first_part_size ) );
+    PSA_ASSERT(psa_cipher_update(&operation2, output1, first_part_size,
+                                 output2, output2_buffer_size,
+                                 &function_output_length));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, first_part_size));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(first_part_size));
     output2_length += function_output_length;
 
-    PSA_ASSERT( psa_cipher_update( &operation2,
-                                   output1 + first_part_size,
-                                   output1_length - first_part_size,
-                                   output2, output2_buffer_size,
-                                   &function_output_length ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type,
-                                              alg,
-                                              output1_length - first_part_size ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE( output1_length - first_part_size ) );
+    PSA_ASSERT(psa_cipher_update(&operation2,
+                                 output1 + first_part_size,
+                                 output1_length - first_part_size,
+                                 output2, output2_buffer_size,
+                                 &function_output_length));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type,
+                                            alg,
+                                            output1_length - first_part_size));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE(output1_length - first_part_size));
     output2_length += function_output_length;
 
-    PSA_ASSERT( psa_cipher_finish( &operation2,
-                                   output2 + output2_length,
-                                   output2_buffer_size - output2_length,
-                                   &function_output_length ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_FINISH_OUTPUT_SIZE( key_type, alg ) );
-    TEST_LE_U( function_output_length,
-               PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE );
+    PSA_ASSERT(psa_cipher_finish(&operation2,
+                                 output2 + output2_length,
+                                 output2_buffer_size - output2_length,
+                                 &function_output_length));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg));
+    TEST_LE_U(function_output_length,
+              PSA_CIPHER_FINISH_OUTPUT_MAX_SIZE);
     output2_length += function_output_length;
 
-    PSA_ASSERT( psa_cipher_abort( &operation2 ) );
+    PSA_ASSERT(psa_cipher_abort(&operation2));
 
-    ASSERT_COMPARE( input->x, input->len, output2, output2_length );
+    ASSERT_COMPARE(input->x, input->len, output2, output2_length);
 
 exit:
-    psa_cipher_abort( &operation1 );
-    psa_cipher_abort( &operation2 );
-    mbedtls_free( output1 );
-    mbedtls_free( output2 );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_cipher_abort(&operation1);
+    psa_cipher_abort(&operation2);
+    mbedtls_free(output1);
+    mbedtls_free(output2);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void aead_encrypt_decrypt( int key_type_arg, data_t *key_data,
-                           int alg_arg,
-                           data_t *nonce,
-                           data_t *additional_data,
-                           data_t *input_data,
-                           int expected_result_arg )
+void aead_encrypt_decrypt(int key_type_arg, data_t *key_data,
+                          int alg_arg,
+                          data_t *nonce,
+                          data_t *additional_data,
+                          data_t *input_data,
+                          int expected_result_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -3372,90 +3390,87 @@
     psa_status_t expected_result = expected_result_arg;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
 
-    output_size = input_data->len + PSA_AEAD_TAG_LENGTH( key_type, key_bits,
-                                                         alg );
+    output_size = input_data->len + PSA_AEAD_TAG_LENGTH(key_type, key_bits,
+                                                        alg);
     /* For all currently defined algorithms, PSA_AEAD_ENCRYPT_OUTPUT_SIZE
      * should be exact. */
-    if( expected_result != PSA_ERROR_INVALID_ARGUMENT &&
-        expected_result != PSA_ERROR_NOT_SUPPORTED )
-    {
-        TEST_EQUAL( output_size,
-                    PSA_AEAD_ENCRYPT_OUTPUT_SIZE( key_type, alg, input_data->len ) );
-        TEST_ASSERT( output_size <=
-                     PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE( input_data->len ) );
+    if (expected_result != PSA_ERROR_INVALID_ARGUMENT &&
+        expected_result != PSA_ERROR_NOT_SUPPORTED) {
+        TEST_EQUAL(output_size,
+                   PSA_AEAD_ENCRYPT_OUTPUT_SIZE(key_type, alg, input_data->len));
+        TEST_ASSERT(output_size <=
+                    PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE(input_data->len));
     }
-    ASSERT_ALLOC( output_data, output_size );
+    ASSERT_ALLOC(output_data, output_size);
 
-    status = psa_aead_encrypt( key, alg,
-                               nonce->x, nonce->len,
-                               additional_data->x,
-                               additional_data->len,
-                               input_data->x, input_data->len,
-                               output_data, output_size,
-                               &output_length );
+    status = psa_aead_encrypt(key, alg,
+                              nonce->x, nonce->len,
+                              additional_data->x,
+                              additional_data->len,
+                              input_data->x, input_data->len,
+                              output_data, output_size,
+                              &output_length);
 
     /* If the operation is not supported, just skip and not fail in case the
      * encryption involves a common limitation of cryptography hardwares and
      * an alternative implementation. */
-    if( status == PSA_ERROR_NOT_SUPPORTED )
-    {
-        MBEDTLS_TEST_PSA_SKIP_IF_ALT_AES_192( key_type, key_data->len * 8 );
-        MBEDTLS_TEST_PSA_SKIP_IF_ALT_GCM_NOT_12BYTES_NONCE( alg, nonce->len );
+    if (status == PSA_ERROR_NOT_SUPPORTED) {
+        MBEDTLS_TEST_PSA_SKIP_IF_ALT_AES_192(key_type, key_data->len * 8);
+        MBEDTLS_TEST_PSA_SKIP_IF_ALT_GCM_NOT_12BYTES_NONCE(alg, nonce->len);
     }
 
-    TEST_EQUAL( status, expected_result );
+    TEST_EQUAL(status, expected_result);
 
-    if( PSA_SUCCESS == expected_result )
-    {
-        ASSERT_ALLOC( output_data2, output_length );
+    if (PSA_SUCCESS == expected_result) {
+        ASSERT_ALLOC(output_data2, output_length);
 
         /* For all currently defined algorithms, PSA_AEAD_DECRYPT_OUTPUT_SIZE
          * should be exact. */
-        TEST_EQUAL( input_data->len,
-                    PSA_AEAD_DECRYPT_OUTPUT_SIZE( key_type, alg, output_length ) );
+        TEST_EQUAL(input_data->len,
+                   PSA_AEAD_DECRYPT_OUTPUT_SIZE(key_type, alg, output_length));
 
-        TEST_ASSERT( input_data->len <=
-                     PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE( output_length ) );
+        TEST_ASSERT(input_data->len <=
+                    PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE(output_length));
 
-        TEST_EQUAL( psa_aead_decrypt( key, alg,
-                                      nonce->x, nonce->len,
-                                      additional_data->x,
-                                      additional_data->len,
-                                      output_data, output_length,
-                                      output_data2, output_length,
-                                      &output_length2 ),
-                    expected_result );
+        TEST_EQUAL(psa_aead_decrypt(key, alg,
+                                    nonce->x, nonce->len,
+                                    additional_data->x,
+                                    additional_data->len,
+                                    output_data, output_length,
+                                    output_data2, output_length,
+                                    &output_length2),
+                   expected_result);
 
-        ASSERT_COMPARE( input_data->x, input_data->len,
-                        output_data2, output_length2 );
+        ASSERT_COMPARE(input_data->x, input_data->len,
+                       output_data2, output_length2);
     }
 
 exit:
-    psa_destroy_key( key );
-    mbedtls_free( output_data );
-    mbedtls_free( output_data2 );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    mbedtls_free(output_data);
+    mbedtls_free(output_data2);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void aead_encrypt( int key_type_arg, data_t *key_data,
-                   int alg_arg,
-                   data_t *nonce,
-                   data_t *additional_data,
-                   data_t *input_data,
-                   data_t *expected_result )
+void aead_encrypt(int key_type_arg, data_t *key_data,
+                  int alg_arg,
+                  data_t *nonce,
+                  data_t *additional_data,
+                  data_t *input_data,
+                  data_t *expected_result)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -3467,62 +3482,61 @@
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_status_t status = PSA_ERROR_GENERIC_ERROR;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT  );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
 
-    output_size = input_data->len + PSA_AEAD_TAG_LENGTH( key_type, key_bits,
-                                                         alg );
+    output_size = input_data->len + PSA_AEAD_TAG_LENGTH(key_type, key_bits,
+                                                        alg);
     /* For all currently defined algorithms, PSA_AEAD_ENCRYPT_OUTPUT_SIZE
      * should be exact. */
-    TEST_EQUAL( output_size,
-                PSA_AEAD_ENCRYPT_OUTPUT_SIZE( key_type, alg, input_data->len ) );
-    TEST_ASSERT( output_size <=
-                 PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE( input_data->len ) );
-    ASSERT_ALLOC( output_data, output_size );
+    TEST_EQUAL(output_size,
+               PSA_AEAD_ENCRYPT_OUTPUT_SIZE(key_type, alg, input_data->len));
+    TEST_ASSERT(output_size <=
+                PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE(input_data->len));
+    ASSERT_ALLOC(output_data, output_size);
 
-    status = psa_aead_encrypt( key, alg,
-                               nonce->x, nonce->len,
-                               additional_data->x, additional_data->len,
-                               input_data->x, input_data->len,
-                               output_data, output_size,
-                               &output_length );
+    status = psa_aead_encrypt(key, alg,
+                              nonce->x, nonce->len,
+                              additional_data->x, additional_data->len,
+                              input_data->x, input_data->len,
+                              output_data, output_size,
+                              &output_length);
 
     /* If the operation is not supported, just skip and not fail in case the
      * encryption involves a common limitation of cryptography hardwares and
      * an alternative implementation. */
-    if( status == PSA_ERROR_NOT_SUPPORTED )
-    {
-        MBEDTLS_TEST_PSA_SKIP_IF_ALT_AES_192( key_type, key_data->len * 8 );
-        MBEDTLS_TEST_PSA_SKIP_IF_ALT_GCM_NOT_12BYTES_NONCE( alg, nonce->len );
+    if (status == PSA_ERROR_NOT_SUPPORTED) {
+        MBEDTLS_TEST_PSA_SKIP_IF_ALT_AES_192(key_type, key_data->len * 8);
+        MBEDTLS_TEST_PSA_SKIP_IF_ALT_GCM_NOT_12BYTES_NONCE(alg, nonce->len);
     }
 
-    PSA_ASSERT( status );
-    ASSERT_COMPARE( expected_result->x, expected_result->len,
-                    output_data, output_length );
+    PSA_ASSERT(status);
+    ASSERT_COMPARE(expected_result->x, expected_result->len,
+                   output_data, output_length);
 
 exit:
-    psa_destroy_key( key );
-    mbedtls_free( output_data );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    mbedtls_free(output_data);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void aead_decrypt( int key_type_arg, data_t *key_data,
-                   int alg_arg,
-                   data_t *nonce,
-                   data_t *additional_data,
-                   data_t *input_data,
-                   data_t *expected_data,
-                   int expected_result_arg )
+void aead_decrypt(int key_type_arg, data_t *key_data,
+                  int alg_arg,
+                  data_t *nonce,
+                  data_t *additional_data,
+                  data_t *input_data,
+                  data_t *expected_data,
+                  int expected_result_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -3535,75 +3549,74 @@
     psa_status_t expected_result = expected_result_arg;
     psa_status_t status = PSA_ERROR_GENERIC_ERROR;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DECRYPT  );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
 
-    output_size = input_data->len - PSA_AEAD_TAG_LENGTH( key_type, key_bits,
-                                                         alg );
-    if( expected_result != PSA_ERROR_INVALID_ARGUMENT &&
-        expected_result != PSA_ERROR_NOT_SUPPORTED )
-    {
+    output_size = input_data->len - PSA_AEAD_TAG_LENGTH(key_type, key_bits,
+                                                        alg);
+    if (expected_result != PSA_ERROR_INVALID_ARGUMENT &&
+        expected_result != PSA_ERROR_NOT_SUPPORTED) {
         /* For all currently defined algorithms, PSA_AEAD_DECRYPT_OUTPUT_SIZE
          * should be exact. */
-        TEST_EQUAL( output_size,
-                    PSA_AEAD_DECRYPT_OUTPUT_SIZE( key_type, alg, input_data->len ) );
-        TEST_ASSERT( output_size <=
-                     PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE( input_data->len ) );
+        TEST_EQUAL(output_size,
+                   PSA_AEAD_DECRYPT_OUTPUT_SIZE(key_type, alg, input_data->len));
+        TEST_ASSERT(output_size <=
+                    PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE(input_data->len));
     }
-    ASSERT_ALLOC( output_data, output_size );
+    ASSERT_ALLOC(output_data, output_size);
 
-    status = psa_aead_decrypt( key, alg,
-                               nonce->x, nonce->len,
-                               additional_data->x,
-                               additional_data->len,
-                               input_data->x, input_data->len,
-                               output_data, output_size,
-                               &output_length );
+    status = psa_aead_decrypt(key, alg,
+                              nonce->x, nonce->len,
+                              additional_data->x,
+                              additional_data->len,
+                              input_data->x, input_data->len,
+                              output_data, output_size,
+                              &output_length);
 
     /* If the operation is not supported, just skip and not fail in case the
      * decryption involves a common limitation of cryptography hardwares and
      * an alternative implementation. */
-    if( status == PSA_ERROR_NOT_SUPPORTED )
-    {
-        MBEDTLS_TEST_PSA_SKIP_IF_ALT_AES_192( key_type, key_data->len * 8 );
-        MBEDTLS_TEST_PSA_SKIP_IF_ALT_GCM_NOT_12BYTES_NONCE( alg, nonce->len );
+    if (status == PSA_ERROR_NOT_SUPPORTED) {
+        MBEDTLS_TEST_PSA_SKIP_IF_ALT_AES_192(key_type, key_data->len * 8);
+        MBEDTLS_TEST_PSA_SKIP_IF_ALT_GCM_NOT_12BYTES_NONCE(alg, nonce->len);
     }
 
-    TEST_EQUAL( status, expected_result );
+    TEST_EQUAL(status, expected_result);
 
-    if( expected_result == PSA_SUCCESS )
-        ASSERT_COMPARE( expected_data->x, expected_data->len,
-                        output_data, output_length );
+    if (expected_result == PSA_SUCCESS) {
+        ASSERT_COMPARE(expected_data->x, expected_data->len,
+                       output_data, output_length);
+    }
 
 exit:
-    psa_destroy_key( key );
-    mbedtls_free( output_data );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    mbedtls_free(output_data);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void signature_size( int type_arg,
-                     int bits,
-                     int alg_arg,
-                     int expected_size_arg )
+void signature_size(int type_arg,
+                    int bits,
+                    int alg_arg,
+                    int expected_size_arg)
 {
     psa_key_type_t type = type_arg;
     psa_algorithm_t alg = alg_arg;
-    size_t actual_size = PSA_SIGN_OUTPUT_SIZE( type, bits, alg );
+    size_t actual_size = PSA_SIGN_OUTPUT_SIZE(type, bits, alg);
 
-    TEST_EQUAL( actual_size, (size_t) expected_size_arg );
+    TEST_EQUAL(actual_size, (size_t) expected_size_arg);
 #if defined(MBEDTLS_TEST_DEPRECATED)
-    TEST_EQUAL( actual_size,
-                PSA_ASYMMETRIC_SIGN_OUTPUT_SIZE( type, bits, alg ) );
+    TEST_EQUAL(actual_size,
+               PSA_ASYMMETRIC_SIGN_OUTPUT_SIZE(type, bits, alg));
 #endif /* MBEDTLS_TEST_DEPRECATED */
 
 exit:
@@ -3612,9 +3625,9 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void sign_hash_deterministic( int key_type_arg, data_t *key_data,
-                              int alg_arg, data_t *input_data,
-                              data_t *output_data )
+void sign_hash_deterministic(int key_type_arg, data_t *key_data,
+                             int alg_arg, data_t *input_data,
+                             data_t *output_data)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -3625,43 +3638,43 @@
     size_t signature_length = 0xdeadbeef;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
 
     /* Allocate a buffer which has the size advertised by the
      * library. */
-    signature_size = PSA_SIGN_OUTPUT_SIZE( key_type,
-                                                      key_bits, alg );
-    TEST_ASSERT( signature_size != 0 );
-    TEST_LE_U( signature_size, PSA_SIGNATURE_MAX_SIZE );
-    ASSERT_ALLOC( signature, signature_size );
+    signature_size = PSA_SIGN_OUTPUT_SIZE(key_type,
+                                          key_bits, alg);
+    TEST_ASSERT(signature_size != 0);
+    TEST_LE_U(signature_size, PSA_SIGNATURE_MAX_SIZE);
+    ASSERT_ALLOC(signature, signature_size);
 
     /* Perform the signature. */
-    PSA_ASSERT( psa_sign_hash( key, alg,
-                               input_data->x, input_data->len,
-                               signature, signature_size,
-                               &signature_length ) );
+    PSA_ASSERT(psa_sign_hash(key, alg,
+                             input_data->x, input_data->len,
+                             signature, signature_size,
+                             &signature_length));
     /* Verify that the signature is what is expected. */
-    ASSERT_COMPARE( output_data->x, output_data->len,
-                    signature, signature_length );
+    ASSERT_COMPARE(output_data->x, output_data->len,
+                   signature, signature_length);
 
 #if defined(MBEDTLS_TEST_DEPRECATED)
-    memset( signature, 0, signature_size );
+    memset(signature, 0, signature_size);
     signature_length = INVALID_EXPORT_LENGTH;
-    PSA_ASSERT( psa_asymmetric_sign( key, alg,
-                                     input_data->x, input_data->len,
-                                     signature, signature_size,
-                                     &signature_length ) );
-    ASSERT_COMPARE( output_data->x, output_data->len,
-                    signature, signature_length );
+    PSA_ASSERT(psa_asymmetric_sign(key, alg,
+                                   input_data->x, input_data->len,
+                                   signature, signature_size,
+                                   &signature_length));
+    ASSERT_COMPARE(output_data->x, output_data->len,
+                   signature, signature_length);
 #endif /* MBEDTLS_TEST_DEPRECATED */
 
 exit:
@@ -3669,18 +3682,18 @@
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    psa_destroy_key( key );
-    mbedtls_free( signature );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    mbedtls_free(signature);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void sign_hash_fail( int key_type_arg, data_t *key_data,
-                     int alg_arg, data_t *input_data,
-                     int signature_size_arg, int expected_status_arg )
+void sign_hash_fail(int key_type_arg, data_t *key_data,
+                    int alg_arg, data_t *input_data,
+                    int signature_size_arg, int expected_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -3692,49 +3705,49 @@
     size_t signature_length = 0xdeadbeef;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    ASSERT_ALLOC( signature, signature_size );
+    ASSERT_ALLOC(signature, signature_size);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    actual_status = psa_sign_hash( key, alg,
-                                   input_data->x, input_data->len,
-                                   signature, signature_size,
-                                   &signature_length );
-    TEST_EQUAL( actual_status, expected_status );
+    actual_status = psa_sign_hash(key, alg,
+                                  input_data->x, input_data->len,
+                                  signature, signature_size,
+                                  &signature_length);
+    TEST_EQUAL(actual_status, expected_status);
     /* The value of *signature_length is unspecified on error, but
      * whatever it is, it should be less than signature_size, so that
      * if the caller tries to read *signature_length bytes without
      * checking the error code then they don't overflow a buffer. */
-    TEST_LE_U( signature_length, signature_size );
+    TEST_LE_U(signature_length, signature_size);
 
 #if defined(MBEDTLS_TEST_DEPRECATED)
     signature_length = INVALID_EXPORT_LENGTH;
-    TEST_EQUAL( psa_asymmetric_sign( key, alg,
-                                     input_data->x, input_data->len,
-                                     signature, signature_size,
-                                     &signature_length ),
-                expected_status );
-    TEST_LE_U( signature_length, signature_size );
+    TEST_EQUAL(psa_asymmetric_sign(key, alg,
+                                   input_data->x, input_data->len,
+                                   signature, signature_size,
+                                   &signature_length),
+               expected_status);
+    TEST_LE_U(signature_length, signature_size);
 #endif /* MBEDTLS_TEST_DEPRECATED */
 
 exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    mbedtls_free( signature );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    mbedtls_free(signature);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void sign_verify_hash( int key_type_arg, data_t *key_data,
-                       int alg_arg, data_t *input_data )
+void sign_verify_hash(int key_type_arg, data_t *key_data,
+                      int alg_arg, data_t *input_data)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -3745,49 +3758,48 @@
     size_t signature_length = 0xdeadbeef;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
 
     /* Allocate a buffer which has the size advertised by the
      * library. */
-    signature_size = PSA_SIGN_OUTPUT_SIZE( key_type,
-                                                      key_bits, alg );
-    TEST_ASSERT( signature_size != 0 );
-    TEST_LE_U( signature_size, PSA_SIGNATURE_MAX_SIZE );
-    ASSERT_ALLOC( signature, signature_size );
+    signature_size = PSA_SIGN_OUTPUT_SIZE(key_type,
+                                          key_bits, alg);
+    TEST_ASSERT(signature_size != 0);
+    TEST_LE_U(signature_size, PSA_SIGNATURE_MAX_SIZE);
+    ASSERT_ALLOC(signature, signature_size);
 
     /* Perform the signature. */
-    PSA_ASSERT( psa_sign_hash( key, alg,
-                               input_data->x, input_data->len,
-                               signature, signature_size,
-                               &signature_length ) );
+    PSA_ASSERT(psa_sign_hash(key, alg,
+                             input_data->x, input_data->len,
+                             signature, signature_size,
+                             &signature_length));
     /* Check that the signature length looks sensible. */
-    TEST_LE_U( signature_length, signature_size );
-    TEST_ASSERT( signature_length > 0 );
+    TEST_LE_U(signature_length, signature_size);
+    TEST_ASSERT(signature_length > 0);
 
     /* Use the library to verify that the signature is correct. */
-    PSA_ASSERT( psa_verify_hash( key, alg,
-                                 input_data->x, input_data->len,
-                                 signature, signature_length ) );
+    PSA_ASSERT(psa_verify_hash(key, alg,
+                               input_data->x, input_data->len,
+                               signature, signature_length));
 
-    if( input_data->len != 0 )
-    {
+    if (input_data->len != 0) {
         /* Flip a bit in the input and verify that the signature is now
          * detected as invalid. Flip a bit at the beginning, not at the end,
          * because ECDSA may ignore the last few bits of the input. */
         input_data->x[0] ^= 1;
-        TEST_EQUAL( psa_verify_hash( key, alg,
-                                     input_data->x, input_data->len,
-                                     signature, signature_length ),
-                    PSA_ERROR_INVALID_SIGNATURE );
+        TEST_EQUAL(psa_verify_hash(key, alg,
+                                   input_data->x, input_data->len,
+                                   signature, signature_length),
+                   PSA_ERROR_INVALID_SIGNATURE);
     }
 
 exit:
@@ -3795,59 +3807,59 @@
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    psa_destroy_key( key );
-    mbedtls_free( signature );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    mbedtls_free(signature);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void verify_hash( int key_type_arg, data_t *key_data,
-                  int alg_arg, data_t *hash_data,
-                  data_t *signature_data )
+void verify_hash(int key_type_arg, data_t *key_data,
+                 int alg_arg, data_t *hash_data,
+                 data_t *signature_data)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
     psa_algorithm_t alg = alg_arg;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    TEST_LE_U( signature_data->len, PSA_SIGNATURE_MAX_SIZE );
+    TEST_LE_U(signature_data->len, PSA_SIGNATURE_MAX_SIZE);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_VERIFY_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_VERIFY_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    PSA_ASSERT( psa_verify_hash( key, alg,
-                                 hash_data->x, hash_data->len,
-                                 signature_data->x, signature_data->len ) );
+    PSA_ASSERT(psa_verify_hash(key, alg,
+                               hash_data->x, hash_data->len,
+                               signature_data->x, signature_data->len));
 
 #if defined(MBEDTLS_TEST_DEPRECATED)
-    PSA_ASSERT( psa_asymmetric_verify( key, alg,
-                                       hash_data->x, hash_data->len,
-                                       signature_data->x,
-                                       signature_data->len ) );
+    PSA_ASSERT(psa_asymmetric_verify(key, alg,
+                                     hash_data->x, hash_data->len,
+                                     signature_data->x,
+                                     signature_data->len));
 
 #endif /* MBEDTLS_TEST_DEPRECATED */
 
 exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void verify_hash_fail( int key_type_arg, data_t *key_data,
-                       int alg_arg, data_t *hash_data,
-                       data_t *signature_data,
-                       int expected_status_arg )
+void verify_hash_fail(int key_type_arg, data_t *key_data,
+                      int alg_arg, data_t *hash_data,
+                      data_t *signature_data,
+                      int expected_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -3856,40 +3868,40 @@
     psa_status_t expected_status = expected_status_arg;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_VERIFY_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_VERIFY_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    actual_status = psa_verify_hash( key, alg,
-                                     hash_data->x, hash_data->len,
-                                     signature_data->x, signature_data->len );
-    TEST_EQUAL( actual_status, expected_status );
+    actual_status = psa_verify_hash(key, alg,
+                                    hash_data->x, hash_data->len,
+                                    signature_data->x, signature_data->len);
+    TEST_EQUAL(actual_status, expected_status);
 
 #if defined(MBEDTLS_TEST_DEPRECATED)
-    TEST_EQUAL( psa_asymmetric_verify( key, alg,
-                                       hash_data->x, hash_data->len,
-                                       signature_data->x, signature_data->len ),
-                expected_status );
+    TEST_EQUAL(psa_asymmetric_verify(key, alg,
+                                     hash_data->x, hash_data->len,
+                                     signature_data->x, signature_data->len),
+               expected_status);
 #endif /* MBEDTLS_TEST_DEPRECATED */
 
 exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void sign_message_deterministic( int key_type_arg,
-                                 data_t *key_data,
-                                 int alg_arg,
-                                 data_t *input_data,
-                                 data_t *output_data )
+void sign_message_deterministic(int key_type_arg,
+                                data_t *key_data,
+                                int alg_arg,
+                                data_t *input_data,
+                                data_t *output_data)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -3900,231 +3912,230 @@
     size_t signature_length = 0xdeadbeef;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_MESSAGE );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_MESSAGE);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
 
-    signature_size = PSA_SIGN_OUTPUT_SIZE( key_type, key_bits, alg );
-    TEST_ASSERT( signature_size != 0 );
-    TEST_LE_U( signature_size, PSA_SIGNATURE_MAX_SIZE );
-    ASSERT_ALLOC( signature, signature_size );
+    signature_size = PSA_SIGN_OUTPUT_SIZE(key_type, key_bits, alg);
+    TEST_ASSERT(signature_size != 0);
+    TEST_LE_U(signature_size, PSA_SIGNATURE_MAX_SIZE);
+    ASSERT_ALLOC(signature, signature_size);
 
-    PSA_ASSERT( psa_sign_message( key, alg,
-                                  input_data->x, input_data->len,
-                                  signature, signature_size,
-                                  &signature_length ) );
+    PSA_ASSERT(psa_sign_message(key, alg,
+                                input_data->x, input_data->len,
+                                signature, signature_size,
+                                &signature_length));
 
-    ASSERT_COMPARE( output_data->x, output_data->len,
-                    signature, signature_length );
+    ASSERT_COMPARE(output_data->x, output_data->len,
+                   signature, signature_length);
 
 exit:
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    psa_destroy_key( key );
-    mbedtls_free( signature );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    mbedtls_free(signature);
+    PSA_DONE();
 
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void sign_message_fail( int key_type_arg,
+void sign_message_fail(int key_type_arg,
+                       data_t *key_data,
+                       int alg_arg,
+                       data_t *input_data,
+                       int signature_size_arg,
+                       int expected_status_arg)
+{
+    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
+    psa_key_type_t key_type = key_type_arg;
+    psa_algorithm_t alg = alg_arg;
+    size_t signature_size = signature_size_arg;
+    psa_status_t actual_status;
+    psa_status_t expected_status = expected_status_arg;
+    unsigned char *signature = NULL;
+    size_t signature_length = 0xdeadbeef;
+    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+
+    ASSERT_ALLOC(signature, signature_size);
+
+    PSA_ASSERT(psa_crypto_init());
+
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_MESSAGE);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
+
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+
+    actual_status = psa_sign_message(key, alg,
+                                     input_data->x, input_data->len,
+                                     signature, signature_size,
+                                     &signature_length);
+    TEST_EQUAL(actual_status, expected_status);
+    /* The value of *signature_length is unspecified on error, but
+     * whatever it is, it should be less than signature_size, so that
+     * if the caller tries to read *signature_length bytes without
+     * checking the error code then they don't overflow a buffer. */
+    TEST_LE_U(signature_length, signature_size);
+
+exit:
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    mbedtls_free(signature);
+    PSA_DONE();
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
+void sign_verify_message(int key_type_arg,
+                         data_t *key_data,
+                         int alg_arg,
+                         data_t *input_data)
+{
+    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
+    psa_key_type_t key_type = key_type_arg;
+    psa_algorithm_t alg = alg_arg;
+    size_t key_bits;
+    unsigned char *signature = NULL;
+    size_t signature_size;
+    size_t signature_length = 0xdeadbeef;
+    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+
+    PSA_ASSERT(psa_crypto_init());
+
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_MESSAGE |
+                            PSA_KEY_USAGE_VERIFY_MESSAGE);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
+
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
+
+    signature_size = PSA_SIGN_OUTPUT_SIZE(key_type, key_bits, alg);
+    TEST_ASSERT(signature_size != 0);
+    TEST_LE_U(signature_size, PSA_SIGNATURE_MAX_SIZE);
+    ASSERT_ALLOC(signature, signature_size);
+
+    PSA_ASSERT(psa_sign_message(key, alg,
+                                input_data->x, input_data->len,
+                                signature, signature_size,
+                                &signature_length));
+    TEST_LE_U(signature_length, signature_size);
+    TEST_ASSERT(signature_length > 0);
+
+    PSA_ASSERT(psa_verify_message(key, alg,
+                                  input_data->x, input_data->len,
+                                  signature, signature_length));
+
+    if (input_data->len != 0) {
+        /* Flip a bit in the input and verify that the signature is now
+         * detected as invalid. Flip a bit at the beginning, not at the end,
+         * because ECDSA may ignore the last few bits of the input. */
+        input_data->x[0] ^= 1;
+        TEST_EQUAL(psa_verify_message(key, alg,
+                                      input_data->x, input_data->len,
+                                      signature, signature_length),
+                   PSA_ERROR_INVALID_SIGNATURE);
+    }
+
+exit:
+    psa_reset_key_attributes(&attributes);
+
+    psa_destroy_key(key);
+    mbedtls_free(signature);
+    PSA_DONE();
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
+void verify_message(int key_type_arg,
+                    data_t *key_data,
+                    int alg_arg,
+                    data_t *input_data,
+                    data_t *signature_data)
+{
+    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
+    psa_key_type_t key_type = key_type_arg;
+    psa_algorithm_t alg = alg_arg;
+    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+
+    TEST_LE_U(signature_data->len, PSA_SIGNATURE_MAX_SIZE);
+
+    PSA_ASSERT(psa_crypto_init());
+
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_VERIFY_MESSAGE);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
+
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+
+    PSA_ASSERT(psa_verify_message(key, alg,
+                                  input_data->x, input_data->len,
+                                  signature_data->x, signature_data->len));
+
+exit:
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    PSA_DONE();
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
+void verify_message_fail(int key_type_arg,
+                         data_t *key_data,
+                         int alg_arg,
+                         data_t *hash_data,
+                         data_t *signature_data,
+                         int expected_status_arg)
+{
+    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
+    psa_key_type_t key_type = key_type_arg;
+    psa_algorithm_t alg = alg_arg;
+    psa_status_t actual_status;
+    psa_status_t expected_status = expected_status_arg;
+    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+
+    PSA_ASSERT(psa_crypto_init());
+
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_VERIFY_MESSAGE);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
+
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+
+    actual_status = psa_verify_message(key, alg,
+                                       hash_data->x, hash_data->len,
+                                       signature_data->x,
+                                       signature_data->len);
+    TEST_EQUAL(actual_status, expected_status);
+
+exit:
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    PSA_DONE();
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
+void asymmetric_encrypt(int key_type_arg,
                         data_t *key_data,
                         int alg_arg,
                         data_t *input_data,
-                        int signature_size_arg,
-                        int expected_status_arg )
-{
-    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
-    psa_key_type_t key_type = key_type_arg;
-    psa_algorithm_t alg = alg_arg;
-    size_t signature_size = signature_size_arg;
-    psa_status_t actual_status;
-    psa_status_t expected_status = expected_status_arg;
-    unsigned char *signature = NULL;
-    size_t signature_length = 0xdeadbeef;
-    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-
-    ASSERT_ALLOC( signature, signature_size );
-
-    PSA_ASSERT( psa_crypto_init( ) );
-
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_MESSAGE );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
-
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-
-    actual_status = psa_sign_message( key, alg,
-                                      input_data->x, input_data->len,
-                                      signature, signature_size,
-                                      &signature_length );
-    TEST_EQUAL( actual_status, expected_status );
-    /* The value of *signature_length is unspecified on error, but
-     * whatever it is, it should be less than signature_size, so that
-     * if the caller tries to read *signature_length bytes without
-     * checking the error code then they don't overflow a buffer. */
-    TEST_LE_U( signature_length, signature_size );
-
-exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    mbedtls_free( signature );
-    PSA_DONE( );
-}
-/* END_CASE */
-
-/* BEGIN_CASE */
-void sign_verify_message( int key_type_arg,
-                          data_t *key_data,
-                          int alg_arg,
-                          data_t *input_data )
-{
-    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
-    psa_key_type_t key_type = key_type_arg;
-    psa_algorithm_t alg = alg_arg;
-    size_t key_bits;
-    unsigned char *signature = NULL;
-    size_t signature_size;
-    size_t signature_length = 0xdeadbeef;
-    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-
-    PSA_ASSERT( psa_crypto_init( ) );
-
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_MESSAGE |
-                                          PSA_KEY_USAGE_VERIFY_MESSAGE );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
-
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
-
-    signature_size = PSA_SIGN_OUTPUT_SIZE( key_type, key_bits, alg );
-    TEST_ASSERT( signature_size != 0 );
-    TEST_LE_U( signature_size, PSA_SIGNATURE_MAX_SIZE );
-    ASSERT_ALLOC( signature, signature_size );
-
-    PSA_ASSERT( psa_sign_message( key, alg,
-                                  input_data->x, input_data->len,
-                                  signature, signature_size,
-                                  &signature_length ) );
-    TEST_LE_U( signature_length, signature_size );
-    TEST_ASSERT( signature_length > 0 );
-
-    PSA_ASSERT( psa_verify_message( key, alg,
-                                    input_data->x, input_data->len,
-                                    signature, signature_length ) );
-
-    if( input_data->len != 0 )
-    {
-        /* Flip a bit in the input and verify that the signature is now
-         * detected as invalid. Flip a bit at the beginning, not at the end,
-         * because ECDSA may ignore the last few bits of the input. */
-        input_data->x[0] ^= 1;
-        TEST_EQUAL( psa_verify_message( key, alg,
-                                        input_data->x, input_data->len,
-                                        signature, signature_length ),
-                    PSA_ERROR_INVALID_SIGNATURE );
-    }
-
-exit:
-    psa_reset_key_attributes( &attributes );
-
-    psa_destroy_key( key );
-    mbedtls_free( signature );
-    PSA_DONE( );
-}
-/* END_CASE */
-
-/* BEGIN_CASE */
-void verify_message( int key_type_arg,
-                     data_t *key_data,
-                     int alg_arg,
-                     data_t *input_data,
-                     data_t *signature_data )
-{
-    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
-    psa_key_type_t key_type = key_type_arg;
-    psa_algorithm_t alg = alg_arg;
-    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-
-    TEST_LE_U( signature_data->len, PSA_SIGNATURE_MAX_SIZE );
-
-    PSA_ASSERT( psa_crypto_init( ) );
-
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_VERIFY_MESSAGE );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
-
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-
-    PSA_ASSERT( psa_verify_message( key, alg,
-                                    input_data->x, input_data->len,
-                                    signature_data->x, signature_data->len ) );
-
-exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    PSA_DONE( );
-}
-/* END_CASE */
-
-/* BEGIN_CASE */
-void verify_message_fail( int key_type_arg,
-                          data_t *key_data,
-                          int alg_arg,
-                          data_t *hash_data,
-                          data_t *signature_data,
-                          int expected_status_arg )
-{
-    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
-    psa_key_type_t key_type = key_type_arg;
-    psa_algorithm_t alg = alg_arg;
-    psa_status_t actual_status;
-    psa_status_t expected_status = expected_status_arg;
-    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-
-    PSA_ASSERT( psa_crypto_init( ) );
-
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_VERIFY_MESSAGE );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
-
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-
-    actual_status = psa_verify_message( key, alg,
-                                        hash_data->x, hash_data->len,
-                                        signature_data->x,
-                                        signature_data->len );
-    TEST_EQUAL( actual_status, expected_status );
-
-exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    PSA_DONE( );
-}
-/* END_CASE */
-
-/* BEGIN_CASE */
-void asymmetric_encrypt( int key_type_arg,
-                         data_t *key_data,
-                         int alg_arg,
-                         data_t *input_data,
-                         data_t *label,
-                         int expected_output_length_arg,
-                         int expected_status_arg )
+                        data_t *label,
+                        int expected_output_length_arg,
+                        int expected_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -4138,46 +4149,46 @@
     psa_status_t expected_status = expected_status_arg;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Import the key */
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
     /* Determine the maximum output length */
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
 
-    output_size = PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE( key_type, key_bits, alg );
-    TEST_LE_U( output_size, PSA_ASYMMETRIC_ENCRYPT_OUTPUT_MAX_SIZE );
-    ASSERT_ALLOC( output, output_size );
+    output_size = PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE(key_type, key_bits, alg);
+    TEST_LE_U(output_size, PSA_ASYMMETRIC_ENCRYPT_OUTPUT_MAX_SIZE);
+    ASSERT_ALLOC(output, output_size);
 
     /* Encrypt the input */
-    actual_status = psa_asymmetric_encrypt( key, alg,
-                                            input_data->x, input_data->len,
-                                            label->x, label->len,
-                                            output, output_size,
-                                            &output_length );
-    TEST_EQUAL( actual_status, expected_status );
-    TEST_EQUAL( output_length, expected_output_length );
+    actual_status = psa_asymmetric_encrypt(key, alg,
+                                           input_data->x, input_data->len,
+                                           label->x, label->len,
+                                           output, output_size,
+                                           &output_length);
+    TEST_EQUAL(actual_status, expected_status);
+    TEST_EQUAL(output_length, expected_output_length);
 
     /* If the label is empty, the test framework puts a non-null pointer
      * in label->x. Test that a null pointer works as well. */
-    if( label->len == 0 )
-    {
+    if (label->len == 0) {
         output_length = ~0;
-        if( output_size != 0 )
-            memset( output, 0, output_size );
-        actual_status = psa_asymmetric_encrypt( key, alg,
-                                                input_data->x, input_data->len,
-                                                NULL, label->len,
-                                                output, output_size,
-                                                &output_length );
-        TEST_EQUAL( actual_status, expected_status );
-        TEST_EQUAL( output_length, expected_output_length );
+        if (output_size != 0) {
+            memset(output, 0, output_size);
+        }
+        actual_status = psa_asymmetric_encrypt(key, alg,
+                                               input_data->x, input_data->len,
+                                               NULL, label->len,
+                                               output, output_size,
+                                               &output_length);
+        TEST_EQUAL(actual_status, expected_status);
+        TEST_EQUAL(output_length, expected_output_length);
     }
 
 exit:
@@ -4185,20 +4196,20 @@
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    psa_destroy_key( key );
-    mbedtls_free( output );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    mbedtls_free(output);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void asymmetric_encrypt_decrypt( int key_type_arg,
-                                 data_t *key_data,
-                                 int alg_arg,
-                                 data_t *input_data,
-                                 data_t *label )
+void asymmetric_encrypt_decrypt(int key_type_arg,
+                                data_t *key_data,
+                                int alg_arg,
+                                data_t *input_data,
+                                data_t *label)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -4212,70 +4223,70 @@
     size_t output2_length = ~0;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
     /* Determine the maximum ciphertext length */
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
 
-    output_size = PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE( key_type, key_bits, alg );
-    TEST_LE_U( output_size, PSA_ASYMMETRIC_ENCRYPT_OUTPUT_MAX_SIZE );
-    ASSERT_ALLOC( output, output_size );
+    output_size = PSA_ASYMMETRIC_ENCRYPT_OUTPUT_SIZE(key_type, key_bits, alg);
+    TEST_LE_U(output_size, PSA_ASYMMETRIC_ENCRYPT_OUTPUT_MAX_SIZE);
+    ASSERT_ALLOC(output, output_size);
 
     output2_size = input_data->len;
-    TEST_LE_U( output2_size,
-               PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE( key_type, key_bits, alg ) );
-    TEST_LE_U( output2_size, PSA_ASYMMETRIC_DECRYPT_OUTPUT_MAX_SIZE );
-    ASSERT_ALLOC( output2, output2_size );
+    TEST_LE_U(output2_size,
+              PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE(key_type, key_bits, alg));
+    TEST_LE_U(output2_size, PSA_ASYMMETRIC_DECRYPT_OUTPUT_MAX_SIZE);
+    ASSERT_ALLOC(output2, output2_size);
 
     /* We test encryption by checking that encrypt-then-decrypt gives back
      * the original plaintext because of the non-optional random
      * part of encryption process which prevents using fixed vectors. */
-    PSA_ASSERT( psa_asymmetric_encrypt( key, alg,
-                                        input_data->x, input_data->len,
-                                        label->x, label->len,
-                                        output, output_size,
-                                        &output_length ) );
+    PSA_ASSERT(psa_asymmetric_encrypt(key, alg,
+                                      input_data->x, input_data->len,
+                                      label->x, label->len,
+                                      output, output_size,
+                                      &output_length));
     /* We don't know what ciphertext length to expect, but check that
      * it looks sensible. */
-    TEST_LE_U( output_length, output_size );
+    TEST_LE_U(output_length, output_size);
 
-    PSA_ASSERT( psa_asymmetric_decrypt( key, alg,
-                                        output, output_length,
-                                        label->x, label->len,
-                                        output2, output2_size,
-                                        &output2_length ) );
-    ASSERT_COMPARE( input_data->x, input_data->len,
-                    output2, output2_length );
+    PSA_ASSERT(psa_asymmetric_decrypt(key, alg,
+                                      output, output_length,
+                                      label->x, label->len,
+                                      output2, output2_size,
+                                      &output2_length));
+    ASSERT_COMPARE(input_data->x, input_data->len,
+                   output2, output2_length);
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    psa_destroy_key( key );
-    mbedtls_free( output );
-    mbedtls_free( output2 );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    mbedtls_free(output);
+    mbedtls_free(output2);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void asymmetric_decrypt( int key_type_arg,
-                         data_t *key_data,
-                         int alg_arg,
-                         data_t *input_data,
-                         data_t *label,
-                         data_t *expected_data )
+void asymmetric_decrypt(int key_type_arg,
+                        data_t *key_data,
+                        int alg_arg,
+                        data_t *input_data,
+                        data_t *label,
+                        data_t *expected_data)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -4286,65 +4297,65 @@
     size_t output_length = ~0;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
 
     /* Determine the maximum ciphertext length */
-    output_size = PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE( key_type, key_bits, alg );
-    TEST_LE_U( output_size, PSA_ASYMMETRIC_DECRYPT_OUTPUT_MAX_SIZE );
-    ASSERT_ALLOC( output, output_size );
+    output_size = PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE(key_type, key_bits, alg);
+    TEST_LE_U(output_size, PSA_ASYMMETRIC_DECRYPT_OUTPUT_MAX_SIZE);
+    ASSERT_ALLOC(output, output_size);
 
-    PSA_ASSERT( psa_asymmetric_decrypt( key, alg,
-                                        input_data->x, input_data->len,
-                                        label->x, label->len,
-                                        output,
-                                        output_size,
-                                        &output_length ) );
-    ASSERT_COMPARE( expected_data->x, expected_data->len,
-                    output, output_length );
+    PSA_ASSERT(psa_asymmetric_decrypt(key, alg,
+                                      input_data->x, input_data->len,
+                                      label->x, label->len,
+                                      output,
+                                      output_size,
+                                      &output_length));
+    ASSERT_COMPARE(expected_data->x, expected_data->len,
+                   output, output_length);
 
     /* If the label is empty, the test framework puts a non-null pointer
      * in label->x. Test that a null pointer works as well. */
-    if( label->len == 0 )
-    {
+    if (label->len == 0) {
         output_length = ~0;
-        if( output_size != 0 )
-            memset( output, 0, output_size );
-        PSA_ASSERT( psa_asymmetric_decrypt( key, alg,
-                                            input_data->x, input_data->len,
-                                            NULL, label->len,
-                                            output,
-                                            output_size,
-                                            &output_length ) );
-        ASSERT_COMPARE( expected_data->x, expected_data->len,
-                        output, output_length );
+        if (output_size != 0) {
+            memset(output, 0, output_size);
+        }
+        PSA_ASSERT(psa_asymmetric_decrypt(key, alg,
+                                          input_data->x, input_data->len,
+                                          NULL, label->len,
+                                          output,
+                                          output_size,
+                                          &output_length));
+        ASSERT_COMPARE(expected_data->x, expected_data->len,
+                       output, output_length);
     }
 
 exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    mbedtls_free( output );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    mbedtls_free(output);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void asymmetric_decrypt_fail( int key_type_arg,
-                              data_t *key_data,
-                              int alg_arg,
-                              data_t *input_data,
-                              data_t *label,
-                              int output_size_arg,
-                              int expected_status_arg  )
+void asymmetric_decrypt_fail(int key_type_arg,
+                             data_t *key_data,
+                             int alg_arg,
+                             data_t *input_data,
+                             data_t *label,
+                             int output_size_arg,
+                             int expected_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -4356,135 +4367,135 @@
     psa_status_t expected_status = expected_status_arg;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    ASSERT_ALLOC( output, output_size );
+    ASSERT_ALLOC(output, output_size);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    actual_status = psa_asymmetric_decrypt( key, alg,
-                                            input_data->x, input_data->len,
-                                            label->x, label->len,
-                                            output, output_size,
-                                            &output_length );
-    TEST_EQUAL( actual_status, expected_status );
-    TEST_LE_U( output_length, output_size );
+    actual_status = psa_asymmetric_decrypt(key, alg,
+                                           input_data->x, input_data->len,
+                                           label->x, label->len,
+                                           output, output_size,
+                                           &output_length);
+    TEST_EQUAL(actual_status, expected_status);
+    TEST_LE_U(output_length, output_size);
 
     /* If the label is empty, the test framework puts a non-null pointer
      * in label->x. Test that a null pointer works as well. */
-    if( label->len == 0 )
-    {
+    if (label->len == 0) {
         output_length = ~0;
-        if( output_size != 0 )
-            memset( output, 0, output_size );
-        actual_status = psa_asymmetric_decrypt( key, alg,
-                                                input_data->x, input_data->len,
-                                                NULL, label->len,
-                                                output, output_size,
-                                                &output_length );
-        TEST_EQUAL( actual_status, expected_status );
-        TEST_LE_U( output_length, output_size );
+        if (output_size != 0) {
+            memset(output, 0, output_size);
+        }
+        actual_status = psa_asymmetric_decrypt(key, alg,
+                                               input_data->x, input_data->len,
+                                               NULL, label->len,
+                                               output, output_size,
+                                               &output_length);
+        TEST_EQUAL(actual_status, expected_status);
+        TEST_LE_U(output_length, output_size);
     }
 
 exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    mbedtls_free( output );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    mbedtls_free(output);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void key_derivation_init( )
+void key_derivation_init()
 {
     /* Test each valid way of initializing the object, except for `= {0}`, as
      * Clang 5 complains when `-Wmissing-field-initializers` is used, even
      * though it's OK by the C standard. We could test for this, but we'd need
      * to suppress the Clang warning for the test. */
     size_t capacity;
-    psa_key_derivation_operation_t func = psa_key_derivation_operation_init( );
+    psa_key_derivation_operation_t func = psa_key_derivation_operation_init();
     psa_key_derivation_operation_t init = PSA_KEY_DERIVATION_OPERATION_INIT;
     psa_key_derivation_operation_t zero;
 
-    memset( &zero, 0, sizeof( zero ) );
+    memset(&zero, 0, sizeof(zero));
 
     /* A default operation should not be able to report its capacity. */
-    TEST_EQUAL( psa_key_derivation_get_capacity( &func, &capacity ),
-                PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( psa_key_derivation_get_capacity( &init, &capacity ),
-                PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( psa_key_derivation_get_capacity( &zero, &capacity ),
-                PSA_ERROR_BAD_STATE );
+    TEST_EQUAL(psa_key_derivation_get_capacity(&func, &capacity),
+               PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(psa_key_derivation_get_capacity(&init, &capacity),
+               PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(psa_key_derivation_get_capacity(&zero, &capacity),
+               PSA_ERROR_BAD_STATE);
 
     /* A default operation should be abortable without error. */
-    PSA_ASSERT( psa_key_derivation_abort(&func) );
-    PSA_ASSERT( psa_key_derivation_abort(&init) );
-    PSA_ASSERT( psa_key_derivation_abort(&zero) );
+    PSA_ASSERT(psa_key_derivation_abort(&func));
+    PSA_ASSERT(psa_key_derivation_abort(&init));
+    PSA_ASSERT(psa_key_derivation_abort(&zero));
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void derive_setup( int alg_arg, int expected_status_arg )
+void derive_setup(int alg_arg, int expected_status_arg)
 {
     psa_algorithm_t alg = alg_arg;
     psa_status_t expected_status = expected_status_arg;
     psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    TEST_EQUAL( psa_key_derivation_setup( &operation, alg ),
-                expected_status );
+    TEST_EQUAL(psa_key_derivation_setup(&operation, alg),
+               expected_status);
 
 exit:
-    psa_key_derivation_abort( &operation );
-    PSA_DONE( );
+    psa_key_derivation_abort(&operation);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void derive_set_capacity( int alg_arg, int capacity_arg,
-                          int expected_status_arg )
+void derive_set_capacity(int alg_arg, int capacity_arg,
+                         int expected_status_arg)
 {
     psa_algorithm_t alg = alg_arg;
     size_t capacity = capacity_arg;
     psa_status_t expected_status = expected_status_arg;
     psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    PSA_ASSERT( psa_key_derivation_setup( &operation, alg ) );
+    PSA_ASSERT(psa_key_derivation_setup(&operation, alg));
 
-    TEST_EQUAL( psa_key_derivation_set_capacity( &operation, capacity ),
-                expected_status );
+    TEST_EQUAL(psa_key_derivation_set_capacity(&operation, capacity),
+               expected_status);
 
 exit:
-    psa_key_derivation_abort( &operation );
-    PSA_DONE( );
+    psa_key_derivation_abort(&operation);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void derive_input( int alg_arg,
-                   int step_arg1, int key_type_arg1, data_t *input1,
-                   int expected_status_arg1,
-                   int step_arg2, int key_type_arg2, data_t *input2,
-                   int expected_status_arg2,
-                   int step_arg3, int key_type_arg3, data_t *input3,
-                   int expected_status_arg3,
-                   int output_key_type_arg, int expected_output_status_arg )
+void derive_input(int alg_arg,
+                  int step_arg1, int key_type_arg1, data_t *input1,
+                  int expected_status_arg1,
+                  int step_arg2, int key_type_arg2, data_t *input2,
+                  int expected_status_arg2,
+                  int step_arg3, int key_type_arg3, data_t *input3,
+                  int expected_status_arg3,
+                  int output_key_type_arg, int expected_output_status_arg)
 {
     psa_algorithm_t alg = alg_arg;
-    psa_key_derivation_step_t steps[] = {step_arg1, step_arg2, step_arg3};
-    psa_key_type_t key_types[] = {key_type_arg1, key_type_arg2, key_type_arg3};
-    psa_status_t expected_statuses[] = {expected_status_arg1,
-                                        expected_status_arg2,
-                                        expected_status_arg3};
-    data_t *inputs[] = {input1, input2, input3};
+    psa_key_derivation_step_t steps[] = { step_arg1, step_arg2, step_arg3 };
+    psa_key_type_t key_types[] = { key_type_arg1, key_type_arg2, key_type_arg3 };
+    psa_status_t expected_statuses[] = { expected_status_arg1,
+                                         expected_status_arg2,
+                                         expected_status_arg3 };
+    data_t *inputs[] = { input1, input2, input3 };
     mbedtls_svc_key_id_t keys[] = { MBEDTLS_SVC_KEY_ID_INIT,
                                     MBEDTLS_SVC_KEY_ID_INIT,
                                     MBEDTLS_SVC_KEY_ID_INIT };
@@ -4496,179 +4507,169 @@
     psa_status_t expected_output_status = expected_output_status_arg;
     psa_status_t actual_output_status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DERIVE );
-    psa_set_key_algorithm( &attributes, alg );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE);
+    psa_set_key_algorithm(&attributes, alg);
 
-    PSA_ASSERT( psa_key_derivation_setup( &operation, alg ) );
+    PSA_ASSERT(psa_key_derivation_setup(&operation, alg));
 
-    for( i = 0; i < ARRAY_LENGTH( steps ); i++ )
-    {
-        mbedtls_test_set_step( i );
-        if( steps[i] == 0 )
-        {
+    for (i = 0; i < ARRAY_LENGTH(steps); i++) {
+        mbedtls_test_set_step(i);
+        if (steps[i] == 0) {
             /* Skip this step */
-        }
-        else if( key_types[i] != PSA_KEY_TYPE_NONE )
-        {
-            psa_set_key_type( &attributes, key_types[i] );
-            PSA_ASSERT( psa_import_key( &attributes,
-                                        inputs[i]->x, inputs[i]->len,
-                                        &keys[i] ) );
-            if( PSA_KEY_TYPE_IS_KEY_PAIR( key_types[i] ) &&
-                steps[i] == PSA_KEY_DERIVATION_INPUT_SECRET )
-            {
+        } else if (key_types[i] != PSA_KEY_TYPE_NONE) {
+            psa_set_key_type(&attributes, key_types[i]);
+            PSA_ASSERT(psa_import_key(&attributes,
+                                      inputs[i]->x, inputs[i]->len,
+                                      &keys[i]));
+            if (PSA_KEY_TYPE_IS_KEY_PAIR(key_types[i]) &&
+                steps[i] == PSA_KEY_DERIVATION_INPUT_SECRET) {
                 // When taking a private key as secret input, use key agreement
                 // to add the shared secret to the derivation
-                TEST_EQUAL( mbedtls_test_psa_key_agreement_with_self(
-                                &operation, keys[i] ),
-                            expected_statuses[i] );
+                TEST_EQUAL(mbedtls_test_psa_key_agreement_with_self(
+                               &operation, keys[i]),
+                           expected_statuses[i]);
+            } else {
+                TEST_EQUAL(psa_key_derivation_input_key(&operation, steps[i],
+                                                        keys[i]),
+                           expected_statuses[i]);
             }
-            else
-            {
-                TEST_EQUAL( psa_key_derivation_input_key( &operation, steps[i],
-                                                          keys[i] ),
-                            expected_statuses[i] );
-            }
-        }
-        else
-        {
-            TEST_EQUAL( psa_key_derivation_input_bytes(
-                            &operation, steps[i],
-                            inputs[i]->x, inputs[i]->len ),
-                        expected_statuses[i] );
+        } else {
+            TEST_EQUAL(psa_key_derivation_input_bytes(
+                           &operation, steps[i],
+                           inputs[i]->x, inputs[i]->len),
+                       expected_statuses[i]);
         }
     }
 
-    if( output_key_type != PSA_KEY_TYPE_NONE )
-    {
-        psa_reset_key_attributes( &attributes );
-        psa_set_key_type( &attributes, output_key_type );
-        psa_set_key_bits( &attributes, 8 );
+    if (output_key_type != PSA_KEY_TYPE_NONE) {
+        psa_reset_key_attributes(&attributes);
+        psa_set_key_type(&attributes, output_key_type);
+        psa_set_key_bits(&attributes, 8);
         actual_output_status =
-            psa_key_derivation_output_key( &attributes, &operation,
-                                           &output_key );
-    }
-    else
-    {
+            psa_key_derivation_output_key(&attributes, &operation,
+                                          &output_key);
+    } else {
         uint8_t buffer[1];
         actual_output_status =
-            psa_key_derivation_output_bytes( &operation,
-                                             buffer, sizeof( buffer ) );
+            psa_key_derivation_output_bytes(&operation,
+                                            buffer, sizeof(buffer));
     }
-    TEST_EQUAL( actual_output_status, expected_output_status );
+    TEST_EQUAL(actual_output_status, expected_output_status);
 
 exit:
-    psa_key_derivation_abort( &operation );
-    for( i = 0; i < ARRAY_LENGTH( keys ); i++ )
-        psa_destroy_key( keys[i] );
-    psa_destroy_key( output_key );
-    PSA_DONE( );
+    psa_key_derivation_abort(&operation);
+    for (i = 0; i < ARRAY_LENGTH(keys); i++) {
+        psa_destroy_key(keys[i]);
+    }
+    psa_destroy_key(output_key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void derive_over_capacity( int alg_arg )
+void derive_over_capacity(int alg_arg)
 {
     psa_algorithm_t alg = alg_arg;
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     size_t key_type = PSA_KEY_TYPE_DERIVE;
     psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
     unsigned char input1[] = "Input 1";
-    size_t input1_length = sizeof( input1 );
+    size_t input1_length = sizeof(input1);
     unsigned char input2[] = "Input 2";
-    size_t input2_length = sizeof( input2 );
+    size_t input2_length = sizeof(input2);
     uint8_t buffer[42];
-    size_t capacity = sizeof( buffer );
+    size_t capacity = sizeof(buffer);
     const uint8_t key_data[22] = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
                                    0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
-                                   0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b};
+                                   0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b };
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DERIVE );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes,
-                                key_data, sizeof( key_data ),
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes,
+                              key_data, sizeof(key_data),
+                              &key));
 
     /* valid key derivation */
-    if( !mbedtls_test_psa_setup_key_derivation_wrap( &operation, key, alg,
-                                                     input1, input1_length,
-                                                     input2, input2_length,
-                                                     capacity ) )
+    if (!mbedtls_test_psa_setup_key_derivation_wrap(&operation, key, alg,
+                                                    input1, input1_length,
+                                                    input2, input2_length,
+                                                    capacity)) {
         goto exit;
+    }
 
     /* state of operation shouldn't allow additional generation */
-    TEST_EQUAL(  psa_key_derivation_setup( &operation, alg ),
-                 PSA_ERROR_BAD_STATE );
+    TEST_EQUAL(psa_key_derivation_setup(&operation, alg),
+               PSA_ERROR_BAD_STATE);
 
-    PSA_ASSERT( psa_key_derivation_output_bytes( &operation, buffer, capacity ) );
+    PSA_ASSERT(psa_key_derivation_output_bytes(&operation, buffer, capacity));
 
-    TEST_EQUAL( psa_key_derivation_output_bytes( &operation, buffer, capacity ),
-                PSA_ERROR_INSUFFICIENT_DATA );
+    TEST_EQUAL(psa_key_derivation_output_bytes(&operation, buffer, capacity),
+               PSA_ERROR_INSUFFICIENT_DATA);
 
 exit:
-    psa_key_derivation_abort( &operation );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_key_derivation_abort(&operation);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void derive_actions_without_setup( )
+void derive_actions_without_setup()
 {
     uint8_t output_buffer[16];
     size_t buffer_size = 16;
     size_t capacity = 0;
     psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
 
-    TEST_ASSERT( psa_key_derivation_output_bytes( &operation,
-                                                  output_buffer, buffer_size )
-                 == PSA_ERROR_BAD_STATE );
+    TEST_ASSERT(psa_key_derivation_output_bytes(&operation,
+                                                output_buffer, buffer_size)
+                == PSA_ERROR_BAD_STATE);
 
-    TEST_ASSERT( psa_key_derivation_get_capacity( &operation, &capacity )
-                 == PSA_ERROR_BAD_STATE );
+    TEST_ASSERT(psa_key_derivation_get_capacity(&operation, &capacity)
+                == PSA_ERROR_BAD_STATE);
 
-    PSA_ASSERT( psa_key_derivation_abort( &operation ) );
+    PSA_ASSERT(psa_key_derivation_abort(&operation));
 
-    TEST_ASSERT( psa_key_derivation_output_bytes( &operation,
-                                                  output_buffer, buffer_size )
-                 == PSA_ERROR_BAD_STATE );
+    TEST_ASSERT(psa_key_derivation_output_bytes(&operation,
+                                                output_buffer, buffer_size)
+                == PSA_ERROR_BAD_STATE);
 
-    TEST_ASSERT( psa_key_derivation_get_capacity( &operation, &capacity )
-                 == PSA_ERROR_BAD_STATE );
+    TEST_ASSERT(psa_key_derivation_get_capacity(&operation, &capacity)
+                == PSA_ERROR_BAD_STATE);
 
 exit:
-    psa_key_derivation_abort( &operation );
+    psa_key_derivation_abort(&operation);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void derive_output( int alg_arg,
-                    int step1_arg, data_t *input1,
-                    int step2_arg, data_t *input2,
-                    int step3_arg, data_t *input3,
-                    int requested_capacity_arg,
-                    data_t *expected_output1,
-                    data_t *expected_output2 )
+void derive_output(int alg_arg,
+                   int step1_arg, data_t *input1,
+                   int step2_arg, data_t *input2,
+                   int step3_arg, data_t *input3,
+                   int requested_capacity_arg,
+                   data_t *expected_output1,
+                   data_t *expected_output2)
 {
     psa_algorithm_t alg = alg_arg;
-    psa_key_derivation_step_t steps[] = {step1_arg, step2_arg, step3_arg};
-    data_t *inputs[] = {input1, input2, input3};
+    psa_key_derivation_step_t steps[] = { step1_arg, step2_arg, step3_arg };
+    data_t *inputs[] = { input1, input2, input3 };
     mbedtls_svc_key_id_t keys[] = { MBEDTLS_SVC_KEY_ID_INIT,
                                     MBEDTLS_SVC_KEY_ID_INIT,
                                     MBEDTLS_SVC_KEY_ID_INIT };
     size_t requested_capacity = requested_capacity_arg;
     psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
     uint8_t *expected_outputs[2] =
-        {expected_output1->x, expected_output2->x};
+    { expected_output1->x, expected_output2->x };
     size_t output_sizes[2] =
-        {expected_output1->len, expected_output2->len};
+    { expected_output1->len, expected_output2->len };
     size_t output_buffer_size = 0;
     uint8_t *output_buffer = NULL;
     size_t expected_capacity;
@@ -4677,107 +4678,103 @@
     psa_status_t status;
     size_t i;
 
-    for( i = 0; i < ARRAY_LENGTH( expected_outputs ); i++ )
-    {
-        if( output_sizes[i] > output_buffer_size )
+    for (i = 0; i < ARRAY_LENGTH(expected_outputs); i++) {
+        if (output_sizes[i] > output_buffer_size) {
             output_buffer_size = output_sizes[i];
-        if( output_sizes[i] == 0 )
+        }
+        if (output_sizes[i] == 0) {
             expected_outputs[i] = NULL;
+        }
     }
-    ASSERT_ALLOC( output_buffer, output_buffer_size );
-    PSA_ASSERT( psa_crypto_init( ) );
+    ASSERT_ALLOC(output_buffer, output_buffer_size);
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DERIVE );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_DERIVE );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_DERIVE);
 
     /* Extraction phase. */
-    PSA_ASSERT( psa_key_derivation_setup( &operation, alg ) );
-    PSA_ASSERT( psa_key_derivation_set_capacity( &operation,
-                                                 requested_capacity ) );
-    for( i = 0; i < ARRAY_LENGTH( steps ); i++ )
-    {
-        switch( steps[i] )
-        {
+    PSA_ASSERT(psa_key_derivation_setup(&operation, alg));
+    PSA_ASSERT(psa_key_derivation_set_capacity(&operation,
+                                               requested_capacity));
+    for (i = 0; i < ARRAY_LENGTH(steps); i++) {
+        switch (steps[i]) {
             case 0:
                 break;
             case PSA_KEY_DERIVATION_INPUT_SECRET:
-                PSA_ASSERT( psa_import_key( &attributes,
-                                            inputs[i]->x, inputs[i]->len,
-                                            &keys[i] ) );
+                PSA_ASSERT(psa_import_key(&attributes,
+                                          inputs[i]->x, inputs[i]->len,
+                                          &keys[i]));
 
-                if ( PSA_ALG_IS_TLS12_PSK_TO_MS( alg ) )
-                {
-                    PSA_ASSERT( psa_get_key_attributes( keys[i], &attributes ) );
-                    TEST_ASSERT( PSA_BITS_TO_BYTES( psa_get_key_bits( &attributes ) ) <=
-                                 PSA_TLS12_PSK_TO_MS_PSK_MAX_SIZE );
+                if (PSA_ALG_IS_TLS12_PSK_TO_MS(alg)) {
+                    PSA_ASSERT(psa_get_key_attributes(keys[i], &attributes));
+                    TEST_ASSERT(PSA_BITS_TO_BYTES(psa_get_key_bits(&attributes)) <=
+                                PSA_TLS12_PSK_TO_MS_PSK_MAX_SIZE);
                 }
 
-                PSA_ASSERT( psa_key_derivation_input_key(
-                                &operation, steps[i], keys[i] ) );
+                PSA_ASSERT(psa_key_derivation_input_key(
+                               &operation, steps[i], keys[i]));
                 break;
             default:
-                PSA_ASSERT( psa_key_derivation_input_bytes(
-                                &operation, steps[i],
-                                inputs[i]->x, inputs[i]->len ) );
+                PSA_ASSERT(psa_key_derivation_input_bytes(
+                               &operation, steps[i],
+                               inputs[i]->x, inputs[i]->len));
                 break;
         }
     }
 
-    PSA_ASSERT( psa_key_derivation_get_capacity( &operation,
-                                                 &current_capacity ) );
-    TEST_EQUAL( current_capacity, requested_capacity );
+    PSA_ASSERT(psa_key_derivation_get_capacity(&operation,
+                                               &current_capacity));
+    TEST_EQUAL(current_capacity, requested_capacity);
     expected_capacity = requested_capacity;
 
     /* Expansion phase. */
-    for( i = 0; i < ARRAY_LENGTH( expected_outputs ); i++ )
-    {
+    for (i = 0; i < ARRAY_LENGTH(expected_outputs); i++) {
         /* Read some bytes. */
-        status = psa_key_derivation_output_bytes( &operation,
-                                                  output_buffer, output_sizes[i] );
-        if( expected_capacity == 0 && output_sizes[i] == 0 )
-        {
+        status = psa_key_derivation_output_bytes(&operation,
+                                                 output_buffer, output_sizes[i]);
+        if (expected_capacity == 0 && output_sizes[i] == 0) {
             /* Reading 0 bytes when 0 bytes are available can go either way. */
-            TEST_ASSERT( status == PSA_SUCCESS ||
-                         status == PSA_ERROR_INSUFFICIENT_DATA );
+            TEST_ASSERT(status == PSA_SUCCESS ||
+                        status == PSA_ERROR_INSUFFICIENT_DATA);
             continue;
-        }
-        else if( expected_capacity == 0 ||
-                 output_sizes[i] > expected_capacity )
-        {
+        } else if (expected_capacity == 0 ||
+                   output_sizes[i] > expected_capacity) {
             /* Capacity exceeded. */
-            TEST_EQUAL( status, PSA_ERROR_INSUFFICIENT_DATA );
+            TEST_EQUAL(status, PSA_ERROR_INSUFFICIENT_DATA);
             expected_capacity = 0;
             continue;
         }
         /* Success. Check the read data. */
-        PSA_ASSERT( status );
-        if( output_sizes[i] != 0 )
-            ASSERT_COMPARE( output_buffer, output_sizes[i],
-                            expected_outputs[i], output_sizes[i] );
+        PSA_ASSERT(status);
+        if (output_sizes[i] != 0) {
+            ASSERT_COMPARE(output_buffer, output_sizes[i],
+                           expected_outputs[i], output_sizes[i]);
+        }
         /* Check the operation status. */
         expected_capacity -= output_sizes[i];
-        PSA_ASSERT( psa_key_derivation_get_capacity( &operation,
-                                                     &current_capacity ) );
-        TEST_EQUAL( expected_capacity, current_capacity );
+        PSA_ASSERT(psa_key_derivation_get_capacity(&operation,
+                                                   &current_capacity));
+        TEST_EQUAL(expected_capacity, current_capacity);
     }
-    PSA_ASSERT( psa_key_derivation_abort( &operation ) );
+    PSA_ASSERT(psa_key_derivation_abort(&operation));
 
 exit:
-    mbedtls_free( output_buffer );
-    psa_key_derivation_abort( &operation );
-    for( i = 0; i < ARRAY_LENGTH( keys ); i++ )
-        psa_destroy_key( keys[i] );
-    PSA_DONE( );
+    mbedtls_free(output_buffer);
+    psa_key_derivation_abort(&operation);
+    for (i = 0; i < ARRAY_LENGTH(keys); i++) {
+        psa_destroy_key(keys[i]);
+    }
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void derive_full( int alg_arg,
-                  data_t *key_data,
-                  data_t *input1,
-                  data_t *input2,
-                  int requested_capacity_arg )
+void derive_full(int alg_arg,
+                 data_t *key_data,
+                 data_t *input1,
+                 data_t *input2,
+                 int requested_capacity_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_algorithm_t alg = alg_arg;
@@ -4788,62 +4785,63 @@
     size_t current_capacity;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DERIVE );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_DERIVE );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_DERIVE);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    if( !mbedtls_test_psa_setup_key_derivation_wrap( &operation, key, alg,
-                                                     input1->x, input1->len,
-                                                     input2->x, input2->len,
-                                                     requested_capacity ) )
+    if (!mbedtls_test_psa_setup_key_derivation_wrap(&operation, key, alg,
+                                                    input1->x, input1->len,
+                                                    input2->x, input2->len,
+                                                    requested_capacity)) {
         goto exit;
+    }
 
-    PSA_ASSERT( psa_key_derivation_get_capacity( &operation,
-                                                 &current_capacity ) );
-    TEST_EQUAL( current_capacity, expected_capacity );
+    PSA_ASSERT(psa_key_derivation_get_capacity(&operation,
+                                               &current_capacity));
+    TEST_EQUAL(current_capacity, expected_capacity);
 
     /* Expansion phase. */
-    while( current_capacity > 0 )
-    {
-        size_t read_size = sizeof( output_buffer );
-        if( read_size > current_capacity )
+    while (current_capacity > 0) {
+        size_t read_size = sizeof(output_buffer);
+        if (read_size > current_capacity) {
             read_size = current_capacity;
-        PSA_ASSERT( psa_key_derivation_output_bytes( &operation,
-                                                     output_buffer,
-                                                     read_size ) );
+        }
+        PSA_ASSERT(psa_key_derivation_output_bytes(&operation,
+                                                   output_buffer,
+                                                   read_size));
         expected_capacity -= read_size;
-        PSA_ASSERT( psa_key_derivation_get_capacity( &operation,
-                                                     &current_capacity ) );
-        TEST_EQUAL( current_capacity, expected_capacity );
+        PSA_ASSERT(psa_key_derivation_get_capacity(&operation,
+                                                   &current_capacity));
+        TEST_EQUAL(current_capacity, expected_capacity);
     }
 
     /* Check that the operation refuses to go over capacity. */
-    TEST_EQUAL( psa_key_derivation_output_bytes( &operation, output_buffer, 1 ),
-                PSA_ERROR_INSUFFICIENT_DATA );
+    TEST_EQUAL(psa_key_derivation_output_bytes(&operation, output_buffer, 1),
+               PSA_ERROR_INSUFFICIENT_DATA);
 
-    PSA_ASSERT( psa_key_derivation_abort( &operation ) );
+    PSA_ASSERT(psa_key_derivation_abort(&operation));
 
 exit:
-    psa_key_derivation_abort( &operation );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_key_derivation_abort(&operation);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void derive_key_exercise( int alg_arg,
-                          data_t *key_data,
-                          data_t *input1,
-                          data_t *input2,
-                          int derived_type_arg,
-                          int derived_bits_arg,
-                          int derived_usage_arg,
-                          int derived_alg_arg )
+void derive_key_exercise(int alg_arg,
+                         data_t *key_data,
+                         data_t *input1,
+                         data_t *input2,
+                         int derived_type_arg,
+                         int derived_bits_arg,
+                         int derived_usage_arg,
+                         int derived_alg_arg)
 {
     mbedtls_svc_key_id_t base_key = MBEDTLS_SVC_KEY_ID_INIT;
     mbedtls_svc_key_id_t derived_key = MBEDTLS_SVC_KEY_ID_INIT;
@@ -4852,63 +4850,65 @@
     size_t derived_bits = derived_bits_arg;
     psa_key_usage_t derived_usage = derived_usage_arg;
     psa_algorithm_t derived_alg = derived_alg_arg;
-    size_t capacity = PSA_BITS_TO_BYTES( derived_bits );
+    size_t capacity = PSA_BITS_TO_BYTES(derived_bits);
     psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_attributes_t got_attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DERIVE );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_DERIVE );
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &base_key ) );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_DERIVE);
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &base_key));
 
     /* Derive a key. */
-    if ( !mbedtls_test_psa_setup_key_derivation_wrap( &operation, base_key, alg,
-                                                     input1->x, input1->len,
-                                                     input2->x, input2->len,
-                                                     capacity ) )
+    if (!mbedtls_test_psa_setup_key_derivation_wrap(&operation, base_key, alg,
+                                                    input1->x, input1->len,
+                                                    input2->x, input2->len,
+                                                    capacity)) {
         goto exit;
+    }
 
-    psa_set_key_usage_flags( &attributes, derived_usage );
-    psa_set_key_algorithm( &attributes, derived_alg );
-    psa_set_key_type( &attributes, derived_type );
-    psa_set_key_bits( &attributes, derived_bits );
-    PSA_ASSERT( psa_key_derivation_output_key( &attributes, &operation,
-                                               &derived_key ) );
+    psa_set_key_usage_flags(&attributes, derived_usage);
+    psa_set_key_algorithm(&attributes, derived_alg);
+    psa_set_key_type(&attributes, derived_type);
+    psa_set_key_bits(&attributes, derived_bits);
+    PSA_ASSERT(psa_key_derivation_output_key(&attributes, &operation,
+                                             &derived_key));
 
     /* Test the key information */
-    PSA_ASSERT( psa_get_key_attributes( derived_key, &got_attributes ) );
-    TEST_EQUAL( psa_get_key_type( &got_attributes ), derived_type );
-    TEST_EQUAL( psa_get_key_bits( &got_attributes ), derived_bits );
+    PSA_ASSERT(psa_get_key_attributes(derived_key, &got_attributes));
+    TEST_EQUAL(psa_get_key_type(&got_attributes), derived_type);
+    TEST_EQUAL(psa_get_key_bits(&got_attributes), derived_bits);
 
     /* Exercise the derived key. */
-    if( ! mbedtls_test_psa_exercise_key( derived_key, derived_usage, derived_alg ) )
+    if (!mbedtls_test_psa_exercise_key(derived_key, derived_usage, derived_alg)) {
         goto exit;
+    }
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &got_attributes );
+    psa_reset_key_attributes(&got_attributes);
 
-    psa_key_derivation_abort( &operation );
-    psa_destroy_key( base_key );
-    psa_destroy_key( derived_key );
-    PSA_DONE( );
+    psa_key_derivation_abort(&operation);
+    psa_destroy_key(base_key);
+    psa_destroy_key(derived_key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void derive_key_export( int alg_arg,
-                        data_t *key_data,
-                        data_t *input1,
-                        data_t *input2,
-                        int bytes1_arg,
-                        int bytes2_arg )
+void derive_key_export(int alg_arg,
+                       data_t *key_data,
+                       data_t *input1,
+                       data_t *input2,
+                       int bytes1_arg,
+                       int bytes2_arg)
 {
     mbedtls_svc_key_id_t base_key = MBEDTLS_SVC_KEY_ID_INIT;
     mbedtls_svc_key_id_t derived_key = MBEDTLS_SVC_KEY_ID_INIT;
@@ -4923,74 +4923,76 @@
     psa_key_attributes_t derived_attributes = PSA_KEY_ATTRIBUTES_INIT;
     size_t length;
 
-    ASSERT_ALLOC( output_buffer, capacity );
-    ASSERT_ALLOC( export_buffer, capacity );
-    PSA_ASSERT( psa_crypto_init( ) );
+    ASSERT_ALLOC(output_buffer, capacity);
+    ASSERT_ALLOC(export_buffer, capacity);
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &base_attributes, PSA_KEY_USAGE_DERIVE );
-    psa_set_key_algorithm( &base_attributes, alg );
-    psa_set_key_type( &base_attributes, PSA_KEY_TYPE_DERIVE );
-    PSA_ASSERT( psa_import_key( &base_attributes, key_data->x, key_data->len,
-                                &base_key ) );
+    psa_set_key_usage_flags(&base_attributes, PSA_KEY_USAGE_DERIVE);
+    psa_set_key_algorithm(&base_attributes, alg);
+    psa_set_key_type(&base_attributes, PSA_KEY_TYPE_DERIVE);
+    PSA_ASSERT(psa_import_key(&base_attributes, key_data->x, key_data->len,
+                              &base_key));
 
     /* Derive some material and output it. */
-    if( !mbedtls_test_psa_setup_key_derivation_wrap( &operation, base_key, alg,
-                                                     input1->x, input1->len,
-                                                     input2->x, input2->len,
-                                                     capacity ) )
+    if (!mbedtls_test_psa_setup_key_derivation_wrap(&operation, base_key, alg,
+                                                    input1->x, input1->len,
+                                                    input2->x, input2->len,
+                                                    capacity)) {
         goto exit;
+    }
 
-    PSA_ASSERT( psa_key_derivation_output_bytes( &operation,
-                                                 output_buffer,
-                                                 capacity ) );
-    PSA_ASSERT( psa_key_derivation_abort( &operation ) );
+    PSA_ASSERT(psa_key_derivation_output_bytes(&operation,
+                                               output_buffer,
+                                               capacity));
+    PSA_ASSERT(psa_key_derivation_abort(&operation));
 
     /* Derive the same output again, but this time store it in key objects. */
-    if( !mbedtls_test_psa_setup_key_derivation_wrap( &operation, base_key, alg,
-                                                     input1->x, input1->len,
-                                                     input2->x, input2->len,
-                                                     capacity ) )
+    if (!mbedtls_test_psa_setup_key_derivation_wrap(&operation, base_key, alg,
+                                                    input1->x, input1->len,
+                                                    input2->x, input2->len,
+                                                    capacity)) {
         goto exit;
+    }
 
-    psa_set_key_usage_flags( &derived_attributes, PSA_KEY_USAGE_EXPORT );
-    psa_set_key_algorithm( &derived_attributes, 0 );
-    psa_set_key_type( &derived_attributes, PSA_KEY_TYPE_RAW_DATA );
-    psa_set_key_bits( &derived_attributes, PSA_BYTES_TO_BITS( bytes1 ) );
-    PSA_ASSERT( psa_key_derivation_output_key( &derived_attributes, &operation,
-                                               &derived_key ) );
-    PSA_ASSERT( psa_export_key( derived_key,
-                                export_buffer, bytes1,
-                                &length ) );
-    TEST_EQUAL( length, bytes1 );
-    PSA_ASSERT( psa_destroy_key( derived_key ) );
-    psa_set_key_bits( &derived_attributes, PSA_BYTES_TO_BITS( bytes2 ) );
-    PSA_ASSERT( psa_key_derivation_output_key( &derived_attributes, &operation,
-                                               &derived_key ) );
-    PSA_ASSERT( psa_export_key( derived_key,
-                                export_buffer + bytes1, bytes2,
-                                &length ) );
-    TEST_EQUAL( length, bytes2 );
+    psa_set_key_usage_flags(&derived_attributes, PSA_KEY_USAGE_EXPORT);
+    psa_set_key_algorithm(&derived_attributes, 0);
+    psa_set_key_type(&derived_attributes, PSA_KEY_TYPE_RAW_DATA);
+    psa_set_key_bits(&derived_attributes, PSA_BYTES_TO_BITS(bytes1));
+    PSA_ASSERT(psa_key_derivation_output_key(&derived_attributes, &operation,
+                                             &derived_key));
+    PSA_ASSERT(psa_export_key(derived_key,
+                              export_buffer, bytes1,
+                              &length));
+    TEST_EQUAL(length, bytes1);
+    PSA_ASSERT(psa_destroy_key(derived_key));
+    psa_set_key_bits(&derived_attributes, PSA_BYTES_TO_BITS(bytes2));
+    PSA_ASSERT(psa_key_derivation_output_key(&derived_attributes, &operation,
+                                             &derived_key));
+    PSA_ASSERT(psa_export_key(derived_key,
+                              export_buffer + bytes1, bytes2,
+                              &length));
+    TEST_EQUAL(length, bytes2);
 
     /* Compare the outputs from the two runs. */
-    ASSERT_COMPARE( output_buffer, bytes1 + bytes2,
-                    export_buffer, capacity );
+    ASSERT_COMPARE(output_buffer, bytes1 + bytes2,
+                   export_buffer, capacity);
 
 exit:
-    mbedtls_free( output_buffer );
-    mbedtls_free( export_buffer );
-    psa_key_derivation_abort( &operation );
-    psa_destroy_key( base_key );
-    psa_destroy_key( derived_key );
-    PSA_DONE( );
+    mbedtls_free(output_buffer);
+    mbedtls_free(export_buffer);
+    psa_key_derivation_abort(&operation);
+    psa_destroy_key(base_key);
+    psa_destroy_key(derived_key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void derive_key( int alg_arg,
-                 data_t *key_data, data_t *input1, data_t *input2,
-                 int type_arg, int bits_arg,
-                 int expected_status_arg,
-                 int is_large_output )
+void derive_key(int alg_arg,
+                data_t *key_data, data_t *input1, data_t *input2,
+                int type_arg, int bits_arg,
+                int expected_status_arg,
+                int is_large_output)
 {
     mbedtls_svc_key_id_t base_key = MBEDTLS_SVC_KEY_ID_INIT;
     mbedtls_svc_key_id_t derived_key = MBEDTLS_SVC_KEY_ID_INIT;
@@ -5002,46 +5004,48 @@
     psa_key_attributes_t base_attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_attributes_t derived_attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &base_attributes, PSA_KEY_USAGE_DERIVE );
-    psa_set_key_algorithm( &base_attributes, alg );
-    psa_set_key_type( &base_attributes, PSA_KEY_TYPE_DERIVE );
-    PSA_ASSERT( psa_import_key( &base_attributes, key_data->x, key_data->len,
-                                &base_key ) );
+    psa_set_key_usage_flags(&base_attributes, PSA_KEY_USAGE_DERIVE);
+    psa_set_key_algorithm(&base_attributes, alg);
+    psa_set_key_type(&base_attributes, PSA_KEY_TYPE_DERIVE);
+    PSA_ASSERT(psa_import_key(&base_attributes, key_data->x, key_data->len,
+                              &base_key));
 
-    if( !mbedtls_test_psa_setup_key_derivation_wrap( &operation, base_key, alg,
-                                                     input1->x, input1->len,
-                                                     input2->x, input2->len,
-                                                     SIZE_MAX ) )
+    if (!mbedtls_test_psa_setup_key_derivation_wrap(&operation, base_key, alg,
+                                                    input1->x, input1->len,
+                                                    input2->x, input2->len,
+                                                    SIZE_MAX)) {
         goto exit;
+    }
 
-    psa_set_key_usage_flags( &derived_attributes, PSA_KEY_USAGE_EXPORT );
-    psa_set_key_algorithm( &derived_attributes, 0 );
-    psa_set_key_type( &derived_attributes, type );
-    psa_set_key_bits( &derived_attributes, bits );
+    psa_set_key_usage_flags(&derived_attributes, PSA_KEY_USAGE_EXPORT);
+    psa_set_key_algorithm(&derived_attributes, 0);
+    psa_set_key_type(&derived_attributes, type);
+    psa_set_key_bits(&derived_attributes, bits);
 
     psa_status_t status =
-      psa_key_derivation_output_key( &derived_attributes,
-                                     &operation,
-                                     &derived_key );
-    if( is_large_output > 0 )
-      TEST_ASSUME( status != PSA_ERROR_INSUFFICIENT_MEMORY );
-    TEST_EQUAL( status, expected_status );
+        psa_key_derivation_output_key(&derived_attributes,
+                                      &operation,
+                                      &derived_key);
+    if (is_large_output > 0) {
+        TEST_ASSUME(status != PSA_ERROR_INSUFFICIENT_MEMORY);
+    }
+    TEST_EQUAL(status, expected_status);
 
 exit:
-    psa_key_derivation_abort( &operation );
-    psa_destroy_key( base_key );
-    psa_destroy_key( derived_key );
-    PSA_DONE( );
+    psa_key_derivation_abort(&operation);
+    psa_destroy_key(base_key);
+    psa_destroy_key(derived_key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void key_agreement_setup( int alg_arg,
-                          int our_key_type_arg, int our_key_alg_arg,
-                          data_t *our_key_data, data_t *peer_key_data,
-                          int expected_status_arg )
+void key_agreement_setup(int alg_arg,
+                         int our_key_type_arg, int our_key_alg_arg,
+                         data_t *our_key_data, data_t *peer_key_data,
+                         int expected_status_arg)
 {
     mbedtls_svc_key_id_t our_key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_algorithm_t alg = alg_arg;
@@ -5052,45 +5056,42 @@
     psa_status_t expected_status = expected_status_arg;
     psa_status_t status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DERIVE );
-    psa_set_key_algorithm( &attributes, our_key_alg );
-    psa_set_key_type( &attributes, our_key_type );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                our_key_data->x, our_key_data->len,
-                                &our_key ) );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE);
+    psa_set_key_algorithm(&attributes, our_key_alg);
+    psa_set_key_type(&attributes, our_key_type);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              our_key_data->x, our_key_data->len,
+                              &our_key));
 
     /* The tests currently include inputs that should fail at either step.
      * Test cases that fail at the setup step should be changed to call
      * key_derivation_setup instead, and this function should be renamed
      * to key_agreement_fail. */
-    status = psa_key_derivation_setup( &operation, alg );
-    if( status == PSA_SUCCESS )
-    {
-        TEST_EQUAL( psa_key_derivation_key_agreement(
-                        &operation, PSA_KEY_DERIVATION_INPUT_SECRET,
-                        our_key,
-                        peer_key_data->x, peer_key_data->len ),
-                    expected_status );
-    }
-    else
-    {
-        TEST_ASSERT( status == expected_status );
+    status = psa_key_derivation_setup(&operation, alg);
+    if (status == PSA_SUCCESS) {
+        TEST_EQUAL(psa_key_derivation_key_agreement(
+                       &operation, PSA_KEY_DERIVATION_INPUT_SECRET,
+                       our_key,
+                       peer_key_data->x, peer_key_data->len),
+                   expected_status);
+    } else {
+        TEST_ASSERT(status == expected_status);
     }
 
 exit:
-    psa_key_derivation_abort( &operation );
-    psa_destroy_key( our_key );
-    PSA_DONE( );
+    psa_key_derivation_abort(&operation);
+    psa_destroy_key(our_key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void raw_key_agreement( int alg_arg,
-                        int our_key_type_arg, data_t *our_key_data,
-                        data_t *peer_key_data,
-                        data_t *expected_output )
+void raw_key_agreement(int alg_arg,
+                       int our_key_type_arg, data_t *our_key_data,
+                       data_t *peer_key_data,
+                       data_t *expected_output)
 {
     mbedtls_svc_key_id_t our_key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_algorithm_t alg = alg_arg;
@@ -5100,72 +5101,72 @@
     size_t output_length = ~0;
     size_t key_bits;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DERIVE );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, our_key_type );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                our_key_data->x, our_key_data->len,
-                                &our_key ) );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, our_key_type);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              our_key_data->x, our_key_data->len,
+                              &our_key));
 
-    PSA_ASSERT( psa_get_key_attributes( our_key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
+    PSA_ASSERT(psa_get_key_attributes(our_key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
 
     /* Validate size macros */
-    TEST_LE_U( expected_output->len,
-               PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE( our_key_type, key_bits ) );
-    TEST_LE_U( PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE( our_key_type, key_bits ),
-               PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE );
+    TEST_LE_U(expected_output->len,
+              PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE(our_key_type, key_bits));
+    TEST_LE_U(PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE(our_key_type, key_bits),
+              PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE);
 
     /* Good case with exact output size */
-    ASSERT_ALLOC( output, expected_output->len );
-    PSA_ASSERT( psa_raw_key_agreement( alg, our_key,
-                                       peer_key_data->x, peer_key_data->len,
-                                       output, expected_output->len,
-                                       &output_length ) );
-    ASSERT_COMPARE( output, output_length,
-                    expected_output->x, expected_output->len );
-    mbedtls_free( output );
+    ASSERT_ALLOC(output, expected_output->len);
+    PSA_ASSERT(psa_raw_key_agreement(alg, our_key,
+                                     peer_key_data->x, peer_key_data->len,
+                                     output, expected_output->len,
+                                     &output_length));
+    ASSERT_COMPARE(output, output_length,
+                   expected_output->x, expected_output->len);
+    mbedtls_free(output);
     output = NULL;
     output_length = ~0;
 
     /* Larger buffer */
-    ASSERT_ALLOC( output, expected_output->len + 1 );
-    PSA_ASSERT( psa_raw_key_agreement( alg, our_key,
-                                       peer_key_data->x, peer_key_data->len,
-                                       output, expected_output->len + 1,
-                                       &output_length ) );
-    ASSERT_COMPARE( output, output_length,
-                    expected_output->x, expected_output->len );
-    mbedtls_free( output );
+    ASSERT_ALLOC(output, expected_output->len + 1);
+    PSA_ASSERT(psa_raw_key_agreement(alg, our_key,
+                                     peer_key_data->x, peer_key_data->len,
+                                     output, expected_output->len + 1,
+                                     &output_length));
+    ASSERT_COMPARE(output, output_length,
+                   expected_output->x, expected_output->len);
+    mbedtls_free(output);
     output = NULL;
     output_length = ~0;
 
     /* Buffer too small */
-    ASSERT_ALLOC( output, expected_output->len - 1 );
-    TEST_EQUAL( psa_raw_key_agreement( alg, our_key,
-                                       peer_key_data->x, peer_key_data->len,
-                                       output, expected_output->len - 1,
-                                       &output_length ),
-                PSA_ERROR_BUFFER_TOO_SMALL );
+    ASSERT_ALLOC(output, expected_output->len - 1);
+    TEST_EQUAL(psa_raw_key_agreement(alg, our_key,
+                                     peer_key_data->x, peer_key_data->len,
+                                     output, expected_output->len - 1,
+                                     &output_length),
+               PSA_ERROR_BUFFER_TOO_SMALL);
     /* Not required by the spec, but good robustness */
-    TEST_LE_U( output_length, expected_output->len - 1 );
-    mbedtls_free( output );
+    TEST_LE_U(output_length, expected_output->len - 1);
+    mbedtls_free(output);
     output = NULL;
 
 exit:
-    mbedtls_free( output );
-    psa_destroy_key( our_key );
-    PSA_DONE( );
+    mbedtls_free(output);
+    psa_destroy_key(our_key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void key_agreement_capacity( int alg_arg,
-                             int our_key_type_arg, data_t *our_key_data,
-                             data_t *peer_key_data,
-                             int expected_capacity_arg )
+void key_agreement_capacity(int alg_arg,
+                            int our_key_type_arg, data_t *our_key_data,
+                            data_t *peer_key_data,
+                            int expected_capacity_arg)
 {
     mbedtls_svc_key_id_t our_key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_algorithm_t alg = alg_arg;
@@ -5175,57 +5176,55 @@
     size_t actual_capacity;
     unsigned char output[16];
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DERIVE );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, our_key_type );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                our_key_data->x, our_key_data->len,
-                                &our_key ) );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, our_key_type);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              our_key_data->x, our_key_data->len,
+                              &our_key));
 
-    PSA_ASSERT( psa_key_derivation_setup( &operation, alg ) );
-    PSA_ASSERT( psa_key_derivation_key_agreement(
-                    &operation,
-                    PSA_KEY_DERIVATION_INPUT_SECRET, our_key,
-                    peer_key_data->x, peer_key_data->len ) );
-    if( PSA_ALG_IS_HKDF( PSA_ALG_KEY_AGREEMENT_GET_KDF( alg ) ) )
-    {
+    PSA_ASSERT(psa_key_derivation_setup(&operation, alg));
+    PSA_ASSERT(psa_key_derivation_key_agreement(
+                   &operation,
+                   PSA_KEY_DERIVATION_INPUT_SECRET, our_key,
+                   peer_key_data->x, peer_key_data->len));
+    if (PSA_ALG_IS_HKDF(PSA_ALG_KEY_AGREEMENT_GET_KDF(alg))) {
         /* The test data is for info="" */
-        PSA_ASSERT( psa_key_derivation_input_bytes( &operation,
-                                                    PSA_KEY_DERIVATION_INPUT_INFO,
-                                                    NULL, 0 ) );
+        PSA_ASSERT(psa_key_derivation_input_bytes(&operation,
+                                                  PSA_KEY_DERIVATION_INPUT_INFO,
+                                                  NULL, 0));
     }
 
     /* Test the advertised capacity. */
-    PSA_ASSERT( psa_key_derivation_get_capacity(
-                    &operation, &actual_capacity ) );
-    TEST_EQUAL( actual_capacity, (size_t) expected_capacity_arg );
+    PSA_ASSERT(psa_key_derivation_get_capacity(
+                   &operation, &actual_capacity));
+    TEST_EQUAL(actual_capacity, (size_t) expected_capacity_arg);
 
     /* Test the actual capacity by reading the output. */
-    while( actual_capacity > sizeof( output ) )
-    {
-        PSA_ASSERT( psa_key_derivation_output_bytes( &operation,
-                                                     output, sizeof( output ) ) );
-        actual_capacity -= sizeof( output );
+    while (actual_capacity > sizeof(output)) {
+        PSA_ASSERT(psa_key_derivation_output_bytes(&operation,
+                                                   output, sizeof(output)));
+        actual_capacity -= sizeof(output);
     }
-    PSA_ASSERT( psa_key_derivation_output_bytes( &operation,
-                                                 output, actual_capacity ) );
-    TEST_EQUAL( psa_key_derivation_output_bytes( &operation, output, 1 ),
-                PSA_ERROR_INSUFFICIENT_DATA );
+    PSA_ASSERT(psa_key_derivation_output_bytes(&operation,
+                                               output, actual_capacity));
+    TEST_EQUAL(psa_key_derivation_output_bytes(&operation, output, 1),
+               PSA_ERROR_INSUFFICIENT_DATA);
 
 exit:
-    psa_key_derivation_abort( &operation );
-    psa_destroy_key( our_key );
-    PSA_DONE( );
+    psa_key_derivation_abort(&operation);
+    psa_destroy_key(our_key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void key_agreement_output( int alg_arg,
-                           int our_key_type_arg, data_t *our_key_data,
-                           data_t *peer_key_data,
-                           data_t *expected_output1, data_t *expected_output2 )
+void key_agreement_output(int alg_arg,
+                          int our_key_type_arg, data_t *our_key_data,
+                          data_t *peer_key_data,
+                          data_t *expected_output1, data_t *expected_output2)
 {
     mbedtls_svc_key_id_t our_key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_algorithm_t alg = alg_arg;
@@ -5234,55 +5233,53 @@
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     uint8_t *actual_output = NULL;
 
-    ASSERT_ALLOC( actual_output, MAX( expected_output1->len,
-                                      expected_output2->len ) );
+    ASSERT_ALLOC(actual_output, MAX(expected_output1->len,
+                                    expected_output2->len));
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DERIVE );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, our_key_type );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                our_key_data->x, our_key_data->len,
-                                &our_key ) );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, our_key_type);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              our_key_data->x, our_key_data->len,
+                              &our_key));
 
-    PSA_ASSERT( psa_key_derivation_setup( &operation, alg ) );
-    PSA_ASSERT( psa_key_derivation_key_agreement(
-                    &operation,
-                    PSA_KEY_DERIVATION_INPUT_SECRET, our_key,
-                    peer_key_data->x, peer_key_data->len ) );
-    if( PSA_ALG_IS_HKDF( PSA_ALG_KEY_AGREEMENT_GET_KDF( alg ) ) )
-    {
+    PSA_ASSERT(psa_key_derivation_setup(&operation, alg));
+    PSA_ASSERT(psa_key_derivation_key_agreement(
+                   &operation,
+                   PSA_KEY_DERIVATION_INPUT_SECRET, our_key,
+                   peer_key_data->x, peer_key_data->len));
+    if (PSA_ALG_IS_HKDF(PSA_ALG_KEY_AGREEMENT_GET_KDF(alg))) {
         /* The test data is for info="" */
-        PSA_ASSERT( psa_key_derivation_input_bytes( &operation,
-                                                    PSA_KEY_DERIVATION_INPUT_INFO,
-                                                    NULL, 0 ) );
+        PSA_ASSERT(psa_key_derivation_input_bytes(&operation,
+                                                  PSA_KEY_DERIVATION_INPUT_INFO,
+                                                  NULL, 0));
     }
 
-    PSA_ASSERT( psa_key_derivation_output_bytes( &operation,
-                                                 actual_output,
-                                                 expected_output1->len ) );
-    ASSERT_COMPARE( actual_output, expected_output1->len,
-                    expected_output1->x, expected_output1->len );
-    if( expected_output2->len != 0 )
-    {
-        PSA_ASSERT( psa_key_derivation_output_bytes( &operation,
-                                                     actual_output,
-                                                     expected_output2->len ) );
-        ASSERT_COMPARE( actual_output, expected_output2->len,
-                        expected_output2->x, expected_output2->len );
+    PSA_ASSERT(psa_key_derivation_output_bytes(&operation,
+                                               actual_output,
+                                               expected_output1->len));
+    ASSERT_COMPARE(actual_output, expected_output1->len,
+                   expected_output1->x, expected_output1->len);
+    if (expected_output2->len != 0) {
+        PSA_ASSERT(psa_key_derivation_output_bytes(&operation,
+                                                   actual_output,
+                                                   expected_output2->len));
+        ASSERT_COMPARE(actual_output, expected_output2->len,
+                       expected_output2->x, expected_output2->len);
     }
 
 exit:
-    psa_key_derivation_abort( &operation );
-    psa_destroy_key( our_key );
-    PSA_DONE( );
-    mbedtls_free( actual_output );
+    psa_key_derivation_abort(&operation);
+    psa_destroy_key(our_key);
+    PSA_DONE();
+    mbedtls_free(actual_output);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void generate_random( int bytes_arg )
+void generate_random(int bytes_arg)
 {
     size_t bytes = bytes_arg;
     unsigned char *output = NULL;
@@ -5290,51 +5287,50 @@
     size_t i;
     unsigned run;
 
-    TEST_ASSERT( bytes_arg >= 0 );
+    TEST_ASSERT(bytes_arg >= 0);
 
-    ASSERT_ALLOC( output, bytes );
-    ASSERT_ALLOC( changed, bytes );
+    ASSERT_ALLOC(output, bytes);
+    ASSERT_ALLOC(changed, bytes);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Run several times, to ensure that every output byte will be
      * nonzero at least once with overwhelming probability
      * (2^(-8*number_of_runs)). */
-    for( run = 0; run < 10; run++ )
-    {
-        if( bytes != 0 )
-            memset( output, 0, bytes );
-        PSA_ASSERT( psa_generate_random( output, bytes ) );
+    for (run = 0; run < 10; run++) {
+        if (bytes != 0) {
+            memset(output, 0, bytes);
+        }
+        PSA_ASSERT(psa_generate_random(output, bytes));
 
-        for( i = 0; i < bytes; i++ )
-        {
-            if( output[i] != 0 )
+        for (i = 0; i < bytes; i++) {
+            if (output[i] != 0) {
                 ++changed[i];
+            }
         }
     }
 
     /* Check that every byte was changed to nonzero at least once. This
      * validates that psa_generate_random is overwriting every byte of
      * the output buffer. */
-    for( i = 0; i < bytes; i++ )
-    {
-        TEST_ASSERT( changed[i] != 0 );
+    for (i = 0; i < bytes; i++) {
+        TEST_ASSERT(changed[i] != 0);
     }
 
 exit:
-    PSA_DONE( );
-    mbedtls_free( output );
-    mbedtls_free( changed );
+    PSA_DONE();
+    mbedtls_free(output);
+    mbedtls_free(changed);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void generate_key( int type_arg,
-                   int bits_arg,
-                   int usage_arg,
-                   int alg_arg,
-                   int expected_status_arg,
-                   int is_large_key )
+void generate_key(int type_arg,
+                  int bits_arg,
+                  int usage_arg,
+                  int alg_arg,
+                  int expected_status_arg,
+                  int is_large_key)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t type = type_arg;
@@ -5345,47 +5341,50 @@
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_attributes_t got_attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, usage );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, type );
-    psa_set_key_bits( &attributes, bits );
+    psa_set_key_usage_flags(&attributes, usage);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, type);
+    psa_set_key_bits(&attributes, bits);
 
     /* Generate a key */
-    psa_status_t status = psa_generate_key( &attributes, &key );
+    psa_status_t status = psa_generate_key(&attributes, &key);
 
-    if( is_large_key > 0 )
-      TEST_ASSUME( status != PSA_ERROR_INSUFFICIENT_MEMORY );
-    TEST_EQUAL( status , expected_status );
-    if( expected_status != PSA_SUCCESS )
+    if (is_large_key > 0) {
+        TEST_ASSUME(status != PSA_ERROR_INSUFFICIENT_MEMORY);
+    }
+    TEST_EQUAL(status, expected_status);
+    if (expected_status != PSA_SUCCESS) {
         goto exit;
+    }
 
     /* Test the key information */
-    PSA_ASSERT( psa_get_key_attributes( key, &got_attributes ) );
-    TEST_EQUAL( psa_get_key_type( &got_attributes ), type );
-    TEST_EQUAL( psa_get_key_bits( &got_attributes ), bits );
+    PSA_ASSERT(psa_get_key_attributes(key, &got_attributes));
+    TEST_EQUAL(psa_get_key_type(&got_attributes), type);
+    TEST_EQUAL(psa_get_key_bits(&got_attributes), bits);
 
     /* Do something with the key according to its type and permitted usage. */
-    if( ! mbedtls_test_psa_exercise_key( key, usage, alg ) )
+    if (!mbedtls_test_psa_exercise_key(key, usage, alg)) {
         goto exit;
+    }
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &got_attributes );
+    psa_reset_key_attributes(&got_attributes);
 
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:PSA_WANT_KEY_TYPE_RSA_KEY_PAIR:PSA_WANT_ALG_RSA_PKCS1V15_CRYPT:PSA_WANT_ALG_RSA_PKCS1V15_SIGN:MBEDTLS_GENPRIME */
-void generate_key_rsa( int bits_arg,
-                       data_t *e_arg,
-                       int expected_status_arg )
+void generate_key_rsa(int bits_arg,
+                      data_t *e_arg,
+                      int expected_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t type = PSA_KEY_TYPE_RSA_KEY_PAIR;
@@ -5396,56 +5395,58 @@
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     uint8_t *exported = NULL;
     size_t exported_size =
-        PSA_EXPORT_KEY_OUTPUT_SIZE( PSA_KEY_TYPE_RSA_PUBLIC_KEY, bits );
+        PSA_EXPORT_KEY_OUTPUT_SIZE(PSA_KEY_TYPE_RSA_PUBLIC_KEY, bits);
     size_t exported_length = SIZE_MAX;
     uint8_t *e_read_buffer = NULL;
     int is_default_public_exponent = 0;
-    size_t e_read_size = PSA_KEY_DOMAIN_PARAMETERS_SIZE( type, bits );
+    size_t e_read_size = PSA_KEY_DOMAIN_PARAMETERS_SIZE(type, bits);
     size_t e_read_length = SIZE_MAX;
 
-    if( e_arg->len == 0 ||
-        ( e_arg->len == 3 &&
-          e_arg->x[0] == 1 && e_arg->x[1] == 0 && e_arg->x[2] == 1 ) )
-    {
+    if (e_arg->len == 0 ||
+        (e_arg->len == 3 &&
+         e_arg->x[0] == 1 && e_arg->x[1] == 0 && e_arg->x[2] == 1)) {
         is_default_public_exponent = 1;
         e_read_size = 0;
     }
-    ASSERT_ALLOC( e_read_buffer, e_read_size );
-    ASSERT_ALLOC( exported, exported_size );
+    ASSERT_ALLOC(e_read_buffer, e_read_size);
+    ASSERT_ALLOC(exported, exported_size);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, usage );
-    psa_set_key_algorithm( &attributes, alg );
-    PSA_ASSERT( psa_set_key_domain_parameters( &attributes, type,
-                                               e_arg->x, e_arg->len ) );
-    psa_set_key_bits( &attributes, bits );
+    psa_set_key_usage_flags(&attributes, usage);
+    psa_set_key_algorithm(&attributes, alg);
+    PSA_ASSERT(psa_set_key_domain_parameters(&attributes, type,
+                                             e_arg->x, e_arg->len));
+    psa_set_key_bits(&attributes, bits);
 
     /* Generate a key */
-    TEST_EQUAL( psa_generate_key( &attributes, &key ), expected_status );
-    if( expected_status != PSA_SUCCESS )
+    TEST_EQUAL(psa_generate_key(&attributes, &key), expected_status);
+    if (expected_status != PSA_SUCCESS) {
         goto exit;
+    }
 
     /* Test the key information */
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    TEST_EQUAL( psa_get_key_type( &attributes ), type );
-    TEST_EQUAL( psa_get_key_bits( &attributes ), bits );
-    PSA_ASSERT( psa_get_key_domain_parameters( &attributes,
-                                               e_read_buffer, e_read_size,
-                                               &e_read_length ) );
-    if( is_default_public_exponent )
-        TEST_EQUAL( e_read_length, 0 );
-    else
-        ASSERT_COMPARE( e_read_buffer, e_read_length, e_arg->x, e_arg->len );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    TEST_EQUAL(psa_get_key_type(&attributes), type);
+    TEST_EQUAL(psa_get_key_bits(&attributes), bits);
+    PSA_ASSERT(psa_get_key_domain_parameters(&attributes,
+                                             e_read_buffer, e_read_size,
+                                             &e_read_length));
+    if (is_default_public_exponent) {
+        TEST_EQUAL(e_read_length, 0);
+    } else {
+        ASSERT_COMPARE(e_read_buffer, e_read_length, e_arg->x, e_arg->len);
+    }
 
     /* Do something with the key according to its type and permitted usage. */
-    if( ! mbedtls_test_psa_exercise_key( key, usage, alg ) )
+    if (!mbedtls_test_psa_exercise_key(key, usage, alg)) {
         goto exit;
+    }
 
     /* Export the key and check the public exponent. */
-    PSA_ASSERT( psa_export_public_key( key,
-                                       exported, exported_size,
-                                       &exported_length ) );
+    PSA_ASSERT(psa_export_public_key(key,
+                                     exported, exported_size,
+                                     &exported_length));
     {
         uint8_t *p = exported;
         uint8_t *end = exported + exported_length;
@@ -5454,26 +5455,24 @@
          *      modulus            INTEGER,    -- n
          *      publicExponent     INTEGER  }  -- e
          */
-        TEST_EQUAL( 0, mbedtls_asn1_get_tag( &p, end, &len,
-                                             MBEDTLS_ASN1_SEQUENCE |
-                                             MBEDTLS_ASN1_CONSTRUCTED ) );
-        TEST_ASSERT( mbedtls_test_asn1_skip_integer( &p, end, bits, bits, 1 ) );
-        TEST_EQUAL( 0, mbedtls_asn1_get_tag( &p, end, &len,
-                                             MBEDTLS_ASN1_INTEGER ) );
-        if( len >= 1 && p[0] == 0 )
-        {
+        TEST_EQUAL(0, mbedtls_asn1_get_tag(&p, end, &len,
+                                           MBEDTLS_ASN1_SEQUENCE |
+                                           MBEDTLS_ASN1_CONSTRUCTED));
+        TEST_ASSERT(mbedtls_test_asn1_skip_integer(&p, end, bits, bits, 1));
+        TEST_EQUAL(0, mbedtls_asn1_get_tag(&p, end, &len,
+                                           MBEDTLS_ASN1_INTEGER));
+        if (len >= 1 && p[0] == 0) {
             ++p;
             --len;
         }
-        if( e_arg->len == 0 )
-        {
-            TEST_EQUAL( len, 3 );
-            TEST_EQUAL( p[0], 1 );
-            TEST_EQUAL( p[1], 0 );
-            TEST_EQUAL( p[2], 1 );
+        if (e_arg->len == 0) {
+            TEST_EQUAL(len, 3);
+            TEST_EQUAL(p[0], 1);
+            TEST_EQUAL(p[1], 0);
+            TEST_EQUAL(p[2], 1);
+        } else {
+            ASSERT_COMPARE(p, len, e_arg->x, e_arg->len);
         }
-        else
-            ASSERT_COMPARE( p, len, e_arg->x, e_arg->len );
     }
 
 exit:
@@ -5481,22 +5480,22 @@
      * Key attributes may have been returned by psa_get_key_attributes() or
      * set by psa_set_key_domain_parameters() thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    psa_destroy_key( key );
-    PSA_DONE( );
-    mbedtls_free( e_read_buffer );
-    mbedtls_free( exported );
+    psa_destroy_key(key);
+    PSA_DONE();
+    mbedtls_free(e_read_buffer);
+    mbedtls_free(exported);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_STORAGE_C */
-void persistent_key_load_key_from_storage( data_t *data,
-                                           int type_arg, int bits_arg,
-                                           int usage_flags_arg, int alg_arg,
-                                           int generation_method )
+void persistent_key_load_key_from_storage(data_t *data,
+                                          int type_arg, int bits_arg,
+                                          int usage_flags_arg, int alg_arg,
+                                          int generation_method)
 {
-    mbedtls_svc_key_id_t key_id = mbedtls_svc_key_id_make( 1, 1 );
+    mbedtls_svc_key_id_t key_id = mbedtls_svc_key_id_make(1, 1);
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     mbedtls_svc_key_id_t base_key = MBEDTLS_SVC_KEY_ID_INIT;
@@ -5507,130 +5506,128 @@
     psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
     unsigned char *first_export = NULL;
     unsigned char *second_export = NULL;
-    size_t export_size = PSA_EXPORT_KEY_OUTPUT_SIZE( type, bits );
+    size_t export_size = PSA_EXPORT_KEY_OUTPUT_SIZE(type, bits);
     size_t first_exported_length;
     size_t second_exported_length;
 
-    if( usage_flags & PSA_KEY_USAGE_EXPORT )
-    {
-        ASSERT_ALLOC( first_export, export_size );
-        ASSERT_ALLOC( second_export, export_size );
+    if (usage_flags & PSA_KEY_USAGE_EXPORT) {
+        ASSERT_ALLOC(first_export, export_size);
+        ASSERT_ALLOC(second_export, export_size);
     }
 
-    PSA_ASSERT( psa_crypto_init() );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_id( &attributes, key_id );
-    psa_set_key_usage_flags( &attributes, usage_flags );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, type );
-    psa_set_key_bits( &attributes, bits );
+    psa_set_key_id(&attributes, key_id);
+    psa_set_key_usage_flags(&attributes, usage_flags);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, type);
+    psa_set_key_bits(&attributes, bits);
 
-    switch( generation_method )
-    {
+    switch (generation_method) {
         case IMPORT_KEY:
             /* Import the key */
-            PSA_ASSERT( psa_import_key( &attributes, data->x, data->len,
-                                        &key ) );
+            PSA_ASSERT(psa_import_key(&attributes, data->x, data->len,
+                                      &key));
             break;
 
         case GENERATE_KEY:
             /* Generate a key */
-            PSA_ASSERT( psa_generate_key( &attributes, &key ) );
+            PSA_ASSERT(psa_generate_key(&attributes, &key));
             break;
 
         case DERIVE_KEY:
 #if defined(PSA_WANT_ALG_HKDF) && defined(PSA_WANT_ALG_SHA_256)
-            {
-                /* Create base key */
-                psa_algorithm_t derive_alg = PSA_ALG_HKDF( PSA_ALG_SHA_256 );
-                psa_key_attributes_t base_attributes = PSA_KEY_ATTRIBUTES_INIT;
-                psa_set_key_usage_flags( &base_attributes,
-                                         PSA_KEY_USAGE_DERIVE );
-                psa_set_key_algorithm( &base_attributes, derive_alg );
-                psa_set_key_type( &base_attributes, PSA_KEY_TYPE_DERIVE );
-                PSA_ASSERT( psa_import_key( &base_attributes,
-                                            data->x, data->len,
-                                            &base_key ) );
-                /* Derive a key. */
-                PSA_ASSERT( psa_key_derivation_setup( &operation, derive_alg ) );
-                PSA_ASSERT( psa_key_derivation_input_key(
-                                &operation,
-                                PSA_KEY_DERIVATION_INPUT_SECRET, base_key ) );
-                PSA_ASSERT( psa_key_derivation_input_bytes(
-                                &operation, PSA_KEY_DERIVATION_INPUT_INFO,
-                                NULL, 0 ) );
-                PSA_ASSERT( psa_key_derivation_output_key( &attributes,
-                                                           &operation,
-                                                           &key ) );
-                PSA_ASSERT( psa_key_derivation_abort( &operation ) );
-                PSA_ASSERT( psa_destroy_key( base_key ) );
-                base_key = MBEDTLS_SVC_KEY_ID_INIT;
-            }
+        {
+            /* Create base key */
+            psa_algorithm_t derive_alg = PSA_ALG_HKDF(PSA_ALG_SHA_256);
+            psa_key_attributes_t base_attributes = PSA_KEY_ATTRIBUTES_INIT;
+            psa_set_key_usage_flags(&base_attributes,
+                                    PSA_KEY_USAGE_DERIVE);
+            psa_set_key_algorithm(&base_attributes, derive_alg);
+            psa_set_key_type(&base_attributes, PSA_KEY_TYPE_DERIVE);
+            PSA_ASSERT(psa_import_key(&base_attributes,
+                                      data->x, data->len,
+                                      &base_key));
+            /* Derive a key. */
+            PSA_ASSERT(psa_key_derivation_setup(&operation, derive_alg));
+            PSA_ASSERT(psa_key_derivation_input_key(
+                           &operation,
+                           PSA_KEY_DERIVATION_INPUT_SECRET, base_key));
+            PSA_ASSERT(psa_key_derivation_input_bytes(
+                           &operation, PSA_KEY_DERIVATION_INPUT_INFO,
+                           NULL, 0));
+            PSA_ASSERT(psa_key_derivation_output_key(&attributes,
+                                                     &operation,
+                                                     &key));
+            PSA_ASSERT(psa_key_derivation_abort(&operation));
+            PSA_ASSERT(psa_destroy_key(base_key));
+            base_key = MBEDTLS_SVC_KEY_ID_INIT;
+        }
 #else
-            TEST_ASSUME( ! "KDF not supported in this configuration" );
+            TEST_ASSUME(!"KDF not supported in this configuration");
 #endif
             break;
 
         default:
-            TEST_ASSERT( ! "generation_method not implemented in test" );
+            TEST_ASSERT(!"generation_method not implemented in test");
             break;
     }
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
     /* Export the key if permitted by the key policy. */
-    if( usage_flags & PSA_KEY_USAGE_EXPORT )
-    {
-        PSA_ASSERT( psa_export_key( key,
-                                    first_export, export_size,
-                                    &first_exported_length ) );
-        if( generation_method == IMPORT_KEY )
-            ASSERT_COMPARE( data->x, data->len,
-                            first_export, first_exported_length );
+    if (usage_flags & PSA_KEY_USAGE_EXPORT) {
+        PSA_ASSERT(psa_export_key(key,
+                                  first_export, export_size,
+                                  &first_exported_length));
+        if (generation_method == IMPORT_KEY) {
+            ASSERT_COMPARE(data->x, data->len,
+                           first_export, first_exported_length);
+        }
     }
 
     /* Shutdown and restart */
-    PSA_ASSERT( psa_purge_key( key ) );
+    PSA_ASSERT(psa_purge_key(key));
     PSA_DONE();
-    PSA_ASSERT( psa_crypto_init() );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Check key slot still contains key data */
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    TEST_ASSERT( mbedtls_svc_key_id_equal(
-                     psa_get_key_id( &attributes ), key_id ) );
-    TEST_EQUAL( psa_get_key_lifetime( &attributes ),
-                PSA_KEY_LIFETIME_PERSISTENT );
-    TEST_EQUAL( psa_get_key_type( &attributes ), type );
-    TEST_EQUAL( psa_get_key_bits( &attributes ), bits );
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes ),
-                mbedtls_test_update_key_usage_flags( usage_flags ) );
-    TEST_EQUAL( psa_get_key_algorithm( &attributes ), alg );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    TEST_ASSERT(mbedtls_svc_key_id_equal(
+                    psa_get_key_id(&attributes), key_id));
+    TEST_EQUAL(psa_get_key_lifetime(&attributes),
+               PSA_KEY_LIFETIME_PERSISTENT);
+    TEST_EQUAL(psa_get_key_type(&attributes), type);
+    TEST_EQUAL(psa_get_key_bits(&attributes), bits);
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes),
+               mbedtls_test_update_key_usage_flags(usage_flags));
+    TEST_EQUAL(psa_get_key_algorithm(&attributes), alg);
 
     /* Export the key again if permitted by the key policy. */
-    if( usage_flags & PSA_KEY_USAGE_EXPORT )
-    {
-        PSA_ASSERT( psa_export_key( key,
-                                    second_export, export_size,
-                                    &second_exported_length ) );
-        ASSERT_COMPARE( first_export, first_exported_length,
-                        second_export, second_exported_length );
+    if (usage_flags & PSA_KEY_USAGE_EXPORT) {
+        PSA_ASSERT(psa_export_key(key,
+                                  second_export, export_size,
+                                  &second_exported_length));
+        ASSERT_COMPARE(first_export, first_exported_length,
+                       second_export, second_exported_length);
     }
 
     /* Do something with the key according to its type and permitted usage. */
-    if( ! mbedtls_test_psa_exercise_key( key, usage_flags, alg ) )
+    if (!mbedtls_test_psa_exercise_key(key, usage_flags, alg)) {
         goto exit;
+    }
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    mbedtls_free( first_export );
-    mbedtls_free( second_export );
-    psa_key_derivation_abort( &operation );
-    psa_destroy_key( base_key );
-    psa_destroy_key( key );
+    mbedtls_free(first_export);
+    mbedtls_free(second_export);
+    psa_key_derivation_abort(&operation);
+    psa_destroy_key(base_key);
+    psa_destroy_key(key);
     PSA_DONE();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_attributes.function b/tests/suites/test_suite_psa_crypto_attributes.function
index ce34fae..c933cb7 100644
--- a/tests/suites/test_suite_psa_crypto_attributes.function
+++ b/tests/suites/test_suite_psa_crypto_attributes.function
@@ -8,12 +8,12 @@
  */
 
 /* BEGIN_CASE */
-void attributes_set_get( int owner_id_arg, int id_arg, int lifetime_arg,
-                         int usage_flags_arg, int alg_arg,
-                         int type_arg, int bits_arg )
+void attributes_set_get(int owner_id_arg, int id_arg, int lifetime_arg,
+                        int usage_flags_arg, int alg_arg,
+                        int type_arg, int bits_arg)
 {
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( owner_id_arg, id_arg );
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(owner_id_arg, id_arg);
     psa_key_lifetime_t lifetime = lifetime_arg;
     psa_key_usage_t usage_flags = usage_flags_arg;
     psa_algorithm_t alg = alg_arg;
@@ -21,109 +21,112 @@
     size_t bits = bits_arg;
 
     TEST_EQUAL(
-        MBEDTLS_SVC_KEY_ID_GET_KEY_ID( psa_get_key_id( &attributes ) ), 0 );
+        MBEDTLS_SVC_KEY_ID_GET_KEY_ID(psa_get_key_id(&attributes)), 0);
     TEST_EQUAL(
-        MBEDTLS_SVC_KEY_ID_GET_OWNER_ID( psa_get_key_id( &attributes ) ), 0 );
-    TEST_EQUAL( psa_get_key_lifetime( &attributes ), 0 );
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes ), 0 );
-    TEST_EQUAL( psa_get_key_algorithm( &attributes ), 0 );
-    TEST_EQUAL( psa_get_key_type( &attributes ), 0 );
-    TEST_EQUAL( psa_get_key_bits( &attributes ), 0 );
+        MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(psa_get_key_id(&attributes)), 0);
+    TEST_EQUAL(psa_get_key_lifetime(&attributes), 0);
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes), 0);
+    TEST_EQUAL(psa_get_key_algorithm(&attributes), 0);
+    TEST_EQUAL(psa_get_key_type(&attributes), 0);
+    TEST_EQUAL(psa_get_key_bits(&attributes), 0);
 
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_usage_flags( &attributes, usage_flags );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, type );
-    psa_set_key_bits( &attributes, bits );
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_usage_flags(&attributes, usage_flags);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, type);
+    psa_set_key_bits(&attributes, bits);
 
-    TEST_ASSERT( mbedtls_svc_key_id_equal(
-                     psa_get_key_id( &attributes ), id ) );
-    TEST_EQUAL( psa_get_key_lifetime( &attributes ), lifetime );
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes ), usage_flags );
-    TEST_EQUAL( psa_get_key_algorithm( &attributes ), alg );
-    TEST_EQUAL( psa_get_key_type( &attributes ), type );
-    TEST_EQUAL( psa_get_key_bits( &attributes ), bits );
+    TEST_ASSERT(mbedtls_svc_key_id_equal(
+                    psa_get_key_id(&attributes), id));
+    TEST_EQUAL(psa_get_key_lifetime(&attributes), lifetime);
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes), usage_flags);
+    TEST_EQUAL(psa_get_key_algorithm(&attributes), alg);
+    TEST_EQUAL(psa_get_key_type(&attributes), type);
+    TEST_EQUAL(psa_get_key_bits(&attributes), bits);
 
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
     TEST_EQUAL(
-        MBEDTLS_SVC_KEY_ID_GET_KEY_ID( psa_get_key_id( &attributes ) ), 0 );
+        MBEDTLS_SVC_KEY_ID_GET_KEY_ID(psa_get_key_id(&attributes)), 0);
     TEST_EQUAL(
-        MBEDTLS_SVC_KEY_ID_GET_OWNER_ID( psa_get_key_id( &attributes ) ), 0 );
-    TEST_EQUAL( psa_get_key_lifetime( &attributes ), 0 );
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes ), 0 );
-    TEST_EQUAL( psa_get_key_algorithm( &attributes ), 0 );
-    TEST_EQUAL( psa_get_key_type( &attributes ), 0 );
-    TEST_EQUAL( psa_get_key_bits( &attributes ), 0 );
+        MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(psa_get_key_id(&attributes)), 0);
+    TEST_EQUAL(psa_get_key_lifetime(&attributes), 0);
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes), 0);
+    TEST_EQUAL(psa_get_key_algorithm(&attributes), 0);
+    TEST_EQUAL(psa_get_key_type(&attributes), 0);
+    TEST_EQUAL(psa_get_key_bits(&attributes), 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void persistence_attributes( int id1_arg, int owner_id1_arg, int lifetime_arg,
-                             int id2_arg, int owner_id2_arg,
-                             int expected_id_arg, int expected_owner_id_arg,
-                             int expected_lifetime_arg )
+void persistence_attributes(int id1_arg, int owner_id1_arg, int lifetime_arg,
+                            int id2_arg, int owner_id2_arg,
+                            int expected_id_arg, int expected_owner_id_arg,
+                            int expected_lifetime_arg)
 {
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     mbedtls_svc_key_id_t id1 =
-        mbedtls_svc_key_id_make( owner_id1_arg, id1_arg );
+        mbedtls_svc_key_id_make(owner_id1_arg, id1_arg);
     psa_key_lifetime_t lifetime = lifetime_arg;
     mbedtls_svc_key_id_t id2 =
-        mbedtls_svc_key_id_make( owner_id2_arg, id2_arg );
+        mbedtls_svc_key_id_make(owner_id2_arg, id2_arg);
     mbedtls_svc_key_id_t expected_id =
-        mbedtls_svc_key_id_make( expected_owner_id_arg, expected_id_arg );
+        mbedtls_svc_key_id_make(expected_owner_id_arg, expected_id_arg);
     psa_key_lifetime_t expected_lifetime = expected_lifetime_arg;
 
-    if( id1_arg != -1 )
-        psa_set_key_id( &attributes, id1 );
-    if( lifetime_arg != -1 )
-        psa_set_key_lifetime( &attributes, lifetime );
-    if( id2_arg != -1 )
-        psa_set_key_id( &attributes, id2 );
+    if (id1_arg != -1) {
+        psa_set_key_id(&attributes, id1);
+    }
+    if (lifetime_arg != -1) {
+        psa_set_key_lifetime(&attributes, lifetime);
+    }
+    if (id2_arg != -1) {
+        psa_set_key_id(&attributes, id2);
+    }
 
-    TEST_ASSERT( mbedtls_svc_key_id_equal(
-                     psa_get_key_id( &attributes ), expected_id ) );
-    TEST_EQUAL( psa_get_key_lifetime( &attributes ), expected_lifetime );
+    TEST_ASSERT(mbedtls_svc_key_id_equal(
+                    psa_get_key_id(&attributes), expected_id));
+    TEST_EQUAL(psa_get_key_lifetime(&attributes), expected_lifetime);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_SE_C */
-void slot_number_attribute( )
+void slot_number_attribute()
 {
     psa_key_slot_number_t slot_number = 0xdeadbeef;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
     /* Initially, there is no slot number. */
-    TEST_EQUAL( psa_get_key_slot_number( &attributes, &slot_number ),
-                PSA_ERROR_INVALID_ARGUMENT );
+    TEST_EQUAL(psa_get_key_slot_number(&attributes, &slot_number),
+               PSA_ERROR_INVALID_ARGUMENT);
 
     /* Test setting a slot number. */
-    psa_set_key_slot_number( &attributes, 0 );
-    PSA_ASSERT( psa_get_key_slot_number( &attributes, &slot_number ) );
-    TEST_EQUAL( slot_number, 0 );
+    psa_set_key_slot_number(&attributes, 0);
+    PSA_ASSERT(psa_get_key_slot_number(&attributes, &slot_number));
+    TEST_EQUAL(slot_number, 0);
 
     /* Test changing the slot number. */
-    psa_set_key_slot_number( &attributes, 42 );
-    PSA_ASSERT( psa_get_key_slot_number( &attributes, &slot_number ) );
-    TEST_EQUAL( slot_number, 42 );
+    psa_set_key_slot_number(&attributes, 42);
+    PSA_ASSERT(psa_get_key_slot_number(&attributes, &slot_number));
+    TEST_EQUAL(slot_number, 42);
 
     /* Test clearing the slot number. */
-    psa_clear_key_slot_number( &attributes );
-    TEST_EQUAL( psa_get_key_slot_number( &attributes, &slot_number ),
-                PSA_ERROR_INVALID_ARGUMENT );
+    psa_clear_key_slot_number(&attributes);
+    TEST_EQUAL(psa_get_key_slot_number(&attributes, &slot_number),
+               PSA_ERROR_INVALID_ARGUMENT);
 
     /* Clearing again should have no effect. */
-    psa_clear_key_slot_number( &attributes );
-    TEST_EQUAL( psa_get_key_slot_number( &attributes, &slot_number ),
-                PSA_ERROR_INVALID_ARGUMENT );
+    psa_clear_key_slot_number(&attributes);
+    TEST_EQUAL(psa_get_key_slot_number(&attributes, &slot_number),
+               PSA_ERROR_INVALID_ARGUMENT);
 
     /* Test that reset clears the slot number. */
-    psa_set_key_slot_number( &attributes, 42 );
-    PSA_ASSERT( psa_get_key_slot_number( &attributes, &slot_number ) );
-    TEST_EQUAL( slot_number, 42 );
-    psa_reset_key_attributes( &attributes );
-    TEST_EQUAL( psa_get_key_slot_number( &attributes, &slot_number ),
-                PSA_ERROR_INVALID_ARGUMENT );
+    psa_set_key_slot_number(&attributes, 42);
+    PSA_ASSERT(psa_get_key_slot_number(&attributes, &slot_number));
+    TEST_EQUAL(slot_number, 42);
+    psa_reset_key_attributes(&attributes);
+    TEST_EQUAL(psa_get_key_slot_number(&attributes, &slot_number),
+               PSA_ERROR_INVALID_ARGUMENT);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_driver_wrappers.function b/tests/suites/test_suite_psa_crypto_driver_wrappers.function
index 27d50b2..953b9ff 100644
--- a/tests/suites/test_suite_psa_crypto_driver_wrappers.function
+++ b/tests/suites/test_suite_psa_crypto_driver_wrappers.function
@@ -8,14 +8,14 @@
  */
 
 /* BEGIN_CASE */
-void sign_hash( int key_type_arg,
-                int alg_arg,
-                int force_status_arg,
-                data_t *key_input,
-                data_t *data_input,
-                data_t *expected_output,
-                int fake_output,
-                int expected_status_arg )
+void sign_hash(int key_type_arg,
+               int alg_arg,
+               int force_status_arg,
+               data_t *key_input,
+               data_t *data_input,
+               data_t *expected_output,
+               int fake_output,
+               int expected_status_arg)
 {
     psa_status_t force_status = force_status_arg;
     psa_status_t expected_status = expected_status_arg;
@@ -31,18 +31,17 @@
     mbedtls_test_driver_signature_sign_hooks =
         mbedtls_test_driver_signature_hooks_init();
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    psa_set_key_type( &attributes,
-                      key_type );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_import_key( &attributes,
-                    key_input->x, key_input->len,
-                    &key );
+    PSA_ASSERT(psa_crypto_init());
+    psa_set_key_type(&attributes,
+                     key_type);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_import_key(&attributes,
+                   key_input->x, key_input->len,
+                   &key);
 
     mbedtls_test_driver_signature_sign_hooks.forced_status = force_status;
-    if( fake_output == 1 )
-    {
+    if (fake_output == 1) {
         mbedtls_test_driver_signature_sign_hooks.forced_output =
             expected_output->x;
         mbedtls_test_driver_signature_sign_hooks.forced_output_length =
@@ -51,104 +50,100 @@
 
     /* Allocate a buffer which has the size advertized by the
      * library. */
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
-    signature_size = PSA_SIGN_OUTPUT_SIZE( key_type, key_bits, alg );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
+    signature_size = PSA_SIGN_OUTPUT_SIZE(key_type, key_bits, alg);
 
-    TEST_ASSERT( signature_size != 0 );
-    TEST_ASSERT( signature_size <= PSA_SIGNATURE_MAX_SIZE );
-    ASSERT_ALLOC( signature, signature_size );
+    TEST_ASSERT(signature_size != 0);
+    TEST_ASSERT(signature_size <= PSA_SIGNATURE_MAX_SIZE);
+    ASSERT_ALLOC(signature, signature_size);
 
-    actual_status = psa_sign_hash( key, alg,
-                                   data_input->x, data_input->len,
-                                   signature, signature_size,
-                                   &signature_length );
-    TEST_EQUAL( actual_status, expected_status );
-    if( expected_status == PSA_SUCCESS )
-    {
-        ASSERT_COMPARE( signature, signature_length,
-                        expected_output->x, expected_output->len );
+    actual_status = psa_sign_hash(key, alg,
+                                  data_input->x, data_input->len,
+                                  signature, signature_size,
+                                  &signature_length);
+    TEST_EQUAL(actual_status, expected_status);
+    if (expected_status == PSA_SUCCESS) {
+        ASSERT_COMPARE(signature, signature_length,
+                       expected_output->x, expected_output->len);
     }
-    TEST_EQUAL( mbedtls_test_driver_signature_sign_hooks.hits, 1 );
+    TEST_EQUAL(mbedtls_test_driver_signature_sign_hooks.hits, 1);
 
 exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    mbedtls_free( signature );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    mbedtls_free(signature);
+    PSA_DONE();
     mbedtls_test_driver_signature_sign_hooks =
         mbedtls_test_driver_signature_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void verify_hash( int key_type_arg,
-                  int key_type_public_arg,
+void verify_hash(int key_type_arg,
+                 int key_type_public_arg,
+                 int alg_arg,
+                 int force_status_arg,
+                 int register_public_key,
+                 data_t *key_input,
+                 data_t *data_input,
+                 data_t *signature_input,
+                 int expected_status_arg)
+{
+    psa_status_t force_status = force_status_arg;
+    psa_status_t expected_status = expected_status_arg;
+    psa_algorithm_t alg = alg_arg;
+    psa_key_type_t key_type = key_type_arg;
+    psa_key_type_t key_type_public = key_type_public_arg;
+    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
+    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+    psa_status_t actual_status;
+    mbedtls_test_driver_signature_verify_hooks =
+        mbedtls_test_driver_signature_hooks_init();
+
+    PSA_ASSERT(psa_crypto_init());
+    if (register_public_key) {
+        psa_set_key_type(&attributes, key_type_public);
+        psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_VERIFY_HASH);
+        psa_set_key_algorithm(&attributes, alg);
+        psa_import_key(&attributes,
+                       key_input->x, key_input->len,
+                       &key);
+    } else {
+        psa_set_key_type(&attributes, key_type);
+        psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_VERIFY_HASH);
+        psa_set_key_algorithm(&attributes, alg);
+        psa_import_key(&attributes,
+                       key_input->x, key_input->len,
+                       &key);
+    }
+
+    mbedtls_test_driver_signature_verify_hooks.forced_status = force_status;
+
+    actual_status = psa_verify_hash(key, alg,
+                                    data_input->x, data_input->len,
+                                    signature_input->x, signature_input->len);
+    TEST_EQUAL(actual_status, expected_status);
+    TEST_EQUAL(mbedtls_test_driver_signature_verify_hooks.hits, 1);
+
+exit:
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    PSA_DONE();
+    mbedtls_test_driver_signature_verify_hooks =
+        mbedtls_test_driver_signature_hooks_init();
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
+void sign_message(int key_type_arg,
                   int alg_arg,
                   int force_status_arg,
-                  int register_public_key,
                   data_t *key_input,
                   data_t *data_input,
-                  data_t *signature_input,
-                  int expected_status_arg )
-{
-    psa_status_t force_status = force_status_arg;
-    psa_status_t expected_status = expected_status_arg;
-    psa_algorithm_t alg = alg_arg;
-    psa_key_type_t key_type = key_type_arg;
-    psa_key_type_t key_type_public = key_type_public_arg;
-    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
-    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    psa_status_t actual_status;
-    mbedtls_test_driver_signature_verify_hooks =
-        mbedtls_test_driver_signature_hooks_init();
-
-    PSA_ASSERT( psa_crypto_init( ) );
-    if( register_public_key )
-    {
-        psa_set_key_type( &attributes, key_type_public );
-        psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_VERIFY_HASH );
-        psa_set_key_algorithm( &attributes, alg );
-        psa_import_key( &attributes,
-                        key_input->x, key_input->len,
-                        &key );
-    }
-    else
-    {
-        psa_set_key_type( &attributes, key_type );
-        psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_VERIFY_HASH );
-        psa_set_key_algorithm( &attributes, alg );
-        psa_import_key( &attributes,
-                        key_input->x, key_input->len,
-                        &key );
-    }
-
-    mbedtls_test_driver_signature_verify_hooks.forced_status = force_status;
-
-    actual_status = psa_verify_hash( key, alg,
-                                     data_input->x, data_input->len,
-                                     signature_input->x, signature_input->len );
-    TEST_EQUAL( actual_status, expected_status );
-    TEST_EQUAL( mbedtls_test_driver_signature_verify_hooks.hits, 1 );
-
-exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    PSA_DONE( );
-    mbedtls_test_driver_signature_verify_hooks =
-        mbedtls_test_driver_signature_hooks_init();
-}
-/* END_CASE */
-
-/* BEGIN_CASE */
-void sign_message( int key_type_arg,
-                   int alg_arg,
-                   int force_status_arg,
-                   data_t *key_input,
-                   data_t *data_input,
-                   data_t *expected_output,
-                   int fake_output,
-                   int expected_status_arg )
+                  data_t *expected_output,
+                  int fake_output,
+                  int expected_status_arg)
 {
     psa_status_t force_status = force_status_arg;
     psa_status_t expected_status = expected_status_arg;
@@ -164,17 +159,16 @@
     mbedtls_test_driver_signature_sign_hooks =
         mbedtls_test_driver_signature_hooks_init();
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    psa_set_key_type( &attributes, key_type );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_MESSAGE );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_import_key( &attributes,
-                    key_input->x, key_input->len,
-                    &key );
+    PSA_ASSERT(psa_crypto_init());
+    psa_set_key_type(&attributes, key_type);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_MESSAGE);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_import_key(&attributes,
+                   key_input->x, key_input->len,
+                   &key);
 
     mbedtls_test_driver_signature_sign_hooks.forced_status = force_status;
-    if( fake_output == 1 )
-    {
+    if (fake_output == 1) {
         mbedtls_test_driver_signature_sign_hooks.forced_output =
             expected_output->x;
         mbedtls_test_driver_signature_sign_hooks.forced_output_length =
@@ -183,48 +177,47 @@
 
     /* Allocate a buffer which has the size advertized by the
      * library. */
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
-    signature_size = PSA_SIGN_OUTPUT_SIZE( key_type, key_bits, alg );
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
+    signature_size = PSA_SIGN_OUTPUT_SIZE(key_type, key_bits, alg);
 
-    TEST_ASSERT( signature_size != 0 );
-    TEST_ASSERT( signature_size <= PSA_SIGNATURE_MAX_SIZE );
-    ASSERT_ALLOC( signature, signature_size );
+    TEST_ASSERT(signature_size != 0);
+    TEST_ASSERT(signature_size <= PSA_SIGNATURE_MAX_SIZE);
+    ASSERT_ALLOC(signature, signature_size);
 
-    actual_status = psa_sign_message( key, alg,
-                                      data_input->x, data_input->len,
-                                      signature, signature_size,
-                                      &signature_length );
-    TEST_EQUAL( actual_status, expected_status );
-    if( expected_status == PSA_SUCCESS )
-    {
-        ASSERT_COMPARE( signature, signature_length,
-                        expected_output->x, expected_output->len );
+    actual_status = psa_sign_message(key, alg,
+                                     data_input->x, data_input->len,
+                                     signature, signature_size,
+                                     &signature_length);
+    TEST_EQUAL(actual_status, expected_status);
+    if (expected_status == PSA_SUCCESS) {
+        ASSERT_COMPARE(signature, signature_length,
+                       expected_output->x, expected_output->len);
     }
     /* In the builtin algorithm the driver is called twice. */
-    TEST_EQUAL( mbedtls_test_driver_signature_sign_hooks.hits,
-                force_status == PSA_ERROR_NOT_SUPPORTED ? 2 : 1 );
+    TEST_EQUAL(mbedtls_test_driver_signature_sign_hooks.hits,
+               force_status == PSA_ERROR_NOT_SUPPORTED ? 2 : 1);
 
 exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    mbedtls_free( signature );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    mbedtls_free(signature);
+    PSA_DONE();
     mbedtls_test_driver_signature_sign_hooks =
         mbedtls_test_driver_signature_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void verify_message( int key_type_arg,
-                     int key_type_public_arg,
-                     int alg_arg,
-                     int force_status_arg,
-                     int register_public_key,
-                     data_t *key_input,
-                     data_t *data_input,
-                     data_t *signature_input,
-                     int expected_status_arg )
+void verify_message(int key_type_arg,
+                    int key_type_public_arg,
+                    int alg_arg,
+                    int force_status_arg,
+                    int register_public_key,
+                    data_t *key_input,
+                    data_t *data_input,
+                    data_t *signature_input,
+                    int expected_status_arg)
 {
     psa_status_t force_status = force_status_arg;
     psa_status_t expected_status = expected_status_arg;
@@ -237,131 +230,123 @@
     mbedtls_test_driver_signature_verify_hooks =
         mbedtls_test_driver_signature_hooks_init();
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    if( register_public_key )
-    {
-        psa_set_key_type( &attributes, key_type_public );
-        psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_VERIFY_MESSAGE );
-        psa_set_key_algorithm( &attributes, alg );
-        psa_import_key( &attributes,
-                        key_input->x, key_input->len,
-                        &key );
-    }
-    else
-    {
-        psa_set_key_type( &attributes, key_type );
-        psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_VERIFY_MESSAGE );
-        psa_set_key_algorithm( &attributes, alg );
-        psa_import_key( &attributes,
-                        key_input->x, key_input->len,
-                        &key );
+    PSA_ASSERT(psa_crypto_init());
+    if (register_public_key) {
+        psa_set_key_type(&attributes, key_type_public);
+        psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_VERIFY_MESSAGE);
+        psa_set_key_algorithm(&attributes, alg);
+        psa_import_key(&attributes,
+                       key_input->x, key_input->len,
+                       &key);
+    } else {
+        psa_set_key_type(&attributes, key_type);
+        psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_VERIFY_MESSAGE);
+        psa_set_key_algorithm(&attributes, alg);
+        psa_import_key(&attributes,
+                       key_input->x, key_input->len,
+                       &key);
     }
 
     mbedtls_test_driver_signature_verify_hooks.forced_status = force_status;
 
-    actual_status = psa_verify_message( key, alg,
-                                        data_input->x, data_input->len,
-                                        signature_input->x, signature_input->len );
-    TEST_EQUAL( actual_status, expected_status );
+    actual_status = psa_verify_message(key, alg,
+                                       data_input->x, data_input->len,
+                                       signature_input->x, signature_input->len);
+    TEST_EQUAL(actual_status, expected_status);
     /* In the builtin algorithm the driver is called twice. */
-    TEST_EQUAL( mbedtls_test_driver_signature_verify_hooks.hits,
-                force_status == PSA_ERROR_NOT_SUPPORTED ? 2 : 1 );
+    TEST_EQUAL(mbedtls_test_driver_signature_verify_hooks.hits,
+               force_status == PSA_ERROR_NOT_SUPPORTED ? 2 : 1);
 
 exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    PSA_DONE();
     mbedtls_test_driver_signature_verify_hooks =
         mbedtls_test_driver_signature_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:PSA_WANT_ALG_ECDSA:PSA_WANT_ECC_SECP_R1_256 */
-void generate_key( int force_status_arg,
-                   data_t *fake_output,
-                   int expected_status_arg )
+void generate_key(int force_status_arg,
+                  data_t *fake_output,
+                  int expected_status_arg)
 {
     psa_status_t force_status = force_status_arg;
     psa_status_t expected_status = expected_status_arg;
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    psa_algorithm_t alg = PSA_ALG_ECDSA( PSA_ALG_SHA_256 );
+    psa_algorithm_t alg = PSA_ALG_ECDSA(PSA_ALG_SHA_256);
     const uint8_t *expected_output = NULL;
     size_t expected_output_length = 0;
     psa_status_t actual_status;
-    uint8_t actual_output[PSA_KEY_EXPORT_ECC_KEY_PAIR_MAX_SIZE(256)] = {0};
+    uint8_t actual_output[PSA_KEY_EXPORT_ECC_KEY_PAIR_MAX_SIZE(256)] = { 0 };
     size_t actual_output_length;
     mbedtls_test_driver_key_management_hooks =
         mbedtls_test_driver_key_management_hooks_init();
 
-    psa_set_key_type( &attributes,
-                      PSA_KEY_TYPE_ECC_KEY_PAIR( PSA_ECC_FAMILY_SECP_R1 ) );
-    psa_set_key_bits( &attributes, 256 );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_EXPORT );
-    psa_set_key_algorithm( &attributes, alg );
+    psa_set_key_type(&attributes,
+                     PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1));
+    psa_set_key_bits(&attributes, 256);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_EXPORT);
+    psa_set_key_algorithm(&attributes, alg);
 
-    if( fake_output->len > 0 )
-    {
+    if (fake_output->len > 0) {
         expected_output =
             mbedtls_test_driver_key_management_hooks.forced_output =
-            fake_output->x;
+                fake_output->x;
 
         expected_output_length =
             mbedtls_test_driver_key_management_hooks.forced_output_length =
-            fake_output->len;
+                fake_output->len;
     }
 
     mbedtls_test_driver_key_management_hooks.hits = 0;
     mbedtls_test_driver_key_management_hooks.forced_status = force_status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    actual_status = psa_generate_key( &attributes, &key );
-    TEST_EQUAL( mbedtls_test_driver_key_management_hooks.hits, 1 );
-    TEST_EQUAL( actual_status, expected_status );
+    actual_status = psa_generate_key(&attributes, &key);
+    TEST_EQUAL(mbedtls_test_driver_key_management_hooks.hits, 1);
+    TEST_EQUAL(actual_status, expected_status);
 
-    if( actual_status == PSA_SUCCESS )
-    {
-        psa_export_key( key, actual_output, sizeof(actual_output), &actual_output_length );
+    if (actual_status == PSA_SUCCESS) {
+        psa_export_key(key, actual_output, sizeof(actual_output), &actual_output_length);
 
-        if( fake_output->len > 0 )
-        {
-            ASSERT_COMPARE( actual_output, actual_output_length,
-                            expected_output, expected_output_length );
-        }
-        else
-        {
+        if (fake_output->len > 0) {
+            ASSERT_COMPARE(actual_output, actual_output_length,
+                           expected_output, expected_output_length);
+        } else {
             size_t zeroes = 0;
-            for( size_t i = 0; i < sizeof(actual_output); i++ )
-            {
-                if( actual_output[i] == 0)
+            for (size_t i = 0; i < sizeof(actual_output); i++) {
+                if (actual_output[i] == 0) {
                     zeroes++;
+                }
             }
-            TEST_ASSERT( zeroes != sizeof(actual_output) );
+            TEST_ASSERT(zeroes != sizeof(actual_output));
         }
     }
 exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    PSA_DONE();
     mbedtls_test_driver_key_management_hooks =
         mbedtls_test_driver_key_management_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void validate_key( int force_status_arg,
-                   int location,
-                   int owner_id_arg,
-                   int id_arg,
-                   int key_type_arg,
-                   data_t *key_input,
-                   int expected_status_arg )
+void validate_key(int force_status_arg,
+                  int location,
+                  int owner_id_arg,
+                  int id_arg,
+                  int key_type_arg,
+                  data_t *key_input,
+                  int expected_status_arg)
 {
     psa_key_lifetime_t lifetime =
-                              PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION( \
-                                  PSA_KEY_PERSISTENCE_DEFAULT, location);
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( owner_id_arg, id_arg );
+        PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION( \
+            PSA_KEY_PERSISTENCE_DEFAULT, location);
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(owner_id_arg, id_arg);
     psa_status_t force_status = force_status_arg;
     psa_status_t expected_status = expected_status_arg;
     psa_key_type_t key_type = key_type_arg;
@@ -371,38 +356,38 @@
     mbedtls_test_driver_key_management_hooks =
         mbedtls_test_driver_key_management_hooks_init();
 
-    psa_set_key_id( &attributes, id );
-    psa_set_key_type( &attributes,
-                      key_type );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_bits( &attributes, 0 );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
+    psa_set_key_id(&attributes, id);
+    psa_set_key_type(&attributes,
+                     key_type);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_bits(&attributes, 0);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
 
     mbedtls_test_driver_key_management_hooks.forced_status = force_status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    actual_status = psa_import_key( &attributes, key_input->x, key_input->len, &key );
-    TEST_EQUAL( mbedtls_test_driver_key_management_hooks.hits, 1 );
-    TEST_EQUAL( actual_status, expected_status );
-    TEST_EQUAL( mbedtls_test_driver_key_management_hooks.location, location );
+    actual_status = psa_import_key(&attributes, key_input->x, key_input->len, &key);
+    TEST_EQUAL(mbedtls_test_driver_key_management_hooks.hits, 1);
+    TEST_EQUAL(actual_status, expected_status);
+    TEST_EQUAL(mbedtls_test_driver_key_management_hooks.location, location);
 exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    PSA_DONE();
     mbedtls_test_driver_key_management_hooks =
         mbedtls_test_driver_key_management_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void export_key( int force_status_arg,
-                 data_t *fake_output,
-                 int key_in_type_arg,
-                 data_t *key_in,
-                 int key_out_type_arg,
-                 data_t *expected_output,
-                 int expected_status_arg )
+void export_key(int force_status_arg,
+                data_t *fake_output,
+                int key_in_type_arg,
+                data_t *key_in,
+                int key_out_type_arg,
+                data_t *expected_output,
+                int expected_status_arg)
 {
     psa_status_t force_status = force_status_arg;
     psa_status_t expected_status = expected_status_arg;
@@ -413,30 +398,27 @@
     const uint8_t *expected_output_ptr = NULL;
     size_t expected_output_length = 0;
     psa_status_t actual_status;
-    uint8_t actual_output[PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(256)] = {0};
+    uint8_t actual_output[PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(256)] = { 0 };
     size_t actual_output_length;
     mbedtls_test_driver_key_management_hooks =
         mbedtls_test_driver_key_management_hooks_init();
 
-    psa_set_key_type( &attributes, input_key_type );
-    psa_set_key_bits( &attributes, 256 );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
+    psa_set_key_type(&attributes, input_key_type);
+    psa_set_key_bits(&attributes, 256);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    PSA_ASSERT( psa_import_key( &attributes, key_in->x, key_in->len, &handle ) );
+    PSA_ASSERT(psa_crypto_init());
+    PSA_ASSERT(psa_import_key(&attributes, key_in->x, key_in->len, &handle));
 
-    if( fake_output->len > 0 )
-    {
+    if (fake_output->len > 0) {
         expected_output_ptr =
             mbedtls_test_driver_key_management_hooks.forced_output =
-            fake_output->x;
+                fake_output->x;
 
         expected_output_length =
             mbedtls_test_driver_key_management_hooks.forced_output_length =
-            fake_output->len;
-    }
-    else
-    {
+                fake_output->len;
+    } else {
         expected_output_ptr = expected_output->x;
         expected_output_length = expected_output->len;
     }
@@ -444,40 +426,47 @@
     mbedtls_test_driver_key_management_hooks.hits = 0;
     mbedtls_test_driver_key_management_hooks.forced_status = force_status;
 
-    if( PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY( output_key_type ) )
-        actual_status = psa_export_public_key( handle, actual_output, sizeof(actual_output), &actual_output_length );
-    else
-        actual_status = psa_export_key( handle, actual_output, sizeof(actual_output), &actual_output_length );
-    TEST_EQUAL( actual_status, expected_status );
+    if (PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY(output_key_type)) {
+        actual_status = psa_export_public_key(handle,
+                                              actual_output,
+                                              sizeof(actual_output),
+                                              &actual_output_length);
+    } else {
+        actual_status = psa_export_key(handle,
+                                       actual_output,
+                                       sizeof(actual_output),
+                                       &actual_output_length);
+    }
+    TEST_EQUAL(actual_status, expected_status);
 
-    if( PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY( output_key_type ) &&
-        !PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY( input_key_type ) )
-        TEST_EQUAL( mbedtls_test_driver_key_management_hooks.hits, 1 );
+    if (PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY(output_key_type) &&
+        !PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY(input_key_type)) {
+        TEST_EQUAL(mbedtls_test_driver_key_management_hooks.hits, 1);
+    }
 
-    if( actual_status == PSA_SUCCESS )
-    {
-        ASSERT_COMPARE( actual_output, actual_output_length,
-                        expected_output_ptr, expected_output_length );
+    if (actual_status == PSA_SUCCESS) {
+        ASSERT_COMPARE(actual_output, actual_output_length,
+                       expected_output_ptr, expected_output_length);
     }
 exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( handle );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(handle);
+    PSA_DONE();
     mbedtls_test_driver_key_management_hooks =
         mbedtls_test_driver_key_management_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_encrypt_validation( int alg_arg,
-                                int key_type_arg,
-                                data_t *key_data,
-                                data_t *input )
+void cipher_encrypt_validation(int alg_arg,
+                               int key_type_arg,
+                               data_t *key_data,
+                               data_t *input)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
     psa_algorithm_t alg = alg_arg;
-    size_t iv_size = PSA_CIPHER_IV_LENGTH ( key_type, alg );
+    size_t iv_size = PSA_CIPHER_IV_LENGTH(key_type, alg);
     unsigned char *output1 = NULL;
     size_t output1_buffer_size = 0;
     size_t output1_length = 0;
@@ -489,81 +478,81 @@
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     mbedtls_test_driver_cipher_hooks = mbedtls_test_driver_cipher_hooks_init();
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    output1_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, input->len );
-    output2_buffer_size = PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, input->len ) +
-                          PSA_CIPHER_FINISH_OUTPUT_SIZE( key_type, alg );
-    ASSERT_ALLOC( output1, output1_buffer_size );
-    ASSERT_ALLOC( output2, output2_buffer_size );
+    output1_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input->len);
+    output2_buffer_size = PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input->len) +
+                          PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg);
+    ASSERT_ALLOC(output1, output1_buffer_size);
+    ASSERT_ALLOC(output2, output2_buffer_size);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    PSA_ASSERT( psa_cipher_encrypt( key, alg, input->x, input->len, output1,
-                                    output1_buffer_size, &output1_length ) );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
+    PSA_ASSERT(psa_cipher_encrypt(key, alg, input->x, input->len, output1,
+                                  output1_buffer_size, &output1_length));
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
-    PSA_ASSERT( psa_cipher_set_iv( &operation, output1, iv_size ) );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
+    PSA_ASSERT(psa_cipher_set_iv(&operation, output1, iv_size));
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
-    PSA_ASSERT( psa_cipher_update( &operation,
-                                   input->x, input->len,
-                                   output2, output2_buffer_size,
-                                   &function_output_length ) );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
+    PSA_ASSERT(psa_cipher_update(&operation,
+                                 input->x, input->len,
+                                 output2, output2_buffer_size,
+                                 &function_output_length));
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
     output2_length += function_output_length;
-    PSA_ASSERT( psa_cipher_finish( &operation,
-                                   output2 + output2_length,
-                                   output2_buffer_size - output2_length,
-                                   &function_output_length ) );
+    PSA_ASSERT(psa_cipher_finish(&operation,
+                                 output2 + output2_length,
+                                 output2_buffer_size - output2_length,
+                                 &function_output_length));
     /* Finish will have called abort as well, so expecting two hits here */
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 2 );
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 2);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
     output2_length += function_output_length;
 
-    PSA_ASSERT( psa_cipher_abort( &operation ) );
+    PSA_ASSERT(psa_cipher_abort(&operation));
     // driver function should've been called as part of the finish() core routine
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 0 );
-    ASSERT_COMPARE( output1 + iv_size, output1_length - iv_size,
-                    output2, output2_length );
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 0);
+    ASSERT_COMPARE(output1 + iv_size, output1_length - iv_size,
+                   output2, output2_length);
 
 exit:
-    psa_cipher_abort( &operation );
-    mbedtls_free( output1 );
-    mbedtls_free( output2 );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_cipher_abort(&operation);
+    mbedtls_free(output1);
+    mbedtls_free(output2);
+    psa_destroy_key(key);
+    PSA_DONE();
     mbedtls_test_driver_cipher_hooks = mbedtls_test_driver_cipher_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_encrypt_multipart( int alg_arg,
-                               int key_type_arg,
-                               data_t *key_data,
-                               data_t *iv,
-                               data_t *input,
-                               int first_part_size_arg,
-                               int output1_length_arg,
-                               int output2_length_arg,
-                               data_t *expected_output,
-                               int mock_output_arg,
-                               int force_status_arg,
-                               int expected_status_arg )
+void cipher_encrypt_multipart(int alg_arg,
+                              int key_type_arg,
+                              data_t *key_data,
+                              data_t *iv,
+                              data_t *input,
+                              int first_part_size_arg,
+                              int output1_length_arg,
+                              int output2_length_arg,
+                              data_t *expected_output,
+                              int mock_output_arg,
+                              int force_status_arg,
+                              int expected_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -585,247 +574,239 @@
 
     /* Test operation initialization */
     mbedtls_psa_cipher_operation_t mbedtls_operation =
-            MBEDTLS_PSA_CIPHER_OPERATION_INIT;
+        MBEDTLS_PSA_CIPHER_OPERATION_INIT;
 
     mbedtls_transparent_test_driver_cipher_operation_t transparent_operation =
-            MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT;
+        MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT;
 
     mbedtls_opaque_test_driver_cipher_operation_t opaque_operation =
-            MBEDTLS_OPAQUE_TEST_DRIVER_CIPHER_OPERATION_INIT;
+        MBEDTLS_OPAQUE_TEST_DRIVER_CIPHER_OPERATION_INIT;
 
     operation.ctx.mbedtls_ctx = mbedtls_operation;
     operation.ctx.transparent_test_driver_ctx = transparent_operation;
     operation.ctx.opaque_test_driver_ctx = opaque_operation;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
+    PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
-    PSA_ASSERT( psa_cipher_set_iv( &operation, iv->x, iv->len ) );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, ( force_status == PSA_SUCCESS ? 1 : 0 ) );
+    PSA_ASSERT(psa_cipher_set_iv(&operation, iv->x, iv->len));
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, (force_status == PSA_SUCCESS ? 1 : 0));
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
-    output_buffer_size = ( (size_t) input->len +
-                           PSA_BLOCK_CIPHER_BLOCK_LENGTH( key_type ) );
-    ASSERT_ALLOC( output, output_buffer_size );
+    output_buffer_size = ((size_t) input->len +
+                          PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type));
+    ASSERT_ALLOC(output, output_buffer_size);
 
-    if( mock_output_arg )
-    {
+    if (mock_output_arg) {
         mbedtls_test_driver_cipher_hooks.forced_output = expected_output->x;
         mbedtls_test_driver_cipher_hooks.forced_output_length = expected_output->len;
     }
 
-    TEST_ASSERT( first_part_size <= input->len );
-    PSA_ASSERT( psa_cipher_update( &operation, input->x, first_part_size,
-                                   output, output_buffer_size,
-                                   &function_output_length ) );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, ( force_status == PSA_SUCCESS ? 1 : 0 ) );
+    TEST_ASSERT(first_part_size <= input->len);
+    PSA_ASSERT(psa_cipher_update(&operation, input->x, first_part_size,
+                                 output, output_buffer_size,
+                                 &function_output_length));
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, (force_status == PSA_SUCCESS ? 1 : 0));
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
-    TEST_ASSERT( function_output_length == output1_length );
+    TEST_ASSERT(function_output_length == output1_length);
     total_output_length += function_output_length;
 
-    if( first_part_size < input->len )
-    {
-        PSA_ASSERT( psa_cipher_update( &operation,
-                                       input->x + first_part_size,
-                                       input->len - first_part_size,
-                                       output + total_output_length,
-                                       output_buffer_size - total_output_length,
-                                       &function_output_length ) );
-        TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
+    if (first_part_size < input->len) {
+        PSA_ASSERT(psa_cipher_update(&operation,
+                                     input->x + first_part_size,
+                                     input->len - first_part_size,
+                                     output + total_output_length,
+                                     output_buffer_size - total_output_length,
+                                     &function_output_length));
+        TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
         mbedtls_test_driver_cipher_hooks.hits = 0;
 
-        TEST_ASSERT( function_output_length == output2_length );
+        TEST_ASSERT(function_output_length == output2_length);
         total_output_length += function_output_length;
     }
 
-    if( mock_output_arg )
-    {
+    if (mock_output_arg) {
         mbedtls_test_driver_cipher_hooks.forced_output = NULL;
         mbedtls_test_driver_cipher_hooks.forced_output_length = 0;
     }
 
-    status =  psa_cipher_finish( &operation,
-                                 output + total_output_length,
-                                 output_buffer_size - total_output_length,
-                                 &function_output_length );
-    /* Finish will have called abort as well, so expecting two hits here */
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, ( force_status == PSA_SUCCESS ? 2 : 0 ) );
-    mbedtls_test_driver_cipher_hooks.hits = 0 ;
-    total_output_length += function_output_length;
-    TEST_EQUAL( status, expected_status );
-
-    if( expected_status == PSA_SUCCESS )
-    {
-        PSA_ASSERT( psa_cipher_abort( &operation ) );
-        TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 0 );
-
-        ASSERT_COMPARE( expected_output->x, expected_output->len,
-                        output, total_output_length );
-    }
-
-exit:
-    psa_cipher_abort( &operation );
-    mbedtls_free( output );
-    psa_destroy_key( key );
-    PSA_DONE( );
-    mbedtls_test_driver_cipher_hooks = mbedtls_test_driver_cipher_hooks_init();
-}
-/* END_CASE */
-
-/* BEGIN_CASE */
-void cipher_decrypt_multipart( int alg_arg,
-                               int key_type_arg,
-                               data_t *key_data,
-                               data_t *iv,
-                               data_t *input,
-                               int first_part_size_arg,
-                               int output1_length_arg,
-                               int output2_length_arg,
-                               data_t *expected_output,
-                               int mock_output_arg,
-                               int force_status_arg,
-                               int expected_status_arg )
-{
-    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
-    psa_key_type_t key_type = key_type_arg;
-    psa_algorithm_t alg = alg_arg;
-    psa_status_t status;
-    psa_status_t expected_status = expected_status_arg;
-    psa_status_t force_status = force_status_arg;
-    size_t first_part_size = first_part_size_arg;
-    size_t output1_length = output1_length_arg;
-    size_t output2_length = output2_length_arg;
-    unsigned char *output = NULL;
-    size_t output_buffer_size = 0;
-    size_t function_output_length = 0;
-    size_t total_output_length = 0;
-    psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT;
-    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    mbedtls_test_driver_cipher_hooks = mbedtls_test_driver_cipher_hooks_init();
-    mbedtls_test_driver_cipher_hooks.forced_status = force_status;
-
-    /* Test operation initialization */
-    mbedtls_psa_cipher_operation_t mbedtls_operation =
-            MBEDTLS_PSA_CIPHER_OPERATION_INIT;
-
-    mbedtls_transparent_test_driver_cipher_operation_t transparent_operation =
-            MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT;
-
-    mbedtls_opaque_test_driver_cipher_operation_t opaque_operation =
-            MBEDTLS_OPAQUE_TEST_DRIVER_CIPHER_OPERATION_INIT;
-
-    operation.ctx.mbedtls_ctx = mbedtls_operation;
-    operation.ctx.transparent_test_driver_ctx = transparent_operation;
-    operation.ctx.opaque_test_driver_ctx = opaque_operation;
-
-    PSA_ASSERT( psa_crypto_init( ) );
-
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
-
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-
-    PSA_ASSERT( psa_cipher_decrypt_setup( &operation, key, alg ) );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
-    mbedtls_test_driver_cipher_hooks.hits = 0;
-
-    PSA_ASSERT( psa_cipher_set_iv( &operation, iv->x, iv->len ) );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, ( force_status == PSA_SUCCESS ? 1 : 0 ) );
-    mbedtls_test_driver_cipher_hooks.hits = 0;
-
-    output_buffer_size = ( (size_t) input->len +
-                           PSA_BLOCK_CIPHER_BLOCK_LENGTH( key_type ) );
-    ASSERT_ALLOC( output, output_buffer_size );
-
-    if( mock_output_arg )
-    {
-        mbedtls_test_driver_cipher_hooks.forced_output = expected_output->x;
-        mbedtls_test_driver_cipher_hooks.forced_output_length = expected_output->len;
-    }
-
-    TEST_ASSERT( first_part_size <= input->len );
-    PSA_ASSERT( psa_cipher_update( &operation,
-                                   input->x, first_part_size,
-                                   output, output_buffer_size,
-                                   &function_output_length ) );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, ( force_status == PSA_SUCCESS ? 1 : 0 ) );
-    mbedtls_test_driver_cipher_hooks.hits = 0;
-
-    TEST_ASSERT( function_output_length == output1_length );
-    total_output_length += function_output_length;
-
-    if( first_part_size < input->len )
-    {
-        PSA_ASSERT( psa_cipher_update( &operation,
-                                       input->x + first_part_size,
-                                       input->len - first_part_size,
-                                       output + total_output_length,
-                                       output_buffer_size - total_output_length,
-                                       &function_output_length ) );
-        TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, ( force_status == PSA_SUCCESS ? 1 : 0 ) );
-        mbedtls_test_driver_cipher_hooks.hits = 0;
-
-        TEST_ASSERT( function_output_length == output2_length );
-        total_output_length += function_output_length;
-    }
-
-    if( mock_output_arg )
-    {
-        mbedtls_test_driver_cipher_hooks.forced_output = NULL;
-        mbedtls_test_driver_cipher_hooks.forced_output_length = 0;
-    }
-
-    status = psa_cipher_finish( &operation,
+    status =  psa_cipher_finish(&operation,
                                 output + total_output_length,
                                 output_buffer_size - total_output_length,
-                                &function_output_length );
+                                &function_output_length);
     /* Finish will have called abort as well, so expecting two hits here */
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, ( force_status == PSA_SUCCESS ? 2 : 0 ) );
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, (force_status == PSA_SUCCESS ? 2 : 0));
     mbedtls_test_driver_cipher_hooks.hits = 0;
     total_output_length += function_output_length;
-    TEST_EQUAL( status, expected_status );
+    TEST_EQUAL(status, expected_status);
 
-    if( expected_status == PSA_SUCCESS )
-    {
-        PSA_ASSERT( psa_cipher_abort( &operation ) );
-        TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 0 );
+    if (expected_status == PSA_SUCCESS) {
+        PSA_ASSERT(psa_cipher_abort(&operation));
+        TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 0);
 
-        ASSERT_COMPARE( expected_output->x, expected_output->len,
-                        output, total_output_length );
+        ASSERT_COMPARE(expected_output->x, expected_output->len,
+                       output, total_output_length);
     }
 
 exit:
-    psa_cipher_abort( &operation );
-    mbedtls_free( output );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_cipher_abort(&operation);
+    mbedtls_free(output);
+    psa_destroy_key(key);
+    PSA_DONE();
     mbedtls_test_driver_cipher_hooks = mbedtls_test_driver_cipher_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_decrypt( int alg_arg,
-                     int key_type_arg,
-                     data_t *key_data,
-                     data_t *iv,
-                     data_t *input_arg,
-                     data_t *expected_output,
-                     int mock_output_arg,
-                     int force_status_arg,
-                     int expected_status_arg )
+void cipher_decrypt_multipart(int alg_arg,
+                              int key_type_arg,
+                              data_t *key_data,
+                              data_t *iv,
+                              data_t *input,
+                              int first_part_size_arg,
+                              int output1_length_arg,
+                              int output2_length_arg,
+                              data_t *expected_output,
+                              int mock_output_arg,
+                              int force_status_arg,
+                              int expected_status_arg)
+{
+    mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
+    psa_key_type_t key_type = key_type_arg;
+    psa_algorithm_t alg = alg_arg;
+    psa_status_t status;
+    psa_status_t expected_status = expected_status_arg;
+    psa_status_t force_status = force_status_arg;
+    size_t first_part_size = first_part_size_arg;
+    size_t output1_length = output1_length_arg;
+    size_t output2_length = output2_length_arg;
+    unsigned char *output = NULL;
+    size_t output_buffer_size = 0;
+    size_t function_output_length = 0;
+    size_t total_output_length = 0;
+    psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT;
+    psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
+    mbedtls_test_driver_cipher_hooks = mbedtls_test_driver_cipher_hooks_init();
+    mbedtls_test_driver_cipher_hooks.forced_status = force_status;
+
+    /* Test operation initialization */
+    mbedtls_psa_cipher_operation_t mbedtls_operation =
+        MBEDTLS_PSA_CIPHER_OPERATION_INIT;
+
+    mbedtls_transparent_test_driver_cipher_operation_t transparent_operation =
+        MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT;
+
+    mbedtls_opaque_test_driver_cipher_operation_t opaque_operation =
+        MBEDTLS_OPAQUE_TEST_DRIVER_CIPHER_OPERATION_INIT;
+
+    operation.ctx.mbedtls_ctx = mbedtls_operation;
+    operation.ctx.transparent_test_driver_ctx = transparent_operation;
+    operation.ctx.opaque_test_driver_ctx = opaque_operation;
+
+    PSA_ASSERT(psa_crypto_init());
+
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
+
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+
+    PSA_ASSERT(psa_cipher_decrypt_setup(&operation, key, alg));
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
+    mbedtls_test_driver_cipher_hooks.hits = 0;
+
+    PSA_ASSERT(psa_cipher_set_iv(&operation, iv->x, iv->len));
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, (force_status == PSA_SUCCESS ? 1 : 0));
+    mbedtls_test_driver_cipher_hooks.hits = 0;
+
+    output_buffer_size = ((size_t) input->len +
+                          PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type));
+    ASSERT_ALLOC(output, output_buffer_size);
+
+    if (mock_output_arg) {
+        mbedtls_test_driver_cipher_hooks.forced_output = expected_output->x;
+        mbedtls_test_driver_cipher_hooks.forced_output_length = expected_output->len;
+    }
+
+    TEST_ASSERT(first_part_size <= input->len);
+    PSA_ASSERT(psa_cipher_update(&operation,
+                                 input->x, first_part_size,
+                                 output, output_buffer_size,
+                                 &function_output_length));
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, (force_status == PSA_SUCCESS ? 1 : 0));
+    mbedtls_test_driver_cipher_hooks.hits = 0;
+
+    TEST_ASSERT(function_output_length == output1_length);
+    total_output_length += function_output_length;
+
+    if (first_part_size < input->len) {
+        PSA_ASSERT(psa_cipher_update(&operation,
+                                     input->x + first_part_size,
+                                     input->len - first_part_size,
+                                     output + total_output_length,
+                                     output_buffer_size - total_output_length,
+                                     &function_output_length));
+        TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, (force_status == PSA_SUCCESS ? 1 : 0));
+        mbedtls_test_driver_cipher_hooks.hits = 0;
+
+        TEST_ASSERT(function_output_length == output2_length);
+        total_output_length += function_output_length;
+    }
+
+    if (mock_output_arg) {
+        mbedtls_test_driver_cipher_hooks.forced_output = NULL;
+        mbedtls_test_driver_cipher_hooks.forced_output_length = 0;
+    }
+
+    status = psa_cipher_finish(&operation,
+                               output + total_output_length,
+                               output_buffer_size - total_output_length,
+                               &function_output_length);
+    /* Finish will have called abort as well, so expecting two hits here */
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, (force_status == PSA_SUCCESS ? 2 : 0));
+    mbedtls_test_driver_cipher_hooks.hits = 0;
+    total_output_length += function_output_length;
+    TEST_EQUAL(status, expected_status);
+
+    if (expected_status == PSA_SUCCESS) {
+        PSA_ASSERT(psa_cipher_abort(&operation));
+        TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 0);
+
+        ASSERT_COMPARE(expected_output->x, expected_output->len,
+                       output, total_output_length);
+    }
+
+exit:
+    psa_cipher_abort(&operation);
+    mbedtls_free(output);
+    psa_destroy_key(key);
+    PSA_DONE();
+    mbedtls_test_driver_cipher_hooks = mbedtls_test_driver_cipher_hooks_init();
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
+void cipher_decrypt(int alg_arg,
+                    int key_type_arg,
+                    data_t *key_data,
+                    data_t *iv,
+                    data_t *input_arg,
+                    data_t *expected_output,
+                    int mock_output_arg,
+                    int force_status_arg,
+                    int expected_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_status_t status;
@@ -842,59 +823,56 @@
     mbedtls_test_driver_cipher_hooks = mbedtls_test_driver_cipher_hooks_init();
     mbedtls_test_driver_cipher_hooks.forced_status = force_status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
     /* Allocate input buffer and copy the iv and the plaintext */
-    input_buffer_size = ( (size_t) input_arg->len + (size_t) iv->len );
-    if ( input_buffer_size > 0 )
-    {
-        ASSERT_ALLOC( input, input_buffer_size );
-        memcpy( input, iv->x, iv->len );
-        memcpy( input + iv->len, input_arg->x, input_arg->len );
+    input_buffer_size = ((size_t) input_arg->len + (size_t) iv->len);
+    if (input_buffer_size > 0) {
+        ASSERT_ALLOC(input, input_buffer_size);
+        memcpy(input, iv->x, iv->len);
+        memcpy(input + iv->len, input_arg->x, input_arg->len);
     }
 
-    output_buffer_size = PSA_CIPHER_DECRYPT_OUTPUT_SIZE( key_type, alg, input_buffer_size );
-    ASSERT_ALLOC( output, output_buffer_size );
+    output_buffer_size = PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, input_buffer_size);
+    ASSERT_ALLOC(output, output_buffer_size);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    if( mock_output_arg )
-    {
+    if (mock_output_arg) {
         mbedtls_test_driver_cipher_hooks.forced_output = expected_output->x;
         mbedtls_test_driver_cipher_hooks.forced_output_length = expected_output->len;
     }
 
-    status = psa_cipher_decrypt( key, alg, input, input_buffer_size, output,
-                                 output_buffer_size, &output_length );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
+    status = psa_cipher_decrypt(key, alg, input, input_buffer_size, output,
+                                output_buffer_size, &output_length);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
-    TEST_EQUAL( status, expected_status );
+    TEST_EQUAL(status, expected_status);
 
-    if( expected_status == PSA_SUCCESS )
-    {
-        ASSERT_COMPARE( expected_output->x, expected_output->len,
-                        output, output_length );
+    if (expected_status == PSA_SUCCESS) {
+        ASSERT_COMPARE(expected_output->x, expected_output->len,
+                       output, output_length);
     }
 
 exit:
-    mbedtls_free( input );
-    mbedtls_free( output );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    mbedtls_free(input);
+    mbedtls_free(output);
+    psa_destroy_key(key);
+    PSA_DONE();
     mbedtls_test_driver_cipher_hooks = mbedtls_test_driver_cipher_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_entry_points( int alg_arg, int key_type_arg,
-                          data_t *key_data, data_t *iv,
-                          data_t *input )
+void cipher_entry_points(int alg_arg, int key_type_arg,
+                         data_t *key_data, data_t *iv,
+                         data_t *input)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_status_t status;
@@ -907,17 +885,17 @@
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     mbedtls_test_driver_cipher_hooks = mbedtls_test_driver_cipher_hooks_init();
 
-    ASSERT_ALLOC( output, input->len + 16 );
+    ASSERT_ALLOC(output, input->len + 16);
     output_buffer_size = input->len + 16;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
     /*
      * Test encrypt failure
@@ -926,195 +904,195 @@
      */
     status = psa_cipher_encrypt(
         key, alg, input->x, input->len,
-        output, output_buffer_size, &function_output_length );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
-    TEST_EQUAL( status, PSA_SUCCESS );
+        output, output_buffer_size, &function_output_length);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
+    TEST_EQUAL(status, PSA_SUCCESS);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
     mbedtls_test_driver_cipher_hooks.forced_status = PSA_ERROR_GENERIC_ERROR;
     /* Set the output buffer in a given state. */
-    for( size_t i = 0; i < output_buffer_size; i++ )
+    for (size_t i = 0; i < output_buffer_size; i++) {
         output[i] = 0xa5;
+    }
 
     status = psa_cipher_encrypt(
         key, alg, input->x, input->len,
-        output, output_buffer_size, &function_output_length );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
-    TEST_EQUAL( status, PSA_ERROR_GENERIC_ERROR );
+        output, output_buffer_size, &function_output_length);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
+    TEST_EQUAL(status, PSA_ERROR_GENERIC_ERROR);
     /*
      * Check that the output buffer is still in the same state.
      * This will fail if the output buffer is used by the core to pass the IV
      * it generated to the driver (and is not restored).
      */
-    for( size_t i = 0; i < output_buffer_size; i++ )
-    {
-        TEST_EQUAL( output[i], 0xa5 );
+    for (size_t i = 0; i < output_buffer_size; i++) {
+        TEST_EQUAL(output[i], 0xa5);
     }
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
     /* Test setup call, encrypt */
     mbedtls_test_driver_cipher_hooks.forced_status = PSA_ERROR_GENERIC_ERROR;
-    status = psa_cipher_encrypt_setup( &operation, key, alg );
+    status = psa_cipher_encrypt_setup(&operation, key, alg);
     /* When setup fails, it shouldn't call any further entry points */
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
-    TEST_EQUAL( status, mbedtls_test_driver_cipher_hooks.forced_status );
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
+    TEST_EQUAL(status, mbedtls_test_driver_cipher_hooks.forced_status);
     mbedtls_test_driver_cipher_hooks.hits = 0;
-    status = psa_cipher_set_iv( &operation, iv->x, iv->len );
-    TEST_EQUAL( status, PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 0 );
+    status = psa_cipher_set_iv(&operation, iv->x, iv->len);
+    TEST_EQUAL(status, PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 0);
 
     /* Test setup call failure, decrypt */
-    status = psa_cipher_decrypt_setup( &operation, key, alg );
+    status = psa_cipher_decrypt_setup(&operation, key, alg);
     /* When setup fails, it shouldn't call any further entry points */
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
-    TEST_EQUAL( status, mbedtls_test_driver_cipher_hooks.forced_status );
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
+    TEST_EQUAL(status, mbedtls_test_driver_cipher_hooks.forced_status);
     mbedtls_test_driver_cipher_hooks.hits = 0;
-    status = psa_cipher_set_iv( &operation, iv->x, iv->len );
-    TEST_EQUAL( status, PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 0 );
+    status = psa_cipher_set_iv(&operation, iv->x, iv->len);
+    TEST_EQUAL(status, PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 0);
 
     /* Test IV setting failure */
     mbedtls_test_driver_cipher_hooks.forced_status = PSA_SUCCESS;
-    status = psa_cipher_encrypt_setup( &operation, key, alg );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
-    TEST_EQUAL( status, mbedtls_test_driver_cipher_hooks.forced_status );
+    status = psa_cipher_encrypt_setup(&operation, key, alg);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
+    TEST_EQUAL(status, mbedtls_test_driver_cipher_hooks.forced_status);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
     mbedtls_test_driver_cipher_hooks.forced_status = PSA_ERROR_GENERIC_ERROR;
-    status = psa_cipher_set_iv( &operation, iv->x, iv->len );
+    status = psa_cipher_set_iv(&operation, iv->x, iv->len);
     /* When setting the IV fails, it should call abort too */
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 2 );
-    TEST_EQUAL( status, mbedtls_test_driver_cipher_hooks.forced_status );
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 2);
+    TEST_EQUAL(status, mbedtls_test_driver_cipher_hooks.forced_status);
     /* Failure should prevent further operations from executing on the driver */
     mbedtls_test_driver_cipher_hooks.hits = 0;
-    status = psa_cipher_update( &operation,
-                                input->x, input->len,
-                                output, output_buffer_size,
-                                &function_output_length );
-    TEST_EQUAL( status, PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 0 );
-    psa_cipher_abort( &operation );
+    status = psa_cipher_update(&operation,
+                               input->x, input->len,
+                               output, output_buffer_size,
+                               &function_output_length);
+    TEST_EQUAL(status, PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 0);
+    psa_cipher_abort(&operation);
 
     /* Test IV generation failure */
     mbedtls_test_driver_cipher_hooks.forced_status = PSA_SUCCESS;
-    status = psa_cipher_encrypt_setup( &operation, key, alg );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
-    TEST_EQUAL( status, mbedtls_test_driver_cipher_hooks.forced_status );
+    status = psa_cipher_encrypt_setup(&operation, key, alg);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
+    TEST_EQUAL(status, mbedtls_test_driver_cipher_hooks.forced_status);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
     mbedtls_test_driver_cipher_hooks.forced_status = PSA_ERROR_GENERIC_ERROR;
     /* Set the output buffer in a given state. */
-    for( size_t i = 0; i < 16; i++ )
+    for (size_t i = 0; i < 16; i++) {
         output[i] = 0xa5;
+    }
 
-    status = psa_cipher_generate_iv( &operation, output, 16, &function_output_length );
+    status = psa_cipher_generate_iv(&operation, output, 16, &function_output_length);
     /* When generating the IV fails, it should call abort too */
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 2 );
-    TEST_EQUAL( status, mbedtls_test_driver_cipher_hooks.forced_status );
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 2);
+    TEST_EQUAL(status, mbedtls_test_driver_cipher_hooks.forced_status);
     /*
      * Check that the output buffer is still in the same state.
      * This will fail if the output buffer is used by the core to pass the IV
      * it generated to the driver (and is not restored).
      */
-    for( size_t i = 0; i < 16; i++ )
-    {
-        TEST_EQUAL( output[i], 0xa5 );
+    for (size_t i = 0; i < 16; i++) {
+        TEST_EQUAL(output[i], 0xa5);
     }
     /* Failure should prevent further operations from executing on the driver */
     mbedtls_test_driver_cipher_hooks.hits = 0;
-    status = psa_cipher_update( &operation,
-                                input->x, input->len,
-                                output, output_buffer_size,
-                                &function_output_length );
-    TEST_EQUAL( status, PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 0 );
-    psa_cipher_abort( &operation );
+    status = psa_cipher_update(&operation,
+                               input->x, input->len,
+                               output, output_buffer_size,
+                               &function_output_length);
+    TEST_EQUAL(status, PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 0);
+    psa_cipher_abort(&operation);
 
     /* Test update failure */
     mbedtls_test_driver_cipher_hooks.forced_status = PSA_SUCCESS;
-    status = psa_cipher_encrypt_setup( &operation, key, alg );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
-    TEST_EQUAL( status, mbedtls_test_driver_cipher_hooks.forced_status );
+    status = psa_cipher_encrypt_setup(&operation, key, alg);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
+    TEST_EQUAL(status, mbedtls_test_driver_cipher_hooks.forced_status);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
-    status = psa_cipher_set_iv( &operation, iv->x, iv->len );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
-    TEST_EQUAL( status, mbedtls_test_driver_cipher_hooks.forced_status );
+    status = psa_cipher_set_iv(&operation, iv->x, iv->len);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
+    TEST_EQUAL(status, mbedtls_test_driver_cipher_hooks.forced_status);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
     mbedtls_test_driver_cipher_hooks.forced_status = PSA_ERROR_GENERIC_ERROR;
-    status = psa_cipher_update( &operation,
-                                input->x, input->len,
-                                output, output_buffer_size,
-                                &function_output_length );
+    status = psa_cipher_update(&operation,
+                               input->x, input->len,
+                               output, output_buffer_size,
+                               &function_output_length);
     /* When the update call fails, it should call abort too */
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 2 );
-    TEST_EQUAL( status, mbedtls_test_driver_cipher_hooks.forced_status );
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 2);
+    TEST_EQUAL(status, mbedtls_test_driver_cipher_hooks.forced_status);
     /* Failure should prevent further operations from executing on the driver */
     mbedtls_test_driver_cipher_hooks.hits = 0;
-    status = psa_cipher_update( &operation,
-                                input->x, input->len,
-                                output, output_buffer_size,
-                                &function_output_length );
-    TEST_EQUAL( status, PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 0 );
-    psa_cipher_abort( &operation );
+    status = psa_cipher_update(&operation,
+                               input->x, input->len,
+                               output, output_buffer_size,
+                               &function_output_length);
+    TEST_EQUAL(status, PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 0);
+    psa_cipher_abort(&operation);
 
     /* Test finish failure */
     mbedtls_test_driver_cipher_hooks.forced_status = PSA_SUCCESS;
-    status = psa_cipher_encrypt_setup( &operation, key, alg );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
-    TEST_EQUAL( status, mbedtls_test_driver_cipher_hooks.forced_status );
+    status = psa_cipher_encrypt_setup(&operation, key, alg);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
+    TEST_EQUAL(status, mbedtls_test_driver_cipher_hooks.forced_status);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
-    status = psa_cipher_set_iv( &operation, iv->x, iv->len );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
-    TEST_EQUAL( status, mbedtls_test_driver_cipher_hooks.forced_status );
+    status = psa_cipher_set_iv(&operation, iv->x, iv->len);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
+    TEST_EQUAL(status, mbedtls_test_driver_cipher_hooks.forced_status);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
-    status = psa_cipher_update( &operation,
-                                input->x, input->len,
-                                output, output_buffer_size,
-                                &function_output_length );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
-    TEST_EQUAL( status, mbedtls_test_driver_cipher_hooks.forced_status );
+    status = psa_cipher_update(&operation,
+                               input->x, input->len,
+                               output, output_buffer_size,
+                               &function_output_length);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 1);
+    TEST_EQUAL(status, mbedtls_test_driver_cipher_hooks.forced_status);
     mbedtls_test_driver_cipher_hooks.hits = 0;
 
     mbedtls_test_driver_cipher_hooks.forced_status = PSA_ERROR_GENERIC_ERROR;
-    status = psa_cipher_finish( &operation,
-                                output + function_output_length,
-                                output_buffer_size - function_output_length,
-                                &function_output_length );
+    status = psa_cipher_finish(&operation,
+                               output + function_output_length,
+                               output_buffer_size - function_output_length,
+                               &function_output_length);
     /* When the finish call fails, it should call abort too */
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 2 );
-    TEST_EQUAL( status, mbedtls_test_driver_cipher_hooks.forced_status );
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 2);
+    TEST_EQUAL(status, mbedtls_test_driver_cipher_hooks.forced_status);
     /* Failure should prevent further operations from executing on the driver */
     mbedtls_test_driver_cipher_hooks.hits = 0;
-    status = psa_cipher_update( &operation,
-                                input->x, input->len,
-                                output, output_buffer_size,
-                                &function_output_length );
-    TEST_EQUAL( status, PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 0 );
-    psa_cipher_abort( &operation );
+    status = psa_cipher_update(&operation,
+                               input->x, input->len,
+                               output, output_buffer_size,
+                               &function_output_length);
+    TEST_EQUAL(status, PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(mbedtls_test_driver_cipher_hooks.hits, 0);
+    psa_cipher_abort(&operation);
 
 exit:
-    psa_cipher_abort( &operation );
-    mbedtls_free( output );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_cipher_abort(&operation);
+    mbedtls_free(output);
+    psa_destroy_key(key);
+    PSA_DONE();
     mbedtls_test_driver_cipher_hooks = mbedtls_test_driver_cipher_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void aead_encrypt( int key_type_arg, data_t *key_data,
-                   int alg_arg,
-                   data_t *nonce,
-                   data_t *additional_data,
-                   data_t *input_data,
-                   data_t *expected_result,
-                   int forced_status_arg )
+void aead_encrypt(int key_type_arg, data_t *key_data,
+                  int alg_arg,
+                  data_t *nonce,
+                  data_t *additional_data,
+                  data_t *input_data,
+                  data_t *expected_result,
+                  int forced_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -1128,62 +1106,61 @@
     psa_status_t status = PSA_ERROR_GENERIC_ERROR;
     mbedtls_test_driver_aead_hooks = mbedtls_test_driver_aead_hooks_init();
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT  );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_ENCRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
 
-    output_size = input_data->len + PSA_AEAD_TAG_LENGTH( key_type, key_bits,
-                                                         alg );
+    output_size = input_data->len + PSA_AEAD_TAG_LENGTH(key_type, key_bits,
+                                                        alg);
     /* For all currently defined algorithms, PSA_AEAD_ENCRYPT_OUTPUT_SIZE
      * should be exact. */
-    TEST_EQUAL( output_size,
-                PSA_AEAD_ENCRYPT_OUTPUT_SIZE( key_type, alg, input_data->len ) );
-    TEST_ASSERT( output_size <=
-                 PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE( input_data->len ) );
-    ASSERT_ALLOC( output_data, output_size );
+    TEST_EQUAL(output_size,
+               PSA_AEAD_ENCRYPT_OUTPUT_SIZE(key_type, alg, input_data->len));
+    TEST_ASSERT(output_size <=
+                PSA_AEAD_ENCRYPT_OUTPUT_MAX_SIZE(input_data->len));
+    ASSERT_ALLOC(output_data, output_size);
 
     mbedtls_test_driver_aead_hooks.forced_status = forced_status;
-    status = psa_aead_encrypt( key, alg,
-                               nonce->x, nonce->len,
-                               additional_data->x, additional_data->len,
-                               input_data->x, input_data->len,
-                               output_data, output_size,
-                               &output_length );
-    TEST_EQUAL( mbedtls_test_driver_aead_hooks.hits, 1 );
-    TEST_EQUAL( mbedtls_test_driver_aead_hooks.driver_status, forced_status );
+    status = psa_aead_encrypt(key, alg,
+                              nonce->x, nonce->len,
+                              additional_data->x, additional_data->len,
+                              input_data->x, input_data->len,
+                              output_data, output_size,
+                              &output_length);
+    TEST_EQUAL(mbedtls_test_driver_aead_hooks.hits, 1);
+    TEST_EQUAL(mbedtls_test_driver_aead_hooks.driver_status, forced_status);
 
-    TEST_EQUAL( status, ( forced_status == PSA_ERROR_NOT_SUPPORTED ) ?
-                        PSA_SUCCESS : forced_status );
+    TEST_EQUAL(status, (forced_status == PSA_ERROR_NOT_SUPPORTED) ?
+               PSA_SUCCESS : forced_status);
 
-    if( status == PSA_SUCCESS )
-    {
-        ASSERT_COMPARE( expected_result->x, expected_result->len,
-                        output_data, output_length );
+    if (status == PSA_SUCCESS) {
+        ASSERT_COMPARE(expected_result->x, expected_result->len,
+                       output_data, output_length);
     }
 
 exit:
-    psa_destroy_key( key );
-    mbedtls_free( output_data );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    mbedtls_free(output_data);
+    PSA_DONE();
     mbedtls_test_driver_aead_hooks = mbedtls_test_driver_aead_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void aead_decrypt( int key_type_arg, data_t *key_data,
-                   int alg_arg,
-                   data_t *nonce,
-                   data_t *additional_data,
-                   data_t *input_data,
-                   data_t *expected_data,
-                   int forced_status_arg )
+void aead_decrypt(int key_type_arg, data_t *key_data,
+                  int alg_arg,
+                  data_t *nonce,
+                  data_t *additional_data,
+                  data_t *input_data,
+                  data_t *expected_data,
+                  int forced_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -1197,56 +1174,55 @@
     psa_status_t status = PSA_ERROR_GENERIC_ERROR;
     mbedtls_test_driver_aead_hooks = mbedtls_test_driver_aead_hooks_init();
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DECRYPT  );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    key_bits = psa_get_key_bits( &attributes );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    key_bits = psa_get_key_bits(&attributes);
 
-    output_size = input_data->len - PSA_AEAD_TAG_LENGTH( key_type, key_bits,
-                                                         alg );
-    ASSERT_ALLOC( output_data, output_size );
+    output_size = input_data->len - PSA_AEAD_TAG_LENGTH(key_type, key_bits,
+                                                        alg);
+    ASSERT_ALLOC(output_data, output_size);
 
     mbedtls_test_driver_aead_hooks.forced_status = forced_status;
-    status = psa_aead_decrypt( key, alg,
-                               nonce->x, nonce->len,
-                               additional_data->x,
-                               additional_data->len,
-                               input_data->x, input_data->len,
-                               output_data, output_size,
-                               &output_length );
-    TEST_EQUAL( mbedtls_test_driver_aead_hooks.hits, 1 );
-    TEST_EQUAL( mbedtls_test_driver_aead_hooks.driver_status, forced_status );
+    status = psa_aead_decrypt(key, alg,
+                              nonce->x, nonce->len,
+                              additional_data->x,
+                              additional_data->len,
+                              input_data->x, input_data->len,
+                              output_data, output_size,
+                              &output_length);
+    TEST_EQUAL(mbedtls_test_driver_aead_hooks.hits, 1);
+    TEST_EQUAL(mbedtls_test_driver_aead_hooks.driver_status, forced_status);
 
-    TEST_EQUAL( status, ( forced_status == PSA_ERROR_NOT_SUPPORTED ) ?
-                        PSA_SUCCESS : forced_status );
+    TEST_EQUAL(status, (forced_status == PSA_ERROR_NOT_SUPPORTED) ?
+               PSA_SUCCESS : forced_status);
 
-    if( status == PSA_SUCCESS )
-    {
-        ASSERT_COMPARE( expected_data->x, expected_data->len,
-                        output_data, output_length );
+    if (status == PSA_SUCCESS) {
+        ASSERT_COMPARE(expected_data->x, expected_data->len,
+                       output_data, output_length);
     }
 
 exit:
-    psa_destroy_key( key );
-    mbedtls_free( output_data );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    mbedtls_free(output_data);
+    PSA_DONE();
     mbedtls_test_driver_aead_hooks = mbedtls_test_driver_aead_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mac_sign( int key_type_arg,
-               data_t *key_data,
-               int alg_arg,
-               data_t *input,
-               data_t *expected_mac,
-               int forced_status_arg )
+void mac_sign(int key_type_arg,
+              data_t *key_data,
+              int alg_arg,
+              data_t *input,
+              data_t *expected_mac,
+              int forced_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -1255,125 +1231,124 @@
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     uint8_t *actual_mac = NULL;
     size_t mac_buffer_size =
-        PSA_MAC_LENGTH( key_type, PSA_BYTES_TO_BITS( key_data->len ), alg );
+        PSA_MAC_LENGTH(key_type, PSA_BYTES_TO_BITS(key_data->len), alg);
     size_t mac_length = 0;
     psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
     psa_status_t forced_status = forced_status_arg;
     mbedtls_test_driver_mac_hooks = mbedtls_test_driver_mac_hooks_init();
 
-    TEST_ASSERT( mac_buffer_size <= PSA_MAC_MAX_SIZE );
+    TEST_ASSERT(mac_buffer_size <= PSA_MAC_MAX_SIZE);
     /* We expect PSA_MAC_LENGTH to be exact. */
-    TEST_ASSERT( expected_mac->len == mac_buffer_size );
+    TEST_ASSERT(expected_mac->len == mac_buffer_size);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
-    ASSERT_ALLOC( actual_mac, mac_buffer_size );
+    ASSERT_ALLOC(actual_mac, mac_buffer_size);
     mbedtls_test_driver_mac_hooks.forced_status = forced_status;
 
     /*
      * Calculate the MAC, one-shot case.
      */
-    status = psa_mac_compute( key, alg,
-                              input->x, input->len,
-                              actual_mac, mac_buffer_size,
-                              &mac_length );
+    status = psa_mac_compute(key, alg,
+                             input->x, input->len,
+                             actual_mac, mac_buffer_size,
+                             &mac_length);
 
-    TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 1 );
-    if( forced_status == PSA_SUCCESS ||
-        forced_status == PSA_ERROR_NOT_SUPPORTED )
-    {
-        PSA_ASSERT( status );
+    TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 1);
+    if (forced_status == PSA_SUCCESS ||
+        forced_status == PSA_ERROR_NOT_SUPPORTED) {
+        PSA_ASSERT(status);
+    } else {
+        TEST_EQUAL(forced_status, status);
     }
-    else
-        TEST_EQUAL( forced_status, status );
 
-    if( mac_buffer_size > 0 )
-        memset( actual_mac, 0, mac_buffer_size );
+    if (mac_buffer_size > 0) {
+        memset(actual_mac, 0, mac_buffer_size);
+    }
     mbedtls_test_driver_mac_hooks = mbedtls_test_driver_mac_hooks_init();
     mbedtls_test_driver_mac_hooks.forced_status = forced_status;
 
     /*
      * Calculate the MAC, multipart case.
      */
-    status = psa_mac_sign_setup( &operation, key, alg );
-    TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 1 );
+    status = psa_mac_sign_setup(&operation, key, alg);
+    TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 1);
 
-    if( forced_status == PSA_SUCCESS ||
-        forced_status == PSA_ERROR_NOT_SUPPORTED )
-    {
-        PSA_ASSERT( status );
-    }
-    else
-        TEST_EQUAL( forced_status, status );
-
-    status = psa_mac_update( &operation,
-                             input->x, input->len );
-    if( forced_status == PSA_SUCCESS )
-        TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 2 );
-    else
-        TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 1 );
-    if( forced_status == PSA_SUCCESS ||
-        forced_status == PSA_ERROR_NOT_SUPPORTED )
-    {
-        PSA_ASSERT( status );
-    }
-    else
-        TEST_EQUAL( PSA_ERROR_BAD_STATE, status );
-
-    status = psa_mac_sign_finish( &operation,
-                                  actual_mac, mac_buffer_size,
-                                  &mac_length );
-    if( forced_status == PSA_SUCCESS )
-        TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 4 );
-    else
-        TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 1 );
-
-    if( forced_status == PSA_SUCCESS ||
-        forced_status == PSA_ERROR_NOT_SUPPORTED )
-    {
-        PSA_ASSERT( status );
-    }
-    else
-        TEST_EQUAL( PSA_ERROR_BAD_STATE, status );
-
-    PSA_ASSERT( psa_mac_abort( &operation ) );
-    if( forced_status == PSA_SUCCESS )
-        TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 4 );
-    else
-        TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 1 );
-
-    if( forced_status == PSA_SUCCESS )
-    {
-        ASSERT_COMPARE( expected_mac->x, expected_mac->len,
-                        actual_mac, mac_length );
+    if (forced_status == PSA_SUCCESS ||
+        forced_status == PSA_ERROR_NOT_SUPPORTED) {
+        PSA_ASSERT(status);
+    } else {
+        TEST_EQUAL(forced_status, status);
     }
 
-    mbedtls_free( actual_mac );
+    status = psa_mac_update(&operation,
+                            input->x, input->len);
+    if (forced_status == PSA_SUCCESS) {
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 2);
+    } else {
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 1);
+    }
+    if (forced_status == PSA_SUCCESS ||
+        forced_status == PSA_ERROR_NOT_SUPPORTED) {
+        PSA_ASSERT(status);
+    } else {
+        TEST_EQUAL(PSA_ERROR_BAD_STATE, status);
+    }
+
+    status = psa_mac_sign_finish(&operation,
+                                 actual_mac, mac_buffer_size,
+                                 &mac_length);
+    if (forced_status == PSA_SUCCESS) {
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 4);
+    } else {
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 1);
+    }
+
+    if (forced_status == PSA_SUCCESS ||
+        forced_status == PSA_ERROR_NOT_SUPPORTED) {
+        PSA_ASSERT(status);
+    } else {
+        TEST_EQUAL(PSA_ERROR_BAD_STATE, status);
+    }
+
+    PSA_ASSERT(psa_mac_abort(&operation));
+    if (forced_status == PSA_SUCCESS) {
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 4);
+    } else {
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 1);
+    }
+
+    if (forced_status == PSA_SUCCESS) {
+        ASSERT_COMPARE(expected_mac->x, expected_mac->len,
+                       actual_mac, mac_length);
+    }
+
+    mbedtls_free(actual_mac);
     actual_mac = NULL;
 
 exit:
-    psa_mac_abort( &operation );
-    psa_destroy_key( key );
-    PSA_DONE( );
-    mbedtls_free( actual_mac );
+    psa_mac_abort(&operation);
+    psa_destroy_key(key);
+    PSA_DONE();
+    mbedtls_free(actual_mac);
     mbedtls_test_driver_mac_hooks = mbedtls_test_driver_mac_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mac_verify( int key_type_arg,
-                 data_t *key_data,
-                 int alg_arg,
-                 data_t *input,
-                 data_t *expected_mac,
-                 int forced_status_arg )
+void mac_verify(int key_type_arg,
+                data_t *key_data,
+                int alg_arg,
+                data_t *input,
+                data_t *expected_mac,
+                int forced_status_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -1384,33 +1359,32 @@
     psa_status_t forced_status = forced_status_arg;
     mbedtls_test_driver_mac_hooks = mbedtls_test_driver_mac_hooks_init();
 
-    TEST_ASSERT( expected_mac->len <= PSA_MAC_MAX_SIZE );
+    TEST_ASSERT(expected_mac->len <= PSA_MAC_MAX_SIZE);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_VERIFY_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, key_type );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_VERIFY_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, key_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
 
     mbedtls_test_driver_mac_hooks.forced_status = forced_status;
 
     /*
      * Verify the MAC, one-shot case.
      */
-    status = psa_mac_verify( key, alg,
-                             input->x, input->len,
-                             expected_mac->x, expected_mac->len );
-    TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 1 );
-    if( forced_status == PSA_SUCCESS ||
-        forced_status == PSA_ERROR_NOT_SUPPORTED )
-    {
-        PSA_ASSERT( status );
+    status = psa_mac_verify(key, alg,
+                            input->x, input->len,
+                            expected_mac->x, expected_mac->len);
+    TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 1);
+    if (forced_status == PSA_SUCCESS ||
+        forced_status == PSA_ERROR_NOT_SUPPORTED) {
+        PSA_ASSERT(status);
+    } else {
+        TEST_EQUAL(forced_status, status);
     }
-    else
-        TEST_EQUAL( forced_status, status );
 
     mbedtls_test_driver_mac_hooks = mbedtls_test_driver_mac_hooks_init();
     mbedtls_test_driver_mac_hooks.forced_status = forced_status;
@@ -1418,70 +1392,70 @@
     /*
      * Verify the MAC, multi-part case.
      */
-    status = psa_mac_verify_setup( &operation, key, alg );
-    TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 1 );
+    status = psa_mac_verify_setup(&operation, key, alg);
+    TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 1);
 
-    if( forced_status == PSA_SUCCESS ||
-        forced_status == PSA_ERROR_NOT_SUPPORTED )
-    {
-        PSA_ASSERT( status );
+    if (forced_status == PSA_SUCCESS ||
+        forced_status == PSA_ERROR_NOT_SUPPORTED) {
+        PSA_ASSERT(status);
+    } else {
+        TEST_EQUAL(forced_status, status);
     }
-    else
-        TEST_EQUAL( forced_status, status );
 
-    status = psa_mac_update( &operation,
-                             input->x, input->len );
-    if( forced_status == PSA_SUCCESS )
-        TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 2 );
-    else
-        TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 1 );
-
-    if( forced_status == PSA_SUCCESS ||
-        forced_status == PSA_ERROR_NOT_SUPPORTED )
-    {
-        PSA_ASSERT( status );
+    status = psa_mac_update(&operation,
+                            input->x, input->len);
+    if (forced_status == PSA_SUCCESS) {
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 2);
+    } else {
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 1);
     }
-    else
-        TEST_EQUAL( PSA_ERROR_BAD_STATE, status );
 
-    status = psa_mac_verify_finish( &operation,
-                                    expected_mac->x,
-                                    expected_mac->len );
-    if( forced_status == PSA_SUCCESS )
-        TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 4 );
-    else
-        TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 1 );
-
-    if( forced_status == PSA_SUCCESS ||
-        forced_status == PSA_ERROR_NOT_SUPPORTED )
-    {
-        PSA_ASSERT( status );
+    if (forced_status == PSA_SUCCESS ||
+        forced_status == PSA_ERROR_NOT_SUPPORTED) {
+        PSA_ASSERT(status);
+    } else {
+        TEST_EQUAL(PSA_ERROR_BAD_STATE, status);
     }
-    else
-        TEST_EQUAL( PSA_ERROR_BAD_STATE, status );
+
+    status = psa_mac_verify_finish(&operation,
+                                   expected_mac->x,
+                                   expected_mac->len);
+    if (forced_status == PSA_SUCCESS) {
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 4);
+    } else {
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 1);
+    }
+
+    if (forced_status == PSA_SUCCESS ||
+        forced_status == PSA_ERROR_NOT_SUPPORTED) {
+        PSA_ASSERT(status);
+    } else {
+        TEST_EQUAL(PSA_ERROR_BAD_STATE, status);
+    }
 
 
-    PSA_ASSERT( psa_mac_abort( &operation ) );
-    if( forced_status == PSA_SUCCESS )
-        TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 4 );
-    else
-        TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 1 );
+    PSA_ASSERT(psa_mac_abort(&operation));
+    if (forced_status == PSA_SUCCESS) {
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 4);
+    } else {
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 1);
+    }
 
 exit:
-    psa_mac_abort( &operation );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_mac_abort(&operation);
+    psa_destroy_key(key);
+    PSA_DONE();
     mbedtls_test_driver_mac_hooks = mbedtls_test_driver_mac_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:PSA_CRYPTO_DRIVER_TEST:MBEDTLS_PSA_CRYPTO_DRIVERS:MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS */
-void builtin_key_export( int builtin_key_id_arg,
-                         int builtin_key_type_arg,
-                         int builtin_key_bits_arg,
-                         int builtin_key_algorithm_arg,
-                         data_t *expected_output,
-                         int expected_status_arg )
+void builtin_key_export(int builtin_key_id_arg,
+                        int builtin_key_type_arg,
+                        int builtin_key_bits_arg,
+                        int builtin_key_algorithm_arg,
+                        data_t *expected_output,
+                        int expected_status_arg)
 {
     psa_key_id_t builtin_key_id = (psa_key_id_t) builtin_key_id_arg;
     psa_key_type_t builtin_key_type = (psa_key_type_t) builtin_key_type_arg;
@@ -1490,51 +1464,49 @@
     psa_status_t expected_status = expected_status_arg;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    mbedtls_svc_key_id_t key = mbedtls_svc_key_id_make( 0, builtin_key_id );
-    uint8_t* output_buffer = NULL;
+    mbedtls_svc_key_id_t key = mbedtls_svc_key_id_make(0, builtin_key_id);
+    uint8_t *output_buffer = NULL;
     size_t output_size = 0;
     psa_status_t actual_status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    ASSERT_ALLOC( output_buffer, expected_output->len );
+    PSA_ASSERT(psa_crypto_init());
+    ASSERT_ALLOC(output_buffer, expected_output->len);
 
-    actual_status = psa_export_key( key, output_buffer, expected_output->len, &output_size );
+    actual_status = psa_export_key(key, output_buffer, expected_output->len, &output_size);
 
-    if( expected_status == PSA_SUCCESS )
-    {
-        PSA_ASSERT( actual_status );
-        TEST_EQUAL( output_size, expected_output->len );
-        ASSERT_COMPARE( output_buffer, output_size,
-                        expected_output->x, expected_output->len );
+    if (expected_status == PSA_SUCCESS) {
+        PSA_ASSERT(actual_status);
+        TEST_EQUAL(output_size, expected_output->len);
+        ASSERT_COMPARE(output_buffer, output_size,
+                       expected_output->x, expected_output->len);
 
-        PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-        TEST_EQUAL( psa_get_key_bits( &attributes ), builtin_key_bits );
-        TEST_EQUAL( psa_get_key_type( &attributes ), builtin_key_type );
-        TEST_EQUAL( psa_get_key_algorithm( &attributes ), builtin_key_alg );
-    }
-    else
-    {
-        if( actual_status != expected_status )
-            fprintf( stderr, "Expected %d but got %d\n", expected_status, actual_status );
-        TEST_EQUAL( actual_status, expected_status );
-        TEST_EQUAL( output_size, 0 );
+        PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+        TEST_EQUAL(psa_get_key_bits(&attributes), builtin_key_bits);
+        TEST_EQUAL(psa_get_key_type(&attributes), builtin_key_type);
+        TEST_EQUAL(psa_get_key_algorithm(&attributes), builtin_key_alg);
+    } else {
+        if (actual_status != expected_status) {
+            fprintf(stderr, "Expected %d but got %d\n", expected_status, actual_status);
+        }
+        TEST_EQUAL(actual_status, expected_status);
+        TEST_EQUAL(output_size, 0);
     }
 
 exit:
-    mbedtls_free( output_buffer );
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    mbedtls_free(output_buffer);
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:PSA_CRYPTO_DRIVER_TEST:MBEDTLS_PSA_CRYPTO_DRIVERS:MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS */
-void builtin_pubkey_export( int builtin_key_id_arg,
-                            int builtin_key_type_arg,
-                            int builtin_key_bits_arg,
-                            int builtin_key_algorithm_arg,
-                            data_t *expected_output,
-                            int expected_status_arg )
+void builtin_pubkey_export(int builtin_key_id_arg,
+                           int builtin_key_type_arg,
+                           int builtin_key_bits_arg,
+                           int builtin_key_algorithm_arg,
+                           data_t *expected_output,
+                           int expected_status_arg)
 {
     psa_key_id_t builtin_key_id = (psa_key_id_t) builtin_key_id_arg;
     psa_key_type_t builtin_key_type = (psa_key_type_t) builtin_key_type_arg;
@@ -1543,47 +1515,44 @@
     psa_status_t expected_status = expected_status_arg;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    mbedtls_svc_key_id_t key = mbedtls_svc_key_id_make( 0, builtin_key_id );
-    uint8_t* output_buffer = NULL;
+    mbedtls_svc_key_id_t key = mbedtls_svc_key_id_make(0, builtin_key_id);
+    uint8_t *output_buffer = NULL;
     size_t output_size = 0;
     psa_status_t actual_status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    ASSERT_ALLOC( output_buffer, expected_output->len );
+    PSA_ASSERT(psa_crypto_init());
+    ASSERT_ALLOC(output_buffer, expected_output->len);
 
-    actual_status = psa_export_public_key( key, output_buffer, expected_output->len, &output_size );
+    actual_status = psa_export_public_key(key, output_buffer, expected_output->len, &output_size);
 
-    if( expected_status == PSA_SUCCESS )
-    {
-        PSA_ASSERT( actual_status );
-        TEST_EQUAL( output_size, expected_output->len );
-        ASSERT_COMPARE( output_buffer, output_size,
-                        expected_output->x, expected_output->len );
+    if (expected_status == PSA_SUCCESS) {
+        PSA_ASSERT(actual_status);
+        TEST_EQUAL(output_size, expected_output->len);
+        ASSERT_COMPARE(output_buffer, output_size,
+                       expected_output->x, expected_output->len);
 
-        PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-        TEST_EQUAL( psa_get_key_bits( &attributes ), builtin_key_bits );
-        TEST_EQUAL( psa_get_key_type( &attributes ), builtin_key_type );
-        TEST_EQUAL( psa_get_key_algorithm( &attributes ), builtin_key_alg );
-    }
-    else
-    {
-        TEST_EQUAL( actual_status, expected_status );
-        TEST_EQUAL( output_size, 0 );
+        PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+        TEST_EQUAL(psa_get_key_bits(&attributes), builtin_key_bits);
+        TEST_EQUAL(psa_get_key_type(&attributes), builtin_key_type);
+        TEST_EQUAL(psa_get_key_algorithm(&attributes), builtin_key_alg);
+    } else {
+        TEST_EQUAL(actual_status, expected_status);
+        TEST_EQUAL(output_size, 0);
     }
 
 exit:
-    mbedtls_free( output_buffer );
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key );
-    PSA_DONE( );
+    mbedtls_free(output_buffer);
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hash_compute( int alg_arg,
-                   data_t *input, data_t *hash,
-                   int forced_status_arg,
-                   int expected_status_arg )
+void hash_compute(int alg_arg,
+                  data_t *input, data_t *hash,
+                  int forced_status_arg,
+                  int expected_status_arg)
 {
     psa_algorithm_t alg = alg_arg;
     psa_status_t forced_status = forced_status_arg;
@@ -1594,79 +1563,77 @@
     mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
     mbedtls_test_driver_hash_hooks.forced_status = forced_status;
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    ASSERT_ALLOC( output, PSA_HASH_LENGTH( alg ) );
+    PSA_ASSERT(psa_crypto_init());
+    ASSERT_ALLOC(output, PSA_HASH_LENGTH(alg));
 
-    TEST_EQUAL( psa_hash_compute( alg, input->x, input->len,
-                                  output, PSA_HASH_LENGTH( alg ),
-                                  &output_length ), expected_status );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 1 );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, forced_status );
+    TEST_EQUAL(psa_hash_compute(alg, input->x, input->len,
+                                output, PSA_HASH_LENGTH(alg),
+                                &output_length), expected_status);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits, 1);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.driver_status, forced_status);
 
-    if( expected_status == PSA_SUCCESS )
-    {
-        ASSERT_COMPARE( output, output_length, hash->x, hash->len );
+    if (expected_status == PSA_SUCCESS) {
+        ASSERT_COMPARE(output, output_length, hash->x, hash->len);
     }
 
 exit:
-    mbedtls_free( output );
-    PSA_DONE( );
+    mbedtls_free(output);
+    PSA_DONE();
     mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hash_multipart_setup( int alg_arg,
+void hash_multipart_setup(int alg_arg,
+                          data_t *input, data_t *hash,
+                          int forced_status_arg,
+                          int expected_status_arg)
+{
+    psa_algorithm_t alg = alg_arg;
+    psa_status_t forced_status = forced_status_arg;
+    psa_status_t expected_status = expected_status_arg;
+    unsigned char *output = NULL;
+    psa_hash_operation_t operation = PSA_HASH_OPERATION_INIT;
+    size_t output_length;
+
+    mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
+    ASSERT_ALLOC(output, PSA_HASH_LENGTH(alg));
+
+    PSA_ASSERT(psa_crypto_init());
+
+    mbedtls_test_driver_hash_hooks.forced_status = forced_status;
+    TEST_EQUAL(psa_hash_setup(&operation, alg), expected_status);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits, 1);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.driver_status, forced_status);
+
+    if (expected_status == PSA_SUCCESS) {
+        PSA_ASSERT(psa_hash_update(&operation, input->x, input->len));
+        TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits,
+                   forced_status == PSA_ERROR_NOT_SUPPORTED ? 1 : 2);
+        TEST_EQUAL(mbedtls_test_driver_hash_hooks.driver_status, forced_status);
+
+        PSA_ASSERT(psa_hash_finish(&operation,
+                                   output, PSA_HASH_LENGTH(alg),
+                                   &output_length));
+        TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits,
+                   forced_status == PSA_ERROR_NOT_SUPPORTED ? 1 : 4);
+        TEST_EQUAL(mbedtls_test_driver_hash_hooks.driver_status, forced_status);
+
+        ASSERT_COMPARE(output, output_length, hash->x, hash->len);
+    }
+
+exit:
+    psa_hash_abort(&operation);
+    mbedtls_free(output);
+    PSA_DONE();
+    mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
+}
+/* END_CASE */
+
+/* BEGIN_CASE */
+void hash_multipart_update(int alg_arg,
                            data_t *input, data_t *hash,
-                           int forced_status_arg,
-                           int expected_status_arg )
-{
-    psa_algorithm_t alg = alg_arg;
-    psa_status_t forced_status = forced_status_arg;
-    psa_status_t expected_status = expected_status_arg;
-    unsigned char *output = NULL;
-    psa_hash_operation_t operation = PSA_HASH_OPERATION_INIT;
-    size_t output_length;
-
-    mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
-    ASSERT_ALLOC( output, PSA_HASH_LENGTH( alg ) );
-
-    PSA_ASSERT( psa_crypto_init( ) );
-
-    mbedtls_test_driver_hash_hooks.forced_status = forced_status;
-    TEST_EQUAL( psa_hash_setup( &operation, alg ), expected_status );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 1 );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, forced_status );
-
-    if( expected_status == PSA_SUCCESS )
-    {
-        PSA_ASSERT( psa_hash_update( &operation, input->x, input->len ) );
-        TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits,
-                    forced_status == PSA_ERROR_NOT_SUPPORTED ? 1 : 2 );
-        TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, forced_status );
-
-        PSA_ASSERT( psa_hash_finish( &operation,
-                                     output, PSA_HASH_LENGTH( alg ),
-                                     &output_length ) );
-        TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits,
-                    forced_status == PSA_ERROR_NOT_SUPPORTED ? 1 : 4 );
-        TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, forced_status );
-
-        ASSERT_COMPARE( output, output_length, hash->x, hash->len );
-    }
-
-exit:
-    psa_hash_abort( &operation );
-    mbedtls_free( output );
-    PSA_DONE( );
-    mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
-}
-/* END_CASE */
-
-/* BEGIN_CASE */
-void hash_multipart_update( int alg_arg,
-                            data_t *input, data_t *hash,
-                            int forced_status_arg )
+                           int forced_status_arg)
 {
     psa_algorithm_t alg = alg_arg;
     psa_status_t forced_status = forced_status_arg;
@@ -1675,54 +1642,53 @@
     size_t output_length;
 
     mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
-    ASSERT_ALLOC( output, PSA_HASH_LENGTH( alg ) );
+    ASSERT_ALLOC(output, PSA_HASH_LENGTH(alg));
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /*
      * Update inactive operation, the driver shouldn't be called.
      */
-    TEST_EQUAL( psa_hash_update( &operation, input->x, input->len ),
-                PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 0 );
+    TEST_EQUAL(psa_hash_update(&operation, input->x, input->len),
+               PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits, 0);
 
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 1 );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits, 1);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS);
 
     mbedtls_test_driver_hash_hooks.forced_status = forced_status;
-    TEST_EQUAL( psa_hash_update( &operation, input->x, input->len ),
-                forced_status );
+    TEST_EQUAL(psa_hash_update(&operation, input->x, input->len),
+               forced_status);
     /* One or two more calls to the driver interface: update or update + abort */
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits,
-                forced_status == PSA_SUCCESS ? 2 : 3 );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, forced_status );
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits,
+               forced_status == PSA_SUCCESS ? 2 : 3);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.driver_status, forced_status);
 
-    if( forced_status == PSA_SUCCESS )
-    {
+    if (forced_status == PSA_SUCCESS) {
         mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
-        PSA_ASSERT( psa_hash_finish( &operation,
-                                     output, PSA_HASH_LENGTH( alg ),
-                                     &output_length ) );
+        PSA_ASSERT(psa_hash_finish(&operation,
+                                   output, PSA_HASH_LENGTH(alg),
+                                   &output_length));
         /* Two calls to the driver interface: update + abort */
-        TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 2 );
-        TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS );
+        TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits, 2);
+        TEST_EQUAL(mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS);
 
-        ASSERT_COMPARE( output, output_length, hash->x, hash->len );
+        ASSERT_COMPARE(output, output_length, hash->x, hash->len);
     }
 
 exit:
-    psa_hash_abort( &operation );
-    mbedtls_free( output );
-    PSA_DONE( );
+    psa_hash_abort(&operation);
+    mbedtls_free(output);
+    PSA_DONE();
     mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hash_multipart_finish( int alg_arg,
-                            data_t *input, data_t *hash,
-                            int forced_status_arg )
+void hash_multipart_finish(int alg_arg,
+                           data_t *input, data_t *hash,
+                           int forced_status_arg)
 {
     psa_algorithm_t alg = alg_arg;
     psa_status_t forced_status = forced_status_arg;
@@ -1731,50 +1697,51 @@
     size_t output_length;
 
     mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
-    ASSERT_ALLOC( output, PSA_HASH_LENGTH( alg ) );
+    ASSERT_ALLOC(output, PSA_HASH_LENGTH(alg));
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /*
      * Finish inactive operation, the driver shouldn't be called.
      */
-    TEST_EQUAL( psa_hash_finish( &operation, output, PSA_HASH_LENGTH( alg ),
-                                 &output_length ),
-                PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 0 );
+    TEST_EQUAL(psa_hash_finish(&operation, output, PSA_HASH_LENGTH(alg),
+                               &output_length),
+               PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits, 0);
 
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 1 );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits, 1);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS);
 
-    PSA_ASSERT( psa_hash_update( &operation, input->x, input->len ) );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 2 );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS );
+    PSA_ASSERT(psa_hash_update(&operation, input->x, input->len));
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits, 2);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS);
 
     mbedtls_test_driver_hash_hooks.forced_status = forced_status;
-    TEST_EQUAL( psa_hash_finish( &operation,
-                                 output, PSA_HASH_LENGTH( alg ),
-                                 &output_length ),
-                forced_status );
+    TEST_EQUAL(psa_hash_finish(&operation,
+                               output, PSA_HASH_LENGTH(alg),
+                               &output_length),
+               forced_status);
     /* Two more calls to the driver interface: finish + abort */
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 4 );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, forced_status );
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits, 4);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.driver_status, forced_status);
 
-    if( forced_status == PSA_SUCCESS )
-        ASSERT_COMPARE( output, output_length, hash->x, hash->len );
+    if (forced_status == PSA_SUCCESS) {
+        ASSERT_COMPARE(output, output_length, hash->x, hash->len);
+    }
 
 exit:
-    psa_hash_abort( &operation );
-    mbedtls_free( output );
-    PSA_DONE( );
+    psa_hash_abort(&operation);
+    mbedtls_free(output);
+    PSA_DONE();
     mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hash_clone( int alg_arg,
-                 data_t *input, data_t *hash,
-                 int forced_status_arg )
+void hash_clone(int alg_arg,
+                data_t *input, data_t *hash,
+                int forced_status_arg)
 {
     psa_algorithm_t alg = alg_arg;
     psa_status_t forced_status = forced_status_arg;
@@ -1784,50 +1751,49 @@
     size_t output_length;
 
     mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
-    ASSERT_ALLOC( output, PSA_HASH_LENGTH( alg ) );
+    ASSERT_ALLOC(output, PSA_HASH_LENGTH(alg));
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /*
      * Clone inactive operation, the driver shouldn't be called.
      */
-    TEST_EQUAL( psa_hash_clone( &source_operation, &target_operation ),
-                PSA_ERROR_BAD_STATE );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 0 );
+    TEST_EQUAL(psa_hash_clone(&source_operation, &target_operation),
+               PSA_ERROR_BAD_STATE);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits, 0);
 
-    PSA_ASSERT( psa_hash_setup( &source_operation, alg ) );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 1 );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS );
+    PSA_ASSERT(psa_hash_setup(&source_operation, alg));
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits, 1);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS);
 
     mbedtls_test_driver_hash_hooks.forced_status = forced_status;
-    TEST_EQUAL( psa_hash_clone( &source_operation, &target_operation ),
-                forced_status );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits,
-                forced_status == PSA_SUCCESS ? 2 : 3 );
-    TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, forced_status );
+    TEST_EQUAL(psa_hash_clone(&source_operation, &target_operation),
+               forced_status);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits,
+               forced_status == PSA_SUCCESS ? 2 : 3);
+    TEST_EQUAL(mbedtls_test_driver_hash_hooks.driver_status, forced_status);
 
-    if( forced_status == PSA_SUCCESS )
-    {
+    if (forced_status == PSA_SUCCESS) {
         mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
-        PSA_ASSERT( psa_hash_update( &target_operation,
-                                     input->x, input->len ) );
-        TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 1 );
-        TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS );
+        PSA_ASSERT(psa_hash_update(&target_operation,
+                                   input->x, input->len));
+        TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits, 1);
+        TEST_EQUAL(mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS);
 
-        PSA_ASSERT( psa_hash_finish( &target_operation,
-                                     output, PSA_HASH_LENGTH( alg ),
-                                     &output_length ) );
-        TEST_EQUAL( mbedtls_test_driver_hash_hooks.hits, 3 );
-        TEST_EQUAL( mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS );
+        PSA_ASSERT(psa_hash_finish(&target_operation,
+                                   output, PSA_HASH_LENGTH(alg),
+                                   &output_length));
+        TEST_EQUAL(mbedtls_test_driver_hash_hooks.hits, 3);
+        TEST_EQUAL(mbedtls_test_driver_hash_hooks.driver_status, PSA_SUCCESS);
 
-        ASSERT_COMPARE( output, output_length, hash->x, hash->len );
+        ASSERT_COMPARE(output, output_length, hash->x, hash->len);
     }
 
 exit:
-    psa_hash_abort( &source_operation );
-    psa_hash_abort( &target_operation );
-    mbedtls_free( output );
-    PSA_DONE( );
+    psa_hash_abort(&source_operation);
+    psa_hash_abort(&target_operation);
+    mbedtls_free(output);
+    PSA_DONE();
     mbedtls_test_driver_hash_hooks = mbedtls_test_driver_hash_hooks_init();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_entropy.function b/tests/suites/test_suite_psa_crypto_entropy.function
index 4dcbb36..26ce0d3 100644
--- a/tests/suites/test_suite_psa_crypto_entropy.function
+++ b/tests/suites/test_suite_psa_crypto_entropy.function
@@ -8,7 +8,8 @@
 #include "mbedtls/entropy_poll.h"
 
 /* Calculating the minimum allowed entropy size in bytes */
-#define MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE MAX(MBEDTLS_ENTROPY_MIN_PLATFORM, MBEDTLS_ENTROPY_BLOCK_SIZE)
+#define MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE MAX(MBEDTLS_ENTROPY_MIN_PLATFORM, \
+                                                MBEDTLS_ENTROPY_BLOCK_SIZE)
 
 #if defined(MBEDTLS_PSA_INJECT_ENTROPY)
 
@@ -22,15 +23,16 @@
  * to do this (it would be a security risk if such a function was ever
  * accessible in production), implement this functionality in a white-box
  * manner. */
-psa_status_t remove_seed_file( void )
+psa_status_t remove_seed_file(void)
 {
 #if defined(MBEDTLS_PSA_ITS_FILE_C)
-    if( remove( "00000000ffffff52.psa_its" ) == 0 )
-        return( PSA_SUCCESS );
-    else
-        return( PSA_ERROR_DOES_NOT_EXIST );
+    if (remove("00000000ffffff52.psa_its") == 0) {
+        return PSA_SUCCESS;
+    } else {
+        return PSA_ERROR_DOES_NOT_EXIST;
+    }
 #else
-    return( psa_its_remove( PSA_CRYPTO_ITS_RANDOM_SEED_UID ) );
+    return psa_its_remove(PSA_CRYPTO_ITS_RANDOM_SEED_UID);
 #endif
 }
 
@@ -39,44 +41,44 @@
 /* END_HEADER */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
-void external_rng_failure_generate( )
+void external_rng_failure_generate()
 {
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_DERIVE );
-    psa_set_key_bits( &attributes, 128 );
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_DERIVE);
+    psa_set_key_bits(&attributes, 128);
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     uint8_t output[1];
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    PSA_ASSERT( psa_generate_random( output, sizeof( output ) ) );
-    PSA_ASSERT( psa_generate_key( &attributes, &key ) );
-    PSA_ASSERT( psa_destroy_key( key ) );
+    PSA_ASSERT(psa_generate_random(output, sizeof(output)));
+    PSA_ASSERT(psa_generate_key(&attributes, &key));
+    PSA_ASSERT(psa_destroy_key(key));
 
-    mbedtls_test_disable_insecure_external_rng( );
-    TEST_EQUAL( PSA_ERROR_INSUFFICIENT_ENTROPY,
-                psa_generate_random( output, sizeof( output ) ) );
-    TEST_EQUAL( PSA_ERROR_INSUFFICIENT_ENTROPY,
-                psa_generate_key( &attributes, &key ) );
+    mbedtls_test_disable_insecure_external_rng();
+    TEST_EQUAL(PSA_ERROR_INSUFFICIENT_ENTROPY,
+               psa_generate_random(output, sizeof(output)));
+    TEST_EQUAL(PSA_ERROR_INSUFFICIENT_ENTROPY,
+               psa_generate_key(&attributes, &key));
 
 exit:
-    psa_destroy_key( key );
-    PSA_DONE( );
+    psa_destroy_key(key);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
-void external_rng_failure_sign( int key_type, data_t *key_data, int alg,
-                                int input_size_arg )
+void external_rng_failure_sign(int key_type, data_t *key_data, int alg,
+                               int input_size_arg)
 {
     /* This test case is only expected to pass if the signature mechanism
      * requires randomness, either because it is a randomized signature
      * or because the implementation uses blinding. */
 
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    psa_set_key_type( &attributes, key_type );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_HASH );
-    psa_set_key_algorithm( &attributes, alg );
+    psa_set_key_type(&attributes, key_type);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_HASH);
+    psa_set_key_algorithm(&attributes, alg);
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     size_t input_size = input_size_arg;
     uint8_t *input = NULL;
@@ -84,43 +86,43 @@
     size_t signature_size = PSA_SIGNATURE_MAX_SIZE;
     size_t signature_length;
 
-    ASSERT_ALLOC( input, input_size );
-    ASSERT_ALLOC( signature, signature_size );
+    ASSERT_ALLOC(input, input_size);
+    ASSERT_ALLOC(signature, signature_size);
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-    PSA_ASSERT( psa_sign_hash( key, alg,
-                               input, input_size,
-                               signature, signature_size,
-                               &signature_length ) );
-    PSA_ASSERT( psa_destroy_key( key ) );
+    PSA_ASSERT(psa_crypto_init());
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+    PSA_ASSERT(psa_sign_hash(key, alg,
+                             input, input_size,
+                             signature, signature_size,
+                             &signature_length));
+    PSA_ASSERT(psa_destroy_key(key));
 
-    mbedtls_test_disable_insecure_external_rng( );
+    mbedtls_test_disable_insecure_external_rng();
     /* Import the key again, because for RSA Mbed TLS caches blinding values
      * in the key object and this could perturb the test. */
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-    TEST_EQUAL( PSA_ERROR_INSUFFICIENT_ENTROPY,
-                psa_sign_hash( key, alg,
-                               input, input_size,
-                               signature, signature_size,
-                               &signature_length ) );
-    PSA_ASSERT( psa_destroy_key( key ) );
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+    TEST_EQUAL(PSA_ERROR_INSUFFICIENT_ENTROPY,
+               psa_sign_hash(key, alg,
+                             input, input_size,
+                             signature, signature_size,
+                             &signature_length));
+    PSA_ASSERT(psa_destroy_key(key));
 
 exit:
-    psa_destroy_key( key );
-    PSA_DONE( );
-    mbedtls_free( input );
-    mbedtls_free( signature );
+    psa_destroy_key(key);
+    PSA_DONE();
+    mbedtls_free(input);
+    mbedtls_free(signature);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_INJECT_ENTROPY */
-void validate_entropy_seed_injection( int seed_length_a,
-                                      int expected_status_a,
-                                      int seed_length_b,
-                                      int expected_status_b )
+void validate_entropy_seed_injection(int seed_length_a,
+                                     int expected_status_a,
+                                     int seed_length_b,
+                                     int expected_status_b)
 {
     psa_status_t status;
     uint8_t output[32] = { 0 };
@@ -128,68 +130,63 @@
     uint8_t *seed = NULL;
     int i;
     int seed_size;
-    if( seed_length_a > seed_length_b )
-    {
+    if (seed_length_a > seed_length_b) {
         seed_size = seed_length_a;
-    }
-    else
-    {
+    } else {
         seed_size = seed_length_b;
     }
-    ASSERT_ALLOC( seed, seed_size );
+    ASSERT_ALLOC(seed, seed_size);
     /* fill seed with some data */
-    for( i = 0; i < seed_size; ++i )
-    {
+    for (i = 0; i < seed_size; ++i) {
         seed[i] = i;
     }
-    status =  remove_seed_file( );
-    TEST_ASSERT( ( status == PSA_SUCCESS ) ||
-                 ( status == PSA_ERROR_DOES_NOT_EXIST ) );
-    status = mbedtls_psa_inject_entropy( seed, seed_length_a );
-    TEST_EQUAL( status, expected_status_a );
-    status = mbedtls_psa_inject_entropy( seed, seed_length_b );
-    TEST_EQUAL( status, expected_status_b );
-    PSA_ASSERT( psa_crypto_init( ) );
-    PSA_ASSERT( psa_generate_random( output,
-                                     sizeof( output ) ) );
-    TEST_ASSERT( memcmp( output, zeros, sizeof( output ) ) != 0 );
+    status =  remove_seed_file();
+    TEST_ASSERT((status == PSA_SUCCESS) ||
+                (status == PSA_ERROR_DOES_NOT_EXIST));
+    status = mbedtls_psa_inject_entropy(seed, seed_length_a);
+    TEST_EQUAL(status, expected_status_a);
+    status = mbedtls_psa_inject_entropy(seed, seed_length_b);
+    TEST_EQUAL(status, expected_status_b);
+    PSA_ASSERT(psa_crypto_init());
+    PSA_ASSERT(psa_generate_random(output,
+                                   sizeof(output)));
+    TEST_ASSERT(memcmp(output, zeros, sizeof(output)) != 0);
 exit:
-    mbedtls_free( seed );
-    remove_seed_file( );
-    PSA_DONE( );
+    mbedtls_free(seed);
+    remove_seed_file();
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_INJECT_ENTROPY */
-void run_entropy_inject_with_crypto_init( )
+void run_entropy_inject_with_crypto_init()
 {
     psa_status_t status;
     size_t i;
     uint8_t seed[MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE] = { 0 };
     /* fill seed with some data */
-    for( i = 0; i < sizeof( seed ); ++i )
-    {
+    for (i = 0; i < sizeof(seed); ++i) {
         seed[i] = i;
     }
-    status =  remove_seed_file( );
-    TEST_ASSERT( ( status == PSA_SUCCESS ) ||
-                 ( status == PSA_ERROR_DOES_NOT_EXIST ) );
-    status = mbedtls_psa_inject_entropy( seed, sizeof( seed ) );
-    PSA_ASSERT( status );
-    status =  remove_seed_file( );
-    TEST_EQUAL( status, PSA_SUCCESS );
-    status = psa_crypto_init( );
-    TEST_EQUAL( status, PSA_ERROR_INSUFFICIENT_ENTROPY );
-    status = mbedtls_psa_inject_entropy( seed, sizeof( seed ) );
-    PSA_ASSERT( status );
-    status = psa_crypto_init( );
-    PSA_ASSERT( status );
-    PSA_DONE( );
+    status =  remove_seed_file();
+    TEST_ASSERT((status == PSA_SUCCESS) ||
+                (status == PSA_ERROR_DOES_NOT_EXIST));
+    status = mbedtls_psa_inject_entropy(seed, sizeof(seed));
+    PSA_ASSERT(status);
+    status =  remove_seed_file();
+    TEST_EQUAL(status, PSA_SUCCESS);
+    status = psa_crypto_init();
+    TEST_EQUAL(status, PSA_ERROR_INSUFFICIENT_ENTROPY);
+    status = mbedtls_psa_inject_entropy(seed, sizeof(seed));
+    PSA_ASSERT(status);
+    status = psa_crypto_init();
+    PSA_ASSERT(status);
+    PSA_DONE();
     /* The seed is written by nv_seed callback functions therefore the injection will fail */
-    status = mbedtls_psa_inject_entropy( seed, sizeof( seed ) );
-    TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
+    status = mbedtls_psa_inject_entropy(seed, sizeof(seed));
+    TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
 exit:
-    remove_seed_file( );
-    PSA_DONE( );
+    remove_seed_file();
+    PSA_DONE();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_generate_key.function b/tests/suites/test_suite_psa_crypto_generate_key.function
index 6dc6043..366e09b 100644
--- a/tests/suites/test_suite_psa_crypto_generate_key.function
+++ b/tests/suites/test_suite_psa_crypto_generate_key.function
@@ -3,7 +3,7 @@
 #include "psa/crypto.h"
 #include "test/psa_crypto_helpers.h"
 
-#define INVALID_KEY_ID mbedtls_svc_key_id_make( 0, 0xfedcba98 )
+#define INVALID_KEY_ID mbedtls_svc_key_id_make(0, 0xfedcba98)
 
 /* END_HEADER */
 
@@ -13,7 +13,7 @@
  */
 
 /* BEGIN_CASE */
-void generate_key( int key_type_arg, int bits_arg, int expected_status_arg)
+void generate_key(int key_type_arg, int bits_arg, int expected_status_arg)
 {
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     mbedtls_svc_key_id_t key_id = INVALID_KEY_ID;
@@ -23,27 +23,26 @@
     size_t bits = bits_arg;
     psa_status_t expected_status = expected_status_arg;
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    psa_set_key_type( &attributes, key_type );
-    psa_set_key_bits( &attributes, bits );
-    TEST_EQUAL( psa_generate_key( &attributes, &key_id ),
-                expected_status );
+    PSA_ASSERT(psa_crypto_init());
+    psa_set_key_type(&attributes, key_type);
+    psa_set_key_bits(&attributes, bits);
+    TEST_EQUAL(psa_generate_key(&attributes, &key_id),
+               expected_status);
 
     // Verify attributes of the created key on success
-    if ( expected_status == PSA_SUCCESS )
-    {
+    if (expected_status == PSA_SUCCESS) {
         psa_reset_key_attributes(&attributes);
-        PSA_ASSERT( psa_get_key_attributes( key_id, &attributes ) );
-        TEST_EQUAL( psa_get_key_lifetime( &attributes ), PSA_KEY_LIFETIME_VOLATILE );
-        TEST_EQUAL( psa_get_key_usage_flags( &attributes ), 0 );
-        TEST_EQUAL( psa_get_key_algorithm( &attributes ), 0 );
-        TEST_EQUAL( psa_get_key_type( &attributes ), key_type );
-        TEST_EQUAL( psa_get_key_bits( &attributes ), bits );
+        PSA_ASSERT(psa_get_key_attributes(key_id, &attributes));
+        TEST_EQUAL(psa_get_key_lifetime(&attributes), PSA_KEY_LIFETIME_VOLATILE);
+        TEST_EQUAL(psa_get_key_usage_flags(&attributes), 0);
+        TEST_EQUAL(psa_get_key_algorithm(&attributes), 0);
+        TEST_EQUAL(psa_get_key_type(&attributes), key_type);
+        TEST_EQUAL(psa_get_key_bits(&attributes), bits);
     }
 
 exit:
     psa_reset_key_attributes(&attributes);
-    psa_destroy_key( key_id );
-    PSA_DONE( );
+    psa_destroy_key(key_id);
+    PSA_DONE();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_hash.function b/tests/suites/test_suite_psa_crypto_hash.function
index b0da2bf..f12541d 100644
--- a/tests/suites/test_suite_psa_crypto_hash.function
+++ b/tests/suites/test_suite_psa_crypto_hash.function
@@ -10,54 +10,54 @@
  */
 
 /* BEGIN_CASE */
-void hash_finish( int alg_arg, data_t *input, data_t *expected_hash )
+void hash_finish(int alg_arg, data_t *input, data_t *expected_hash)
 {
     psa_algorithm_t alg = alg_arg;
     unsigned char actual_hash[PSA_HASH_MAX_SIZE];
     size_t actual_hash_length;
     psa_hash_operation_t operation = PSA_HASH_OPERATION_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
-    PSA_ASSERT( psa_hash_update( &operation,
-                                 input->x, input->len ) );
-    PSA_ASSERT( psa_hash_finish( &operation,
-                                 actual_hash, sizeof( actual_hash ),
-                                 &actual_hash_length ) );
-    ASSERT_COMPARE( expected_hash->x, expected_hash->len,
-                    actual_hash, actual_hash_length );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
+    PSA_ASSERT(psa_hash_update(&operation,
+                               input->x, input->len));
+    PSA_ASSERT(psa_hash_finish(&operation,
+                               actual_hash, sizeof(actual_hash),
+                               &actual_hash_length));
+    ASSERT_COMPARE(expected_hash->x, expected_hash->len,
+                   actual_hash, actual_hash_length);
 
 exit:
-    psa_hash_abort( &operation );
-    PSA_DONE( );
+    psa_hash_abort(&operation);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hash_verify( int alg_arg, data_t *input, data_t *expected_hash )
+void hash_verify(int alg_arg, data_t *input, data_t *expected_hash)
 {
     psa_algorithm_t alg = alg_arg;
     psa_hash_operation_t operation = PSA_HASH_OPERATION_INIT;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    PSA_ASSERT( psa_hash_setup( &operation, alg ) );
-    PSA_ASSERT( psa_hash_update( &operation,
-                                 input->x,
-                                 input->len ) );
-    PSA_ASSERT( psa_hash_verify( &operation,
-                                 expected_hash->x,
-                                 expected_hash->len ) );
+    PSA_ASSERT(psa_hash_setup(&operation, alg));
+    PSA_ASSERT(psa_hash_update(&operation,
+                               input->x,
+                               input->len));
+    PSA_ASSERT(psa_hash_verify(&operation,
+                               expected_hash->x,
+                               expected_hash->len));
 
 exit:
-    psa_hash_abort( &operation );
-    PSA_DONE( );
+    psa_hash_abort(&operation);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hash_multi_part( int alg_arg, data_t *input, data_t *expected_hash )
+void hash_multi_part(int alg_arg, data_t *input, data_t *expected_hash)
 {
     psa_algorithm_t alg = alg_arg;
     unsigned char actual_hash[PSA_HASH_MAX_SIZE];
@@ -66,37 +66,36 @@
     psa_hash_operation_t operation2 = PSA_HASH_OPERATION_INIT;
     uint32_t len = 0;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    do
-    {
-        memset( actual_hash, 0, sizeof( actual_hash ) );
-        PSA_ASSERT( psa_hash_setup( &operation, alg ) );
+    do {
+        memset(actual_hash, 0, sizeof(actual_hash));
+        PSA_ASSERT(psa_hash_setup(&operation, alg));
 
-        PSA_ASSERT( psa_hash_update( &operation,
-                                     input->x, len ) );
-        PSA_ASSERT( psa_hash_clone( &operation, &operation2 ) );
-        PSA_ASSERT( psa_hash_update( &operation,
-                                     input->x + len, input->len - len ) );
-        PSA_ASSERT( psa_hash_update( &operation2,
-                                     input->x + len, input->len - len ) );
+        PSA_ASSERT(psa_hash_update(&operation,
+                                   input->x, len));
+        PSA_ASSERT(psa_hash_clone(&operation, &operation2));
+        PSA_ASSERT(psa_hash_update(&operation,
+                                   input->x + len, input->len - len));
+        PSA_ASSERT(psa_hash_update(&operation2,
+                                   input->x + len, input->len - len));
 
-        PSA_ASSERT( psa_hash_finish( &operation,
-                                     actual_hash, sizeof( actual_hash ),
-                                     &actual_hash_length ) );
-        ASSERT_COMPARE( expected_hash->x, expected_hash->len,
-                        actual_hash, actual_hash_length );
+        PSA_ASSERT(psa_hash_finish(&operation,
+                                   actual_hash, sizeof(actual_hash),
+                                   &actual_hash_length));
+        ASSERT_COMPARE(expected_hash->x, expected_hash->len,
+                       actual_hash, actual_hash_length);
 
-        PSA_ASSERT( psa_hash_finish( &operation2,
-                                     actual_hash, sizeof( actual_hash ),
-                                     &actual_hash_length ) );
-        ASSERT_COMPARE( expected_hash->x, expected_hash->len,
-                        actual_hash, actual_hash_length );
-    } while( len++ != input->len );
+        PSA_ASSERT(psa_hash_finish(&operation2,
+                                   actual_hash, sizeof(actual_hash),
+                                   &actual_hash_length));
+        ASSERT_COMPARE(expected_hash->x, expected_hash->len,
+                       actual_hash, actual_hash_length);
+    } while (len++ != input->len);
 
 exit:
-    psa_hash_abort( &operation );
-    psa_hash_abort( &operation2 );
-    PSA_DONE( );
+    psa_hash_abort(&operation);
+    psa_hash_abort(&operation2);
+    PSA_DONE();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_init.function b/tests/suites/test_suite_psa_crypto_init.function
index 40efb87..7345ad1 100644
--- a/tests/suites/test_suite_psa_crypto_init.function
+++ b/tests/suites/test_suite_psa_crypto_init.function
@@ -17,7 +17,7 @@
  * half the entropy length. For SHA-256, SHA-384 or SHA-512, the
  * entropy length is 256 per the documentation of mbedtls_hmac_drbg_seed(),
  * and PSA crypto doesn't support other hashes for HMAC_DRBG. */
-#define ENTROPY_NONCE_LEN ( 256 / 2 )
+#define ENTROPY_NONCE_LEN (256 / 2)
 #else
 /* PSA crypto uses the CTR_DRBG module. In some configurations, it needs
  * to read from the entropy source twice: once for the initial entropy
@@ -28,28 +28,29 @@
 
 #if !defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
 
-typedef struct
-{
+typedef struct {
     size_t threshold; /* Minimum bytes to make mbedtls_entropy_func happy */
     size_t max_steps;
     size_t *length_sequence;
     size_t step;
 } fake_entropy_state_t;
-static int fake_entropy_source( void *state_arg,
-                                unsigned char *output, size_t len,
-                                size_t *olen )
+static int fake_entropy_source(void *state_arg,
+                               unsigned char *output, size_t len,
+                               size_t *olen)
 {
     fake_entropy_state_t *state = state_arg;
     size_t i;
 
-    if( state->step >= state->max_steps )
-        return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
+    if (state->step >= state->max_steps) {
+        return MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
+    }
 
-    *olen = MIN( len, state->length_sequence[state->step] );
-    for( i = 0; i < *olen; i++ )
+    *olen = MIN(len, state->length_sequence[state->step]);
+    for (i = 0; i < *olen; i++) {
         output[i] = i;
+    }
     ++state->step;
-    return( 0 );
+    return 0;
 }
 
 #define ENTROPY_SOURCE_PLATFORM                 0x00000001
@@ -64,69 +65,71 @@
 
 /* This is a modified version of mbedtls_entropy_init() from entropy.c
  * which chooses entropy sources dynamically. */
-static void custom_entropy_init( mbedtls_entropy_context *ctx )
+static void custom_entropy_init(mbedtls_entropy_context *ctx)
 {
     ctx->source_count = 0;
-    memset( ctx->source, 0, sizeof( ctx->source ) );
+    memset(ctx->source, 0, sizeof(ctx->source));
 
 #if defined(MBEDTLS_THREADING_C)
-    mbedtls_mutex_init( &ctx->mutex );
+    mbedtls_mutex_init(&ctx->mutex);
 #endif
 
     ctx->accumulator_started = 0;
 #if defined(MBEDTLS_ENTROPY_SHA512_ACCUMULATOR)
-    mbedtls_sha512_init( &ctx->accumulator );
+    mbedtls_sha512_init(&ctx->accumulator);
 #else
-    mbedtls_sha256_init( &ctx->accumulator );
+    mbedtls_sha256_init(&ctx->accumulator);
 #endif
 #if defined(MBEDTLS_HAVEGE_C)
-    mbedtls_havege_init( &ctx->havege_data );
+    mbedtls_havege_init(&ctx->havege_data);
 #endif
 
 #if !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
-    if( custom_entropy_sources_mask & ENTROPY_SOURCE_PLATFORM )
-        mbedtls_entropy_add_source( ctx, mbedtls_platform_entropy_poll, NULL,
-                                    MBEDTLS_ENTROPY_MIN_PLATFORM,
-                                    MBEDTLS_ENTROPY_SOURCE_STRONG );
+    if (custom_entropy_sources_mask & ENTROPY_SOURCE_PLATFORM) {
+        mbedtls_entropy_add_source(ctx, mbedtls_platform_entropy_poll, NULL,
+                                   MBEDTLS_ENTROPY_MIN_PLATFORM,
+                                   MBEDTLS_ENTROPY_SOURCE_STRONG);
+    }
 #endif
 #if defined(MBEDTLS_TIMING_C)
-    if( custom_entropy_sources_mask & ENTROPY_SOURCE_TIMING )
-        mbedtls_entropy_add_source( ctx, mbedtls_hardclock_poll, NULL,
-                                    MBEDTLS_ENTROPY_MIN_HARDCLOCK,
-                                    MBEDTLS_ENTROPY_SOURCE_WEAK );
+    if (custom_entropy_sources_mask & ENTROPY_SOURCE_TIMING) {
+        mbedtls_entropy_add_source(ctx, mbedtls_hardclock_poll, NULL,
+                                   MBEDTLS_ENTROPY_MIN_HARDCLOCK,
+                                   MBEDTLS_ENTROPY_SOURCE_WEAK);
+    }
 #endif
 #if defined(MBEDTLS_HAVEGE_C)
-    if( custom_entropy_sources_mask & ENTROPY_SOURCE_HAVEGE )
-        mbedtls_entropy_add_source( ctx, mbedtls_havege_poll, &ctx->havege_data,
-                                    MBEDTLS_ENTROPY_MIN_HAVEGE,
-                                    MBEDTLS_ENTROPY_SOURCE_STRONG );
+    if (custom_entropy_sources_mask & ENTROPY_SOURCE_HAVEGE) {
+        mbedtls_entropy_add_source(ctx, mbedtls_havege_poll, &ctx->havege_data,
+                                   MBEDTLS_ENTROPY_MIN_HAVEGE,
+                                   MBEDTLS_ENTROPY_SOURCE_STRONG);
+    }
 #endif
 #if defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
-    if( custom_entropy_sources_mask & ENTROPY_SOURCE_HARDWARE )
-        mbedtls_entropy_add_source( ctx, mbedtls_hardware_poll, NULL,
-                                    MBEDTLS_ENTROPY_MIN_HARDWARE,
-                                    MBEDTLS_ENTROPY_SOURCE_STRONG );
+    if (custom_entropy_sources_mask & ENTROPY_SOURCE_HARDWARE) {
+        mbedtls_entropy_add_source(ctx, mbedtls_hardware_poll, NULL,
+                                   MBEDTLS_ENTROPY_MIN_HARDWARE,
+                                   MBEDTLS_ENTROPY_SOURCE_STRONG);
+    }
 #endif
 #if defined(MBEDTLS_ENTROPY_NV_SEED)
-    if( custom_entropy_sources_mask & ENTROPY_SOURCE_NV_SEED )
-    {
-        mbedtls_entropy_add_source( ctx, mbedtls_nv_seed_poll, NULL,
-                                    MBEDTLS_ENTROPY_BLOCK_SIZE,
-                                    MBEDTLS_ENTROPY_SOURCE_STRONG );
+    if (custom_entropy_sources_mask & ENTROPY_SOURCE_NV_SEED) {
+        mbedtls_entropy_add_source(ctx, mbedtls_nv_seed_poll, NULL,
+                                   MBEDTLS_ENTROPY_BLOCK_SIZE,
+                                   MBEDTLS_ENTROPY_SOURCE_STRONG);
         ctx->initial_entropy_run = 0;
-    }
-    else
-    {
+    } else {
         /* Skip the NV seed even though it's compiled in. */
         ctx->initial_entropy_run = 1;
     }
 #endif
 
-    if( custom_entropy_sources_mask & ENTROPY_SOURCE_FAKE )
-        mbedtls_entropy_add_source( ctx,
-                                    fake_entropy_source, &fake_entropy_state,
-                                    fake_entropy_state.threshold,
-                                    MBEDTLS_ENTROPY_SOURCE_STRONG );
+    if (custom_entropy_sources_mask & ENTROPY_SOURCE_FAKE) {
+        mbedtls_entropy_add_source(ctx,
+                                   fake_entropy_source, &fake_entropy_state,
+                                   fake_entropy_state.threshold,
+                                   MBEDTLS_ENTROPY_SOURCE_STRONG);
+    }
 }
 
 #endif /* !defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG) */
@@ -139,109 +142,106 @@
  */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_NV_SEED:!MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
-void create_nv_seed( )
+void create_nv_seed()
 {
     static unsigned char seed[ENTROPY_MIN_NV_SEED_SIZE];
-    TEST_ASSERT( mbedtls_nv_seed_write( seed, sizeof( seed ) ) >= 0 );
+    TEST_ASSERT(mbedtls_nv_seed_write(seed, sizeof(seed)) >= 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void init_deinit( int count )
+void init_deinit(int count)
 {
     psa_status_t status;
     int i;
-    for( i = 0; i < count; i++ )
-    {
-        status = psa_crypto_init( );
-        PSA_ASSERT( status );
-        status = psa_crypto_init( );
-        PSA_ASSERT( status );
-        PSA_DONE( );
+    for (i = 0; i < count; i++) {
+        status = psa_crypto_init();
+        PSA_ASSERT(status);
+        status = psa_crypto_init();
+        PSA_ASSERT(status);
+        PSA_DONE();
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void deinit_without_init( int count )
+void deinit_without_init(int count)
 {
     int i;
-    for( i = 0; i < count; i++ )
-    {
-        PSA_ASSERT( psa_crypto_init( ) );
-        PSA_DONE( );
+    for (i = 0; i < count; i++) {
+        PSA_ASSERT(psa_crypto_init());
+        PSA_DONE();
     }
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void validate_module_init_generate_random( int count )
+void validate_module_init_generate_random(int count)
 {
     psa_status_t status;
     uint8_t random[10] = { 0 };
     int i;
-    for( i = 0; i < count; i++ )
-    {
-        status = psa_crypto_init( );
-        PSA_ASSERT( status );
-        PSA_DONE( );
+    for (i = 0; i < count; i++) {
+        status = psa_crypto_init();
+        PSA_ASSERT(status);
+        PSA_DONE();
     }
-    status = psa_generate_random( random, sizeof( random ) );
-    TEST_EQUAL( status, PSA_ERROR_BAD_STATE );
+    status = psa_generate_random(random, sizeof(random));
+    TEST_EQUAL(status, PSA_ERROR_BAD_STATE);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void validate_module_init_key_based( int count )
+void validate_module_init_key_based(int count)
 {
     psa_status_t status;
     uint8_t data[10] = { 0 };
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    mbedtls_svc_key_id_t key = mbedtls_svc_key_id_make( 0xdead, 0xdead );
+    mbedtls_svc_key_id_t key = mbedtls_svc_key_id_make(0xdead, 0xdead);
     int i;
 
-    for( i = 0; i < count; i++ )
-    {
-        status = psa_crypto_init( );
-        PSA_ASSERT( status );
-        PSA_DONE( );
+    for (i = 0; i < count; i++) {
+        status = psa_crypto_init();
+        PSA_ASSERT(status);
+        PSA_DONE();
     }
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA );
-    status = psa_import_key( &attributes, data, sizeof( data ), &key );
-    TEST_EQUAL( status, PSA_ERROR_BAD_STATE );
-    TEST_ASSERT( mbedtls_svc_key_id_is_null( key ) );
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
+    status = psa_import_key(&attributes, data, sizeof(data), &key);
+    TEST_EQUAL(status, PSA_ERROR_BAD_STATE);
+    TEST_ASSERT(mbedtls_svc_key_id_is_null(key));
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:!MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
-void custom_entropy_sources( int sources_arg, int expected_init_status_arg )
+void custom_entropy_sources(int sources_arg, int expected_init_status_arg)
 {
     psa_status_t expected_init_status = expected_init_status_arg;
     uint8_t random[10] = { 0 };
 
     custom_entropy_sources_mask = sources_arg;
-    PSA_ASSERT( mbedtls_psa_crypto_configure_entropy_sources(
-                    custom_entropy_init, mbedtls_entropy_free ) );
+    PSA_ASSERT(mbedtls_psa_crypto_configure_entropy_sources(
+                   custom_entropy_init, mbedtls_entropy_free));
 
-    TEST_EQUAL( psa_crypto_init( ), expected_init_status );
-    if( expected_init_status != PSA_SUCCESS )
+    TEST_EQUAL(psa_crypto_init(), expected_init_status);
+    if (expected_init_status != PSA_SUCCESS) {
         goto exit;
+    }
 
-    PSA_ASSERT( psa_generate_random( random, sizeof( random ) ) );
+    PSA_ASSERT(psa_generate_random(random, sizeof(random)));
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:!MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
-void fake_entropy_source( int threshold,
-                          int amount1,
-                          int amount2,
-                          int amount3,
-                          int amount4,
-                          int expected_init_status_arg )
+void fake_entropy_source(int threshold,
+                         int amount1,
+                         int amount2,
+                         int amount3,
+                         int amount4,
+                         int expected_init_status_arg)
 {
     psa_status_t expected_init_status = expected_init_status_arg;
     uint8_t random[10] = { 0 };
@@ -250,55 +250,61 @@
     fake_entropy_state.threshold = threshold;
     fake_entropy_state.step = 0;
     fake_entropy_state.max_steps = 0;
-    if( amount1 >= 0 )
+    if (amount1 >= 0) {
         lengths[fake_entropy_state.max_steps++] = amount1;
-    if( amount2 >= 0 )
+    }
+    if (amount2 >= 0) {
         lengths[fake_entropy_state.max_steps++] = amount2;
-    if( amount3 >= 0 )
+    }
+    if (amount3 >= 0) {
         lengths[fake_entropy_state.max_steps++] = amount3;
-    if( amount4 >= 0 )
+    }
+    if (amount4 >= 0) {
         lengths[fake_entropy_state.max_steps++] = amount4;
+    }
     fake_entropy_state.length_sequence = lengths;
 
     custom_entropy_sources_mask = ENTROPY_SOURCE_FAKE;
-    PSA_ASSERT( mbedtls_psa_crypto_configure_entropy_sources(
-                    custom_entropy_init, mbedtls_entropy_free ) );
+    PSA_ASSERT(mbedtls_psa_crypto_configure_entropy_sources(
+                   custom_entropy_init, mbedtls_entropy_free));
 
-    TEST_EQUAL( psa_crypto_init( ), expected_init_status );
-    if( expected_init_status != PSA_SUCCESS )
+    TEST_EQUAL(psa_crypto_init(), expected_init_status);
+    if (expected_init_status != PSA_SUCCESS) {
         goto exit;
+    }
 
-    PSA_ASSERT( psa_generate_random( random, sizeof( random ) ) );
+    PSA_ASSERT(psa_generate_random(random, sizeof(random)));
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_NV_SEED:!MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
-void entropy_from_nv_seed( int seed_size_arg,
-                           int expected_init_status_arg )
+void entropy_from_nv_seed(int seed_size_arg,
+                          int expected_init_status_arg)
 {
     psa_status_t expected_init_status = expected_init_status_arg;
     uint8_t random[10] = { 0 };
     uint8_t *seed = NULL;
     size_t seed_size = seed_size_arg;
 
-    ASSERT_ALLOC( seed, seed_size );
-    TEST_ASSERT( mbedtls_nv_seed_write( seed, seed_size ) >= 0 );
+    ASSERT_ALLOC(seed, seed_size);
+    TEST_ASSERT(mbedtls_nv_seed_write(seed, seed_size) >= 0);
 
     custom_entropy_sources_mask = ENTROPY_SOURCE_NV_SEED;
-    PSA_ASSERT( mbedtls_psa_crypto_configure_entropy_sources(
-                    custom_entropy_init, mbedtls_entropy_free ) );
+    PSA_ASSERT(mbedtls_psa_crypto_configure_entropy_sources(
+                   custom_entropy_init, mbedtls_entropy_free));
 
-    TEST_EQUAL( psa_crypto_init( ), expected_init_status );
-    if( expected_init_status != PSA_SUCCESS )
+    TEST_EQUAL(psa_crypto_init(), expected_init_status);
+    if (expected_init_status != PSA_SUCCESS) {
         goto exit;
+    }
 
-    PSA_ASSERT( psa_generate_random( random, sizeof( random ) ) );
+    PSA_ASSERT(psa_generate_random(random, sizeof(random)));
 
 exit:
-    mbedtls_free( seed );
-    PSA_DONE( );
+    mbedtls_free(seed);
+    PSA_DONE();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_metadata.function b/tests/suites/test_suite_psa_crypto_metadata.function
index f2ba16a..47d60c1 100644
--- a/tests/suites/test_suite_psa_crypto_metadata.function
+++ b/tests/suites/test_suite_psa_crypto_metadata.function
@@ -16,56 +16,56 @@
  * category test macros, which are hard-coded in each
  * category-specific function. The name of the flag is the name of the
  * classification macro without the PSA_ prefix. */
-#define ALG_IS_VENDOR_DEFINED           ( 1u << 0 )
-#define ALG_IS_HMAC                     ( 1u << 1 )
-#define ALG_IS_BLOCK_CIPHER_MAC         ( 1u << 2 )
-#define ALG_IS_STREAM_CIPHER            ( 1u << 3 )
-#define ALG_IS_RSA_PKCS1V15_SIGN        ( 1u << 4 )
-#define ALG_IS_RSA_PSS                  ( 1u << 5 )
-#define ALG_IS_RSA_PSS_ANY_SALT         ( 1u << 6 )
-#define ALG_IS_RSA_PSS_STANDARD_SALT    ( 1u << 7 )
-#define ALG_IS_DSA                      ( 1u << 8 )
-#define ALG_DSA_IS_DETERMINISTIC        ( 1u << 9 )
-#define ALG_IS_DETERMINISTIC_DSA        ( 1u << 10 )
-#define ALG_IS_RANDOMIZED_DSA           ( 1u << 11 )
-#define ALG_IS_ECDSA                    ( 1u << 12 )
-#define ALG_ECDSA_IS_DETERMINISTIC      ( 1u << 13 )
-#define ALG_IS_DETERMINISTIC_ECDSA      ( 1u << 14 )
-#define ALG_IS_RANDOMIZED_ECDSA         ( 1u << 15 )
-#define ALG_IS_HASH_EDDSA               ( 1u << 16 )
-#define ALG_IS_SIGN_HASH                ( 1u << 17 )
-#define ALG_IS_HASH_AND_SIGN            ( 1u << 18 )
-#define ALG_IS_RSA_OAEP                 ( 1u << 19 )
-#define ALG_IS_HKDF                     ( 1u << 20 )
-#define ALG_IS_FFDH                     ( 1u << 21 )
-#define ALG_IS_ECDH                     ( 1u << 22 )
-#define ALG_IS_WILDCARD                 ( 1u << 23 )
-#define ALG_IS_RAW_KEY_AGREEMENT        ( 1u << 24 )
-#define ALG_IS_AEAD_ON_BLOCK_CIPHER     ( 1u << 25 )
-#define ALG_IS_TLS12_PRF                ( 1u << 26 )
-#define ALG_IS_TLS12_PSK_TO_MS          ( 1u << 27 )
-#define ALG_FLAG_MASK_PLUS_ONE          ( 1u << 28 ) /* must be last! */
+#define ALG_IS_VENDOR_DEFINED           (1u << 0)
+#define ALG_IS_HMAC                     (1u << 1)
+#define ALG_IS_BLOCK_CIPHER_MAC         (1u << 2)
+#define ALG_IS_STREAM_CIPHER            (1u << 3)
+#define ALG_IS_RSA_PKCS1V15_SIGN        (1u << 4)
+#define ALG_IS_RSA_PSS                  (1u << 5)
+#define ALG_IS_RSA_PSS_ANY_SALT         (1u << 6)
+#define ALG_IS_RSA_PSS_STANDARD_SALT    (1u << 7)
+#define ALG_IS_DSA                      (1u << 8)
+#define ALG_DSA_IS_DETERMINISTIC        (1u << 9)
+#define ALG_IS_DETERMINISTIC_DSA        (1u << 10)
+#define ALG_IS_RANDOMIZED_DSA           (1u << 11)
+#define ALG_IS_ECDSA                    (1u << 12)
+#define ALG_ECDSA_IS_DETERMINISTIC      (1u << 13)
+#define ALG_IS_DETERMINISTIC_ECDSA      (1u << 14)
+#define ALG_IS_RANDOMIZED_ECDSA         (1u << 15)
+#define ALG_IS_HASH_EDDSA               (1u << 16)
+#define ALG_IS_SIGN_HASH                (1u << 17)
+#define ALG_IS_HASH_AND_SIGN            (1u << 18)
+#define ALG_IS_RSA_OAEP                 (1u << 19)
+#define ALG_IS_HKDF                     (1u << 20)
+#define ALG_IS_FFDH                     (1u << 21)
+#define ALG_IS_ECDH                     (1u << 22)
+#define ALG_IS_WILDCARD                 (1u << 23)
+#define ALG_IS_RAW_KEY_AGREEMENT        (1u << 24)
+#define ALG_IS_AEAD_ON_BLOCK_CIPHER     (1u << 25)
+#define ALG_IS_TLS12_PRF                (1u << 26)
+#define ALG_IS_TLS12_PSK_TO_MS          (1u << 27)
+#define ALG_FLAG_MASK_PLUS_ONE          (1u << 28)   /* must be last! */
 
 /* Flags for key type classification macros. There is a flag for every
  * key type classification macro PSA_KEY_TYPE_IS_xxx except for some that
  * are tested as derived from other macros. The name of the flag is
  * the name of the classification macro without the PSA_ prefix. */
-#define KEY_TYPE_IS_VENDOR_DEFINED      ( 1u << 0 )
-#define KEY_TYPE_IS_UNSTRUCTURED        ( 1u << 1 )
-#define KEY_TYPE_IS_PUBLIC_KEY          ( 1u << 2 )
-#define KEY_TYPE_IS_KEY_PAIR            ( 1u << 3 )
-#define KEY_TYPE_IS_RSA                 ( 1u << 4 )
-#define KEY_TYPE_IS_DSA                 ( 1u << 5 )
-#define KEY_TYPE_IS_ECC                 ( 1u << 6 )
-#define KEY_TYPE_IS_DH                  ( 1u << 7 )
-#define KEY_TYPE_FLAG_MASK_PLUS_ONE     ( 1u << 8 ) /* must be last! */
+#define KEY_TYPE_IS_VENDOR_DEFINED      (1u << 0)
+#define KEY_TYPE_IS_UNSTRUCTURED        (1u << 1)
+#define KEY_TYPE_IS_PUBLIC_KEY          (1u << 2)
+#define KEY_TYPE_IS_KEY_PAIR            (1u << 3)
+#define KEY_TYPE_IS_RSA                 (1u << 4)
+#define KEY_TYPE_IS_DSA                 (1u << 5)
+#define KEY_TYPE_IS_ECC                 (1u << 6)
+#define KEY_TYPE_IS_DH                  (1u << 7)
+#define KEY_TYPE_FLAG_MASK_PLUS_ONE     (1u << 8)   /* must be last! */
 
 /* Flags for lifetime classification macros. There is a flag for every
  * lifetime classification macro PSA_KEY_LIFETIME_IS_xxx. The name of the
  * flag is the name of the classification macro without the PSA_ prefix. */
-#define KEY_LIFETIME_IS_VOLATILE        ( 1u << 0 )
-#define KEY_LIFETIME_IS_READ_ONLY       ( 1u << 1 )
-#define KEY_LIFETIME_FLAG_MASK_PLUS_ONE ( 1u << 2 ) /* must be last! */
+#define KEY_LIFETIME_IS_VOLATILE        (1u << 0)
+#define KEY_LIFETIME_IS_READ_ONLY       (1u << 1)
+#define KEY_LIFETIME_FLAG_MASK_PLUS_ONE (1u << 2)   /* must be last! */
 
 /* Check that in the value of flags, the bit flag (which should be a macro
  * expanding to a number of the form 1 << k) is set if and only if
@@ -78,19 +78,19 @@
  * Unconditionally mask flag into the ambient variable
  * classification_flags_tested.
  */
-#define TEST_CLASSIFICATION_MACRO( cond, flag, alg, flags )     \
+#define TEST_CLASSIFICATION_MACRO(cond, flag, alg, flags)     \
     do                                                          \
     {                                                           \
-        if( cond )                                              \
+        if (cond)                                              \
         {                                                       \
-            if( ( flags ) & ( flag ) )                          \
-                TEST_ASSERT( PSA_##flag( alg ) );               \
+            if ((flags) & (flag))                          \
+            TEST_ASSERT(PSA_##flag(alg));               \
             else                                                \
-                TEST_ASSERT( ! PSA_##flag( alg ) );             \
+            TEST_ASSERT(!PSA_##flag(alg));             \
         }                                                       \
-        classification_flags_tested |= ( flag );                \
+        classification_flags_tested |= (flag);                \
     }                                                           \
-    while( 0 )
+    while (0)
 
 /* Check the parity of value.
  *
@@ -104,134 +104,134 @@
  * The expected parity is even so that 0 is considered a valid encoding.
  *
  * Return a nonzero value if value has even parity and 0 otherwise. */
-int has_even_parity( uint32_t value )
+int has_even_parity(uint32_t value)
 {
     value ^= value >> 16;
     value ^= value >> 8;
     value ^= value >> 4;
-    return( 0x9669 & 1 << ( value & 0xf ) );
+    return 0x9669 & 1 << (value & 0xf);
 }
-#define TEST_PARITY( value )                    \
-    TEST_ASSERT( has_even_parity( value ) )
+#define TEST_PARITY(value)                    \
+    TEST_ASSERT(has_even_parity(value))
 
-void algorithm_classification( psa_algorithm_t alg, unsigned flags )
+void algorithm_classification(psa_algorithm_t alg, unsigned flags)
 {
     unsigned classification_flags_tested = 0;
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_VENDOR_DEFINED, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_HMAC, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_BLOCK_CIPHER_MAC, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_STREAM_CIPHER, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_RSA_PKCS1V15_SIGN, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_RSA_PSS, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_RSA_PSS_ANY_SALT, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_RSA_PSS_STANDARD_SALT, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_DSA, alg, flags );
-    TEST_CLASSIFICATION_MACRO( PSA_ALG_IS_DSA( alg ),
-                               ALG_DSA_IS_DETERMINISTIC, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_DETERMINISTIC_DSA, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_RANDOMIZED_DSA, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_ECDSA, alg, flags );
-    TEST_CLASSIFICATION_MACRO( PSA_ALG_IS_ECDSA( alg ),
-                               ALG_ECDSA_IS_DETERMINISTIC, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_DETERMINISTIC_ECDSA, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_RANDOMIZED_ECDSA, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_HASH_EDDSA, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_SIGN_HASH, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_HASH_AND_SIGN, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_RSA_OAEP, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_HKDF, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_WILDCARD, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_ECDH, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_FFDH, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_RAW_KEY_AGREEMENT, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_AEAD_ON_BLOCK_CIPHER, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_TLS12_PRF, alg, flags );
-    TEST_CLASSIFICATION_MACRO( 1, ALG_IS_TLS12_PSK_TO_MS, alg, flags );
-    TEST_EQUAL( classification_flags_tested, ALG_FLAG_MASK_PLUS_ONE - 1 );
-exit: ;
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_VENDOR_DEFINED, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_HMAC, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_BLOCK_CIPHER_MAC, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_STREAM_CIPHER, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_RSA_PKCS1V15_SIGN, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_RSA_PSS, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_RSA_PSS_ANY_SALT, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_RSA_PSS_STANDARD_SALT, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_DSA, alg, flags);
+    TEST_CLASSIFICATION_MACRO(PSA_ALG_IS_DSA(alg),
+                              ALG_DSA_IS_DETERMINISTIC, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_DETERMINISTIC_DSA, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_RANDOMIZED_DSA, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_ECDSA, alg, flags);
+    TEST_CLASSIFICATION_MACRO(PSA_ALG_IS_ECDSA(alg),
+                              ALG_ECDSA_IS_DETERMINISTIC, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_DETERMINISTIC_ECDSA, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_RANDOMIZED_ECDSA, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_HASH_EDDSA, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_SIGN_HASH, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_HASH_AND_SIGN, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_RSA_OAEP, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_HKDF, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_WILDCARD, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_ECDH, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_FFDH, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_RAW_KEY_AGREEMENT, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_AEAD_ON_BLOCK_CIPHER, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_TLS12_PRF, alg, flags);
+    TEST_CLASSIFICATION_MACRO(1, ALG_IS_TLS12_PSK_TO_MS, alg, flags);
+    TEST_EQUAL(classification_flags_tested, ALG_FLAG_MASK_PLUS_ONE - 1);
+exit:;
 }
 
-void key_type_classification( psa_key_type_t type, unsigned flags )
+void key_type_classification(psa_key_type_t type, unsigned flags)
 {
     unsigned classification_flags_tested = 0;
 
     /* Macros tested based on the test case parameter */
-    TEST_CLASSIFICATION_MACRO( 1, KEY_TYPE_IS_VENDOR_DEFINED, type, flags );
-    TEST_CLASSIFICATION_MACRO( 1, KEY_TYPE_IS_UNSTRUCTURED, type, flags );
-    TEST_CLASSIFICATION_MACRO( 1, KEY_TYPE_IS_PUBLIC_KEY, type, flags );
-    TEST_CLASSIFICATION_MACRO( 1, KEY_TYPE_IS_KEY_PAIR, type, flags );
-    TEST_CLASSIFICATION_MACRO( 1, KEY_TYPE_IS_RSA, type, flags );
-    TEST_CLASSIFICATION_MACRO( 1, KEY_TYPE_IS_DSA, type, flags );
-    TEST_CLASSIFICATION_MACRO( 1, KEY_TYPE_IS_ECC, type, flags );
-    TEST_CLASSIFICATION_MACRO( 1, KEY_TYPE_IS_DH, type, flags );
-    TEST_EQUAL( classification_flags_tested, KEY_TYPE_FLAG_MASK_PLUS_ONE - 1 );
+    TEST_CLASSIFICATION_MACRO(1, KEY_TYPE_IS_VENDOR_DEFINED, type, flags);
+    TEST_CLASSIFICATION_MACRO(1, KEY_TYPE_IS_UNSTRUCTURED, type, flags);
+    TEST_CLASSIFICATION_MACRO(1, KEY_TYPE_IS_PUBLIC_KEY, type, flags);
+    TEST_CLASSIFICATION_MACRO(1, KEY_TYPE_IS_KEY_PAIR, type, flags);
+    TEST_CLASSIFICATION_MACRO(1, KEY_TYPE_IS_RSA, type, flags);
+    TEST_CLASSIFICATION_MACRO(1, KEY_TYPE_IS_DSA, type, flags);
+    TEST_CLASSIFICATION_MACRO(1, KEY_TYPE_IS_ECC, type, flags);
+    TEST_CLASSIFICATION_MACRO(1, KEY_TYPE_IS_DH, type, flags);
+    TEST_EQUAL(classification_flags_tested, KEY_TYPE_FLAG_MASK_PLUS_ONE - 1);
 
     /* Macros with derived semantics */
-    TEST_EQUAL( PSA_KEY_TYPE_IS_ASYMMETRIC( type ),
-                ( PSA_KEY_TYPE_IS_PUBLIC_KEY( type ) ||
-                  PSA_KEY_TYPE_IS_KEY_PAIR( type ) ) );
-    TEST_EQUAL( PSA_KEY_TYPE_IS_ECC_KEY_PAIR( type ),
-                ( PSA_KEY_TYPE_IS_ECC( type ) &&
-                  PSA_KEY_TYPE_IS_KEY_PAIR( type ) ) );
-    TEST_EQUAL( PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY( type ),
-                ( PSA_KEY_TYPE_IS_ECC( type ) &&
-                  PSA_KEY_TYPE_IS_PUBLIC_KEY( type ) ) );
-    TEST_EQUAL( PSA_KEY_TYPE_IS_DH_KEY_PAIR( type ),
-                ( PSA_KEY_TYPE_IS_DH( type ) &&
-                  PSA_KEY_TYPE_IS_KEY_PAIR( type ) ) );
-    TEST_EQUAL( PSA_KEY_TYPE_IS_DH_PUBLIC_KEY( type ),
-                ( PSA_KEY_TYPE_IS_DH( type ) &&
-                  PSA_KEY_TYPE_IS_PUBLIC_KEY( type ) ) );
+    TEST_EQUAL(PSA_KEY_TYPE_IS_ASYMMETRIC(type),
+               (PSA_KEY_TYPE_IS_PUBLIC_KEY(type) ||
+                PSA_KEY_TYPE_IS_KEY_PAIR(type)));
+    TEST_EQUAL(PSA_KEY_TYPE_IS_ECC_KEY_PAIR(type),
+               (PSA_KEY_TYPE_IS_ECC(type) &&
+                PSA_KEY_TYPE_IS_KEY_PAIR(type)));
+    TEST_EQUAL(PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY(type),
+               (PSA_KEY_TYPE_IS_ECC(type) &&
+                PSA_KEY_TYPE_IS_PUBLIC_KEY(type)));
+    TEST_EQUAL(PSA_KEY_TYPE_IS_DH_KEY_PAIR(type),
+               (PSA_KEY_TYPE_IS_DH(type) &&
+                PSA_KEY_TYPE_IS_KEY_PAIR(type)));
+    TEST_EQUAL(PSA_KEY_TYPE_IS_DH_PUBLIC_KEY(type),
+               (PSA_KEY_TYPE_IS_DH(type) &&
+                PSA_KEY_TYPE_IS_PUBLIC_KEY(type)));
 
-    TEST_PARITY( type );
+    TEST_PARITY(type);
 
-exit: ;
+exit:;
 }
 
-void mac_algorithm_core( psa_algorithm_t alg, int classification_flags,
-                         psa_key_type_t key_type, size_t key_bits,
-                         size_t length )
+void mac_algorithm_core(psa_algorithm_t alg, int classification_flags,
+                        psa_key_type_t key_type, size_t key_bits,
+                        size_t length)
 {
     /* Algorithm classification */
-    TEST_ASSERT( ! PSA_ALG_IS_HASH( alg ) );
-    TEST_ASSERT( PSA_ALG_IS_MAC( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_CIPHER( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_AEAD( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_SIGN( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_ASYMMETRIC_ENCRYPTION( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_KEY_AGREEMENT( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_KEY_DERIVATION( alg ) );
-    algorithm_classification( alg, classification_flags );
+    TEST_ASSERT(!PSA_ALG_IS_HASH(alg));
+    TEST_ASSERT(PSA_ALG_IS_MAC(alg));
+    TEST_ASSERT(!PSA_ALG_IS_CIPHER(alg));
+    TEST_ASSERT(!PSA_ALG_IS_AEAD(alg));
+    TEST_ASSERT(!PSA_ALG_IS_SIGN(alg));
+    TEST_ASSERT(!PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg));
+    TEST_ASSERT(!PSA_ALG_IS_KEY_AGREEMENT(alg));
+    TEST_ASSERT(!PSA_ALG_IS_KEY_DERIVATION(alg));
+    algorithm_classification(alg, classification_flags);
 
     /* Length */
-    TEST_EQUAL( length, PSA_MAC_LENGTH( key_type, key_bits, alg ) );
+    TEST_EQUAL(length, PSA_MAC_LENGTH(key_type, key_bits, alg));
 
 #if defined(MBEDTLS_TEST_HOOKS) && defined(MBEDTLS_PSA_CRYPTO_C)
-    PSA_ASSERT( psa_mac_key_can_do( alg, key_type ) );
+    PSA_ASSERT(psa_mac_key_can_do(alg, key_type));
 #endif
 
-exit: ;
+exit:;
 }
 
-void aead_algorithm_core( psa_algorithm_t alg, int classification_flags,
-                          psa_key_type_t key_type, size_t key_bits,
-                          size_t tag_length )
+void aead_algorithm_core(psa_algorithm_t alg, int classification_flags,
+                         psa_key_type_t key_type, size_t key_bits,
+                         size_t tag_length)
 {
     /* Algorithm classification */
-    TEST_ASSERT( ! PSA_ALG_IS_HASH( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_MAC( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_CIPHER( alg ) );
-    TEST_ASSERT( PSA_ALG_IS_AEAD( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_SIGN( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_ASYMMETRIC_ENCRYPTION( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_KEY_AGREEMENT( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_KEY_DERIVATION( alg ) );
-    algorithm_classification( alg, classification_flags );
+    TEST_ASSERT(!PSA_ALG_IS_HASH(alg));
+    TEST_ASSERT(!PSA_ALG_IS_MAC(alg));
+    TEST_ASSERT(!PSA_ALG_IS_CIPHER(alg));
+    TEST_ASSERT(PSA_ALG_IS_AEAD(alg));
+    TEST_ASSERT(!PSA_ALG_IS_SIGN(alg));
+    TEST_ASSERT(!PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg));
+    TEST_ASSERT(!PSA_ALG_IS_KEY_AGREEMENT(alg));
+    TEST_ASSERT(!PSA_ALG_IS_KEY_DERIVATION(alg));
+    algorithm_classification(alg, classification_flags);
 
     /* Tag length */
-    TEST_EQUAL( tag_length, PSA_AEAD_TAG_LENGTH( key_type, key_bits, alg ) );
+    TEST_EQUAL(tag_length, PSA_AEAD_TAG_LENGTH(key_type, key_bits, alg));
 
-exit: ;
+exit:;
 }
 
 /* END_HEADER */
@@ -242,52 +242,52 @@
  */
 
 /* BEGIN_CASE */
-void hash_algorithm( int alg_arg, int length_arg )
+void hash_algorithm(int alg_arg, int length_arg)
 {
     psa_algorithm_t alg = alg_arg;
     size_t length = length_arg;
-    psa_algorithm_t hmac_alg = PSA_ALG_HMAC( alg );
-    psa_algorithm_t rsa_pkcs1v15_sign_alg = PSA_ALG_RSA_PKCS1V15_SIGN( alg );
-    psa_algorithm_t rsa_pss_alg = PSA_ALG_RSA_PSS( alg );
-    psa_algorithm_t dsa_alg = PSA_ALG_DSA( alg );
-    psa_algorithm_t deterministic_dsa_alg = PSA_ALG_DETERMINISTIC_DSA( alg );
-    psa_algorithm_t ecdsa_alg = PSA_ALG_ECDSA( alg );
-    psa_algorithm_t deterministic_ecdsa_alg = PSA_ALG_DETERMINISTIC_ECDSA( alg );
-    psa_algorithm_t rsa_oaep_alg = PSA_ALG_RSA_OAEP( alg );
-    psa_algorithm_t hkdf_alg = PSA_ALG_HKDF( alg );
+    psa_algorithm_t hmac_alg = PSA_ALG_HMAC(alg);
+    psa_algorithm_t rsa_pkcs1v15_sign_alg = PSA_ALG_RSA_PKCS1V15_SIGN(alg);
+    psa_algorithm_t rsa_pss_alg = PSA_ALG_RSA_PSS(alg);
+    psa_algorithm_t dsa_alg = PSA_ALG_DSA(alg);
+    psa_algorithm_t deterministic_dsa_alg = PSA_ALG_DETERMINISTIC_DSA(alg);
+    psa_algorithm_t ecdsa_alg = PSA_ALG_ECDSA(alg);
+    psa_algorithm_t deterministic_ecdsa_alg = PSA_ALG_DETERMINISTIC_ECDSA(alg);
+    psa_algorithm_t rsa_oaep_alg = PSA_ALG_RSA_OAEP(alg);
+    psa_algorithm_t hkdf_alg = PSA_ALG_HKDF(alg);
 
     /* Algorithm classification */
-    TEST_ASSERT( PSA_ALG_IS_HASH( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_MAC( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_CIPHER( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_AEAD( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_SIGN( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_ASYMMETRIC_ENCRYPTION( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_KEY_AGREEMENT( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_KEY_DERIVATION( alg ) );
-    algorithm_classification( alg, 0 );
+    TEST_ASSERT(PSA_ALG_IS_HASH(alg));
+    TEST_ASSERT(!PSA_ALG_IS_MAC(alg));
+    TEST_ASSERT(!PSA_ALG_IS_CIPHER(alg));
+    TEST_ASSERT(!PSA_ALG_IS_AEAD(alg));
+    TEST_ASSERT(!PSA_ALG_IS_SIGN(alg));
+    TEST_ASSERT(!PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg));
+    TEST_ASSERT(!PSA_ALG_IS_KEY_AGREEMENT(alg));
+    TEST_ASSERT(!PSA_ALG_IS_KEY_DERIVATION(alg));
+    algorithm_classification(alg, 0);
 
     /* Dependent algorithms */
-    TEST_EQUAL( PSA_ALG_HMAC_GET_HASH( hmac_alg ), alg );
-    TEST_EQUAL( PSA_ALG_SIGN_GET_HASH( rsa_pkcs1v15_sign_alg ), alg );
-    TEST_EQUAL( PSA_ALG_SIGN_GET_HASH( rsa_pss_alg ), alg );
-    TEST_EQUAL( PSA_ALG_SIGN_GET_HASH( dsa_alg ), alg );
-    TEST_EQUAL( PSA_ALG_SIGN_GET_HASH( deterministic_dsa_alg ), alg );
-    TEST_EQUAL( PSA_ALG_SIGN_GET_HASH( ecdsa_alg ), alg );
-    TEST_EQUAL( PSA_ALG_SIGN_GET_HASH( deterministic_ecdsa_alg ), alg );
-    TEST_EQUAL( PSA_ALG_RSA_OAEP_GET_HASH( rsa_oaep_alg ), alg );
-    TEST_EQUAL( PSA_ALG_HKDF_GET_HASH( hkdf_alg ), alg );
+    TEST_EQUAL(PSA_ALG_HMAC_GET_HASH(hmac_alg), alg);
+    TEST_EQUAL(PSA_ALG_SIGN_GET_HASH(rsa_pkcs1v15_sign_alg), alg);
+    TEST_EQUAL(PSA_ALG_SIGN_GET_HASH(rsa_pss_alg), alg);
+    TEST_EQUAL(PSA_ALG_SIGN_GET_HASH(dsa_alg), alg);
+    TEST_EQUAL(PSA_ALG_SIGN_GET_HASH(deterministic_dsa_alg), alg);
+    TEST_EQUAL(PSA_ALG_SIGN_GET_HASH(ecdsa_alg), alg);
+    TEST_EQUAL(PSA_ALG_SIGN_GET_HASH(deterministic_ecdsa_alg), alg);
+    TEST_EQUAL(PSA_ALG_RSA_OAEP_GET_HASH(rsa_oaep_alg), alg);
+    TEST_EQUAL(PSA_ALG_HKDF_GET_HASH(hkdf_alg), alg);
 
     /* Hash length */
-    TEST_EQUAL( length, PSA_HASH_LENGTH( alg ) );
-    TEST_ASSERT( length <= PSA_HASH_MAX_SIZE );
+    TEST_EQUAL(length, PSA_HASH_LENGTH(alg));
+    TEST_ASSERT(length <= PSA_HASH_MAX_SIZE);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mac_algorithm( int alg_arg, int classification_flags,
-                    int length_arg,
-                    int key_type_arg, int key_bits_arg )
+void mac_algorithm(int alg_arg, int classification_flags,
+                   int length_arg,
+                   int key_type_arg, int key_bits_arg)
 {
     psa_algorithm_t alg = alg_arg;
     size_t length = length_arg;
@@ -295,127 +295,124 @@
     size_t key_type = key_type_arg;
     size_t key_bits = key_bits_arg;
 
-    mac_algorithm_core( alg, classification_flags,
-                        key_type, key_bits, length );
-    TEST_EQUAL( PSA_ALG_FULL_LENGTH_MAC( alg ), alg );
-    TEST_ASSERT( length <= PSA_MAC_MAX_SIZE );
+    mac_algorithm_core(alg, classification_flags,
+                       key_type, key_bits, length);
+    TEST_EQUAL(PSA_ALG_FULL_LENGTH_MAC(alg), alg);
+    TEST_ASSERT(length <= PSA_MAC_MAX_SIZE);
 
     /* Truncated versions */
-    for( n = 1; n <= length; n++ )
-    {
-        psa_algorithm_t truncated_alg = PSA_ALG_TRUNCATED_MAC( alg, n );
-        mac_algorithm_core( truncated_alg, classification_flags,
-                            key_type, key_bits, n );
-        TEST_EQUAL( PSA_ALG_FULL_LENGTH_MAC( truncated_alg ), alg );
+    for (n = 1; n <= length; n++) {
+        psa_algorithm_t truncated_alg = PSA_ALG_TRUNCATED_MAC(alg, n);
+        mac_algorithm_core(truncated_alg, classification_flags,
+                           key_type, key_bits, n);
+        TEST_EQUAL(PSA_ALG_FULL_LENGTH_MAC(truncated_alg), alg);
         /* Check that calling PSA_ALG_TRUNCATED_MAC twice gives the length
          * of the outer truncation (even if the outer length is smaller than
          * the inner length). */
-        TEST_EQUAL( PSA_ALG_TRUNCATED_MAC( truncated_alg, 1 ),
-                    PSA_ALG_TRUNCATED_MAC( alg, 1 ) );
-        TEST_EQUAL( PSA_ALG_TRUNCATED_MAC( truncated_alg, length - 1 ),
-                    PSA_ALG_TRUNCATED_MAC( alg, length - 1) );
-        TEST_EQUAL( PSA_ALG_TRUNCATED_MAC( truncated_alg, length ),
-                    PSA_ALG_TRUNCATED_MAC( alg, length ) );
+        TEST_EQUAL(PSA_ALG_TRUNCATED_MAC(truncated_alg, 1),
+                   PSA_ALG_TRUNCATED_MAC(alg, 1));
+        TEST_EQUAL(PSA_ALG_TRUNCATED_MAC(truncated_alg, length - 1),
+                   PSA_ALG_TRUNCATED_MAC(alg, length - 1));
+        TEST_EQUAL(PSA_ALG_TRUNCATED_MAC(truncated_alg, length),
+                   PSA_ALG_TRUNCATED_MAC(alg, length));
 
         /* Check that calling PSA_ALG_TRUNCATED_MAC on an algorithm
          * earlier constructed with PSA_ALG_AT_LEAST_THIS_LENGTH_MAC gives the
          * length of the outer truncation (even if the outer length is smaller
          * than the inner length). */
-        TEST_EQUAL( PSA_ALG_TRUNCATED_MAC(
-                        PSA_ALG_AT_LEAST_THIS_LENGTH_MAC( truncated_alg, n ), 1 ),
-                    PSA_ALG_TRUNCATED_MAC( alg, 1 ) );
-        TEST_EQUAL( PSA_ALG_TRUNCATED_MAC(
-                        PSA_ALG_AT_LEAST_THIS_LENGTH_MAC( truncated_alg, n ), length - 1 ),
-                    PSA_ALG_TRUNCATED_MAC( alg, length - 1) );
-        TEST_EQUAL( PSA_ALG_TRUNCATED_MAC(
-                        PSA_ALG_AT_LEAST_THIS_LENGTH_MAC( truncated_alg, n ), length ),
-                    PSA_ALG_TRUNCATED_MAC( alg, length ) );
+        TEST_EQUAL(PSA_ALG_TRUNCATED_MAC(
+                       PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(truncated_alg, n), 1),
+                   PSA_ALG_TRUNCATED_MAC(alg, 1));
+        TEST_EQUAL(PSA_ALG_TRUNCATED_MAC(
+                       PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(truncated_alg, n), length - 1),
+                   PSA_ALG_TRUNCATED_MAC(alg, length - 1));
+        TEST_EQUAL(PSA_ALG_TRUNCATED_MAC(
+                       PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(truncated_alg, n), length),
+                   PSA_ALG_TRUNCATED_MAC(alg, length));
     }
 
     /* At-leat-this-length versions */
-    for( n = 1; n <= length; n++ )
-    {
-        psa_algorithm_t policy_alg = PSA_ALG_AT_LEAST_THIS_LENGTH_MAC( alg, n );
-        mac_algorithm_core( policy_alg, classification_flags | ALG_IS_WILDCARD,
-                            key_type, key_bits, n );
-        TEST_EQUAL( PSA_ALG_FULL_LENGTH_MAC( policy_alg ), alg );
+    for (n = 1; n <= length; n++) {
+        psa_algorithm_t policy_alg = PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(alg, n);
+        mac_algorithm_core(policy_alg, classification_flags | ALG_IS_WILDCARD,
+                           key_type, key_bits, n);
+        TEST_EQUAL(PSA_ALG_FULL_LENGTH_MAC(policy_alg), alg);
         /* Check that calling PSA_ALG_AT_LEAST_THIS_LENGTH_MAC twice gives the
          * length of the outer truncation (even if the outer length is smaller
          * than the inner length). */
-        TEST_EQUAL( PSA_ALG_AT_LEAST_THIS_LENGTH_MAC( policy_alg, 1 ),
-                    PSA_ALG_AT_LEAST_THIS_LENGTH_MAC( alg, 1 ) );
-        TEST_EQUAL( PSA_ALG_AT_LEAST_THIS_LENGTH_MAC( policy_alg, length - 1 ),
-                    PSA_ALG_AT_LEAST_THIS_LENGTH_MAC( alg, length - 1) );
-        TEST_EQUAL( PSA_ALG_AT_LEAST_THIS_LENGTH_MAC( policy_alg, length ),
-                    PSA_ALG_AT_LEAST_THIS_LENGTH_MAC( alg, length ) );
+        TEST_EQUAL(PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(policy_alg, 1),
+                   PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(alg, 1));
+        TEST_EQUAL(PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(policy_alg, length - 1),
+                   PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(alg, length - 1));
+        TEST_EQUAL(PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(policy_alg, length),
+                   PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(alg, length));
 
         /* Check that calling PSA_ALG_AT_LEAST_THIS_LENGTH_MAC on an algorithm
          * earlier constructed with PSA_ALG_TRUNCATED_MAC gives the length of
          * the outer truncation (even if the outer length is smaller than the
          * inner length). */
-        TEST_EQUAL( PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(
-                        PSA_ALG_TRUNCATED_MAC( policy_alg, n ), 1),
-                    PSA_ALG_AT_LEAST_THIS_LENGTH_MAC( alg, 1 ) );
-        TEST_EQUAL( PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(
-                        PSA_ALG_TRUNCATED_MAC( policy_alg, n ), length - 1 ),
-                    PSA_ALG_AT_LEAST_THIS_LENGTH_MAC( alg, length - 1) );
-        TEST_EQUAL( PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(
-                        PSA_ALG_TRUNCATED_MAC( policy_alg, n ), length ),
-                    PSA_ALG_AT_LEAST_THIS_LENGTH_MAC( alg, length ) );
+        TEST_EQUAL(PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(
+                       PSA_ALG_TRUNCATED_MAC(policy_alg, n), 1),
+                   PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(alg, 1));
+        TEST_EQUAL(PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(
+                       PSA_ALG_TRUNCATED_MAC(policy_alg, n), length - 1),
+                   PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(alg, length - 1));
+        TEST_EQUAL(PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(
+                       PSA_ALG_TRUNCATED_MAC(policy_alg, n), length),
+                   PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(alg, length));
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void hmac_algorithm( int alg_arg,
-                     int length_arg,
-                     int block_size_arg )
+void hmac_algorithm(int alg_arg,
+                    int length_arg,
+                    int block_size_arg)
 {
     psa_algorithm_t alg = alg_arg;
-    psa_algorithm_t hash_alg = PSA_ALG_HMAC_GET_HASH( alg );
+    psa_algorithm_t hash_alg = PSA_ALG_HMAC_GET_HASH(alg);
     size_t block_size = block_size_arg;
     size_t length = length_arg;
     size_t n;
 
-    TEST_ASSERT( PSA_ALG_IS_HASH( hash_alg ) );
-    TEST_EQUAL( PSA_ALG_HMAC( hash_alg ), alg );
+    TEST_ASSERT(PSA_ALG_IS_HASH(hash_alg));
+    TEST_EQUAL(PSA_ALG_HMAC(hash_alg), alg);
 
-    TEST_ASSERT( block_size == PSA_HASH_BLOCK_LENGTH( alg ) );
-    TEST_ASSERT( block_size <= PSA_HMAC_MAX_HASH_BLOCK_SIZE );
+    TEST_ASSERT(block_size == PSA_HASH_BLOCK_LENGTH(alg));
+    TEST_ASSERT(block_size <= PSA_HMAC_MAX_HASH_BLOCK_SIZE);
 
-    test_mac_algorithm( alg_arg, ALG_IS_HMAC, length,
-                        PSA_KEY_TYPE_HMAC, PSA_BYTES_TO_BITS( length ) );
+    test_mac_algorithm(alg_arg, ALG_IS_HMAC, length,
+                       PSA_KEY_TYPE_HMAC, PSA_BYTES_TO_BITS(length));
 
-    for( n = 1; n <= length; n++ )
-    {
-        psa_algorithm_t truncated_alg = PSA_ALG_TRUNCATED_MAC( alg, n );
-        TEST_EQUAL( PSA_ALG_HMAC_GET_HASH( truncated_alg ), hash_alg );
+    for (n = 1; n <= length; n++) {
+        psa_algorithm_t truncated_alg = PSA_ALG_TRUNCATED_MAC(alg, n);
+        TEST_EQUAL(PSA_ALG_HMAC_GET_HASH(truncated_alg), hash_alg);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_algorithm( int alg_arg, int classification_flags )
+void cipher_algorithm(int alg_arg, int classification_flags)
 {
     psa_algorithm_t alg = alg_arg;
 
     /* Algorithm classification */
-    TEST_ASSERT( ! PSA_ALG_IS_HASH( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_MAC( alg ) );
-    TEST_ASSERT( PSA_ALG_IS_CIPHER( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_AEAD( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_SIGN( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_ASYMMETRIC_ENCRYPTION( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_KEY_AGREEMENT( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_KEY_DERIVATION( alg ) );
-    algorithm_classification( alg, classification_flags );
+    TEST_ASSERT(!PSA_ALG_IS_HASH(alg));
+    TEST_ASSERT(!PSA_ALG_IS_MAC(alg));
+    TEST_ASSERT(PSA_ALG_IS_CIPHER(alg));
+    TEST_ASSERT(!PSA_ALG_IS_AEAD(alg));
+    TEST_ASSERT(!PSA_ALG_IS_SIGN(alg));
+    TEST_ASSERT(!PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg));
+    TEST_ASSERT(!PSA_ALG_IS_KEY_AGREEMENT(alg));
+    TEST_ASSERT(!PSA_ALG_IS_KEY_DERIVATION(alg));
+    algorithm_classification(alg, classification_flags);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void aead_algorithm( int alg_arg, int classification_flags,
-                     int tag_length_arg,
-                     int key_type_arg, int key_bits_arg )
+void aead_algorithm(int alg_arg, int classification_flags,
+                    int tag_length_arg,
+                    int key_type_arg, int key_bits_arg)
 {
     psa_algorithm_t alg = alg_arg;
     size_t tag_length = tag_length_arg;
@@ -423,102 +420,101 @@
     psa_key_type_t key_type = key_type_arg;
     size_t key_bits = key_bits_arg;
 
-    aead_algorithm_core( alg, classification_flags,
-                         key_type, key_bits, tag_length );
+    aead_algorithm_core(alg, classification_flags,
+                        key_type, key_bits, tag_length);
 
     /* Truncated versions */
-    for( n = 1; n <= tag_length; n++ )
-    {
-        psa_algorithm_t truncated_alg = PSA_ALG_AEAD_WITH_SHORTENED_TAG( alg, n );
-        aead_algorithm_core( truncated_alg, classification_flags,
-                             key_type, key_bits, n );
-        TEST_EQUAL( PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG( truncated_alg ),
-                    alg );
+    for (n = 1; n <= tag_length; n++) {
+        psa_algorithm_t truncated_alg = PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, n);
+        aead_algorithm_core(truncated_alg, classification_flags,
+                            key_type, key_bits, n);
+        TEST_EQUAL(PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(truncated_alg),
+                   alg);
         /* Check that calling PSA_ALG_AEAD_WITH_SHORTENED_TAG twice gives
          * the length of the outer truncation (even if the outer length is
          * smaller than the inner length). */
-        TEST_EQUAL( PSA_ALG_AEAD_WITH_SHORTENED_TAG( truncated_alg, 1 ),
-                    PSA_ALG_AEAD_WITH_SHORTENED_TAG( alg, 1 ) );
-        TEST_EQUAL( PSA_ALG_AEAD_WITH_SHORTENED_TAG( truncated_alg, tag_length - 1 ),
-                    PSA_ALG_AEAD_WITH_SHORTENED_TAG( alg, tag_length - 1) );
-        TEST_EQUAL( PSA_ALG_AEAD_WITH_SHORTENED_TAG( truncated_alg, tag_length ),
-                    PSA_ALG_AEAD_WITH_SHORTENED_TAG( alg, tag_length ) );
+        TEST_EQUAL(PSA_ALG_AEAD_WITH_SHORTENED_TAG(truncated_alg, 1),
+                   PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, 1));
+        TEST_EQUAL(PSA_ALG_AEAD_WITH_SHORTENED_TAG(truncated_alg, tag_length - 1),
+                   PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, tag_length - 1));
+        TEST_EQUAL(PSA_ALG_AEAD_WITH_SHORTENED_TAG(truncated_alg, tag_length),
+                   PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, tag_length));
 
         /* Check that calling PSA_ALG_AEAD_WITH_SHORTENED_TAG on an algorithm
          * earlier constructed with PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG
          * gives the length of the outer truncation (even if the outer length is
          * smaller than the inner length). */
-        TEST_EQUAL( PSA_ALG_AEAD_WITH_SHORTENED_TAG(
-                        PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG( truncated_alg, n ), 1 ),
-                    PSA_ALG_AEAD_WITH_SHORTENED_TAG( alg, 1 ) );
-        TEST_EQUAL( PSA_ALG_AEAD_WITH_SHORTENED_TAG(
-                        PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG( truncated_alg, n ), tag_length - 1 ),
-                    PSA_ALG_AEAD_WITH_SHORTENED_TAG( alg, tag_length - 1) );
-        TEST_EQUAL( PSA_ALG_AEAD_WITH_SHORTENED_TAG(
-                        PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG( truncated_alg, n ), tag_length ),
-                    PSA_ALG_AEAD_WITH_SHORTENED_TAG( alg, tag_length ) );
+        TEST_EQUAL(PSA_ALG_AEAD_WITH_SHORTENED_TAG(
+                       PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(truncated_alg, n), 1),
+                   PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, 1));
+        TEST_EQUAL(PSA_ALG_AEAD_WITH_SHORTENED_TAG(
+                       PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(truncated_alg,
+                                                                  n), tag_length - 1),
+                   PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, tag_length - 1));
+        TEST_EQUAL(PSA_ALG_AEAD_WITH_SHORTENED_TAG(
+                       PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(truncated_alg, n), tag_length),
+                   PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, tag_length));
     }
 
     /* At-leat-this-length versions */
-    for( n = 1; n <= tag_length; n++ )
-    {
-        psa_algorithm_t policy_alg = PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG( alg, n );
-        aead_algorithm_core( policy_alg, classification_flags | ALG_IS_WILDCARD,
-                             key_type, key_bits, n );
-        TEST_EQUAL( PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG( policy_alg ),
-                    alg );
+    for (n = 1; n <= tag_length; n++) {
+        psa_algorithm_t policy_alg = PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(alg, n);
+        aead_algorithm_core(policy_alg, classification_flags | ALG_IS_WILDCARD,
+                            key_type, key_bits, n);
+        TEST_EQUAL(PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(policy_alg),
+                   alg);
         /* Check that calling PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG twice
          * gives the length of the outer truncation (even if the outer length is
          * smaller than the inner length). */
-        TEST_EQUAL( PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG( policy_alg, 1 ),
-                    PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG( alg, 1 ) );
-        TEST_EQUAL( PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG( policy_alg, tag_length - 1 ),
-                    PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG( alg, tag_length - 1) );
-        TEST_EQUAL( PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG( policy_alg, tag_length ),
-                    PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG( alg, tag_length ) );
+        TEST_EQUAL(PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(policy_alg, 1),
+                   PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(alg, 1));
+        TEST_EQUAL(PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(policy_alg, tag_length - 1),
+                   PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(alg, tag_length - 1));
+        TEST_EQUAL(PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(policy_alg, tag_length),
+                   PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(alg, tag_length));
 
         /* Check that calling PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG on an
          * algorithm earlier constructed with PSA_ALG_AEAD_WITH_SHORTENED_TAG
          * gives the length of the outer truncation (even if the outer length is
          * smaller than the inner length). */
-        TEST_EQUAL( PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(
-                        PSA_ALG_AEAD_WITH_SHORTENED_TAG( policy_alg, n ), 1),
-                    PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG( alg, 1 ) );
-        TEST_EQUAL( PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(
-                        PSA_ALG_AEAD_WITH_SHORTENED_TAG( policy_alg, n ), tag_length - 1 ),
-                    PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG( alg, tag_length - 1) );
-        TEST_EQUAL( PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(
-                        PSA_ALG_AEAD_WITH_SHORTENED_TAG( policy_alg, n ), tag_length ),
-                    PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG( alg, tag_length ) );
+        TEST_EQUAL(PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(
+                       PSA_ALG_AEAD_WITH_SHORTENED_TAG(policy_alg, n), 1),
+                   PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(alg, 1));
+        TEST_EQUAL(PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(
+                       PSA_ALG_AEAD_WITH_SHORTENED_TAG(policy_alg, n), tag_length - 1),
+                   PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(alg, tag_length - 1));
+        TEST_EQUAL(PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(
+                       PSA_ALG_AEAD_WITH_SHORTENED_TAG(policy_alg, n), tag_length),
+                   PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(alg, tag_length));
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void asymmetric_signature_algorithm( int alg_arg, int classification_flags )
+void asymmetric_signature_algorithm(int alg_arg, int classification_flags)
 {
     psa_algorithm_t alg = alg_arg;
 
     /* Algorithm classification */
-    TEST_ASSERT( ! PSA_ALG_IS_HASH( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_MAC( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_CIPHER( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_AEAD( alg ) );
-    TEST_ASSERT( PSA_ALG_IS_SIGN( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_ASYMMETRIC_ENCRYPTION( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_KEY_AGREEMENT( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_KEY_DERIVATION( alg ) );
-    algorithm_classification( alg, classification_flags );
+    TEST_ASSERT(!PSA_ALG_IS_HASH(alg));
+    TEST_ASSERT(!PSA_ALG_IS_MAC(alg));
+    TEST_ASSERT(!PSA_ALG_IS_CIPHER(alg));
+    TEST_ASSERT(!PSA_ALG_IS_AEAD(alg));
+    TEST_ASSERT(PSA_ALG_IS_SIGN(alg));
+    TEST_ASSERT(!PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg));
+    TEST_ASSERT(!PSA_ALG_IS_KEY_AGREEMENT(alg));
+    TEST_ASSERT(!PSA_ALG_IS_KEY_DERIVATION(alg));
+    algorithm_classification(alg, classification_flags);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void asymmetric_signature_wildcard( int alg_arg, int classification_flags )
+void asymmetric_signature_wildcard(int alg_arg, int classification_flags)
 {
     classification_flags |= ALG_IS_WILDCARD;
     classification_flags |= ALG_IS_SIGN_HASH;
     classification_flags |= ALG_IS_HASH_AND_SIGN;
-    test_asymmetric_signature_algorithm( alg_arg, classification_flags );
+    test_asymmetric_signature_algorithm(alg_arg, classification_flags);
     /* Any failure of this test function comes from
      * asymmetric_signature_algorithm. Pacify -Werror=unused-label. */
     goto exit;
@@ -526,175 +522,173 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void asymmetric_encryption_algorithm( int alg_arg, int classification_flags )
+void asymmetric_encryption_algorithm(int alg_arg, int classification_flags)
 {
     psa_algorithm_t alg = alg_arg;
 
     /* Algorithm classification */
-    TEST_ASSERT( ! PSA_ALG_IS_HASH( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_MAC( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_CIPHER( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_AEAD( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_SIGN( alg ) );
-    TEST_ASSERT( PSA_ALG_IS_ASYMMETRIC_ENCRYPTION( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_KEY_AGREEMENT( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_KEY_DERIVATION( alg ) );
-    algorithm_classification( alg, classification_flags );
+    TEST_ASSERT(!PSA_ALG_IS_HASH(alg));
+    TEST_ASSERT(!PSA_ALG_IS_MAC(alg));
+    TEST_ASSERT(!PSA_ALG_IS_CIPHER(alg));
+    TEST_ASSERT(!PSA_ALG_IS_AEAD(alg));
+    TEST_ASSERT(!PSA_ALG_IS_SIGN(alg));
+    TEST_ASSERT(PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg));
+    TEST_ASSERT(!PSA_ALG_IS_KEY_AGREEMENT(alg));
+    TEST_ASSERT(!PSA_ALG_IS_KEY_DERIVATION(alg));
+    algorithm_classification(alg, classification_flags);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void key_derivation_algorithm( int alg_arg, int classification_flags )
+void key_derivation_algorithm(int alg_arg, int classification_flags)
 {
     psa_algorithm_t alg = alg_arg;
-    psa_algorithm_t ecdh_alg = PSA_ALG_KEY_AGREEMENT( PSA_ALG_ECDH, alg );
-    psa_algorithm_t ffdh_alg = PSA_ALG_KEY_AGREEMENT( PSA_ALG_FFDH, alg );
+    psa_algorithm_t ecdh_alg = PSA_ALG_KEY_AGREEMENT(PSA_ALG_ECDH, alg);
+    psa_algorithm_t ffdh_alg = PSA_ALG_KEY_AGREEMENT(PSA_ALG_FFDH, alg);
 
     /* Algorithm classification */
-    TEST_ASSERT( ! PSA_ALG_IS_HASH( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_MAC( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_CIPHER( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_AEAD( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_SIGN( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_ASYMMETRIC_ENCRYPTION( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_KEY_AGREEMENT( alg ) );
-    TEST_ASSERT( PSA_ALG_IS_KEY_DERIVATION( alg ) );
-    algorithm_classification( alg, classification_flags );
+    TEST_ASSERT(!PSA_ALG_IS_HASH(alg));
+    TEST_ASSERT(!PSA_ALG_IS_MAC(alg));
+    TEST_ASSERT(!PSA_ALG_IS_CIPHER(alg));
+    TEST_ASSERT(!PSA_ALG_IS_AEAD(alg));
+    TEST_ASSERT(!PSA_ALG_IS_SIGN(alg));
+    TEST_ASSERT(!PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg));
+    TEST_ASSERT(!PSA_ALG_IS_KEY_AGREEMENT(alg));
+    TEST_ASSERT(PSA_ALG_IS_KEY_DERIVATION(alg));
+    algorithm_classification(alg, classification_flags);
 
     /* Check combinations with key agreements */
-    TEST_ASSERT( PSA_ALG_IS_KEY_AGREEMENT( ecdh_alg ) );
-    TEST_ASSERT( PSA_ALG_IS_KEY_AGREEMENT( ffdh_alg ) );
-    TEST_EQUAL( PSA_ALG_KEY_AGREEMENT_GET_KDF( ecdh_alg ), alg );
-    TEST_EQUAL( PSA_ALG_KEY_AGREEMENT_GET_KDF( ffdh_alg ), alg );
+    TEST_ASSERT(PSA_ALG_IS_KEY_AGREEMENT(ecdh_alg));
+    TEST_ASSERT(PSA_ALG_IS_KEY_AGREEMENT(ffdh_alg));
+    TEST_EQUAL(PSA_ALG_KEY_AGREEMENT_GET_KDF(ecdh_alg), alg);
+    TEST_EQUAL(PSA_ALG_KEY_AGREEMENT_GET_KDF(ffdh_alg), alg);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void key_agreement_algorithm( int alg_arg, int classification_flags,
-                              int ka_alg_arg, int kdf_alg_arg )
+void key_agreement_algorithm(int alg_arg, int classification_flags,
+                             int ka_alg_arg, int kdf_alg_arg)
 {
     psa_algorithm_t alg = alg_arg;
-    psa_algorithm_t actual_ka_alg = PSA_ALG_KEY_AGREEMENT_GET_BASE( alg );
+    psa_algorithm_t actual_ka_alg = PSA_ALG_KEY_AGREEMENT_GET_BASE(alg);
     psa_algorithm_t expected_ka_alg = ka_alg_arg;
-    psa_algorithm_t actual_kdf_alg = PSA_ALG_KEY_AGREEMENT_GET_KDF( alg );
+    psa_algorithm_t actual_kdf_alg = PSA_ALG_KEY_AGREEMENT_GET_KDF(alg);
     psa_algorithm_t expected_kdf_alg = kdf_alg_arg;
 
     /* Algorithm classification */
-    TEST_ASSERT( ! PSA_ALG_IS_HASH( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_MAC( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_CIPHER( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_AEAD( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_SIGN( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_ASYMMETRIC_ENCRYPTION( alg ) );
-    TEST_ASSERT( PSA_ALG_IS_KEY_AGREEMENT( alg ) );
-    TEST_ASSERT( ! PSA_ALG_IS_KEY_DERIVATION( alg ) );
-    algorithm_classification( alg, classification_flags );
+    TEST_ASSERT(!PSA_ALG_IS_HASH(alg));
+    TEST_ASSERT(!PSA_ALG_IS_MAC(alg));
+    TEST_ASSERT(!PSA_ALG_IS_CIPHER(alg));
+    TEST_ASSERT(!PSA_ALG_IS_AEAD(alg));
+    TEST_ASSERT(!PSA_ALG_IS_SIGN(alg));
+    TEST_ASSERT(!PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg));
+    TEST_ASSERT(PSA_ALG_IS_KEY_AGREEMENT(alg));
+    TEST_ASSERT(!PSA_ALG_IS_KEY_DERIVATION(alg));
+    algorithm_classification(alg, classification_flags);
 
     /* Shared secret derivation properties */
-    TEST_EQUAL( actual_ka_alg, expected_ka_alg );
-    TEST_EQUAL( actual_kdf_alg, expected_kdf_alg );
+    TEST_EQUAL(actual_ka_alg, expected_ka_alg);
+    TEST_EQUAL(actual_kdf_alg, expected_kdf_alg);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void key_type( int type_arg, int classification_flags )
+void key_type(int type_arg, int classification_flags)
 {
     psa_key_type_t type = type_arg;
 
-    key_type_classification( type, classification_flags );
+    key_type_classification(type, classification_flags);
 
     /* For asymmetric types, check the corresponding pair/public type */
-    if( classification_flags & KEY_TYPE_IS_PUBLIC_KEY )
-    {
-        psa_key_type_t pair_type = PSA_KEY_TYPE_KEY_PAIR_OF_PUBLIC_KEY( type );
-        TEST_EQUAL( PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR( pair_type ), type );
-        key_type_classification( pair_type,
-                                 ( classification_flags
-                                   & ~KEY_TYPE_IS_PUBLIC_KEY )
-                                 | KEY_TYPE_IS_KEY_PAIR );
-        TEST_EQUAL( PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR( type ), type );
+    if (classification_flags & KEY_TYPE_IS_PUBLIC_KEY) {
+        psa_key_type_t pair_type = PSA_KEY_TYPE_KEY_PAIR_OF_PUBLIC_KEY(type);
+        TEST_EQUAL(PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(pair_type), type);
+        key_type_classification(pair_type,
+                                (classification_flags
+                                 & ~KEY_TYPE_IS_PUBLIC_KEY)
+                                | KEY_TYPE_IS_KEY_PAIR);
+        TEST_EQUAL(PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type), type);
     }
-    if( classification_flags & KEY_TYPE_IS_KEY_PAIR )
-    {
-        psa_key_type_t public_type = PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR( type );
-        TEST_EQUAL( PSA_KEY_TYPE_KEY_PAIR_OF_PUBLIC_KEY( public_type ), type );
-        key_type_classification( public_type,
-                                 ( classification_flags
-                                   & ~KEY_TYPE_IS_KEY_PAIR )
-                                 | KEY_TYPE_IS_PUBLIC_KEY );
-        TEST_EQUAL( PSA_KEY_TYPE_KEY_PAIR_OF_PUBLIC_KEY( type ), type );
+    if (classification_flags & KEY_TYPE_IS_KEY_PAIR) {
+        psa_key_type_t public_type = PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type);
+        TEST_EQUAL(PSA_KEY_TYPE_KEY_PAIR_OF_PUBLIC_KEY(public_type), type);
+        key_type_classification(public_type,
+                                (classification_flags
+                                 & ~KEY_TYPE_IS_KEY_PAIR)
+                                | KEY_TYPE_IS_PUBLIC_KEY);
+        TEST_EQUAL(PSA_KEY_TYPE_KEY_PAIR_OF_PUBLIC_KEY(type), type);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void block_cipher_key_type( int type_arg, int block_size_arg )
+void block_cipher_key_type(int type_arg, int block_size_arg)
 {
     psa_key_type_t type = type_arg;
     size_t block_size = block_size_arg;
 
-    test_key_type( type_arg, KEY_TYPE_IS_UNSTRUCTURED );
+    test_key_type(type_arg, KEY_TYPE_IS_UNSTRUCTURED);
 
-    TEST_EQUAL( type & PSA_KEY_TYPE_CATEGORY_MASK,
-                PSA_KEY_TYPE_CATEGORY_SYMMETRIC );
-    TEST_EQUAL( PSA_BLOCK_CIPHER_BLOCK_LENGTH( type ), block_size );
+    TEST_EQUAL(type & PSA_KEY_TYPE_CATEGORY_MASK,
+               PSA_KEY_TYPE_CATEGORY_SYMMETRIC);
+    TEST_EQUAL(PSA_BLOCK_CIPHER_BLOCK_LENGTH(type), block_size);
 
     /* Check that the block size is a power of 2. This is required, at least,
-    for PSA_ROUND_UP_TO_MULTIPLE(block_size, length) in crypto_sizes.h. */
-    TEST_ASSERT( ( ( block_size - 1 ) & block_size ) == 0 );
+       for PSA_ROUND_UP_TO_MULTIPLE(block_size, length) in crypto_sizes.h. */
+    TEST_ASSERT(((block_size - 1) & block_size) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void stream_cipher_key_type( int type_arg )
+void stream_cipher_key_type(int type_arg)
 {
     psa_key_type_t type = type_arg;
 
-    test_key_type( type_arg, KEY_TYPE_IS_UNSTRUCTURED );
+    test_key_type(type_arg, KEY_TYPE_IS_UNSTRUCTURED);
 
-    TEST_EQUAL( type & PSA_KEY_TYPE_CATEGORY_MASK,
-                PSA_KEY_TYPE_CATEGORY_SYMMETRIC );
-    TEST_EQUAL( PSA_BLOCK_CIPHER_BLOCK_LENGTH( type ), 1 );
+    TEST_EQUAL(type & PSA_KEY_TYPE_CATEGORY_MASK,
+               PSA_KEY_TYPE_CATEGORY_SYMMETRIC);
+    TEST_EQUAL(PSA_BLOCK_CIPHER_BLOCK_LENGTH(type), 1);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:PSA_KEY_TYPE_ECC_PUBLIC_KEY:PSA_KEY_TYPE_ECC_KEY_PAIR */
-void ecc_key_family( int curve_arg )
+void ecc_key_family(int curve_arg)
 {
     psa_ecc_family_t curve = curve_arg;
-    psa_key_type_t public_type = PSA_KEY_TYPE_ECC_PUBLIC_KEY( curve );
-    psa_key_type_t pair_type = PSA_KEY_TYPE_ECC_KEY_PAIR( curve );
+    psa_key_type_t public_type = PSA_KEY_TYPE_ECC_PUBLIC_KEY(curve);
+    psa_key_type_t pair_type = PSA_KEY_TYPE_ECC_KEY_PAIR(curve);
 
-    TEST_PARITY( curve );
+    TEST_PARITY(curve);
 
-    test_key_type( public_type, KEY_TYPE_IS_ECC | KEY_TYPE_IS_PUBLIC_KEY );
-    test_key_type( pair_type, KEY_TYPE_IS_ECC | KEY_TYPE_IS_KEY_PAIR );
+    test_key_type(public_type, KEY_TYPE_IS_ECC | KEY_TYPE_IS_PUBLIC_KEY);
+    test_key_type(pair_type, KEY_TYPE_IS_ECC | KEY_TYPE_IS_KEY_PAIR);
 
-    TEST_EQUAL( PSA_KEY_TYPE_ECC_GET_FAMILY( public_type ), curve );
-    TEST_EQUAL( PSA_KEY_TYPE_ECC_GET_FAMILY( pair_type ), curve );
+    TEST_EQUAL(PSA_KEY_TYPE_ECC_GET_FAMILY(public_type), curve);
+    TEST_EQUAL(PSA_KEY_TYPE_ECC_GET_FAMILY(pair_type), curve);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_DHM_C */
-void dh_key_family( int group_arg )
+void dh_key_family(int group_arg)
 {
     psa_dh_family_t group = group_arg;
-    psa_key_type_t public_type = PSA_KEY_TYPE_DH_PUBLIC_KEY( group );
-    psa_key_type_t pair_type = PSA_KEY_TYPE_DH_KEY_PAIR( group );
+    psa_key_type_t public_type = PSA_KEY_TYPE_DH_PUBLIC_KEY(group);
+    psa_key_type_t pair_type = PSA_KEY_TYPE_DH_KEY_PAIR(group);
 
-    TEST_PARITY( group );
+    TEST_PARITY(group);
 
-    test_key_type( public_type, KEY_TYPE_IS_DH | KEY_TYPE_IS_PUBLIC_KEY );
-    test_key_type( pair_type, KEY_TYPE_IS_DH | KEY_TYPE_IS_KEY_PAIR );
+    test_key_type(public_type, KEY_TYPE_IS_DH | KEY_TYPE_IS_PUBLIC_KEY);
+    test_key_type(pair_type, KEY_TYPE_IS_DH | KEY_TYPE_IS_KEY_PAIR);
 
-    TEST_EQUAL( PSA_KEY_TYPE_DH_GET_FAMILY( public_type ), group );
-    TEST_EQUAL( PSA_KEY_TYPE_DH_GET_FAMILY( pair_type ), group );
+    TEST_EQUAL(PSA_KEY_TYPE_DH_GET_FAMILY(public_type), group);
+    TEST_EQUAL(PSA_KEY_TYPE_DH_GET_FAMILY(pair_type), group);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void lifetime( int lifetime_arg, int classification_flags,
-               int persistence_arg, int location_arg )
+void lifetime(int lifetime_arg, int classification_flags,
+              int persistence_arg, int location_arg)
 {
     psa_key_lifetime_t lifetime = lifetime_arg;
     psa_key_persistence_t persistence = persistence_arg;
@@ -702,12 +696,12 @@
     unsigned flags = classification_flags;
     unsigned classification_flags_tested = 0;
 
-    TEST_CLASSIFICATION_MACRO( 1, KEY_LIFETIME_IS_VOLATILE, lifetime, flags );
-    TEST_CLASSIFICATION_MACRO( 1, KEY_LIFETIME_IS_READ_ONLY, lifetime, flags );
-    TEST_EQUAL( classification_flags_tested,
-                KEY_LIFETIME_FLAG_MASK_PLUS_ONE - 1 );
+    TEST_CLASSIFICATION_MACRO(1, KEY_LIFETIME_IS_VOLATILE, lifetime, flags);
+    TEST_CLASSIFICATION_MACRO(1, KEY_LIFETIME_IS_READ_ONLY, lifetime, flags);
+    TEST_EQUAL(classification_flags_tested,
+               KEY_LIFETIME_FLAG_MASK_PLUS_ONE - 1);
 
-    TEST_EQUAL( PSA_KEY_LIFETIME_GET_PERSISTENCE( lifetime ), persistence );
-    TEST_EQUAL( PSA_KEY_LIFETIME_GET_LOCATION( lifetime ), location );
+    TEST_EQUAL(PSA_KEY_LIFETIME_GET_PERSISTENCE(lifetime), persistence);
+    TEST_EQUAL(PSA_KEY_LIFETIME_GET_LOCATION(lifetime), location);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_not_supported.function b/tests/suites/test_suite_psa_crypto_not_supported.function
index e3253d8..e5e66f4 100644
--- a/tests/suites/test_suite_psa_crypto_not_supported.function
+++ b/tests/suites/test_suite_psa_crypto_not_supported.function
@@ -3,7 +3,7 @@
 #include "psa/crypto.h"
 #include "test/psa_crypto_helpers.h"
 
-#define INVALID_KEY_ID mbedtls_svc_key_id_make( 0, 0xfedcba98 )
+#define INVALID_KEY_ID mbedtls_svc_key_id_make(0, 0xfedcba98)
 
 /* END_HEADER */
 
@@ -13,40 +13,40 @@
  */
 
 /* BEGIN_CASE */
-void import_not_supported( int key_type, data_t *key_material )
+void import_not_supported(int key_type, data_t *key_material)
 {
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     mbedtls_svc_key_id_t key_id = INVALID_KEY_ID;
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    psa_set_key_type( &attributes, key_type );
-    TEST_EQUAL( psa_import_key( &attributes,
-                                key_material->x, key_material->len,
-                                &key_id ),
-                PSA_ERROR_NOT_SUPPORTED );
-    TEST_ASSERT( mbedtls_svc_key_id_equal( key_id, MBEDTLS_SVC_KEY_ID_INIT ) );
+    PSA_ASSERT(psa_crypto_init());
+    psa_set_key_type(&attributes, key_type);
+    TEST_EQUAL(psa_import_key(&attributes,
+                              key_material->x, key_material->len,
+                              &key_id),
+               PSA_ERROR_NOT_SUPPORTED);
+    TEST_ASSERT(mbedtls_svc_key_id_equal(key_id, MBEDTLS_SVC_KEY_ID_INIT));
 
 exit:
-    psa_destroy_key( key_id );
-    PSA_DONE( );
+    psa_destroy_key(key_id);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void generate_not_supported( int key_type, int bits )
+void generate_not_supported(int key_type, int bits)
 {
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     mbedtls_svc_key_id_t key_id = INVALID_KEY_ID;
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    psa_set_key_type( &attributes, key_type );
-    psa_set_key_bits( &attributes, bits );
-    TEST_EQUAL( psa_generate_key( &attributes, &key_id ),
-                PSA_ERROR_NOT_SUPPORTED );
-    TEST_ASSERT( mbedtls_svc_key_id_equal( key_id, MBEDTLS_SVC_KEY_ID_INIT ) );
+    PSA_ASSERT(psa_crypto_init());
+    psa_set_key_type(&attributes, key_type);
+    psa_set_key_bits(&attributes, bits);
+    TEST_EQUAL(psa_generate_key(&attributes, &key_id),
+               PSA_ERROR_NOT_SUPPORTED);
+    TEST_ASSERT(mbedtls_svc_key_id_equal(key_id, MBEDTLS_SVC_KEY_ID_INIT));
 
 exit:
-    psa_destroy_key( key_id );
-    PSA_DONE( );
+    psa_destroy_key(key_id);
+    PSA_DONE();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_op_fail.function b/tests/suites/test_suite_psa_crypto_op_fail.function
index 1138e74..0d5d538 100644
--- a/tests/suites/test_suite_psa_crypto_op_fail.function
+++ b/tests/suites/test_suite_psa_crypto_op_fail.function
@@ -3,19 +3,18 @@
 #include "psa/crypto.h"
 #include "test/psa_crypto_helpers.h"
 
-static int test_equal_status( const char *test,
-                              int line_no, const char* filename,
-                              psa_status_t value1,
-                              psa_status_t value2 )
+static int test_equal_status(const char *test,
+                             int line_no, const char *filename,
+                             psa_status_t value1,
+                             psa_status_t value2)
 {
-    if( ( value1 == PSA_ERROR_INVALID_ARGUMENT &&
-          value2 == PSA_ERROR_NOT_SUPPORTED ) ||
-        ( value1 == PSA_ERROR_NOT_SUPPORTED &&
-          value2 == PSA_ERROR_INVALID_ARGUMENT ) )
-    {
-        return( 1 );
+    if ((value1 == PSA_ERROR_INVALID_ARGUMENT &&
+         value2 == PSA_ERROR_NOT_SUPPORTED) ||
+        (value1 == PSA_ERROR_NOT_SUPPORTED &&
+         value2 == PSA_ERROR_INVALID_ARGUMENT)) {
+        return 1;
     }
-    return( mbedtls_test_equal( test, line_no, filename, value1, value2 ) );
+    return mbedtls_test_equal(test, line_no, filename, value1, value2);
 }
 
 /** Like #TEST_EQUAL, but expects #psa_status_t values and treats
@@ -28,12 +27,12 @@
  * run, it would be better to clarify the expectations and reconcile the
  * library and the test case generator.
  */
-#define TEST_STATUS( expr1, expr2 )                                     \
+#define TEST_STATUS(expr1, expr2)                                     \
     do {                                                                \
-        if( ! test_equal_status( #expr1 " == " #expr2, __LINE__, __FILE__, \
-                                 expr1, expr2 ) )                       \
-            goto exit;                                                  \
-    } while( 0 )
+        if (!test_equal_status( #expr1 " == " #expr2, __LINE__, __FILE__, \
+                                expr1, expr2))                       \
+        goto exit;                                                  \
+    } while (0)
 
 /* END_HEADER */
 
@@ -43,35 +42,35 @@
  */
 
 /* BEGIN_CASE */
-void hash_fail( int alg_arg, int expected_status_arg )
+void hash_fail(int alg_arg, int expected_status_arg)
 {
     psa_status_t expected_status = expected_status_arg;
     psa_algorithm_t alg = alg_arg;
     psa_hash_operation_t operation = PSA_HASH_OPERATION_INIT;
-    uint8_t input[1] = {'A'};
-    uint8_t output[PSA_HASH_MAX_SIZE] = {0};
+    uint8_t input[1] = { 'A' };
+    uint8_t output[PSA_HASH_MAX_SIZE] = { 0 };
     size_t length = SIZE_MAX;
 
-    PSA_INIT( );
+    PSA_INIT();
 
-    TEST_EQUAL( expected_status,
-                psa_hash_setup( &operation, alg ) );
-    TEST_EQUAL( expected_status,
-                psa_hash_compute( alg, input, sizeof( input ),
-                                  output, sizeof( output ), &length ) );
-    TEST_EQUAL( expected_status,
-                psa_hash_compare( alg, input, sizeof( input ),
-                                  output, sizeof( output ) ) );
+    TEST_EQUAL(expected_status,
+               psa_hash_setup(&operation, alg));
+    TEST_EQUAL(expected_status,
+               psa_hash_compute(alg, input, sizeof(input),
+                                output, sizeof(output), &length));
+    TEST_EQUAL(expected_status,
+               psa_hash_compare(alg, input, sizeof(input),
+                                output, sizeof(output)));
 
 exit:
-    psa_hash_abort( &operation );
-    PSA_DONE( );
+    psa_hash_abort(&operation);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mac_fail( int key_type_arg, data_t *key_data,
-               int alg_arg, int expected_status_arg )
+void mac_fail(int key_type_arg, data_t *key_data,
+              int alg_arg, int expected_status_arg)
 {
     psa_status_t expected_status = expected_status_arg;
     psa_key_type_t key_type = key_type_arg;
@@ -79,45 +78,45 @@
     psa_mac_operation_t operation = PSA_MAC_OPERATION_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     mbedtls_svc_key_id_t key_id = MBEDTLS_SVC_KEY_ID_INIT;
-    uint8_t input[1] = {'A'};
-    uint8_t output[PSA_MAC_MAX_SIZE] = {0};
+    uint8_t input[1] = { 'A' };
+    uint8_t output[PSA_MAC_MAX_SIZE] = { 0 };
     size_t length = SIZE_MAX;
 
-    PSA_INIT( );
+    PSA_INIT();
 
-    psa_set_key_type( &attributes, key_type );
-    psa_set_key_usage_flags( &attributes,
-                             PSA_KEY_USAGE_SIGN_HASH |
-                             PSA_KEY_USAGE_VERIFY_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                key_data->x, key_data->len,
-                                &key_id ) );
+    psa_set_key_type(&attributes, key_type);
+    psa_set_key_usage_flags(&attributes,
+                            PSA_KEY_USAGE_SIGN_HASH |
+                            PSA_KEY_USAGE_VERIFY_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              key_data->x, key_data->len,
+                              &key_id));
 
-    TEST_STATUS( expected_status,
-                 psa_mac_sign_setup( &operation, key_id, alg ) );
-    TEST_STATUS( expected_status,
-                 psa_mac_verify_setup( &operation, key_id, alg ) );
-    TEST_STATUS( expected_status,
-                 psa_mac_compute( key_id, alg,
-                                  input, sizeof( input ),
-                                  output, sizeof( output ), &length ) );
-    TEST_STATUS( expected_status,
-                 psa_mac_verify( key_id, alg,
-                                 input, sizeof( input ),
-                                 output, sizeof( output ) ) );
+    TEST_STATUS(expected_status,
+                psa_mac_sign_setup(&operation, key_id, alg));
+    TEST_STATUS(expected_status,
+                psa_mac_verify_setup(&operation, key_id, alg));
+    TEST_STATUS(expected_status,
+                psa_mac_compute(key_id, alg,
+                                input, sizeof(input),
+                                output, sizeof(output), &length));
+    TEST_STATUS(expected_status,
+                psa_mac_verify(key_id, alg,
+                               input, sizeof(input),
+                               output, sizeof(output)));
 
 exit:
-    psa_mac_abort( &operation );
-    psa_destroy_key( key_id );
-    psa_reset_key_attributes( &attributes );
-    PSA_DONE( );
+    psa_mac_abort(&operation);
+    psa_destroy_key(key_id);
+    psa_reset_key_attributes(&attributes);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void cipher_fail( int key_type_arg, data_t *key_data,
-                  int alg_arg, int expected_status_arg )
+void cipher_fail(int key_type_arg, data_t *key_data,
+                 int alg_arg, int expected_status_arg)
 {
     psa_status_t expected_status = expected_status_arg;
     psa_key_type_t key_type = key_type_arg;
@@ -125,45 +124,45 @@
     psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     mbedtls_svc_key_id_t key_id = MBEDTLS_SVC_KEY_ID_INIT;
-    uint8_t input[1] = {'A'};
-    uint8_t output[64] = {0};
+    uint8_t input[1] = { 'A' };
+    uint8_t output[64] = { 0 };
     size_t length = SIZE_MAX;
 
-    PSA_INIT( );
+    PSA_INIT();
 
-    psa_set_key_type( &attributes, key_type );
-    psa_set_key_usage_flags( &attributes,
-                             PSA_KEY_USAGE_ENCRYPT |
-                             PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                key_data->x, key_data->len,
-                                &key_id ) );
+    psa_set_key_type(&attributes, key_type);
+    psa_set_key_usage_flags(&attributes,
+                            PSA_KEY_USAGE_ENCRYPT |
+                            PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              key_data->x, key_data->len,
+                              &key_id));
 
-    TEST_STATUS( expected_status,
-                 psa_cipher_encrypt_setup( &operation, key_id, alg ) );
-    TEST_STATUS( expected_status,
-                 psa_cipher_decrypt_setup( &operation, key_id, alg ) );
-    TEST_STATUS( expected_status,
-                 psa_cipher_encrypt( key_id, alg,
-                                     input, sizeof( input ),
-                                     output, sizeof( output ), &length ) );
-    TEST_STATUS( expected_status,
-                 psa_cipher_decrypt( key_id, alg,
-                                     input, sizeof( input ),
-                                     output, sizeof( output ), &length ) );
+    TEST_STATUS(expected_status,
+                psa_cipher_encrypt_setup(&operation, key_id, alg));
+    TEST_STATUS(expected_status,
+                psa_cipher_decrypt_setup(&operation, key_id, alg));
+    TEST_STATUS(expected_status,
+                psa_cipher_encrypt(key_id, alg,
+                                   input, sizeof(input),
+                                   output, sizeof(output), &length));
+    TEST_STATUS(expected_status,
+                psa_cipher_decrypt(key_id, alg,
+                                   input, sizeof(input),
+                                   output, sizeof(output), &length));
 
 exit:
-    psa_cipher_abort( &operation );
-    psa_destroy_key( key_id );
-    psa_reset_key_attributes( &attributes );
-    PSA_DONE( );
+    psa_cipher_abort(&operation);
+    psa_destroy_key(key_id);
+    psa_reset_key_attributes(&attributes);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void aead_fail( int key_type_arg, data_t *key_data,
-                int alg_arg, int expected_status_arg )
+void aead_fail(int key_type_arg, data_t *key_data,
+               int alg_arg, int expected_status_arg)
 {
     psa_status_t expected_status = expected_status_arg;
     psa_key_type_t key_type = key_type_arg;
@@ -171,214 +170,212 @@
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     mbedtls_svc_key_id_t key_id = MBEDTLS_SVC_KEY_ID_INIT;
     uint8_t input[16] = "ABCDEFGHIJKLMNO";
-    uint8_t output[64] = {0};
+    uint8_t output[64] = { 0 };
     size_t length = SIZE_MAX;
 
-    PSA_INIT( );
+    PSA_INIT();
 
-    psa_set_key_type( &attributes, key_type );
-    psa_set_key_usage_flags( &attributes,
-                             PSA_KEY_USAGE_ENCRYPT |
-                             PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                key_data->x, key_data->len,
-                                &key_id ) );
+    psa_set_key_type(&attributes, key_type);
+    psa_set_key_usage_flags(&attributes,
+                            PSA_KEY_USAGE_ENCRYPT |
+                            PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              key_data->x, key_data->len,
+                              &key_id));
 
-    TEST_STATUS( expected_status,
-                 psa_aead_encrypt( key_id, alg,
-                                   input, sizeof( input ),
-                                   NULL, 0, input, sizeof( input ),
-                                   output, sizeof( output ), &length ) );
-    TEST_STATUS( expected_status,
-                 psa_aead_decrypt( key_id, alg,
-                                   input, sizeof( input ),
-                                   NULL, 0, input, sizeof( input ),
-                                   output, sizeof( output ), &length ) );
+    TEST_STATUS(expected_status,
+                psa_aead_encrypt(key_id, alg,
+                                 input, sizeof(input),
+                                 NULL, 0, input, sizeof(input),
+                                 output, sizeof(output), &length));
+    TEST_STATUS(expected_status,
+                psa_aead_decrypt(key_id, alg,
+                                 input, sizeof(input),
+                                 NULL, 0, input, sizeof(input),
+                                 output, sizeof(output), &length));
 
 exit:
-    psa_destroy_key( key_id );
-    psa_reset_key_attributes( &attributes );
-    PSA_DONE( );
+    psa_destroy_key(key_id);
+    psa_reset_key_attributes(&attributes);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void sign_fail( int key_type_arg, data_t *key_data,
-                int alg_arg, int private_only,
-                int expected_status_arg )
+void sign_fail(int key_type_arg, data_t *key_data,
+               int alg_arg, int private_only,
+               int expected_status_arg)
 {
     psa_status_t expected_status = expected_status_arg;
     psa_key_type_t key_type = key_type_arg;
     psa_algorithm_t alg = alg_arg;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     mbedtls_svc_key_id_t key_id = MBEDTLS_SVC_KEY_ID_INIT;
-    uint8_t input[1] = {'A'};
-    uint8_t output[PSA_SIGNATURE_MAX_SIZE] = {0};
+    uint8_t input[1] = { 'A' };
+    uint8_t output[PSA_SIGNATURE_MAX_SIZE] = { 0 };
     size_t length = SIZE_MAX;
 
-    PSA_INIT( );
+    PSA_INIT();
 
-    psa_set_key_type( &attributes, key_type );
-    psa_set_key_usage_flags( &attributes,
-                             PSA_KEY_USAGE_SIGN_HASH |
-                             PSA_KEY_USAGE_VERIFY_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                key_data->x, key_data->len,
-                                &key_id ) );
+    psa_set_key_type(&attributes, key_type);
+    psa_set_key_usage_flags(&attributes,
+                            PSA_KEY_USAGE_SIGN_HASH |
+                            PSA_KEY_USAGE_VERIFY_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              key_data->x, key_data->len,
+                              &key_id));
 
-    TEST_STATUS( expected_status,
-                 psa_sign_hash( key_id, alg,
-                                input, sizeof( input ),
-                                output, sizeof( output ), &length ) );
-    if( ! private_only )
-    {
+    TEST_STATUS(expected_status,
+                psa_sign_hash(key_id, alg,
+                              input, sizeof(input),
+                              output, sizeof(output), &length));
+    if (!private_only) {
         /* Determine a plausible signature size to avoid an INVALID_SIGNATURE
          * error based on this. */
-        PSA_ASSERT( psa_get_key_attributes( key_id, &attributes ) );
-        size_t key_bits = psa_get_key_bits( &attributes );
-        size_t output_length = sizeof( output );
-        if( PSA_KEY_TYPE_IS_RSA( key_type ) )
-            output_length = PSA_BITS_TO_BYTES( key_bits );
-        else if( PSA_KEY_TYPE_IS_ECC( key_type ) )
-            output_length = 2 * PSA_BITS_TO_BYTES( key_bits );
-        TEST_ASSERT( output_length <= sizeof( output ) );
-        TEST_STATUS( expected_status,
-                     psa_verify_hash( key_id, alg,
-                                      input, sizeof( input ),
-                                      output, output_length ) );
+        PSA_ASSERT(psa_get_key_attributes(key_id, &attributes));
+        size_t key_bits = psa_get_key_bits(&attributes);
+        size_t output_length = sizeof(output);
+        if (PSA_KEY_TYPE_IS_RSA(key_type)) {
+            output_length = PSA_BITS_TO_BYTES(key_bits);
+        } else if (PSA_KEY_TYPE_IS_ECC(key_type)) {
+            output_length = 2 * PSA_BITS_TO_BYTES(key_bits);
+        }
+        TEST_ASSERT(output_length <= sizeof(output));
+        TEST_STATUS(expected_status,
+                    psa_verify_hash(key_id, alg,
+                                    input, sizeof(input),
+                                    output, output_length));
     }
 
 exit:
-    psa_destroy_key( key_id );
-    psa_reset_key_attributes( &attributes );
-    PSA_DONE( );
+    psa_destroy_key(key_id);
+    psa_reset_key_attributes(&attributes);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void asymmetric_encryption_fail( int key_type_arg, data_t *key_data,
-                                 int alg_arg, int private_only,
-                                 int expected_status_arg )
+void asymmetric_encryption_fail(int key_type_arg, data_t *key_data,
+                                int alg_arg, int private_only,
+                                int expected_status_arg)
 {
     psa_status_t expected_status = expected_status_arg;
     psa_key_type_t key_type = key_type_arg;
     psa_algorithm_t alg = alg_arg;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     mbedtls_svc_key_id_t key_id = MBEDTLS_SVC_KEY_ID_INIT;
-    uint8_t plaintext[PSA_ASYMMETRIC_DECRYPT_OUTPUT_MAX_SIZE] = {0};
-    uint8_t ciphertext[PSA_ASYMMETRIC_ENCRYPT_OUTPUT_MAX_SIZE] = {0};
+    uint8_t plaintext[PSA_ASYMMETRIC_DECRYPT_OUTPUT_MAX_SIZE] = { 0 };
+    uint8_t ciphertext[PSA_ASYMMETRIC_ENCRYPT_OUTPUT_MAX_SIZE] = { 0 };
     size_t length = SIZE_MAX;
 
-    PSA_INIT( );
+    PSA_INIT();
 
-    psa_set_key_type( &attributes, key_type );
-    psa_set_key_usage_flags( &attributes,
-                             PSA_KEY_USAGE_ENCRYPT |
-                             PSA_KEY_USAGE_DECRYPT );
-    psa_set_key_algorithm( &attributes, alg );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                key_data->x, key_data->len,
-                                &key_id ) );
+    psa_set_key_type(&attributes, key_type);
+    psa_set_key_usage_flags(&attributes,
+                            PSA_KEY_USAGE_ENCRYPT |
+                            PSA_KEY_USAGE_DECRYPT);
+    psa_set_key_algorithm(&attributes, alg);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              key_data->x, key_data->len,
+                              &key_id));
 
-    if( ! private_only )
-    {
-        TEST_STATUS( expected_status,
-                     psa_asymmetric_encrypt( key_id, alg,
-                                             plaintext, 1,
-                                             NULL, 0,
-                                             ciphertext, sizeof( ciphertext ),
-                                             &length ) );
+    if (!private_only) {
+        TEST_STATUS(expected_status,
+                    psa_asymmetric_encrypt(key_id, alg,
+                                           plaintext, 1,
+                                           NULL, 0,
+                                           ciphertext, sizeof(ciphertext),
+                                           &length));
     }
-    TEST_STATUS( expected_status,
-                 psa_asymmetric_decrypt( key_id, alg,
-                                         ciphertext, sizeof( ciphertext ),
-                                         NULL, 0,
-                                         plaintext, sizeof( plaintext ),
-                                         &length ) );
+    TEST_STATUS(expected_status,
+                psa_asymmetric_decrypt(key_id, alg,
+                                       ciphertext, sizeof(ciphertext),
+                                       NULL, 0,
+                                       plaintext, sizeof(plaintext),
+                                       &length));
 
 exit:
-    psa_destroy_key( key_id );
-    psa_reset_key_attributes( &attributes );
-    PSA_DONE( );
+    psa_destroy_key(key_id);
+    psa_reset_key_attributes(&attributes);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void key_derivation_fail( int alg_arg, int expected_status_arg )
+void key_derivation_fail(int alg_arg, int expected_status_arg)
 {
     psa_status_t expected_status = expected_status_arg;
     psa_algorithm_t alg = alg_arg;
     psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
 
-    PSA_INIT( );
+    PSA_INIT();
 
-    TEST_EQUAL( expected_status,
-                psa_key_derivation_setup( &operation, alg ) );
+    TEST_EQUAL(expected_status,
+               psa_key_derivation_setup(&operation, alg));
 
 exit:
-    psa_key_derivation_abort( &operation );
-    PSA_DONE( );
+    psa_key_derivation_abort(&operation);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void key_agreement_fail( int key_type_arg, data_t *key_data,
-                         int alg_arg, int private_only,
-                         int expected_status_arg )
+void key_agreement_fail(int key_type_arg, data_t *key_data,
+                        int alg_arg, int private_only,
+                        int expected_status_arg)
 {
     psa_status_t expected_status = expected_status_arg;
     psa_key_type_t key_type = key_type_arg;
     psa_algorithm_t alg = alg_arg;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     mbedtls_svc_key_id_t key_id = MBEDTLS_SVC_KEY_ID_INIT;
-    uint8_t public_key[PSA_EXPORT_PUBLIC_KEY_MAX_SIZE] = {0};
+    uint8_t public_key[PSA_EXPORT_PUBLIC_KEY_MAX_SIZE] = { 0 };
     size_t public_key_length = SIZE_MAX;
-    uint8_t output[PSA_SIGNATURE_MAX_SIZE] = {0};
+    uint8_t output[PSA_SIGNATURE_MAX_SIZE] = { 0 };
     size_t length = SIZE_MAX;
     psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
 
-    PSA_INIT( );
+    PSA_INIT();
 
-    psa_set_key_type( &attributes, key_type );
-    psa_set_key_usage_flags( &attributes,
-                             PSA_KEY_USAGE_DERIVE );
-    psa_set_key_algorithm( &attributes, alg );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                key_data->x, key_data->len,
-                                &key_id ) );
-    if( PSA_KEY_TYPE_IS_KEY_PAIR( key_type ) ||
-        PSA_KEY_TYPE_IS_PUBLIC_KEY( key_type ) )
-    {
-        PSA_ASSERT( psa_export_public_key( key_id,
-                                           public_key, sizeof( public_key ),
-                                           &public_key_length ) );
+    psa_set_key_type(&attributes, key_type);
+    psa_set_key_usage_flags(&attributes,
+                            PSA_KEY_USAGE_DERIVE);
+    psa_set_key_algorithm(&attributes, alg);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              key_data->x, key_data->len,
+                              &key_id));
+    if (PSA_KEY_TYPE_IS_KEY_PAIR(key_type) ||
+        PSA_KEY_TYPE_IS_PUBLIC_KEY(key_type)) {
+        PSA_ASSERT(psa_export_public_key(key_id,
+                                         public_key, sizeof(public_key),
+                                         &public_key_length));
     }
 
-    TEST_STATUS( expected_status,
-                 psa_raw_key_agreement( alg, key_id,
-                                        public_key, public_key_length,
-                                        output, sizeof( output ), &length ) );
+    TEST_STATUS(expected_status,
+                psa_raw_key_agreement(alg, key_id,
+                                      public_key, public_key_length,
+                                      output, sizeof(output), &length));
 
 #if defined(PSA_WANT_ALG_HKDF) && defined(PSA_WANT_ALG_SHA_256)
-    PSA_ASSERT( psa_key_derivation_setup( &operation,
-                                          PSA_ALG_HKDF( PSA_ALG_SHA_256 ) ) );
-    TEST_STATUS( expected_status,
-                 psa_key_derivation_key_agreement(
-                     &operation,
-                     PSA_KEY_DERIVATION_INPUT_SECRET,
-                     key_id,
-                     public_key, public_key_length ) );
+    PSA_ASSERT(psa_key_derivation_setup(&operation,
+                                        PSA_ALG_HKDF(PSA_ALG_SHA_256)));
+    TEST_STATUS(expected_status,
+                psa_key_derivation_key_agreement(
+                    &operation,
+                    PSA_KEY_DERIVATION_INPUT_SECRET,
+                    key_id,
+                    public_key, public_key_length));
 #endif
 
     /* There are no public-key operations. */
     (void) private_only;
 
 exit:
-    psa_key_derivation_abort( &operation );
-    psa_destroy_key( key_id );
-    psa_reset_key_attributes( &attributes );
-    PSA_DONE( );
+    psa_key_derivation_abort(&operation);
+    psa_destroy_key(key_id);
+    psa_reset_key_attributes(&attributes);
+    PSA_DONE();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_persistent_key.function b/tests/suites/test_suite_psa_crypto_persistent_key.function
index 08db34a..db99d79 100644
--- a/tests/suites/test_suite_psa_crypto_persistent_key.function
+++ b/tests/suites/test_suite_psa_crypto_persistent_key.function
@@ -20,7 +20,7 @@
 #include "mbedtls/md.h"
 
 #define PSA_KEY_STORAGE_MAGIC_HEADER "PSA\0KEY"
-#define PSA_KEY_STORAGE_MAGIC_HEADER_LENGTH ( sizeof( PSA_KEY_STORAGE_MAGIC_HEADER ) )
+#define PSA_KEY_STORAGE_MAGIC_HEADER_LENGTH (sizeof(PSA_KEY_STORAGE_MAGIC_HEADER))
 
 /* Enforce the storage format for keys. The storage format is not a public
  * documented interface, but it must be preserved between versions so that
@@ -29,9 +29,9 @@
 typedef struct {
     uint8_t magic[PSA_KEY_STORAGE_MAGIC_HEADER_LENGTH];
     uint8_t version[4];
-    uint8_t lifetime[sizeof( psa_key_lifetime_t )];
+    uint8_t lifetime[sizeof(psa_key_lifetime_t)];
     uint8_t type[4];
-    uint8_t policy[sizeof( psa_key_policy_t )];
+    uint8_t policy[sizeof(psa_key_policy_t)];
     uint8_t data_len[4];
     uint8_t key_data[];
 } psa_persistent_key_storage_format;
@@ -44,223 +44,222 @@
  */
 
 /* BEGIN_CASE */
-void format_storage_data_check( data_t *key_data,
-                                data_t *expected_file_data,
-                                int key_lifetime, int key_type, int key_bits,
-                                int key_usage, int key_alg, int key_alg2 )
+void format_storage_data_check(data_t *key_data,
+                               data_t *expected_file_data,
+                               int key_lifetime, int key_type, int key_bits,
+                               int key_usage, int key_alg, int key_alg2)
 {
     uint8_t *file_data = NULL;
     size_t file_data_length =
-        key_data->len + sizeof( psa_persistent_key_storage_format );
+        key_data->len + sizeof(psa_persistent_key_storage_format);
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    psa_set_key_lifetime( &attributes, key_lifetime );
-    psa_set_key_type( &attributes, key_type );
-    psa_set_key_bits( &attributes, key_bits );
-    psa_set_key_usage_flags( &attributes, key_usage );
-    psa_set_key_algorithm( &attributes, key_alg );
-    psa_set_key_enrollment_algorithm( &attributes, key_alg2 );
+    psa_set_key_lifetime(&attributes, key_lifetime);
+    psa_set_key_type(&attributes, key_type);
+    psa_set_key_bits(&attributes, key_bits);
+    psa_set_key_usage_flags(&attributes, key_usage);
+    psa_set_key_algorithm(&attributes, key_alg);
+    psa_set_key_enrollment_algorithm(&attributes, key_alg2);
 
-    ASSERT_ALLOC( file_data, file_data_length );
-    psa_format_key_data_for_storage( key_data->x, key_data->len,
-                                     &attributes.core,
-                                     file_data );
+    ASSERT_ALLOC(file_data, file_data_length);
+    psa_format_key_data_for_storage(key_data->x, key_data->len,
+                                    &attributes.core,
+                                    file_data);
 
-    ASSERT_COMPARE( expected_file_data->x, expected_file_data->len,
-                    file_data, file_data_length );
+    ASSERT_COMPARE(expected_file_data->x, expected_file_data->len,
+                   file_data, file_data_length);
 
 exit:
-    mbedtls_free( file_data );
+    mbedtls_free(file_data);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void parse_storage_data_check( data_t *file_data,
-                               data_t *expected_key_data,
-                               int expected_key_lifetime,
-                               int expected_key_type,
-                               int expected_key_bits,
-                               int expected_key_usage,
-                               int expected_key_alg,
-                               int expected_key_alg2,
-                               int expected_status )
+void parse_storage_data_check(data_t *file_data,
+                              data_t *expected_key_data,
+                              int expected_key_lifetime,
+                              int expected_key_type,
+                              int expected_key_bits,
+                              int expected_key_usage,
+                              int expected_key_alg,
+                              int expected_key_alg2,
+                              int expected_status)
 {
     uint8_t *key_data = NULL;
     size_t key_data_length = 0;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_status_t status;
 
-    status = psa_parse_key_data_from_storage( file_data->x, file_data->len,
-                                              &key_data, &key_data_length,
-                                              &attributes.core );
+    status = psa_parse_key_data_from_storage(file_data->x, file_data->len,
+                                             &key_data, &key_data_length,
+                                             &attributes.core);
 
-    TEST_EQUAL( status, expected_status );
-    if( status != PSA_SUCCESS )
+    TEST_EQUAL(status, expected_status);
+    if (status != PSA_SUCCESS) {
         goto exit;
+    }
 
-    TEST_EQUAL( psa_get_key_lifetime( &attributes ),
-                (psa_key_type_t) expected_key_lifetime );
-    TEST_EQUAL( psa_get_key_type( &attributes ),
-                (psa_key_type_t) expected_key_type );
-    TEST_EQUAL( psa_get_key_bits( &attributes ),
-                (psa_key_bits_t) expected_key_bits );
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes ),
-                (uint32_t) expected_key_usage );
-    TEST_EQUAL( psa_get_key_algorithm( &attributes ),
-                (uint32_t) expected_key_alg );
-    TEST_EQUAL( psa_get_key_enrollment_algorithm( &attributes ),
-                (uint32_t) expected_key_alg2 );
-    ASSERT_COMPARE( expected_key_data->x, expected_key_data->len,
-                    key_data, key_data_length );
+    TEST_EQUAL(psa_get_key_lifetime(&attributes),
+               (psa_key_type_t) expected_key_lifetime);
+    TEST_EQUAL(psa_get_key_type(&attributes),
+               (psa_key_type_t) expected_key_type);
+    TEST_EQUAL(psa_get_key_bits(&attributes),
+               (psa_key_bits_t) expected_key_bits);
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes),
+               (uint32_t) expected_key_usage);
+    TEST_EQUAL(psa_get_key_algorithm(&attributes),
+               (uint32_t) expected_key_alg);
+    TEST_EQUAL(psa_get_key_enrollment_algorithm(&attributes),
+               (uint32_t) expected_key_alg2);
+    ASSERT_COMPARE(expected_key_data->x, expected_key_data->len,
+                   key_data, key_data_length);
 
 exit:
-    mbedtls_free( key_data );
+    mbedtls_free(key_data);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void save_large_persistent_key( int data_length_arg, int expected_status )
+void save_large_persistent_key(int data_length_arg, int expected_status)
 {
-    mbedtls_svc_key_id_t key_id = mbedtls_svc_key_id_make( 1, 42 );
+    mbedtls_svc_key_id_t key_id = mbedtls_svc_key_id_make(1, 42);
     uint8_t *data = NULL;
     size_t data_length = data_length_arg;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    ASSERT_ALLOC( data, data_length );
+    ASSERT_ALLOC(data, data_length);
 
-    PSA_ASSERT( psa_crypto_init() );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_id( &attributes, key_id );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA );
+    psa_set_key_id(&attributes, key_id);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
 
-    TEST_EQUAL( psa_import_key( &attributes, data, data_length, &key_id ),
-                expected_status );
+    TEST_EQUAL(psa_import_key(&attributes, data, data_length, &key_id),
+               expected_status);
 
-    if( expected_status == PSA_SUCCESS )
-        PSA_ASSERT( psa_destroy_key( key_id ) );
+    if (expected_status == PSA_SUCCESS) {
+        PSA_ASSERT(psa_destroy_key(key_id));
+    }
 
 exit:
-    mbedtls_free( data );
+    mbedtls_free(data);
     PSA_DONE();
-    psa_destroy_persistent_key( key_id );
+    psa_destroy_persistent_key(key_id);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void persistent_key_destroy( int owner_id_arg, int key_id_arg, int restart,
-                             int first_type_arg, data_t *first_data,
-                             int second_type_arg, data_t *second_data )
+void persistent_key_destroy(int owner_id_arg, int key_id_arg, int restart,
+                            int first_type_arg, data_t *first_data,
+                            int second_type_arg, data_t *second_data)
 {
     mbedtls_svc_key_id_t key_id =
-        mbedtls_svc_key_id_make( owner_id_arg, key_id_arg );
+        mbedtls_svc_key_id_make(owner_id_arg, key_id_arg);
     mbedtls_svc_key_id_t returned_key_id = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t first_type = (psa_key_type_t) first_type_arg;
     psa_key_type_t second_type = (psa_key_type_t) second_type_arg;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init() );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_id( &attributes, key_id );
-    psa_set_key_type( &attributes, first_type );
+    psa_set_key_id(&attributes, key_id);
+    psa_set_key_type(&attributes, first_type);
 
-    PSA_ASSERT( psa_import_key( &attributes, first_data->x, first_data->len,
-                                &returned_key_id ) );
+    PSA_ASSERT(psa_import_key(&attributes, first_data->x, first_data->len,
+                              &returned_key_id));
 
-    if( restart )
-    {
-        psa_close_key( key_id );
+    if (restart) {
+        psa_close_key(key_id);
         PSA_DONE();
-        PSA_ASSERT( psa_crypto_init() );
+        PSA_ASSERT(psa_crypto_init());
     }
-    TEST_EQUAL( psa_is_key_present_in_storage( key_id ), 1 );
+    TEST_EQUAL(psa_is_key_present_in_storage(key_id), 1);
 
     /* Destroy the key */
-    PSA_ASSERT( psa_destroy_key( key_id ) );
+    PSA_ASSERT(psa_destroy_key(key_id));
 
     /* Check key slot storage is removed */
-    TEST_EQUAL( psa_is_key_present_in_storage( key_id ), 0 );
+    TEST_EQUAL(psa_is_key_present_in_storage(key_id), 0);
 
     /* Shutdown and restart */
     PSA_DONE();
-    PSA_ASSERT( psa_crypto_init() );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Create another key in the same slot */
-    psa_set_key_id( &attributes, key_id );
-    psa_set_key_type( &attributes, second_type );
-    PSA_ASSERT( psa_import_key( &attributes, second_data->x, second_data->len,
-                                &returned_key_id ) );
+    psa_set_key_id(&attributes, key_id);
+    psa_set_key_type(&attributes, second_type);
+    PSA_ASSERT(psa_import_key(&attributes, second_data->x, second_data->len,
+                              &returned_key_id));
 
-    PSA_ASSERT( psa_destroy_key( key_id ) );
+    PSA_ASSERT(psa_destroy_key(key_id));
 
 exit:
     PSA_DONE();
-    psa_destroy_persistent_key( key_id );
+    psa_destroy_persistent_key(key_id);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void persistent_key_import( int owner_id_arg, int key_id_arg, int type_arg,
-                            data_t *data, int restart, int expected_status )
+void persistent_key_import(int owner_id_arg, int key_id_arg, int type_arg,
+                           data_t *data, int restart, int expected_status)
 {
     mbedtls_svc_key_id_t key_id =
-        mbedtls_svc_key_id_make( owner_id_arg, key_id_arg );
+        mbedtls_svc_key_id_make(owner_id_arg, key_id_arg);
     mbedtls_svc_key_id_t returned_key_id;
     psa_key_type_t type = (psa_key_type_t) type_arg;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_crypto_init() );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_id( &attributes, key_id );
-    psa_set_key_type( &attributes, type );
-    TEST_EQUAL( psa_import_key( &attributes, data->x, data->len, &returned_key_id ),
-                expected_status );
+    psa_set_key_id(&attributes, key_id);
+    psa_set_key_type(&attributes, type);
+    TEST_EQUAL(psa_import_key(&attributes, data->x, data->len, &returned_key_id),
+               expected_status);
 
-    if( expected_status != PSA_SUCCESS )
-    {
-        TEST_ASSERT( mbedtls_svc_key_id_is_null( returned_key_id ) );
-        TEST_EQUAL( psa_is_key_present_in_storage( key_id ), 0 );
+    if (expected_status != PSA_SUCCESS) {
+        TEST_ASSERT(mbedtls_svc_key_id_is_null(returned_key_id));
+        TEST_EQUAL(psa_is_key_present_in_storage(key_id), 0);
         goto exit;
     }
 
-    TEST_ASSERT( mbedtls_svc_key_id_equal( returned_key_id, key_id ) );
+    TEST_ASSERT(mbedtls_svc_key_id_equal(returned_key_id, key_id));
 
-    if( restart )
-    {
-        PSA_ASSERT( psa_purge_key( key_id ) );
+    if (restart) {
+        PSA_ASSERT(psa_purge_key(key_id));
         PSA_DONE();
-        PSA_ASSERT( psa_crypto_init() );
+        PSA_ASSERT(psa_crypto_init());
     }
 
-    psa_reset_key_attributes( &attributes );
-    PSA_ASSERT( psa_get_key_attributes( key_id, &attributes ) );
-    TEST_ASSERT( mbedtls_svc_key_id_equal( psa_get_key_id( &attributes ),
-                                           key_id ) );
-    TEST_EQUAL( psa_get_key_lifetime( &attributes ),
-                PSA_KEY_LIFETIME_PERSISTENT );
-    TEST_EQUAL( psa_get_key_type( &attributes ), type );
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes ), 0 );
-    TEST_EQUAL( psa_get_key_algorithm( &attributes ), 0 );
+    psa_reset_key_attributes(&attributes);
+    PSA_ASSERT(psa_get_key_attributes(key_id, &attributes));
+    TEST_ASSERT(mbedtls_svc_key_id_equal(psa_get_key_id(&attributes),
+                                         key_id));
+    TEST_EQUAL(psa_get_key_lifetime(&attributes),
+               PSA_KEY_LIFETIME_PERSISTENT);
+    TEST_EQUAL(psa_get_key_type(&attributes), type);
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes), 0);
+    TEST_EQUAL(psa_get_key_algorithm(&attributes), 0);
 
-    PSA_ASSERT( psa_destroy_key( key_id ) );
+    PSA_ASSERT(psa_destroy_key(key_id));
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    psa_destroy_persistent_key( key_id );
+    psa_destroy_persistent_key(key_id);
     PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void import_export_persistent_key( data_t *data, int type_arg,
-                                   int expected_bits,
-                                   int restart, int key_not_exist )
+void import_export_persistent_key(data_t *data, int type_arg,
+                                  int expected_bits,
+                                  int restart, int key_not_exist)
 {
-    mbedtls_svc_key_id_t key_id = mbedtls_svc_key_id_make( 1, 42 );
+    mbedtls_svc_key_id_t key_id = mbedtls_svc_key_id_make(1, 42);
     psa_key_type_t type = (psa_key_type_t) type_arg;
     mbedtls_svc_key_id_t returned_key_id = MBEDTLS_SVC_KEY_ID_INIT;
     unsigned char *exported = NULL;
@@ -268,78 +267,76 @@
     size_t exported_length;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    ASSERT_ALLOC( exported, export_size );
+    ASSERT_ALLOC(exported, export_size);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_id( &attributes, key_id );
-    psa_set_key_type( &attributes, type );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
+    psa_set_key_id(&attributes, key_id);
+    psa_set_key_type(&attributes, type);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
 
     /* Import the key */
-    PSA_ASSERT( psa_import_key( &attributes, data->x, data->len,
-                                &returned_key_id ) );
+    PSA_ASSERT(psa_import_key(&attributes, data->x, data->len,
+                              &returned_key_id));
 
 
-    if( restart )
-    {
-        PSA_ASSERT( psa_purge_key( key_id ) );
+    if (restart) {
+        PSA_ASSERT(psa_purge_key(key_id));
         PSA_DONE();
-        PSA_ASSERT( psa_crypto_init() );
+        PSA_ASSERT(psa_crypto_init());
     }
 
     /* Test the key information */
-    psa_reset_key_attributes( &attributes );
-    PSA_ASSERT( psa_get_key_attributes( key_id, &attributes ) );
-    TEST_ASSERT( mbedtls_svc_key_id_equal(
-                     psa_get_key_id( &attributes ), key_id ) );
-    TEST_EQUAL( psa_get_key_lifetime( &attributes ),
-                PSA_KEY_LIFETIME_PERSISTENT );
-    TEST_EQUAL( psa_get_key_type( &attributes ), type );
-    TEST_EQUAL( psa_get_key_bits( &attributes ), (size_t) expected_bits );
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes ), PSA_KEY_USAGE_EXPORT );
-    TEST_EQUAL( psa_get_key_algorithm( &attributes ), 0 );
+    psa_reset_key_attributes(&attributes);
+    PSA_ASSERT(psa_get_key_attributes(key_id, &attributes));
+    TEST_ASSERT(mbedtls_svc_key_id_equal(
+                    psa_get_key_id(&attributes), key_id));
+    TEST_EQUAL(psa_get_key_lifetime(&attributes),
+               PSA_KEY_LIFETIME_PERSISTENT);
+    TEST_EQUAL(psa_get_key_type(&attributes), type);
+    TEST_EQUAL(psa_get_key_bits(&attributes), (size_t) expected_bits);
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes), PSA_KEY_USAGE_EXPORT);
+    TEST_EQUAL(psa_get_key_algorithm(&attributes), 0);
 
-    TEST_EQUAL( psa_is_key_present_in_storage( key_id ), 1 );
+    TEST_EQUAL(psa_is_key_present_in_storage(key_id), 1);
 
-    if( key_not_exist )
-    {
-        psa_destroy_persistent_key( key_id );
+    if (key_not_exist) {
+        psa_destroy_persistent_key(key_id);
     }
     /* Export the key */
-    PSA_ASSERT( psa_export_key( key_id, exported, export_size,
-                                &exported_length ) );
+    PSA_ASSERT(psa_export_key(key_id, exported, export_size,
+                              &exported_length));
 
-    ASSERT_COMPARE( data->x, data->len, exported, exported_length );
+    ASSERT_COMPARE(data->x, data->len, exported, exported_length);
 
     /* Destroy the key */
-    PSA_ASSERT( psa_destroy_key( key_id ) );
-    TEST_EQUAL( psa_is_key_present_in_storage( key_id ), 0 );
+    PSA_ASSERT(psa_destroy_key(key_id));
+    TEST_EQUAL(psa_is_key_present_in_storage(key_id), 0);
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    mbedtls_free( exported );
-    PSA_DONE( );
-    psa_destroy_persistent_key( key_id );
+    mbedtls_free(exported);
+    PSA_DONE();
+    psa_destroy_persistent_key(key_id);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void destroy_nonexistent( int id_arg, int expected_status_arg )
+void destroy_nonexistent(int id_arg, int expected_status_arg)
 {
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, id_arg );
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, id_arg);
     psa_status_t expected_status = expected_status_arg;
 
-    PSA_INIT( );
+    PSA_INIT();
 
-    TEST_EQUAL( expected_status, psa_destroy_key( id ) );
+    TEST_EQUAL(expected_status, psa_destroy_key(id));
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_se_driver_hal.function b/tests/suites/test_suite_psa_crypto_se_driver_hal.function
index c96b988..aeced54 100644
--- a/tests/suites/test_suite_psa_crypto_se_driver_hal.function
+++ b/tests/suites/test_suite_psa_crypto_se_driver_hal.function
@@ -24,16 +24,16 @@
 /** The location and lifetime used for tests that use a single driver. */
 #define TEST_DRIVER_LOCATION 1
 #define TEST_SE_PERSISTENT_LIFETIME                             \
-    ( PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(           \
-        PSA_KEY_PERSISTENCE_DEFAULT, TEST_DRIVER_LOCATION ) )
+    (PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(           \
+         PSA_KEY_PERSISTENCE_DEFAULT, TEST_DRIVER_LOCATION))
 
 #define TEST_SE_VOLATILE_LIFETIME                               \
-    ( PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(           \
-        PSA_KEY_PERSISTENCE_VOLATILE, TEST_DRIVER_LOCATION ) )
+    (PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(           \
+         PSA_KEY_PERSISTENCE_VOLATILE, TEST_DRIVER_LOCATION))
 
 /** The driver detected a condition that shouldn't happen.
  * This is probably a bug in the library. */
-#define PSA_ERROR_DETECTED_BY_DRIVER ((psa_status_t)( -500 ))
+#define PSA_ERROR_DETECTED_BY_DRIVER ((psa_status_t) (-500))
 
 /** Like #TEST_ASSERT for use in a driver method, with no cleanup.
  *
@@ -41,14 +41,14 @@
  *
  * Use this macro to assert on guarantees provided by the core.
  */
-#define DRIVER_ASSERT_RETURN( TEST )                        \
+#define DRIVER_ASSERT_RETURN(TEST)                        \
     do {                                                    \
-       if( ! (TEST) )                                       \
-       {                                                    \
-          mbedtls_test_fail( #TEST, __LINE__, __FILE__ );   \
-          return( PSA_ERROR_DETECTED_BY_DRIVER );           \
-       }                                                    \
-    } while( 0 )
+        if (!(TEST))                                       \
+        {                                                    \
+            mbedtls_test_fail( #TEST, __LINE__, __FILE__);   \
+            return PSA_ERROR_DETECTED_BY_DRIVER;           \
+        }                                                    \
+    } while (0)
 
 /** Like #TEST_ASSERT for use in a driver method, with cleanup.
  *
@@ -57,15 +57,15 @@
  *
  * Use this macro to assert on guarantees provided by the core.
  */
-#define DRIVER_ASSERT( TEST )                               \
+#define DRIVER_ASSERT(TEST)                               \
     do {                                                    \
-       if( ! (TEST) )                                       \
-       {                                                    \
-          mbedtls_test_fail( #TEST, __LINE__, __FILE__ );   \
-          status = PSA_ERROR_DETECTED_BY_DRIVER;            \
-          goto exit;                                        \
-       }                                                    \
-    } while( 0 )
+        if (!(TEST))                                       \
+        {                                                    \
+            mbedtls_test_fail( #TEST, __LINE__, __FILE__);   \
+            status = PSA_ERROR_DETECTED_BY_DRIVER;            \
+            goto exit;                                        \
+        }                                                    \
+    } while (0)
 
 /** Like #PSA_ASSERT for a PSA API call that calls a driver underneath.
  *
@@ -78,17 +78,17 @@
  * case, the test driver code is expected to have called mbedtls_test_fail()
  * already, so we make sure not to overwrite the failure information.
  */
-#define PSA_ASSERT_VIA_DRIVER( expr, expected_status )                  \
+#define PSA_ASSERT_VIA_DRIVER(expr, expected_status)                  \
     do {                                                                \
-        psa_status_t PSA_ASSERT_VIA_DRIVER_status = ( expr );           \
-        if( PSA_ASSERT_VIA_DRIVER_status == PSA_ERROR_DETECTED_BY_DRIVER ) \
-            goto exit;                                                  \
-        if( PSA_ASSERT_VIA_DRIVER_status != ( expected_status ) )       \
+        psa_status_t PSA_ASSERT_VIA_DRIVER_status = (expr);           \
+        if (PSA_ASSERT_VIA_DRIVER_status == PSA_ERROR_DETECTED_BY_DRIVER) \
+        goto exit;                                                  \
+        if (PSA_ASSERT_VIA_DRIVER_status != (expected_status))       \
         {                                                               \
-            mbedtls_test_fail( #expr, __LINE__, __FILE__ );                     \
+            mbedtls_test_fail( #expr, __LINE__, __FILE__);                     \
             goto exit;                                                  \
         }                                                               \
-    } while( 0 )
+    } while (0)
 
 
 
@@ -97,20 +97,21 @@
 /****************************************************************/
 
 /* Return the exact bit size given a curve family and a byte length. */
-static size_t ecc_curve_bits( psa_ecc_family_t curve, size_t data_length )
+static size_t ecc_curve_bits(psa_ecc_family_t curve, size_t data_length)
 {
-    switch( curve )
-    {
+    switch (curve) {
         case PSA_ECC_FAMILY_SECP_R1:
-            if( data_length == PSA_BYTES_TO_BITS( 521 ) )
-                return( 521 );
+            if (data_length == PSA_BYTES_TO_BITS(521)) {
+                return 521;
+            }
             break;
         case PSA_ECC_FAMILY_MONTGOMERY:
-            if( data_length == PSA_BYTES_TO_BITS( 255 ) )
-                return( 255 );
+            if (data_length == PSA_BYTES_TO_BITS(255)) {
+                return 255;
+            }
     }
     /* If not listed above, assume a multiple of 8 bits. */
-    return( PSA_BYTES_TO_BITS( data_length ) );
+    return PSA_BYTES_TO_BITS(data_length);
 }
 
 
@@ -118,8 +119,7 @@
 /* Miscellaneous driver methods */
 /****************************************************************/
 
-typedef struct
-{
+typedef struct {
     psa_key_slot_number_t slot_number;
     psa_key_creation_method_t method;
     psa_status_t status;
@@ -132,50 +132,52 @@
     void *persistent_data,
     const psa_key_attributes_t *attributes,
     psa_key_creation_method_t method,
-    psa_key_slot_number_t slot_number )
+    psa_key_slot_number_t slot_number)
 {
     (void) context;
     (void) persistent_data;
     (void) attributes;
-    DRIVER_ASSERT_RETURN( slot_number ==
-                          validate_slot_number_directions.slot_number );
-    DRIVER_ASSERT_RETURN( method ==
-                          validate_slot_number_directions.method );
-    return( validate_slot_number_directions.status );
+    DRIVER_ASSERT_RETURN(slot_number ==
+                         validate_slot_number_directions.slot_number);
+    DRIVER_ASSERT_RETURN(method ==
+                         validate_slot_number_directions.method);
+    return validate_slot_number_directions.status;
 }
 
 /* Allocate slot numbers with a monotonic counter. */
 static psa_key_slot_number_t shadow_counter;
-static void counter_reset( void )
+static void counter_reset(void)
 {
     shadow_counter = 0;
 }
-static psa_status_t counter_allocate( psa_drv_se_context_t *context,
-                                      void *persistent_data,
-                                      const psa_key_attributes_t *attributes,
-                                      psa_key_creation_method_t method,
-                                      psa_key_slot_number_t *slot_number )
+static psa_status_t counter_allocate(psa_drv_se_context_t *context,
+                                     void *persistent_data,
+                                     const psa_key_attributes_t *attributes,
+                                     psa_key_creation_method_t method,
+                                     psa_key_slot_number_t *slot_number)
 {
     psa_key_slot_number_t *p_counter = persistent_data;
     (void) attributes;
     (void) method;
-    if( context->persistent_data_size != sizeof( psa_key_slot_number_t ) )
-        return( PSA_ERROR_DETECTED_BY_DRIVER );
+    if (context->persistent_data_size != sizeof(psa_key_slot_number_t)) {
+        return PSA_ERROR_DETECTED_BY_DRIVER;
+    }
     ++*p_counter;
-    if( *p_counter == 0 )
-        return( PSA_ERROR_INSUFFICIENT_STORAGE );
+    if (*p_counter == 0) {
+        return PSA_ERROR_INSUFFICIENT_STORAGE;
+    }
     shadow_counter = *p_counter;
     *slot_number = *p_counter;
-    return( PSA_SUCCESS );
+    return PSA_SUCCESS;
 }
 
 /* Null import: do nothing, but pretend it worked. */
-static psa_status_t null_import( psa_drv_se_context_t *context,
-                                 psa_key_slot_number_t slot_number,
-                                 const psa_key_attributes_t *attributes,
-                                 const uint8_t *data,
-                                 size_t data_length,
-                                 size_t *bits )
+static psa_status_t null_import(psa_drv_se_context_t *context,
+                                psa_key_slot_number_t slot_number,
+                                const psa_key_attributes_t *attributes,
+                                const uint8_t *data,
+                                size_t data_length,
+                                size_t *bits)
 {
     (void) context;
     (void) slot_number;
@@ -183,41 +185,40 @@
     (void) data;
     /* We're supposed to return a key size. Return one that's correct for
      * plain data keys. */
-    *bits = PSA_BYTES_TO_BITS( data_length );
-    return( PSA_SUCCESS );
+    *bits = PSA_BYTES_TO_BITS(data_length);
+    return PSA_SUCCESS;
 }
 
 /* Null generate: do nothing, but pretend it worked. */
-static psa_status_t null_generate( psa_drv_se_context_t *context,
-                                   psa_key_slot_number_t slot_number,
-                                   const psa_key_attributes_t *attributes,
-                                   uint8_t *pubkey,
-                                   size_t pubkey_size,
-                                   size_t *pubkey_length )
+static psa_status_t null_generate(psa_drv_se_context_t *context,
+                                  psa_key_slot_number_t slot_number,
+                                  const psa_key_attributes_t *attributes,
+                                  uint8_t *pubkey,
+                                  size_t pubkey_size,
+                                  size_t *pubkey_length)
 {
     (void) context;
     (void) slot_number;
     (void) attributes;
 
-    DRIVER_ASSERT_RETURN( *pubkey_length == 0 );
-    if( ! PSA_KEY_TYPE_IS_KEY_PAIR( psa_get_key_type( attributes ) ) )
-    {
-        DRIVER_ASSERT_RETURN( pubkey == NULL );
-        DRIVER_ASSERT_RETURN( pubkey_size == 0 );
+    DRIVER_ASSERT_RETURN(*pubkey_length == 0);
+    if (!PSA_KEY_TYPE_IS_KEY_PAIR(psa_get_key_type(attributes))) {
+        DRIVER_ASSERT_RETURN(pubkey == NULL);
+        DRIVER_ASSERT_RETURN(pubkey_size == 0);
     }
 
-    return( PSA_SUCCESS );
+    return PSA_SUCCESS;
 }
 
 /* Null destroy: do nothing, but pretend it worked. */
-static psa_status_t null_destroy( psa_drv_se_context_t *context,
-                                  void *persistent_data,
-                                  psa_key_slot_number_t slot_number )
+static psa_status_t null_destroy(psa_drv_se_context_t *context,
+                                 void *persistent_data,
+                                 psa_key_slot_number_t slot_number)
 {
     (void) context;
     (void) persistent_data;
     (void) slot_number;
-    return( PSA_SUCCESS );
+    return PSA_SUCCESS;
 }
 
 
@@ -227,8 +228,7 @@
 /****************************************************************/
 
 #define RAM_MAX_KEY_SIZE 64
-typedef struct
-{
+typedef struct {
     psa_key_lifetime_t lifetime;
     psa_key_type_t type;
     size_t bits;
@@ -244,9 +244,9 @@
 
 static uint8_t ram_min_slot = 0;
 
-static void ram_slots_reset( void )
+static void ram_slots_reset(void)
 {
-    memset( ram_slots, 0, sizeof( ram_slots ) );
+    memset(ram_slots, 0, sizeof(ram_slots));
     ram_min_slot = 0;
     ram_shadow_slot_usage = 0;
 }
@@ -259,168 +259,165 @@
  * in the test case function's cleanup code) and it might be wrong
  * (if slot_number is invalid).
  */
-static psa_status_t ram_create_common( psa_drv_se_context_t *context,
-                                       psa_key_slot_number_t slot_number,
-                                       const psa_key_attributes_t *attributes,
-                                       size_t required_storage )
+static psa_status_t ram_create_common(psa_drv_se_context_t *context,
+                                      psa_key_slot_number_t slot_number,
+                                      const psa_key_attributes_t *attributes,
+                                      size_t required_storage)
 {
     (void) context;
-    DRIVER_ASSERT_RETURN( slot_number < ARRAY_LENGTH( ram_slots ) );
+    DRIVER_ASSERT_RETURN(slot_number < ARRAY_LENGTH(ram_slots));
 
-    ram_slots[slot_number].lifetime = psa_get_key_lifetime( attributes );
-    ram_slots[slot_number].type = psa_get_key_type( attributes );
-    ram_slots[slot_number].bits = psa_get_key_bits( attributes );
+    ram_slots[slot_number].lifetime = psa_get_key_lifetime(attributes);
+    ram_slots[slot_number].type = psa_get_key_type(attributes);
+    ram_slots[slot_number].bits = psa_get_key_bits(attributes);
 
-    if( required_storage > sizeof( ram_slots[slot_number].content ) )
-    {
-        memset( &ram_slots[slot_number], 0, sizeof( ram_slots[slot_number] ) );
-        return( PSA_ERROR_INSUFFICIENT_STORAGE );
+    if (required_storage > sizeof(ram_slots[slot_number].content)) {
+        memset(&ram_slots[slot_number], 0, sizeof(ram_slots[slot_number]));
+        return PSA_ERROR_INSUFFICIENT_STORAGE;
     }
 
-    return( PSA_SUCCESS );
+    return PSA_SUCCESS;
 }
 
 /* This function does everything except actually generating key material.
  * After calling it, you must copy the desired key material to
  * ram_slots[slot_number].content. */
-static psa_status_t ram_fake_generate( psa_drv_se_context_t *context,
-                                       psa_key_slot_number_t slot_number,
-                                       const psa_key_attributes_t *attributes,
-                                       uint8_t *pubkey,
-                                       size_t pubkey_size,
-                                       size_t *pubkey_length )
+static psa_status_t ram_fake_generate(psa_drv_se_context_t *context,
+                                      psa_key_slot_number_t slot_number,
+                                      const psa_key_attributes_t *attributes,
+                                      uint8_t *pubkey,
+                                      size_t pubkey_size,
+                                      size_t *pubkey_length)
 {
     psa_status_t status;
     size_t required_storage =
-        PSA_EXPORT_KEY_OUTPUT_SIZE( psa_get_key_type( attributes ),
-                                    psa_get_key_bits( attributes ) );
+        PSA_EXPORT_KEY_OUTPUT_SIZE(psa_get_key_type(attributes),
+                                   psa_get_key_bits(attributes));
 
-    DRIVER_ASSERT_RETURN( *pubkey_length == 0 );
-    if( ! PSA_KEY_TYPE_IS_KEY_PAIR( psa_get_key_type( attributes ) ) )
-    {
-        DRIVER_ASSERT_RETURN( pubkey == NULL );
-        DRIVER_ASSERT_RETURN( pubkey_size == 0 );
+    DRIVER_ASSERT_RETURN(*pubkey_length == 0);
+    if (!PSA_KEY_TYPE_IS_KEY_PAIR(psa_get_key_type(attributes))) {
+        DRIVER_ASSERT_RETURN(pubkey == NULL);
+        DRIVER_ASSERT_RETURN(pubkey_size == 0);
     }
 
-    status = ram_create_common( context, slot_number, attributes,
-                                required_storage );
-    return( status );
+    status = ram_create_common(context, slot_number, attributes,
+                               required_storage);
+    return status;
 }
 
-static psa_status_t ram_import( psa_drv_se_context_t *context,
-                                psa_key_slot_number_t slot_number,
-                                const psa_key_attributes_t *attributes,
-                                const uint8_t *data,
-                                size_t data_length,
-                                size_t *bits )
+static psa_status_t ram_import(psa_drv_se_context_t *context,
+                               psa_key_slot_number_t slot_number,
+                               const psa_key_attributes_t *attributes,
+                               const uint8_t *data,
+                               size_t data_length,
+                               size_t *bits)
 {
-    psa_key_type_t type = psa_get_key_type( attributes );
-    psa_status_t status = ram_create_common( context, slot_number, attributes,
-                                             data_length );
-    if( status != PSA_SUCCESS )
-        return( status );
+    psa_key_type_t type = psa_get_key_type(attributes);
+    psa_status_t status = ram_create_common(context, slot_number, attributes,
+                                            data_length);
+    if (status != PSA_SUCCESS) {
+        return status;
+    }
 
     /* The RAM driver only works for certain key types: raw keys,
      * and ECC key pairs. This is true in particular of the bit-size
      * calculation here. */
-    if( PSA_KEY_TYPE_IS_UNSTRUCTURED( type ) )
-        *bits = PSA_BYTES_TO_BITS( data_length );
-    else if ( PSA_KEY_TYPE_IS_ECC_KEY_PAIR( type ) )
-    {
-        *bits = ecc_curve_bits( PSA_KEY_TYPE_ECC_GET_FAMILY( type ), data_length );
-        if( *bits == 0 )
-            return( PSA_ERROR_DETECTED_BY_DRIVER );
-    }
-    else
-    {
-        memset( &ram_slots[slot_number], 0, sizeof( ram_slots[slot_number] ) );
-        return( PSA_ERROR_NOT_SUPPORTED );
+    if (PSA_KEY_TYPE_IS_UNSTRUCTURED(type)) {
+        *bits = PSA_BYTES_TO_BITS(data_length);
+    } else if (PSA_KEY_TYPE_IS_ECC_KEY_PAIR(type)) {
+        *bits = ecc_curve_bits(PSA_KEY_TYPE_ECC_GET_FAMILY(type), data_length);
+        if (*bits == 0) {
+            return PSA_ERROR_DETECTED_BY_DRIVER;
+        }
+    } else {
+        memset(&ram_slots[slot_number], 0, sizeof(ram_slots[slot_number]));
+        return PSA_ERROR_NOT_SUPPORTED;
     }
 
     ram_slots[slot_number].bits = *bits;
-    memcpy( ram_slots[slot_number].content, data, data_length );
+    memcpy(ram_slots[slot_number].content, data, data_length);
 
-    return( PSA_SUCCESS );
+    return PSA_SUCCESS;
 }
 
-static psa_status_t ram_export( psa_drv_se_context_t *context,
-                                psa_key_slot_number_t slot_number,
-                                uint8_t *data,
-                                size_t data_size,
-                                size_t *data_length )
+static psa_status_t ram_export(psa_drv_se_context_t *context,
+                               psa_key_slot_number_t slot_number,
+                               uint8_t *data,
+                               size_t data_size,
+                               size_t *data_length)
 {
     size_t actual_size;
     (void) context;
-    DRIVER_ASSERT_RETURN( slot_number < ARRAY_LENGTH( ram_slots ) );
-    actual_size = PSA_BITS_TO_BYTES( ram_slots[slot_number].bits );
-    if( actual_size > data_size )
-        return( PSA_ERROR_BUFFER_TOO_SMALL );
+    DRIVER_ASSERT_RETURN(slot_number < ARRAY_LENGTH(ram_slots));
+    actual_size = PSA_BITS_TO_BYTES(ram_slots[slot_number].bits);
+    if (actual_size > data_size) {
+        return PSA_ERROR_BUFFER_TOO_SMALL;
+    }
     *data_length = actual_size;
-    memcpy( data, ram_slots[slot_number].content, actual_size );
-    return( PSA_SUCCESS );
+    memcpy(data, ram_slots[slot_number].content, actual_size);
+    return PSA_SUCCESS;
 }
 
-static psa_status_t ram_export_public( psa_drv_se_context_t *context,
-                                       psa_key_slot_number_t slot_number,
-                                       uint8_t *data,
-                                       size_t data_size,
-                                       size_t *data_length )
+static psa_status_t ram_export_public(psa_drv_se_context_t *context,
+                                      psa_key_slot_number_t slot_number,
+                                      uint8_t *data,
+                                      size_t data_size,
+                                      size_t *data_length)
 {
     psa_status_t status;
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
     (void) context;
-    DRIVER_ASSERT_RETURN( slot_number < ARRAY_LENGTH( ram_slots ) );
+    DRIVER_ASSERT_RETURN(slot_number < ARRAY_LENGTH(ram_slots));
     DRIVER_ASSERT_RETURN(
-        PSA_KEY_TYPE_IS_KEY_PAIR( ram_slots[slot_number].type ) );
+        PSA_KEY_TYPE_IS_KEY_PAIR(ram_slots[slot_number].type));
 
-    psa_set_key_type( &attributes, ram_slots[slot_number].type );
-    status = psa_import_key( &attributes,
-                             ram_slots[slot_number].content,
-                             PSA_BITS_TO_BYTES( ram_slots[slot_number].bits ),
-                             &key );
-    if( status != PSA_SUCCESS )
-        return( status );
-    status = psa_export_public_key( key, data, data_size, data_length );
-    psa_destroy_key( key );
-    return( PSA_SUCCESS );
+    psa_set_key_type(&attributes, ram_slots[slot_number].type);
+    status = psa_import_key(&attributes,
+                            ram_slots[slot_number].content,
+                            PSA_BITS_TO_BYTES(ram_slots[slot_number].bits),
+                            &key);
+    if (status != PSA_SUCCESS) {
+        return status;
+    }
+    status = psa_export_public_key(key, data, data_size, data_length);
+    psa_destroy_key(key);
+    return PSA_SUCCESS;
 }
 
-static psa_status_t ram_destroy( psa_drv_se_context_t *context,
-                                 void *persistent_data,
-                                 psa_key_slot_number_t slot_number )
+static psa_status_t ram_destroy(psa_drv_se_context_t *context,
+                                void *persistent_data,
+                                psa_key_slot_number_t slot_number)
 {
     ram_slot_usage_t *slot_usage = persistent_data;
-    DRIVER_ASSERT_RETURN( context->persistent_data_size == sizeof( ram_slot_usage_t ) );
-    DRIVER_ASSERT_RETURN( slot_number < ARRAY_LENGTH( ram_slots ) );
-    memset( &ram_slots[slot_number], 0, sizeof( ram_slots[slot_number] ) );
-    *slot_usage &= ~(ram_slot_usage_t)( 1 << slot_number );
+    DRIVER_ASSERT_RETURN(context->persistent_data_size == sizeof(ram_slot_usage_t));
+    DRIVER_ASSERT_RETURN(slot_number < ARRAY_LENGTH(ram_slots));
+    memset(&ram_slots[slot_number], 0, sizeof(ram_slots[slot_number]));
+    *slot_usage &= ~(ram_slot_usage_t) (1 << slot_number);
     ram_shadow_slot_usage = *slot_usage;
-    return( PSA_SUCCESS );
+    return PSA_SUCCESS;
 }
 
-static psa_status_t ram_allocate( psa_drv_se_context_t *context,
-                                  void *persistent_data,
-                                  const psa_key_attributes_t *attributes,
-                                  psa_key_creation_method_t method,
-                                  psa_key_slot_number_t *slot_number )
+static psa_status_t ram_allocate(psa_drv_se_context_t *context,
+                                 void *persistent_data,
+                                 const psa_key_attributes_t *attributes,
+                                 psa_key_creation_method_t method,
+                                 psa_key_slot_number_t *slot_number)
 {
     ram_slot_usage_t *slot_usage = persistent_data;
     (void) attributes;
     (void) method;
-    DRIVER_ASSERT_RETURN( context->persistent_data_size == sizeof( ram_slot_usage_t ) );
-    for( *slot_number = ram_min_slot;
-         *slot_number < ARRAY_LENGTH( ram_slots );
-         ++( *slot_number ) )
-    {
-        if( ! ( *slot_usage & 1 << *slot_number ) )
-        {
+    DRIVER_ASSERT_RETURN(context->persistent_data_size == sizeof(ram_slot_usage_t));
+    for (*slot_number = ram_min_slot;
+         *slot_number < ARRAY_LENGTH(ram_slots);
+         ++(*slot_number)) {
+        if (!(*slot_usage & 1 << *slot_number)) {
             ram_shadow_slot_usage = *slot_usage;
-            return( PSA_SUCCESS );
+            return PSA_SUCCESS;
         }
     }
-    return( PSA_ERROR_INSUFFICIENT_STORAGE );
+    return PSA_ERROR_INSUFFICIENT_STORAGE;
 }
 
 static psa_status_t ram_validate_slot_number(
@@ -428,25 +425,26 @@
     void *persistent_data,
     const psa_key_attributes_t *attributes,
     psa_key_creation_method_t method,
-    psa_key_slot_number_t slot_number )
+    psa_key_slot_number_t slot_number)
 {
     (void) context;
     (void) persistent_data;
     (void) attributes;
     (void) method;
-    if( slot_number >= ARRAY_LENGTH( ram_slots ) )
-        return( PSA_ERROR_INVALID_ARGUMENT );
-    return( PSA_SUCCESS );
+    if (slot_number >= ARRAY_LENGTH(ram_slots)) {
+        return PSA_ERROR_INVALID_ARGUMENT;
+    }
+    return PSA_SUCCESS;
 }
 
-static psa_status_t ram_sign( psa_drv_se_context_t *context,
-                              psa_key_slot_number_t slot_number,
-                              psa_algorithm_t alg,
-                              const uint8_t *hash,
-                              size_t hash_length,
-                              uint8_t *signature,
-                              size_t signature_size,
-                              size_t *signature_length )
+static psa_status_t ram_sign(psa_drv_se_context_t *context,
+                             psa_key_slot_number_t slot_number,
+                             psa_algorithm_t alg,
+                             const uint8_t *hash,
+                             size_t hash_length,
+                             uint8_t *signature,
+                             size_t signature_size,
+                             size_t *signature_length)
 {
     ram_slot_t *slot;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -454,32 +452,32 @@
     psa_status_t status = PSA_ERROR_GENERIC_ERROR;
 
     (void) context;
-    DRIVER_ASSERT_RETURN( slot_number < ARRAY_LENGTH( ram_slots ) );
+    DRIVER_ASSERT_RETURN(slot_number < ARRAY_LENGTH(ram_slots));
     slot = &ram_slots[slot_number];
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, slot->type );
-    DRIVER_ASSERT( psa_import_key( &attributes,
-                                   slot->content,
-                                   PSA_BITS_TO_BYTES( slot->bits ),
-                                   &key ) == PSA_SUCCESS );
-    status = psa_sign_hash( key, alg,
-                            hash, hash_length,
-                            signature, signature_size, signature_length );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, slot->type);
+    DRIVER_ASSERT(psa_import_key(&attributes,
+                                 slot->content,
+                                 PSA_BITS_TO_BYTES(slot->bits),
+                                 &key) == PSA_SUCCESS);
+    status = psa_sign_hash(key, alg,
+                           hash, hash_length,
+                           signature, signature_size, signature_length);
 
 exit:
-    psa_destroy_key( key );
-    return( status );
+    psa_destroy_key(key);
+    return status;
 }
 
-static psa_status_t ram_verify( psa_drv_se_context_t *context,
-                                psa_key_slot_number_t slot_number,
-                                psa_algorithm_t alg,
-                                const uint8_t *hash,
-                                size_t hash_length,
-                                const uint8_t *signature,
-                                size_t signature_length )
+static psa_status_t ram_verify(psa_drv_se_context_t *context,
+                               psa_key_slot_number_t slot_number,
+                               psa_algorithm_t alg,
+                               const uint8_t *hash,
+                               size_t hash_length,
+                               const uint8_t *signature,
+                               size_t signature_length)
 {
     ram_slot_t *slot;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -487,24 +485,24 @@
     psa_status_t status = PSA_ERROR_GENERIC_ERROR;
 
     (void) context;
-    DRIVER_ASSERT_RETURN( slot_number < ARRAY_LENGTH( ram_slots ) );
+    DRIVER_ASSERT_RETURN(slot_number < ARRAY_LENGTH(ram_slots));
     slot = &ram_slots[slot_number];
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_VERIFY_HASH );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, slot->type );
-    DRIVER_ASSERT( psa_import_key( &attributes,
-                                   slot->content,
-                                   PSA_BITS_TO_BYTES( slot->bits ),
-                                   &key ) ==
-                   PSA_SUCCESS );
-    status = psa_verify_hash( key, alg,
-                              hash, hash_length,
-                              signature, signature_length );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_VERIFY_HASH);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, slot->type);
+    DRIVER_ASSERT(psa_import_key(&attributes,
+                                 slot->content,
+                                 PSA_BITS_TO_BYTES(slot->bits),
+                                 &key) ==
+                  PSA_SUCCESS);
+    status = psa_verify_hash(key, alg,
+                             hash, hash_length,
+                             signature, signature_length);
 
 exit:
-    psa_destroy_key( key );
-    return( status );
+    psa_destroy_key(key);
+    return status;
 }
 
 
@@ -512,8 +510,7 @@
 /* Other test helper functions */
 /****************************************************************/
 
-typedef enum
-{
+typedef enum {
     SIGN_IN_SOFTWARE_AND_PARALLEL_CREATION,
     SIGN_IN_DRIVER_AND_PARALLEL_CREATION,
     SIGN_IN_DRIVER_THEN_EXPORT_PUBLIC,
@@ -523,54 +520,49 @@
  * are consistent with the attributes used when creating the key. */
 static int check_key_attributes(
     mbedtls_svc_key_id_t key,
-    const psa_key_attributes_t *reference_attributes )
+    const psa_key_attributes_t *reference_attributes)
 {
     int ok = 0;
     psa_key_attributes_t actual_attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_ASSERT( psa_get_key_attributes( key, &actual_attributes ) );
+    PSA_ASSERT(psa_get_key_attributes(key, &actual_attributes));
 
-    TEST_ASSERT( mbedtls_svc_key_id_equal(
-                     psa_get_key_id( &actual_attributes ),
-                     psa_get_key_id( reference_attributes ) ) );
-    TEST_EQUAL( psa_get_key_lifetime( &actual_attributes ),
-                psa_get_key_lifetime( reference_attributes ) );
-    TEST_EQUAL( psa_get_key_type( &actual_attributes ),
-                psa_get_key_type( reference_attributes ) );
-    TEST_EQUAL( psa_get_key_usage_flags( &actual_attributes ),
-                psa_get_key_usage_flags( reference_attributes ) );
-    TEST_EQUAL( psa_get_key_algorithm( &actual_attributes ),
-                psa_get_key_algorithm( reference_attributes ) );
-    TEST_EQUAL( psa_get_key_enrollment_algorithm( &actual_attributes ),
-                psa_get_key_enrollment_algorithm( reference_attributes ) );
-    if( psa_get_key_bits( reference_attributes ) != 0 )
-    {
-        TEST_EQUAL( psa_get_key_bits( &actual_attributes ),
-                    psa_get_key_bits( reference_attributes ) );
+    TEST_ASSERT(mbedtls_svc_key_id_equal(
+                    psa_get_key_id(&actual_attributes),
+                    psa_get_key_id(reference_attributes)));
+    TEST_EQUAL(psa_get_key_lifetime(&actual_attributes),
+               psa_get_key_lifetime(reference_attributes));
+    TEST_EQUAL(psa_get_key_type(&actual_attributes),
+               psa_get_key_type(reference_attributes));
+    TEST_EQUAL(psa_get_key_usage_flags(&actual_attributes),
+               psa_get_key_usage_flags(reference_attributes));
+    TEST_EQUAL(psa_get_key_algorithm(&actual_attributes),
+               psa_get_key_algorithm(reference_attributes));
+    TEST_EQUAL(psa_get_key_enrollment_algorithm(&actual_attributes),
+               psa_get_key_enrollment_algorithm(reference_attributes));
+    if (psa_get_key_bits(reference_attributes) != 0) {
+        TEST_EQUAL(psa_get_key_bits(&actual_attributes),
+                   psa_get_key_bits(reference_attributes));
     }
 
     {
         psa_key_slot_number_t actual_slot_number = 0xdeadbeef;
         psa_key_slot_number_t desired_slot_number = 0xb90cc011;
         psa_key_lifetime_t lifetime =
-            psa_get_key_lifetime( &actual_attributes );
-        psa_status_t status = psa_get_key_slot_number( &actual_attributes,
-                                                       &actual_slot_number );
-        if( PSA_KEY_LIFETIME_GET_LOCATION( lifetime ) < MIN_DRIVER_LOCATION )
-        {
+            psa_get_key_lifetime(&actual_attributes);
+        psa_status_t status = psa_get_key_slot_number(&actual_attributes,
+                                                      &actual_slot_number);
+        if (PSA_KEY_LIFETIME_GET_LOCATION(lifetime) < MIN_DRIVER_LOCATION) {
             /* The key is not in a secure element. */
-            TEST_EQUAL( status, PSA_ERROR_INVALID_ARGUMENT );
-        }
-        else
-        {
+            TEST_EQUAL(status, PSA_ERROR_INVALID_ARGUMENT);
+        } else {
             /* The key is in a secure element. If it had been created
              * in a specific slot, check that it is reported there. */
-            PSA_ASSERT( status );
-            status = psa_get_key_slot_number( reference_attributes,
-                                              &desired_slot_number );
-            if( status == PSA_SUCCESS )
-            {
-                TEST_EQUAL( desired_slot_number, actual_slot_number );
+            PSA_ASSERT(status);
+            status = psa_get_key_slot_number(reference_attributes,
+                                             &desired_slot_number);
+            if (status == PSA_SUCCESS) {
+                TEST_EQUAL(desired_slot_number, actual_slot_number);
             }
         }
     }
@@ -581,64 +573,64 @@
      * Actual key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &actual_attributes );
+    psa_reset_key_attributes(&actual_attributes);
 
-    return( ok );
+    return ok;
 }
 
 /* Get the file UID corresponding to the specified location.
  * If this changes, the storage format version must change.
  * See psa_get_se_driver_its_file_uid() in psa_crypto_se.c.
  */
-psa_storage_uid_t file_uid_for_location( psa_key_location_t location )
+psa_storage_uid_t file_uid_for_location(psa_key_location_t location)
 {
-    if( location > PSA_MAX_SE_LOCATION )
-        return( 0 );
-    return( 0xfffffe00 + location );
+    if (location > PSA_MAX_SE_LOCATION) {
+        return 0;
+    }
+    return 0xfffffe00 + location;
 }
 
 /* Check that the persistent data of a driver has its expected content. */
-static int check_persistent_data( psa_key_location_t location,
-                                  const void *expected_data,
-                                  size_t size )
+static int check_persistent_data(psa_key_location_t location,
+                                 const void *expected_data,
+                                 size_t size)
 {
-    psa_storage_uid_t uid = file_uid_for_location( location );
+    psa_storage_uid_t uid = file_uid_for_location(location);
     struct psa_storage_info_t info;
     uint8_t *loaded = NULL;
     int ok = 0;
 
-    PSA_ASSERT( psa_its_get_info( uid, &info ) );
-    ASSERT_ALLOC( loaded, info.size );
-    PSA_ASSERT( psa_its_get( uid, 0, info.size, loaded, NULL ) );
-    ASSERT_COMPARE( expected_data, size, loaded, info.size );
+    PSA_ASSERT(psa_its_get_info(uid, &info));
+    ASSERT_ALLOC(loaded, info.size);
+    PSA_ASSERT(psa_its_get(uid, 0, info.size, loaded, NULL));
+    ASSERT_COMPARE(expected_data, size, loaded, info.size);
     ok = 1;
 
 exit:
-    mbedtls_free( loaded );
-    return( ok );
+    mbedtls_free(loaded);
+    return ok;
 }
 
 /* Check that no persistent data exists for the given location. */
-static int check_no_persistent_data( psa_key_location_t location )
+static int check_no_persistent_data(psa_key_location_t location)
 {
-    psa_storage_uid_t uid = file_uid_for_location( location );
+    psa_storage_uid_t uid = file_uid_for_location(location);
     struct psa_storage_info_t info;
     int ok = 0;
 
-    TEST_EQUAL( psa_its_get_info( uid, &info ), PSA_ERROR_DOES_NOT_EXIST );
+    TEST_EQUAL(psa_its_get_info(uid, &info), PSA_ERROR_DOES_NOT_EXIST);
     ok = 1;
 
 exit:
-    return( ok );
+    return ok;
 }
 
 /* Check that a function's return status is "smoke-free", i.e. that
  * it's an acceptable error code when calling an API function that operates
  * on a key with potentially bogus parameters. */
-static int is_status_smoke_free( psa_status_t status )
+static int is_status_smoke_free(psa_status_t status)
 {
-    switch( status )
-    {
+    switch (status) {
         case PSA_SUCCESS:
         case PSA_ERROR_NOT_SUPPORTED:
         case PSA_ERROR_NOT_PERMITTED:
@@ -646,19 +638,19 @@
         case PSA_ERROR_INVALID_ARGUMENT:
         case PSA_ERROR_INVALID_SIGNATURE:
         case PSA_ERROR_INVALID_PADDING:
-            return( 1 );
+            return 1;
         default:
-            return( 0 );
+            return 0;
     }
 }
-#define SMOKE_ASSERT( expr )                    \
-    TEST_ASSERT( is_status_smoke_free( expr ) )
+#define SMOKE_ASSERT(expr)                    \
+    TEST_ASSERT(is_status_smoke_free(expr))
 
 /* Smoke test a key. There are mostly no wrong answers here since we pass
  * mostly bogus parameters: the goal is to ensure that there is no memory
  * corruption or crash. This test function is most useful when run under
  * an environment with sanity checks such as ASan or MSan. */
-static int smoke_test_key( mbedtls_svc_key_id_t key )
+static int smoke_test_key(mbedtls_svc_key_id_t key)
 {
     int ok = 0;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -672,88 +664,88 @@
     size_t length;
     mbedtls_svc_key_id_t key2 = MBEDTLS_SVC_KEY_ID_INIT;
 
-    SMOKE_ASSERT( psa_get_key_attributes( key, &attributes ) );
+    SMOKE_ASSERT(psa_get_key_attributes(key, &attributes));
 
-    SMOKE_ASSERT( psa_export_key( key,
-                                  buffer, sizeof( buffer ), &length ) );
-    SMOKE_ASSERT( psa_export_public_key( key,
-                                         buffer, sizeof( buffer ), &length ) );
+    SMOKE_ASSERT(psa_export_key(key,
+                                buffer, sizeof(buffer), &length));
+    SMOKE_ASSERT(psa_export_public_key(key,
+                                       buffer, sizeof(buffer), &length));
 
-    SMOKE_ASSERT( psa_copy_key( key, &attributes, &key2 ) );
-    if( ! mbedtls_svc_key_id_is_null( key2 ) )
-        PSA_ASSERT( psa_destroy_key( key2 ) );
+    SMOKE_ASSERT(psa_copy_key(key, &attributes, &key2));
+    if (!mbedtls_svc_key_id_is_null(key2)) {
+        PSA_ASSERT(psa_destroy_key(key2));
+    }
 
-    SMOKE_ASSERT( psa_mac_sign_setup( &mac_operation, key, PSA_ALG_CMAC ) );
-    PSA_ASSERT( psa_mac_abort( &mac_operation ) );
-    SMOKE_ASSERT( psa_mac_verify_setup( &mac_operation, key,
-                                        PSA_ALG_HMAC( PSA_ALG_SHA_256 ) ) );
-    PSA_ASSERT( psa_mac_abort( &mac_operation ) );
+    SMOKE_ASSERT(psa_mac_sign_setup(&mac_operation, key, PSA_ALG_CMAC));
+    PSA_ASSERT(psa_mac_abort(&mac_operation));
+    SMOKE_ASSERT(psa_mac_verify_setup(&mac_operation, key,
+                                      PSA_ALG_HMAC(PSA_ALG_SHA_256)));
+    PSA_ASSERT(psa_mac_abort(&mac_operation));
 
-    SMOKE_ASSERT( psa_cipher_encrypt_setup( &cipher_operation, key,
-                                            PSA_ALG_CTR ) );
-    PSA_ASSERT( psa_cipher_abort( &cipher_operation ) );
-    SMOKE_ASSERT( psa_cipher_decrypt_setup( &cipher_operation, key,
-                                            PSA_ALG_CTR ) );
-    PSA_ASSERT( psa_cipher_abort( &cipher_operation ) );
+    SMOKE_ASSERT(psa_cipher_encrypt_setup(&cipher_operation, key,
+                                          PSA_ALG_CTR));
+    PSA_ASSERT(psa_cipher_abort(&cipher_operation));
+    SMOKE_ASSERT(psa_cipher_decrypt_setup(&cipher_operation, key,
+                                          PSA_ALG_CTR));
+    PSA_ASSERT(psa_cipher_abort(&cipher_operation));
 
-    SMOKE_ASSERT( psa_aead_encrypt( key, PSA_ALG_CCM,
-                                    buffer, sizeof( buffer ),
-                                    NULL, 0,
-                                    buffer, sizeof( buffer),
-                                    buffer, sizeof( buffer), &length ) );
-    SMOKE_ASSERT( psa_aead_decrypt( key, PSA_ALG_CCM,
-                                    buffer, sizeof( buffer ),
-                                    NULL, 0,
-                                    buffer, sizeof( buffer),
-                                    buffer, sizeof( buffer), &length ) );
+    SMOKE_ASSERT(psa_aead_encrypt(key, PSA_ALG_CCM,
+                                  buffer, sizeof(buffer),
+                                  NULL, 0,
+                                  buffer, sizeof(buffer),
+                                  buffer, sizeof(buffer), &length));
+    SMOKE_ASSERT(psa_aead_decrypt(key, PSA_ALG_CCM,
+                                  buffer, sizeof(buffer),
+                                  NULL, 0,
+                                  buffer, sizeof(buffer),
+                                  buffer, sizeof(buffer), &length));
 
-    SMOKE_ASSERT( psa_sign_hash( key, PSA_ALG_ECDSA_ANY,
+    SMOKE_ASSERT(psa_sign_hash(key, PSA_ALG_ECDSA_ANY,
+                               buffer, 32,
+                               buffer, sizeof(buffer), &length));
+    SMOKE_ASSERT(psa_verify_hash(key, PSA_ALG_ECDSA_ANY,
                                  buffer, 32,
-                                 buffer, sizeof( buffer ), &length ) );
-    SMOKE_ASSERT( psa_verify_hash( key, PSA_ALG_ECDSA_ANY,
-                                   buffer, 32,
-                                   buffer, sizeof( buffer ) ) );
+                                 buffer, sizeof(buffer)));
 
-    SMOKE_ASSERT( psa_asymmetric_encrypt( key, PSA_ALG_RSA_PKCS1V15_CRYPT,
-                                          buffer, 10, NULL, 0,
-                                          buffer, sizeof( buffer ), &length ) );
-    SMOKE_ASSERT( psa_asymmetric_decrypt( key, PSA_ALG_RSA_PKCS1V15_CRYPT,
-                                          buffer, sizeof( buffer ), NULL, 0,
-                                          buffer, sizeof( buffer ), &length ) );
+    SMOKE_ASSERT(psa_asymmetric_encrypt(key, PSA_ALG_RSA_PKCS1V15_CRYPT,
+                                        buffer, 10, NULL, 0,
+                                        buffer, sizeof(buffer), &length));
+    SMOKE_ASSERT(psa_asymmetric_decrypt(key, PSA_ALG_RSA_PKCS1V15_CRYPT,
+                                        buffer, sizeof(buffer), NULL, 0,
+                                        buffer, sizeof(buffer), &length));
 
 #if defined(MBEDTLS_SHA256_C)
     /* Try the key in a plain key derivation. */
-    PSA_ASSERT( psa_key_derivation_setup( &derivation_operation,
-                                          PSA_ALG_HKDF( PSA_ALG_SHA_256 ) ) );
-    PSA_ASSERT( psa_key_derivation_input_bytes( &derivation_operation,
-                                                PSA_KEY_DERIVATION_INPUT_SALT,
-                                                NULL, 0 ) );
-    SMOKE_ASSERT( psa_key_derivation_input_key( &derivation_operation,
-                                                PSA_KEY_DERIVATION_INPUT_SECRET,
-                                                key ) );
-    PSA_ASSERT( psa_key_derivation_abort( &derivation_operation ) );
+    PSA_ASSERT(psa_key_derivation_setup(&derivation_operation,
+                                        PSA_ALG_HKDF(PSA_ALG_SHA_256)));
+    PSA_ASSERT(psa_key_derivation_input_bytes(&derivation_operation,
+                                              PSA_KEY_DERIVATION_INPUT_SALT,
+                                              NULL, 0));
+    SMOKE_ASSERT(psa_key_derivation_input_key(&derivation_operation,
+                                              PSA_KEY_DERIVATION_INPUT_SECRET,
+                                              key));
+    PSA_ASSERT(psa_key_derivation_abort(&derivation_operation));
 
     /* If the key is asymmetric, try it in a key agreement, both as
      * part of a derivation operation and standalone. */
-    if( psa_export_public_key( key, buffer, sizeof( buffer ), &length ) ==
-        PSA_SUCCESS )
-    {
+    if (psa_export_public_key(key, buffer, sizeof(buffer), &length) ==
+        PSA_SUCCESS) {
         psa_algorithm_t alg =
-            PSA_ALG_KEY_AGREEMENT( PSA_ALG_ECDH,
-                                   PSA_ALG_HKDF( PSA_ALG_SHA_256 ) );
-        PSA_ASSERT( psa_key_derivation_setup( &derivation_operation, alg ) );
-        PSA_ASSERT( psa_key_derivation_input_bytes(
-                        &derivation_operation, PSA_KEY_DERIVATION_INPUT_SALT,
-                        NULL, 0 ) );
-        SMOKE_ASSERT( psa_key_derivation_key_agreement(
-                          &derivation_operation,
-                          PSA_KEY_DERIVATION_INPUT_SECRET,
-                          key, buffer, length ) );
-        PSA_ASSERT( psa_key_derivation_abort( &derivation_operation ) );
+            PSA_ALG_KEY_AGREEMENT(PSA_ALG_ECDH,
+                                  PSA_ALG_HKDF(PSA_ALG_SHA_256));
+        PSA_ASSERT(psa_key_derivation_setup(&derivation_operation, alg));
+        PSA_ASSERT(psa_key_derivation_input_bytes(
+                       &derivation_operation, PSA_KEY_DERIVATION_INPUT_SALT,
+                       NULL, 0));
+        SMOKE_ASSERT(psa_key_derivation_key_agreement(
+                         &derivation_operation,
+                         PSA_KEY_DERIVATION_INPUT_SECRET,
+                         key, buffer, length));
+        PSA_ASSERT(psa_key_derivation_abort(&derivation_operation));
 
-        SMOKE_ASSERT( psa_raw_key_agreement(
-                          alg, key, buffer, length,
-                          buffer, sizeof( buffer ), &length ) );
+        SMOKE_ASSERT(psa_raw_key_agreement(
+                         alg, key, buffer, length,
+                         buffer, sizeof(buffer), &length));
     }
 #endif /* MBEDTLS_SHA256_C */
 
@@ -764,22 +756,23 @@
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    return( ok );
+    return ok;
 }
 
-static void psa_purge_storage( void )
+static void psa_purge_storage(void)
 {
     /* The generic code in mbedtls_test_psa_purge_key_storage()
      * (which is called by PSA_DONE()) doesn't take care of things that are
      * specific to dynamic secure elements. */
     psa_key_location_t location;
     /* Purge the transaction file. */
-    psa_crypto_stop_transaction( );
+    psa_crypto_stop_transaction();
     /* Purge driver persistent data. */
-    for( location = 0; location < PSA_MAX_SE_LOCATION; location++ )
-        psa_destroy_se_persistent_data( location );
+    for (location = 0; location < PSA_MAX_SE_LOCATION; location++) {
+        psa_destroy_se_persistent_data(location);
+    }
 }
 
 /* END_HEADER */
@@ -790,205 +783,207 @@
  */
 
 /* BEGIN_CASE */
-void register_one( int location, int version, int expected_status_arg )
+void register_one(int location, int version, int expected_status_arg)
 {
     psa_status_t expected_status = expected_status_arg;
     psa_drv_se_t driver;
 
-    memset( &driver, 0, sizeof( driver ) );
+    memset(&driver, 0, sizeof(driver));
     driver.hal_version = version;
 
-    TEST_EQUAL( psa_register_se_driver( location, &driver ),
-                expected_status );
+    TEST_EQUAL(psa_register_se_driver(location, &driver),
+               expected_status);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void register_twice( int count )
+void register_twice(int count)
 {
     psa_drv_se_t driver;
     psa_key_location_t location;
     psa_key_location_t max = MIN_DRIVER_LOCATION + count;
 
-    memset( &driver, 0, sizeof( driver ) );
+    memset(&driver, 0, sizeof(driver));
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
 
-    for( location = MIN_DRIVER_LOCATION; location < max; location++ )
-        PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    for( location = MIN_DRIVER_LOCATION; location < max; location++ )
-        TEST_EQUAL( psa_register_se_driver( location, &driver ),
-                    PSA_ERROR_ALREADY_EXISTS );
+    for (location = MIN_DRIVER_LOCATION; location < max; location++) {
+        PSA_ASSERT(psa_register_se_driver(location, &driver));
+    }
+    for (location = MIN_DRIVER_LOCATION; location < max; location++) {
+        TEST_EQUAL(psa_register_se_driver(location, &driver),
+                   PSA_ERROR_ALREADY_EXISTS);
+    }
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void register_max( )
+void register_max()
 {
     psa_drv_se_t driver;
     psa_key_location_t location;
     psa_key_location_t max = MIN_DRIVER_LOCATION + PSA_MAX_SE_DRIVERS;
 
-    memset( &driver, 0, sizeof( driver ) );
+    memset(&driver, 0, sizeof(driver));
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
 
-    for( location = MIN_DRIVER_LOCATION; location < max; location++ )
-        PSA_ASSERT( psa_register_se_driver( location, &driver ) );
+    for (location = MIN_DRIVER_LOCATION; location < max; location++) {
+        PSA_ASSERT(psa_register_se_driver(location, &driver));
+    }
 
-    TEST_EQUAL( psa_register_se_driver( location, &driver ),
-                PSA_ERROR_INSUFFICIENT_MEMORY );
+    TEST_EQUAL(psa_register_se_driver(location, &driver),
+               PSA_ERROR_INSUFFICIENT_MEMORY);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void key_creation_import_export( int lifetime_arg, int min_slot, int restart )
+void key_creation_import_export(int lifetime_arg, int min_slot, int restart)
 {
     psa_drv_se_t driver;
     psa_drv_se_key_management_t key_management;
     psa_key_lifetime_t lifetime = (psa_key_lifetime_t) lifetime_arg;
-    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( lifetime );
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, 1 );
+    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION(lifetime);
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, 1);
     mbedtls_svc_key_id_t returned_id = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_handle_t handle;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    const uint8_t key_material[3] = {0xfa, 0xca, 0xde};
-    uint8_t exported[sizeof( key_material )];
+    const uint8_t key_material[3] = { 0xfa, 0xca, 0xde };
+    uint8_t exported[sizeof(key_material)];
     size_t exported_length;
 
-    TEST_USES_KEY_ID( id );
+    TEST_USES_KEY_ID(id);
 
-    memset( &driver, 0, sizeof( driver ) );
-    memset( &key_management, 0, sizeof( key_management ) );
+    memset(&driver, 0, sizeof(driver));
+    memset(&key_management, 0, sizeof(key_management));
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
     driver.key_management = &key_management;
-    driver.persistent_data_size = sizeof( ram_slot_usage_t );
+    driver.persistent_data_size = sizeof(ram_slot_usage_t);
     key_management.p_allocate = ram_allocate;
     key_management.p_import = ram_import;
     key_management.p_destroy = ram_destroy;
     key_management.p_export = ram_export;
     ram_min_slot = min_slot;
 
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
 
     /* Create a key. */
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                key_material, sizeof( key_material ),
-                                &returned_id ) );
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              key_material, sizeof(key_material),
+                              &returned_id));
 
-    if( PSA_KEY_LIFETIME_IS_VOLATILE( lifetime ) )
-    {
+    if (PSA_KEY_LIFETIME_IS_VOLATILE(lifetime)) {
         /* For volatile keys, check no persistent data was created */
-        if( ! check_no_persistent_data( location ) )
+        if (!check_no_persistent_data(location)) {
             goto exit;
-    }
-    else
-    {
+        }
+    } else {
         /* For persistent keys, check persistent data */
-        if( ! check_persistent_data( location,
-                             &ram_shadow_slot_usage,
-                             sizeof( ram_shadow_slot_usage ) ) )
+        if (!check_persistent_data(location,
+                                   &ram_shadow_slot_usage,
+                                   sizeof(ram_shadow_slot_usage))) {
             goto exit;
+        }
     }
 
     /* Test that the key was created in the expected slot. */
-    TEST_EQUAL( ram_slots[min_slot].type, PSA_KEY_TYPE_RAW_DATA );
+    TEST_EQUAL(ram_slots[min_slot].type, PSA_KEY_TYPE_RAW_DATA);
 
     /* Maybe restart, to check that the information is saved correctly. */
-    if( restart )
-    {
-        mbedtls_psa_crypto_free( );
-        PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-        PSA_ASSERT( psa_crypto_init( ) );
+    if (restart) {
+        mbedtls_psa_crypto_free();
+        PSA_ASSERT(psa_register_se_driver(location, &driver));
+        PSA_ASSERT(psa_crypto_init());
 
-        if( PSA_KEY_LIFETIME_IS_VOLATILE( lifetime ) )
-        {
+        if (PSA_KEY_LIFETIME_IS_VOLATILE(lifetime)) {
             /* Check that the PSA core has no knowledge of the volatile key */
-            TEST_ASSERT( psa_open_key( returned_id, &handle ) ==
-                         PSA_ERROR_DOES_NOT_EXIST );
+            TEST_ASSERT(psa_open_key(returned_id, &handle) ==
+                        PSA_ERROR_DOES_NOT_EXIST);
 
             /* Drop data from our mockup driver */
             ram_slots_reset();
             ram_min_slot = min_slot;
 
             /* Re-import key */
-            PSA_ASSERT( psa_import_key( &attributes,
-                                        key_material, sizeof( key_material ),
-                                        &returned_id ) );
-        }
-        else
-        {
+            PSA_ASSERT(psa_import_key(&attributes,
+                                      key_material, sizeof(key_material),
+                                      &returned_id));
+        } else {
             /* Check the persistent key file */
-            if( ! check_persistent_data( location,
-                                         &ram_shadow_slot_usage,
-                                         sizeof( ram_shadow_slot_usage ) ) )
+            if (!check_persistent_data(location,
+                                       &ram_shadow_slot_usage,
+                                       sizeof(ram_shadow_slot_usage))) {
                 goto exit;
+            }
         }
     }
 
     /* Test that the key was created in the expected slot. */
-    TEST_EQUAL( ram_slots[min_slot].type, PSA_KEY_TYPE_RAW_DATA );
+    TEST_EQUAL(ram_slots[min_slot].type, PSA_KEY_TYPE_RAW_DATA);
 
     /* Test the key attributes, including the reported slot number. */
-    psa_set_key_bits( &attributes,
-                      PSA_BYTES_TO_BITS( sizeof( key_material ) ) );
-    psa_set_key_slot_number( &attributes, min_slot );
+    psa_set_key_bits(&attributes,
+                     PSA_BYTES_TO_BITS(sizeof(key_material)));
+    psa_set_key_slot_number(&attributes, min_slot);
 
-    if( PSA_KEY_LIFETIME_IS_VOLATILE( lifetime ) )
+    if (PSA_KEY_LIFETIME_IS_VOLATILE(lifetime)) {
         attributes.core.id = returned_id;
-    else
-        psa_set_key_id( &attributes, returned_id );
+    } else {
+        psa_set_key_id(&attributes, returned_id);
+    }
 
-    if( ! check_key_attributes( returned_id, &attributes ) )
+    if (!check_key_attributes(returned_id, &attributes)) {
         goto exit;
+    }
 
     /* Test the key data. */
-    PSA_ASSERT( psa_export_key( returned_id,
-                                exported, sizeof( exported ),
-                                &exported_length ) );
-    ASSERT_COMPARE( key_material, sizeof( key_material ),
-                    exported, exported_length );
+    PSA_ASSERT(psa_export_key(returned_id,
+                              exported, sizeof(exported),
+                              &exported_length));
+    ASSERT_COMPARE(key_material, sizeof(key_material),
+                   exported, exported_length);
 
-    PSA_ASSERT( psa_destroy_key( returned_id ) );
-    if( ! check_persistent_data( location,
-                                 &ram_shadow_slot_usage,
-                                 sizeof( ram_shadow_slot_usage ) ) )
+    PSA_ASSERT(psa_destroy_key(returned_id));
+    if (!check_persistent_data(location,
+                               &ram_shadow_slot_usage,
+                               sizeof(ram_shadow_slot_usage))) {
         goto exit;
-    TEST_EQUAL( psa_open_key( returned_id, &handle ),
-                PSA_ERROR_DOES_NOT_EXIST );
+    }
+    TEST_EQUAL(psa_open_key(returned_id, &handle),
+               PSA_ERROR_DOES_NOT_EXIST);
 
     /* Test that the key has been erased from the designated slot. */
-    TEST_EQUAL( ram_slots[min_slot].type, 0 );
+    TEST_EQUAL(ram_slots[min_slot].type, 0);
 
 exit:
-    PSA_DONE( );
-    ram_slots_reset( );
-    psa_purge_storage( );
+    PSA_DONE();
+    ram_slots_reset();
+    psa_purge_storage();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void key_creation_in_chosen_slot( int slot_arg,
-                                  int restart,
-                                  int expected_status_arg )
+void key_creation_in_chosen_slot(int slot_arg,
+                                 int restart,
+                                 int expected_status_arg)
 {
     psa_key_slot_number_t wanted_slot = slot_arg;
     psa_status_t expected_status = expected_status_arg;
@@ -996,200 +991,208 @@
     psa_drv_se_t driver;
     psa_drv_se_key_management_t key_management;
     psa_key_lifetime_t lifetime = TEST_SE_PERSISTENT_LIFETIME;
-    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( lifetime );
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, 1 );
+    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION(lifetime);
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, 1);
     mbedtls_svc_key_id_t returned_id;
     psa_key_handle_t handle;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    const uint8_t key_material[3] = {0xfa, 0xca, 0xde};
+    const uint8_t key_material[3] = { 0xfa, 0xca, 0xde };
 
-    TEST_USES_KEY_ID( id );
+    TEST_USES_KEY_ID(id);
 
-    memset( &driver, 0, sizeof( driver ) );
-    memset( &key_management, 0, sizeof( key_management ) );
+    memset(&driver, 0, sizeof(driver));
+    memset(&key_management, 0, sizeof(key_management));
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
     driver.key_management = &key_management;
-    driver.persistent_data_size = sizeof( ram_slot_usage_t );
+    driver.persistent_data_size = sizeof(ram_slot_usage_t);
     key_management.p_validate_slot_number = ram_validate_slot_number;
     key_management.p_import = ram_import;
     key_management.p_destroy = ram_destroy;
     key_management.p_export = ram_export;
 
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
 
     /* Create a key. */
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA );
-    psa_set_key_slot_number( &attributes, wanted_slot );
-    status = psa_import_key( &attributes,
-                             key_material, sizeof( key_material ),
-                             &returned_id );
-    TEST_EQUAL( status, expected_status );
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
+    psa_set_key_slot_number(&attributes, wanted_slot);
+    status = psa_import_key(&attributes,
+                            key_material, sizeof(key_material),
+                            &returned_id);
+    TEST_EQUAL(status, expected_status);
 
-    if( status != PSA_SUCCESS )
+    if (status != PSA_SUCCESS) {
         goto exit;
-    if( ! check_persistent_data( location,
-                                 &ram_shadow_slot_usage,
-                                 sizeof( ram_shadow_slot_usage ) ) )
+    }
+    if (!check_persistent_data(location,
+                               &ram_shadow_slot_usage,
+                               sizeof(ram_shadow_slot_usage))) {
         goto exit;
+    }
 
     /* Maybe restart, to check that the information is saved correctly. */
-    if( restart )
-    {
-        mbedtls_psa_crypto_free( );
-        PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-        PSA_ASSERT( psa_crypto_init( ) );
-        if( ! check_persistent_data( location,
-                                     &ram_shadow_slot_usage,
-                                     sizeof( ram_shadow_slot_usage ) ) )
+    if (restart) {
+        mbedtls_psa_crypto_free();
+        PSA_ASSERT(psa_register_se_driver(location, &driver));
+        PSA_ASSERT(psa_crypto_init());
+        if (!check_persistent_data(location,
+                                   &ram_shadow_slot_usage,
+                                   sizeof(ram_shadow_slot_usage))) {
             goto exit;
+        }
     }
 
     /* Test that the key was created in the expected slot. */
-    TEST_EQUAL( ram_slots[wanted_slot].type, PSA_KEY_TYPE_RAW_DATA );
+    TEST_EQUAL(ram_slots[wanted_slot].type, PSA_KEY_TYPE_RAW_DATA);
 
     /* Test that the key is reported with the correct attributes,
      * including the expected slot. */
-    PSA_ASSERT( psa_get_key_attributes( id, &attributes ) );
+    PSA_ASSERT(psa_get_key_attributes(id, &attributes));
 
-    PSA_ASSERT( psa_destroy_key( id ) );
-    if( ! check_persistent_data( location,
-                                 &ram_shadow_slot_usage,
-                                 sizeof( ram_shadow_slot_usage ) ) )
+    PSA_ASSERT(psa_destroy_key(id));
+    if (!check_persistent_data(location,
+                               &ram_shadow_slot_usage,
+                               sizeof(ram_shadow_slot_usage))) {
         goto exit;
-    TEST_EQUAL( psa_open_key( id, &handle ), PSA_ERROR_DOES_NOT_EXIST );
+    }
+    TEST_EQUAL(psa_open_key(id, &handle), PSA_ERROR_DOES_NOT_EXIST);
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    PSA_DONE( );
-    ram_slots_reset( );
-    psa_purge_storage( );
+    PSA_DONE();
+    ram_slots_reset();
+    psa_purge_storage();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void import_key_smoke( int type_arg, int alg_arg,
-                       data_t *key_material )
+void import_key_smoke(int type_arg, int alg_arg,
+                      data_t *key_material)
 {
     psa_key_type_t type = type_arg;
     psa_algorithm_t alg = alg_arg;
     psa_drv_se_t driver;
     psa_drv_se_key_management_t key_management;
     psa_key_lifetime_t lifetime = TEST_SE_PERSISTENT_LIFETIME;
-    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( lifetime );
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, 1 );
+    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION(lifetime);
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, 1);
     mbedtls_svc_key_id_t returned_id;
     psa_key_handle_t handle;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    TEST_USES_KEY_ID( id );
+    TEST_USES_KEY_ID(id);
 
-    memset( &driver, 0, sizeof( driver ) );
-    memset( &key_management, 0, sizeof( key_management ) );
+    memset(&driver, 0, sizeof(driver));
+    memset(&key_management, 0, sizeof(key_management));
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
     driver.key_management = &key_management;
-    driver.persistent_data_size = sizeof( psa_key_slot_number_t );
+    driver.persistent_data_size = sizeof(psa_key_slot_number_t);
     key_management.p_allocate = counter_allocate;
     key_management.p_import = null_import;
     key_management.p_destroy = null_destroy;
 
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
 
     /* Create a key. */
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_usage_flags( &attributes,
-                             PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH |
-                             PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT |
-                             PSA_KEY_USAGE_EXPORT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, type );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                key_material->x, key_material->len,
-                                &returned_id ) );
-    if( ! check_persistent_data( location,
-                                 &shadow_counter, sizeof( shadow_counter ) ) )
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_usage_flags(&attributes,
+                            PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH |
+                            PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT |
+                            PSA_KEY_USAGE_EXPORT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, type);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              key_material->x, key_material->len,
+                              &returned_id));
+    if (!check_persistent_data(location,
+                               &shadow_counter, sizeof(shadow_counter))) {
         goto exit;
+    }
 
     /* Do stuff with the key. */
-    if( ! smoke_test_key( id ) )
+    if (!smoke_test_key(id)) {
         goto exit;
+    }
 
     /* Restart and try again. */
-    mbedtls_psa_crypto_free( );
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
-    if( ! check_persistent_data( location,
-                                 &shadow_counter, sizeof( shadow_counter ) ) )
+    mbedtls_psa_crypto_free();
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
+    if (!check_persistent_data(location,
+                               &shadow_counter, sizeof(shadow_counter))) {
         goto exit;
-    if( ! smoke_test_key( id ) )
+    }
+    if (!smoke_test_key(id)) {
         goto exit;
+    }
 
     /* We're done. */
-    PSA_ASSERT( psa_destroy_key( id ) );
-    if( ! check_persistent_data( location,
-                                 &shadow_counter, sizeof( shadow_counter ) ) )
+    PSA_ASSERT(psa_destroy_key(id));
+    if (!check_persistent_data(location,
+                               &shadow_counter, sizeof(shadow_counter))) {
         goto exit;
-    TEST_EQUAL( psa_open_key( id, &handle ), PSA_ERROR_DOES_NOT_EXIST );
+    }
+    TEST_EQUAL(psa_open_key(id, &handle), PSA_ERROR_DOES_NOT_EXIST);
 
 exit:
-    PSA_DONE( );
-    counter_reset( );
-    psa_purge_storage( );
+    PSA_DONE();
+    counter_reset();
+    psa_purge_storage();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void generate_key_not_supported( int type_arg, int bits_arg )
+void generate_key_not_supported(int type_arg, int bits_arg)
 {
     psa_key_type_t type = type_arg;
     size_t bits = bits_arg;
     psa_drv_se_t driver;
     psa_drv_se_key_management_t key_management;
     psa_key_lifetime_t lifetime = TEST_SE_PERSISTENT_LIFETIME;
-    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( lifetime );
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, 1 );
+    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION(lifetime);
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, 1);
     mbedtls_svc_key_id_t returned_id;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    TEST_USES_KEY_ID( id );
+    TEST_USES_KEY_ID(id);
 
-    memset( &driver, 0, sizeof( driver ) );
-    memset( &key_management, 0, sizeof( key_management ) );
+    memset(&driver, 0, sizeof(driver));
+    memset(&key_management, 0, sizeof(key_management));
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
     driver.key_management = &key_management;
-    driver.persistent_data_size = sizeof( psa_key_slot_number_t );
+    driver.persistent_data_size = sizeof(psa_key_slot_number_t);
     key_management.p_allocate = counter_allocate;
     /* No p_generate method */
 
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_type( &attributes, type );
-    psa_set_key_bits( &attributes, bits );
-    TEST_EQUAL( psa_generate_key( &attributes, &returned_id ),
-                PSA_ERROR_NOT_SUPPORTED );
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_type(&attributes, type);
+    psa_set_key_bits(&attributes, bits);
+    TEST_EQUAL(psa_generate_key(&attributes, &returned_id),
+               PSA_ERROR_NOT_SUPPORTED);
 
 exit:
-    PSA_DONE( );
-    counter_reset( );
-    psa_purge_storage( );
+    PSA_DONE();
+    counter_reset();
+    psa_purge_storage();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void generate_key_smoke( int type_arg, int bits_arg, int alg_arg )
+void generate_key_smoke(int type_arg, int bits_arg, int alg_arg)
 {
     psa_key_type_t type = type_arg;
     psa_key_bits_t bits = bits_arg;
@@ -1197,88 +1200,93 @@
     psa_drv_se_t driver;
     psa_drv_se_key_management_t key_management;
     psa_key_lifetime_t lifetime = TEST_SE_PERSISTENT_LIFETIME;
-    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( lifetime );
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, 1 );
+    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION(lifetime);
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, 1);
     mbedtls_svc_key_id_t returned_id;
     psa_key_handle_t handle;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    TEST_USES_KEY_ID( id );
+    TEST_USES_KEY_ID(id);
 
-    memset( &driver, 0, sizeof( driver ) );
-    memset( &key_management, 0, sizeof( key_management ) );
+    memset(&driver, 0, sizeof(driver));
+    memset(&key_management, 0, sizeof(key_management));
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
     driver.key_management = &key_management;
-    driver.persistent_data_size = sizeof( psa_key_slot_number_t );
+    driver.persistent_data_size = sizeof(psa_key_slot_number_t);
     key_management.p_allocate = counter_allocate;
     key_management.p_generate = null_generate;
     key_management.p_destroy = null_destroy;
 
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
 
     /* Create a key. */
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_usage_flags( &attributes,
-                             PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH |
-                             PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT |
-                             PSA_KEY_USAGE_EXPORT );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, type );
-    psa_set_key_bits( &attributes, bits );
-    PSA_ASSERT( psa_generate_key( &attributes, &returned_id ) );
-    if( ! check_persistent_data( location,
-                                 &shadow_counter, sizeof( shadow_counter ) ) )
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_usage_flags(&attributes,
+                            PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH |
+                            PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT |
+                            PSA_KEY_USAGE_EXPORT);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, type);
+    psa_set_key_bits(&attributes, bits);
+    PSA_ASSERT(psa_generate_key(&attributes, &returned_id));
+    if (!check_persistent_data(location,
+                               &shadow_counter, sizeof(shadow_counter))) {
         goto exit;
+    }
 
     /* Do stuff with the key. */
-    if( ! smoke_test_key( id ) )
+    if (!smoke_test_key(id)) {
         goto exit;
+    }
 
     /* Restart and try again. */
-    mbedtls_psa_crypto_free( );
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
-    if( ! check_persistent_data( location,
-                                 &shadow_counter, sizeof( shadow_counter ) ) )
+    mbedtls_psa_crypto_free();
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
+    if (!check_persistent_data(location,
+                               &shadow_counter, sizeof(shadow_counter))) {
         goto exit;
-    if( ! smoke_test_key( id ) )
+    }
+    if (!smoke_test_key(id)) {
         goto exit;
+    }
 
     /* We're done. */
-    PSA_ASSERT( psa_destroy_key( id ) );
-    if( ! check_persistent_data( location,
-                                 &shadow_counter, sizeof( shadow_counter ) ) )
+    PSA_ASSERT(psa_destroy_key(id));
+    if (!check_persistent_data(location,
+                               &shadow_counter, sizeof(shadow_counter))) {
         goto exit;
-    TEST_EQUAL( psa_open_key( id, &handle ), PSA_ERROR_DOES_NOT_EXIST );
+    }
+    TEST_EQUAL(psa_open_key(id, &handle), PSA_ERROR_DOES_NOT_EXIST);
 
 exit:
-    PSA_DONE( );
-    counter_reset( );
-    psa_purge_storage( );
+    PSA_DONE();
+    counter_reset();
+    psa_purge_storage();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void sign_verify( int flow,
-                  int type_arg, int alg_arg,
-                  int bits_arg, data_t *key_material,
-                  data_t *input )
+void sign_verify(int flow,
+                 int type_arg, int alg_arg,
+                 int bits_arg, data_t *key_material,
+                 data_t *input)
 {
     psa_key_type_t type = type_arg;
     psa_algorithm_t alg = alg_arg;
     size_t bits = bits_arg;
     /* Pass bits=0 to import, bits>0 to fake-generate */
-    int generating = ( bits != 0 );
+    int generating = (bits != 0);
 
     psa_drv_se_t driver;
     psa_drv_se_key_management_t key_management;
     psa_drv_se_asymmetric_t asymmetric;
 
     psa_key_lifetime_t lifetime = TEST_SE_PERSISTENT_LIFETIME;
-    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( lifetime );
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, 1 );
+    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION(lifetime);
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, 1);
     mbedtls_svc_key_id_t returned_id;
     mbedtls_svc_key_id_t sw_key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t sw_attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -1286,23 +1294,23 @@
     uint8_t signature[PSA_SIGNATURE_MAX_SIZE];
     size_t signature_length;
 
-    TEST_USES_KEY_ID( id );
+    TEST_USES_KEY_ID(id);
 
-    memset( &driver, 0, sizeof( driver ) );
-    memset( &key_management, 0, sizeof( key_management ) );
-    memset( &asymmetric, 0, sizeof( asymmetric ) );
+    memset(&driver, 0, sizeof(driver));
+    memset(&key_management, 0, sizeof(key_management));
+    memset(&asymmetric, 0, sizeof(asymmetric));
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
     driver.key_management = &key_management;
     driver.asymmetric = &asymmetric;
-    driver.persistent_data_size = sizeof( ram_slot_usage_t );
+    driver.persistent_data_size = sizeof(ram_slot_usage_t);
     key_management.p_allocate = ram_allocate;
     key_management.p_destroy = ram_destroy;
-    if( generating )
+    if (generating) {
         key_management.p_generate = ram_fake_generate;
-    else
+    } else {
         key_management.p_import = ram_import;
-    switch( flow )
-    {
+    }
+    switch (flow) {
         case SIGN_IN_SOFTWARE_AND_PARALLEL_CREATION:
             break;
         case SIGN_IN_DRIVER_AND_PARALLEL_CREATION:
@@ -1313,208 +1321,206 @@
             key_management.p_export_public = ram_export_public;
             break;
         default:
-            TEST_ASSERT( ! "unsupported flow (should be SIGN_IN_xxx)" );
+            TEST_ASSERT(!"unsupported flow (should be SIGN_IN_xxx)");
             break;
     }
     asymmetric.p_verify = ram_verify;
 
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
 
     /* Prepare to create two keys with the same key material: a transparent
      * key, and one that goes through the driver. */
-    psa_set_key_usage_flags( &sw_attributes,
-                             PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH );
-    psa_set_key_algorithm( &sw_attributes, alg );
-    psa_set_key_type( &sw_attributes, type );
+    psa_set_key_usage_flags(&sw_attributes,
+                            PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH);
+    psa_set_key_algorithm(&sw_attributes, alg);
+    psa_set_key_type(&sw_attributes, type);
     drv_attributes = sw_attributes;
-    psa_set_key_id( &drv_attributes, id );
-    psa_set_key_lifetime( &drv_attributes, lifetime );
+    psa_set_key_id(&drv_attributes, id);
+    psa_set_key_lifetime(&drv_attributes, lifetime);
 
     /* Create the key in the driver. */
-    if( generating )
-    {
-        psa_set_key_bits( &drv_attributes, bits );
-        PSA_ASSERT( psa_generate_key( &drv_attributes, &returned_id ) );
+    if (generating) {
+        psa_set_key_bits(&drv_attributes, bits);
+        PSA_ASSERT(psa_generate_key(&drv_attributes, &returned_id));
         /* Since we called a generate method that does not actually
          * generate material, store the desired result of generation in
          * the mock secure element storage. */
-        PSA_ASSERT( psa_get_key_attributes( id, &drv_attributes ) );
-        TEST_EQUAL( key_material->len, PSA_BITS_TO_BYTES( bits ) );
-        memcpy( ram_slots[ram_min_slot].content, key_material->x,
-                key_material->len );
-    }
-    else
-    {
-        PSA_ASSERT( psa_import_key( &drv_attributes,
-                                    key_material->x, key_material->len,
-                                    &returned_id ) );
+        PSA_ASSERT(psa_get_key_attributes(id, &drv_attributes));
+        TEST_EQUAL(key_material->len, PSA_BITS_TO_BYTES(bits));
+        memcpy(ram_slots[ram_min_slot].content, key_material->x,
+               key_material->len);
+    } else {
+        PSA_ASSERT(psa_import_key(&drv_attributes,
+                                  key_material->x, key_material->len,
+                                  &returned_id));
     }
 
     /* Either import the same key in software, or export the driver's
      * public key and import that. */
-    switch( flow )
-    {
+    switch (flow) {
         case SIGN_IN_SOFTWARE_AND_PARALLEL_CREATION:
         case SIGN_IN_DRIVER_AND_PARALLEL_CREATION:
-            PSA_ASSERT( psa_import_key( &sw_attributes,
-                                        key_material->x, key_material->len,
-                                        &sw_key ) );
+            PSA_ASSERT(psa_import_key(&sw_attributes,
+                                      key_material->x, key_material->len,
+                                      &sw_key));
             break;
         case SIGN_IN_DRIVER_THEN_EXPORT_PUBLIC:
         {
-            uint8_t public_key[PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE( PSA_VENDOR_ECC_MAX_CURVE_BITS )];
+            uint8_t public_key[PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_ECC_MAX_CURVE_BITS)
+            ];
             size_t public_key_length;
-            PSA_ASSERT( psa_export_public_key( id,
-                                               public_key, sizeof( public_key ),
-                                               &public_key_length ) );
-            psa_set_key_type( &sw_attributes,
-                              PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR( type ) );
-            PSA_ASSERT( psa_import_key( &sw_attributes,
-                                        public_key, public_key_length,
-                                        &sw_key ) );
+            PSA_ASSERT(psa_export_public_key(id,
+                                             public_key, sizeof(public_key),
+                                             &public_key_length));
+            psa_set_key_type(&sw_attributes,
+                             PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type));
+            PSA_ASSERT(psa_import_key(&sw_attributes,
+                                      public_key, public_key_length,
+                                      &sw_key));
             break;
         }
     }
 
     /* Sign with the chosen key. */
-    switch( flow )
-    {
+    switch (flow) {
         case SIGN_IN_DRIVER_AND_PARALLEL_CREATION:
         case SIGN_IN_DRIVER_THEN_EXPORT_PUBLIC:
             PSA_ASSERT_VIA_DRIVER(
-                psa_sign_hash( id, alg,
-                               input->x, input->len,
-                               signature, sizeof( signature ),
-                               &signature_length ),
-                PSA_SUCCESS );
+                psa_sign_hash(id, alg,
+                              input->x, input->len,
+                              signature, sizeof(signature),
+                              &signature_length),
+                PSA_SUCCESS);
             break;
         case SIGN_IN_SOFTWARE_AND_PARALLEL_CREATION:
-            PSA_ASSERT( psa_sign_hash( sw_key, alg,
-                                       input->x, input->len,
-                                       signature, sizeof( signature ),
-                                       &signature_length ) );
+            PSA_ASSERT(psa_sign_hash(sw_key, alg,
+                                     input->x, input->len,
+                                     signature, sizeof(signature),
+                                     &signature_length));
             break;
     }
 
     /* Verify with both keys. */
-    PSA_ASSERT( psa_verify_hash( sw_key, alg,
-                                 input->x, input->len,
-                                 signature, signature_length ) );
+    PSA_ASSERT(psa_verify_hash(sw_key, alg,
+                               input->x, input->len,
+                               signature, signature_length));
     PSA_ASSERT_VIA_DRIVER(
-        psa_verify_hash( id, alg,
-                         input->x, input->len,
-                         signature, signature_length ),
-        PSA_SUCCESS );
+        psa_verify_hash(id, alg,
+                        input->x, input->len,
+                        signature, signature_length),
+        PSA_SUCCESS);
 
     /* Change the signature and verify again. */
     signature[0] ^= 1;
-    TEST_EQUAL( psa_verify_hash( sw_key, alg,
-                                 input->x, input->len,
-                                 signature, signature_length ),
-                PSA_ERROR_INVALID_SIGNATURE );
+    TEST_EQUAL(psa_verify_hash(sw_key, alg,
+                               input->x, input->len,
+                               signature, signature_length),
+               PSA_ERROR_INVALID_SIGNATURE);
     PSA_ASSERT_VIA_DRIVER(
-        psa_verify_hash( id, alg,
-                         input->x, input->len,
-                         signature, signature_length ),
-        PSA_ERROR_INVALID_SIGNATURE );
+        psa_verify_hash(id, alg,
+                        input->x, input->len,
+                        signature, signature_length),
+        PSA_ERROR_INVALID_SIGNATURE);
 
 exit:
     /*
      * Driver key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &drv_attributes );
+    psa_reset_key_attributes(&drv_attributes);
 
-    psa_destroy_key( id );
-    psa_destroy_key( sw_key );
-    PSA_DONE( );
-    ram_slots_reset( );
-    psa_purge_storage( );
+    psa_destroy_key(id);
+    psa_destroy_key(sw_key);
+    PSA_DONE();
+    ram_slots_reset();
+    psa_purge_storage();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void register_key_smoke_test( int lifetime_arg,
-                              int owner_id_arg,
-                              int id_arg,
-                              int validate,
-                              int expected_status_arg )
+void register_key_smoke_test(int lifetime_arg,
+                             int owner_id_arg,
+                             int id_arg,
+                             int validate,
+                             int expected_status_arg)
 {
     psa_key_lifetime_t lifetime = lifetime_arg;
-    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( lifetime );
+    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION(lifetime);
     psa_status_t expected_status = expected_status_arg;
     psa_drv_se_t driver;
     psa_drv_se_key_management_t key_management;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( owner_id_arg, id_arg );
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(owner_id_arg, id_arg);
     psa_key_handle_t handle;
     size_t bit_size = 48;
     psa_key_slot_number_t wanted_slot = 0x123456789;
     psa_status_t status;
 
-    TEST_USES_KEY_ID( id );
+    TEST_USES_KEY_ID(id);
 
-    memset( &driver, 0, sizeof( driver ) );
+    memset(&driver, 0, sizeof(driver));
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
-    memset( &key_management, 0, sizeof( key_management ) );
+    memset(&key_management, 0, sizeof(key_management));
     driver.key_management = &key_management;
     key_management.p_destroy = null_destroy;
-    if( validate >= 0 )
-    {
+    if (validate >= 0) {
         key_management.p_validate_slot_number = validate_slot_number_as_directed;
         validate_slot_number_directions.slot_number = wanted_slot;
         validate_slot_number_directions.method = PSA_KEY_CREATION_REGISTER;
         validate_slot_number_directions.status =
-            ( validate > 0 ? PSA_SUCCESS : PSA_ERROR_NOT_PERMITTED );
+            (validate > 0 ? PSA_SUCCESS : PSA_ERROR_NOT_PERMITTED);
     }
 
-    mbedtls_test_set_step( 1 );
-    PSA_ASSERT( psa_register_se_driver( MIN_DRIVER_LOCATION, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
+    mbedtls_test_set_step(1);
+    PSA_ASSERT(psa_register_se_driver(MIN_DRIVER_LOCATION, &driver));
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA );
-    psa_set_key_bits( &attributes, bit_size );
-    psa_set_key_slot_number( &attributes, wanted_slot );
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
+    psa_set_key_bits(&attributes, bit_size);
+    psa_set_key_slot_number(&attributes, wanted_slot);
 
-    status = mbedtls_psa_register_se_key( &attributes );
-    TEST_EQUAL( status, expected_status );
+    status = mbedtls_psa_register_se_key(&attributes);
+    TEST_EQUAL(status, expected_status);
 
-    if( status != PSA_SUCCESS )
+    if (status != PSA_SUCCESS) {
         goto exit;
+    }
 
     /* Test that the key exists and has the expected attributes. */
-    if( ! check_key_attributes( id, &attributes ) )
+    if (!check_key_attributes(id, &attributes)) {
         goto exit;
+    }
 
 #if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
     mbedtls_svc_key_id_t invalid_id =
-        mbedtls_svc_key_id_make( owner_id_arg + 1, id_arg );
-    TEST_EQUAL( psa_open_key( invalid_id, &handle ), PSA_ERROR_DOES_NOT_EXIST );
+        mbedtls_svc_key_id_make(owner_id_arg + 1, id_arg);
+    TEST_EQUAL(psa_open_key(invalid_id, &handle), PSA_ERROR_DOES_NOT_EXIST);
 #endif
 
-    PSA_ASSERT( psa_purge_key( id ) );
+    PSA_ASSERT(psa_purge_key(id));
 
     /* Restart and try again. */
-    mbedtls_test_set_step( 2 );
-    PSA_SESSION_DONE( );
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
-    if( ! check_key_attributes( id, &attributes ) )
+    mbedtls_test_set_step(2);
+    PSA_SESSION_DONE();
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
+    if (!check_key_attributes(id, &attributes)) {
         goto exit;
+    }
     /* This time, destroy the key. */
-    PSA_ASSERT( psa_destroy_key( id ) );
-    TEST_EQUAL( psa_open_key( id, &handle ), PSA_ERROR_DOES_NOT_EXIST );
+    PSA_ASSERT(psa_destroy_key(id));
+    TEST_EQUAL(psa_open_key(id, &handle), PSA_ERROR_DOES_NOT_EXIST);
 
 exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( id );
-    PSA_DONE( );
-    psa_purge_storage( );
-    memset( &validate_slot_number_directions, 0,
-            sizeof( validate_slot_number_directions ) );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(id);
+    PSA_DONE();
+    psa_purge_storage();
+    memset(&validate_slot_number_directions, 0,
+           sizeof(validate_slot_number_directions));
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_se_driver_hal_mocks.function b/tests/suites/test_suite_psa_crypto_se_driver_hal_mocks.function
index 12c58eb..6f28f93 100644
--- a/tests/suites/test_suite_psa_crypto_se_driver_hal_mocks.function
+++ b/tests/suites/test_suite_psa_crypto_se_driver_hal_mocks.function
@@ -7,18 +7,16 @@
 /** The location and lifetime used for tests that use a single driver. */
 #define TEST_DRIVER_LOCATION 1
 #define TEST_SE_PERSISTENT_LIFETIME                             \
-    ( PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(           \
-        PSA_KEY_PERSISTENCE_DEFAULT, TEST_DRIVER_LOCATION ) )
+    (PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(           \
+         PSA_KEY_PERSISTENCE_DEFAULT, TEST_DRIVER_LOCATION))
 
-static struct
-{
+static struct {
     uint16_t called;
     psa_key_location_t location;
     psa_status_t return_value;
 } mock_init_data;
 
-static struct
-{
+static struct {
     uint16_t called;
     psa_key_slot_number_t key_slot;
     psa_key_attributes_t attributes;
@@ -26,8 +24,7 @@
     psa_status_t return_value;
 } mock_generate_data;
 
-static struct
-{
+static struct {
     uint16_t called;
     psa_key_slot_number_t key_slot;
     psa_key_attributes_t attributes;
@@ -36,24 +33,21 @@
     psa_status_t return_value;
 } mock_import_data;
 
-static struct
-{
+static struct {
     uint16_t called;
     psa_key_slot_number_t slot_number;
     size_t data_size;
     psa_status_t return_value;
 } mock_export_data;
 
-static struct
-{
+static struct {
     uint16_t called;
     psa_key_slot_number_t slot_number;
     size_t data_size;
     psa_status_t return_value;
 } mock_export_public_data;
 
-static struct
-{
+static struct {
     uint16_t called;
     psa_key_slot_number_t key_slot;
     psa_algorithm_t alg;
@@ -62,8 +56,7 @@
     psa_status_t return_value;
 } mock_sign_data;
 
-static struct
-{
+static struct {
     uint16_t called;
     psa_key_slot_number_t key_slot;
     psa_algorithm_t alg;
@@ -72,21 +65,19 @@
     psa_status_t return_value;
 } mock_verify_data;
 
-static struct
-{
+static struct {
     uint16_t called;
     psa_status_t return_value;
 } mock_allocate_data;
 
-static struct
-{
+static struct {
     uint16_t called;
     psa_key_slot_number_t slot_number;
     psa_status_t return_value;
 } mock_destroy_data;
 
 #define MAX_KEY_ID_FOR_TEST 10
-static void psa_purge_storage( void )
+static void psa_purge_storage(void)
 {
     psa_key_id_t id;
     psa_key_location_t location;
@@ -94,48 +85,50 @@
     /* The tests may have potentially created key ids from 1 to
      * MAX_KEY_ID_FOR_TEST. In addition, run the destroy function on key id
      * 0, which file-based storage uses as a temporary file. */
-    for( id = 0; id <= MAX_KEY_ID_FOR_TEST; id++ )
-        psa_destroy_persistent_key( mbedtls_svc_key_id_make( 1, id ) );
+    for (id = 0; id <= MAX_KEY_ID_FOR_TEST; id++) {
+        psa_destroy_persistent_key(mbedtls_svc_key_id_make(1, id));
+    }
 
     /* Purge the transaction file. */
-    psa_crypto_stop_transaction( );
+    psa_crypto_stop_transaction();
     /* Purge driver persistent data. */
-    for( location = 0; location < PSA_MAX_SE_LOCATION; location++ )
-        psa_destroy_se_persistent_data( location );
+    for (location = 0; location < PSA_MAX_SE_LOCATION; location++) {
+        psa_destroy_se_persistent_data(location);
+    }
 }
 
-static void mock_teardown( void )
+static void mock_teardown(void)
 {
-    memset( &mock_init_data, 0, sizeof( mock_init_data ) );
-    memset( &mock_import_data, 0, sizeof( mock_import_data ) );
-    memset( &mock_export_data, 0, sizeof( mock_export_data ) );
-    memset( &mock_export_public_data, 0, sizeof( mock_export_public_data ) );
-    memset( &mock_sign_data, 0, sizeof( mock_sign_data ) );
-    memset( &mock_verify_data, 0, sizeof( mock_verify_data ) );
-    memset( &mock_allocate_data, 0, sizeof( mock_allocate_data ) );
-    memset( &mock_destroy_data, 0, sizeof( mock_destroy_data ) );
-    memset( &mock_generate_data, 0, sizeof( mock_generate_data ) );
-    psa_purge_storage( );
+    memset(&mock_init_data, 0, sizeof(mock_init_data));
+    memset(&mock_import_data, 0, sizeof(mock_import_data));
+    memset(&mock_export_data, 0, sizeof(mock_export_data));
+    memset(&mock_export_public_data, 0, sizeof(mock_export_public_data));
+    memset(&mock_sign_data, 0, sizeof(mock_sign_data));
+    memset(&mock_verify_data, 0, sizeof(mock_verify_data));
+    memset(&mock_allocate_data, 0, sizeof(mock_allocate_data));
+    memset(&mock_destroy_data, 0, sizeof(mock_destroy_data));
+    memset(&mock_generate_data, 0, sizeof(mock_generate_data));
+    psa_purge_storage();
 }
 
-static psa_status_t mock_init( psa_drv_se_context_t *drv_context,
-                               void *persistent_data,
-                               psa_key_location_t location )
+static psa_status_t mock_init(psa_drv_se_context_t *drv_context,
+                              void *persistent_data,
+                              psa_key_location_t location)
 {
     (void) drv_context;
     (void) persistent_data;
 
     mock_init_data.called++;
     mock_init_data.location = location;
-    return( mock_init_data.return_value );
+    return mock_init_data.return_value;
 }
 
-static psa_status_t mock_generate( psa_drv_se_context_t *drv_context,
-                                   psa_key_slot_number_t key_slot,
-                                   const psa_key_attributes_t *attributes,
-                                   uint8_t *pubkey,
-                                   size_t pubkey_size,
-                                   size_t *pubkey_length )
+static psa_status_t mock_generate(psa_drv_se_context_t *drv_context,
+                                  psa_key_slot_number_t key_slot,
+                                  const psa_key_attributes_t *attributes,
+                                  uint8_t *pubkey,
+                                  size_t pubkey_size,
+                                  size_t *pubkey_length)
 {
     (void) drv_context;
     (void) pubkey;
@@ -146,15 +139,15 @@
     mock_generate_data.attributes = *attributes;
     mock_generate_data.pubkey_size = pubkey_size;
 
-    return( mock_generate_data.return_value );
+    return mock_generate_data.return_value;
 }
 
-static psa_status_t mock_import( psa_drv_se_context_t *drv_context,
-                                 psa_key_slot_number_t key_slot,
-                                 const psa_key_attributes_t *attributes,
-                                 const uint8_t *data,
-                                 size_t data_length,
-                                 size_t *bits )
+static psa_status_t mock_import(psa_drv_se_context_t *drv_context,
+                                psa_key_slot_number_t key_slot,
+                                const psa_key_attributes_t *attributes,
+                                const uint8_t *data,
+                                size_t data_length,
+                                size_t *bits)
 {
     (void) drv_context;
     (void) data;
@@ -166,14 +159,14 @@
     mock_import_data.attributes = *attributes;
     mock_import_data.data_length = data_length;
 
-    return( mock_import_data.return_value );
+    return mock_import_data.return_value;
 }
 
-psa_status_t mock_export( psa_drv_se_context_t *context,
-                          psa_key_slot_number_t slot_number,
-                          uint8_t *p_data,
-                          size_t data_size,
-                          size_t *p_data_length )
+psa_status_t mock_export(psa_drv_se_context_t *context,
+                         psa_key_slot_number_t slot_number,
+                         uint8_t *p_data,
+                         size_t data_size,
+                         size_t *p_data_length)
 {
     (void) context;
     (void) p_data;
@@ -183,14 +176,14 @@
     mock_export_data.slot_number = slot_number;
     mock_export_data.data_size = data_size;
 
-    return( mock_export_data.return_value );
+    return mock_export_data.return_value;
 }
 
-psa_status_t mock_export_public( psa_drv_se_context_t *context,
-                                 psa_key_slot_number_t slot_number,
-                                 uint8_t *p_data,
-                                 size_t data_size,
-                                 size_t *p_data_length )
+psa_status_t mock_export_public(psa_drv_se_context_t *context,
+                                psa_key_slot_number_t slot_number,
+                                uint8_t *p_data,
+                                size_t data_size,
+                                size_t *p_data_length)
 {
     (void) context;
     (void) p_data;
@@ -200,17 +193,17 @@
     mock_export_public_data.slot_number = slot_number;
     mock_export_public_data.data_size = data_size;
 
-    return( mock_export_public_data.return_value );
+    return mock_export_public_data.return_value;
 }
 
-psa_status_t mock_sign( psa_drv_se_context_t *context,
-                        psa_key_slot_number_t key_slot,
-                        psa_algorithm_t alg,
-                        const uint8_t *p_hash,
-                        size_t hash_length,
-                        uint8_t *p_signature,
-                        size_t signature_size,
-                        size_t *p_signature_length )
+psa_status_t mock_sign(psa_drv_se_context_t *context,
+                       psa_key_slot_number_t key_slot,
+                       psa_algorithm_t alg,
+                       const uint8_t *p_hash,
+                       size_t hash_length,
+                       uint8_t *p_signature,
+                       size_t signature_size,
+                       size_t *p_signature_length)
 {
     (void) context;
     (void) p_hash;
@@ -226,13 +219,13 @@
     return mock_sign_data.return_value;
 }
 
-psa_status_t mock_verify( psa_drv_se_context_t *context,
-                          psa_key_slot_number_t key_slot,
-                          psa_algorithm_t alg,
-                          const uint8_t *p_hash,
-                          size_t hash_length,
-                          const uint8_t *p_signature,
-                          size_t signature_length )
+psa_status_t mock_verify(psa_drv_se_context_t *context,
+                         psa_key_slot_number_t key_slot,
+                         psa_algorithm_t alg,
+                         const uint8_t *p_hash,
+                         size_t hash_length,
+                         const uint8_t *p_signature,
+                         size_t signature_length)
 {
     (void) context;
     (void) p_hash;
@@ -247,11 +240,11 @@
     return mock_verify_data.return_value;
 }
 
-psa_status_t mock_allocate( psa_drv_se_context_t *drv_context,
-                            void *persistent_data,
-                            const psa_key_attributes_t *attributes,
-                            psa_key_creation_method_t method,
-                            psa_key_slot_number_t *key_slot )
+psa_status_t mock_allocate(psa_drv_se_context_t *drv_context,
+                           void *persistent_data,
+                           const psa_key_attributes_t *attributes,
+                           psa_key_creation_method_t method,
+                           psa_key_slot_number_t *key_slot)
 {
     (void) drv_context;
     (void) persistent_data;
@@ -262,12 +255,12 @@
     mock_allocate_data.called++;
     *key_slot = 0;
 
-    return( mock_allocate_data.return_value );
+    return mock_allocate_data.return_value;
 }
 
-psa_status_t mock_destroy( psa_drv_se_context_t *context,
-                           void *persistent_data,
-                           psa_key_slot_number_t slot_number )
+psa_status_t mock_destroy(psa_drv_se_context_t *context,
+                          void *persistent_data,
+                          psa_key_slot_number_t slot_number)
 {
     (void) context;
     (void) persistent_data;
@@ -275,7 +268,7 @@
     mock_destroy_data.called++;
     mock_destroy_data.slot_number = slot_number;
 
-    return( mock_destroy_data.return_value );
+    return mock_destroy_data.return_value;
 }
 
 /* END_HEADER */
@@ -286,11 +279,11 @@
  */
 
 /* BEGIN_CASE */
-void mock_init( int location_arg,
-                int expected_register_status_arg,
-                int driver_status_arg,
-                int expected_psa_status_arg,
-                int expected_called )
+void mock_init(int location_arg,
+               int expected_register_status_arg,
+               int driver_status_arg,
+               int expected_psa_status_arg,
+               int expected_called)
 {
     psa_key_location_t location = location_arg;
     psa_status_t expected_register_status = expected_register_status_arg;
@@ -304,112 +297,110 @@
 
     mock_init_data.return_value = driver_status;
 
-    TEST_EQUAL( psa_register_se_driver( location, &driver ),
-                expected_register_status );
+    TEST_EQUAL(psa_register_se_driver(location, &driver),
+               expected_register_status);
 
     psa_crypto_init_called = 1;
-    TEST_EQUAL( psa_crypto_init( ), expected_psa_status );
+    TEST_EQUAL(psa_crypto_init(), expected_psa_status);
 
-    TEST_EQUAL( mock_init_data.called, expected_called );
-    if( expected_called )
-        TEST_EQUAL( mock_init_data.location, location );
+    TEST_EQUAL(mock_init_data.called, expected_called);
+    if (expected_called) {
+        TEST_EQUAL(mock_init_data.location, location);
+    }
 
 exit:
-    if( psa_crypto_init_called )
-        PSA_DONE( );
-    mock_teardown( );
+    if (psa_crypto_init_called) {
+        PSA_DONE();
+    }
+    mock_teardown();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mock_import( int mock_alloc_return_value,
-                  int mock_import_return_value,
-                  int bits,
-                  int expected_result )
+void mock_import(int mock_alloc_return_value,
+                 int mock_import_return_value,
+                 int bits,
+                 int expected_result)
 {
     psa_drv_se_t driver;
     psa_drv_se_key_management_t key_management;
     psa_key_lifetime_t lifetime = TEST_SE_PERSISTENT_LIFETIME;
-    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( lifetime );
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, 1 );
+    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION(lifetime);
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, 1);
     mbedtls_svc_key_id_t returned_id;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    const uint8_t key_material[3] = {0xfa, 0xca, 0xde};
+    const uint8_t key_material[3] = { 0xfa, 0xca, 0xde };
 
     mock_allocate_data.return_value = mock_alloc_return_value;
     mock_import_data.return_value = mock_import_return_value;
     mock_import_data.bits = bits;
-    memset( &driver, 0, sizeof( driver ) );
-    memset( &key_management, 0, sizeof( key_management ) );
+    memset(&driver, 0, sizeof(driver));
+    memset(&key_management, 0, sizeof(key_management));
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
     driver.key_management = &key_management;
     key_management.p_import = mock_import;
     key_management.p_destroy = mock_destroy;
     key_management.p_allocate = mock_allocate;
 
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA );
-    TEST_ASSERT( psa_import_key( &attributes,
-                                 key_material, sizeof( key_material ),
-                                 &returned_id ) == expected_result );
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
+    TEST_ASSERT(psa_import_key(&attributes,
+                               key_material, sizeof(key_material),
+                               &returned_id) == expected_result);
 
-    TEST_ASSERT( mock_allocate_data.called == 1 );
-    TEST_ASSERT( mock_import_data.called ==
-        ( mock_alloc_return_value == PSA_SUCCESS? 1 : 0 ) );
+    TEST_ASSERT(mock_allocate_data.called == 1);
+    TEST_ASSERT(mock_import_data.called ==
+                (mock_alloc_return_value == PSA_SUCCESS ? 1 : 0));
 
-    if( mock_alloc_return_value == PSA_SUCCESS )
-    {
-        TEST_ASSERT( mbedtls_svc_key_id_equal(
-                         mock_import_data.attributes.core.id, id ) );
-    }
-    else
-    {
-        TEST_ASSERT( MBEDTLS_SVC_KEY_ID_GET_KEY_ID(
-                         mock_import_data.attributes.core.id ) == 0 );
-        TEST_ASSERT( MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(
-                         mock_import_data.attributes.core.id ) == 0 );
+    if (mock_alloc_return_value == PSA_SUCCESS) {
+        TEST_ASSERT(mbedtls_svc_key_id_equal(
+                        mock_import_data.attributes.core.id, id));
+    } else {
+        TEST_ASSERT(MBEDTLS_SVC_KEY_ID_GET_KEY_ID(
+                        mock_import_data.attributes.core.id) == 0);
+        TEST_ASSERT(MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(
+                        mock_import_data.attributes.core.id) == 0);
     }
 
-    TEST_ASSERT( mock_import_data.attributes.core.lifetime ==
-        ( mock_alloc_return_value == PSA_SUCCESS? lifetime : 0 ) );
-    TEST_ASSERT( mock_import_data.attributes.core.policy.usage ==
-        ( mock_alloc_return_value == PSA_SUCCESS? PSA_KEY_USAGE_EXPORT : 0 ) );
-    TEST_ASSERT( mock_import_data.attributes.core.type ==
-        ( mock_alloc_return_value == PSA_SUCCESS? PSA_KEY_TYPE_RAW_DATA : 0 ) );
+    TEST_ASSERT(mock_import_data.attributes.core.lifetime ==
+                (mock_alloc_return_value == PSA_SUCCESS ? lifetime : 0));
+    TEST_ASSERT(mock_import_data.attributes.core.policy.usage ==
+                (mock_alloc_return_value == PSA_SUCCESS ? PSA_KEY_USAGE_EXPORT : 0));
+    TEST_ASSERT(mock_import_data.attributes.core.type ==
+                (mock_alloc_return_value == PSA_SUCCESS ? PSA_KEY_TYPE_RAW_DATA : 0));
 
-    if( expected_result == PSA_SUCCESS )
-    {
-        PSA_ASSERT( psa_destroy_key( id ) );
-        TEST_ASSERT( mock_destroy_data.called == 1 );
+    if (expected_result == PSA_SUCCESS) {
+        PSA_ASSERT(psa_destroy_key(id));
+        TEST_ASSERT(mock_destroy_data.called == 1);
     }
 exit:
-    PSA_DONE( );
-    mock_teardown( );
+    PSA_DONE();
+    mock_teardown();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mock_export( int mock_export_return_value, int expected_result )
+void mock_export(int mock_export_return_value, int expected_result)
 {
     psa_drv_se_t driver;
     psa_drv_se_key_management_t key_management;
     psa_key_lifetime_t lifetime = TEST_SE_PERSISTENT_LIFETIME;
-    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( lifetime );
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, 1 );
+    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION(lifetime);
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, 1);
     mbedtls_svc_key_id_t returned_id;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    const uint8_t key_material[3] = {0xfa, 0xca, 0xde};
-    uint8_t exported[sizeof( key_material )];
+    const uint8_t key_material[3] = { 0xfa, 0xca, 0xde };
+    uint8_t exported[sizeof(key_material)];
     size_t exported_length;
 
     mock_export_data.return_value = mock_export_return_value;
-    memset( &driver, 0, sizeof( driver ) );
-    memset( &key_management, 0, sizeof( key_management ) );
+    memset(&driver, 0, sizeof(driver));
+    memset(&key_management, 0, sizeof(key_management));
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
     driver.key_management = &key_management;
     driver.p_init = mock_init;
@@ -418,119 +409,115 @@
     key_management.p_destroy = mock_destroy;
     key_management.p_allocate = mock_allocate;
 
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                key_material, sizeof( key_material ),
-                                &returned_id ) );
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              key_material, sizeof(key_material),
+                              &returned_id));
 
-    TEST_ASSERT( psa_export_key( id,
-                                 exported, sizeof( exported ),
-                                 &exported_length ) == expected_result );
+    TEST_ASSERT(psa_export_key(id,
+                               exported, sizeof(exported),
+                               &exported_length) == expected_result);
 
-    TEST_ASSERT( mock_export_data.called == 1 );
+    TEST_ASSERT(mock_export_data.called == 1);
 
-    PSA_ASSERT( psa_destroy_key( id ) );
+    PSA_ASSERT(psa_destroy_key(id));
 
-    TEST_ASSERT( mock_destroy_data.called == 1 );
+    TEST_ASSERT(mock_destroy_data.called == 1);
 
 exit:
-    PSA_DONE( );
-    mock_teardown( );
+    PSA_DONE();
+    mock_teardown();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mock_generate( int mock_alloc_return_value,
-                    int mock_generate_return_value,
-                    int expected_result )
+void mock_generate(int mock_alloc_return_value,
+                   int mock_generate_return_value,
+                   int expected_result)
 {
     psa_drv_se_t driver;
     psa_drv_se_key_management_t key_management;
     psa_key_lifetime_t lifetime = TEST_SE_PERSISTENT_LIFETIME;
-    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( lifetime );
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, 1 );
+    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION(lifetime);
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, 1);
     mbedtls_svc_key_id_t returned_id;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
     mock_allocate_data.return_value = mock_alloc_return_value;
     mock_generate_data.return_value = mock_generate_return_value;
-    memset( &driver, 0, sizeof( driver ) );
-    memset( &key_management, 0, sizeof( key_management ) );
+    memset(&driver, 0, sizeof(driver));
+    memset(&key_management, 0, sizeof(key_management));
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
     driver.key_management = &key_management;
     key_management.p_generate = mock_generate;
     key_management.p_destroy = mock_destroy;
     key_management.p_allocate = mock_allocate;
 
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA );
-    psa_set_key_bits( &attributes, 8 );
-    TEST_ASSERT( psa_generate_key( &attributes, &returned_id) == expected_result );
-    TEST_ASSERT( mock_allocate_data.called == 1 );
-    TEST_ASSERT( mock_generate_data.called ==
-        ( mock_alloc_return_value == PSA_SUCCESS? 1 : 0 ) );
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
+    psa_set_key_bits(&attributes, 8);
+    TEST_ASSERT(psa_generate_key(&attributes, &returned_id) == expected_result);
+    TEST_ASSERT(mock_allocate_data.called == 1);
+    TEST_ASSERT(mock_generate_data.called ==
+                (mock_alloc_return_value == PSA_SUCCESS ? 1 : 0));
 
-    if( mock_alloc_return_value == PSA_SUCCESS )
-    {
-        TEST_ASSERT( mbedtls_svc_key_id_equal(
-                         mock_generate_data.attributes.core.id, id ) );
-    }
-    else
-    {
-        TEST_ASSERT( MBEDTLS_SVC_KEY_ID_GET_KEY_ID(
-                         mock_generate_data.attributes.core.id ) == 0 );
-        TEST_ASSERT( MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(
-                         mock_generate_data.attributes.core.id ) == 0 );
+    if (mock_alloc_return_value == PSA_SUCCESS) {
+        TEST_ASSERT(mbedtls_svc_key_id_equal(
+                        mock_generate_data.attributes.core.id, id));
+    } else {
+        TEST_ASSERT(MBEDTLS_SVC_KEY_ID_GET_KEY_ID(
+                        mock_generate_data.attributes.core.id) == 0);
+        TEST_ASSERT(MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(
+                        mock_generate_data.attributes.core.id) == 0);
     }
 
-    TEST_ASSERT( mock_generate_data.attributes.core.lifetime ==
-        ( mock_alloc_return_value == PSA_SUCCESS? lifetime : 0 ) );
-    TEST_ASSERT( mock_generate_data.attributes.core.policy.usage ==
-        ( mock_alloc_return_value == PSA_SUCCESS? PSA_KEY_USAGE_EXPORT : 0 ) );
-    TEST_ASSERT( mock_generate_data.attributes.core.type ==
-        ( mock_alloc_return_value == PSA_SUCCESS? PSA_KEY_TYPE_RAW_DATA : 0 ) );
+    TEST_ASSERT(mock_generate_data.attributes.core.lifetime ==
+                (mock_alloc_return_value == PSA_SUCCESS ? lifetime : 0));
+    TEST_ASSERT(mock_generate_data.attributes.core.policy.usage ==
+                (mock_alloc_return_value == PSA_SUCCESS ? PSA_KEY_USAGE_EXPORT : 0));
+    TEST_ASSERT(mock_generate_data.attributes.core.type ==
+                (mock_alloc_return_value == PSA_SUCCESS ? PSA_KEY_TYPE_RAW_DATA : 0));
 
-    if( expected_result == PSA_SUCCESS )
-    {
-        PSA_ASSERT( psa_destroy_key( id ) );
-        TEST_ASSERT( mock_destroy_data.called == 1 );
+    if (expected_result == PSA_SUCCESS) {
+        PSA_ASSERT(psa_destroy_key(id));
+        TEST_ASSERT(mock_destroy_data.called == 1);
     }
 
 exit:
-    PSA_DONE( );
-    mock_teardown( );
+    PSA_DONE();
+    mock_teardown();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mock_export_public( int mock_export_public_return_value,
-                         int expected_result )
+void mock_export_public(int mock_export_public_return_value,
+                        int expected_result)
 {
     psa_drv_se_t driver;
     psa_drv_se_key_management_t key_management;
     psa_key_lifetime_t lifetime = TEST_SE_PERSISTENT_LIFETIME;
-    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( lifetime );
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, 1 );
+    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION(lifetime);
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, 1);
     mbedtls_svc_key_id_t returned_id;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    const uint8_t key_material[3] = {0xfa, 0xca, 0xde};
-    uint8_t exported[sizeof( key_material )];
+    const uint8_t key_material[3] = { 0xfa, 0xca, 0xde };
+    uint8_t exported[sizeof(key_material)];
     size_t exported_length;
 
     mock_export_public_data.return_value = mock_export_public_return_value;
-    memset( &driver, 0, sizeof( driver ) );
-    memset( &key_management, 0, sizeof( key_management ) );
+    memset(&driver, 0, sizeof(driver));
+    memset(&key_management, 0, sizeof(key_management));
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
     driver.key_management = &key_management;
     key_management.p_import = mock_import;
@@ -538,52 +525,52 @@
     key_management.p_destroy = mock_destroy;
     key_management.p_allocate = mock_allocate;
 
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RSA_PUBLIC_KEY );
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RSA_PUBLIC_KEY);
 
-    PSA_ASSERT( psa_import_key( &attributes,
-                                key_material, sizeof( key_material ),
-                                &returned_id ) );
+    PSA_ASSERT(psa_import_key(&attributes,
+                              key_material, sizeof(key_material),
+                              &returned_id));
 
-    TEST_ASSERT( psa_export_public_key( id, exported, sizeof(exported),
-                                        &exported_length ) == expected_result );
-    TEST_ASSERT( mock_export_public_data.called == 1 );
+    TEST_ASSERT(psa_export_public_key(id, exported, sizeof(exported),
+                                      &exported_length) == expected_result);
+    TEST_ASSERT(mock_export_public_data.called == 1);
 
-    PSA_ASSERT( psa_destroy_key( id ) );
-    TEST_ASSERT( mock_destroy_data.called == 1 );
+    PSA_ASSERT(psa_destroy_key(id));
+    TEST_ASSERT(mock_destroy_data.called == 1);
 
 exit:
-    PSA_DONE( );
-    mock_teardown( );
+    PSA_DONE();
+    mock_teardown();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mock_sign( int mock_sign_return_value, int expected_result )
+void mock_sign(int mock_sign_return_value, int expected_result)
 {
     psa_drv_se_t driver;
     psa_drv_se_key_management_t key_management;
     psa_drv_se_asymmetric_t asymmetric;
     psa_key_lifetime_t lifetime = TEST_SE_PERSISTENT_LIFETIME;
-    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( lifetime );
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, 1 );
+    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION(lifetime);
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, 1);
     mbedtls_svc_key_id_t returned_id;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    const uint8_t key_material[3] = {0xfa, 0xca, 0xde};
+    const uint8_t key_material[3] = { 0xfa, 0xca, 0xde };
     psa_algorithm_t algorithm = PSA_ALG_ECDSA(PSA_ALG_SHA_256);
-    const uint8_t hash[1] = {'H'};
-    uint8_t signature[1] = {'S'};
+    const uint8_t hash[1] = { 'H' };
+    uint8_t signature[1] = { 'S' };
     size_t signature_length;
 
     mock_sign_data.return_value = mock_sign_return_value;
-    memset( &driver, 0, sizeof( driver ) );
-    memset( &key_management, 0, sizeof( key_management ) );
-    memset( &asymmetric, 0, sizeof( asymmetric ) );
+    memset(&driver, 0, sizeof(driver));
+    memset(&key_management, 0, sizeof(key_management));
+    memset(&asymmetric, 0, sizeof(asymmetric));
 
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
 
@@ -595,55 +582,55 @@
     driver.asymmetric = &asymmetric;
     asymmetric.p_sign = mock_sign;
 
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN_HASH );
-    psa_set_key_algorithm( &attributes, algorithm );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RSA_KEY_PAIR );
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_SIGN_HASH);
+    psa_set_key_algorithm(&attributes, algorithm);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RSA_KEY_PAIR);
 
-    PSA_ASSERT( psa_import_key( &attributes,
-                                key_material, sizeof( key_material ),
-                                &returned_id ) );
+    PSA_ASSERT(psa_import_key(&attributes,
+                              key_material, sizeof(key_material),
+                              &returned_id));
 
-    TEST_ASSERT( psa_sign_hash( id, algorithm,
-                                hash, sizeof( hash ),
-                                signature, sizeof( signature ),
-                                &signature_length)
-                 == expected_result );
-    TEST_ASSERT( mock_sign_data.called == 1 );
+    TEST_ASSERT(psa_sign_hash(id, algorithm,
+                              hash, sizeof(hash),
+                              signature, sizeof(signature),
+                              &signature_length)
+                == expected_result);
+    TEST_ASSERT(mock_sign_data.called == 1);
 
-    PSA_ASSERT( psa_destroy_key( id ) );
-    TEST_ASSERT( mock_destroy_data.called == 1 );
+    PSA_ASSERT(psa_destroy_key(id));
+    TEST_ASSERT(mock_destroy_data.called == 1);
 
 exit:
-    PSA_DONE( );
-    mock_teardown( );
+    PSA_DONE();
+    mock_teardown();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mock_verify( int mock_verify_return_value, int expected_result )
+void mock_verify(int mock_verify_return_value, int expected_result)
 {
     psa_drv_se_t driver;
     psa_drv_se_key_management_t key_management;
     psa_drv_se_asymmetric_t asymmetric;
     psa_key_lifetime_t lifetime = TEST_SE_PERSISTENT_LIFETIME;
-    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( lifetime );
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, 1 );
+    psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION(lifetime);
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, 1);
     mbedtls_svc_key_id_t returned_id;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    const uint8_t key_material[3] = {0xfa, 0xca, 0xde};
+    const uint8_t key_material[3] = { 0xfa, 0xca, 0xde };
     psa_algorithm_t algorithm = PSA_ALG_ECDSA(PSA_ALG_SHA_256);
-    const uint8_t hash[1] = {'H'};
-    const uint8_t signature[1] = {'S'};
+    const uint8_t hash[1] = { 'H' };
+    const uint8_t signature[1] = { 'S' };
 
     mock_verify_data.return_value = mock_verify_return_value;
-    memset( &driver, 0, sizeof( driver ) );
-    memset( &key_management, 0, sizeof( key_management ) );
-    memset( &asymmetric, 0, sizeof( asymmetric ) );
+    memset(&driver, 0, sizeof(driver));
+    memset(&key_management, 0, sizeof(key_management));
+    memset(&asymmetric, 0, sizeof(asymmetric));
 
     driver.hal_version = PSA_DRV_SE_HAL_VERSION;
 
@@ -655,30 +642,30 @@
     driver.asymmetric = &asymmetric;
     asymmetric.p_verify = mock_verify;
 
-    PSA_ASSERT( psa_register_se_driver( location, &driver ) );
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_register_se_driver(location, &driver));
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_VERIFY_HASH );
-    psa_set_key_algorithm( &attributes, algorithm );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA );
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_VERIFY_HASH);
+    psa_set_key_algorithm(&attributes, algorithm);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
 
-    PSA_ASSERT( psa_import_key( &attributes,
-                                key_material, sizeof( key_material ),
-                                &returned_id ) );
+    PSA_ASSERT(psa_import_key(&attributes,
+                              key_material, sizeof(key_material),
+                              &returned_id));
 
-    TEST_ASSERT( psa_verify_hash( id, algorithm,
-                                  hash, sizeof( hash ),
-                                  signature, sizeof( signature ) )
-                 == expected_result );
-    TEST_ASSERT( mock_verify_data.called == 1 );
+    TEST_ASSERT(psa_verify_hash(id, algorithm,
+                                hash, sizeof(hash),
+                                signature, sizeof(signature))
+                == expected_result);
+    TEST_ASSERT(mock_verify_data.called == 1);
 
-    PSA_ASSERT( psa_destroy_key( id ) );
-    TEST_ASSERT( mock_destroy_data.called == 1 );
+    PSA_ASSERT(psa_destroy_key(id));
+    TEST_ASSERT(mock_destroy_data.called == 1);
 
 exit:
-    PSA_DONE( );
-    mock_teardown( );
+    PSA_DONE();
+    mock_teardown();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_slot_management.function b/tests/suites/test_suite_psa_crypto_slot_management.function
index d577663..e3bb0d3 100644
--- a/tests/suites/test_suite_psa_crypto_slot_management.function
+++ b/tests/suites/test_suite_psa_crypto_slot_management.function
@@ -4,8 +4,7 @@
 #include "psa_crypto_slot_management.h"
 #include "psa_crypto_storage.h"
 
-typedef enum
-{
+typedef enum {
     /**< Close key(s) */
     INVALIDATE_BY_CLOSING,
 
@@ -28,15 +27,13 @@
     INVALIDATE_BY_PURGING_WITH_SHUTDOWN,
 } invalidate_method_t;
 
-typedef enum
-{
+typedef enum {
     KEEP_OPEN,
     CLOSE_BEFORE,
     CLOSE_AFTER,
 } reopen_policy_t;
 
-typedef enum
-{
+typedef enum {
     INVALID_HANDLE_0,
     INVALID_HANDLE_UNOPENED,
     INVALID_HANDLE_CLOSED,
@@ -46,61 +43,59 @@
 /** Apply \p invalidate_method to invalidate the specified key:
  * close it, destroy it, or do nothing;
  */
-static int invalidate_key( invalidate_method_t invalidate_method,
-                           mbedtls_svc_key_id_t key )
+static int invalidate_key(invalidate_method_t invalidate_method,
+                          mbedtls_svc_key_id_t key)
 {
-    switch( invalidate_method )
-    {
+    switch (invalidate_method) {
         /* Closing the key invalidate only volatile keys, not persistent ones. */
         case INVALIDATE_BY_CLOSING:
         case INVALIDATE_BY_CLOSING_WITH_SHUTDOWN:
-            PSA_ASSERT( psa_close_key( key ) );
+            PSA_ASSERT(psa_close_key(key));
             break;
         case INVALIDATE_BY_DESTROYING:
         case INVALIDATE_BY_DESTROYING_WITH_SHUTDOWN:
-            PSA_ASSERT( psa_destroy_key( key ) );
+            PSA_ASSERT(psa_destroy_key(key));
             break;
         /* Purging the key just purges RAM data of persistent keys. */
         case INVALIDATE_BY_PURGING:
         case INVALIDATE_BY_PURGING_WITH_SHUTDOWN:
-            PSA_ASSERT( psa_purge_key( key ) );
+            PSA_ASSERT(psa_purge_key(key));
             break;
         case INVALIDATE_BY_SHUTDOWN:
             break;
     }
-    return( 1 );
+    return 1;
 exit:
-    return( 0 );
+    return 0;
 }
 
 /** Restart the PSA subsystem if \p invalidate_method says so. */
-static int invalidate_psa( invalidate_method_t invalidate_method )
+static int invalidate_psa(invalidate_method_t invalidate_method)
 {
-    switch( invalidate_method )
-    {
+    switch (invalidate_method) {
         case INVALIDATE_BY_CLOSING:
         case INVALIDATE_BY_DESTROYING:
         case INVALIDATE_BY_PURGING:
-            return( 1 );
+            return 1;
         case INVALIDATE_BY_CLOSING_WITH_SHUTDOWN:
         case INVALIDATE_BY_DESTROYING_WITH_SHUTDOWN:
         case INVALIDATE_BY_PURGING_WITH_SHUTDOWN:
             /* All keys must have been closed. */
-            PSA_SESSION_DONE( );
+            PSA_SESSION_DONE();
             break;
         case INVALIDATE_BY_SHUTDOWN:
             /* Some keys may remain behind, and we're testing that this
              * properly closes them. */
-            mbedtls_psa_crypto_free( );
+            mbedtls_psa_crypto_free();
             break;
     }
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    ASSERT_PSA_PRISTINE( );
-    return( 1 );
+    PSA_ASSERT(psa_crypto_init());
+    ASSERT_PSA_PRISTINE();
+    return 1;
 
 exit:
-    return( 0 );
+    return 0;
 }
 
 /* END_HEADER */
@@ -111,10 +106,10 @@
  */
 
 /* BEGIN_CASE */
-void transient_slot_lifecycle( int owner_id_arg,
-                               int usage_arg, int alg_arg,
-                               int type_arg, data_t *key_data,
-                               int invalidate_method_arg )
+void transient_slot_lifecycle(int owner_id_arg,
+                              int usage_arg, int alg_arg,
+                              int type_arg, data_t *key_data,
+                              int invalidate_method_arg)
 {
     psa_algorithm_t alg = alg_arg;
     psa_key_usage_t usage_flags = usage_arg;
@@ -123,40 +118,40 @@
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    mbedtls_test_set_step( 1 );
-    PSA_ASSERT( psa_crypto_init( ) );
+    mbedtls_test_set_step(1);
+    PSA_ASSERT(psa_crypto_init());
 
     /* Import a key. */
 #if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
     mbedtls_key_owner_id_t owner_id = owner_id_arg;
 
-    mbedtls_set_key_owner_id( &attributes, owner_id );
+    mbedtls_set_key_owner_id(&attributes, owner_id);
 #else
-    (void)owner_id_arg;
+    (void) owner_id_arg;
 #endif
 
-    psa_set_key_usage_flags( &attributes, usage_flags );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_type( &attributes, type );
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &key ) );
-    TEST_ASSERT( ! mbedtls_svc_key_id_is_null( key ) );
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    TEST_EQUAL( psa_get_key_type( &attributes ), type );
-    psa_reset_key_attributes( &attributes );
+    psa_set_key_usage_flags(&attributes, usage_flags);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_type(&attributes, type);
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &key));
+    TEST_ASSERT(!mbedtls_svc_key_id_is_null(key));
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    TEST_EQUAL(psa_get_key_type(&attributes), type);
+    psa_reset_key_attributes(&attributes);
 
 #if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
     {
         psa_key_handle_t handle;
         mbedtls_svc_key_id_t key_with_invalid_owner =
-            mbedtls_svc_key_id_make( owner_id + 1,
-                                     MBEDTLS_SVC_KEY_ID_GET_KEY_ID( key ) );
+            mbedtls_svc_key_id_make(owner_id + 1,
+                                    MBEDTLS_SVC_KEY_ID_GET_KEY_ID(key));
 
-        TEST_ASSERT( mbedtls_key_owner_id_equal(
-                         owner_id,
-                         MBEDTLS_SVC_KEY_ID_GET_OWNER_ID( key ) ) );
-        TEST_EQUAL( psa_open_key( key_with_invalid_owner, &handle ),
-                    PSA_ERROR_DOES_NOT_EXIST );
+        TEST_ASSERT(mbedtls_key_owner_id_equal(
+                        owner_id,
+                        MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(key)));
+        TEST_EQUAL(psa_open_key(key_with_invalid_owner, &handle),
+                   PSA_ERROR_DOES_NOT_EXIST);
     }
 #endif
 
@@ -164,42 +159,44 @@
      * Purge the key and make sure that it is still valid, as purging a
      * volatile key shouldn't invalidate/destroy it.
      */
-    PSA_ASSERT( psa_purge_key( key ) );
-    PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
-    TEST_EQUAL( psa_get_key_type( &attributes ), type );
-    psa_reset_key_attributes( &attributes );
+    PSA_ASSERT(psa_purge_key(key));
+    PSA_ASSERT(psa_get_key_attributes(key, &attributes));
+    TEST_EQUAL(psa_get_key_type(&attributes), type);
+    psa_reset_key_attributes(&attributes);
 
     /* Do something that invalidates the key. */
-    mbedtls_test_set_step( 2 );
-    if( ! invalidate_key( invalidate_method, key ) )
+    mbedtls_test_set_step(2);
+    if (!invalidate_key(invalidate_method, key)) {
         goto exit;
-    if( ! invalidate_psa( invalidate_method ) )
+    }
+    if (!invalidate_psa(invalidate_method)) {
         goto exit;
+    }
 
     /* Test that the key is now invalid. */
-    TEST_EQUAL( psa_get_key_attributes( key, &attributes ),
-                PSA_ERROR_INVALID_HANDLE );
-    TEST_EQUAL( psa_close_key( key ), PSA_ERROR_INVALID_HANDLE );
+    TEST_EQUAL(psa_get_key_attributes(key, &attributes),
+               PSA_ERROR_INVALID_HANDLE);
+    TEST_EQUAL(psa_close_key(key), PSA_ERROR_INVALID_HANDLE);
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_STORAGE_C */
-void persistent_slot_lifecycle( int lifetime_arg, int owner_id_arg, int id_arg,
-                                int usage_arg, int alg_arg, int alg2_arg,
-                                int type_arg, data_t *key_data,
-                                int invalidate_method_arg )
+void persistent_slot_lifecycle(int lifetime_arg, int owner_id_arg, int id_arg,
+                               int usage_arg, int alg_arg, int alg2_arg,
+                               int type_arg, data_t *key_data,
+                               int invalidate_method_arg)
 {
     psa_key_lifetime_t lifetime = lifetime_arg;
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( owner_id_arg, id_arg );
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(owner_id_arg, id_arg);
     psa_algorithm_t alg = alg_arg;
     psa_algorithm_t alg2 = alg2_arg;
     psa_key_usage_t usage_flags = usage_arg;
@@ -214,112 +211,110 @@
 
 #if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
     mbedtls_svc_key_id_t wrong_owner_id =
-        mbedtls_svc_key_id_make( owner_id_arg + 1, id_arg );
+        mbedtls_svc_key_id_make(owner_id_arg + 1, id_arg);
     mbedtls_svc_key_id_t invalid_svc_key_id = MBEDTLS_SVC_KEY_ID_INIT;
 #endif
 
-    TEST_USES_KEY_ID( id );
+    TEST_USES_KEY_ID(id);
 
-    mbedtls_test_set_step( 1 );
-    PSA_ASSERT( psa_crypto_init( ) );
+    mbedtls_test_set_step(1);
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_type( &attributes, type );
-    psa_set_key_usage_flags( &attributes, usage_flags );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_enrollment_algorithm( &attributes, alg2 );
-    PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
-                                &returned_id ) );
-    TEST_ASSERT( mbedtls_svc_key_id_equal( id, returned_id ) );
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_type(&attributes, type);
+    psa_set_key_usage_flags(&attributes, usage_flags);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_enrollment_algorithm(&attributes, alg2);
+    PSA_ASSERT(psa_import_key(&attributes, key_data->x, key_data->len,
+                              &returned_id));
+    TEST_ASSERT(mbedtls_svc_key_id_equal(id, returned_id));
 
 #if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
-    TEST_EQUAL( psa_open_key( wrong_owner_id, &invalid_svc_key_id ),
-                PSA_ERROR_DOES_NOT_EXIST );
+    TEST_EQUAL(psa_open_key(wrong_owner_id, &invalid_svc_key_id),
+               PSA_ERROR_DOES_NOT_EXIST);
 #endif
 
-    PSA_ASSERT( psa_get_key_attributes( id, &attributes ) );
-    TEST_EQUAL( psa_get_key_lifetime( &attributes ), lifetime );
-    TEST_ASSERT( mbedtls_svc_key_id_equal(
-                     psa_get_key_id( &attributes ), id ) );
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes ),
-                mbedtls_test_update_key_usage_flags( usage_flags ) );
-    TEST_EQUAL( psa_get_key_algorithm( &attributes ), alg );
-    TEST_EQUAL( psa_get_key_enrollment_algorithm( &attributes ), alg2 );
-    TEST_EQUAL( psa_get_key_type( &attributes ), type );
+    PSA_ASSERT(psa_get_key_attributes(id, &attributes));
+    TEST_EQUAL(psa_get_key_lifetime(&attributes), lifetime);
+    TEST_ASSERT(mbedtls_svc_key_id_equal(
+                    psa_get_key_id(&attributes), id));
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes),
+               mbedtls_test_update_key_usage_flags(usage_flags));
+    TEST_EQUAL(psa_get_key_algorithm(&attributes), alg);
+    TEST_EQUAL(psa_get_key_enrollment_algorithm(&attributes), alg2);
+    TEST_EQUAL(psa_get_key_type(&attributes), type);
 
     /* Close the key and then open it. */
-    PSA_ASSERT( psa_close_key( id ) );
+    PSA_ASSERT(psa_close_key(id));
 
 #if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
-    TEST_EQUAL( psa_open_key( wrong_owner_id, &invalid_svc_key_id ),
-                PSA_ERROR_DOES_NOT_EXIST );
+    TEST_EQUAL(psa_open_key(wrong_owner_id, &invalid_svc_key_id),
+               PSA_ERROR_DOES_NOT_EXIST);
 #endif
 
-    PSA_ASSERT( psa_open_key( id, &handle ) );
-    TEST_ASSERT( ! psa_key_handle_is_null( handle ) );
-    PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
-    TEST_EQUAL( psa_get_key_lifetime( &attributes ), lifetime );
-    TEST_ASSERT( mbedtls_svc_key_id_equal(
-                     psa_get_key_id( &attributes ), id ) );
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes ),
-                mbedtls_test_update_key_usage_flags( usage_flags ) );
-    TEST_EQUAL( psa_get_key_algorithm( &attributes ), alg );
-    TEST_EQUAL( psa_get_key_enrollment_algorithm( &attributes ), alg2 );
-    TEST_EQUAL( psa_get_key_type( &attributes ), type );
+    PSA_ASSERT(psa_open_key(id, &handle));
+    TEST_ASSERT(!psa_key_handle_is_null(handle));
+    PSA_ASSERT(psa_get_key_attributes(handle, &attributes));
+    TEST_EQUAL(psa_get_key_lifetime(&attributes), lifetime);
+    TEST_ASSERT(mbedtls_svc_key_id_equal(
+                    psa_get_key_id(&attributes), id));
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes),
+               mbedtls_test_update_key_usage_flags(usage_flags));
+    TEST_EQUAL(psa_get_key_algorithm(&attributes), alg);
+    TEST_EQUAL(psa_get_key_enrollment_algorithm(&attributes), alg2);
+    TEST_EQUAL(psa_get_key_type(&attributes), type);
 
     /*
      * Do something that wipes key data in volatile memory or destroy the
      * key.
      */
-    mbedtls_test_set_step( 2 );
-    if( ! invalidate_key( invalidate_method, id ) )
+    mbedtls_test_set_step(2);
+    if (!invalidate_key(invalidate_method, id)) {
         goto exit;
-    if( ! invalidate_psa( invalidate_method ) )
+    }
+    if (!invalidate_psa(invalidate_method)) {
         goto exit;
+    }
 
     /* Try to reaccess the key. If we destroyed it, check that it doesn't
      * exist. Otherwise check that it still exists and has the expected
      * content. */
-    switch( invalidate_method )
-    {
+    switch (invalidate_method) {
         case INVALIDATE_BY_CLOSING:
         case INVALIDATE_BY_CLOSING_WITH_SHUTDOWN:
         case INVALIDATE_BY_PURGING:
         case INVALIDATE_BY_PURGING_WITH_SHUTDOWN:
         case INVALIDATE_BY_SHUTDOWN:
-            PSA_ASSERT( psa_open_key( id, &handle ) );
-            PSA_ASSERT( psa_get_key_attributes( id, &read_attributes ) );
-            TEST_EQUAL( psa_get_key_lifetime( &attributes ),
-                        psa_get_key_lifetime( &read_attributes ) );
-            TEST_ASSERT( mbedtls_svc_key_id_equal(
-                             psa_get_key_id( &attributes ),
-                             psa_get_key_id( &read_attributes ) ) );
-            TEST_EQUAL( psa_get_key_usage_flags( &attributes ),
-                        mbedtls_test_update_key_usage_flags( usage_flags ) );
-            TEST_EQUAL( psa_get_key_algorithm( &attributes ),
-                        psa_get_key_algorithm( &read_attributes ) );
-            TEST_EQUAL( psa_get_key_enrollment_algorithm( &attributes ),
-                        psa_get_key_enrollment_algorithm( &read_attributes ) );
-            TEST_EQUAL( psa_get_key_type( &attributes ),
-                        psa_get_key_type( &read_attributes ) );
-            TEST_EQUAL( psa_get_key_bits( &attributes ),
-                        psa_get_key_bits( &read_attributes ) );
-            ASSERT_ALLOC( reexported, key_data->len );
-            if( usage_flags & PSA_KEY_USAGE_EXPORT )
-            {
-                PSA_ASSERT( psa_export_key( id, reexported, key_data->len,
-                                            &reexported_length ) );
-                ASSERT_COMPARE( key_data->x, key_data->len,
-                                reexported, reexported_length );
+            PSA_ASSERT(psa_open_key(id, &handle));
+            PSA_ASSERT(psa_get_key_attributes(id, &read_attributes));
+            TEST_EQUAL(psa_get_key_lifetime(&attributes),
+                       psa_get_key_lifetime(&read_attributes));
+            TEST_ASSERT(mbedtls_svc_key_id_equal(
+                            psa_get_key_id(&attributes),
+                            psa_get_key_id(&read_attributes)));
+            TEST_EQUAL(psa_get_key_usage_flags(&attributes),
+                       mbedtls_test_update_key_usage_flags(usage_flags));
+            TEST_EQUAL(psa_get_key_algorithm(&attributes),
+                       psa_get_key_algorithm(&read_attributes));
+            TEST_EQUAL(psa_get_key_enrollment_algorithm(&attributes),
+                       psa_get_key_enrollment_algorithm(&read_attributes));
+            TEST_EQUAL(psa_get_key_type(&attributes),
+                       psa_get_key_type(&read_attributes));
+            TEST_EQUAL(psa_get_key_bits(&attributes),
+                       psa_get_key_bits(&read_attributes));
+            ASSERT_ALLOC(reexported, key_data->len);
+            if (usage_flags & PSA_KEY_USAGE_EXPORT) {
+                PSA_ASSERT(psa_export_key(id, reexported, key_data->len,
+                                          &reexported_length));
+                ASSERT_COMPARE(key_data->x, key_data->len,
+                               reexported, reexported_length);
+            } else {
+                TEST_EQUAL(psa_export_key(id, reexported,
+                                          key_data->len, &reexported_length),
+                           PSA_ERROR_NOT_PERMITTED);
             }
-            else
-            {
-                TEST_EQUAL( psa_export_key( id, reexported,
-                                key_data->len, &reexported_length ),
-                            PSA_ERROR_NOT_PERMITTED );
-            }
-            PSA_ASSERT( psa_close_key( handle ) );
+            PSA_ASSERT(psa_close_key(handle));
             break;
 
         case INVALIDATE_BY_DESTROYING:
@@ -328,11 +323,11 @@
              * Test that the key handle and identifier are now not referring to an
              * existing key.
              */
-            TEST_EQUAL( psa_get_key_attributes( handle, &read_attributes ),
-                        PSA_ERROR_INVALID_HANDLE );
-            TEST_EQUAL( psa_close_key( handle ), PSA_ERROR_INVALID_HANDLE );
-            TEST_EQUAL( psa_get_key_attributes( id, &read_attributes ),
-                        PSA_ERROR_INVALID_HANDLE );
+            TEST_EQUAL(psa_get_key_attributes(handle, &read_attributes),
+                       PSA_ERROR_INVALID_HANDLE);
+            TEST_EQUAL(psa_close_key(handle), PSA_ERROR_INVALID_HANDLE);
+            TEST_EQUAL(psa_get_key_attributes(id, &read_attributes),
+                       PSA_ERROR_INVALID_HANDLE);
             break;
     }
 
@@ -341,158 +336,159 @@
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
-    psa_reset_key_attributes( &read_attributes );
+    psa_reset_key_attributes(&attributes);
+    psa_reset_key_attributes(&read_attributes);
 
-    PSA_DONE( );
-    mbedtls_free( reexported );
+    PSA_DONE();
+    mbedtls_free(reexported);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_STORAGE_C */
-void create_existent( int lifetime_arg, int owner_id_arg, int id_arg,
-                      int reopen_policy_arg )
+void create_existent(int lifetime_arg, int owner_id_arg, int id_arg,
+                     int reopen_policy_arg)
 {
     psa_key_lifetime_t lifetime = lifetime_arg;
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( owner_id_arg, id_arg );
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(owner_id_arg, id_arg);
     mbedtls_svc_key_id_t returned_id = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_type_t type1 = PSA_KEY_TYPE_RAW_DATA;
     const uint8_t material1[5] = "a key";
     const uint8_t material2[5] = "b key";
-    size_t bits1 = PSA_BYTES_TO_BITS( sizeof( material1 ) );
-    uint8_t reexported[sizeof( material1 )];
+    size_t bits1 = PSA_BYTES_TO_BITS(sizeof(material1));
+    uint8_t reexported[sizeof(material1)];
     size_t reexported_length;
     reopen_policy_t reopen_policy = reopen_policy_arg;
 
-    TEST_USES_KEY_ID( id );
+    TEST_USES_KEY_ID(id);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Create a key. */
-    psa_set_key_id( &attributes, id );
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_type( &attributes, type1 );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
-    psa_set_key_algorithm( &attributes, 0 );
-    PSA_ASSERT( psa_import_key( &attributes, material1, sizeof( material1 ),
-                                &returned_id ) );
-    TEST_ASSERT( mbedtls_svc_key_id_equal( id, returned_id ) );
+    psa_set_key_id(&attributes, id);
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_type(&attributes, type1);
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
+    psa_set_key_algorithm(&attributes, 0);
+    PSA_ASSERT(psa_import_key(&attributes, material1, sizeof(material1),
+                              &returned_id));
+    TEST_ASSERT(mbedtls_svc_key_id_equal(id, returned_id));
 
-    if( reopen_policy == CLOSE_BEFORE )
-        PSA_ASSERT( psa_close_key( id ) );
+    if (reopen_policy == CLOSE_BEFORE) {
+        PSA_ASSERT(psa_close_key(id));
+    }
 
     /* Attempt to create a new key in the same slot. */
-    TEST_EQUAL( psa_import_key( &attributes, material2, sizeof( material2 ),
-                                &returned_id ),
-                PSA_ERROR_ALREADY_EXISTS );
-    TEST_ASSERT( mbedtls_svc_key_id_is_null( returned_id ) );
+    TEST_EQUAL(psa_import_key(&attributes, material2, sizeof(material2),
+                              &returned_id),
+               PSA_ERROR_ALREADY_EXISTS);
+    TEST_ASSERT(mbedtls_svc_key_id_is_null(returned_id));
 
-    if( reopen_policy == CLOSE_AFTER )
-        PSA_ASSERT( psa_close_key( id ) );
+    if (reopen_policy == CLOSE_AFTER) {
+        PSA_ASSERT(psa_close_key(id));
+    }
 
     /* Check that the original key hasn't changed. */
-    psa_reset_key_attributes( &attributes );
-    PSA_ASSERT( psa_get_key_attributes( id, &attributes ) );
-    TEST_ASSERT( mbedtls_svc_key_id_equal(
-                     psa_get_key_id( &attributes ), id ) );
-    TEST_EQUAL( psa_get_key_lifetime( &attributes ), lifetime );
-    TEST_EQUAL( psa_get_key_type( &attributes ), type1 );
-    TEST_EQUAL( psa_get_key_bits( &attributes ), bits1 );
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes ), PSA_KEY_USAGE_EXPORT );
-    TEST_EQUAL( psa_get_key_algorithm( &attributes ), 0 );
+    psa_reset_key_attributes(&attributes);
+    PSA_ASSERT(psa_get_key_attributes(id, &attributes));
+    TEST_ASSERT(mbedtls_svc_key_id_equal(
+                    psa_get_key_id(&attributes), id));
+    TEST_EQUAL(psa_get_key_lifetime(&attributes), lifetime);
+    TEST_EQUAL(psa_get_key_type(&attributes), type1);
+    TEST_EQUAL(psa_get_key_bits(&attributes), bits1);
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes), PSA_KEY_USAGE_EXPORT);
+    TEST_EQUAL(psa_get_key_algorithm(&attributes), 0);
 
-    PSA_ASSERT( psa_export_key( id,
-                                reexported, sizeof( reexported ),
-                                &reexported_length ) );
-    ASSERT_COMPARE( material1, sizeof( material1 ),
-                    reexported, reexported_length );
+    PSA_ASSERT(psa_export_key(id,
+                              reexported, sizeof(reexported),
+                              &reexported_length));
+    ASSERT_COMPARE(material1, sizeof(material1),
+                   reexported, reexported_length);
 
-    PSA_ASSERT( psa_close_key( id ) );
+    PSA_ASSERT(psa_close_key(id));
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void open_fail( int id_arg,
-                int expected_status_arg )
+void open_fail(int id_arg,
+               int expected_status_arg)
 {
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, id_arg );
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, id_arg);
     psa_status_t expected_status = expected_status_arg;
-    psa_key_handle_t handle = mbedtls_svc_key_id_make( 0xdead, 0xdead );
+    psa_key_handle_t handle = mbedtls_svc_key_id_make(0xdead, 0xdead);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    TEST_EQUAL( psa_open_key( id, &handle ), expected_status );
-    TEST_ASSERT( psa_key_handle_is_null( handle ) );
+    TEST_EQUAL(psa_open_key(id, &handle), expected_status);
+    TEST_ASSERT(psa_key_handle_is_null(handle));
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void create_fail( int lifetime_arg, int id_arg,
-                  int expected_status_arg )
+void create_fail(int lifetime_arg, int id_arg,
+                 int expected_status_arg)
 {
     psa_key_lifetime_t lifetime = lifetime_arg;
-    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make( 1, id_arg );
+    mbedtls_svc_key_id_t id = mbedtls_svc_key_id_make(1, id_arg);
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     psa_status_t expected_status = expected_status_arg;
     mbedtls_svc_key_id_t returned_id =
-        mbedtls_svc_key_id_make( 0xdead, 0xdead );
-    uint8_t material[1] = {'k'};
+        mbedtls_svc_key_id_make(0xdead, 0xdead);
+    uint8_t material[1] = { 'k' };
 
-    TEST_USES_KEY_ID( id );
+    TEST_USES_KEY_ID(id);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_lifetime( &attributes, lifetime );
-    if( PSA_KEY_LIFETIME_IS_VOLATILE( lifetime ) )
-    {
+    psa_set_key_lifetime(&attributes, lifetime);
+    if (PSA_KEY_LIFETIME_IS_VOLATILE(lifetime)) {
         /*
          * Not possible to set a key identifier different from 0 through
          * PSA key attributes APIs thus accessing to the attributes
          * directly.
          */
         attributes.core.id = id;
+    } else {
+        psa_set_key_id(&attributes, id);
     }
-    else
-        psa_set_key_id( &attributes, id );
 
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA );
-    TEST_EQUAL( psa_import_key( &attributes, material, sizeof( material ),
-                                &returned_id ),
-                expected_status );
-    TEST_ASSERT( mbedtls_svc_key_id_is_null( returned_id ) );
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
+    TEST_EQUAL(psa_import_key(&attributes, material, sizeof(material),
+                              &returned_id),
+               expected_status);
+    TEST_ASSERT(mbedtls_svc_key_id_is_null(returned_id));
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void copy_across_lifetimes( int source_lifetime_arg, int source_owner_id_arg,
-                            int source_id_arg, int source_usage_arg,
-                            int source_alg_arg, int source_alg2_arg,
-                            int type_arg, data_t *material,
-                            int target_lifetime_arg, int target_owner_id_arg,
-                            int target_id_arg, int target_usage_arg,
-                            int target_alg_arg, int target_alg2_arg,
-                            int expected_usage_arg,
-                            int expected_alg_arg, int expected_alg2_arg )
+void copy_across_lifetimes(int source_lifetime_arg, int source_owner_id_arg,
+                           int source_id_arg, int source_usage_arg,
+                           int source_alg_arg, int source_alg2_arg,
+                           int type_arg, data_t *material,
+                           int target_lifetime_arg, int target_owner_id_arg,
+                           int target_id_arg, int target_usage_arg,
+                           int target_alg_arg, int target_alg2_arg,
+                           int expected_usage_arg,
+                           int expected_alg_arg, int expected_alg2_arg)
 {
     psa_key_lifetime_t source_lifetime = source_lifetime_arg;
     mbedtls_svc_key_id_t source_id =
-        mbedtls_svc_key_id_make( source_owner_id_arg, source_id_arg );
+        mbedtls_svc_key_id_make(source_owner_id_arg, source_id_arg);
     psa_key_usage_t source_usage = source_usage_arg;
     psa_algorithm_t source_alg = source_alg_arg;
     psa_key_attributes_t source_attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -500,7 +496,7 @@
     mbedtls_svc_key_id_t returned_source_id = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_lifetime_t target_lifetime = target_lifetime_arg;
     mbedtls_svc_key_id_t target_id =
-        mbedtls_svc_key_id_make( target_owner_id_arg, target_id_arg );
+        mbedtls_svc_key_id_make(target_owner_id_arg, target_id_arg);
     psa_key_usage_t target_usage = target_usage_arg;
     psa_algorithm_t target_alg = target_alg_arg;
     psa_key_attributes_t target_attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -511,127 +507,120 @@
     psa_algorithm_t expected_alg2 = expected_alg2_arg;
     uint8_t *export_buffer = NULL;
 
-    TEST_USES_KEY_ID( source_id );
-    TEST_USES_KEY_ID( target_id );
+    TEST_USES_KEY_ID(source_id);
+    TEST_USES_KEY_ID(target_id);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Populate the source slot. */
-    psa_set_key_id( &source_attributes, source_id );
-    psa_set_key_lifetime( &source_attributes, source_lifetime );
+    psa_set_key_id(&source_attributes, source_id);
+    psa_set_key_lifetime(&source_attributes, source_lifetime);
 
-    psa_set_key_type( &source_attributes, source_type );
-    psa_set_key_usage_flags( &source_attributes, source_usage );
-    psa_set_key_algorithm( &source_attributes, source_alg );
-    psa_set_key_enrollment_algorithm( &source_attributes, source_alg2_arg );
-    PSA_ASSERT( psa_import_key( &source_attributes,
-                                material->x, material->len,
-                                &returned_source_id ) );
+    psa_set_key_type(&source_attributes, source_type);
+    psa_set_key_usage_flags(&source_attributes, source_usage);
+    psa_set_key_algorithm(&source_attributes, source_alg);
+    psa_set_key_enrollment_algorithm(&source_attributes, source_alg2_arg);
+    PSA_ASSERT(psa_import_key(&source_attributes,
+                              material->x, material->len,
+                              &returned_source_id));
     /* Update the attributes with the bit size. */
-    PSA_ASSERT( psa_get_key_attributes( returned_source_id,
-                                        &source_attributes ) );
+    PSA_ASSERT(psa_get_key_attributes(returned_source_id,
+                                      &source_attributes));
 
     /* Prepare the target slot. */
-    psa_set_key_id( &target_attributes, target_id );
-    psa_set_key_lifetime( &target_attributes, target_lifetime );
+    psa_set_key_id(&target_attributes, target_id);
+    psa_set_key_lifetime(&target_attributes, target_lifetime);
 
-    psa_set_key_usage_flags( &target_attributes, target_usage );
-    psa_set_key_algorithm( &target_attributes, target_alg );
-    psa_set_key_enrollment_algorithm( &target_attributes, target_alg2_arg );
+    psa_set_key_usage_flags(&target_attributes, target_usage);
+    psa_set_key_algorithm(&target_attributes, target_alg);
+    psa_set_key_enrollment_algorithm(&target_attributes, target_alg2_arg);
 
     /* Copy the key. */
-    PSA_ASSERT( psa_copy_key( returned_source_id,
-                              &target_attributes, &returned_target_id ) );
+    PSA_ASSERT(psa_copy_key(returned_source_id,
+                            &target_attributes, &returned_target_id));
 
     /* Destroy the source to ensure that this doesn't affect the target. */
-    PSA_ASSERT( psa_destroy_key( returned_source_id ) );
+    PSA_ASSERT(psa_destroy_key(returned_source_id));
 
     /* If the target key is persistent, restart the system to make
      * sure that the material is still alive. */
-    if( ! PSA_KEY_LIFETIME_IS_VOLATILE( target_lifetime ) )
-    {
-        mbedtls_psa_crypto_free( );
-        PSA_ASSERT( psa_crypto_init( ) );
-        PSA_ASSERT( psa_open_key( target_id, &target_handle ) );
+    if (!PSA_KEY_LIFETIME_IS_VOLATILE(target_lifetime)) {
+        mbedtls_psa_crypto_free();
+        PSA_ASSERT(psa_crypto_init());
+        PSA_ASSERT(psa_open_key(target_id, &target_handle));
     }
 
     /* Test that the target slot has the expected content. */
-    psa_reset_key_attributes( &target_attributes );
-    PSA_ASSERT( psa_get_key_attributes( returned_target_id,
-                                        &target_attributes ) );
+    psa_reset_key_attributes(&target_attributes);
+    PSA_ASSERT(psa_get_key_attributes(returned_target_id,
+                                      &target_attributes));
 
-    if( ! PSA_KEY_LIFETIME_IS_VOLATILE( target_lifetime ) )
-    {
-        TEST_ASSERT( mbedtls_svc_key_id_equal(
-                         target_id, psa_get_key_id( &target_attributes ) ) );
-    }
-    else
-    {
+    if (!PSA_KEY_LIFETIME_IS_VOLATILE(target_lifetime)) {
+        TEST_ASSERT(mbedtls_svc_key_id_equal(
+                        target_id, psa_get_key_id(&target_attributes)));
+    } else {
 #if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
-        TEST_EQUAL( MBEDTLS_SVC_KEY_ID_GET_OWNER_ID( returned_target_id ),
-                    target_owner_id_arg );
+        TEST_EQUAL(MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(returned_target_id),
+                   target_owner_id_arg);
 #endif
     }
 
-    TEST_EQUAL( target_lifetime, psa_get_key_lifetime( &target_attributes ) );
-    TEST_EQUAL( source_type, psa_get_key_type( &target_attributes ) );
-    TEST_EQUAL( psa_get_key_bits( &source_attributes ),
-                psa_get_key_bits( &target_attributes ) );
-    TEST_EQUAL( expected_usage, psa_get_key_usage_flags( &target_attributes ) );
-    TEST_EQUAL( expected_alg, psa_get_key_algorithm( &target_attributes ) );
-    TEST_EQUAL( expected_alg2,
-                psa_get_key_enrollment_algorithm( &target_attributes ) );
-    if( expected_usage & PSA_KEY_USAGE_EXPORT )
-    {
+    TEST_EQUAL(target_lifetime, psa_get_key_lifetime(&target_attributes));
+    TEST_EQUAL(source_type, psa_get_key_type(&target_attributes));
+    TEST_EQUAL(psa_get_key_bits(&source_attributes),
+               psa_get_key_bits(&target_attributes));
+    TEST_EQUAL(expected_usage, psa_get_key_usage_flags(&target_attributes));
+    TEST_EQUAL(expected_alg, psa_get_key_algorithm(&target_attributes));
+    TEST_EQUAL(expected_alg2,
+               psa_get_key_enrollment_algorithm(&target_attributes));
+    if (expected_usage & PSA_KEY_USAGE_EXPORT) {
         size_t length;
-        ASSERT_ALLOC( export_buffer, material->len );
-        PSA_ASSERT( psa_export_key( returned_target_id, export_buffer,
-                                    material->len, &length ) );
-        ASSERT_COMPARE( material->x, material->len,
-                        export_buffer, length );
-    }
-    else
-    {
+        ASSERT_ALLOC(export_buffer, material->len);
+        PSA_ASSERT(psa_export_key(returned_target_id, export_buffer,
+                                  material->len, &length));
+        ASSERT_COMPARE(material->x, material->len,
+                       export_buffer, length);
+    } else {
         size_t length;
         /* Check that the key is actually non-exportable. */
-        TEST_EQUAL( psa_export_key( returned_target_id, export_buffer,
-                                    material->len, &length ),
-                    PSA_ERROR_NOT_PERMITTED );
+        TEST_EQUAL(psa_export_key(returned_target_id, export_buffer,
+                                  material->len, &length),
+                   PSA_ERROR_NOT_PERMITTED);
     }
 
-    PSA_ASSERT( psa_destroy_key( returned_target_id ) );
+    PSA_ASSERT(psa_destroy_key(returned_target_id));
 
 exit:
     /*
      * Source and target key attributes may have been returned by
      * psa_get_key_attributes() thus reset them as required.
      */
-    psa_reset_key_attributes( &source_attributes );
-    psa_reset_key_attributes( &target_attributes );
+    psa_reset_key_attributes(&source_attributes);
+    psa_reset_key_attributes(&target_attributes);
 
-    PSA_DONE( );
-    mbedtls_free( export_buffer );
+    PSA_DONE();
+    mbedtls_free(export_buffer);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void copy_to_occupied( int source_lifetime_arg, int source_id_arg,
-                       int source_usage_arg, int source_alg_arg,
-                       int source_type_arg, data_t *source_material,
-                       int target_lifetime_arg, int target_id_arg,
-                       int target_usage_arg, int target_alg_arg,
-                       int target_type_arg, data_t *target_material )
+void copy_to_occupied(int source_lifetime_arg, int source_id_arg,
+                      int source_usage_arg, int source_alg_arg,
+                      int source_type_arg, data_t *source_material,
+                      int target_lifetime_arg, int target_id_arg,
+                      int target_usage_arg, int target_alg_arg,
+                      int target_type_arg, data_t *target_material)
 {
     psa_key_lifetime_t source_lifetime = source_lifetime_arg;
     mbedtls_svc_key_id_t source_id =
-        mbedtls_svc_key_id_make( 1, source_id_arg );
+        mbedtls_svc_key_id_make(1, source_id_arg);
     psa_key_usage_t source_usage = source_usage_arg;
     psa_algorithm_t source_alg = source_alg_arg;
     psa_key_type_t source_type = source_type_arg;
     mbedtls_svc_key_id_t returned_source_id = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_lifetime_t target_lifetime = target_lifetime_arg;
     mbedtls_svc_key_id_t target_id =
-        mbedtls_svc_key_id_make( 1, target_id_arg );
+        mbedtls_svc_key_id_make(1, target_id_arg);
     psa_key_usage_t target_usage = target_usage_arg;
     psa_algorithm_t target_alg = target_alg_arg;
     psa_key_type_t target_type = target_type_arg;
@@ -642,96 +631,92 @@
     psa_key_attributes_t attributes1 = PSA_KEY_ATTRIBUTES_INIT;
     psa_key_attributes_t attributes2 = PSA_KEY_ATTRIBUTES_INIT;
 
-    TEST_USES_KEY_ID( source_id );
-    TEST_USES_KEY_ID( target_id );
+    TEST_USES_KEY_ID(source_id);
+    TEST_USES_KEY_ID(target_id);
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Populate the source slot. */
-    if( ! PSA_KEY_LIFETIME_IS_VOLATILE( source_lifetime ) )
-    {
-        psa_set_key_id( &attributes, source_id );
-        psa_set_key_lifetime( &attributes, source_lifetime );
+    if (!PSA_KEY_LIFETIME_IS_VOLATILE(source_lifetime)) {
+        psa_set_key_id(&attributes, source_id);
+        psa_set_key_lifetime(&attributes, source_lifetime);
     }
-    psa_set_key_type( &attributes, source_type );
-    psa_set_key_usage_flags( &attributes, source_usage );
-    psa_set_key_algorithm( &attributes, source_alg );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                source_material->x, source_material->len,
-                                &returned_source_id ) );
+    psa_set_key_type(&attributes, source_type);
+    psa_set_key_usage_flags(&attributes, source_usage);
+    psa_set_key_algorithm(&attributes, source_alg);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              source_material->x, source_material->len,
+                              &returned_source_id));
 
     /* Populate the target slot. */
-    if( mbedtls_svc_key_id_equal( target_id, source_id ) )
-    {
+    if (mbedtls_svc_key_id_equal(target_id, source_id)) {
         returned_target_id = returned_source_id;
-    }
-    else
-    {
-        psa_set_key_id( &attributes1, target_id );
-        psa_set_key_lifetime( &attributes1, target_lifetime );
-        psa_set_key_type( &attributes1, target_type );
-        psa_set_key_usage_flags( &attributes1, target_usage );
-        psa_set_key_algorithm( &attributes1, target_alg );
-        PSA_ASSERT( psa_import_key( &attributes1,
-                                    target_material->x, target_material->len,
-                                    &returned_target_id ) );
+    } else {
+        psa_set_key_id(&attributes1, target_id);
+        psa_set_key_lifetime(&attributes1, target_lifetime);
+        psa_set_key_type(&attributes1, target_type);
+        psa_set_key_usage_flags(&attributes1, target_usage);
+        psa_set_key_algorithm(&attributes1, target_alg);
+        PSA_ASSERT(psa_import_key(&attributes1,
+                                  target_material->x, target_material->len,
+                                  &returned_target_id));
     }
 
-    PSA_ASSERT( psa_get_key_attributes( returned_target_id, &attributes1 ) );
+    PSA_ASSERT(psa_get_key_attributes(returned_target_id, &attributes1));
 
     /* Make a copy attempt. */
-    psa_set_key_id( &attributes, target_id );
-    psa_set_key_lifetime( &attributes, target_lifetime );
-    TEST_EQUAL( psa_copy_key( returned_source_id,
-                              &attributes, &new_key ),
-                PSA_ERROR_ALREADY_EXISTS );
-    TEST_ASSERT( mbedtls_svc_key_id_is_null( new_key ) );
+    psa_set_key_id(&attributes, target_id);
+    psa_set_key_lifetime(&attributes, target_lifetime);
+    TEST_EQUAL(psa_copy_key(returned_source_id,
+                            &attributes, &new_key),
+               PSA_ERROR_ALREADY_EXISTS);
+    TEST_ASSERT(mbedtls_svc_key_id_is_null(new_key));
 
     /* Test that the target slot is unaffected. */
-    PSA_ASSERT( psa_get_key_attributes( returned_target_id, &attributes2 ) );
-    TEST_ASSERT( mbedtls_svc_key_id_equal(
-                     psa_get_key_id( &attributes1 ),
-                     psa_get_key_id( &attributes2 ) ) );
-    TEST_EQUAL( psa_get_key_lifetime( &attributes1 ),
-                psa_get_key_lifetime( &attributes2 ) );
-    TEST_EQUAL( psa_get_key_type( &attributes1 ),
-                psa_get_key_type( &attributes2 ) );
-    TEST_EQUAL( psa_get_key_bits( &attributes1 ),
-                psa_get_key_bits( &attributes2 ) );
-    TEST_EQUAL( psa_get_key_usage_flags( &attributes1 ),
-                psa_get_key_usage_flags( &attributes2 ) );
-    TEST_EQUAL( psa_get_key_algorithm( &attributes1 ),
-                psa_get_key_algorithm( &attributes2 ) );
-    if( target_usage & PSA_KEY_USAGE_EXPORT )
-    {
+    PSA_ASSERT(psa_get_key_attributes(returned_target_id, &attributes2));
+    TEST_ASSERT(mbedtls_svc_key_id_equal(
+                    psa_get_key_id(&attributes1),
+                    psa_get_key_id(&attributes2)));
+    TEST_EQUAL(psa_get_key_lifetime(&attributes1),
+               psa_get_key_lifetime(&attributes2));
+    TEST_EQUAL(psa_get_key_type(&attributes1),
+               psa_get_key_type(&attributes2));
+    TEST_EQUAL(psa_get_key_bits(&attributes1),
+               psa_get_key_bits(&attributes2));
+    TEST_EQUAL(psa_get_key_usage_flags(&attributes1),
+               psa_get_key_usage_flags(&attributes2));
+    TEST_EQUAL(psa_get_key_algorithm(&attributes1),
+               psa_get_key_algorithm(&attributes2));
+    if (target_usage & PSA_KEY_USAGE_EXPORT) {
         size_t length;
-        ASSERT_ALLOC( export_buffer, target_material->len );
-        PSA_ASSERT( psa_export_key( returned_target_id, export_buffer,
-                                    target_material->len, &length ) );
-        ASSERT_COMPARE( target_material->x, target_material->len,
-                        export_buffer, length );
+        ASSERT_ALLOC(export_buffer, target_material->len);
+        PSA_ASSERT(psa_export_key(returned_target_id, export_buffer,
+                                  target_material->len, &length));
+        ASSERT_COMPARE(target_material->x, target_material->len,
+                       export_buffer, length);
     }
 
-    PSA_ASSERT( psa_destroy_key( returned_source_id ) );
-    if( ! mbedtls_svc_key_id_equal( target_id, source_id ) )
-        PSA_ASSERT( psa_destroy_key( returned_target_id ) );
+    PSA_ASSERT(psa_destroy_key(returned_source_id));
+    if (!mbedtls_svc_key_id_equal(target_id, source_id)) {
+        PSA_ASSERT(psa_destroy_key(returned_target_id));
+    }
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes1 );
-    psa_reset_key_attributes( &attributes2 );
+    psa_reset_key_attributes(&attributes1);
+    psa_reset_key_attributes(&attributes2);
 
-    PSA_DONE( );
-    mbedtls_free( export_buffer );
+    PSA_DONE();
+    mbedtls_free(export_buffer);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void invalid_handle( int handle_construction,
-                     int close_status_arg )
+void invalid_handle(int handle_construction,
+                    int close_status_arg)
 {
     psa_key_handle_t valid_handle = PSA_KEY_HANDLE_INIT;
     psa_key_handle_t invalid_handle = PSA_KEY_HANDLE_INIT;
@@ -740,20 +725,19 @@
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     uint8_t material[1] = "a";
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
     /* Allocate a handle and store a key in it. */
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA );
-    psa_set_key_usage_flags( &attributes, 0 );
-    psa_set_key_algorithm( &attributes, 0 );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                material, sizeof( material ),
-                                &valid_handle ) );
-    TEST_ASSERT( ! psa_key_handle_is_null( valid_handle ) );
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
+    psa_set_key_usage_flags(&attributes, 0);
+    psa_set_key_algorithm(&attributes, 0);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              material, sizeof(material),
+                              &valid_handle));
+    TEST_ASSERT(!psa_key_handle_is_null(valid_handle));
 
     /* Construct an invalid handle as specified in the test case data. */
-    switch( handle_construction )
-    {
+    switch (handle_construction) {
         case INVALID_HANDLE_0:
             invalid_handle = PSA_KEY_HANDLE_INIT;
             break;
@@ -770,129 +754,129 @@
              * unopened and thus invalid identifier.
              */
 
-            if( MBEDTLS_SVC_KEY_ID_GET_KEY_ID( valid_handle ) ==
-                PSA_KEY_ID_VOLATILE_MIN )
+            if (MBEDTLS_SVC_KEY_ID_GET_KEY_ID(valid_handle) ==
+                PSA_KEY_ID_VOLATILE_MIN) {
                 key_id = PSA_KEY_ID_VOLATILE_MIN + 1;
-            else
-                key_id = MBEDTLS_SVC_KEY_ID_GET_KEY_ID( valid_handle ) - 1;
+            } else {
+                key_id = MBEDTLS_SVC_KEY_ID_GET_KEY_ID(valid_handle) - 1;
+            }
 
             invalid_handle =
-                mbedtls_svc_key_id_make( 0, key_id );
+                mbedtls_svc_key_id_make(0, key_id);
             break;
         case INVALID_HANDLE_CLOSED:
-            PSA_ASSERT( psa_import_key( &attributes,
-                                        material, sizeof( material ),
-                                        &invalid_handle ) );
-            PSA_ASSERT( psa_destroy_key( invalid_handle ) );
+            PSA_ASSERT(psa_import_key(&attributes,
+                                      material, sizeof(material),
+                                      &invalid_handle));
+            PSA_ASSERT(psa_destroy_key(invalid_handle));
             break;
         case INVALID_HANDLE_HUGE:
             invalid_handle =
-                mbedtls_svc_key_id_make( 0, PSA_KEY_ID_VENDOR_MAX + 1 );
+                mbedtls_svc_key_id_make(0, PSA_KEY_ID_VENDOR_MAX + 1);
             break;
         default:
-            TEST_ASSERT( ! "unknown handle construction" );
+            TEST_ASSERT(!"unknown handle construction");
     }
 
     /* Attempt to use the invalid handle. */
-    TEST_EQUAL( psa_get_key_attributes( invalid_handle, &attributes ),
-                PSA_ERROR_INVALID_HANDLE );
-    TEST_EQUAL( psa_close_key( invalid_handle ), close_status );
-    TEST_EQUAL( psa_destroy_key( invalid_handle ), close_status );
+    TEST_EQUAL(psa_get_key_attributes(invalid_handle, &attributes),
+               PSA_ERROR_INVALID_HANDLE);
+    TEST_EQUAL(psa_close_key(invalid_handle), close_status);
+    TEST_EQUAL(psa_destroy_key(invalid_handle), close_status);
 
     /* After all this, check that the original handle is intact. */
-    PSA_ASSERT( psa_get_key_attributes( valid_handle, &attributes ) );
-    TEST_EQUAL( psa_get_key_type( &attributes ), PSA_KEY_TYPE_RAW_DATA );
-    TEST_EQUAL( psa_get_key_bits( &attributes ),
-                PSA_BYTES_TO_BITS( sizeof( material ) ) );
-    PSA_ASSERT( psa_close_key( valid_handle ) );
+    PSA_ASSERT(psa_get_key_attributes(valid_handle, &attributes));
+    TEST_EQUAL(psa_get_key_type(&attributes), PSA_KEY_TYPE_RAW_DATA);
+    TEST_EQUAL(psa_get_key_bits(&attributes),
+               PSA_BYTES_TO_BITS(sizeof(material)));
+    PSA_ASSERT(psa_close_key(valid_handle));
 
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void many_transient_keys( int max_keys_arg )
+void many_transient_keys(int max_keys_arg)
 {
     mbedtls_svc_key_id_t *keys = NULL;
     size_t max_keys = max_keys_arg;
     size_t i, j;
     psa_status_t status;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    uint8_t exported[sizeof( size_t )];
+    uint8_t exported[sizeof(size_t)];
     size_t exported_length;
 
-    ASSERT_ALLOC( keys, max_keys );
-    PSA_ASSERT( psa_crypto_init( ) );
+    ASSERT_ALLOC(keys, max_keys);
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
-    psa_set_key_algorithm( &attributes, 0 );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
+    psa_set_key_algorithm(&attributes, 0);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
 
-    for( i = 0; i < max_keys; i++ )
-    {
-        status = psa_import_key( &attributes,
-                                 (uint8_t *) &i, sizeof( i ),
-                                 &keys[i] );
-        if( status == PSA_ERROR_INSUFFICIENT_MEMORY )
+    for (i = 0; i < max_keys; i++) {
+        status = psa_import_key(&attributes,
+                                (uint8_t *) &i, sizeof(i),
+                                &keys[i]);
+        if (status == PSA_ERROR_INSUFFICIENT_MEMORY) {
             break;
-        PSA_ASSERT( status );
-        TEST_ASSERT( ! mbedtls_svc_key_id_is_null( keys[i] ) );
-        for( j = 0; j < i; j++ )
-            TEST_ASSERT( ! mbedtls_svc_key_id_equal( keys[i], keys[j] ) );
+        }
+        PSA_ASSERT(status);
+        TEST_ASSERT(!mbedtls_svc_key_id_is_null(keys[i]));
+        for (j = 0; j < i; j++) {
+            TEST_ASSERT(!mbedtls_svc_key_id_equal(keys[i], keys[j]));
+        }
     }
     max_keys = i;
 
-    for( i = 1; i < max_keys; i++ )
-    {
-        PSA_ASSERT( psa_close_key( keys[i - 1] ) );
-        PSA_ASSERT( psa_export_key( keys[i],
-                                    exported, sizeof( exported ),
-                                    &exported_length ) );
-        ASSERT_COMPARE( exported, exported_length,
-                        (uint8_t *) &i, sizeof( i ) );
+    for (i = 1; i < max_keys; i++) {
+        PSA_ASSERT(psa_close_key(keys[i - 1]));
+        PSA_ASSERT(psa_export_key(keys[i],
+                                  exported, sizeof(exported),
+                                  &exported_length));
+        ASSERT_COMPARE(exported, exported_length,
+                       (uint8_t *) &i, sizeof(i));
     }
-    PSA_ASSERT( psa_close_key( keys[i - 1] ) );
+    PSA_ASSERT(psa_close_key(keys[i - 1]));
 
 exit:
-    PSA_DONE( );
-    mbedtls_free( keys );
+    PSA_DONE();
+    mbedtls_free(keys);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_STORAGE_C */
-void key_slot_eviction_to_import_new_key( int lifetime_arg )
+void key_slot_eviction_to_import_new_key(int lifetime_arg)
 {
-    psa_key_lifetime_t lifetime = (psa_key_lifetime_t)lifetime_arg;
+    psa_key_lifetime_t lifetime = (psa_key_lifetime_t) lifetime_arg;
     size_t i;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    uint8_t exported[sizeof( size_t )];
+    uint8_t exported[sizeof(size_t)];
     size_t exported_length;
     mbedtls_svc_key_id_t key, returned_key_id;
 
-    PSA_ASSERT( psa_crypto_init( ) );
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
-    psa_set_key_algorithm( &attributes, 0 );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA );
+    psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_EXPORT);
+    psa_set_key_algorithm(&attributes, 0);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
 
     /*
      * Create MBEDTLS_PSA_KEY_SLOT_COUNT persistent keys.
      */
-    for( i = 0; i < MBEDTLS_PSA_KEY_SLOT_COUNT; i++ )
-    {
-        key = mbedtls_svc_key_id_make( i, i + 1 );
-        psa_set_key_id( &attributes, key );
-        PSA_ASSERT( psa_import_key( &attributes,
-                                    (uint8_t *) &i, sizeof( i ),
-                                    &returned_key_id ) );
-       TEST_ASSERT( mbedtls_svc_key_id_equal( returned_key_id, key ) );
+    for (i = 0; i < MBEDTLS_PSA_KEY_SLOT_COUNT; i++) {
+        key = mbedtls_svc_key_id_make(i, i + 1);
+        psa_set_key_id(&attributes, key);
+        PSA_ASSERT(psa_import_key(&attributes,
+                                  (uint8_t *) &i, sizeof(i),
+                                  &returned_key_id));
+        TEST_ASSERT(mbedtls_svc_key_id_equal(returned_key_id, key));
     }
 
     /*
@@ -902,18 +886,19 @@
      * description in RAM.
      */
     i = MBEDTLS_PSA_KEY_SLOT_COUNT;
-    key = mbedtls_svc_key_id_make( i, i + 1 );
-    psa_set_key_id( &attributes, key );
-    psa_set_key_lifetime( &attributes, lifetime );
+    key = mbedtls_svc_key_id_make(i, i + 1);
+    psa_set_key_id(&attributes, key);
+    psa_set_key_lifetime(&attributes, lifetime);
 
-    PSA_ASSERT( psa_import_key( &attributes,
-                                (uint8_t *) &i, sizeof( i ),
-                                &returned_key_id ) );
-    if( lifetime != PSA_KEY_LIFETIME_VOLATILE )
-        TEST_ASSERT( mbedtls_svc_key_id_equal( returned_key_id, key ) );
-    else
-        TEST_ASSERT( psa_key_id_is_volatile(
-                     MBEDTLS_SVC_KEY_ID_GET_KEY_ID( returned_key_id ) ) );
+    PSA_ASSERT(psa_import_key(&attributes,
+                              (uint8_t *) &i, sizeof(i),
+                              &returned_key_id));
+    if (lifetime != PSA_KEY_LIFETIME_VOLATILE) {
+        TEST_ASSERT(mbedtls_svc_key_id_equal(returned_key_id, key));
+    } else {
+        TEST_ASSERT(psa_key_id_is_volatile(
+                        MBEDTLS_SVC_KEY_ID_GET_KEY_ID(returned_key_id)));
+    }
 
     /*
      * Check that we can export all ( MBEDTLS_PSA_KEY_SLOT_COUNT + 1 ) keys,
@@ -922,120 +907,118 @@
      * slots when creating the last key is restored in a RAM slot to export
      * its value.
      */
-    for( i = 0; i <= MBEDTLS_PSA_KEY_SLOT_COUNT; i++ )
-    {
-        if( i < MBEDTLS_PSA_KEY_SLOT_COUNT )
-            key = mbedtls_svc_key_id_make( i, i + 1 );
-        else
+    for (i = 0; i <= MBEDTLS_PSA_KEY_SLOT_COUNT; i++) {
+        if (i < MBEDTLS_PSA_KEY_SLOT_COUNT) {
+            key = mbedtls_svc_key_id_make(i, i + 1);
+        } else {
             key = returned_key_id;
+        }
 
-        PSA_ASSERT( psa_export_key( key,
-                                    exported, sizeof( exported ),
-                                    &exported_length ) );
-        ASSERT_COMPARE( exported, exported_length,
-                        (uint8_t *) &i, sizeof( i ) );
-        PSA_ASSERT( psa_destroy_key( key ) );
+        PSA_ASSERT(psa_export_key(key,
+                                  exported, sizeof(exported),
+                                  &exported_length));
+        ASSERT_COMPARE(exported, exported_length,
+                       (uint8_t *) &i, sizeof(i));
+        PSA_ASSERT(psa_destroy_key(key));
     }
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_STORAGE_C */
-void non_reusable_key_slots_integrity_in_case_of_key_slot_starvation( )
+void non_reusable_key_slots_integrity_in_case_of_key_slot_starvation()
 {
     psa_status_t status;
     size_t i;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-    uint8_t exported[sizeof( size_t )];
+    uint8_t exported[sizeof(size_t)];
     size_t exported_length;
     mbedtls_svc_key_id_t persistent_key = MBEDTLS_SVC_KEY_ID_INIT;
     mbedtls_svc_key_id_t persistent_key2 = MBEDTLS_SVC_KEY_ID_INIT;
     mbedtls_svc_key_id_t returned_key_id = MBEDTLS_SVC_KEY_ID_INIT;
     mbedtls_svc_key_id_t *keys = NULL;
 
-    TEST_ASSERT( MBEDTLS_PSA_KEY_SLOT_COUNT >= 1 );
+    TEST_ASSERT(MBEDTLS_PSA_KEY_SLOT_COUNT >= 1);
 
-    ASSERT_ALLOC( keys, MBEDTLS_PSA_KEY_SLOT_COUNT );
-    PSA_ASSERT( psa_crypto_init( ) );
+    ASSERT_ALLOC(keys, MBEDTLS_PSA_KEY_SLOT_COUNT);
+    PSA_ASSERT(psa_crypto_init());
 
-    psa_set_key_usage_flags( &attributes,
-                             PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_COPY );
-    psa_set_key_algorithm( &attributes, 0 );
-    psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA );
+    psa_set_key_usage_flags(&attributes,
+                            PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_COPY);
+    psa_set_key_algorithm(&attributes, 0);
+    psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
 
     /*
      * Create a persistent key
      */
-    persistent_key = mbedtls_svc_key_id_make( 0x100, 0x205 );
-    psa_set_key_id( &attributes, persistent_key );
-    PSA_ASSERT( psa_import_key( &attributes,
-                                (uint8_t *) &persistent_key,
-                                sizeof( persistent_key ),
-                                &returned_key_id ) );
-    TEST_ASSERT( mbedtls_svc_key_id_equal( returned_key_id, persistent_key ) );
+    persistent_key = mbedtls_svc_key_id_make(0x100, 0x205);
+    psa_set_key_id(&attributes, persistent_key);
+    PSA_ASSERT(psa_import_key(&attributes,
+                              (uint8_t *) &persistent_key,
+                              sizeof(persistent_key),
+                              &returned_key_id));
+    TEST_ASSERT(mbedtls_svc_key_id_equal(returned_key_id, persistent_key));
 
     /*
      * Create MBEDTLS_PSA_KEY_SLOT_COUNT volatile keys
      */
-    psa_set_key_lifetime( &attributes, PSA_KEY_LIFETIME_VOLATILE );
-    for( i = 0; i < MBEDTLS_PSA_KEY_SLOT_COUNT; i++ )
-    {
-        PSA_ASSERT( psa_import_key( &attributes,
-                                    (uint8_t *) &i, sizeof( i ),
-                                    &keys[i]) );
+    psa_set_key_lifetime(&attributes, PSA_KEY_LIFETIME_VOLATILE);
+    for (i = 0; i < MBEDTLS_PSA_KEY_SLOT_COUNT; i++) {
+        PSA_ASSERT(psa_import_key(&attributes,
+                                  (uint8_t *) &i, sizeof(i),
+                                  &keys[i]));
     }
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
     /*
      * Check that we cannot access the persistent key as all slots are
      * occupied by volatile keys and the implementation needs to load the
      * persistent key description in a slot to be able to access it.
      */
-    status = psa_get_key_attributes( persistent_key, &attributes );
-    TEST_EQUAL( status, PSA_ERROR_INSUFFICIENT_MEMORY );
+    status = psa_get_key_attributes(persistent_key, &attributes);
+    TEST_EQUAL(status, PSA_ERROR_INSUFFICIENT_MEMORY);
 
     /*
      * Check we can export the volatile key created last and that it has the
      * expected value. Then, destroy it.
      */
-    PSA_ASSERT( psa_export_key( keys[MBEDTLS_PSA_KEY_SLOT_COUNT - 1],
-                                exported, sizeof( exported ),
-                                &exported_length ) );
+    PSA_ASSERT(psa_export_key(keys[MBEDTLS_PSA_KEY_SLOT_COUNT - 1],
+                              exported, sizeof(exported),
+                              &exported_length));
     i = MBEDTLS_PSA_KEY_SLOT_COUNT - 1;
-    ASSERT_COMPARE( exported, exported_length, (uint8_t *) &i, sizeof( i ) );
-    PSA_ASSERT( psa_destroy_key( keys[MBEDTLS_PSA_KEY_SLOT_COUNT - 1] ) );
+    ASSERT_COMPARE(exported, exported_length, (uint8_t *) &i, sizeof(i));
+    PSA_ASSERT(psa_destroy_key(keys[MBEDTLS_PSA_KEY_SLOT_COUNT - 1]));
 
     /*
      * Check that we can now access the persistent key again.
      */
-    PSA_ASSERT( psa_get_key_attributes( persistent_key, &attributes ) );
-    TEST_ASSERT( mbedtls_svc_key_id_equal( attributes.core.id,
-                                           persistent_key ) );
+    PSA_ASSERT(psa_get_key_attributes(persistent_key, &attributes));
+    TEST_ASSERT(mbedtls_svc_key_id_equal(attributes.core.id,
+                                         persistent_key));
 
     /*
      * Check that we cannot copy the persistent key as all slots are occupied
      * by the persistent key and the volatile keys and the slot containing the
      * persistent key cannot be reclaimed as it contains the key to copy.
      */
-    persistent_key2 = mbedtls_svc_key_id_make( 0x100, 0x204 );
-    psa_set_key_id( &attributes, persistent_key2 );
-    status = psa_copy_key( persistent_key, &attributes, &returned_key_id );
-    TEST_EQUAL( status, PSA_ERROR_INSUFFICIENT_MEMORY );
+    persistent_key2 = mbedtls_svc_key_id_make(0x100, 0x204);
+    psa_set_key_id(&attributes, persistent_key2);
+    status = psa_copy_key(persistent_key, &attributes, &returned_key_id);
+    TEST_EQUAL(status, PSA_ERROR_INSUFFICIENT_MEMORY);
 
     /*
      * Check we can export the remaining volatile keys and that they have the
      * expected values.
      */
-    for( i = 0; i < ( MBEDTLS_PSA_KEY_SLOT_COUNT - 1 ); i++ )
-    {
-        PSA_ASSERT( psa_export_key( keys[i],
-                                    exported, sizeof( exported ),
-                                    &exported_length ) );
-        ASSERT_COMPARE( exported, exported_length,
-                        (uint8_t *) &i, sizeof( i ) );
-        PSA_ASSERT( psa_destroy_key( keys[i] ) );
+    for (i = 0; i < (MBEDTLS_PSA_KEY_SLOT_COUNT - 1); i++) {
+        PSA_ASSERT(psa_export_key(keys[i],
+                                  exported, sizeof(exported),
+                                  &exported_length));
+        ASSERT_COMPARE(exported, exported_length,
+                       (uint8_t *) &i, sizeof(i));
+        PSA_ASSERT(psa_destroy_key(keys[i]));
     }
 
     /*
@@ -1043,19 +1026,19 @@
      * value.
      */
 
-    PSA_ASSERT( psa_export_key( persistent_key, exported, sizeof( exported ),
-                                &exported_length ) );
-    ASSERT_COMPARE( exported, exported_length,
-                    (uint8_t *) &persistent_key, sizeof( persistent_key ) );
+    PSA_ASSERT(psa_export_key(persistent_key, exported, sizeof(exported),
+                              &exported_length));
+    ASSERT_COMPARE(exported, exported_length,
+                   (uint8_t *) &persistent_key, sizeof(persistent_key));
 exit:
     /*
      * Key attributes may have been returned by psa_get_key_attributes()
      * thus reset them as required.
      */
-    psa_reset_key_attributes( &attributes );
+    psa_reset_key_attributes(&attributes);
 
-    psa_destroy_key( persistent_key );
-    PSA_DONE( );
-    mbedtls_free( keys );
+    psa_destroy_key(persistent_key);
+    PSA_DONE();
+    mbedtls_free(keys);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_crypto_storage_format.function b/tests/suites/test_suite_psa_crypto_storage_format.function
index 7f0a00e..ee66f7d 100644
--- a/tests/suites/test_suite_psa_crypto_storage_format.function
+++ b/tests/suites/test_suite_psa_crypto_storage_format.function
@@ -16,10 +16,10 @@
  * On error, including if the key representation in storage differs,
  * mark the test case as failed and return 0. On success, return 1.
  */
-static int test_written_key( const psa_key_attributes_t *attributes,
-                             const data_t *material,
-                             psa_storage_uid_t uid,
-                             const data_t *expected_representation )
+static int test_written_key(const psa_key_attributes_t *attributes,
+                            const data_t *material,
+                            psa_storage_uid_t uid,
+                            const data_t *expected_representation)
 {
     mbedtls_svc_key_id_t created_key_id = MBEDTLS_SVC_KEY_ID_INIT;
     uint8_t *actual_representation = NULL;
@@ -28,136 +28,153 @@
     int ok = 0;
 
     /* Create a key with the given parameters. */
-    PSA_ASSERT( psa_import_key( attributes, material->x, material->len,
-                                &created_key_id ) );
-    TEST_ASSERT( mbedtls_svc_key_id_equal( psa_get_key_id( attributes ),
-                                           created_key_id ) );
+    PSA_ASSERT(psa_import_key(attributes, material->x, material->len,
+                              &created_key_id));
+    TEST_ASSERT(mbedtls_svc_key_id_equal(psa_get_key_id(attributes),
+                                         created_key_id));
 
     /* Check that the key is represented as expected. */
-    PSA_ASSERT( psa_its_get_info( uid, &storage_info ) );
-    TEST_EQUAL( storage_info.size, expected_representation->len );
-    ASSERT_ALLOC( actual_representation, storage_info.size );
-    PSA_ASSERT( psa_its_get( uid, 0, storage_info.size,
-                             actual_representation, &length ) );
-    ASSERT_COMPARE( expected_representation->x, expected_representation->len,
-                    actual_representation, length );
+    PSA_ASSERT(psa_its_get_info(uid, &storage_info));
+    TEST_EQUAL(storage_info.size, expected_representation->len);
+    ASSERT_ALLOC(actual_representation, storage_info.size);
+    PSA_ASSERT(psa_its_get(uid, 0, storage_info.size,
+                           actual_representation, &length));
+    ASSERT_COMPARE(expected_representation->x, expected_representation->len,
+                   actual_representation, length);
 
     ok = 1;
 
 exit:
-    mbedtls_free( actual_representation );
-    return( ok );
+    mbedtls_free(actual_representation);
+    return ok;
 }
 
 /** Check if a key is exportable. */
-static int can_export( const psa_key_attributes_t *attributes )
+static int can_export(const psa_key_attributes_t *attributes)
 {
-    if( psa_get_key_usage_flags( attributes ) & PSA_KEY_USAGE_EXPORT )
-        return( 1 );
-    else if( PSA_KEY_TYPE_IS_PUBLIC_KEY( psa_get_key_type( attributes ) ) )
-        return( 1 );
-    else
-        return( 0 );
+    if (psa_get_key_usage_flags(attributes) & PSA_KEY_USAGE_EXPORT) {
+        return 1;
+    } else if (PSA_KEY_TYPE_IS_PUBLIC_KEY(psa_get_key_type(attributes))) {
+        return 1;
+    } else {
+        return 0;
+    }
 }
 
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1)
-static int is_accelerated_rsa( psa_algorithm_t alg )
+static int is_accelerated_rsa(psa_algorithm_t alg)
 {
 #if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN)
-    if ( PSA_ALG_IS_RSA_PKCS1V15_SIGN( alg ) )
-        return( 1 );
+    if (PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg)) {
+        return 1;
+    }
 #endif
 #if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS)
-    if( PSA_ALG_IS_RSA_PSS( alg ) )
-        return( 1 );
+    if (PSA_ALG_IS_RSA_PSS(alg)) {
+        return 1;
+    }
 #endif
 #if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP)
-    if( PSA_ALG_IS_RSA_OAEP( alg ) )
-        return( 1 );
+    if (PSA_ALG_IS_RSA_OAEP(alg)) {
+        return 1;
+    }
 #endif
     (void) alg;
-    return( 0 );
+    return 0;
 }
 
 /* Whether the algorithm is implemented as a builtin, i.e. not accelerated,
  * and calls mbedtls_md() functions that require the hash algorithm to
  * also be built-in. */
-static int is_builtin_calling_md( psa_algorithm_t alg )
+static int is_builtin_calling_md(psa_algorithm_t alg)
 {
 #if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_SIGN)
-    if( PSA_ALG_IS_RSA_PKCS1V15_SIGN( alg ) )
-        return( 1 );
+    if (PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg)) {
+        return 1;
+    }
 #endif
 #if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PSS)
-    if( PSA_ALG_IS_RSA_PSS( alg ) )
-        return( 1 );
+    if (PSA_ALG_IS_RSA_PSS(alg)) {
+        return 1;
+    }
 #endif
 #if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP)
-    if( PSA_ALG_IS_RSA_OAEP( alg ) )
-        return( 1 );
+    if (PSA_ALG_IS_RSA_OAEP(alg)) {
+        return 1;
+    }
 #endif
 #if defined(MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA)
-    if( PSA_ALG_IS_DETERMINISTIC_ECDSA( alg ) )
-        return( 1 );
+    if (PSA_ALG_IS_DETERMINISTIC_ECDSA(alg)) {
+        return 1;
+    }
 #endif
     (void) alg;
-    return( 0 );
+    return 0;
 }
 
-static int has_builtin_hash( psa_algorithm_t alg )
+static int has_builtin_hash(psa_algorithm_t alg)
 {
 #if !defined(MBEDTLS_MD2_C)
-    if( alg == PSA_ALG_MD2 )
-        return( 0 );
+    if (alg == PSA_ALG_MD2) {
+        return 0;
+    }
 #endif
 #if !defined(MBEDTLS_MD4_C)
-    if( alg == PSA_ALG_MD4 )
-        return( 0 );
+    if (alg == PSA_ALG_MD4) {
+        return 0;
+    }
 #endif
 #if !defined(MBEDTLS_MD5_C)
-    if( alg == PSA_ALG_MD5 )
-        return( 0 );
+    if (alg == PSA_ALG_MD5) {
+        return 0;
+    }
 #endif
 #if !defined(MBEDTLS_RIPEMD160_C)
-    if( alg == PSA_ALG_RIPEMD160 )
-        return( 0 );
+    if (alg == PSA_ALG_RIPEMD160) {
+        return 0;
+    }
 #endif
 #if !defined(MBEDTLS_SHA1_C)
-    if( alg == PSA_ALG_SHA_1 )
-        return( 0 );
+    if (alg == PSA_ALG_SHA_1) {
+        return 0;
+    }
 #endif
 #if !defined(MBEDTLS_SHA224_C)
-    if( alg == PSA_ALG_SHA_224 )
-        return( 0 );
+    if (alg == PSA_ALG_SHA_224) {
+        return 0;
+    }
 #endif
 #if !defined(MBEDTLS_SHA256_C)
-    if( alg == PSA_ALG_SHA_256 )
-        return( 0 );
+    if (alg == PSA_ALG_SHA_256) {
+        return 0;
+    }
 #endif
 #if !defined(MBEDTLS_SHA384_C)
-    if( alg == PSA_ALG_SHA_384 )
-        return( 0 );
+    if (alg == PSA_ALG_SHA_384) {
+        return 0;
+    }
 #endif
 #if !defined(MBEDTLS_SHA512_C)
-    if( alg == PSA_ALG_SHA_512 )
-        return( 0 );
+    if (alg == PSA_ALG_SHA_512) {
+        return 0;
+    }
 #endif
     (void) alg;
-    return( 1 );
+    return 1;
 }
 #endif
 
 /* Mbed TLS doesn't support certain combinations of key type and algorithm
  * in certain configurations. */
-static int can_exercise( const psa_key_attributes_t *attributes )
+static int can_exercise(const psa_key_attributes_t *attributes)
 {
-    psa_key_type_t key_type = psa_get_key_type( attributes );
-    psa_algorithm_t alg = psa_get_key_algorithm( attributes );
+    psa_key_type_t key_type = psa_get_key_type(attributes);
+    psa_algorithm_t alg = psa_get_key_algorithm(attributes);
     psa_algorithm_t hash_alg =
-        PSA_ALG_IS_HASH_AND_SIGN( alg ) ? PSA_ALG_SIGN_GET_HASH( alg ) :
-        PSA_ALG_IS_RSA_OAEP( alg ) ? PSA_ALG_RSA_OAEP_GET_HASH( alg ) :
+        PSA_ALG_IS_HASH_AND_SIGN(alg) ? PSA_ALG_SIGN_GET_HASH(alg) :
+        PSA_ALG_IS_RSA_OAEP(alg) ? PSA_ALG_RSA_OAEP_GET_HASH(alg) :
         PSA_ALG_NONE;
-    psa_key_usage_t usage = psa_get_key_usage_flags( attributes );
+    psa_key_usage_t usage = psa_get_key_usage_flags(attributes);
 
 #if defined(MBEDTLS_TEST_LIBTESTDRIVER1)
     /* We test some configurations using drivers where the driver doesn't
@@ -171,32 +188,28 @@
      * affected. All RSA signatures are affected except raw PKCS#1v1.5.
      * OAEP is also affected.
      */
-    if( PSA_ALG_IS_DETERMINISTIC_ECDSA( alg ) &&
-        ! ( usage & ( PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_SIGN_MESSAGE ) ) )
-    {
+    if (PSA_ALG_IS_DETERMINISTIC_ECDSA(alg) &&
+        !(usage & (PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_SIGN_MESSAGE))) {
         /* Verification only. Verification doesn't use the hash algorithm. */
-        return( 1 );
+        return 1;
     }
 
 #if defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
-    if( PSA_ALG_IS_DETERMINISTIC_ECDSA( alg ) &&
-        ( hash_alg == PSA_ALG_MD5 ||
-          hash_alg == PSA_ALG_RIPEMD160 ||
-          hash_alg == PSA_ALG_SHA_1 ) )
-    {
-        return( 0 );
+    if (PSA_ALG_IS_DETERMINISTIC_ECDSA(alg) &&
+        (hash_alg == PSA_ALG_MD5 ||
+         hash_alg == PSA_ALG_RIPEMD160 ||
+         hash_alg == PSA_ALG_SHA_1)) {
+        return 0;
     }
 #endif
-    if( is_accelerated_rsa( alg ) &&
-        ( hash_alg == PSA_ALG_RIPEMD160 || hash_alg == PSA_ALG_SHA_384 ) )
-    {
-            return( 0 );
+    if (is_accelerated_rsa(alg) &&
+        (hash_alg == PSA_ALG_RIPEMD160 || hash_alg == PSA_ALG_SHA_384)) {
+        return 0;
     }
 #if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP)
-    if( PSA_ALG_IS_RSA_OAEP( alg ) &&
-        ( hash_alg == PSA_ALG_RIPEMD160 || hash_alg == PSA_ALG_SHA_384 ) )
-    {
-        return( 0 );
+    if (PSA_ALG_IS_RSA_OAEP(alg) &&
+        (hash_alg == PSA_ALG_RIPEMD160 || hash_alg == PSA_ALG_SHA_384)) {
+        return 0;
     }
 #endif
 
@@ -204,9 +217,8 @@
      * hash internally only dispatch to the internal md module, not to
      * PSA. Until this is supported, don't try to actually perform
      * operations when the operation is built-in and the hash isn't.  */
-    if( is_builtin_calling_md( alg ) && ! has_builtin_hash( hash_alg ) )
-    {
-        return( 0 );
+    if (is_builtin_calling_md(alg) && !has_builtin_hash(hash_alg)) {
+        return 0;
     }
 #endif /* MBEDTLS_TEST_LIBTESTDRIVER1 */
 
@@ -214,7 +226,7 @@
     (void) alg;
     (void) hash_alg;
     (void) usage;
-    return( 1 );
+    return 1;
 }
 
 /** Write a key with the given representation to storage, then check
@@ -223,78 +235,73 @@
  * On error, including if the key representation in storage differs,
  * mark the test case as failed and return 0. On success, return 1.
  */
-static int test_read_key( const psa_key_attributes_t *expected_attributes,
-                          const data_t *expected_material,
-                          psa_storage_uid_t uid,
-                          const data_t *representation,
-                          int flags )
+static int test_read_key(const psa_key_attributes_t *expected_attributes,
+                         const data_t *expected_material,
+                         psa_storage_uid_t uid,
+                         const data_t *representation,
+                         int flags)
 {
     psa_key_attributes_t actual_attributes = PSA_KEY_ATTRIBUTES_INIT;
-    mbedtls_svc_key_id_t key_id = psa_get_key_id( expected_attributes );
+    mbedtls_svc_key_id_t key_id = psa_get_key_id(expected_attributes);
     struct psa_storage_info_t storage_info;
     int ok = 0;
     uint8_t *exported_material = NULL;
     size_t length;
 
     /* Prime the storage with a key file. */
-    PSA_ASSERT( psa_its_set( uid, representation->len, representation->x, 0 ) );
+    PSA_ASSERT(psa_its_set(uid, representation->len, representation->x, 0));
 
     /* Check that the injected key exists and looks as expected. */
-    PSA_ASSERT( psa_get_key_attributes( key_id, &actual_attributes ) );
-    TEST_ASSERT( mbedtls_svc_key_id_equal( key_id,
-                                           psa_get_key_id( &actual_attributes ) ) );
-    TEST_EQUAL( psa_get_key_lifetime( expected_attributes ),
-                psa_get_key_lifetime( &actual_attributes ) );
-    TEST_EQUAL( psa_get_key_type( expected_attributes ),
-                psa_get_key_type( &actual_attributes ) );
-    TEST_EQUAL( psa_get_key_bits( expected_attributes ),
-                psa_get_key_bits( &actual_attributes ) );
-    TEST_EQUAL( psa_get_key_usage_flags( expected_attributes ),
-                psa_get_key_usage_flags( &actual_attributes ) );
-    TEST_EQUAL( psa_get_key_algorithm( expected_attributes ),
-                psa_get_key_algorithm( &actual_attributes ) );
-    TEST_EQUAL( psa_get_key_enrollment_algorithm( expected_attributes ),
-                psa_get_key_enrollment_algorithm( &actual_attributes ) );
-    if( can_export( expected_attributes ) )
-    {
-        ASSERT_ALLOC( exported_material, expected_material->len );
-        PSA_ASSERT( psa_export_key( key_id,
-                                    exported_material, expected_material->len,
-                                    &length ) );
-        ASSERT_COMPARE( expected_material->x, expected_material->len,
-                        exported_material, length );
+    PSA_ASSERT(psa_get_key_attributes(key_id, &actual_attributes));
+    TEST_ASSERT(mbedtls_svc_key_id_equal(key_id,
+                                         psa_get_key_id(&actual_attributes)));
+    TEST_EQUAL(psa_get_key_lifetime(expected_attributes),
+               psa_get_key_lifetime(&actual_attributes));
+    TEST_EQUAL(psa_get_key_type(expected_attributes),
+               psa_get_key_type(&actual_attributes));
+    TEST_EQUAL(psa_get_key_bits(expected_attributes),
+               psa_get_key_bits(&actual_attributes));
+    TEST_EQUAL(psa_get_key_usage_flags(expected_attributes),
+               psa_get_key_usage_flags(&actual_attributes));
+    TEST_EQUAL(psa_get_key_algorithm(expected_attributes),
+               psa_get_key_algorithm(&actual_attributes));
+    TEST_EQUAL(psa_get_key_enrollment_algorithm(expected_attributes),
+               psa_get_key_enrollment_algorithm(&actual_attributes));
+    if (can_export(expected_attributes)) {
+        ASSERT_ALLOC(exported_material, expected_material->len);
+        PSA_ASSERT(psa_export_key(key_id,
+                                  exported_material, expected_material->len,
+                                  &length));
+        ASSERT_COMPARE(expected_material->x, expected_material->len,
+                       exported_material, length);
     }
 
-    if( ( flags & TEST_FLAG_EXERCISE ) && can_exercise( &actual_attributes ) )
-    {
-        TEST_ASSERT( mbedtls_test_psa_exercise_key(
-                         key_id,
-                         psa_get_key_usage_flags( expected_attributes ),
-                         psa_get_key_algorithm( expected_attributes ) ) );
+    if ((flags & TEST_FLAG_EXERCISE) && can_exercise(&actual_attributes)) {
+        TEST_ASSERT(mbedtls_test_psa_exercise_key(
+                        key_id,
+                        psa_get_key_usage_flags(expected_attributes),
+                        psa_get_key_algorithm(expected_attributes)));
     }
 
 
-    if( flags & TEST_FLAG_READ_ONLY )
-    {
+    if (flags & TEST_FLAG_READ_ONLY) {
         /* Read-only keys cannot be removed through the API.
          * The key will be removed through ITS in the cleanup code below. */
-        TEST_EQUAL( PSA_ERROR_NOT_PERMITTED, psa_destroy_key( key_id ) );
-    }
-    else
-    {
+        TEST_EQUAL(PSA_ERROR_NOT_PERMITTED, psa_destroy_key(key_id));
+    } else {
         /* Destroy the key. Confirm through direct access to the storage. */
-        PSA_ASSERT( psa_destroy_key( key_id ) );
-        TEST_EQUAL( PSA_ERROR_DOES_NOT_EXIST,
-                    psa_its_get_info( uid, &storage_info ) );
+        PSA_ASSERT(psa_destroy_key(key_id));
+        TEST_EQUAL(PSA_ERROR_DOES_NOT_EXIST,
+                   psa_its_get_info(uid, &storage_info));
     }
 
     ok = 1;
 
 exit:
-    psa_reset_key_attributes( &actual_attributes );
-    psa_its_remove( uid );
-    mbedtls_free( exported_material );
-    return( ok );
+    psa_reset_key_attributes(&actual_attributes);
+    psa_its_remove(uid);
+    mbedtls_free(exported_material);
+    return ok;
 }
 
 /* END_HEADER */
@@ -305,10 +312,10 @@
  */
 
 /* BEGIN_CASE */
-void key_storage_save( int lifetime_arg, int type_arg, int bits_arg,
-                       int usage_arg, int alg_arg, int alg2_arg,
-                       data_t *material,
-                       data_t *representation )
+void key_storage_save(int lifetime_arg, int type_arg, int bits_arg,
+                      int usage_arg, int alg_arg, int alg2_arg,
+                      data_t *material,
+                      data_t *representation)
 {
     /* Forward compatibility: save a key in the current format and
      * check that it has the expected format so that future versions
@@ -320,40 +327,40 @@
     psa_key_usage_t usage = usage_arg;
     psa_algorithm_t alg = alg_arg;
     psa_algorithm_t alg2 = alg2_arg;
-    mbedtls_svc_key_id_t key_id = mbedtls_svc_key_id_make( 0, 1 );
+    mbedtls_svc_key_id_t key_id = mbedtls_svc_key_id_make(0, 1);
     psa_storage_uid_t uid = 1;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_INIT( );
-    TEST_USES_KEY_ID( key_id );
+    PSA_INIT();
+    TEST_USES_KEY_ID(key_id);
 
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_id( &attributes, key_id );
-    psa_set_key_type( &attributes, type );
-    psa_set_key_bits( &attributes, bits );
-    psa_set_key_usage_flags( &attributes, usage );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_enrollment_algorithm( &attributes, alg2 );
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_id(&attributes, key_id);
+    psa_set_key_type(&attributes, type);
+    psa_set_key_bits(&attributes, bits);
+    psa_set_key_usage_flags(&attributes, usage);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_enrollment_algorithm(&attributes, alg2);
 
     /* This is the current storage format. Test that we know exactly how
      * the key is stored. The stability of the test data in future
      * versions of Mbed TLS will guarantee that future versions
      * can read back what this version wrote. */
-    TEST_ASSERT( test_written_key( &attributes, material,
-                                   uid, representation ) );
+    TEST_ASSERT(test_written_key(&attributes, material,
+                                 uid, representation));
 
 exit:
-    psa_reset_key_attributes( &attributes );
-    psa_destroy_key( key_id );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key_id);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void key_storage_read( int lifetime_arg, int type_arg, int bits_arg,
-                       int usage_arg, int alg_arg, int alg2_arg,
-                       data_t *material,
-                       data_t *representation, int flags )
+void key_storage_read(int lifetime_arg, int type_arg, int bits_arg,
+                      int usage_arg, int alg_arg, int alg2_arg,
+                      data_t *material,
+                      data_t *representation, int flags)
 {
     /* Backward compatibility: read a key in the format of a past version
      * and check that this version can use it. */
@@ -364,29 +371,29 @@
     psa_key_usage_t usage = usage_arg;
     psa_algorithm_t alg = alg_arg;
     psa_algorithm_t alg2 = alg2_arg;
-    mbedtls_svc_key_id_t key_id = mbedtls_svc_key_id_make( 0, 1 );
+    mbedtls_svc_key_id_t key_id = mbedtls_svc_key_id_make(0, 1);
     psa_storage_uid_t uid = 1;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    PSA_INIT( );
-    TEST_USES_KEY_ID( key_id );
+    PSA_INIT();
+    TEST_USES_KEY_ID(key_id);
 
-    psa_set_key_lifetime( &attributes, lifetime );
-    psa_set_key_id( &attributes, key_id );
-    psa_set_key_type( &attributes, type );
-    psa_set_key_bits( &attributes, bits );
-    psa_set_key_usage_flags( &attributes, usage );
-    psa_set_key_algorithm( &attributes, alg );
-    psa_set_key_enrollment_algorithm( &attributes, alg2 );
+    psa_set_key_lifetime(&attributes, lifetime);
+    psa_set_key_id(&attributes, key_id);
+    psa_set_key_type(&attributes, type);
+    psa_set_key_bits(&attributes, bits);
+    psa_set_key_usage_flags(&attributes, usage);
+    psa_set_key_algorithm(&attributes, alg);
+    psa_set_key_enrollment_algorithm(&attributes, alg2);
 
     /* Test that we can use a key with the given representation. This
      * guarantees backward compatibility with keys that were stored by
      * past versions of Mbed TLS. */
-    TEST_ASSERT( test_read_key( &attributes, material,
-                                uid, representation, flags ) );
+    TEST_ASSERT(test_read_key(&attributes, material,
+                              uid, representation, flags));
 
 exit:
-    psa_reset_key_attributes( &attributes );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    PSA_DONE();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_psa_its.function b/tests/suites/test_suite_psa_its.function
index 12878b5..7864b9c 100644
--- a/tests/suites/test_suite_psa_its.function
+++ b/tests/suites/test_suite_psa_its.function
@@ -20,23 +20,23 @@
 #define PSA_ITS_STORAGE_FILENAME_PATTERN "%08lx%08lx"
 #define PSA_ITS_STORAGE_SUFFIX ".psa_its"
 #define PSA_ITS_STORAGE_FILENAME_LENGTH         \
-    ( sizeof( PSA_ITS_STORAGE_PREFIX ) - 1 + /*prefix without terminating 0*/ \
-      16 + /*UID (64-bit number in hex)*/                               \
-      16 + /*UID (64-bit number in hex)*/                               \
-      sizeof( PSA_ITS_STORAGE_SUFFIX ) - 1 + /*suffix without terminating 0*/ \
-      1 /*terminating null byte*/ )
+    (sizeof(PSA_ITS_STORAGE_PREFIX) - 1 +    /*prefix without terminating 0*/ \
+     16 +  /*UID (64-bit number in hex)*/                               \
+     16 +  /*UID (64-bit number in hex)*/                               \
+     sizeof(PSA_ITS_STORAGE_SUFFIX) - 1 +    /*suffix without terminating 0*/ \
+     1 /*terminating null byte*/)
 #define PSA_ITS_STORAGE_TEMP \
     PSA_ITS_STORAGE_PREFIX "tempfile" PSA_ITS_STORAGE_SUFFIX
-static void psa_its_fill_filename( psa_storage_uid_t uid, char *filename )
+static void psa_its_fill_filename(psa_storage_uid_t uid, char *filename)
 {
     /* Break up the UID into two 32-bit pieces so as not to rely on
      * long long support in snprintf. */
-    mbedtls_snprintf( filename, PSA_ITS_STORAGE_FILENAME_LENGTH,
-                      "%s" PSA_ITS_STORAGE_FILENAME_PATTERN "%s",
-                      PSA_ITS_STORAGE_PREFIX,
-                      (unsigned long) ( uid >> 32 ),
-                      (unsigned long) ( uid & 0xffffffff ),
-                      PSA_ITS_STORAGE_SUFFIX );
+    mbedtls_snprintf(filename, PSA_ITS_STORAGE_FILENAME_LENGTH,
+                     "%s" PSA_ITS_STORAGE_FILENAME_PATTERN "%s",
+                     PSA_ITS_STORAGE_PREFIX,
+                     (unsigned long) (uid >> 32),
+                     (unsigned long) (uid & 0xffffffff),
+                     PSA_ITS_STORAGE_SUFFIX);
 }
 
 /* Maximum uid used by the test, recorded so that cleanup() can delete
@@ -44,7 +44,7 @@
  * need to and should not be taken into account for uid_max. */
 static psa_storage_uid_t uid_max = 0;
 
-static void cleanup( void )
+static void cleanup(void)
 {
     /* Call remove() on all the files that a test might have created.
      * We ignore the error if the file exists but remove() fails because
@@ -55,25 +55,25 @@
      * test case. */
     char filename[PSA_ITS_STORAGE_FILENAME_LENGTH];
     psa_storage_uid_t uid;
-    for( uid = 0; uid < uid_max; uid++ )
-    {
-        psa_its_fill_filename( uid, filename );
-        (void) remove( filename );
+    for (uid = 0; uid < uid_max; uid++) {
+        psa_its_fill_filename(uid, filename);
+        (void) remove(filename);
     }
-    psa_its_fill_filename( (psa_storage_uid_t)( -1 ), filename );
-    (void) remove( filename );
-    (void) remove( PSA_ITS_STORAGE_TEMP );
+    psa_its_fill_filename((psa_storage_uid_t) (-1), filename);
+    (void) remove(filename);
+    (void) remove(PSA_ITS_STORAGE_TEMP);
     uid_max = 0;
 }
 
-static psa_status_t psa_its_set_wrap( psa_storage_uid_t uid,
-                                      uint32_t data_length,
-                                      const void *p_data,
-                                      psa_storage_create_flags_t create_flags )
+static psa_status_t psa_its_set_wrap(psa_storage_uid_t uid,
+                                     uint32_t data_length,
+                                     const void *p_data,
+                                     psa_storage_create_flags_t create_flags)
 {
-    if( uid_max != (psa_storage_uid_t)( -1 ) && uid_max < uid )
+    if (uid_max != (psa_storage_uid_t) (-1) && uid_max < uid) {
         uid_max = uid;
-    return( psa_its_set( uid, data_length, p_data, create_flags ) );
+    }
+    return psa_its_set(uid, data_length, p_data, create_flags);
 }
 
 /* END_HEADER */
@@ -84,7 +84,7 @@
  */
 
 /* BEGIN_CASE */
-void set_get_remove( int uid_arg, int flags_arg, data_t *data )
+void set_get_remove(int uid_arg, int flags_arg, data_t *data)
 {
     psa_storage_uid_t uid = uid_arg;
     uint32_t flags = flags_arg;
@@ -92,28 +92,28 @@
     unsigned char *buffer = NULL;
     size_t ret_len = 0;
 
-    ASSERT_ALLOC( buffer, data->len );
+    ASSERT_ALLOC(buffer, data->len);
 
-    PSA_ASSERT( psa_its_set_wrap( uid, data->len, data->x, flags ) );
+    PSA_ASSERT(psa_its_set_wrap(uid, data->len, data->x, flags));
 
-    PSA_ASSERT( psa_its_get_info( uid, &info ) );
-    TEST_ASSERT( info.size == data->len );
-    TEST_ASSERT( info.flags == flags );
-    PSA_ASSERT( psa_its_get( uid, 0, data->len, buffer, &ret_len ) );
-    ASSERT_COMPARE( data->x, data->len, buffer, ret_len );
+    PSA_ASSERT(psa_its_get_info(uid, &info));
+    TEST_ASSERT(info.size == data->len);
+    TEST_ASSERT(info.flags == flags);
+    PSA_ASSERT(psa_its_get(uid, 0, data->len, buffer, &ret_len));
+    ASSERT_COMPARE(data->x, data->len, buffer, ret_len);
 
-    PSA_ASSERT( psa_its_remove( uid ) );
+    PSA_ASSERT(psa_its_remove(uid));
 
 exit:
-    mbedtls_free( buffer );
-    cleanup( );
+    mbedtls_free(buffer);
+    cleanup();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void set_overwrite( int uid_arg,
-                    int flags1_arg, data_t *data1,
-                    int flags2_arg, data_t *data2 )
+void set_overwrite(int uid_arg,
+                   int flags1_arg, data_t *data1,
+                   int flags2_arg, data_t *data2)
 {
     psa_storage_uid_t uid = uid_arg;
     uint32_t flags1 = flags1_arg;
@@ -122,33 +122,33 @@
     unsigned char *buffer = NULL;
     size_t ret_len = 0;
 
-    ASSERT_ALLOC( buffer, MAX( data1->len, data2->len ) );
+    ASSERT_ALLOC(buffer, MAX(data1->len, data2->len));
 
-    PSA_ASSERT( psa_its_set_wrap( uid, data1->len, data1->x, flags1 ) );
-    PSA_ASSERT( psa_its_get_info( uid, &info ) );
-    TEST_ASSERT( info.size == data1->len );
-    TEST_ASSERT( info.flags == flags1 );
-    PSA_ASSERT( psa_its_get( uid, 0, data1->len, buffer, &ret_len ) );
-    ASSERT_COMPARE( data1->x, data1->len, buffer, ret_len );
+    PSA_ASSERT(psa_its_set_wrap(uid, data1->len, data1->x, flags1));
+    PSA_ASSERT(psa_its_get_info(uid, &info));
+    TEST_ASSERT(info.size == data1->len);
+    TEST_ASSERT(info.flags == flags1);
+    PSA_ASSERT(psa_its_get(uid, 0, data1->len, buffer, &ret_len));
+    ASSERT_COMPARE(data1->x, data1->len, buffer, ret_len);
 
-    PSA_ASSERT( psa_its_set_wrap( uid, data2->len, data2->x, flags2 ) );
-    PSA_ASSERT( psa_its_get_info( uid, &info ) );
-    TEST_ASSERT( info.size == data2->len );
-    TEST_ASSERT( info.flags == flags2 );
+    PSA_ASSERT(psa_its_set_wrap(uid, data2->len, data2->x, flags2));
+    PSA_ASSERT(psa_its_get_info(uid, &info));
+    TEST_ASSERT(info.size == data2->len);
+    TEST_ASSERT(info.flags == flags2);
     ret_len = 0;
-    PSA_ASSERT( psa_its_get( uid, 0, data2->len, buffer, &ret_len ) );
-    ASSERT_COMPARE( data2->x, data2->len, buffer, ret_len );
+    PSA_ASSERT(psa_its_get(uid, 0, data2->len, buffer, &ret_len));
+    ASSERT_COMPARE(data2->x, data2->len, buffer, ret_len);
 
-    PSA_ASSERT( psa_its_remove( uid ) );
+    PSA_ASSERT(psa_its_remove(uid));
 
 exit:
-    mbedtls_free( buffer );
-    cleanup( );
+    mbedtls_free(buffer);
+    cleanup();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void set_multiple( int first_id, int count )
+void set_multiple(int first_id, int count)
 {
     psa_storage_uid_t uid0 = first_id;
     psa_storage_uid_t uid;
@@ -156,58 +156,55 @@
     char retrieved[40];
     size_t ret_len = 0;
 
-    memset( stored, '.', sizeof( stored ) );
-    for( uid = uid0; uid < uid0 + count; uid++ )
-    {
-        mbedtls_snprintf( stored, sizeof( stored ),
-                          "Content of file 0x%08lx", (unsigned long) uid );
-        PSA_ASSERT( psa_its_set_wrap( uid, sizeof( stored ), stored, 0 ) );
+    memset(stored, '.', sizeof(stored));
+    for (uid = uid0; uid < uid0 + count; uid++) {
+        mbedtls_snprintf(stored, sizeof(stored),
+                         "Content of file 0x%08lx", (unsigned long) uid);
+        PSA_ASSERT(psa_its_set_wrap(uid, sizeof(stored), stored, 0));
     }
 
-    for( uid = uid0; uid < uid0 + count; uid++ )
-    {
-        mbedtls_snprintf( stored, sizeof( stored ),
-                          "Content of file 0x%08lx", (unsigned long) uid );
-        PSA_ASSERT( psa_its_get( uid, 0, sizeof( stored ), retrieved, &ret_len ) );
-        ASSERT_COMPARE( retrieved, ret_len,
-                        stored, sizeof( stored ) );
-        PSA_ASSERT( psa_its_remove( uid ) );
-        TEST_ASSERT( psa_its_get( uid, 0, 0, NULL, NULL ) ==
-                     PSA_ERROR_DOES_NOT_EXIST );
+    for (uid = uid0; uid < uid0 + count; uid++) {
+        mbedtls_snprintf(stored, sizeof(stored),
+                         "Content of file 0x%08lx", (unsigned long) uid);
+        PSA_ASSERT(psa_its_get(uid, 0, sizeof(stored), retrieved, &ret_len));
+        ASSERT_COMPARE(retrieved, ret_len,
+                       stored, sizeof(stored));
+        PSA_ASSERT(psa_its_remove(uid));
+        TEST_ASSERT(psa_its_get(uid, 0, 0, NULL, NULL) ==
+                    PSA_ERROR_DOES_NOT_EXIST);
     }
 
 exit:
-    cleanup( );
+    cleanup();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void nonexistent( int uid_arg, int create_and_remove )
+void nonexistent(int uid_arg, int create_and_remove)
 {
     psa_storage_uid_t uid = uid_arg;
     struct psa_storage_info_t info;
 
-    if( create_and_remove )
-    {
-        PSA_ASSERT( psa_its_set_wrap( uid, 0, NULL, 0 ) );
-        PSA_ASSERT( psa_its_remove( uid ) );
+    if (create_and_remove) {
+        PSA_ASSERT(psa_its_set_wrap(uid, 0, NULL, 0));
+        PSA_ASSERT(psa_its_remove(uid));
     }
 
-    TEST_ASSERT( psa_its_remove( uid ) == PSA_ERROR_DOES_NOT_EXIST );
-    TEST_ASSERT( psa_its_get_info( uid, &info ) ==
-                 PSA_ERROR_DOES_NOT_EXIST );
-    TEST_ASSERT( psa_its_get( uid, 0, 0, NULL, NULL ) ==
-                 PSA_ERROR_DOES_NOT_EXIST );
+    TEST_ASSERT(psa_its_remove(uid) == PSA_ERROR_DOES_NOT_EXIST);
+    TEST_ASSERT(psa_its_get_info(uid, &info) ==
+                PSA_ERROR_DOES_NOT_EXIST);
+    TEST_ASSERT(psa_its_get(uid, 0, 0, NULL, NULL) ==
+                PSA_ERROR_DOES_NOT_EXIST);
 
 exit:
-    cleanup( );
+    cleanup();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void get_at( int uid_arg, data_t *data,
-             int offset, int length_arg,
-             int expected_status )
+void get_at(int uid_arg, data_t *data,
+            int offset, int length_arg,
+            int expected_status)
 {
     psa_storage_uid_t uid = uid_arg;
     unsigned char *buffer = NULL;
@@ -217,31 +214,33 @@
     size_t i;
     size_t ret_len = 0;
 
-    ASSERT_ALLOC( buffer, length + 16 );
+    ASSERT_ALLOC(buffer, length + 16);
     trailer = buffer + length;
-    memset( trailer, '-', 16 );
+    memset(trailer, '-', 16);
 
-    PSA_ASSERT( psa_its_set_wrap( uid, data->len, data->x, 0 ) );
+    PSA_ASSERT(psa_its_set_wrap(uid, data->len, data->x, 0));
 
-    status = psa_its_get( uid, offset, length_arg, buffer, &ret_len );
-    TEST_ASSERT( status == (psa_status_t) expected_status );
-    if( status == PSA_SUCCESS )
-        ASSERT_COMPARE( data->x + offset, (size_t) length_arg,
-                        buffer, ret_len );
-    for( i = 0; i < 16; i++ )
-        TEST_ASSERT( trailer[i] == '-' );
-    PSA_ASSERT( psa_its_remove( uid ) );
+    status = psa_its_get(uid, offset, length_arg, buffer, &ret_len);
+    TEST_ASSERT(status == (psa_status_t) expected_status);
+    if (status == PSA_SUCCESS) {
+        ASSERT_COMPARE(data->x + offset, (size_t) length_arg,
+                       buffer, ret_len);
+    }
+    for (i = 0; i < 16; i++) {
+        TEST_ASSERT(trailer[i] == '-');
+    }
+    PSA_ASSERT(psa_its_remove(uid));
 
 exit:
-    mbedtls_free( buffer );
-    cleanup( );
+    mbedtls_free(buffer);
+    cleanup();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void get_fail( int uid_arg, data_t *data,
-               int overwrite_magic, int cut_header,
-               int expected_status )
+void get_fail(int uid_arg, data_t *data,
+              int overwrite_magic, int cut_header,
+              int expected_status)
 {
     psa_storage_uid_t uid = uid_arg;
     unsigned char *buffer = NULL;
@@ -252,54 +251,53 @@
     FILE *stream = NULL;
     char bad_char = 'X';
 
-    PSA_ASSERT( psa_its_set_wrap( uid, data->len, data->x, 0 ) );
+    PSA_ASSERT(psa_its_set_wrap(uid, data->len, data->x, 0));
 
-    psa_its_fill_filename( uid, filename );
-    stream = fopen( filename, "rb+" );
-    TEST_ASSERT( NULL != stream );
-    if( 0 != overwrite_magic )
-    {
+    psa_its_fill_filename(uid, filename);
+    stream = fopen(filename, "rb+");
+    TEST_ASSERT(NULL != stream);
+    if (0 != overwrite_magic) {
         /* Overwrite the 1st byte of the file, the ITS magic number */
-        TEST_ASSERT( fseek( stream, 0, SEEK_SET ) == 0 );
-        n = fwrite( &bad_char, 1, 1, stream );
-        TEST_ASSERT( 1 == n );
+        TEST_ASSERT(fseek(stream, 0, SEEK_SET) == 0);
+        n = fwrite(&bad_char, 1, 1, stream);
+        TEST_ASSERT(1 == n);
     }
-    if( 0 != cut_header )
-    {
+    if (0 != cut_header) {
         /* Reopen file and truncate it to 0 byte by specifying the 'w' flag */
-        stream = freopen( filename, "wb", stream );
-        TEST_ASSERT( NULL != stream );
+        stream = freopen(filename, "wb", stream);
+        TEST_ASSERT(NULL != stream);
     }
-    fclose( stream );
+    fclose(stream);
     stream = NULL;
 
-    status = psa_its_get( uid, 0, 0, buffer, &ret_len );
-    TEST_ASSERT( status == (psa_status_t) expected_status );
-    TEST_ASSERT( 0 == ret_len );
-    PSA_ASSERT( psa_its_remove( uid ) );
+    status = psa_its_get(uid, 0, 0, buffer, &ret_len);
+    TEST_ASSERT(status == (psa_status_t) expected_status);
+    TEST_ASSERT(0 == ret_len);
+    PSA_ASSERT(psa_its_remove(uid));
 
     /* Check if the file is really deleted. */
-    stream = fopen( filename, "rb" );
-    TEST_ASSERT( NULL == stream );
+    stream = fopen(filename, "rb");
+    TEST_ASSERT(NULL == stream);
 
 exit:
-    if( stream != NULL )
-        fclose( stream );
+    if (stream != NULL) {
+        fclose(stream);
+    }
 
-    mbedtls_free( buffer );
-    cleanup( );
+    mbedtls_free(buffer);
+    cleanup();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void set_fail( int uid_arg, data_t *data,
-               int expected_status )
+void set_fail(int uid_arg, data_t *data,
+              int expected_status)
 {
     psa_storage_uid_t uid = uid_arg;
-    TEST_ASSERT( psa_its_set_wrap( uid, data->len, data->x, 0 ) ==
-                 (psa_status_t) expected_status );
+    TEST_ASSERT(psa_its_set_wrap(uid, data->len, data->x, 0) ==
+                (psa_status_t) expected_status);
 
-    exit:
-    cleanup( );
+exit:
+    cleanup();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_random.function b/tests/suites/test_suite_random.function
index 37fa36e..0f0c7fa 100644
--- a/tests/suites/test_suite_random.function
+++ b/tests/suites/test_suite_random.function
@@ -19,7 +19,7 @@
 /* END_HEADER */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_C:!MBEDTLS_TEST_NULL_ENTROPY:MBEDTLS_CTR_DRBG_C */
-void random_twice_with_ctr_drbg( )
+void random_twice_with_ctr_drbg()
 {
     mbedtls_entropy_context entropy;
     mbedtls_ctr_drbg_context drbg;
@@ -27,176 +27,176 @@
     unsigned char output2[OUTPUT_SIZE];
 
     /* First round */
-    mbedtls_entropy_init( &entropy );
-    mbedtls_ctr_drbg_init( &drbg );
-    TEST_EQUAL( 0, mbedtls_ctr_drbg_seed( &drbg,
-                                          mbedtls_entropy_func, &entropy,
-                                          NULL, 0 ) );
-    TEST_EQUAL( 0, mbedtls_ctr_drbg_random( &drbg,
-                                            output1, sizeof( output1 ) ) );
-    mbedtls_ctr_drbg_free( &drbg );
-    mbedtls_entropy_free( &entropy );
+    mbedtls_entropy_init(&entropy);
+    mbedtls_ctr_drbg_init(&drbg);
+    TEST_EQUAL(0, mbedtls_ctr_drbg_seed(&drbg,
+                                        mbedtls_entropy_func, &entropy,
+                                        NULL, 0));
+    TEST_EQUAL(0, mbedtls_ctr_drbg_random(&drbg,
+                                          output1, sizeof(output1)));
+    mbedtls_ctr_drbg_free(&drbg);
+    mbedtls_entropy_free(&entropy);
 
     /* Second round */
-    mbedtls_entropy_init( &entropy );
-    mbedtls_ctr_drbg_init( &drbg );
-    TEST_EQUAL( 0, mbedtls_ctr_drbg_seed( &drbg,
-                                          mbedtls_entropy_func, &entropy,
-                                          NULL, 0 ) );
-    TEST_EQUAL( 0, mbedtls_ctr_drbg_random( &drbg,
-                                            output2, sizeof( output2 ) ) );
-    mbedtls_ctr_drbg_free( &drbg );
-    mbedtls_entropy_free( &entropy );
+    mbedtls_entropy_init(&entropy);
+    mbedtls_ctr_drbg_init(&drbg);
+    TEST_EQUAL(0, mbedtls_ctr_drbg_seed(&drbg,
+                                        mbedtls_entropy_func, &entropy,
+                                        NULL, 0));
+    TEST_EQUAL(0, mbedtls_ctr_drbg_random(&drbg,
+                                          output2, sizeof(output2)));
+    mbedtls_ctr_drbg_free(&drbg);
+    mbedtls_entropy_free(&entropy);
 
     /* The two rounds must generate different random data. */
-    TEST_ASSERT( memcmp( output1, output2, OUTPUT_SIZE ) != 0 );
+    TEST_ASSERT(memcmp(output1, output2, OUTPUT_SIZE) != 0);
 
 exit:
-    mbedtls_ctr_drbg_free( &drbg );
-    mbedtls_entropy_free( &entropy );
+    mbedtls_ctr_drbg_free(&drbg);
+    mbedtls_entropy_free(&entropy);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_C:!MBEDTLS_TEST_NULL_ENTROPY:MBEDTLS_HMAC_DRBG_C */
-void random_twice_with_hmac_drbg( int md_type )
+void random_twice_with_hmac_drbg(int md_type)
 {
     mbedtls_entropy_context entropy;
     mbedtls_hmac_drbg_context drbg;
     unsigned char output1[OUTPUT_SIZE];
     unsigned char output2[OUTPUT_SIZE];
-    const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type( md_type );
+    const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(md_type);
 
     /* First round */
-    mbedtls_entropy_init( &entropy );
-    mbedtls_hmac_drbg_init( &drbg );
-    TEST_EQUAL( 0, mbedtls_hmac_drbg_seed( &drbg, md_info,
-                                           mbedtls_entropy_func, &entropy,
-                                           NULL, 0 ) );
-    TEST_EQUAL( 0, mbedtls_hmac_drbg_random( &drbg,
-                                             output1, sizeof( output1 ) ) );
-    mbedtls_hmac_drbg_free( &drbg );
-    mbedtls_entropy_free( &entropy );
+    mbedtls_entropy_init(&entropy);
+    mbedtls_hmac_drbg_init(&drbg);
+    TEST_EQUAL(0, mbedtls_hmac_drbg_seed(&drbg, md_info,
+                                         mbedtls_entropy_func, &entropy,
+                                         NULL, 0));
+    TEST_EQUAL(0, mbedtls_hmac_drbg_random(&drbg,
+                                           output1, sizeof(output1)));
+    mbedtls_hmac_drbg_free(&drbg);
+    mbedtls_entropy_free(&entropy);
 
     /* Second round */
-    mbedtls_entropy_init( &entropy );
-    mbedtls_hmac_drbg_init( &drbg );
-    TEST_EQUAL( 0, mbedtls_hmac_drbg_seed( &drbg, md_info,
-                                           mbedtls_entropy_func, &entropy,
-                                           NULL, 0 ) );
-    TEST_EQUAL( 0, mbedtls_hmac_drbg_random( &drbg,
-                                             output2, sizeof( output2 ) ) );
-    mbedtls_hmac_drbg_free( &drbg );
-    mbedtls_entropy_free( &entropy );
+    mbedtls_entropy_init(&entropy);
+    mbedtls_hmac_drbg_init(&drbg);
+    TEST_EQUAL(0, mbedtls_hmac_drbg_seed(&drbg, md_info,
+                                         mbedtls_entropy_func, &entropy,
+                                         NULL, 0));
+    TEST_EQUAL(0, mbedtls_hmac_drbg_random(&drbg,
+                                           output2, sizeof(output2)));
+    mbedtls_hmac_drbg_free(&drbg);
+    mbedtls_entropy_free(&entropy);
 
     /* The two rounds must generate different random data. */
-    TEST_ASSERT( memcmp( output1, output2, OUTPUT_SIZE ) != 0 );
+    TEST_ASSERT(memcmp(output1, output2, OUTPUT_SIZE) != 0);
 
 exit:
-    mbedtls_hmac_drbg_free( &drbg );
-    mbedtls_entropy_free( &entropy );
+    mbedtls_hmac_drbg_free(&drbg);
+    mbedtls_entropy_free(&entropy);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_C:!MBEDTLS_TEST_NULL_ENTROPY:!MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
-void random_twice_with_psa_from_classic( )
+void random_twice_with_psa_from_classic()
 {
     unsigned char output1[OUTPUT_SIZE];
     unsigned char output2[OUTPUT_SIZE];
 
     /* First round */
-    PSA_ASSERT( psa_crypto_init( ) );
-    TEST_EQUAL( 0, mbedtls_psa_get_random( MBEDTLS_PSA_RANDOM_STATE,
-                                           output1, sizeof( output1 ) ) );
-    PSA_DONE( );
+    PSA_ASSERT(psa_crypto_init());
+    TEST_EQUAL(0, mbedtls_psa_get_random(MBEDTLS_PSA_RANDOM_STATE,
+                                         output1, sizeof(output1)));
+    PSA_DONE();
 
     /* Second round */
-    PSA_ASSERT( psa_crypto_init( ) );
-    TEST_EQUAL( 0, mbedtls_psa_get_random( MBEDTLS_PSA_RANDOM_STATE,
-                                           output2, sizeof( output2 ) ) );
-    PSA_DONE( );
+    PSA_ASSERT(psa_crypto_init());
+    TEST_EQUAL(0, mbedtls_psa_get_random(MBEDTLS_PSA_RANDOM_STATE,
+                                         output2, sizeof(output2)));
+    PSA_DONE();
 
     /* The two rounds must generate different random data. */
-    TEST_ASSERT( memcmp( output1, output2, OUTPUT_SIZE ) != 0 );
+    TEST_ASSERT(memcmp(output1, output2, OUTPUT_SIZE) != 0);
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_C:!MBEDTLS_TEST_NULL_ENTROPY:!MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
-void random_twice_with_psa_from_psa( )
+void random_twice_with_psa_from_psa()
 {
     unsigned char output1[OUTPUT_SIZE];
     unsigned char output2[OUTPUT_SIZE];
 
     /* First round */
-    PSA_ASSERT( psa_crypto_init( ) );
-    PSA_ASSERT( psa_generate_random( output1, sizeof( output1 ) ) );
-    PSA_DONE( );
+    PSA_ASSERT(psa_crypto_init());
+    PSA_ASSERT(psa_generate_random(output1, sizeof(output1)));
+    PSA_DONE();
 
     /* Second round */
-    PSA_ASSERT( psa_crypto_init( ) );
-    PSA_ASSERT( psa_generate_random( output2, sizeof( output2 ) ) );
-    PSA_DONE( );
+    PSA_ASSERT(psa_crypto_init());
+    PSA_ASSERT(psa_generate_random(output2, sizeof(output2)));
+    PSA_DONE();
 
     /* The two rounds must generate different random data. */
-    TEST_ASSERT( memcmp( output1, output2, OUTPUT_SIZE ) != 0 );
+    TEST_ASSERT(memcmp(output1, output2, OUTPUT_SIZE) != 0);
 
 exit:
-    PSA_DONE( );
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_C */
-void mbedtls_psa_get_random_no_init( )
+void mbedtls_psa_get_random_no_init()
 {
     unsigned char output[1];
 
-    TEST_ASSERT( mbedtls_psa_get_random( MBEDTLS_PSA_RANDOM_STATE,
-                                         output, sizeof( output ) ) != 0 );
+    TEST_ASSERT(mbedtls_psa_get_random(MBEDTLS_PSA_RANDOM_STATE,
+                                       output, sizeof(output)) != 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_C */
-void mbedtls_psa_get_random_length( int n )
+void mbedtls_psa_get_random_length(int n)
 {
     unsigned char *output = NULL;
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    ASSERT_ALLOC( output, n );
+    PSA_ASSERT(psa_crypto_init());
+    ASSERT_ALLOC(output, n);
 
-    TEST_EQUAL( 0, mbedtls_psa_get_random( MBEDTLS_PSA_RANDOM_STATE,
-                                           output, n ) );
+    TEST_EQUAL(0, mbedtls_psa_get_random(MBEDTLS_PSA_RANDOM_STATE,
+                                         output, n));
 exit:
-    mbedtls_free( output );
-    PSA_DONE( );
+    mbedtls_free(output);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_C:MBEDTLS_ECDSA_C */
-void mbedtls_psa_get_random_ecdsa_sign( int curve )
+void mbedtls_psa_get_random_ecdsa_sign(int curve)
 {
     mbedtls_ecp_group grp;
     mbedtls_mpi d, r, s;
     unsigned char buf[] = "This is not a hash.";
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_mpi_init( &d );
-    mbedtls_mpi_init( &r );
-    mbedtls_mpi_init( &s );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_mpi_init(&d);
+    mbedtls_mpi_init(&r);
+    mbedtls_mpi_init(&s);
 
-    TEST_EQUAL( 0, mbedtls_mpi_lset( &d, 123456789 ) );
-    TEST_EQUAL( 0, mbedtls_ecp_group_load( &grp, curve ) );
-    PSA_ASSERT( psa_crypto_init( ) );
-    TEST_EQUAL( 0, mbedtls_ecdsa_sign( &grp, &r, &s, &d,
-                                       buf, sizeof( buf ),
-                                       mbedtls_psa_get_random,
-                                       MBEDTLS_PSA_RANDOM_STATE ) );
+    TEST_EQUAL(0, mbedtls_mpi_lset(&d, 123456789));
+    TEST_EQUAL(0, mbedtls_ecp_group_load(&grp, curve));
+    PSA_ASSERT(psa_crypto_init());
+    TEST_EQUAL(0, mbedtls_ecdsa_sign(&grp, &r, &s, &d,
+                                     buf, sizeof(buf),
+                                     mbedtls_psa_get_random,
+                                     MBEDTLS_PSA_RANDOM_STATE));
 exit:
-    mbedtls_mpi_free( &d );
-    mbedtls_mpi_free( &r );
-    mbedtls_mpi_free( &s );
-    mbedtls_ecp_group_free( &grp );
-    PSA_DONE( );
+    mbedtls_mpi_free(&d);
+    mbedtls_mpi_free(&r);
+    mbedtls_mpi_free(&s);
+    mbedtls_ecp_group_free(&grp);
+    PSA_DONE();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_rsa.function b/tests/suites/test_suite_rsa.function
index 3c0e35f..fa7fa95 100644
--- a/tests/suites/test_suite_rsa.function
+++ b/tests/suites/test_suite_rsa.function
@@ -18,7 +18,7 @@
  */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void rsa_invalid_param( )
+void rsa_invalid_param()
 {
     mbedtls_rsa_context ctx;
     const int valid_padding = MBEDTLS_RSA_PKCS_V21;
@@ -28,460 +28,460 @@
     unsigned char buf[42] = { 0 };
     size_t olen;
 
-    TEST_INVALID_PARAM( mbedtls_rsa_init( NULL, valid_padding, 0 ) );
-    TEST_INVALID_PARAM( mbedtls_rsa_init( &ctx, invalid_padding, 0 ) );
-    TEST_VALID_PARAM( mbedtls_rsa_free( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_rsa_init(NULL, valid_padding, 0));
+    TEST_INVALID_PARAM(mbedtls_rsa_init(&ctx, invalid_padding, 0));
+    TEST_VALID_PARAM(mbedtls_rsa_free(NULL));
 
     /* No more variants because only the first argument must be non-NULL. */
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_import( NULL, NULL, NULL,
-                                                NULL, NULL, NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_import_raw( NULL,
-                                                    NULL, 0,
-                                                    NULL, 0,
-                                                    NULL, 0,
-                                                    NULL, 0,
-                                                    NULL, 0 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_import(NULL, NULL, NULL,
+                                              NULL, NULL, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_import_raw(NULL,
+                                                  NULL, 0,
+                                                  NULL, 0,
+                                                  NULL, 0,
+                                                  NULL, 0,
+                                                  NULL, 0));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_complete( NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_complete(NULL));
 
     /* No more variants because only the first argument must be non-NULL. */
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_export( NULL, NULL, NULL,
-                                                NULL, NULL, NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_export_raw( NULL,
-                                                    NULL, 0,
-                                                    NULL, 0,
-                                                    NULL, 0,
-                                                    NULL, 0,
-                                                    NULL, 0 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_export_crt( NULL, NULL, NULL, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_export(NULL, NULL, NULL,
+                                              NULL, NULL, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_export_raw(NULL,
+                                                  NULL, 0,
+                                                  NULL, 0,
+                                                  NULL, 0,
+                                                  NULL, 0,
+                                                  NULL, 0));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_export_crt(NULL, NULL, NULL, NULL));
 
-    TEST_INVALID_PARAM( mbedtls_rsa_set_padding( NULL,
-                                                 valid_padding, 0 ) );
-    TEST_INVALID_PARAM( mbedtls_rsa_set_padding( &ctx,
-                                                 invalid_padding, 0 ) );
+    TEST_INVALID_PARAM(mbedtls_rsa_set_padding(NULL,
+                                               valid_padding, 0));
+    TEST_INVALID_PARAM(mbedtls_rsa_set_padding(&ctx,
+                                               invalid_padding, 0));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_gen_key( NULL,
-                                                 mbedtls_test_rnd_std_rand,
-                                                 NULL, 0, 0 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_gen_key( &ctx, NULL,
-                                                 NULL, 0, 0 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_gen_key(NULL,
+                                               mbedtls_test_rnd_std_rand,
+                                               NULL, 0, 0));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_gen_key(&ctx, NULL,
+                                               NULL, 0, 0));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_check_pubkey( NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_check_privkey( NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_check_pubkey(NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_check_privkey(NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_check_pub_priv( NULL, &ctx ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_check_pub_priv( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_check_pub_priv(NULL, &ctx));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_check_pub_priv(&ctx, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_public( NULL, buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_public( &ctx, NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_public( &ctx, buf, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_public(NULL, buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_public(&ctx, NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_public(&ctx, buf, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_private( NULL, NULL, NULL,
-                                                 buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_private( &ctx, NULL, NULL,
-                                                 NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_private( &ctx, NULL, NULL,
-                                                 buf, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_private(NULL, NULL, NULL,
+                                               buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_private(&ctx, NULL, NULL,
+                                               NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_private(&ctx, NULL, NULL,
+                                               buf, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_encrypt( NULL, NULL, NULL,
-                                                       valid_mode,
-                                                       sizeof( buf ), buf,
-                                                       buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_encrypt( &ctx, NULL, NULL,
-                                                       invalid_mode,
-                                                       sizeof( buf ), buf,
-                                                       buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_encrypt( &ctx, NULL, NULL,
-                                                       valid_mode,
-                                                       sizeof( buf ), NULL,
-                                                       buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_encrypt( &ctx, NULL, NULL,
-                                                       valid_mode,
-                                                       sizeof( buf ), buf,
-                                                       NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_encrypt(NULL, NULL, NULL,
+                                                     valid_mode,
+                                                     sizeof(buf), buf,
+                                                     buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_encrypt(&ctx, NULL, NULL,
+                                                     invalid_mode,
+                                                     sizeof(buf), buf,
+                                                     buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_encrypt(&ctx, NULL, NULL,
+                                                     valid_mode,
+                                                     sizeof(buf), NULL,
+                                                     buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_encrypt(&ctx, NULL, NULL,
+                                                     valid_mode,
+                                                     sizeof(buf), buf,
+                                                     NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_pkcs1_v15_encrypt( NULL, NULL,
-                                                           NULL,
-                                                           valid_mode,
-                                                           sizeof( buf ), buf,
-                                                           buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_pkcs1_v15_encrypt( &ctx, NULL,
-                                                           NULL,
-                                                           invalid_mode,
-                                                           sizeof( buf ), buf,
-                                                           buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_pkcs1_v15_encrypt( &ctx, NULL,
-                                                           NULL,
-                                                           valid_mode,
-                                                           sizeof( buf ), NULL,
-                                                           buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_pkcs1_v15_encrypt( &ctx, NULL,
-                                                           NULL,
-                                                           valid_mode,
-                                                           sizeof( buf ), buf,
-                                                           NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_pkcs1_v15_encrypt(NULL, NULL,
+                                                               NULL,
+                                                               valid_mode,
+                                                               sizeof(buf), buf,
+                                                               buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_pkcs1_v15_encrypt(&ctx, NULL,
+                                                               NULL,
+                                                               invalid_mode,
+                                                               sizeof(buf), buf,
+                                                               buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_pkcs1_v15_encrypt(&ctx, NULL,
+                                                               NULL,
+                                                               valid_mode,
+                                                               sizeof(buf), NULL,
+                                                               buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_pkcs1_v15_encrypt(&ctx, NULL,
+                                                               NULL,
+                                                               valid_mode,
+                                                               sizeof(buf), buf,
+                                                               NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_oaep_encrypt( NULL, NULL, NULL,
-                                                            valid_mode,
-                                                            buf, sizeof( buf ),
-                                                            sizeof( buf ), buf,
-                                                            buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_oaep_encrypt( &ctx, NULL, NULL,
-                                                            invalid_mode,
-                                                            buf, sizeof( buf ),
-                                                            sizeof( buf ), buf,
-                                                            buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_oaep_encrypt( &ctx, NULL, NULL,
-                                                            valid_mode,
-                                                            NULL, sizeof( buf ),
-                                                            sizeof( buf ), buf,
-                                                            buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_oaep_encrypt( &ctx, NULL, NULL,
-                                                            valid_mode,
-                                                            buf, sizeof( buf ),
-                                                            sizeof( buf ), NULL,
-                                                            buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_oaep_encrypt( &ctx, NULL, NULL,
-                                                            valid_mode,
-                                                            buf, sizeof( buf ),
-                                                            sizeof( buf ), buf,
-                                                            NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_oaep_encrypt(NULL, NULL, NULL,
+                                                          valid_mode,
+                                                          buf, sizeof(buf),
+                                                          sizeof(buf), buf,
+                                                          buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_oaep_encrypt(&ctx, NULL, NULL,
+                                                          invalid_mode,
+                                                          buf, sizeof(buf),
+                                                          sizeof(buf), buf,
+                                                          buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_oaep_encrypt(&ctx, NULL, NULL,
+                                                          valid_mode,
+                                                          NULL, sizeof(buf),
+                                                          sizeof(buf), buf,
+                                                          buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_oaep_encrypt(&ctx, NULL, NULL,
+                                                          valid_mode,
+                                                          buf, sizeof(buf),
+                                                          sizeof(buf), NULL,
+                                                          buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_oaep_encrypt(&ctx, NULL, NULL,
+                                                          valid_mode,
+                                                          buf, sizeof(buf),
+                                                          sizeof(buf), buf,
+                                                          NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_decrypt( NULL, NULL, NULL,
-                                                       valid_mode, &olen,
-                                                       buf, buf, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_decrypt( &ctx, NULL, NULL,
-                                                       invalid_mode, &olen,
-                                                       buf, buf, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_decrypt( &ctx, NULL, NULL,
-                                                       valid_mode, NULL,
-                                                       buf, buf, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_decrypt( &ctx, NULL, NULL,
-                                                       valid_mode, &olen,
-                                                       NULL, buf, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_decrypt( &ctx, NULL, NULL,
-                                                       valid_mode, &olen,
-                                                       buf, NULL, 42 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_decrypt(NULL, NULL, NULL,
+                                                     valid_mode, &olen,
+                                                     buf, buf, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_decrypt(&ctx, NULL, NULL,
+                                                     invalid_mode, &olen,
+                                                     buf, buf, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_decrypt(&ctx, NULL, NULL,
+                                                     valid_mode, NULL,
+                                                     buf, buf, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_decrypt(&ctx, NULL, NULL,
+                                                     valid_mode, &olen,
+                                                     NULL, buf, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_decrypt(&ctx, NULL, NULL,
+                                                     valid_mode, &olen,
+                                                     buf, NULL, 42));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_pkcs1_v15_decrypt( NULL, NULL,
-                                                           NULL,
-                                                           valid_mode, &olen,
-                                                           buf, buf, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_pkcs1_v15_decrypt( &ctx, NULL,
-                                                           NULL,
-                                                           invalid_mode, &olen,
-                                                           buf, buf, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_pkcs1_v15_decrypt( &ctx, NULL,
-                                                           NULL,
-                                                           valid_mode, NULL,
-                                                           buf, buf, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_pkcs1_v15_decrypt( &ctx, NULL,
-                                                           NULL,
-                                                           valid_mode, &olen,
-                                                           NULL, buf, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_pkcs1_v15_decrypt( &ctx, NULL,
-                                                           NULL,
-                                                           valid_mode, &olen,
-                                                           buf, NULL, 42 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_pkcs1_v15_decrypt(NULL, NULL,
+                                                               NULL,
+                                                               valid_mode, &olen,
+                                                               buf, buf, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_pkcs1_v15_decrypt(&ctx, NULL,
+                                                               NULL,
+                                                               invalid_mode, &olen,
+                                                               buf, buf, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_pkcs1_v15_decrypt(&ctx, NULL,
+                                                               NULL,
+                                                               valid_mode, NULL,
+                                                               buf, buf, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_pkcs1_v15_decrypt(&ctx, NULL,
+                                                               NULL,
+                                                               valid_mode, &olen,
+                                                               NULL, buf, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_pkcs1_v15_decrypt(&ctx, NULL,
+                                                               NULL,
+                                                               valid_mode, &olen,
+                                                               buf, NULL, 42));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_oaep_decrypt( NULL, NULL, NULL,
-                                                            valid_mode,
-                                                            buf, sizeof( buf ),
-                                                            &olen,
-                                                            buf, buf, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_oaep_decrypt( &ctx, NULL, NULL,
-                                                            invalid_mode,
-                                                            buf, sizeof( buf ),
-                                                            &olen,
-                                                            buf, buf, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_oaep_decrypt( &ctx, NULL, NULL,
-                                                            valid_mode,
-                                                            NULL, sizeof( buf ),
-                                                            NULL,
-                                                            buf, buf, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_oaep_decrypt( &ctx, NULL, NULL,
-                                                            valid_mode,
-                                                            buf, sizeof( buf ),
-                                                            &olen,
-                                                            NULL, buf, 42 ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsaes_oaep_decrypt( &ctx, NULL, NULL,
-                                                            valid_mode,
-                                                            buf, sizeof( buf ),
-                                                            &olen,
-                                                            buf, NULL, 42 ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_oaep_decrypt(NULL, NULL, NULL,
+                                                          valid_mode,
+                                                          buf, sizeof(buf),
+                                                          &olen,
+                                                          buf, buf, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_oaep_decrypt(&ctx, NULL, NULL,
+                                                          invalid_mode,
+                                                          buf, sizeof(buf),
+                                                          &olen,
+                                                          buf, buf, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_oaep_decrypt(&ctx, NULL, NULL,
+                                                          valid_mode,
+                                                          NULL, sizeof(buf),
+                                                          NULL,
+                                                          buf, buf, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_oaep_decrypt(&ctx, NULL, NULL,
+                                                          valid_mode,
+                                                          buf, sizeof(buf),
+                                                          &olen,
+                                                          NULL, buf, 42));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsaes_oaep_decrypt(&ctx, NULL, NULL,
+                                                          valid_mode,
+                                                          buf, sizeof(buf),
+                                                          &olen,
+                                                          buf, NULL, 42));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_sign( NULL, NULL, NULL,
-                                                    valid_mode,
-                                                    0, sizeof( buf ), buf,
-                                                    buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_sign( &ctx, NULL, NULL,
-                                                    invalid_mode,
-                                                    0, sizeof( buf ), buf,
-                                                    buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_sign( &ctx, NULL, NULL,
-                                                    valid_mode,
-                                                    0, sizeof( buf ), NULL,
-                                                    buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_sign( &ctx, NULL, NULL,
-                                                    valid_mode,
-                                                    0, sizeof( buf ), buf,
-                                                    NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_sign( &ctx, NULL, NULL,
-                                                    valid_mode,
-                                                    MBEDTLS_MD_SHA1,
-                                                    0, NULL,
-                                                    buf ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_sign(NULL, NULL, NULL,
+                                                  valid_mode,
+                                                  0, sizeof(buf), buf,
+                                                  buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_sign(&ctx, NULL, NULL,
+                                                  invalid_mode,
+                                                  0, sizeof(buf), buf,
+                                                  buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_sign(&ctx, NULL, NULL,
+                                                  valid_mode,
+                                                  0, sizeof(buf), NULL,
+                                                  buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_sign(&ctx, NULL, NULL,
+                                                  valid_mode,
+                                                  0, sizeof(buf), buf,
+                                                  NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_sign(&ctx, NULL, NULL,
+                                                  valid_mode,
+                                                  MBEDTLS_MD_SHA1,
+                                                  0, NULL,
+                                                  buf));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pkcs1_v15_sign( NULL, NULL, NULL,
-                                                        valid_mode,
-                                                        0, sizeof( buf ), buf,
-                                                        buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pkcs1_v15_sign( &ctx, NULL, NULL,
-                                                        invalid_mode,
-                                                        0, sizeof( buf ), buf,
-                                                        buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pkcs1_v15_sign( &ctx, NULL, NULL,
-                                                        valid_mode,
-                                                        0, sizeof( buf ), NULL,
-                                                        buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pkcs1_v15_sign( &ctx, NULL, NULL,
-                                                        valid_mode,
-                                                        0, sizeof( buf ), buf,
-                                                        NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pkcs1_v15_sign( &ctx, NULL, NULL,
-                                                        valid_mode,
-                                                        MBEDTLS_MD_SHA1,
-                                                        0, NULL,
-                                                        buf ) );
-
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_sign( NULL, NULL, NULL,
-                                                         valid_mode,
-                                                         0, sizeof( buf ), buf,
-                                                         buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_sign( &ctx, NULL, NULL,
-                                                         invalid_mode,
-                                                         0, sizeof( buf ), buf,
-                                                         buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_sign( &ctx, NULL, NULL,
-                                                         valid_mode,
-                                                         0, sizeof( buf ), NULL,
-                                                         buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_sign( &ctx, NULL, NULL,
-                                                         valid_mode,
-                                                         0, sizeof( buf ), buf,
-                                                         NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_sign( &ctx, NULL, NULL,
-                                                         valid_mode,
-                                                         MBEDTLS_MD_SHA1,
-                                                         0, NULL,
-                                                         buf ) );
-
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_sign_ext( NULL, NULL, NULL,
-                                                             0, sizeof( buf ), buf,
-                                                             MBEDTLS_RSA_SALT_LEN_ANY,
-                                                             buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_sign_ext( &ctx, NULL, NULL,
-                                                             0, sizeof( buf ), NULL,
-                                                             MBEDTLS_RSA_SALT_LEN_ANY,
-                                                             buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_sign_ext( &ctx, NULL, NULL,
-                                                             0, sizeof( buf ), buf,
-                                                             MBEDTLS_RSA_SALT_LEN_ANY,
-                                                             NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_sign_ext( &ctx, NULL, NULL,
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pkcs1_v15_sign(NULL, NULL, NULL,
+                                                             valid_mode,
+                                                             0, sizeof(buf), buf,
+                                                             buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pkcs1_v15_sign(&ctx, NULL, NULL,
+                                                             invalid_mode,
+                                                             0, sizeof(buf), buf,
+                                                             buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pkcs1_v15_sign(&ctx, NULL, NULL,
+                                                             valid_mode,
+                                                             0, sizeof(buf), NULL,
+                                                             buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pkcs1_v15_sign(&ctx, NULL, NULL,
+                                                             valid_mode,
+                                                             0, sizeof(buf), buf,
+                                                             NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pkcs1_v15_sign(&ctx, NULL, NULL,
+                                                             valid_mode,
                                                              MBEDTLS_MD_SHA1,
                                                              0, NULL,
-                                                             MBEDTLS_RSA_SALT_LEN_ANY,
-                                                             buf ) );
+                                                             buf));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_verify( NULL, NULL, NULL,
-                                                      valid_mode,
-                                                      0, sizeof( buf ), buf,
-                                                      buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_verify( &ctx, NULL, NULL,
-                                                      invalid_mode,
-                                                      0, sizeof( buf ), buf,
-                                                      buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_verify( &ctx, NULL, NULL,
-                                                      valid_mode,
-                                                      0, sizeof( buf ), NULL,
-                                                      buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_verify( &ctx, NULL, NULL,
-                                                      valid_mode,
-                                                      0, sizeof( buf ), buf,
-                                                      NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_pkcs1_verify( &ctx, NULL, NULL,
-                                                      valid_mode,
-                                                      MBEDTLS_MD_SHA1, 0, NULL,
-                                                      buf ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_sign(NULL, NULL, NULL,
+                                                       valid_mode,
+                                                       0, sizeof(buf), buf,
+                                                       buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_sign(&ctx, NULL, NULL,
+                                                       invalid_mode,
+                                                       0, sizeof(buf), buf,
+                                                       buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_sign(&ctx, NULL, NULL,
+                                                       valid_mode,
+                                                       0, sizeof(buf), NULL,
+                                                       buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_sign(&ctx, NULL, NULL,
+                                                       valid_mode,
+                                                       0, sizeof(buf), buf,
+                                                       NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_sign(&ctx, NULL, NULL,
+                                                       valid_mode,
+                                                       MBEDTLS_MD_SHA1,
+                                                       0, NULL,
+                                                       buf));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pkcs1_v15_verify( NULL, NULL,
-                                                          NULL,
-                                                          valid_mode,
-                                                          0, sizeof( buf ), buf,
-                                                          buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pkcs1_v15_verify( &ctx, NULL,
-                                                          NULL,
-                                                          invalid_mode,
-                                                          0, sizeof( buf ), buf,
-                                                          buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pkcs1_v15_verify( &ctx, NULL,
-                                                          NULL,
-                                                          valid_mode,
-                                                          0, sizeof( buf ),
-                                                          NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pkcs1_v15_verify( &ctx, NULL,
-                                                          NULL,
-                                                          valid_mode,
-                                                          0, sizeof( buf ), buf,
-                                                          NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pkcs1_v15_verify( &ctx, NULL,
-                                                          NULL,
-                                                          valid_mode,
-                                                          MBEDTLS_MD_SHA1,
-                                                          0, NULL,
-                                                          buf ) );
-
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_verify( NULL, NULL, NULL,
-                                                           valid_mode,
-                                                           0, sizeof( buf ),
-                                                           buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_verify( &ctx, NULL, NULL,
-                                                           invalid_mode,
-                                                           0, sizeof( buf ),
-                                                           buf, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_verify( &ctx, NULL, NULL,
-                                                           valid_mode,
-                                                           0, sizeof( buf ),
-                                                           NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_verify( &ctx, NULL, NULL,
-                                                           valid_mode,
-                                                           0, sizeof( buf ),
-                                                           buf, NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_verify( &ctx, NULL, NULL,
-                                                           valid_mode,
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_sign_ext(NULL, NULL, NULL,
+                                                           0, sizeof(buf), buf,
+                                                           MBEDTLS_RSA_SALT_LEN_ANY,
+                                                           buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_sign_ext(&ctx, NULL, NULL,
+                                                           0, sizeof(buf), NULL,
+                                                           MBEDTLS_RSA_SALT_LEN_ANY,
+                                                           buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_sign_ext(&ctx, NULL, NULL,
+                                                           0, sizeof(buf), buf,
+                                                           MBEDTLS_RSA_SALT_LEN_ANY,
+                                                           NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_sign_ext(&ctx, NULL, NULL,
                                                            MBEDTLS_MD_SHA1,
                                                            0, NULL,
-                                                           buf ) );
+                                                           MBEDTLS_RSA_SALT_LEN_ANY,
+                                                           buf));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_verify_ext( NULL, NULL, NULL,
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_verify(NULL, NULL, NULL,
+                                                    valid_mode,
+                                                    0, sizeof(buf), buf,
+                                                    buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_verify(&ctx, NULL, NULL,
+                                                    invalid_mode,
+                                                    0, sizeof(buf), buf,
+                                                    buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_verify(&ctx, NULL, NULL,
+                                                    valid_mode,
+                                                    0, sizeof(buf), NULL,
+                                                    buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_verify(&ctx, NULL, NULL,
+                                                    valid_mode,
+                                                    0, sizeof(buf), buf,
+                                                    NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_pkcs1_verify(&ctx, NULL, NULL,
+                                                    valid_mode,
+                                                    MBEDTLS_MD_SHA1, 0, NULL,
+                                                    buf));
+
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pkcs1_v15_verify(NULL, NULL,
+                                                               NULL,
                                                                valid_mode,
-                                                               0, sizeof( buf ),
-                                                               buf,
-                                                               0, 0,
-                                                               buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_verify_ext( &ctx, NULL, NULL,
+                                                               0, sizeof(buf), buf,
+                                                               buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pkcs1_v15_verify(&ctx, NULL,
+                                                               NULL,
                                                                invalid_mode,
-                                                               0, sizeof( buf ),
-                                                               buf,
-                                                               0, 0,
-                                                               buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_verify_ext( &ctx, NULL, NULL,
+                                                               0, sizeof(buf), buf,
+                                                               buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pkcs1_v15_verify(&ctx, NULL,
+                                                               NULL,
                                                                valid_mode,
-                                                               0, sizeof( buf ),
-                                                               NULL, 0, 0,
-                                                               buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_verify_ext( &ctx, NULL, NULL,
+                                                               0, sizeof(buf),
+                                                               NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pkcs1_v15_verify(&ctx, NULL,
+                                                               NULL,
                                                                valid_mode,
-                                                               0, sizeof( buf ),
-                                                               buf, 0, 0,
-                                                               NULL ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_rsassa_pss_verify_ext( &ctx, NULL, NULL,
+                                                               0, sizeof(buf), buf,
+                                                               NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pkcs1_v15_verify(&ctx, NULL,
+                                                               NULL,
                                                                valid_mode,
                                                                MBEDTLS_MD_SHA1,
                                                                0, NULL,
-                                                               0, 0,
-                                                               buf ) );
+                                                               buf));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_copy( NULL, &ctx ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
-                            mbedtls_rsa_copy( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_verify(NULL, NULL, NULL,
+                                                         valid_mode,
+                                                         0, sizeof(buf),
+                                                         buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_verify(&ctx, NULL, NULL,
+                                                         invalid_mode,
+                                                         0, sizeof(buf),
+                                                         buf, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_verify(&ctx, NULL, NULL,
+                                                         valid_mode,
+                                                         0, sizeof(buf),
+                                                         NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_verify(&ctx, NULL, NULL,
+                                                         valid_mode,
+                                                         0, sizeof(buf),
+                                                         buf, NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_verify(&ctx, NULL, NULL,
+                                                         valid_mode,
+                                                         MBEDTLS_MD_SHA1,
+                                                         0, NULL,
+                                                         buf));
+
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_verify_ext(NULL, NULL, NULL,
+                                                             valid_mode,
+                                                             0, sizeof(buf),
+                                                             buf,
+                                                             0, 0,
+                                                             buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_verify_ext(&ctx, NULL, NULL,
+                                                             invalid_mode,
+                                                             0, sizeof(buf),
+                                                             buf,
+                                                             0, 0,
+                                                             buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_verify_ext(&ctx, NULL, NULL,
+                                                             valid_mode,
+                                                             0, sizeof(buf),
+                                                             NULL, 0, 0,
+                                                             buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_verify_ext(&ctx, NULL, NULL,
+                                                             valid_mode,
+                                                             0, sizeof(buf),
+                                                             buf, 0, 0,
+                                                             NULL));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_rsassa_pss_verify_ext(&ctx, NULL, NULL,
+                                                             valid_mode,
+                                                             MBEDTLS_MD_SHA1,
+                                                             0, NULL,
+                                                             0, 0,
+                                                             buf));
+
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_copy(NULL, &ctx));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_RSA_BAD_INPUT_DATA,
+                           mbedtls_rsa_copy(&ctx, NULL));
 
 exit:
     return;
@@ -489,7 +489,7 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void rsa_init_free( int reinit )
+void rsa_init_free(int reinit)
 {
     mbedtls_rsa_context ctx;
 
@@ -498,12 +498,13 @@
      * unconditionally on an error path without checking whether it has
      * already been called in the success path. */
 
-    mbedtls_rsa_init( &ctx, 0, 0 );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_rsa_init(&ctx, 0, 0);
+    mbedtls_rsa_free(&ctx);
 
-    if( reinit )
-        mbedtls_rsa_init( &ctx, 0, 0 );
-    mbedtls_rsa_free( &ctx );
+    if (reinit) {
+        mbedtls_rsa_init(&ctx, 0, 0);
+    }
+    mbedtls_rsa_free(&ctx);
 
     /* This test case always succeeds, functionally speaking. A plausible
      * bug might trigger an invalid pointer dereference or a memory leak. */
@@ -512,10 +513,10 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_rsa_pkcs1_sign( data_t * message_str, int padding_mode,
-                             int digest, int mod, char * input_P,
-                             char * input_Q, char * input_N, char * input_E,
-                             data_t * result_str, int result )
+void mbedtls_rsa_pkcs1_sign(data_t *message_str, int padding_mode,
+                            int digest, int mod, char *input_P,
+                            char *input_Q, char *input_N, char *input_E,
+                            data_t *result_str, int result)
 {
     unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
     unsigned char output[256];
@@ -523,303 +524,304 @@
     mbedtls_mpi N, P, Q, E;
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &P );
-    mbedtls_mpi_init( &Q ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx, padding_mode, 0 );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx, padding_mode, 0);
 
-    memset( hash_result, 0x00, sizeof( hash_result ) );
-    memset( output, 0x00, sizeof( output ) );
-    memset( &rnd_info, 0, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    memset(hash_result, 0x00, sizeof(hash_result));
+    memset(output, 0x00, sizeof(output));
+    memset(&rnd_info, 0, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, &P, &Q, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( mod / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_complete( &ctx ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) (mod / 8));
+    TEST_ASSERT(mbedtls_rsa_complete(&ctx) == 0);
+    TEST_ASSERT(mbedtls_rsa_check_privkey(&ctx) == 0);
 
 
-    if( mbedtls_md_info_from_type( digest ) != NULL )
-        TEST_ASSERT( mbedtls_md( mbedtls_md_info_from_type( digest ), message_str->x, message_str->len, hash_result ) == 0 );
+    if (mbedtls_md_info_from_type(digest) != NULL) {
+        TEST_ASSERT(mbedtls_md(mbedtls_md_info_from_type(digest), message_str->x, message_str->len,
+                               hash_result) == 0);
+    }
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_sign( &ctx, &mbedtls_test_rnd_pseudo_rand,
-                                         &rnd_info, MBEDTLS_RSA_PRIVATE, digest,
-                                         0, hash_result, output ) == result );
-    if( result == 0 )
-    {
+    TEST_ASSERT(mbedtls_rsa_pkcs1_sign(&ctx, &mbedtls_test_rnd_pseudo_rand,
+                                       &rnd_info, MBEDTLS_RSA_PRIVATE, digest,
+                                       0, hash_result, output) == result);
+    if (result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                          ctx.len, result_str->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, result_str->x,
+                                        ctx.len, result_str->len) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &P );
-    mbedtls_mpi_free( &Q ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&P);
+    mbedtls_mpi_free(&Q); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_rsa_pkcs1_verify( data_t * message_str, int padding_mode,
-                               int digest, int mod,
-                               char * input_N, char * input_E,
-                               data_t * result_str, int result )
+void mbedtls_rsa_pkcs1_verify(data_t *message_str, int padding_mode,
+                              int digest, int mod,
+                              char *input_N, char *input_E,
+                              data_t *result_str, int result)
 {
     unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
     mbedtls_rsa_context ctx;
 
     mbedtls_mpi N, E;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx, padding_mode, 0 );
-    memset( hash_result, 0x00, sizeof( hash_result ) );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx, padding_mode, 0);
+    memset(hash_result, 0x00, sizeof(hash_result));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, NULL, NULL, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( mod / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, NULL, NULL, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) (mod / 8));
+    TEST_ASSERT(mbedtls_rsa_check_pubkey(&ctx) == 0);
 
 
-    if( mbedtls_md_info_from_type( digest ) != NULL )
-        TEST_ASSERT( mbedtls_md( mbedtls_md_info_from_type( digest ), message_str->x, message_str->len, hash_result ) == 0 );
+    if (mbedtls_md_info_from_type(digest) != NULL) {
+        TEST_ASSERT(mbedtls_md(mbedtls_md_info_from_type(digest), message_str->x, message_str->len,
+                               hash_result) == 0);
+    }
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_verify( &ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC, digest, 0, hash_result, result_str->x ) == result );
+    TEST_ASSERT(mbedtls_rsa_pkcs1_verify(&ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC, digest, 0,
+                                         hash_result, result_str->x) == result);
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 
 /* BEGIN_CASE */
-void rsa_pkcs1_sign_raw( data_t * hash_result,
-                         int padding_mode, int mod,
-                         char * input_P, char * input_Q,
-                         char * input_N, char * input_E,
-                         data_t * result_str )
+void rsa_pkcs1_sign_raw(data_t *hash_result,
+                        int padding_mode, int mod,
+                        char *input_P, char *input_Q,
+                        char *input_N, char *input_E,
+                        data_t *result_str)
 {
     unsigned char output[256];
     mbedtls_rsa_context ctx;
     mbedtls_mpi N, P, Q, E;
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    mbedtls_rsa_init( &ctx, padding_mode, 0 );
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &P );
-    mbedtls_mpi_init( &Q ); mbedtls_mpi_init( &E );
+    mbedtls_rsa_init(&ctx, padding_mode, 0);
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E);
 
-    memset( output, 0x00, sizeof( output ) );
-    memset( &rnd_info, 0, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    memset(output, 0x00, sizeof(output));
+    memset(&rnd_info, 0, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, &P, &Q, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( mod / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_complete( &ctx ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) (mod / 8));
+    TEST_ASSERT(mbedtls_rsa_complete(&ctx) == 0);
+    TEST_ASSERT(mbedtls_rsa_check_privkey(&ctx) == 0);
 
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_sign( &ctx, &mbedtls_test_rnd_pseudo_rand,
-                                         &rnd_info, MBEDTLS_RSA_PRIVATE,
-                                         MBEDTLS_MD_NONE, hash_result->len,
-                                         hash_result->x, output ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_pkcs1_sign(&ctx, &mbedtls_test_rnd_pseudo_rand,
+                                       &rnd_info, MBEDTLS_RSA_PRIVATE,
+                                       MBEDTLS_MD_NONE, hash_result->len,
+                                       hash_result->x, output) == 0);
 
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                      ctx.len, result_str->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, result_str->x,
+                                    ctx.len, result_str->len) == 0);
 
 #if defined(MBEDTLS_PKCS1_V15)
     /* For PKCS#1 v1.5, there is an alternative way to generate signatures */
-    if( padding_mode == MBEDTLS_RSA_PKCS_V15 )
-    {
+    if (padding_mode == MBEDTLS_RSA_PKCS_V15) {
         int res;
-        memset( output, 0x00, sizeof( output) );
+        memset(output, 0x00, sizeof(output));
 
-        res = mbedtls_rsa_rsaes_pkcs1_v15_encrypt( &ctx,
-                  &mbedtls_test_rnd_pseudo_rand, &rnd_info,
-                  MBEDTLS_RSA_PRIVATE, hash_result->len,
-                  hash_result->x, output );
+        res = mbedtls_rsa_rsaes_pkcs1_v15_encrypt(&ctx,
+                                                  &mbedtls_test_rnd_pseudo_rand, &rnd_info,
+                                                  MBEDTLS_RSA_PRIVATE, hash_result->len,
+                                                  hash_result->x, output);
 
 #if !defined(MBEDTLS_RSA_ALT)
-        TEST_ASSERT( res == 0 );
+        TEST_ASSERT(res == 0);
 #else
-        TEST_ASSERT( ( res == 0 ) ||
-                     ( res == MBEDTLS_ERR_RSA_UNSUPPORTED_OPERATION ) );
+        TEST_ASSERT((res == 0) ||
+                    (res == MBEDTLS_ERR_RSA_UNSUPPORTED_OPERATION));
 #endif
 
-        if( res == 0 )
-        {
-            TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                              ctx.len,
-                                              result_str->len ) == 0 );
+        if (res == 0) {
+            TEST_ASSERT(mbedtls_test_hexcmp(output, result_str->x,
+                                            ctx.len,
+                                            result_str->len) == 0);
         }
     }
 #endif /* MBEDTLS_PKCS1_V15 */
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &P );
-    mbedtls_mpi_free( &Q ); mbedtls_mpi_free( &E );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&P);
+    mbedtls_mpi_free(&Q); mbedtls_mpi_free(&E);
 
-    mbedtls_rsa_free( &ctx );
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void rsa_pkcs1_verify_raw( data_t * hash_result,
-                           int padding_mode, int mod,
-                           char * input_N, char * input_E,
-                           data_t * result_str, int correct )
+void rsa_pkcs1_verify_raw(data_t *hash_result,
+                          int padding_mode, int mod,
+                          char *input_N, char *input_E,
+                          data_t *result_str, int correct)
 {
     unsigned char output[256];
     mbedtls_rsa_context ctx;
 
     mbedtls_mpi N, E;
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&E);
 
-    mbedtls_rsa_init( &ctx, padding_mode, 0 );
-    memset( output, 0x00, sizeof( output ) );
+    mbedtls_rsa_init(&ctx, padding_mode, 0);
+    memset(output, 0x00, sizeof(output));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, NULL, NULL, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( mod / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, NULL, NULL, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) (mod / 8));
+    TEST_ASSERT(mbedtls_rsa_check_pubkey(&ctx) == 0);
 
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_verify( &ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC, MBEDTLS_MD_NONE, hash_result->len, hash_result->x, result_str->x ) == correct );
+    TEST_ASSERT(mbedtls_rsa_pkcs1_verify(&ctx, NULL, NULL, MBEDTLS_RSA_PUBLIC, MBEDTLS_MD_NONE,
+                                         hash_result->len, hash_result->x,
+                                         result_str->x) == correct);
 
 #if defined(MBEDTLS_PKCS1_V15)
     /* For PKCS#1 v1.5, there is an alternative way to verify signatures */
-    if( padding_mode == MBEDTLS_RSA_PKCS_V15 )
-    {
+    if (padding_mode == MBEDTLS_RSA_PKCS_V15) {
         int res;
         int ok;
         size_t olen;
 
-        res = mbedtls_rsa_rsaes_pkcs1_v15_decrypt( &ctx,
-                    NULL, NULL, MBEDTLS_RSA_PUBLIC,
-                    &olen, result_str->x, output, sizeof( output ) );
+        res = mbedtls_rsa_rsaes_pkcs1_v15_decrypt(&ctx,
+                                                  NULL, NULL, MBEDTLS_RSA_PUBLIC,
+                                                  &olen, result_str->x, output, sizeof(output));
 
 #if !defined(MBEDTLS_RSA_ALT)
-        TEST_ASSERT( res == 0 );
+        TEST_ASSERT(res == 0);
 #else
-        TEST_ASSERT( ( res == 0 ) ||
-                     ( res == MBEDTLS_ERR_RSA_UNSUPPORTED_OPERATION ) );
+        TEST_ASSERT((res == 0) ||
+                    (res == MBEDTLS_ERR_RSA_UNSUPPORTED_OPERATION));
 #endif
 
-        if( res == 0 )
-        {
-            ok = olen == hash_result->len && memcmp( output, hash_result->x, olen ) == 0;
-            if( correct == 0 )
-                TEST_ASSERT( ok == 1 );
-            else
-                TEST_ASSERT( ok == 0 );
+        if (res == 0) {
+            ok = olen == hash_result->len && memcmp(output, hash_result->x, olen) == 0;
+            if (correct == 0) {
+                TEST_ASSERT(ok == 1);
+            } else {
+                TEST_ASSERT(ok == 0);
+            }
         }
     }
 #endif /* MBEDTLS_PKCS1_V15 */
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_rsa_pkcs1_encrypt( data_t * message_str, int padding_mode,
-                                int mod, char * input_N, char * input_E,
-                                data_t * result_str, int result )
+void mbedtls_rsa_pkcs1_encrypt(data_t *message_str, int padding_mode,
+                               int mod, char *input_N, char *input_E,
+                               data_t *result_str, int result)
 {
     unsigned char output[256];
     mbedtls_rsa_context ctx;
     mbedtls_test_rnd_pseudo_info rnd_info;
 
     mbedtls_mpi N, E;
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&E);
 
-    memset( &rnd_info, 0, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    memset(&rnd_info, 0, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    mbedtls_rsa_init( &ctx, padding_mode, 0 );
-    memset( output, 0x00, sizeof( output ) );
+    mbedtls_rsa_init(&ctx, padding_mode, 0);
+    memset(output, 0x00, sizeof(output));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, NULL, NULL, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( mod / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, NULL, NULL, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) (mod / 8));
+    TEST_ASSERT(mbedtls_rsa_check_pubkey(&ctx) == 0);
 
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_encrypt( &ctx,
-                                            &mbedtls_test_rnd_pseudo_rand,
-                                            &rnd_info, MBEDTLS_RSA_PUBLIC,
-                                            message_str->len, message_str->x,
-                                            output ) == result );
-    if( result == 0 )
-    {
+    TEST_ASSERT(mbedtls_rsa_pkcs1_encrypt(&ctx,
+                                          &mbedtls_test_rnd_pseudo_rand,
+                                          &rnd_info, MBEDTLS_RSA_PUBLIC,
+                                          message_str->len, message_str->x,
+                                          output) == result);
+    if (result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                          ctx.len, result_str->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, result_str->x,
+                                        ctx.len, result_str->len) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void rsa_pkcs1_encrypt_bad_rng( data_t * message_str, int padding_mode,
-                                int mod, char * input_N, char * input_E,
-                                data_t * result_str, int result )
+void rsa_pkcs1_encrypt_bad_rng(data_t *message_str, int padding_mode,
+                               int mod, char *input_N, char *input_E,
+                               data_t *result_str, int result)
 {
     unsigned char output[256];
     mbedtls_rsa_context ctx;
 
     mbedtls_mpi N, E;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx, padding_mode, 0 );
-    memset( output, 0x00, sizeof( output ) );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx, padding_mode, 0);
+    memset(output, 0x00, sizeof(output));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, NULL, NULL, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( mod / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, NULL, NULL, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) (mod / 8));
+    TEST_ASSERT(mbedtls_rsa_check_pubkey(&ctx) == 0);
 
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_encrypt( &ctx, &mbedtls_test_rnd_zero_rand,
-                                            NULL, MBEDTLS_RSA_PUBLIC,
-                                            message_str->len, message_str->x,
-                                            output ) == result );
-    if( result == 0 )
-    {
+    TEST_ASSERT(mbedtls_rsa_pkcs1_encrypt(&ctx, &mbedtls_test_rnd_zero_rand,
+                                          NULL, MBEDTLS_RSA_PUBLIC,
+                                          message_str->len, message_str->x,
+                                          output) == result);
+    if (result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                          ctx.len, result_str->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, result_str->x,
+                                        ctx.len, result_str->len) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_rsa_pkcs1_decrypt( data_t * message_str, int padding_mode,
-                                int mod, char * input_P,
-                                char * input_Q, char * input_N,
-                                char * input_E, int max_output,
-                                data_t * result_str, int result )
+void mbedtls_rsa_pkcs1_decrypt(data_t *message_str, int padding_mode,
+                               int mod, char *input_P,
+                               char *input_Q, char *input_N,
+                               char *input_E, int max_output,
+                               data_t *result_str, int result)
 {
     unsigned char output[32];
     mbedtls_rsa_context ctx;
@@ -827,107 +829,104 @@
     mbedtls_test_rnd_pseudo_info rnd_info;
     mbedtls_mpi N, P, Q, E;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &P );
-    mbedtls_mpi_init( &Q ); mbedtls_mpi_init( &E );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E);
 
-    mbedtls_rsa_init( &ctx, padding_mode, 0 );
+    mbedtls_rsa_init(&ctx, padding_mode, 0);
 
-    memset( output, 0x00, sizeof( output ) );
-    memset( &rnd_info, 0, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    memset(output, 0x00, sizeof(output));
+    memset(&rnd_info, 0, sizeof(mbedtls_test_rnd_pseudo_info));
 
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, &P, &Q, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( mod / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_complete( &ctx ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) (mod / 8));
+    TEST_ASSERT(mbedtls_rsa_complete(&ctx) == 0);
+    TEST_ASSERT(mbedtls_rsa_check_privkey(&ctx) == 0);
 
     output_len = 0;
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_decrypt( &ctx, mbedtls_test_rnd_pseudo_rand,
-                                            &rnd_info, MBEDTLS_RSA_PRIVATE,
-                                            &output_len, message_str->x, output,
-                                            max_output ) == result );
-    if( result == 0 )
-    {
+    TEST_ASSERT(mbedtls_rsa_pkcs1_decrypt(&ctx, mbedtls_test_rnd_pseudo_rand,
+                                          &rnd_info, MBEDTLS_RSA_PRIVATE,
+                                          &output_len, message_str->x, output,
+                                          max_output) == result);
+    if (result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                          output_len,
-                                          result_str->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, result_str->x,
+                                        output_len,
+                                        result_str->len) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &P );
-    mbedtls_mpi_free( &Q ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&P);
+    mbedtls_mpi_free(&Q); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_rsa_public( data_t * message_str, int mod,
-                         char * input_N, char * input_E,
-                         data_t * result_str, int result )
+void mbedtls_rsa_public(data_t *message_str, int mod,
+                        char *input_N, char *input_E,
+                        data_t *result_str, int result)
 {
     unsigned char output[256];
     mbedtls_rsa_context ctx, ctx2; /* Also test mbedtls_rsa_copy() while at it */
 
     mbedtls_mpi N, E;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V15, 0 );
-    mbedtls_rsa_init( &ctx2, MBEDTLS_RSA_PKCS_V15, 0 );
-    memset( output, 0x00, sizeof( output ) );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V15, 0);
+    mbedtls_rsa_init(&ctx2, MBEDTLS_RSA_PKCS_V15, 0);
+    memset(output, 0x00, sizeof(output));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, NULL, NULL, NULL, &E ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, NULL, NULL, NULL, &E) == 0);
 
     /* Check test data consistency */
-    TEST_ASSERT( message_str->len == (size_t) ( mod / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( mod / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == 0 );
+    TEST_ASSERT(message_str->len == (size_t) (mod / 8));
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) (mod / 8));
+    TEST_ASSERT(mbedtls_rsa_check_pubkey(&ctx) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_public( &ctx, message_str->x, output ) == result );
-    if( result == 0 )
-    {
+    TEST_ASSERT(mbedtls_rsa_public(&ctx, message_str->x, output) == result);
+    if (result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                          ctx.len, result_str->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, result_str->x,
+                                        ctx.len, result_str->len) == 0);
     }
 
     /* And now with the copy */
-    TEST_ASSERT( mbedtls_rsa_copy( &ctx2, &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_copy(&ctx2, &ctx) == 0);
     /* clear the original to be sure */
-    mbedtls_rsa_free( &ctx );
+    mbedtls_rsa_free(&ctx);
 
-    TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx2 ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_check_pubkey(&ctx2) == 0);
 
-    memset( output, 0x00, sizeof( output ) );
-    TEST_ASSERT( mbedtls_rsa_public( &ctx2, message_str->x, output ) == result );
-    if( result == 0 )
-    {
+    memset(output, 0x00, sizeof(output));
+    TEST_ASSERT(mbedtls_rsa_public(&ctx2, message_str->x, output) == result);
+    if (result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                          ctx.len, result_str->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, result_str->x,
+                                        ctx.len, result_str->len) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
-    mbedtls_rsa_free( &ctx2 );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
+    mbedtls_rsa_free(&ctx2);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_rsa_private( data_t * message_str, int mod,
-                          char * input_P, char * input_Q,
-                          char * input_N, char * input_E,
-                          data_t * result_str, int result )
+void mbedtls_rsa_private(data_t *message_str, int mod,
+                         char *input_P, char *input_Q,
+                         char *input_N, char *input_E,
+                         data_t *result_str, int result)
 {
     unsigned char output[256];
     mbedtls_rsa_context ctx, ctx2; /* Also test mbedtls_rsa_copy() while at it */
@@ -935,149 +934,136 @@
     mbedtls_test_rnd_pseudo_info rnd_info;
     int i;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &P );
-    mbedtls_mpi_init( &Q ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V15, 0 );
-    mbedtls_rsa_init( &ctx2, MBEDTLS_RSA_PKCS_V15, 0 );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q); mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V15, 0);
+    mbedtls_rsa_init(&ctx2, MBEDTLS_RSA_PKCS_V15, 0);
 
-    memset( &rnd_info, 0, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    memset(&rnd_info, 0, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, &P, &Q, NULL, &E ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, &P, &Q, NULL, &E) == 0);
 
     /* Check test data consistency */
-    TEST_ASSERT( message_str->len == (size_t) ( mod / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_get_len( &ctx ) == (size_t) ( mod / 8 ) );
-    TEST_ASSERT( mbedtls_rsa_complete( &ctx ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == 0 );
+    TEST_ASSERT(message_str->len == (size_t) (mod / 8));
+    TEST_ASSERT(mbedtls_rsa_get_len(&ctx) == (size_t) (mod / 8));
+    TEST_ASSERT(mbedtls_rsa_complete(&ctx) == 0);
+    TEST_ASSERT(mbedtls_rsa_check_privkey(&ctx) == 0);
 
     /* repeat three times to test updating of blinding values */
-    for( i = 0; i < 3; i++ )
-    {
-        memset( output, 0x00, sizeof( output ) );
-        TEST_ASSERT( mbedtls_rsa_private( &ctx, mbedtls_test_rnd_pseudo_rand,
-                                          &rnd_info, message_str->x,
-                                          output ) == result );
-        if( result == 0 )
-        {
+    for (i = 0; i < 3; i++) {
+        memset(output, 0x00, sizeof(output));
+        TEST_ASSERT(mbedtls_rsa_private(&ctx, mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info, message_str->x,
+                                        output) == result);
+        if (result == 0) {
 
-            TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                              ctx.len,
-                                              result_str->len ) == 0 );
+            TEST_ASSERT(mbedtls_test_hexcmp(output, result_str->x,
+                                            ctx.len,
+                                            result_str->len) == 0);
         }
     }
 
     /* And now one more time with the copy */
-    TEST_ASSERT( mbedtls_rsa_copy( &ctx2, &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_copy(&ctx2, &ctx) == 0);
     /* clear the original to be sure */
-    mbedtls_rsa_free( &ctx );
+    mbedtls_rsa_free(&ctx);
 
-    TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx2 ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_check_privkey(&ctx2) == 0);
 
-    memset( output, 0x00, sizeof( output ) );
-    TEST_ASSERT( mbedtls_rsa_private( &ctx2, mbedtls_test_rnd_pseudo_rand,
-                                      &rnd_info, message_str->x,
-                                      output ) == result );
-    if( result == 0 )
-    {
+    memset(output, 0x00, sizeof(output));
+    TEST_ASSERT(mbedtls_rsa_private(&ctx2, mbedtls_test_rnd_pseudo_rand,
+                                    &rnd_info, message_str->x,
+                                    output) == result);
+    if (result == 0) {
 
-        TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                          ctx2.len,
-                                          result_str->len ) == 0 );
+        TEST_ASSERT(mbedtls_test_hexcmp(output, result_str->x,
+                                        ctx2.len,
+                                        result_str->len) == 0);
     }
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &P );
-    mbedtls_mpi_free( &Q ); mbedtls_mpi_free( &E );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&P);
+    mbedtls_mpi_free(&Q); mbedtls_mpi_free(&E);
 
-    mbedtls_rsa_free( &ctx ); mbedtls_rsa_free( &ctx2 );
+    mbedtls_rsa_free(&ctx); mbedtls_rsa_free(&ctx2);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void rsa_check_privkey_null(  )
+void rsa_check_privkey_null()
 {
     mbedtls_rsa_context ctx;
-    memset( &ctx, 0x00, sizeof( mbedtls_rsa_context ) );
+    memset(&ctx, 0x00, sizeof(mbedtls_rsa_context));
 
-    TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == MBEDTLS_ERR_RSA_KEY_CHECK_FAILED );
+    TEST_ASSERT(mbedtls_rsa_check_privkey(&ctx) == MBEDTLS_ERR_RSA_KEY_CHECK_FAILED);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_rsa_check_pubkey( char * input_N, char * input_E, int result )
+void mbedtls_rsa_check_pubkey(char *input_N, char *input_E, int result)
 {
     mbedtls_rsa_context ctx;
     mbedtls_mpi N, E;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V15, 0 );
+    mbedtls_mpi_init(&N); mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V15, 0);
 
-    if( strlen( input_N ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
+    if (strlen(input_N)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
     }
-    if( strlen( input_E ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
+    if (strlen(input_E)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
     }
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx, &N, NULL, NULL, NULL, &E ) == 0 );
-    TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == result );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx, &N, NULL, NULL, NULL, &E) == 0);
+    TEST_ASSERT(mbedtls_rsa_check_pubkey(&ctx) == result);
 
 exit:
-    mbedtls_mpi_free( &N ); mbedtls_mpi_free( &E );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_mpi_free(&N); mbedtls_mpi_free(&E);
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_rsa_check_privkey( int mod, char * input_P, char * input_Q,
-                                char * input_N, char * input_E, char * input_D,
-                                char * input_DP, char * input_DQ, char * input_QP,
-                                int result )
+void mbedtls_rsa_check_privkey(int mod, char *input_P, char *input_Q,
+                               char *input_N, char *input_E, char *input_D,
+                               char *input_DP, char *input_DQ, char *input_QP,
+                               int result)
 {
     mbedtls_rsa_context ctx;
 
-    mbedtls_rsa_init( &ctx, MBEDTLS_RSA_PKCS_V15, 0 );
+    mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V15, 0);
 
     ctx.len = mod / 8;
-    if( strlen( input_P ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.P, input_P ) == 0 );
+    if (strlen(input_P)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.P, input_P) == 0);
     }
-    if( strlen( input_Q ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.Q, input_Q ) == 0 );
+    if (strlen(input_Q)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.Q, input_Q) == 0);
     }
-    if( strlen( input_N ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.N, input_N ) == 0 );
+    if (strlen(input_N)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.N, input_N) == 0);
     }
-    if( strlen( input_E ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.E, input_E ) == 0 );
+    if (strlen(input_E)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.E, input_E) == 0);
     }
-    if( strlen( input_D ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.D, input_D ) == 0 );
+    if (strlen(input_D)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.D, input_D) == 0);
     }
 #if !defined(MBEDTLS_RSA_NO_CRT)
-    if( strlen( input_DP ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.DP, input_DP ) == 0 );
+    if (strlen(input_DP)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.DP, input_DP) == 0);
     }
-    if( strlen( input_DQ ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.DQ, input_DQ ) == 0 );
+    if (strlen(input_DQ)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.DQ, input_DQ) == 0);
     }
-    if( strlen( input_QP ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.QP, input_QP ) == 0 );
+    if (strlen(input_QP)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.QP, input_QP) == 0);
     }
 #else
     ((void) input_DP);
@@ -1085,68 +1071,58 @@
     ((void) input_QP);
 #endif
 
-    TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == result );
+    TEST_ASSERT(mbedtls_rsa_check_privkey(&ctx) == result);
 
 exit:
-    mbedtls_rsa_free( &ctx );
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void rsa_check_pubpriv( int mod, char * input_Npub, char * input_Epub,
-                        char * input_P, char * input_Q, char * input_N,
-                        char * input_E, char * input_D, char * input_DP,
-                        char * input_DQ, char * input_QP, int result )
+void rsa_check_pubpriv(int mod, char *input_Npub, char *input_Epub,
+                       char *input_P, char *input_Q, char *input_N,
+                       char *input_E, char *input_D, char *input_DP,
+                       char *input_DQ, char *input_QP, int result)
 {
     mbedtls_rsa_context pub, prv;
 
-    mbedtls_rsa_init( &pub, MBEDTLS_RSA_PKCS_V15, 0 );
-    mbedtls_rsa_init( &prv, MBEDTLS_RSA_PKCS_V15, 0 );
+    mbedtls_rsa_init(&pub, MBEDTLS_RSA_PKCS_V15, 0);
+    mbedtls_rsa_init(&prv, MBEDTLS_RSA_PKCS_V15, 0);
 
     pub.len = mod / 8;
     prv.len = mod / 8;
 
-    if( strlen( input_Npub ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &pub.N, input_Npub ) == 0 );
+    if (strlen(input_Npub)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&pub.N, input_Npub) == 0);
     }
-    if( strlen( input_Epub ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &pub.E, input_Epub ) == 0 );
+    if (strlen(input_Epub)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&pub.E, input_Epub) == 0);
     }
 
-    if( strlen( input_P ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.P, input_P ) == 0 );
+    if (strlen(input_P)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.P, input_P) == 0);
     }
-    if( strlen( input_Q ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.Q, input_Q ) == 0 );
+    if (strlen(input_Q)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.Q, input_Q) == 0);
     }
-    if( strlen( input_N ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.N, input_N ) == 0 );
+    if (strlen(input_N)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.N, input_N) == 0);
     }
-    if( strlen( input_E ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.E, input_E ) == 0 );
+    if (strlen(input_E)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.E, input_E) == 0);
     }
-    if( strlen( input_D ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.D, input_D ) == 0 );
+    if (strlen(input_D)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.D, input_D) == 0);
     }
 #if !defined(MBEDTLS_RSA_NO_CRT)
-    if( strlen( input_DP ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.DP, input_DP ) == 0 );
+    if (strlen(input_DP)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.DP, input_DP) == 0);
     }
-    if( strlen( input_DQ ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.DQ, input_DQ ) == 0 );
+    if (strlen(input_DQ)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.DQ, input_DQ) == 0);
     }
-    if( strlen( input_QP ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.QP, input_QP ) == 0 );
+    if (strlen(input_QP)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.QP, input_QP) == 0);
     }
 #else
     ((void) input_DP);
@@ -1154,155 +1130,153 @@
     ((void) input_QP);
 #endif
 
-    TEST_ASSERT( mbedtls_rsa_check_pub_priv( &pub, &prv ) == result );
+    TEST_ASSERT(mbedtls_rsa_check_pub_priv(&pub, &prv) == result);
 
 exit:
-    mbedtls_rsa_free( &pub );
-    mbedtls_rsa_free( &prv );
+    mbedtls_rsa_free(&pub);
+    mbedtls_rsa_free(&prv);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CTR_DRBG_C:MBEDTLS_ENTROPY_C:ENTROPY_HAVE_STRONG */
-void mbedtls_rsa_gen_key( int nrbits, int exponent, int result)
+void mbedtls_rsa_gen_key(int nrbits, int exponent, int result)
 {
     mbedtls_rsa_context ctx;
     mbedtls_entropy_context entropy;
     mbedtls_ctr_drbg_context ctr_drbg;
     const char *pers = "test_suite_rsa";
 
-    mbedtls_ctr_drbg_init( &ctr_drbg );
-    mbedtls_entropy_init( &entropy );
-    mbedtls_rsa_init ( &ctx, 0, 0 );
+    mbedtls_ctr_drbg_init(&ctr_drbg);
+    mbedtls_entropy_init(&entropy);
+    mbedtls_rsa_init(&ctx, 0, 0);
 
-    TEST_ASSERT( mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func,
-                                        &entropy, (const unsigned char *) pers,
-                                        strlen( pers ) ) == 0 );
+    TEST_ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func,
+                                      &entropy, (const unsigned char *) pers,
+                                      strlen(pers)) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_gen_key( &ctx, mbedtls_ctr_drbg_random, &ctr_drbg, nrbits, exponent ) == result );
-    if( result == 0 )
-    {
-        TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == 0 );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &ctx.P, &ctx.Q ) > 0 );
+    TEST_ASSERT(mbedtls_rsa_gen_key(&ctx, mbedtls_ctr_drbg_random, &ctr_drbg, nrbits,
+                                    exponent) == result);
+    if (result == 0) {
+        TEST_ASSERT(mbedtls_rsa_check_privkey(&ctx) == 0);
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&ctx.P, &ctx.Q) > 0);
     }
 
 exit:
-    mbedtls_rsa_free( &ctx );
-    mbedtls_ctr_drbg_free( &ctr_drbg );
-    mbedtls_entropy_free( &entropy );
+    mbedtls_rsa_free(&ctx);
+    mbedtls_ctr_drbg_free(&ctr_drbg);
+    mbedtls_entropy_free(&entropy);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CTR_DRBG_C:MBEDTLS_ENTROPY_C */
-void mbedtls_rsa_deduce_primes( char *input_N,
-                                char *input_D,
-                                char *input_E,
-                                char *output_P,
-                                char *output_Q,
-                                int corrupt, int result )
+void mbedtls_rsa_deduce_primes(char *input_N,
+                               char *input_D,
+                               char *input_E,
+                               char *output_P,
+                               char *output_Q,
+                               int corrupt, int result)
 {
     mbedtls_mpi N, P, Pp, Q, Qp, D, E;
 
-    mbedtls_mpi_init( &N );
-    mbedtls_mpi_init( &P );  mbedtls_mpi_init( &Q  );
-    mbedtls_mpi_init( &Pp ); mbedtls_mpi_init( &Qp );
-    mbedtls_mpi_init( &D ); mbedtls_mpi_init( &E );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&P);  mbedtls_mpi_init(&Q);
+    mbedtls_mpi_init(&Pp); mbedtls_mpi_init(&Qp);
+    mbedtls_mpi_init(&D); mbedtls_mpi_init(&E);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &D, input_D ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Qp, output_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Pp, output_Q ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&D, input_D) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Qp, output_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Pp, output_Q) == 0);
 
-    if( corrupt )
-        TEST_ASSERT( mbedtls_mpi_add_int( &D, &D, 2 ) == 0 );
+    if (corrupt) {
+        TEST_ASSERT(mbedtls_mpi_add_int(&D, &D, 2) == 0);
+    }
 
     /* Try to deduce P, Q from N, D, E only. */
-    TEST_ASSERT( mbedtls_rsa_deduce_primes( &N, &D, &E, &P, &Q ) == result );
+    TEST_ASSERT(mbedtls_rsa_deduce_primes(&N, &D, &E, &P, &Q) == result);
 
-    if( !corrupt )
-    {
+    if (!corrupt) {
         /* Check if (P,Q) = (Pp, Qp) or (P,Q) = (Qp, Pp) */
-        TEST_ASSERT( ( mbedtls_mpi_cmp_mpi( &P, &Pp ) == 0 && mbedtls_mpi_cmp_mpi( &Q, &Qp ) == 0 ) ||
-                     ( mbedtls_mpi_cmp_mpi( &P, &Qp ) == 0 && mbedtls_mpi_cmp_mpi( &Q, &Pp ) == 0 ) );
+        TEST_ASSERT((mbedtls_mpi_cmp_mpi(&P, &Pp) == 0 && mbedtls_mpi_cmp_mpi(&Q, &Qp) == 0) ||
+                    (mbedtls_mpi_cmp_mpi(&P, &Qp) == 0 && mbedtls_mpi_cmp_mpi(&Q, &Pp) == 0));
     }
 
 exit:
-    mbedtls_mpi_free( &N );
-    mbedtls_mpi_free( &P  ); mbedtls_mpi_free( &Q  );
-    mbedtls_mpi_free( &Pp ); mbedtls_mpi_free( &Qp );
-    mbedtls_mpi_free( &D ); mbedtls_mpi_free( &E );
+    mbedtls_mpi_free(&N);
+    mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q);
+    mbedtls_mpi_free(&Pp); mbedtls_mpi_free(&Qp);
+    mbedtls_mpi_free(&D); mbedtls_mpi_free(&E);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_rsa_deduce_private_exponent( char *input_P,
-                                          char *input_Q,
-                                          char *input_E,
-                                          char *output_D,
-                                          int corrupt, int result )
+void mbedtls_rsa_deduce_private_exponent(char *input_P,
+                                         char *input_Q,
+                                         char *input_E,
+                                         char *output_D,
+                                         int corrupt, int result)
 {
     mbedtls_mpi P, Q, D, Dp, E, R, Rp;
 
-    mbedtls_mpi_init( &P ); mbedtls_mpi_init( &Q );
-    mbedtls_mpi_init( &D ); mbedtls_mpi_init( &Dp );
-    mbedtls_mpi_init( &E );
-    mbedtls_mpi_init( &R ); mbedtls_mpi_init( &Rp );
+    mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q);
+    mbedtls_mpi_init(&D); mbedtls_mpi_init(&Dp);
+    mbedtls_mpi_init(&E);
+    mbedtls_mpi_init(&R); mbedtls_mpi_init(&Rp);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Dp, output_D ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Dp, output_D) == 0);
 
-    if( corrupt )
-    {
+    if (corrupt) {
         /* Make E even */
-        TEST_ASSERT( mbedtls_mpi_set_bit( &E, 0, 0 ) == 0 );
+        TEST_ASSERT(mbedtls_mpi_set_bit(&E, 0, 0) == 0);
     }
 
     /* Try to deduce D from N, P, Q, E. */
-    TEST_ASSERT( mbedtls_rsa_deduce_private_exponent( &P, &Q,
-                                                      &E, &D ) == result );
+    TEST_ASSERT(mbedtls_rsa_deduce_private_exponent(&P, &Q,
+                                                    &E, &D) == result);
 
-    if( !corrupt )
-    {
+    if (!corrupt) {
         /*
          * Check that D and Dp agree modulo LCM(P-1, Q-1).
          */
 
         /* Replace P,Q by P-1, Q-1 */
-        TEST_ASSERT( mbedtls_mpi_sub_int( &P, &P, 1 ) == 0 );
-        TEST_ASSERT( mbedtls_mpi_sub_int( &Q, &Q, 1 ) == 0 );
+        TEST_ASSERT(mbedtls_mpi_sub_int(&P, &P, 1) == 0);
+        TEST_ASSERT(mbedtls_mpi_sub_int(&Q, &Q, 1) == 0);
 
         /* Check D == Dp modulo P-1 */
-        TEST_ASSERT( mbedtls_mpi_mod_mpi( &R,  &D,  &P ) == 0 );
-        TEST_ASSERT( mbedtls_mpi_mod_mpi( &Rp, &Dp, &P ) == 0 );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R,  &Rp )     == 0 );
+        TEST_ASSERT(mbedtls_mpi_mod_mpi(&R,  &D,  &P) == 0);
+        TEST_ASSERT(mbedtls_mpi_mod_mpi(&Rp, &Dp, &P) == 0);
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R,  &Rp)     == 0);
 
         /* Check D == Dp modulo Q-1 */
-        TEST_ASSERT( mbedtls_mpi_mod_mpi( &R,  &D,  &Q ) == 0 );
-        TEST_ASSERT( mbedtls_mpi_mod_mpi( &Rp, &Dp, &Q ) == 0 );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &R,  &Rp )     == 0 );
+        TEST_ASSERT(mbedtls_mpi_mod_mpi(&R,  &D,  &Q) == 0);
+        TEST_ASSERT(mbedtls_mpi_mod_mpi(&Rp, &Dp, &Q) == 0);
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&R,  &Rp)     == 0);
     }
 
 exit:
 
-    mbedtls_mpi_free( &P ); mbedtls_mpi_free( &Q  );
-    mbedtls_mpi_free( &D ); mbedtls_mpi_free( &Dp );
-    mbedtls_mpi_free( &E );
-    mbedtls_mpi_free( &R ); mbedtls_mpi_free( &Rp );
+    mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q);
+    mbedtls_mpi_free(&D); mbedtls_mpi_free(&Dp);
+    mbedtls_mpi_free(&E);
+    mbedtls_mpi_free(&R); mbedtls_mpi_free(&Rp);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CTR_DRBG_C:MBEDTLS_ENTROPY_C:ENTROPY_HAVE_STRONG */
-void mbedtls_rsa_import( char *input_N,
-                         char *input_P,
-                         char *input_Q,
-                         char *input_D,
-                         char *input_E,
-                         int successive,
-                         int is_priv,
-                         int res_check,
-                         int res_complete )
+void mbedtls_rsa_import(char *input_N,
+                        char *input_P,
+                        char *input_Q,
+                        char *input_D,
+                        char *input_E,
+                        int successive,
+                        int is_priv,
+                        int res_check,
+                        int res_complete)
 {
     mbedtls_mpi N, P, Q, D, E;
     mbedtls_rsa_context ctx;
@@ -1316,140 +1290,143 @@
     mbedtls_ctr_drbg_context ctr_drbg;
     const char *pers = "test_suite_rsa";
 
-    const int have_N = ( strlen( input_N ) > 0 );
-    const int have_P = ( strlen( input_P ) > 0 );
-    const int have_Q = ( strlen( input_Q ) > 0 );
-    const int have_D = ( strlen( input_D ) > 0 );
-    const int have_E = ( strlen( input_E ) > 0 );
+    const int have_N = (strlen(input_N) > 0);
+    const int have_P = (strlen(input_P) > 0);
+    const int have_Q = (strlen(input_Q) > 0);
+    const int have_D = (strlen(input_D) > 0);
+    const int have_E = (strlen(input_E) > 0);
 
-    mbedtls_ctr_drbg_init( &ctr_drbg );
-    mbedtls_entropy_init( &entropy );
-    mbedtls_rsa_init( &ctx, 0, 0 );
+    mbedtls_ctr_drbg_init(&ctr_drbg);
+    mbedtls_entropy_init(&entropy);
+    mbedtls_rsa_init(&ctx, 0, 0);
 
-    mbedtls_mpi_init( &N );
-    mbedtls_mpi_init( &P ); mbedtls_mpi_init( &Q );
-    mbedtls_mpi_init( &D ); mbedtls_mpi_init( &E );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q);
+    mbedtls_mpi_init(&D); mbedtls_mpi_init(&E);
 
-    TEST_ASSERT( mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy,
-                                (const unsigned char *) pers, strlen( pers ) ) == 0 );
+    TEST_ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy,
+                                      (const unsigned char *) pers, strlen(pers)) == 0);
 
-    if( have_N )
-        TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
-
-    if( have_P )
-        TEST_ASSERT( mbedtls_test_read_mpi( &P, input_P ) == 0 );
-
-    if( have_Q )
-        TEST_ASSERT( mbedtls_test_read_mpi( &Q, input_Q ) == 0 );
-
-    if( have_D )
-        TEST_ASSERT( mbedtls_test_read_mpi( &D, input_D ) == 0 );
-
-    if( have_E )
-        TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
-
-    if( !successive )
-    {
-        TEST_ASSERT( mbedtls_rsa_import( &ctx,
-                             have_N ? &N : NULL,
-                             have_P ? &P : NULL,
-                             have_Q ? &Q : NULL,
-                             have_D ? &D : NULL,
-                             have_E ? &E : NULL ) == 0 );
+    if (have_N) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
     }
-    else
-    {
+
+    if (have_P) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0);
+    }
+
+    if (have_Q) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0);
+    }
+
+    if (have_D) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&D, input_D) == 0);
+    }
+
+    if (have_E) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
+    }
+
+    if (!successive) {
+        TEST_ASSERT(mbedtls_rsa_import(&ctx,
+                                       have_N ? &N : NULL,
+                                       have_P ? &P : NULL,
+                                       have_Q ? &Q : NULL,
+                                       have_D ? &D : NULL,
+                                       have_E ? &E : NULL) == 0);
+    } else {
         /* Import N, P, Q, D, E separately.
          * This should make no functional difference. */
 
-        TEST_ASSERT( mbedtls_rsa_import( &ctx,
-                               have_N ? &N : NULL,
-                               NULL, NULL, NULL, NULL ) == 0 );
+        TEST_ASSERT(mbedtls_rsa_import(&ctx,
+                                       have_N ? &N : NULL,
+                                       NULL, NULL, NULL, NULL) == 0);
 
-        TEST_ASSERT( mbedtls_rsa_import( &ctx,
-                               NULL,
-                               have_P ? &P : NULL,
-                               NULL, NULL, NULL ) == 0 );
+        TEST_ASSERT(mbedtls_rsa_import(&ctx,
+                                       NULL,
+                                       have_P ? &P : NULL,
+                                       NULL, NULL, NULL) == 0);
 
-        TEST_ASSERT( mbedtls_rsa_import( &ctx,
-                               NULL, NULL,
-                               have_Q ? &Q : NULL,
-                               NULL, NULL ) == 0 );
+        TEST_ASSERT(mbedtls_rsa_import(&ctx,
+                                       NULL, NULL,
+                                       have_Q ? &Q : NULL,
+                                       NULL, NULL) == 0);
 
-        TEST_ASSERT( mbedtls_rsa_import( &ctx,
-                               NULL, NULL, NULL,
-                               have_D ? &D : NULL,
-                               NULL ) == 0 );
+        TEST_ASSERT(mbedtls_rsa_import(&ctx,
+                                       NULL, NULL, NULL,
+                                       have_D ? &D : NULL,
+                                       NULL) == 0);
 
-        TEST_ASSERT( mbedtls_rsa_import( &ctx,
-                               NULL, NULL, NULL, NULL,
-                               have_E ? &E : NULL ) == 0 );
+        TEST_ASSERT(mbedtls_rsa_import(&ctx,
+                                       NULL, NULL, NULL, NULL,
+                                       have_E ? &E : NULL) == 0);
     }
 
-    TEST_ASSERT( mbedtls_rsa_complete( &ctx ) == res_complete );
+    TEST_ASSERT(mbedtls_rsa_complete(&ctx) == res_complete);
 
     /* On expected success, perform some public and private
      * key operations to check if the key is working properly. */
-    if( res_complete == 0 )
-    {
-        if( is_priv )
-            TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == res_check );
-        else
-            TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == res_check );
+    if (res_complete == 0) {
+        if (is_priv) {
+            TEST_ASSERT(mbedtls_rsa_check_privkey(&ctx) == res_check);
+        } else {
+            TEST_ASSERT(mbedtls_rsa_check_pubkey(&ctx) == res_check);
+        }
 
-        if( res_check != 0 )
+        if (res_check != 0) {
             goto exit;
+        }
 
-        buf_orig = mbedtls_calloc( 1, mbedtls_rsa_get_len( &ctx ) );
-        buf_enc  = mbedtls_calloc( 1, mbedtls_rsa_get_len( &ctx ) );
-        buf_dec  = mbedtls_calloc( 1, mbedtls_rsa_get_len( &ctx ) );
-        if( buf_orig == NULL || buf_enc == NULL || buf_dec == NULL )
+        buf_orig = mbedtls_calloc(1, mbedtls_rsa_get_len(&ctx));
+        buf_enc  = mbedtls_calloc(1, mbedtls_rsa_get_len(&ctx));
+        buf_dec  = mbedtls_calloc(1, mbedtls_rsa_get_len(&ctx));
+        if (buf_orig == NULL || buf_enc == NULL || buf_dec == NULL) {
             goto exit;
+        }
 
-        TEST_ASSERT( mbedtls_ctr_drbg_random( &ctr_drbg,
-                              buf_orig, mbedtls_rsa_get_len( &ctx ) ) == 0 );
+        TEST_ASSERT(mbedtls_ctr_drbg_random(&ctr_drbg,
+                                            buf_orig, mbedtls_rsa_get_len(&ctx)) == 0);
 
         /* Make sure the number we're generating is smaller than the modulus */
         buf_orig[0] = 0x00;
 
-        TEST_ASSERT( mbedtls_rsa_public( &ctx, buf_orig, buf_enc ) == 0 );
+        TEST_ASSERT(mbedtls_rsa_public(&ctx, buf_orig, buf_enc) == 0);
 
-        if( is_priv )
-        {
-            TEST_ASSERT( mbedtls_rsa_private( &ctx, mbedtls_ctr_drbg_random,
-                                              &ctr_drbg, buf_enc,
-                                              buf_dec ) == 0 );
+        if (is_priv) {
+            TEST_ASSERT(mbedtls_rsa_private(&ctx, mbedtls_ctr_drbg_random,
+                                            &ctr_drbg, buf_enc,
+                                            buf_dec) == 0);
 
-            TEST_ASSERT( memcmp( buf_orig, buf_dec,
-                                 mbedtls_rsa_get_len( &ctx ) ) == 0 );
+            TEST_ASSERT(memcmp(buf_orig, buf_dec,
+                               mbedtls_rsa_get_len(&ctx)) == 0);
         }
     }
 
 exit:
 
-    mbedtls_free( buf_orig );
-    mbedtls_free( buf_enc  );
-    mbedtls_free( buf_dec  );
+    mbedtls_free(buf_orig);
+    mbedtls_free(buf_enc);
+    mbedtls_free(buf_dec);
 
-    mbedtls_rsa_free( &ctx );
+    mbedtls_rsa_free(&ctx);
 
-    mbedtls_ctr_drbg_free( &ctr_drbg );
-    mbedtls_entropy_free( &entropy );
+    mbedtls_ctr_drbg_free(&ctr_drbg);
+    mbedtls_entropy_free(&entropy);
 
-    mbedtls_mpi_free( &N );
-    mbedtls_mpi_free( &P ); mbedtls_mpi_free( &Q );
-    mbedtls_mpi_free( &D ); mbedtls_mpi_free( &E );
+    mbedtls_mpi_free(&N);
+    mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q);
+    mbedtls_mpi_free(&D); mbedtls_mpi_free(&E);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_rsa_export( char *input_N,
-                         char *input_P,
-                         char *input_Q,
-                         char *input_D,
-                         char *input_E,
-                         int is_priv,
-                         int successive )
+void mbedtls_rsa_export(char *input_N,
+                        char *input_P,
+                        char *input_Q,
+                        char *input_D,
+                        char *input_E,
+                        int is_priv,
+                        int successive)
 {
     /* Original MPI's with which we set up the RSA context */
     mbedtls_mpi N, P, Q, D, E;
@@ -1457,184 +1434,190 @@
     /* Exported MPI's */
     mbedtls_mpi Ne, Pe, Qe, De, Ee;
 
-    const int have_N = ( strlen( input_N ) > 0 );
-    const int have_P = ( strlen( input_P ) > 0 );
-    const int have_Q = ( strlen( input_Q ) > 0 );
-    const int have_D = ( strlen( input_D ) > 0 );
-    const int have_E = ( strlen( input_E ) > 0 );
+    const int have_N = (strlen(input_N) > 0);
+    const int have_P = (strlen(input_P) > 0);
+    const int have_Q = (strlen(input_Q) > 0);
+    const int have_D = (strlen(input_D) > 0);
+    const int have_E = (strlen(input_E) > 0);
 
     mbedtls_rsa_context ctx;
 
-    mbedtls_rsa_init( &ctx, 0, 0 );
+    mbedtls_rsa_init(&ctx, 0, 0);
 
-    mbedtls_mpi_init( &N );
-    mbedtls_mpi_init( &P ); mbedtls_mpi_init( &Q );
-    mbedtls_mpi_init( &D ); mbedtls_mpi_init( &E );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q);
+    mbedtls_mpi_init(&D); mbedtls_mpi_init(&E);
 
-    mbedtls_mpi_init( &Ne );
-    mbedtls_mpi_init( &Pe ); mbedtls_mpi_init( &Qe );
-    mbedtls_mpi_init( &De ); mbedtls_mpi_init( &Ee );
+    mbedtls_mpi_init(&Ne);
+    mbedtls_mpi_init(&Pe); mbedtls_mpi_init(&Qe);
+    mbedtls_mpi_init(&De); mbedtls_mpi_init(&Ee);
 
     /* Setup RSA context */
 
-    if( have_N )
-        TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
+    if (have_N) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    }
 
-    if( have_P )
-        TEST_ASSERT( mbedtls_test_read_mpi( &P, input_P ) == 0 );
+    if (have_P) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0);
+    }
 
-    if( have_Q )
-        TEST_ASSERT( mbedtls_test_read_mpi( &Q, input_Q ) == 0 );
+    if (have_Q) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0);
+    }
 
-    if( have_D )
-        TEST_ASSERT( mbedtls_test_read_mpi( &D, input_D ) == 0 );
+    if (have_D) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&D, input_D) == 0);
+    }
 
-    if( have_E )
-        TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
+    if (have_E) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
+    }
 
-    TEST_ASSERT( mbedtls_rsa_import( &ctx,
-                                     strlen( input_N ) ? &N : NULL,
-                                     strlen( input_P ) ? &P : NULL,
-                                     strlen( input_Q ) ? &Q : NULL,
-                                     strlen( input_D ) ? &D : NULL,
-                                     strlen( input_E ) ? &E : NULL ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import(&ctx,
+                                   strlen(input_N) ? &N : NULL,
+                                   strlen(input_P) ? &P : NULL,
+                                   strlen(input_Q) ? &Q : NULL,
+                                   strlen(input_D) ? &D : NULL,
+                                   strlen(input_E) ? &E : NULL) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_complete( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_complete(&ctx) == 0);
 
     /*
      * Export parameters and compare to original ones.
      */
 
     /* N and E must always be present. */
-    if( !successive )
-    {
-        TEST_ASSERT( mbedtls_rsa_export( &ctx, &Ne, NULL, NULL, NULL, &Ee ) == 0 );
+    if (!successive) {
+        TEST_ASSERT(mbedtls_rsa_export(&ctx, &Ne, NULL, NULL, NULL, &Ee) == 0);
+    } else {
+        TEST_ASSERT(mbedtls_rsa_export(&ctx, &Ne, NULL, NULL, NULL, NULL) == 0);
+        TEST_ASSERT(mbedtls_rsa_export(&ctx, NULL, NULL, NULL, NULL, &Ee) == 0);
     }
-    else
-    {
-        TEST_ASSERT( mbedtls_rsa_export( &ctx, &Ne, NULL, NULL, NULL, NULL ) == 0 );
-        TEST_ASSERT( mbedtls_rsa_export( &ctx, NULL, NULL, NULL, NULL, &Ee ) == 0 );
-    }
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &N, &Ne ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &E, &Ee ) == 0 );
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&N, &Ne) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&E, &Ee) == 0);
 
     /* If we were providing enough information to setup a complete private context,
      * we expect to be able to export all core parameters. */
 
-    if( is_priv )
-    {
-        if( !successive )
-        {
-            TEST_ASSERT( mbedtls_rsa_export( &ctx, NULL, &Pe, &Qe,
-                                             &De, NULL ) == 0 );
-        }
-        else
-        {
-            TEST_ASSERT( mbedtls_rsa_export( &ctx, NULL, &Pe, NULL,
-                                             NULL, NULL ) == 0 );
-            TEST_ASSERT( mbedtls_rsa_export( &ctx, NULL, NULL, &Qe,
-                                             NULL, NULL ) == 0 );
-            TEST_ASSERT( mbedtls_rsa_export( &ctx, NULL, NULL, NULL,
-                                             &De, NULL ) == 0 );
+    if (is_priv) {
+        if (!successive) {
+            TEST_ASSERT(mbedtls_rsa_export(&ctx, NULL, &Pe, &Qe,
+                                           &De, NULL) == 0);
+        } else {
+            TEST_ASSERT(mbedtls_rsa_export(&ctx, NULL, &Pe, NULL,
+                                           NULL, NULL) == 0);
+            TEST_ASSERT(mbedtls_rsa_export(&ctx, NULL, NULL, &Qe,
+                                           NULL, NULL) == 0);
+            TEST_ASSERT(mbedtls_rsa_export(&ctx, NULL, NULL, NULL,
+                                           &De, NULL) == 0);
         }
 
-        if( have_P )
-            TEST_ASSERT( mbedtls_mpi_cmp_mpi( &P, &Pe ) == 0 );
+        if (have_P) {
+            TEST_ASSERT(mbedtls_mpi_cmp_mpi(&P, &Pe) == 0);
+        }
 
-        if( have_Q )
-            TEST_ASSERT( mbedtls_mpi_cmp_mpi( &Q, &Qe ) == 0 );
+        if (have_Q) {
+            TEST_ASSERT(mbedtls_mpi_cmp_mpi(&Q, &Qe) == 0);
+        }
 
-        if( have_D )
-            TEST_ASSERT( mbedtls_mpi_cmp_mpi( &D, &De ) == 0 );
+        if (have_D) {
+            TEST_ASSERT(mbedtls_mpi_cmp_mpi(&D, &De) == 0);
+        }
 
         /* While at it, perform a sanity check */
-        TEST_ASSERT( mbedtls_rsa_validate_params( &Ne, &Pe, &Qe, &De, &Ee,
-                                                       NULL, NULL ) == 0 );
+        TEST_ASSERT(mbedtls_rsa_validate_params(&Ne, &Pe, &Qe, &De, &Ee,
+                                                NULL, NULL) == 0);
     }
 
 exit:
 
-    mbedtls_rsa_free( &ctx );
+    mbedtls_rsa_free(&ctx);
 
-    mbedtls_mpi_free( &N );
-    mbedtls_mpi_free( &P ); mbedtls_mpi_free( &Q );
-    mbedtls_mpi_free( &D ); mbedtls_mpi_free( &E );
+    mbedtls_mpi_free(&N);
+    mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q);
+    mbedtls_mpi_free(&D); mbedtls_mpi_free(&E);
 
-    mbedtls_mpi_free( &Ne );
-    mbedtls_mpi_free( &Pe ); mbedtls_mpi_free( &Qe );
-    mbedtls_mpi_free( &De ); mbedtls_mpi_free( &Ee );
+    mbedtls_mpi_free(&Ne);
+    mbedtls_mpi_free(&Pe); mbedtls_mpi_free(&Qe);
+    mbedtls_mpi_free(&De); mbedtls_mpi_free(&Ee);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_C:ENTROPY_HAVE_STRONG:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C */
-void mbedtls_rsa_validate_params( char *input_N,
-                                  char *input_P,
-                                  char *input_Q,
-                                  char *input_D,
-                                  char *input_E,
-                                  int prng, int result )
+void mbedtls_rsa_validate_params(char *input_N,
+                                 char *input_P,
+                                 char *input_Q,
+                                 char *input_D,
+                                 char *input_E,
+                                 int prng, int result)
 {
     /* Original MPI's with which we set up the RSA context */
     mbedtls_mpi N, P, Q, D, E;
 
-    const int have_N = ( strlen( input_N ) > 0 );
-    const int have_P = ( strlen( input_P ) > 0 );
-    const int have_Q = ( strlen( input_Q ) > 0 );
-    const int have_D = ( strlen( input_D ) > 0 );
-    const int have_E = ( strlen( input_E ) > 0 );
+    const int have_N = (strlen(input_N) > 0);
+    const int have_P = (strlen(input_P) > 0);
+    const int have_Q = (strlen(input_Q) > 0);
+    const int have_D = (strlen(input_D) > 0);
+    const int have_E = (strlen(input_E) > 0);
 
     mbedtls_entropy_context entropy;
     mbedtls_ctr_drbg_context ctr_drbg;
     const char *pers = "test_suite_rsa";
 
-    mbedtls_mpi_init( &N );
-    mbedtls_mpi_init( &P ); mbedtls_mpi_init( &Q );
-    mbedtls_mpi_init( &D ); mbedtls_mpi_init( &E );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&P); mbedtls_mpi_init(&Q);
+    mbedtls_mpi_init(&D); mbedtls_mpi_init(&E);
 
-    mbedtls_ctr_drbg_init( &ctr_drbg );
-    mbedtls_entropy_init( &entropy );
-    TEST_ASSERT( mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func,
-                                        &entropy, (const unsigned char *) pers,
-                                        strlen( pers ) ) == 0 );
+    mbedtls_ctr_drbg_init(&ctr_drbg);
+    mbedtls_entropy_init(&entropy);
+    TEST_ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func,
+                                      &entropy, (const unsigned char *) pers,
+                                      strlen(pers)) == 0);
 
-    if( have_N )
-        TEST_ASSERT( mbedtls_test_read_mpi( &N, input_N ) == 0 );
+    if (have_N) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&N, input_N) == 0);
+    }
 
-    if( have_P )
-        TEST_ASSERT( mbedtls_test_read_mpi( &P, input_P ) == 0 );
+    if (have_P) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&P, input_P) == 0);
+    }
 
-    if( have_Q )
-        TEST_ASSERT( mbedtls_test_read_mpi( &Q, input_Q ) == 0 );
+    if (have_Q) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&Q, input_Q) == 0);
+    }
 
-    if( have_D )
-        TEST_ASSERT( mbedtls_test_read_mpi( &D, input_D ) == 0 );
+    if (have_D) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&D, input_D) == 0);
+    }
 
-    if( have_E )
-        TEST_ASSERT( mbedtls_test_read_mpi( &E, input_E ) == 0 );
+    if (have_E) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&E, input_E) == 0);
+    }
 
-    TEST_ASSERT( mbedtls_rsa_validate_params( have_N ? &N : NULL,
-                                        have_P ? &P : NULL,
-                                        have_Q ? &Q : NULL,
-                                        have_D ? &D : NULL,
-                                        have_E ? &E : NULL,
-                                        prng ? mbedtls_ctr_drbg_random : NULL,
-                                        prng ? &ctr_drbg : NULL ) == result );
+    TEST_ASSERT(mbedtls_rsa_validate_params(have_N ? &N : NULL,
+                                            have_P ? &P : NULL,
+                                            have_Q ? &Q : NULL,
+                                            have_D ? &D : NULL,
+                                            have_E ? &E : NULL,
+                                            prng ? mbedtls_ctr_drbg_random : NULL,
+                                            prng ? &ctr_drbg : NULL) == result);
 exit:
 
-    mbedtls_ctr_drbg_free( &ctr_drbg );
-    mbedtls_entropy_free( &entropy );
+    mbedtls_ctr_drbg_free(&ctr_drbg);
+    mbedtls_entropy_free(&entropy);
 
-    mbedtls_mpi_free( &N );
-    mbedtls_mpi_free( &P ); mbedtls_mpi_free( &Q );
-    mbedtls_mpi_free( &D ); mbedtls_mpi_free( &E );
+    mbedtls_mpi_free(&N);
+    mbedtls_mpi_free(&P); mbedtls_mpi_free(&Q);
+    mbedtls_mpi_free(&D); mbedtls_mpi_free(&E);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CTR_DRBG_C:MBEDTLS_ENTROPY_C */
-void mbedtls_rsa_export_raw( data_t *input_N, data_t *input_P,
-                             data_t *input_Q, data_t *input_D,
-                             data_t *input_E, int is_priv,
-                             int successive )
+void mbedtls_rsa_export_raw(data_t *input_N, data_t *input_P,
+                            data_t *input_Q, data_t *input_D,
+                            data_t *input_E, int is_priv,
+                            int successive)
 {
     /* Exported buffers */
     unsigned char bufNe[256];
@@ -1645,94 +1628,90 @@
 
     mbedtls_rsa_context ctx;
 
-    mbedtls_rsa_init( &ctx, 0, 0 );
+    mbedtls_rsa_init(&ctx, 0, 0);
 
     /* Setup RSA context */
-    TEST_ASSERT( mbedtls_rsa_import_raw( &ctx,
-                               input_N->len ? input_N->x : NULL, input_N->len,
-                               input_P->len ? input_P->x : NULL, input_P->len,
-                               input_Q->len ? input_Q->x : NULL, input_Q->len,
-                               input_D->len ? input_D->x : NULL, input_D->len,
-                               input_E->len ? input_E->x : NULL, input_E->len ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_import_raw(&ctx,
+                                       input_N->len ? input_N->x : NULL, input_N->len,
+                                       input_P->len ? input_P->x : NULL, input_P->len,
+                                       input_Q->len ? input_Q->x : NULL, input_Q->len,
+                                       input_D->len ? input_D->x : NULL, input_D->len,
+                                       input_E->len ? input_E->x : NULL, input_E->len) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_complete( &ctx ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_complete(&ctx) == 0);
 
     /*
      * Export parameters and compare to original ones.
      */
 
     /* N and E must always be present. */
-    if( !successive )
-    {
-        TEST_ASSERT( mbedtls_rsa_export_raw( &ctx, bufNe, input_N->len,
-                                             NULL, 0, NULL, 0, NULL, 0,
-                                             bufEe, input_E->len ) == 0 );
+    if (!successive) {
+        TEST_ASSERT(mbedtls_rsa_export_raw(&ctx, bufNe, input_N->len,
+                                           NULL, 0, NULL, 0, NULL, 0,
+                                           bufEe, input_E->len) == 0);
+    } else {
+        TEST_ASSERT(mbedtls_rsa_export_raw(&ctx, bufNe, input_N->len,
+                                           NULL, 0, NULL, 0, NULL, 0,
+                                           NULL, 0) == 0);
+        TEST_ASSERT(mbedtls_rsa_export_raw(&ctx, NULL, 0,
+                                           NULL, 0, NULL, 0, NULL, 0,
+                                           bufEe, input_E->len) == 0);
     }
-    else
-    {
-        TEST_ASSERT( mbedtls_rsa_export_raw( &ctx, bufNe, input_N->len,
-                                             NULL, 0, NULL, 0, NULL, 0,
-                                             NULL, 0 ) == 0 );
-        TEST_ASSERT( mbedtls_rsa_export_raw( &ctx, NULL, 0,
-                                             NULL, 0, NULL, 0, NULL, 0,
-                                             bufEe, input_E->len ) == 0 );
-    }
-    TEST_ASSERT( memcmp( input_N->x, bufNe, input_N->len ) == 0 );
-    TEST_ASSERT( memcmp( input_E->x, bufEe, input_E->len ) == 0 );
+    TEST_ASSERT(memcmp(input_N->x, bufNe, input_N->len) == 0);
+    TEST_ASSERT(memcmp(input_E->x, bufEe, input_E->len) == 0);
 
     /* If we were providing enough information to setup a complete private context,
      * we expect to be able to export all core parameters. */
 
-    if( is_priv )
-    {
-        if( !successive )
-        {
-            TEST_ASSERT( mbedtls_rsa_export_raw( &ctx, NULL, 0,
-                                         bufPe, input_P->len ? input_P->len : sizeof( bufPe ),
-                                         bufQe, input_Q->len ? input_Q->len : sizeof( bufQe ),
-                                         bufDe, input_D->len ? input_D->len : sizeof( bufDe ),
-                                         NULL, 0 ) == 0 );
-        }
-        else
-        {
-            TEST_ASSERT( mbedtls_rsa_export_raw( &ctx, NULL, 0,
-                                         bufPe, input_P->len ? input_P->len : sizeof( bufPe ),
-                                         NULL, 0, NULL, 0,
-                                         NULL, 0 ) == 0 );
+    if (is_priv) {
+        if (!successive) {
+            TEST_ASSERT(mbedtls_rsa_export_raw(&ctx, NULL, 0,
+                                               bufPe, input_P->len ? input_P->len : sizeof(bufPe),
+                                               bufQe, input_Q->len ? input_Q->len : sizeof(bufQe),
+                                               bufDe, input_D->len ? input_D->len : sizeof(bufDe),
+                                               NULL, 0) == 0);
+        } else {
+            TEST_ASSERT(mbedtls_rsa_export_raw(&ctx, NULL, 0,
+                                               bufPe, input_P->len ? input_P->len : sizeof(bufPe),
+                                               NULL, 0, NULL, 0,
+                                               NULL, 0) == 0);
 
-            TEST_ASSERT( mbedtls_rsa_export_raw( &ctx, NULL, 0, NULL, 0,
-                                         bufQe, input_Q->len ? input_Q->len : sizeof( bufQe ),
-                                         NULL, 0, NULL, 0 ) == 0 );
+            TEST_ASSERT(mbedtls_rsa_export_raw(&ctx, NULL, 0, NULL, 0,
+                                               bufQe, input_Q->len ? input_Q->len : sizeof(bufQe),
+                                               NULL, 0, NULL, 0) == 0);
 
-            TEST_ASSERT( mbedtls_rsa_export_raw( &ctx, NULL, 0, NULL, 0, NULL, 0,
-                                         bufDe, input_D->len ? input_D->len : sizeof( bufDe ),
-                                         NULL, 0 ) == 0 );
+            TEST_ASSERT(mbedtls_rsa_export_raw(&ctx, NULL, 0, NULL, 0, NULL, 0,
+                                               bufDe, input_D->len ? input_D->len : sizeof(bufDe),
+                                               NULL, 0) == 0);
         }
 
-        if( input_P->len )
-            TEST_ASSERT( memcmp( input_P->x, bufPe, input_P->len ) == 0 );
+        if (input_P->len) {
+            TEST_ASSERT(memcmp(input_P->x, bufPe, input_P->len) == 0);
+        }
 
-        if( input_Q->len )
-            TEST_ASSERT( memcmp( input_Q->x, bufQe, input_Q->len ) == 0 );
+        if (input_Q->len) {
+            TEST_ASSERT(memcmp(input_Q->x, bufQe, input_Q->len) == 0);
+        }
 
-        if( input_D->len )
-            TEST_ASSERT( memcmp( input_D->x, bufDe, input_D->len ) == 0 );
+        if (input_D->len) {
+            TEST_ASSERT(memcmp(input_D->x, bufDe, input_D->len) == 0);
+        }
 
     }
 
 exit:
-    mbedtls_rsa_free( &ctx );
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CTR_DRBG_C:MBEDTLS_ENTROPY_C:ENTROPY_HAVE_STRONG */
-void mbedtls_rsa_import_raw( data_t *input_N,
-                             data_t *input_P, data_t *input_Q,
-                             data_t *input_D, data_t *input_E,
-                             int successive,
-                             int is_priv,
-                             int res_check,
-                             int res_complete )
+void mbedtls_rsa_import_raw(data_t *input_N,
+                            data_t *input_P, data_t *input_Q,
+                            data_t *input_D, data_t *input_E,
+                            int successive,
+                            int is_priv,
+                            int res_check,
+                            int res_complete)
 {
     /* Buffers used for encryption-decryption test */
     unsigned char *buf_orig = NULL;
@@ -1745,108 +1724,108 @@
 
     const char *pers = "test_suite_rsa";
 
-    mbedtls_ctr_drbg_init( &ctr_drbg );
-    mbedtls_entropy_init( &entropy );
-    mbedtls_rsa_init( &ctx, 0, 0 );
+    mbedtls_ctr_drbg_init(&ctr_drbg);
+    mbedtls_entropy_init(&entropy);
+    mbedtls_rsa_init(&ctx, 0, 0);
 
-    TEST_ASSERT( mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func,
-                                        &entropy, (const unsigned char *) pers,
-                                        strlen( pers ) ) == 0 );
+    TEST_ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func,
+                                      &entropy, (const unsigned char *) pers,
+                                      strlen(pers)) == 0);
 
-    if( !successive )
-    {
-        TEST_ASSERT( mbedtls_rsa_import_raw( &ctx,
-                               ( input_N->len > 0 ) ? input_N->x : NULL, input_N->len,
-                               ( input_P->len > 0 ) ? input_P->x : NULL, input_P->len,
-                               ( input_Q->len > 0 ) ? input_Q->x : NULL, input_Q->len,
-                               ( input_D->len > 0 ) ? input_D->x : NULL, input_D->len,
-                               ( input_E->len > 0 ) ? input_E->x : NULL, input_E->len ) == 0 );
-    }
-    else
-    {
+    if (!successive) {
+        TEST_ASSERT(mbedtls_rsa_import_raw(&ctx,
+                                           (input_N->len > 0) ? input_N->x : NULL, input_N->len,
+                                           (input_P->len > 0) ? input_P->x : NULL, input_P->len,
+                                           (input_Q->len > 0) ? input_Q->x : NULL, input_Q->len,
+                                           (input_D->len > 0) ? input_D->x : NULL, input_D->len,
+                                           (input_E->len > 0) ? input_E->x : NULL,
+                                           input_E->len) == 0);
+    } else {
         /* Import N, P, Q, D, E separately.
          * This should make no functional difference. */
 
-        TEST_ASSERT( mbedtls_rsa_import_raw( &ctx,
-                               ( input_N->len > 0 ) ? input_N->x : NULL, input_N->len,
-                               NULL, 0, NULL, 0, NULL, 0, NULL, 0 ) == 0 );
+        TEST_ASSERT(mbedtls_rsa_import_raw(&ctx,
+                                           (input_N->len > 0) ? input_N->x : NULL, input_N->len,
+                                           NULL, 0, NULL, 0, NULL, 0, NULL, 0) == 0);
 
-        TEST_ASSERT( mbedtls_rsa_import_raw( &ctx,
-                               NULL, 0,
-                               ( input_P->len > 0 ) ? input_P->x : NULL, input_P->len,
-                               NULL, 0, NULL, 0, NULL, 0 ) == 0 );
+        TEST_ASSERT(mbedtls_rsa_import_raw(&ctx,
+                                           NULL, 0,
+                                           (input_P->len > 0) ? input_P->x : NULL, input_P->len,
+                                           NULL, 0, NULL, 0, NULL, 0) == 0);
 
-        TEST_ASSERT( mbedtls_rsa_import_raw( &ctx,
-                               NULL, 0, NULL, 0,
-                               ( input_Q->len > 0 ) ? input_Q->x : NULL, input_Q->len,
-                               NULL, 0, NULL, 0 ) == 0 );
+        TEST_ASSERT(mbedtls_rsa_import_raw(&ctx,
+                                           NULL, 0, NULL, 0,
+                                           (input_Q->len > 0) ? input_Q->x : NULL, input_Q->len,
+                                           NULL, 0, NULL, 0) == 0);
 
-        TEST_ASSERT( mbedtls_rsa_import_raw( &ctx,
-                               NULL, 0, NULL, 0, NULL, 0,
-                               ( input_D->len > 0 ) ? input_D->x : NULL, input_D->len,
-                               NULL, 0 ) == 0 );
+        TEST_ASSERT(mbedtls_rsa_import_raw(&ctx,
+                                           NULL, 0, NULL, 0, NULL, 0,
+                                           (input_D->len > 0) ? input_D->x : NULL, input_D->len,
+                                           NULL, 0) == 0);
 
-        TEST_ASSERT( mbedtls_rsa_import_raw( &ctx,
-                               NULL, 0, NULL, 0, NULL, 0, NULL, 0,
-                               ( input_E->len > 0 ) ? input_E->x : NULL, input_E->len ) == 0 );
+        TEST_ASSERT(mbedtls_rsa_import_raw(&ctx,
+                                           NULL, 0, NULL, 0, NULL, 0, NULL, 0,
+                                           (input_E->len > 0) ? input_E->x : NULL,
+                                           input_E->len) == 0);
     }
 
-    TEST_ASSERT( mbedtls_rsa_complete( &ctx ) == res_complete );
+    TEST_ASSERT(mbedtls_rsa_complete(&ctx) == res_complete);
 
     /* On expected success, perform some public and private
      * key operations to check if the key is working properly. */
-    if( res_complete == 0 )
-    {
-        if( is_priv )
-            TEST_ASSERT( mbedtls_rsa_check_privkey( &ctx ) == res_check );
-        else
-            TEST_ASSERT( mbedtls_rsa_check_pubkey( &ctx ) == res_check );
+    if (res_complete == 0) {
+        if (is_priv) {
+            TEST_ASSERT(mbedtls_rsa_check_privkey(&ctx) == res_check);
+        } else {
+            TEST_ASSERT(mbedtls_rsa_check_pubkey(&ctx) == res_check);
+        }
 
-        if( res_check != 0 )
+        if (res_check != 0) {
             goto exit;
+        }
 
-        buf_orig = mbedtls_calloc( 1, mbedtls_rsa_get_len( &ctx ) );
-        buf_enc  = mbedtls_calloc( 1, mbedtls_rsa_get_len( &ctx ) );
-        buf_dec  = mbedtls_calloc( 1, mbedtls_rsa_get_len( &ctx ) );
-        if( buf_orig == NULL || buf_enc == NULL || buf_dec == NULL )
+        buf_orig = mbedtls_calloc(1, mbedtls_rsa_get_len(&ctx));
+        buf_enc  = mbedtls_calloc(1, mbedtls_rsa_get_len(&ctx));
+        buf_dec  = mbedtls_calloc(1, mbedtls_rsa_get_len(&ctx));
+        if (buf_orig == NULL || buf_enc == NULL || buf_dec == NULL) {
             goto exit;
+        }
 
-        TEST_ASSERT( mbedtls_ctr_drbg_random( &ctr_drbg,
-                              buf_orig, mbedtls_rsa_get_len( &ctx ) ) == 0 );
+        TEST_ASSERT(mbedtls_ctr_drbg_random(&ctr_drbg,
+                                            buf_orig, mbedtls_rsa_get_len(&ctx)) == 0);
 
         /* Make sure the number we're generating is smaller than the modulus */
         buf_orig[0] = 0x00;
 
-        TEST_ASSERT( mbedtls_rsa_public( &ctx, buf_orig, buf_enc ) == 0 );
+        TEST_ASSERT(mbedtls_rsa_public(&ctx, buf_orig, buf_enc) == 0);
 
-        if( is_priv )
-        {
-            TEST_ASSERT( mbedtls_rsa_private( &ctx, mbedtls_ctr_drbg_random,
-                                              &ctr_drbg, buf_enc,
-                                              buf_dec ) == 0 );
+        if (is_priv) {
+            TEST_ASSERT(mbedtls_rsa_private(&ctx, mbedtls_ctr_drbg_random,
+                                            &ctr_drbg, buf_enc,
+                                            buf_dec) == 0);
 
-            TEST_ASSERT( memcmp( buf_orig, buf_dec,
-                                 mbedtls_rsa_get_len( &ctx ) ) == 0 );
+            TEST_ASSERT(memcmp(buf_orig, buf_dec,
+                               mbedtls_rsa_get_len(&ctx)) == 0);
         }
     }
 
 exit:
 
-    mbedtls_free( buf_orig );
-    mbedtls_free( buf_enc  );
-    mbedtls_free( buf_dec  );
+    mbedtls_free(buf_orig);
+    mbedtls_free(buf_enc);
+    mbedtls_free(buf_dec);
 
-    mbedtls_rsa_free( &ctx );
+    mbedtls_rsa_free(&ctx);
 
-    mbedtls_ctr_drbg_free( &ctr_drbg );
-    mbedtls_entropy_free( &entropy );
+    mbedtls_ctr_drbg_free(&ctr_drbg);
+    mbedtls_entropy_free(&entropy);
 
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void rsa_selftest(  )
+void rsa_selftest()
 {
-    TEST_ASSERT( mbedtls_rsa_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_shax.function b/tests/suites/test_suite_shax.function
index f3477ec..02c410e 100644
--- a/tests/suites/test_suite_shax.function
+++ b/tests/suites/test_suite_shax.function
@@ -5,46 +5,46 @@
 /* END_HEADER */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA1_C */
-void sha1_valid_param( )
+void sha1_valid_param()
 {
-    TEST_VALID_PARAM( mbedtls_sha1_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_sha1_free(NULL));
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA1_C:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void sha1_invalid_param( )
+void sha1_invalid_param()
 {
     mbedtls_sha1_context ctx;
     unsigned char buf[64] = { 0 };
-    size_t const buflen = sizeof( buf );
+    size_t const buflen = sizeof(buf);
 
-    TEST_INVALID_PARAM( mbedtls_sha1_init( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_sha1_init(NULL));
 
-    TEST_INVALID_PARAM( mbedtls_sha1_clone( NULL, &ctx ) );
-    TEST_INVALID_PARAM( mbedtls_sha1_clone( &ctx, NULL ) );
+    TEST_INVALID_PARAM(mbedtls_sha1_clone(NULL, &ctx));
+    TEST_INVALID_PARAM(mbedtls_sha1_clone(&ctx, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
-                            mbedtls_sha1_starts_ret( NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
+                           mbedtls_sha1_starts_ret(NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
-                            mbedtls_sha1_update_ret( NULL, buf, buflen ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
-                            mbedtls_sha1_update_ret( &ctx, NULL, buflen ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
+                           mbedtls_sha1_update_ret(NULL, buf, buflen));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
+                           mbedtls_sha1_update_ret(&ctx, NULL, buflen));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
-                            mbedtls_sha1_finish_ret( NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
-                            mbedtls_sha1_finish_ret( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
+                           mbedtls_sha1_finish_ret(NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
+                           mbedtls_sha1_finish_ret(&ctx, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
-                            mbedtls_internal_sha1_process( NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
-                            mbedtls_internal_sha1_process( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
+                           mbedtls_internal_sha1_process(NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
+                           mbedtls_internal_sha1_process(&ctx, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
-                            mbedtls_sha1_ret( NULL, buflen, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
-                            mbedtls_sha1_ret( buf, buflen, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
+                           mbedtls_sha1_ret(NULL, buflen, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA1_BAD_INPUT_DATA,
+                           mbedtls_sha1_ret(buf, buflen, NULL));
 
 exit:
     return;
@@ -52,69 +52,69 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA1_C */
-void mbedtls_sha1( data_t * src_str, data_t * hash )
+void mbedtls_sha1(data_t *src_str, data_t *hash)
 {
     unsigned char output[41];
 
     memset(output, 0x00, 41);
 
 
-    TEST_ASSERT( mbedtls_sha1_ret( src_str->x, src_str->len, output ) == 0 );
+    TEST_ASSERT(mbedtls_sha1_ret(src_str->x, src_str->len, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x, 20, hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x, 20, hash->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA256_C */
-void sha256_valid_param( )
+void sha256_valid_param()
 {
-    TEST_VALID_PARAM( mbedtls_sha256_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_sha256_free(NULL));
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA256_C:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void sha256_invalid_param( )
+void sha256_invalid_param()
 {
     mbedtls_sha256_context ctx;
     unsigned char buf[64] = { 0 };
-    size_t const buflen = sizeof( buf );
+    size_t const buflen = sizeof(buf);
     int valid_type = 0;
     int invalid_type = 42;
 
-    TEST_INVALID_PARAM( mbedtls_sha256_init( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_sha256_init(NULL));
 
-    TEST_INVALID_PARAM( mbedtls_sha256_clone( NULL, &ctx ) );
-    TEST_INVALID_PARAM( mbedtls_sha256_clone( &ctx, NULL ) );
+    TEST_INVALID_PARAM(mbedtls_sha256_clone(NULL, &ctx));
+    TEST_INVALID_PARAM(mbedtls_sha256_clone(&ctx, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
-                            mbedtls_sha256_starts_ret( NULL, valid_type ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
-                            mbedtls_sha256_starts_ret( &ctx, invalid_type ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
+                           mbedtls_sha256_starts_ret(NULL, valid_type));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
+                           mbedtls_sha256_starts_ret(&ctx, invalid_type));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
-                            mbedtls_sha256_update_ret( NULL, buf, buflen ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
-                            mbedtls_sha256_update_ret( &ctx, NULL, buflen ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
+                           mbedtls_sha256_update_ret(NULL, buf, buflen));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
+                           mbedtls_sha256_update_ret(&ctx, NULL, buflen));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
-                            mbedtls_sha256_finish_ret( NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
-                            mbedtls_sha256_finish_ret( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
+                           mbedtls_sha256_finish_ret(NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
+                           mbedtls_sha256_finish_ret(&ctx, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
-                            mbedtls_internal_sha256_process( NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
-                            mbedtls_internal_sha256_process( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
+                           mbedtls_internal_sha256_process(NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
+                           mbedtls_internal_sha256_process(&ctx, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
-                            mbedtls_sha256_ret( NULL, buflen,
-                                                buf, valid_type ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
-                            mbedtls_sha256_ret( buf, buflen,
-                                                NULL, valid_type ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
-                            mbedtls_sha256_ret( buf, buflen,
-                                                buf, invalid_type ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
+                           mbedtls_sha256_ret(NULL, buflen,
+                                              buf, valid_type));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
+                           mbedtls_sha256_ret(buf, buflen,
+                                              NULL, valid_type));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
+                           mbedtls_sha256_ret(buf, buflen,
+                                              buf, invalid_type));
 
 exit:
     return;
@@ -122,83 +122,83 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA256_C */
-void sha224( data_t * src_str, data_t * hash )
+void sha224(data_t *src_str, data_t *hash)
 {
     unsigned char output[57];
 
     memset(output, 0x00, 57);
 
 
-    TEST_ASSERT( mbedtls_sha256_ret( src_str->x, src_str->len, output, 1 ) == 0 );
+    TEST_ASSERT(mbedtls_sha256_ret(src_str->x, src_str->len, output, 1) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x, 28, hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x, 28, hash->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA256_C */
-void mbedtls_sha256( data_t * src_str, data_t * hash )
+void mbedtls_sha256(data_t *src_str, data_t *hash)
 {
     unsigned char output[65];
 
     memset(output, 0x00, 65);
 
 
-    TEST_ASSERT( mbedtls_sha256_ret( src_str->x, src_str->len, output, 0 ) == 0 );
+    TEST_ASSERT(mbedtls_sha256_ret(src_str->x, src_str->len, output, 0) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x, 32, hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x, 32, hash->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA512_C */
-void sha512_valid_param( )
+void sha512_valid_param()
 {
-    TEST_VALID_PARAM( mbedtls_sha512_free( NULL ) );
+    TEST_VALID_PARAM(mbedtls_sha512_free(NULL));
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA512_C:MBEDTLS_CHECK_PARAMS:!MBEDTLS_PARAM_FAILED_ALT */
-void sha512_invalid_param( )
+void sha512_invalid_param()
 {
     mbedtls_sha512_context ctx;
     unsigned char buf[64] = { 0 };
-    size_t const buflen = sizeof( buf );
+    size_t const buflen = sizeof(buf);
     int valid_type = 0;
     int invalid_type = 42;
 
-    TEST_INVALID_PARAM( mbedtls_sha512_init( NULL ) );
+    TEST_INVALID_PARAM(mbedtls_sha512_init(NULL));
 
-    TEST_INVALID_PARAM( mbedtls_sha512_clone( NULL, &ctx ) );
-    TEST_INVALID_PARAM( mbedtls_sha512_clone( &ctx, NULL ) );
+    TEST_INVALID_PARAM(mbedtls_sha512_clone(NULL, &ctx));
+    TEST_INVALID_PARAM(mbedtls_sha512_clone(&ctx, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
-                            mbedtls_sha512_starts_ret( NULL, valid_type ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
-                            mbedtls_sha512_starts_ret( &ctx, invalid_type ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
+                           mbedtls_sha512_starts_ret(NULL, valid_type));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
+                           mbedtls_sha512_starts_ret(&ctx, invalid_type));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
-                            mbedtls_sha512_update_ret( NULL, buf, buflen ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
-                            mbedtls_sha512_update_ret( &ctx, NULL, buflen ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
+                           mbedtls_sha512_update_ret(NULL, buf, buflen));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
+                           mbedtls_sha512_update_ret(&ctx, NULL, buflen));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
-                            mbedtls_sha512_finish_ret( NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
-                            mbedtls_sha512_finish_ret( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
+                           mbedtls_sha512_finish_ret(NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
+                           mbedtls_sha512_finish_ret(&ctx, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
-                            mbedtls_internal_sha512_process( NULL, buf ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
-                            mbedtls_internal_sha512_process( &ctx, NULL ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
+                           mbedtls_internal_sha512_process(NULL, buf));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
+                           mbedtls_internal_sha512_process(&ctx, NULL));
 
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
-                            mbedtls_sha512_ret( NULL, buflen,
-                                                buf, valid_type ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
-                            mbedtls_sha512_ret( buf, buflen,
-                                                NULL, valid_type ) );
-    TEST_INVALID_PARAM_RET( MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
-                            mbedtls_sha512_ret( buf, buflen,
-                                                buf, invalid_type ) );
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
+                           mbedtls_sha512_ret(NULL, buflen,
+                                              buf, valid_type));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
+                           mbedtls_sha512_ret(buf, buflen,
+                                              NULL, valid_type));
+    TEST_INVALID_PARAM_RET(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
+                           mbedtls_sha512_ret(buf, buflen,
+                                              buf, invalid_type));
 
 exit:
     return;
@@ -206,50 +206,50 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA512_C */
-void sha384( data_t * src_str, data_t * hash )
+void sha384(data_t *src_str, data_t *hash)
 {
     unsigned char output[97];
 
     memset(output, 0x00, 97);
 
 
-    TEST_ASSERT( mbedtls_sha512_ret( src_str->x, src_str->len, output, 1 ) == 0 );
+    TEST_ASSERT(mbedtls_sha512_ret(src_str->x, src_str->len, output, 1) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x, 48, hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x, 48, hash->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA512_C */
-void mbedtls_sha512( data_t * src_str, data_t * hash )
+void mbedtls_sha512(data_t *src_str, data_t *hash)
 {
     unsigned char output[129];
 
     memset(output, 0x00, 129);
 
 
-    TEST_ASSERT( mbedtls_sha512_ret( src_str->x, src_str->len, output, 0 ) == 0 );
+    TEST_ASSERT(mbedtls_sha512_ret(src_str->x, src_str->len, output, 0) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, hash->x, 64, hash->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x, 64, hash->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA1_C:MBEDTLS_SELF_TEST */
-void sha1_selftest(  )
+void sha1_selftest()
 {
-    TEST_ASSERT( mbedtls_sha1_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_sha1_self_test(1) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA256_C:MBEDTLS_SELF_TEST */
-void sha256_selftest(  )
+void sha256_selftest()
 {
-    TEST_ASSERT( mbedtls_sha256_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_sha256_self_test(1) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA512_C:MBEDTLS_SELF_TEST */
-void sha512_selftest(  )
+void sha512_selftest()
 {
-    TEST_ASSERT( mbedtls_sha512_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_sha512_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_ssl.function b/tests/suites/test_suite_ssl.function
index 7575f78..5a92820 100644
--- a/tests/suites/test_suite_ssl.function
+++ b/tests/suites/test_suite_ssl.function
@@ -12,16 +12,14 @@
 
 #include <test/constant_flow.h>
 
-enum
-{
-#define MBEDTLS_SSL_TLS1_3_LABEL( name, string )   \
-     tls1_3_label_ ## name,
-MBEDTLS_SSL_TLS1_3_LABEL_LIST
+enum {
+#define MBEDTLS_SSL_TLS1_3_LABEL(name, string)   \
+    tls1_3_label_ ## name,
+    MBEDTLS_SSL_TLS1_3_LABEL_LIST
 #undef MBEDTLS_SSL_TLS1_3_LABEL
 };
 
-typedef struct log_pattern
-{
+typedef struct log_pattern {
     const char *pattern;
     size_t counter;
 } log_pattern;
@@ -31,9 +29,9 @@
  * this case, it will count the instances of a log_pattern in the received
  * logged messages.
  */
-void log_analyzer( void *ctx, int level,
-                   const char *file, int line,
-                   const char *str )
+void log_analyzer(void *ctx, int level,
+                  const char *file, int line,
+                  const char *str)
 {
     log_pattern *p = (log_pattern *) ctx;
 
@@ -41,10 +39,9 @@
     (void) line;
     (void) file;
 
-    if( NULL != p &&
+    if (NULL != p &&
         NULL != p->pattern &&
-        NULL != strstr( str, p->pattern ) )
-    {
+        NULL != strstr(str, p->pattern)) {
         p->counter++;
     }
 }
@@ -52,8 +49,7 @@
 /* Invalid minor version used when not specifying a min/max version or expecting a test to fail */
 #define TEST_SSL_MINOR_VERSION_NONE -1
 
-typedef struct handshake_test_options
-{
+typedef struct handshake_test_options {
     const char *cipher;
     int client_min_version;
     int client_max_version;
@@ -79,38 +75,37 @@
     int resize_buffers;
 } handshake_test_options;
 
-void init_handshake_options( handshake_test_options *opts )
+void init_handshake_options(handshake_test_options *opts)
 {
-  opts->cipher = "";
-  opts->client_min_version = TEST_SSL_MINOR_VERSION_NONE;
-  opts->client_max_version = TEST_SSL_MINOR_VERSION_NONE;
-  opts->server_min_version = TEST_SSL_MINOR_VERSION_NONE;
-  opts->server_max_version = TEST_SSL_MINOR_VERSION_NONE;
-  opts->expected_negotiated_version = MBEDTLS_SSL_MINOR_VERSION_3;
-  opts->pk_alg = MBEDTLS_PK_RSA;
-  opts->psk_str = NULL;
-  opts->dtls = 0;
-  opts->srv_auth_mode = MBEDTLS_SSL_VERIFY_NONE;
-  opts->serialize = 0;
-  opts->mfl = MBEDTLS_SSL_MAX_FRAG_LEN_NONE;
-  opts->cli_msg_len = 100;
-  opts->srv_msg_len = 100;
-  opts->expected_cli_fragments = 1;
-  opts->expected_srv_fragments = 1;
-  opts->renegotiate = 0;
-  opts->legacy_renegotiation = MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION;
-  opts->srv_log_obj = NULL;
-  opts->srv_log_obj = NULL;
-  opts->srv_log_fun = NULL;
-  opts->cli_log_fun = NULL;
-  opts->resize_buffers = 1;
+    opts->cipher = "";
+    opts->client_min_version = TEST_SSL_MINOR_VERSION_NONE;
+    opts->client_max_version = TEST_SSL_MINOR_VERSION_NONE;
+    opts->server_min_version = TEST_SSL_MINOR_VERSION_NONE;
+    opts->server_max_version = TEST_SSL_MINOR_VERSION_NONE;
+    opts->expected_negotiated_version = MBEDTLS_SSL_MINOR_VERSION_3;
+    opts->pk_alg = MBEDTLS_PK_RSA;
+    opts->psk_str = NULL;
+    opts->dtls = 0;
+    opts->srv_auth_mode = MBEDTLS_SSL_VERIFY_NONE;
+    opts->serialize = 0;
+    opts->mfl = MBEDTLS_SSL_MAX_FRAG_LEN_NONE;
+    opts->cli_msg_len = 100;
+    opts->srv_msg_len = 100;
+    opts->expected_cli_fragments = 1;
+    opts->expected_srv_fragments = 1;
+    opts->renegotiate = 0;
+    opts->legacy_renegotiation = MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION;
+    opts->srv_log_obj = NULL;
+    opts->srv_log_obj = NULL;
+    opts->srv_log_fun = NULL;
+    opts->cli_log_fun = NULL;
+    opts->resize_buffers = 1;
 }
 /*
  * Buffer structure for custom I/O callbacks.
  */
 
-typedef struct mbedtls_test_buffer
-{
+typedef struct mbedtls_test_buffer {
     size_t start;
     size_t content_length;
     size_t capacity;
@@ -121,32 +116,34 @@
  * Initialises \p buf. After calling this function it is safe to call
  * `mbedtls_test_buffer_free()` on \p buf.
  */
-void mbedtls_test_buffer_init( mbedtls_test_buffer *buf )
+void mbedtls_test_buffer_init(mbedtls_test_buffer *buf)
 {
-    memset( buf, 0, sizeof( *buf ) );
+    memset(buf, 0, sizeof(*buf));
 }
 
 /*
  * Sets up \p buf. After calling this function it is safe to call
  * `mbedtls_test_buffer_put()` and `mbedtls_test_buffer_get()` on \p buf.
  */
-int mbedtls_test_buffer_setup( mbedtls_test_buffer *buf, size_t capacity )
+int mbedtls_test_buffer_setup(mbedtls_test_buffer *buf, size_t capacity)
 {
-    buf->buffer = (unsigned char*) mbedtls_calloc( capacity,
-                                                   sizeof( unsigned char ) );
-    if( NULL == buf->buffer )
+    buf->buffer = (unsigned char *) mbedtls_calloc(capacity,
+                                                   sizeof(unsigned char));
+    if (NULL == buf->buffer) {
         return MBEDTLS_ERR_SSL_ALLOC_FAILED;
+    }
     buf->capacity = capacity;
 
     return 0;
 }
 
-void mbedtls_test_buffer_free( mbedtls_test_buffer *buf )
+void mbedtls_test_buffer_free(mbedtls_test_buffer *buf)
 {
-    if( buf->buffer != NULL )
-        mbedtls_free( buf->buffer );
+    if (buf->buffer != NULL) {
+        mbedtls_free(buf->buffer);
+    }
 
-    memset( buf, 0, sizeof( *buf ) );
+    memset(buf, 0, sizeof(*buf));
 }
 
 /*
@@ -160,49 +157,44 @@
  * \retval  -1, if \p buf is NULL, it hasn't been set up or \p input_len is not
  *          zero and \p input is NULL.
  */
-int mbedtls_test_buffer_put( mbedtls_test_buffer *buf,
-                             const unsigned char *input, size_t input_len )
+int mbedtls_test_buffer_put(mbedtls_test_buffer *buf,
+                            const unsigned char *input, size_t input_len)
 {
     size_t overflow = 0;
 
-    if( ( buf == NULL ) || ( buf->buffer == NULL ) )
+    if ((buf == NULL) || (buf->buffer == NULL)) {
         return -1;
+    }
 
     /* Reduce input_len to a number that fits in the buffer. */
-    if ( ( buf->content_length + input_len ) > buf->capacity )
-    {
+    if ((buf->content_length + input_len) > buf->capacity) {
         input_len = buf->capacity - buf->content_length;
     }
 
-    if( input == NULL )
-    {
-        return ( input_len == 0 ) ? 0 : -1;
+    if (input == NULL) {
+        return (input_len == 0) ? 0 : -1;
     }
 
-     /* Check if the buffer has not come full circle and free space is not in
-      * the middle */
-    if( buf->start + buf->content_length < buf->capacity )
-    {
+    /* Check if the buffer has not come full circle and free space is not in
+     * the middle */
+    if (buf->start + buf->content_length < buf->capacity) {
 
         /* Calculate the number of bytes that need to be placed at lower memory
-        * address */
-        if( buf->start + buf->content_length + input_len
-            > buf->capacity )
-        {
-            overflow = ( buf->start + buf->content_length + input_len )
-                        % buf->capacity;
+         * address */
+        if (buf->start + buf->content_length + input_len
+            > buf->capacity) {
+            overflow = (buf->start + buf->content_length + input_len)
+                       % buf->capacity;
         }
 
-        memcpy( buf->buffer + buf->start + buf->content_length, input,
-                    input_len - overflow );
-        memcpy( buf->buffer, input + input_len - overflow, overflow );
+        memcpy(buf->buffer + buf->start + buf->content_length, input,
+               input_len - overflow);
+        memcpy(buf->buffer, input + input_len - overflow, overflow);
 
-    }
-    else
-    {
+    } else {
         /* The buffer has come full circle and free space is in the middle */
-        memcpy( buf->buffer + buf->start + buf->content_length - buf->capacity,
-                input, input_len );
+        memcpy(buf->buffer + buf->start + buf->content_length - buf->capacity,
+               input, input_len);
     }
 
     buf->content_length += input_len;
@@ -221,35 +213,36 @@
  * \retval  0 <= value < \p output_len, if the data is not available.
  * \retval  -1, if \buf is NULL or it hasn't been set up.
  */
-int mbedtls_test_buffer_get( mbedtls_test_buffer *buf,
-                             unsigned char* output, size_t output_len )
+int mbedtls_test_buffer_get(mbedtls_test_buffer *buf,
+                            unsigned char *output, size_t output_len)
 {
     size_t overflow = 0;
 
-    if( ( buf == NULL ) || ( buf->buffer == NULL ) )
+    if ((buf == NULL) || (buf->buffer == NULL)) {
         return -1;
+    }
 
-    if( output == NULL && output_len == 0 )
+    if (output == NULL && output_len == 0) {
         return 0;
+    }
 
-    if( buf->content_length < output_len )
+    if (buf->content_length < output_len) {
         output_len = buf->content_length;
+    }
 
     /* Calculate the number of bytes that need to be drawn from lower memory
      * address */
-    if( buf->start + output_len > buf->capacity )
-    {
-        overflow = ( buf->start + output_len ) % buf->capacity;
+    if (buf->start + output_len > buf->capacity) {
+        overflow = (buf->start + output_len) % buf->capacity;
     }
 
-    if( output != NULL )
-    {
-        memcpy( output, buf->buffer + buf->start, output_len - overflow );
-        memcpy( output + output_len - overflow, buf->buffer, overflow );
+    if (output != NULL) {
+        memcpy(output, buf->buffer + buf->start, output_len - overflow);
+        memcpy(output + output_len - overflow, buf->buffer, overflow);
     }
 
     buf->content_length -= output_len;
-    buf->start = ( buf->start + output_len ) % buf->capacity;
+    buf->start = (buf->start + output_len) % buf->capacity;
 
     return output_len;
 }
@@ -263,8 +256,7 @@
 /*
  * Context for a message metadata queue (fifo) that is on top of the ring buffer.
  */
-typedef struct mbedtls_test_message_queue
-{
+typedef struct mbedtls_test_message_queue {
     size_t *messages;
     int pos;
     int num;
@@ -280,12 +272,13 @@
  * \retval  0, if a metadata queue of a given length can be allocated.
  * \retval  MBEDTLS_ERR_SSL_ALLOC_FAILED, if allocation failed.
  */
-int mbedtls_test_message_queue_setup( mbedtls_test_message_queue *queue,
-                                      size_t capacity )
+int mbedtls_test_message_queue_setup(mbedtls_test_message_queue *queue,
+                                     size_t capacity)
 {
-    queue->messages = (size_t*) mbedtls_calloc( capacity, sizeof( size_t ) );
-    if( NULL == queue->messages )
+    queue->messages = (size_t *) mbedtls_calloc(capacity, sizeof(size_t));
+    if (NULL == queue->messages) {
         return MBEDTLS_ERR_SSL_ALLOC_FAILED;
+    }
 
     queue->capacity = capacity;
     queue->pos = 0;
@@ -294,15 +287,17 @@
     return 0;
 }
 
-void mbedtls_test_message_queue_free( mbedtls_test_message_queue *queue )
+void mbedtls_test_message_queue_free(mbedtls_test_message_queue *queue)
 {
-    if( queue == NULL )
+    if (queue == NULL) {
         return;
+    }
 
-    if( queue->messages != NULL )
-        mbedtls_free( queue->messages );
+    if (queue->messages != NULL) {
+        mbedtls_free(queue->messages);
+    }
 
-    memset( queue, 0, sizeof( *queue ) );
+    memset(queue, 0, sizeof(*queue));
 }
 
 /*
@@ -313,17 +308,19 @@
  * \retval  MBEDTLS_ERR_SSL_WANT_WRITE, if the queue is full.
  * \retval  \p len, if the push was successful.
  */
-int mbedtls_test_message_queue_push_info( mbedtls_test_message_queue *queue,
-                                          size_t len )
+int mbedtls_test_message_queue_push_info(mbedtls_test_message_queue *queue,
+                                         size_t len)
 {
     int place;
-    if( queue == NULL )
+    if (queue == NULL) {
         return MBEDTLS_TEST_ERROR_ARG_NULL;
+    }
 
-    if( queue->num >= queue->capacity )
+    if (queue->num >= queue->capacity) {
         return MBEDTLS_ERR_SSL_WANT_WRITE;
+    }
 
-    place = ( queue->pos + queue->num ) % queue->capacity;
+    place = (queue->pos + queue->num) % queue->capacity;
     queue->messages[place] = len;
     queue->num++;
     return len;
@@ -339,24 +336,27 @@
  * \retval  message length, if the pop was successful, up to the given
             \p buf_len.
  */
-int mbedtls_test_message_queue_pop_info( mbedtls_test_message_queue *queue,
-                                         size_t buf_len )
+int mbedtls_test_message_queue_pop_info(mbedtls_test_message_queue *queue,
+                                        size_t buf_len)
 {
     size_t message_length;
-    if( queue == NULL )
+    if (queue == NULL) {
         return MBEDTLS_TEST_ERROR_ARG_NULL;
-    if( queue->num == 0 )
+    }
+    if (queue->num == 0) {
         return MBEDTLS_ERR_SSL_WANT_READ;
+    }
 
     message_length = queue->messages[queue->pos];
     queue->messages[queue->pos] = 0;
     queue->num--;
     queue->pos++;
     queue->pos %= queue->capacity;
-    if( queue->pos < 0 )
+    if (queue->pos < 0) {
         queue->pos += queue->capacity;
+    }
 
-    return ( message_length > buf_len ) ? buf_len : message_length;
+    return (message_length > buf_len) ? buf_len : message_length;
 }
 
 /*
@@ -371,16 +371,18 @@
  *          set to the full message length so that the
  *          caller knows what portion of the message can be dropped.
  */
-int mbedtls_test_message_queue_peek_info( mbedtls_test_message_queue *queue,
-                                          size_t buf_len, size_t* msg_len )
+int mbedtls_test_message_queue_peek_info(mbedtls_test_message_queue *queue,
+                                         size_t buf_len, size_t *msg_len)
 {
-    if( queue == NULL || msg_len == NULL )
+    if (queue == NULL || msg_len == NULL) {
         return MBEDTLS_TEST_ERROR_ARG_NULL;
-    if( queue->num == 0 )
+    }
+    if (queue->num == 0) {
         return MBEDTLS_ERR_SSL_WANT_READ;
+    }
 
     *msg_len = queue->messages[queue->pos];
-    return ( *msg_len > buf_len ) ? MBEDTLS_TEST_ERROR_MESSAGE_TRUNCATED : 0;
+    return (*msg_len > buf_len) ? MBEDTLS_TEST_ERROR_MESSAGE_TRUNCATED : 0;
 }
 /*
  * Context for the I/O callbacks simulating network connection.
@@ -388,8 +390,7 @@
 
 #define MBEDTLS_MOCK_SOCKET_CONNECTED 1
 
-typedef struct mbedtls_mock_socket
-{
+typedef struct mbedtls_mock_socket {
     int status;
     mbedtls_test_buffer *input;
     mbedtls_test_buffer *output;
@@ -399,9 +400,9 @@
 /*
  * Setup and teardown functions for mock sockets.
  */
-void mbedtls_mock_socket_init( mbedtls_mock_socket *socket )
+void mbedtls_mock_socket_init(mbedtls_mock_socket *socket)
 {
-    memset( socket, 0, sizeof( *socket ) );
+    memset(socket, 0, sizeof(*socket));
 }
 
 /*
@@ -417,27 +418,27 @@
  * phenomenon that when closing a UDP connection the peer is not aware of the
  * connection having been closed.
  */
-void mbedtls_mock_socket_close( mbedtls_mock_socket* socket )
+void mbedtls_mock_socket_close(mbedtls_mock_socket *socket)
 {
-    if( socket == NULL )
+    if (socket == NULL) {
         return;
-
-    if( socket->input != NULL )
-    {
-        mbedtls_test_buffer_free( socket->input );
-        mbedtls_free( socket->input );
     }
 
-    if( socket->output != NULL )
-    {
-        mbedtls_test_buffer_free( socket->output );
-        mbedtls_free( socket->output );
+    if (socket->input != NULL) {
+        mbedtls_test_buffer_free(socket->input);
+        mbedtls_free(socket->input);
     }
 
-    if( socket->peer != NULL )
-        memset( socket->peer, 0, sizeof( *socket->peer ) );
+    if (socket->output != NULL) {
+        mbedtls_test_buffer_free(socket->output);
+        mbedtls_free(socket->output);
+    }
 
-    memset( socket, 0, sizeof( *socket ) );
+    if (socket->peer != NULL) {
+        memset(socket->peer, 0, sizeof(*socket->peer));
+    }
+
+    memset(socket, 0, sizeof(*socket));
 }
 
 /*
@@ -450,35 +451,31 @@
  * the correct value allows for simulation of MTU, sanity testing the mock
  * implementation and mocking TCP connections with lower memory cost.
  */
-int mbedtls_mock_socket_connect( mbedtls_mock_socket* peer1,
-                                 mbedtls_mock_socket* peer2,
-                                 size_t bufsize )
+int mbedtls_mock_socket_connect(mbedtls_mock_socket *peer1,
+                                mbedtls_mock_socket *peer2,
+                                size_t bufsize)
 {
     int ret = -1;
 
     peer1->output =
-        (mbedtls_test_buffer*) mbedtls_calloc( 1, sizeof( mbedtls_test_buffer ) );
-    if( peer1->output == NULL )
-    {
+        (mbedtls_test_buffer *) mbedtls_calloc(1, sizeof(mbedtls_test_buffer));
+    if (peer1->output == NULL) {
         ret = MBEDTLS_ERR_SSL_ALLOC_FAILED;
         goto exit;
     }
-    mbedtls_test_buffer_init( peer1->output );
-    if( 0 != ( ret = mbedtls_test_buffer_setup( peer1->output, bufsize ) ) )
-    {
+    mbedtls_test_buffer_init(peer1->output);
+    if (0 != (ret = mbedtls_test_buffer_setup(peer1->output, bufsize))) {
         goto exit;
     }
 
     peer2->output =
-        (mbedtls_test_buffer*) mbedtls_calloc( 1, sizeof( mbedtls_test_buffer) );
-    if( peer2->output == NULL )
-    {
+        (mbedtls_test_buffer *) mbedtls_calloc(1, sizeof(mbedtls_test_buffer));
+    if (peer2->output == NULL) {
         ret = MBEDTLS_ERR_SSL_ALLOC_FAILED;
         goto exit;
     }
-    mbedtls_test_buffer_init( peer2->output );
-    if( 0 != ( ret = mbedtls_test_buffer_setup( peer2->output, bufsize ) ) )
-    {
+    mbedtls_test_buffer_init(peer2->output);
+    if (0 != (ret = mbedtls_test_buffer_setup(peer2->output, bufsize))) {
         goto exit;
     }
 
@@ -492,10 +489,9 @@
 
 exit:
 
-    if( ret != 0 )
-    {
-        mbedtls_mock_socket_close( peer1 );
-        mbedtls_mock_socket_close( peer2 );
+    if (ret != 0) {
+        mbedtls_mock_socket_close(peer1);
+        mbedtls_mock_socket_close(peer2);
     }
 
     return ret;
@@ -505,58 +501,60 @@
  * Callbacks for simulating blocking I/O over connection-oriented transport.
  */
 
-int mbedtls_mock_tcp_send_b( void *ctx, const unsigned char *buf, size_t len )
+int mbedtls_mock_tcp_send_b(void *ctx, const unsigned char *buf, size_t len)
 {
-    mbedtls_mock_socket *socket = (mbedtls_mock_socket*) ctx;
+    mbedtls_mock_socket *socket = (mbedtls_mock_socket *) ctx;
 
-    if( socket == NULL || socket->status != MBEDTLS_MOCK_SOCKET_CONNECTED )
+    if (socket == NULL || socket->status != MBEDTLS_MOCK_SOCKET_CONNECTED) {
         return -1;
+    }
 
-    return mbedtls_test_buffer_put( socket->output, buf, len );
+    return mbedtls_test_buffer_put(socket->output, buf, len);
 }
 
-int mbedtls_mock_tcp_recv_b( void *ctx, unsigned char *buf, size_t len )
+int mbedtls_mock_tcp_recv_b(void *ctx, unsigned char *buf, size_t len)
 {
-    mbedtls_mock_socket *socket = (mbedtls_mock_socket*) ctx;
+    mbedtls_mock_socket *socket = (mbedtls_mock_socket *) ctx;
 
-    if( socket == NULL || socket->status != MBEDTLS_MOCK_SOCKET_CONNECTED )
+    if (socket == NULL || socket->status != MBEDTLS_MOCK_SOCKET_CONNECTED) {
         return -1;
+    }
 
-    return mbedtls_test_buffer_get( socket->input, buf, len );
+    return mbedtls_test_buffer_get(socket->input, buf, len);
 }
 
 /*
  * Callbacks for simulating non-blocking I/O over connection-oriented transport.
  */
 
-int mbedtls_mock_tcp_send_nb( void *ctx, const unsigned char *buf, size_t len )
+int mbedtls_mock_tcp_send_nb(void *ctx, const unsigned char *buf, size_t len)
 {
-    mbedtls_mock_socket *socket = (mbedtls_mock_socket*) ctx;
+    mbedtls_mock_socket *socket = (mbedtls_mock_socket *) ctx;
 
-    if( socket == NULL || socket->status != MBEDTLS_MOCK_SOCKET_CONNECTED )
+    if (socket == NULL || socket->status != MBEDTLS_MOCK_SOCKET_CONNECTED) {
         return -1;
+    }
 
-    if( socket->output->capacity == socket->output->content_length )
-    {
+    if (socket->output->capacity == socket->output->content_length) {
         return MBEDTLS_ERR_SSL_WANT_WRITE;
     }
 
-    return mbedtls_test_buffer_put( socket->output, buf, len );
+    return mbedtls_test_buffer_put(socket->output, buf, len);
 }
 
-int mbedtls_mock_tcp_recv_nb( void *ctx, unsigned char *buf, size_t len )
+int mbedtls_mock_tcp_recv_nb(void *ctx, unsigned char *buf, size_t len)
 {
-    mbedtls_mock_socket *socket = (mbedtls_mock_socket*) ctx;
+    mbedtls_mock_socket *socket = (mbedtls_mock_socket *) ctx;
 
-    if( socket == NULL || socket->status != MBEDTLS_MOCK_SOCKET_CONNECTED )
+    if (socket == NULL || socket->status != MBEDTLS_MOCK_SOCKET_CONNECTED) {
         return -1;
+    }
 
-    if( socket->input->content_length == 0 )
-    {
+    if (socket->input->content_length == 0) {
         return MBEDTLS_ERR_SSL_WANT_READ;
     }
 
-    return mbedtls_test_buffer_get( socket->input, buf, len );
+    return mbedtls_test_buffer_get(socket->input, buf, len);
 }
 
 /* Errors used in the message socket mocks */
@@ -572,14 +570,13 @@
  * considered as an owner of the input queue only, which is initialized and
  * freed in the respective setup and free calls.
  */
-typedef struct mbedtls_test_message_socket_context
-{
-    mbedtls_test_message_queue* queue_input;
-    mbedtls_test_message_queue* queue_output;
-    mbedtls_mock_socket* socket;
+typedef struct mbedtls_test_message_socket_context {
+    mbedtls_test_message_queue *queue_input;
+    mbedtls_test_message_queue *queue_output;
+    mbedtls_mock_socket *socket;
 } mbedtls_test_message_socket_context;
 
-void mbedtls_message_socket_init( mbedtls_test_message_socket_context *ctx )
+void mbedtls_message_socket_init(mbedtls_test_message_socket_context *ctx)
 {
     ctx->queue_input = NULL;
     ctx->queue_output = NULL;
@@ -595,19 +592,20 @@
  * \retval  MBEDTLS_ERR_SSL_ALLOC_FAILED, if allocation of a message
  *          queue failed.
  */
-int mbedtls_message_socket_setup( mbedtls_test_message_queue* queue_input,
-                                  mbedtls_test_message_queue* queue_output,
-                                  size_t queue_capacity,
-                                  mbedtls_mock_socket* socket,
-                                  mbedtls_test_message_socket_context* ctx )
+int mbedtls_message_socket_setup(mbedtls_test_message_queue *queue_input,
+                                 mbedtls_test_message_queue *queue_output,
+                                 size_t queue_capacity,
+                                 mbedtls_mock_socket *socket,
+                                 mbedtls_test_message_socket_context *ctx)
 {
-    int ret = mbedtls_test_message_queue_setup( queue_input, queue_capacity );
-    if( ret != 0 )
+    int ret = mbedtls_test_message_queue_setup(queue_input, queue_capacity);
+    if (ret != 0) {
         return ret;
+    }
     ctx->queue_input = queue_input;
     ctx->queue_output = queue_output;
     ctx->socket = socket;
-    mbedtls_mock_socket_init( socket );
+    mbedtls_mock_socket_init(socket);
 
     return 0;
 }
@@ -616,14 +614,15 @@
  * Close a given message socket context, along with the socket itself. Free the
  * memory allocated by the input queue.
  */
-void mbedtls_message_socket_close( mbedtls_test_message_socket_context* ctx )
+void mbedtls_message_socket_close(mbedtls_test_message_socket_context *ctx)
 {
-    if( ctx == NULL )
+    if (ctx == NULL) {
         return;
+    }
 
-    mbedtls_test_message_queue_free( ctx->queue_input );
-    mbedtls_mock_socket_close( ctx->socket );
-    memset( ctx, 0, sizeof( *ctx ) );
+    mbedtls_test_message_queue_free(ctx->queue_input);
+    mbedtls_mock_socket_close(ctx->socket);
+    memset(ctx, 0, sizeof(*ctx));
 }
 
 /*
@@ -638,28 +637,29 @@
  * This function will also return any error from
  * mbedtls_test_message_queue_push_info.
  */
-int mbedtls_mock_tcp_send_msg( void *ctx, const unsigned char *buf, size_t len )
+int mbedtls_mock_tcp_send_msg(void *ctx, const unsigned char *buf, size_t len)
 {
-    mbedtls_test_message_queue* queue;
-    mbedtls_mock_socket* socket;
-    mbedtls_test_message_socket_context *context = (mbedtls_test_message_socket_context*) ctx;
+    mbedtls_test_message_queue *queue;
+    mbedtls_mock_socket *socket;
+    mbedtls_test_message_socket_context *context = (mbedtls_test_message_socket_context *) ctx;
 
-    if( context == NULL || context->socket == NULL
-        || context->queue_output == NULL )
-    {
+    if (context == NULL || context->socket == NULL
+        || context->queue_output == NULL) {
         return MBEDTLS_TEST_ERROR_CONTEXT_ERROR;
     }
 
     queue = context->queue_output;
     socket = context->socket;
 
-    if( queue->num >= queue->capacity )
+    if (queue->num >= queue->capacity) {
         return MBEDTLS_ERR_SSL_WANT_WRITE;
+    }
 
-    if( mbedtls_mock_tcp_send_b( socket, buf, len ) != (int) len )
+    if (mbedtls_mock_tcp_send_b(socket, buf, len) != (int) len) {
         return MBEDTLS_TEST_ERROR_SEND_FAILED;
+    }
 
-    return mbedtls_test_message_queue_push_info( queue, len );
+    return mbedtls_test_message_queue_push_info(queue, len);
 }
 
 /*
@@ -674,18 +674,17 @@
  * This function will also return any error other than
  * MBEDTLS_TEST_ERROR_MESSAGE_TRUNCATED from mbedtls_test_message_queue_peek_info.
  */
-int mbedtls_mock_tcp_recv_msg( void *ctx, unsigned char *buf, size_t buf_len )
+int mbedtls_mock_tcp_recv_msg(void *ctx, unsigned char *buf, size_t buf_len)
 {
-    mbedtls_test_message_queue* queue;
-    mbedtls_mock_socket* socket;
-    mbedtls_test_message_socket_context *context = (mbedtls_test_message_socket_context*) ctx;
+    mbedtls_test_message_queue *queue;
+    mbedtls_mock_socket *socket;
+    mbedtls_test_message_socket_context *context = (mbedtls_test_message_socket_context *) ctx;
     size_t drop_len = 0;
     size_t msg_len;
     int ret;
 
-    if( context == NULL || context->socket == NULL
-        || context->queue_input == NULL )
-    {
+    if (context == NULL || context->socket == NULL
+        || context->queue_input == NULL) {
         return MBEDTLS_TEST_ERROR_CONTEXT_ERROR;
     }
 
@@ -694,33 +693,30 @@
 
     /* Peek first, so that in case of a socket error the data remains in
      * the queue. */
-    ret = mbedtls_test_message_queue_peek_info( queue, buf_len, &msg_len );
-    if( ret == MBEDTLS_TEST_ERROR_MESSAGE_TRUNCATED )
-    {
+    ret = mbedtls_test_message_queue_peek_info(queue, buf_len, &msg_len);
+    if (ret == MBEDTLS_TEST_ERROR_MESSAGE_TRUNCATED) {
         /* Calculate how much to drop */
         drop_len = msg_len - buf_len;
 
         /* Set the requested message len to be buffer length */
         msg_len = buf_len;
-    } else if( ret != 0 )
-    {
+    } else if (ret != 0) {
         return ret;
     }
 
-    if( mbedtls_mock_tcp_recv_b( socket, buf, msg_len ) != (int) msg_len )
+    if (mbedtls_mock_tcp_recv_b(socket, buf, msg_len) != (int) msg_len) {
         return MBEDTLS_TEST_ERROR_RECV_FAILED;
+    }
 
-    if( ret == MBEDTLS_TEST_ERROR_MESSAGE_TRUNCATED )
-    {
+    if (ret == MBEDTLS_TEST_ERROR_MESSAGE_TRUNCATED) {
         /* Drop the remaining part of the message */
-        if( mbedtls_mock_tcp_recv_b( socket, NULL, drop_len ) != (int) drop_len )
-        {
-          /* Inconsistent state - part of the message was read,
-           * and a part couldn't. Not much we can do here, but it should not
-           * happen in test environment, unless forced manually. */
+        if (mbedtls_mock_tcp_recv_b(socket, NULL, drop_len) != (int) drop_len) {
+            /* Inconsistent state - part of the message was read,
+             * and a part couldn't. Not much we can do here, but it should not
+             * happen in test environment, unless forced manually. */
         }
     }
-    mbedtls_test_message_queue_pop_info( queue, buf_len );
+    mbedtls_test_message_queue_pop_info(queue, buf_len);
 
     return msg_len;
 }
@@ -732,18 +728,16 @@
 /*
  * Structure with endpoint's certificates for SSL communication tests.
  */
-typedef struct mbedtls_endpoint_certificate
-{
-    mbedtls_x509_crt* ca_cert;
-    mbedtls_x509_crt* cert;
-    mbedtls_pk_context* pkey;
+typedef struct mbedtls_endpoint_certificate {
+    mbedtls_x509_crt *ca_cert;
+    mbedtls_x509_crt *cert;
+    mbedtls_pk_context *pkey;
 } mbedtls_endpoint_certificate;
 
 /*
  * Endpoint structure for SSL communication tests.
  */
-typedef struct mbedtls_endpoint
-{
+typedef struct mbedtls_endpoint {
     const char *name;
     mbedtls_ssl_context ssl;
     mbedtls_ssl_config conf;
@@ -756,34 +750,29 @@
 /*
  * Deinitializes certificates from endpoint represented by \p ep.
  */
-void mbedtls_endpoint_certificate_free( mbedtls_endpoint *ep )
+void mbedtls_endpoint_certificate_free(mbedtls_endpoint *ep)
 {
-    mbedtls_endpoint_certificate *cert = &( ep->cert );
-    if( cert != NULL )
-    {
-        if( cert->ca_cert != NULL )
-        {
-            mbedtls_x509_crt_free( cert->ca_cert );
-            mbedtls_free( cert->ca_cert );
+    mbedtls_endpoint_certificate *cert = &(ep->cert);
+    if (cert != NULL) {
+        if (cert->ca_cert != NULL) {
+            mbedtls_x509_crt_free(cert->ca_cert);
+            mbedtls_free(cert->ca_cert);
             cert->ca_cert = NULL;
         }
-        if( cert->cert != NULL )
-        {
-            mbedtls_x509_crt_free( cert->cert );
-            mbedtls_free( cert->cert );
+        if (cert->cert != NULL) {
+            mbedtls_x509_crt_free(cert->cert);
+            mbedtls_free(cert->cert);
             cert->cert = NULL;
         }
-        if( cert->pkey != NULL )
-        {
+        if (cert->pkey != NULL) {
 #if defined(MBEDTLS_USE_PSA_CRYPTO)
-            if( mbedtls_pk_get_type( cert->pkey ) == MBEDTLS_PK_OPAQUE )
-            {
+            if (mbedtls_pk_get_type(cert->pkey) == MBEDTLS_PK_OPAQUE) {
                 mbedtls_svc_key_id_t *key_slot = cert->pkey->pk_ctx;
-                psa_destroy_key( *key_slot );
+                psa_destroy_key(*key_slot);
             }
 #endif
-            mbedtls_pk_free( cert->pkey );
-            mbedtls_free( cert->pkey );
+            mbedtls_pk_free(cert->pkey);
+            mbedtls_free(cert->pkey);
             cert->pkey = NULL;
         }
     }
@@ -795,103 +784,91 @@
  *
  * \retval  0 on success, otherwise error code.
  */
-int mbedtls_endpoint_certificate_init( mbedtls_endpoint *ep, int pk_alg )
+int mbedtls_endpoint_certificate_init(mbedtls_endpoint *ep, int pk_alg)
 {
     int i = 0;
     int ret = -1;
     mbedtls_endpoint_certificate *cert = NULL;
 
-    if( ep == NULL )
-    {
+    if (ep == NULL) {
         return MBEDTLS_ERR_SSL_BAD_INPUT_DATA;
     }
 
-    cert = &( ep->cert );
-    ASSERT_ALLOC( cert->ca_cert, 1 );
-    ASSERT_ALLOC( cert->cert, 1 );
-    ASSERT_ALLOC( cert->pkey, 1 );
+    cert = &(ep->cert);
+    ASSERT_ALLOC(cert->ca_cert, 1);
+    ASSERT_ALLOC(cert->cert, 1);
+    ASSERT_ALLOC(cert->pkey, 1);
 
-    mbedtls_x509_crt_init( cert->ca_cert );
-    mbedtls_x509_crt_init( cert->cert );
-    mbedtls_pk_init( cert->pkey );
+    mbedtls_x509_crt_init(cert->ca_cert);
+    mbedtls_x509_crt_init(cert->cert);
+    mbedtls_pk_init(cert->pkey);
 
     /* Load the trusted CA */
 
-    for( i = 0; mbedtls_test_cas_der[i] != NULL; i++ )
-    {
-        ret = mbedtls_x509_crt_parse_der( cert->ca_cert,
-                        (const unsigned char *) mbedtls_test_cas_der[i],
-                        mbedtls_test_cas_der_len[i] );
-        TEST_ASSERT( ret == 0 );
+    for (i = 0; mbedtls_test_cas_der[i] != NULL; i++) {
+        ret = mbedtls_x509_crt_parse_der(cert->ca_cert,
+                                         (const unsigned char *) mbedtls_test_cas_der[i],
+                                         mbedtls_test_cas_der_len[i]);
+        TEST_ASSERT(ret == 0);
     }
 
     /* Load own certificate and private key */
 
-    if( ep->conf.endpoint == MBEDTLS_SSL_IS_SERVER )
-    {
-        if( pk_alg == MBEDTLS_PK_RSA )
-        {
-            ret = mbedtls_x509_crt_parse( cert->cert,
-                    (const unsigned char*) mbedtls_test_srv_crt_rsa_sha256_der,
-                    mbedtls_test_srv_crt_rsa_sha256_der_len );
-            TEST_ASSERT( ret == 0 );
+    if (ep->conf.endpoint == MBEDTLS_SSL_IS_SERVER) {
+        if (pk_alg == MBEDTLS_PK_RSA) {
+            ret = mbedtls_x509_crt_parse(cert->cert,
+                                         (const unsigned char *) mbedtls_test_srv_crt_rsa_sha256_der,
+                                         mbedtls_test_srv_crt_rsa_sha256_der_len);
+            TEST_ASSERT(ret == 0);
 
-            ret = mbedtls_pk_parse_key( cert->pkey,
-                            (const unsigned char*) mbedtls_test_srv_key_rsa_der,
-                            mbedtls_test_srv_key_rsa_der_len, NULL, 0 );
-            TEST_ASSERT( ret == 0 );
+            ret = mbedtls_pk_parse_key(cert->pkey,
+                                       (const unsigned char *) mbedtls_test_srv_key_rsa_der,
+                                       mbedtls_test_srv_key_rsa_der_len, NULL, 0);
+            TEST_ASSERT(ret == 0);
+        } else {
+            ret = mbedtls_x509_crt_parse(cert->cert,
+                                         (const unsigned char *) mbedtls_test_srv_crt_ec_der,
+                                         mbedtls_test_srv_crt_ec_der_len);
+            TEST_ASSERT(ret == 0);
+
+            ret = mbedtls_pk_parse_key(cert->pkey,
+                                       (const unsigned char *) mbedtls_test_srv_key_ec_der,
+                                       mbedtls_test_srv_key_ec_der_len, NULL, 0);
+            TEST_ASSERT(ret == 0);
         }
-        else
-        {
-            ret = mbedtls_x509_crt_parse( cert->cert,
-                            (const unsigned char*) mbedtls_test_srv_crt_ec_der,
-                            mbedtls_test_srv_crt_ec_der_len );
-            TEST_ASSERT( ret == 0 );
+    } else {
+        if (pk_alg == MBEDTLS_PK_RSA) {
+            ret = mbedtls_x509_crt_parse(cert->cert,
+                                         (const unsigned char *) mbedtls_test_cli_crt_rsa_der,
+                                         mbedtls_test_cli_crt_rsa_der_len);
+            TEST_ASSERT(ret == 0);
 
-            ret = mbedtls_pk_parse_key( cert->pkey,
-                            (const unsigned char*) mbedtls_test_srv_key_ec_der,
-                            mbedtls_test_srv_key_ec_der_len, NULL, 0 );
-            TEST_ASSERT( ret == 0 );
-        }
-    }
-    else
-    {
-        if( pk_alg == MBEDTLS_PK_RSA )
-        {
-            ret = mbedtls_x509_crt_parse( cert->cert,
-                          (const unsigned char *) mbedtls_test_cli_crt_rsa_der,
-                          mbedtls_test_cli_crt_rsa_der_len );
-            TEST_ASSERT( ret == 0 );
+            ret = mbedtls_pk_parse_key(cert->pkey,
+                                       (const unsigned char *) mbedtls_test_cli_key_rsa_der,
+                                       mbedtls_test_cli_key_rsa_der_len, NULL, 0);
+            TEST_ASSERT(ret == 0);
+        } else {
+            ret = mbedtls_x509_crt_parse(cert->cert,
+                                         (const unsigned char *) mbedtls_test_cli_crt_ec_der,
+                                         mbedtls_test_cli_crt_ec_len);
+            TEST_ASSERT(ret == 0);
 
-            ret = mbedtls_pk_parse_key( cert->pkey,
-                          (const unsigned char *) mbedtls_test_cli_key_rsa_der,
-                          mbedtls_test_cli_key_rsa_der_len, NULL, 0 );
-            TEST_ASSERT( ret == 0 );
-        }
-        else
-        {
-            ret = mbedtls_x509_crt_parse( cert->cert,
-                          (const unsigned char *) mbedtls_test_cli_crt_ec_der,
-                          mbedtls_test_cli_crt_ec_len );
-            TEST_ASSERT( ret == 0 );
-
-            ret = mbedtls_pk_parse_key( cert->pkey,
-                          (const unsigned char *) mbedtls_test_cli_key_ec_der,
-                          mbedtls_test_cli_key_ec_der_len, NULL, 0 );
-            TEST_ASSERT( ret == 0 );
+            ret = mbedtls_pk_parse_key(cert->pkey,
+                                       (const unsigned char *) mbedtls_test_cli_key_ec_der,
+                                       mbedtls_test_cli_key_ec_der_len, NULL, 0);
+            TEST_ASSERT(ret == 0);
         }
     }
 
-    mbedtls_ssl_conf_ca_chain( &( ep->conf ), cert->ca_cert, NULL );
+    mbedtls_ssl_conf_ca_chain(&(ep->conf), cert->ca_cert, NULL);
 
-    ret = mbedtls_ssl_conf_own_cert( &( ep->conf ), cert->cert,
-                                     cert->pkey );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_ssl_conf_own_cert(&(ep->conf), cert->cert,
+                                    cert->pkey);
+    TEST_ASSERT(ret == 0);
 
 exit:
-    if( ret != 0 )
-    {
-        mbedtls_endpoint_certificate_free( ep );
+    if (ret != 0) {
+        mbedtls_endpoint_certificate_free(ep);
     }
 
     return ret;
@@ -911,87 +888,85 @@
  *
  * \retval  0 on success, otherwise error code.
  */
-int mbedtls_endpoint_init( mbedtls_endpoint *ep, int endpoint_type, int pk_alg,
-                           mbedtls_test_message_socket_context *dtls_context,
-                           mbedtls_test_message_queue *input_queue,
-                           mbedtls_test_message_queue *output_queue,
-                           const mbedtls_ecp_group_id *curves )
+int mbedtls_endpoint_init(mbedtls_endpoint *ep, int endpoint_type, int pk_alg,
+                          mbedtls_test_message_socket_context *dtls_context,
+                          mbedtls_test_message_queue *input_queue,
+                          mbedtls_test_message_queue *output_queue,
+                          const mbedtls_ecp_group_id *curves)
 {
     int ret = -1;
 
-    if( dtls_context != NULL && ( input_queue == NULL || output_queue == NULL ) )
+    if (dtls_context != NULL && (input_queue == NULL || output_queue == NULL)) {
         return MBEDTLS_ERR_SSL_BAD_INPUT_DATA;
-
-    if( ep == NULL )
-        return MBEDTLS_ERR_SSL_BAD_INPUT_DATA;
-
-    memset( ep, 0, sizeof( *ep ) );
-
-    ep->name = ( endpoint_type == MBEDTLS_SSL_IS_SERVER ) ? "Server" : "Client";
-
-    mbedtls_ssl_init( &( ep->ssl ) );
-    mbedtls_ssl_config_init( &( ep->conf ) );
-    mbedtls_ctr_drbg_init( &( ep->ctr_drbg ) );
-    mbedtls_ssl_conf_rng( &( ep->conf ),
-        mbedtls_ctr_drbg_random,
-        &( ep->ctr_drbg ) );
-    mbedtls_entropy_init( &( ep->entropy ) );
-    if( dtls_context != NULL )
-    {
-        TEST_ASSERT( mbedtls_message_socket_setup( input_queue, output_queue,
-                                                   100, &( ep->socket ),
-                                                   dtls_context ) == 0 );
-    }
-    else
-    {
-        mbedtls_mock_socket_init( &( ep->socket ) );
     }
 
-    ret = mbedtls_ctr_drbg_seed( &( ep->ctr_drbg ), mbedtls_entropy_func,
-                    &( ep->entropy ), (const unsigned char *) ( ep->name ),
-                    strlen( ep->name ) );
-    TEST_ASSERT( ret == 0 );
+    if (ep == NULL) {
+        return MBEDTLS_ERR_SSL_BAD_INPUT_DATA;
+    }
+
+    memset(ep, 0, sizeof(*ep));
+
+    ep->name = (endpoint_type == MBEDTLS_SSL_IS_SERVER) ? "Server" : "Client";
+
+    mbedtls_ssl_init(&(ep->ssl));
+    mbedtls_ssl_config_init(&(ep->conf));
+    mbedtls_ctr_drbg_init(&(ep->ctr_drbg));
+    mbedtls_ssl_conf_rng(&(ep->conf),
+                         mbedtls_ctr_drbg_random,
+                         &(ep->ctr_drbg));
+    mbedtls_entropy_init(&(ep->entropy));
+    if (dtls_context != NULL) {
+        TEST_ASSERT(mbedtls_message_socket_setup(input_queue, output_queue,
+                                                 100, &(ep->socket),
+                                                 dtls_context) == 0);
+    } else {
+        mbedtls_mock_socket_init(&(ep->socket));
+    }
+
+    ret = mbedtls_ctr_drbg_seed(&(ep->ctr_drbg), mbedtls_entropy_func,
+                                &(ep->entropy), (const unsigned char *) (ep->name),
+                                strlen(ep->name));
+    TEST_ASSERT(ret == 0);
 
     /* Non-blocking callbacks without timeout */
-    if( dtls_context != NULL )
-    {
-        mbedtls_ssl_set_bio( &( ep->ssl ), dtls_context,
-            mbedtls_mock_tcp_send_msg,
-            mbedtls_mock_tcp_recv_msg,
-            NULL );
-    }
-    else
-    {
-        mbedtls_ssl_set_bio( &( ep->ssl ), &( ep->socket ),
-            mbedtls_mock_tcp_send_nb,
-            mbedtls_mock_tcp_recv_nb,
-            NULL );
+    if (dtls_context != NULL) {
+        mbedtls_ssl_set_bio(&(ep->ssl), dtls_context,
+                            mbedtls_mock_tcp_send_msg,
+                            mbedtls_mock_tcp_recv_msg,
+                            NULL);
+    } else {
+        mbedtls_ssl_set_bio(&(ep->ssl), &(ep->socket),
+                            mbedtls_mock_tcp_send_nb,
+                            mbedtls_mock_tcp_recv_nb,
+                            NULL);
     }
 
-    ret = mbedtls_ssl_config_defaults( &( ep->conf ), endpoint_type,
-                                       ( dtls_context != NULL ) ?
-                                           MBEDTLS_SSL_TRANSPORT_DATAGRAM :
-                                           MBEDTLS_SSL_TRANSPORT_STREAM,
-                                       MBEDTLS_SSL_PRESET_DEFAULT );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_ssl_config_defaults(&(ep->conf), endpoint_type,
+                                      (dtls_context != NULL) ?
+                                      MBEDTLS_SSL_TRANSPORT_DATAGRAM :
+                                      MBEDTLS_SSL_TRANSPORT_STREAM,
+                                      MBEDTLS_SSL_PRESET_DEFAULT);
+    TEST_ASSERT(ret == 0);
 
 #if defined(MBEDTLS_ECP_C)
-    if( curves != NULL )
-        mbedtls_ssl_conf_curves( &(ep->conf), curves );
+    if (curves != NULL) {
+        mbedtls_ssl_conf_curves(&(ep->conf), curves);
+    }
 #else
     (void) curves;
 #endif
 
-    ret = mbedtls_ssl_setup( &( ep->ssl ), &( ep->conf ) );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_ssl_setup(&(ep->ssl), &(ep->conf));
+    TEST_ASSERT(ret == 0);
 
 #if defined(MBEDTLS_SSL_PROTO_DTLS) && defined(MBEDTLS_SSL_SRV_C)
-    if( endpoint_type == MBEDTLS_SSL_IS_SERVER && dtls_context != NULL )
-         mbedtls_ssl_conf_dtls_cookies( &( ep->conf ), NULL, NULL, NULL );
+    if (endpoint_type == MBEDTLS_SSL_IS_SERVER && dtls_context != NULL) {
+        mbedtls_ssl_conf_dtls_cookies(&(ep->conf), NULL, NULL, NULL);
+    }
 #endif
 
-    ret = mbedtls_endpoint_certificate_init( ep, pk_alg );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_endpoint_certificate_init(ep, pk_alg);
+    TEST_ASSERT(ret == 0);
 
 exit:
     return ret;
@@ -1000,23 +975,20 @@
 /*
  * Deinitializes endpoint represented by \p ep.
  */
-void mbedtls_endpoint_free( mbedtls_endpoint *ep,
-                            mbedtls_test_message_socket_context *context )
+void mbedtls_endpoint_free(mbedtls_endpoint *ep,
+                           mbedtls_test_message_socket_context *context)
 {
-    mbedtls_endpoint_certificate_free( ep );
+    mbedtls_endpoint_certificate_free(ep);
 
-    mbedtls_ssl_free( &( ep->ssl ) );
-    mbedtls_ssl_config_free( &( ep->conf ) );
-    mbedtls_ctr_drbg_free( &( ep->ctr_drbg ) );
-    mbedtls_entropy_free( &( ep->entropy ) );
+    mbedtls_ssl_free(&(ep->ssl));
+    mbedtls_ssl_config_free(&(ep->conf));
+    mbedtls_ctr_drbg_free(&(ep->ctr_drbg));
+    mbedtls_entropy_free(&(ep->entropy));
 
-    if( context != NULL )
-    {
-        mbedtls_message_socket_close( context );
-    }
-    else
-    {
-        mbedtls_mock_socket_close( &( ep->socket ) );
+    if (context != NULL) {
+        mbedtls_message_socket_close(context);
+    } else {
+        mbedtls_mock_socket_close(&(ep->socket));
     }
 }
 
@@ -1027,45 +999,40 @@
  *
  * \retval  0 on success, otherwise error code.
  */
-int mbedtls_move_handshake_to_state( mbedtls_ssl_context *ssl,
-                                     mbedtls_ssl_context *second_ssl,
-                                     int state )
+int mbedtls_move_handshake_to_state(mbedtls_ssl_context *ssl,
+                                    mbedtls_ssl_context *second_ssl,
+                                    int state)
 {
     enum { BUFFSIZE = 1024 };
     int max_steps = 1000;
     int ret = 0;
 
-    if( ssl == NULL || second_ssl == NULL )
-    {
+    if (ssl == NULL || second_ssl == NULL) {
         return MBEDTLS_ERR_SSL_BAD_INPUT_DATA;
     }
 
     /* Perform communication via connected sockets */
-    while( ( ssl->state != state ) && ( --max_steps >= 0 ) )
-    {
+    while ((ssl->state != state) && (--max_steps >= 0)) {
         /* If /p second_ssl ends the handshake procedure before /p ssl then
          * there is no need to call the next step */
-        if( second_ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER )
-        {
-            ret = mbedtls_ssl_handshake_step( second_ssl );
-            if( ret != 0 && ret != MBEDTLS_ERR_SSL_WANT_READ &&
-                            ret != MBEDTLS_ERR_SSL_WANT_WRITE )
-            {
+        if (second_ssl->state != MBEDTLS_SSL_HANDSHAKE_OVER) {
+            ret = mbedtls_ssl_handshake_step(second_ssl);
+            if (ret != 0 && ret != MBEDTLS_ERR_SSL_WANT_READ &&
+                ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
                 return ret;
             }
         }
 
         /* We only care about the \p ssl state and returns, so we call it last,
          * to leave the iteration as soon as the state is as expected. */
-        ret = mbedtls_ssl_handshake_step( ssl );
-        if( ret != 0 && ret != MBEDTLS_ERR_SSL_WANT_READ &&
-                        ret != MBEDTLS_ERR_SSL_WANT_WRITE )
-        {
+        ret = mbedtls_ssl_handshake_step(ssl);
+        if (ret != 0 && ret != MBEDTLS_ERR_SSL_WANT_READ &&
+            ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
             return ret;
         }
     }
 
-    return ( max_steps >= 0 ) ? ret : -1;
+    return (max_steps >= 0) ? ret : -1;
 }
 
 #endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C */
@@ -1073,38 +1040,32 @@
 /*
  * Write application data. Increase write counter if necessary.
  */
-int mbedtls_ssl_write_fragment( mbedtls_ssl_context *ssl, unsigned char *buf,
-                                int buf_len, int *written,
-                                const int expected_fragments )
+int mbedtls_ssl_write_fragment(mbedtls_ssl_context *ssl, unsigned char *buf,
+                               int buf_len, int *written,
+                               const int expected_fragments)
 {
-    int ret = mbedtls_ssl_write( ssl, buf + *written, buf_len - *written );
-    if( ret > 0 )
-    {
+    int ret = mbedtls_ssl_write(ssl, buf + *written, buf_len - *written);
+    if (ret > 0) {
         *written += ret;
     }
 
-    if( expected_fragments == 0 )
-    {
+    if (expected_fragments == 0) {
         /* Used for DTLS and the message size larger than MFL. In that case
          * the message can not be fragmented and the library should return
          * MBEDTLS_ERR_SSL_BAD_INPUT_DATA error. This error must be returned
          * to prevent a dead loop inside mbedtls_exchange_data(). */
         return ret;
-    }
-    else if( expected_fragments == 1 )
-    {
+    } else if (expected_fragments == 1) {
         /* Used for TLS/DTLS and the message size lower than MFL */
-        TEST_ASSERT( ret == buf_len ||
-                     ret == MBEDTLS_ERR_SSL_WANT_READ ||
-                     ret == MBEDTLS_ERR_SSL_WANT_WRITE );
-    }
-    else
-    {
+        TEST_ASSERT(ret == buf_len ||
+                    ret == MBEDTLS_ERR_SSL_WANT_READ ||
+                    ret == MBEDTLS_ERR_SSL_WANT_WRITE);
+    } else {
         /* Used for TLS and the message size larger than MFL */
-        TEST_ASSERT( expected_fragments > 1 );
-        TEST_ASSERT( ( ret >= 0 && ret <= buf_len ) ||
-                       ret == MBEDTLS_ERR_SSL_WANT_READ ||
-                       ret == MBEDTLS_ERR_SSL_WANT_WRITE );
+        TEST_ASSERT(expected_fragments > 1);
+        TEST_ASSERT((ret >= 0 && ret <= buf_len) ||
+                    ret == MBEDTLS_ERR_SSL_WANT_READ ||
+                    ret == MBEDTLS_ERR_SSL_WANT_WRITE);
     }
 
     return 0;
@@ -1117,33 +1078,27 @@
 /*
  * Read application data and increase read counter and fragments counter if necessary.
  */
-int mbedtls_ssl_read_fragment( mbedtls_ssl_context *ssl, unsigned char *buf,
-                               int buf_len, int *read,
-                               int *fragments, const int expected_fragments )
+int mbedtls_ssl_read_fragment(mbedtls_ssl_context *ssl, unsigned char *buf,
+                              int buf_len, int *read,
+                              int *fragments, const int expected_fragments)
 {
-    int ret = mbedtls_ssl_read( ssl, buf + *read, buf_len - *read );
-    if( ret > 0 )
-    {
-        ( *fragments )++;
+    int ret = mbedtls_ssl_read(ssl, buf + *read, buf_len - *read);
+    if (ret > 0) {
+        (*fragments)++;
         *read += ret;
     }
 
-    if( expected_fragments == 0 )
-    {
-        TEST_ASSERT( ret == 0 );
-    }
-    else if( expected_fragments == 1 )
-    {
-        TEST_ASSERT( ret == buf_len ||
-                     ret == MBEDTLS_ERR_SSL_WANT_READ ||
-                     ret == MBEDTLS_ERR_SSL_WANT_WRITE );
-    }
-    else
-    {
-        TEST_ASSERT( expected_fragments > 1 );
-        TEST_ASSERT( ( ret >= 0 && ret <= buf_len ) ||
-                       ret == MBEDTLS_ERR_SSL_WANT_READ ||
-                       ret == MBEDTLS_ERR_SSL_WANT_WRITE );
+    if (expected_fragments == 0) {
+        TEST_ASSERT(ret == 0);
+    } else if (expected_fragments == 1) {
+        TEST_ASSERT(ret == buf_len ||
+                    ret == MBEDTLS_ERR_SSL_WANT_READ ||
+                    ret == MBEDTLS_ERR_SSL_WANT_WRITE);
+    } else {
+        TEST_ASSERT(expected_fragments > 1);
+        TEST_ASSERT((ret >= 0 && ret <= buf_len) ||
+                    ret == MBEDTLS_ERR_SSL_WANT_READ ||
+                    ret == MBEDTLS_ERR_SSL_WANT_WRITE);
     }
 
     return 0;
@@ -1159,54 +1114,52 @@
  * and version.
  */
 
-#define CHK( x )                                \
+#define CHK(x)                                \
     do                                          \
     {                                           \
-        if( !( x ) )                            \
+        if (!(x))                            \
         {                                       \
             ret = -1;                           \
             goto cleanup;                       \
         }                                       \
-    } while( 0 )
+    } while (0)
 
-void set_ciphersuite( mbedtls_ssl_config *conf, const char *cipher,
-                      int* forced_ciphersuite )
+void set_ciphersuite(mbedtls_ssl_config *conf, const char *cipher,
+                     int *forced_ciphersuite)
 {
     const mbedtls_ssl_ciphersuite_t *ciphersuite_info;
-    forced_ciphersuite[0] = mbedtls_ssl_get_ciphersuite_id( cipher );
+    forced_ciphersuite[0] = mbedtls_ssl_get_ciphersuite_id(cipher);
     forced_ciphersuite[1] = 0;
 
     ciphersuite_info =
-        mbedtls_ssl_ciphersuite_from_id( forced_ciphersuite[0] );
+        mbedtls_ssl_ciphersuite_from_id(forced_ciphersuite[0]);
 
-    TEST_ASSERT( ciphersuite_info != NULL );
-    TEST_ASSERT( ciphersuite_info->min_minor_ver <= conf->max_minor_ver );
-    TEST_ASSERT( ciphersuite_info->max_minor_ver >= conf->min_minor_ver );
+    TEST_ASSERT(ciphersuite_info != NULL);
+    TEST_ASSERT(ciphersuite_info->min_minor_ver <= conf->max_minor_ver);
+    TEST_ASSERT(ciphersuite_info->max_minor_ver >= conf->min_minor_ver);
 
-    if( conf->max_minor_ver > ciphersuite_info->max_minor_ver )
-    {
+    if (conf->max_minor_ver > ciphersuite_info->max_minor_ver) {
         conf->max_minor_ver = ciphersuite_info->max_minor_ver;
     }
-    if( conf->min_minor_ver < ciphersuite_info->min_minor_ver )
-    {
+    if (conf->min_minor_ver < ciphersuite_info->min_minor_ver) {
         conf->min_minor_ver = ciphersuite_info->min_minor_ver;
     }
 
-    mbedtls_ssl_conf_ciphersuites( conf, forced_ciphersuite );
+    mbedtls_ssl_conf_ciphersuites(conf, forced_ciphersuite);
 
 exit:
     return;
 }
 
-int psk_dummy_callback( void *p_info, mbedtls_ssl_context *ssl,
-                  const unsigned char *name, size_t name_len )
+int psk_dummy_callback(void *p_info, mbedtls_ssl_context *ssl,
+                       const unsigned char *name, size_t name_len)
 {
     (void) p_info;
     (void) ssl;
     (void) name;
     (void) name_len;
 
-    return ( 0 );
+    return 0;
 }
 
 #if MBEDTLS_SSL_CID_OUT_LEN_MAX > MBEDTLS_SSL_CID_IN_LEN_MAX
@@ -1215,12 +1168,12 @@
 #define SSL_CID_LEN_MIN MBEDTLS_SSL_CID_OUT_LEN_MAX
 #endif
 
-static int build_transforms( mbedtls_ssl_transform *t_in,
-                             mbedtls_ssl_transform *t_out,
-                             int cipher_type, int hash_id,
-                             int etm, int tag_mode, int ver,
-                             size_t cid0_len,
-                             size_t cid1_len )
+static int build_transforms(mbedtls_ssl_transform *t_in,
+                            mbedtls_ssl_transform *t_out,
+                            int cipher_type, int hash_id,
+                            int etm, int tag_mode, int ver,
+                            size_t cid0_len,
+                            size_t cid1_len)
 {
     mbedtls_cipher_info_t const *cipher_info;
     int ret = 0;
@@ -1231,11 +1184,11 @@
     unsigned char iv_enc[16], iv_dec[16];
 
 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
-    unsigned char cid0[ SSL_CID_LEN_MIN ];
-    unsigned char cid1[ SSL_CID_LEN_MIN ];
+    unsigned char cid0[SSL_CID_LEN_MIN];
+    unsigned char cid1[SSL_CID_LEN_MIN];
 
-    mbedtls_test_rnd_std_rand( NULL, cid0, sizeof( cid0 ) );
-    mbedtls_test_rnd_std_rand( NULL, cid1, sizeof( cid1 ) );
+    mbedtls_test_rnd_std_rand(NULL, cid0, sizeof(cid0));
+    mbedtls_test_rnd_std_rand(NULL, cid1, sizeof(cid1));
 #else
     ((void) cid0_len);
     ((void) cid1_len);
@@ -1244,91 +1197,87 @@
     maclen = 0;
 
     /* Pick cipher */
-    cipher_info = mbedtls_cipher_info_from_type( cipher_type );
-    CHK( cipher_info != NULL );
-    CHK( cipher_info->iv_size <= 16 );
-    CHK( cipher_info->key_bitlen % 8 == 0 );
+    cipher_info = mbedtls_cipher_info_from_type(cipher_type);
+    CHK(cipher_info != NULL);
+    CHK(cipher_info->iv_size <= 16);
+    CHK(cipher_info->key_bitlen % 8 == 0);
 
     /* Pick keys */
     keylen = cipher_info->key_bitlen / 8;
     /* Allocate `keylen + 1` bytes to ensure that we get
      * a non-NULL pointers from `mbedtls_calloc` even if
      * `keylen == 0` in the case of the NULL cipher. */
-    CHK( ( key0 = mbedtls_calloc( 1, keylen + 1 ) ) != NULL );
-    CHK( ( key1 = mbedtls_calloc( 1, keylen + 1 ) ) != NULL );
-    memset( key0, 0x1, keylen );
-    memset( key1, 0x2, keylen );
+    CHK((key0 = mbedtls_calloc(1, keylen + 1)) != NULL);
+    CHK((key1 = mbedtls_calloc(1, keylen + 1)) != NULL);
+    memset(key0, 0x1, keylen);
+    memset(key1, 0x2, keylen);
 
     /* Setup cipher contexts */
-    CHK( mbedtls_cipher_setup( &t_in->cipher_ctx_enc,  cipher_info ) == 0 );
-    CHK( mbedtls_cipher_setup( &t_in->cipher_ctx_dec,  cipher_info ) == 0 );
-    CHK( mbedtls_cipher_setup( &t_out->cipher_ctx_enc, cipher_info ) == 0 );
-    CHK( mbedtls_cipher_setup( &t_out->cipher_ctx_dec, cipher_info ) == 0 );
+    CHK(mbedtls_cipher_setup(&t_in->cipher_ctx_enc,  cipher_info) == 0);
+    CHK(mbedtls_cipher_setup(&t_in->cipher_ctx_dec,  cipher_info) == 0);
+    CHK(mbedtls_cipher_setup(&t_out->cipher_ctx_enc, cipher_info) == 0);
+    CHK(mbedtls_cipher_setup(&t_out->cipher_ctx_dec, cipher_info) == 0);
 
 #if defined(MBEDTLS_CIPHER_MODE_CBC)
-    if( cipher_info->mode == MBEDTLS_MODE_CBC )
-    {
-        CHK( mbedtls_cipher_set_padding_mode( &t_in->cipher_ctx_enc,
-                                              MBEDTLS_PADDING_NONE ) == 0 );
-        CHK( mbedtls_cipher_set_padding_mode( &t_in->cipher_ctx_dec,
-                                              MBEDTLS_PADDING_NONE ) == 0 );
-        CHK( mbedtls_cipher_set_padding_mode( &t_out->cipher_ctx_enc,
-                                              MBEDTLS_PADDING_NONE ) == 0 );
-        CHK( mbedtls_cipher_set_padding_mode( &t_out->cipher_ctx_dec,
-                                              MBEDTLS_PADDING_NONE ) == 0 );
+    if (cipher_info->mode == MBEDTLS_MODE_CBC) {
+        CHK(mbedtls_cipher_set_padding_mode(&t_in->cipher_ctx_enc,
+                                            MBEDTLS_PADDING_NONE) == 0);
+        CHK(mbedtls_cipher_set_padding_mode(&t_in->cipher_ctx_dec,
+                                            MBEDTLS_PADDING_NONE) == 0);
+        CHK(mbedtls_cipher_set_padding_mode(&t_out->cipher_ctx_enc,
+                                            MBEDTLS_PADDING_NONE) == 0);
+        CHK(mbedtls_cipher_set_padding_mode(&t_out->cipher_ctx_dec,
+                                            MBEDTLS_PADDING_NONE) == 0);
     }
 #endif /* MBEDTLS_CIPHER_MODE_CBC */
 
-    CHK( mbedtls_cipher_setkey( &t_in->cipher_ctx_enc, key0,
-                                keylen << 3, MBEDTLS_ENCRYPT ) == 0 );
-    CHK( mbedtls_cipher_setkey( &t_in->cipher_ctx_dec, key1,
-                                keylen << 3, MBEDTLS_DECRYPT ) == 0 );
-    CHK( mbedtls_cipher_setkey( &t_out->cipher_ctx_enc, key1,
-                                keylen << 3, MBEDTLS_ENCRYPT ) == 0 );
-    CHK( mbedtls_cipher_setkey( &t_out->cipher_ctx_dec, key0,
-                                keylen << 3, MBEDTLS_DECRYPT ) == 0 );
+    CHK(mbedtls_cipher_setkey(&t_in->cipher_ctx_enc, key0,
+                              keylen << 3, MBEDTLS_ENCRYPT) == 0);
+    CHK(mbedtls_cipher_setkey(&t_in->cipher_ctx_dec, key1,
+                              keylen << 3, MBEDTLS_DECRYPT) == 0);
+    CHK(mbedtls_cipher_setkey(&t_out->cipher_ctx_enc, key1,
+                              keylen << 3, MBEDTLS_ENCRYPT) == 0);
+    CHK(mbedtls_cipher_setkey(&t_out->cipher_ctx_dec, key0,
+                              keylen << 3, MBEDTLS_DECRYPT) == 0);
 
     /* Setup MAC contexts */
 #if defined(MBEDTLS_SSL_SOME_MODES_USE_MAC)
-    if( cipher_info->mode == MBEDTLS_MODE_CBC ||
-        cipher_info->mode == MBEDTLS_MODE_STREAM )
-    {
+    if (cipher_info->mode == MBEDTLS_MODE_CBC ||
+        cipher_info->mode == MBEDTLS_MODE_STREAM) {
         mbedtls_md_info_t const *md_info;
 
         /* Pick hash */
-        md_info = mbedtls_md_info_from_type( hash_id );
-        CHK( md_info != NULL );
+        md_info = mbedtls_md_info_from_type(hash_id);
+        CHK(md_info != NULL);
 
         /* Pick hash keys */
-        maclen = mbedtls_md_get_size( md_info );
-        CHK( ( md0 = mbedtls_calloc( 1, maclen ) ) != NULL );
-        CHK( ( md1 = mbedtls_calloc( 1, maclen ) ) != NULL );
-        memset( md0, 0x5, maclen );
-        memset( md1, 0x6, maclen );
+        maclen = mbedtls_md_get_size(md_info);
+        CHK((md0 = mbedtls_calloc(1, maclen)) != NULL);
+        CHK((md1 = mbedtls_calloc(1, maclen)) != NULL);
+        memset(md0, 0x5, maclen);
+        memset(md1, 0x6, maclen);
 
-        CHK( mbedtls_md_setup( &t_out->md_ctx_enc, md_info, 1 ) == 0 );
-        CHK( mbedtls_md_setup( &t_out->md_ctx_dec, md_info, 1 ) == 0 );
-        CHK( mbedtls_md_setup( &t_in->md_ctx_enc,  md_info, 1 ) == 0 );
-        CHK( mbedtls_md_setup( &t_in->md_ctx_dec,  md_info, 1 ) == 0 );
+        CHK(mbedtls_md_setup(&t_out->md_ctx_enc, md_info, 1) == 0);
+        CHK(mbedtls_md_setup(&t_out->md_ctx_dec, md_info, 1) == 0);
+        CHK(mbedtls_md_setup(&t_in->md_ctx_enc,  md_info, 1) == 0);
+        CHK(mbedtls_md_setup(&t_in->md_ctx_dec,  md_info, 1) == 0);
 
-        if( ver > MBEDTLS_SSL_MINOR_VERSION_0 )
-        {
-            CHK( mbedtls_md_hmac_starts( &t_in->md_ctx_enc,
-                                         md0, maclen ) == 0 );
-            CHK( mbedtls_md_hmac_starts( &t_in->md_ctx_dec,
-                                         md1, maclen ) == 0 );
-            CHK( mbedtls_md_hmac_starts( &t_out->md_ctx_enc,
-                                         md1, maclen ) == 0 );
-            CHK( mbedtls_md_hmac_starts( &t_out->md_ctx_dec,
-                                         md0, maclen ) == 0 );
+        if (ver > MBEDTLS_SSL_MINOR_VERSION_0) {
+            CHK(mbedtls_md_hmac_starts(&t_in->md_ctx_enc,
+                                       md0, maclen) == 0);
+            CHK(mbedtls_md_hmac_starts(&t_in->md_ctx_dec,
+                                       md1, maclen) == 0);
+            CHK(mbedtls_md_hmac_starts(&t_out->md_ctx_enc,
+                                       md1, maclen) == 0);
+            CHK(mbedtls_md_hmac_starts(&t_out->md_ctx_dec,
+                                       md0, maclen) == 0);
         }
 #if defined(MBEDTLS_SSL_PROTO_SSL3)
-        else
-        {
-            memcpy( &t_in->mac_enc, md0, maclen );
-            memcpy( &t_in->mac_dec, md1, maclen );
-            memcpy( &t_out->mac_enc, md1, maclen );
-            memcpy( &t_out->mac_dec, md0, maclen );
+        else {
+            memcpy(&t_in->mac_enc, md0, maclen);
+            memcpy(&t_in->mac_dec, md1, maclen);
+            memcpy(&t_out->mac_enc, md1, maclen);
+            memcpy(&t_out->mac_dec, md0, maclen);
         }
 #endif
     }
@@ -1340,8 +1289,8 @@
     /* Pick IV's (regardless of whether they
      * are being used by the transform). */
     ivlen = cipher_info->iv_size;
-    memset( iv_enc, 0x3, sizeof( iv_enc ) );
-    memset( iv_dec, 0x4, sizeof( iv_dec ) );
+    memset(iv_enc, 0x3, sizeof(iv_enc));
+    memset(iv_dec, 0x4, sizeof(iv_dec));
 
     /*
      * Setup transforms
@@ -1360,17 +1309,14 @@
     t_out->ivlen = ivlen;
     t_in->ivlen = ivlen;
 
-    switch( cipher_info->mode )
-    {
+    switch (cipher_info->mode) {
         case MBEDTLS_MODE_GCM:
         case MBEDTLS_MODE_CCM:
 #if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL)
-            if( ver == MBEDTLS_SSL_MINOR_VERSION_4 )
-            {
+            if (ver == MBEDTLS_SSL_MINOR_VERSION_4) {
                 t_out->fixed_ivlen = 12;
                 t_in->fixed_ivlen  = 12;
-            }
-            else
+            } else
 #endif /* MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
             {
                 t_out->fixed_ivlen = 4;
@@ -1378,8 +1324,7 @@
             }
             t_out->maclen = 0;
             t_in->maclen = 0;
-            switch( tag_mode )
-            {
+            switch (tag_mode) {
                 case 0: /* Full tag */
                     t_out->taglen = 16;
                     t_in->taglen = 16;
@@ -1399,8 +1344,7 @@
             t_in->fixed_ivlen = 12;
             t_out->maclen = 0;
             t_in->maclen = 0;
-            switch( tag_mode )
-            {
+            switch (tag_mode) {
                 case 0: /* Full tag */
                     t_out->taglen = 16;
                     t_in->taglen = 16;
@@ -1421,8 +1365,7 @@
             t_in->fixed_ivlen = 0;  /* redundant, must be 0 */
             t_out->taglen = 0;
             t_in->taglen = 0;
-            switch( tag_mode )
-            {
+            switch (tag_mode) {
                 case 0: /* Full tag */
                     t_out->maclen = maclen;
                     t_in->maclen = maclen;
@@ -1444,88 +1387,91 @@
 
     /* Setup IV's */
 
-    memcpy( &t_in->iv_dec, iv_dec, sizeof( iv_dec ) );
-    memcpy( &t_in->iv_enc, iv_enc, sizeof( iv_enc ) );
-    memcpy( &t_out->iv_dec, iv_enc, sizeof( iv_enc ) );
-    memcpy( &t_out->iv_enc, iv_dec, sizeof( iv_dec ) );
+    memcpy(&t_in->iv_dec, iv_dec, sizeof(iv_dec));
+    memcpy(&t_in->iv_enc, iv_enc, sizeof(iv_enc));
+    memcpy(&t_out->iv_dec, iv_enc, sizeof(iv_enc));
+    memcpy(&t_out->iv_enc, iv_dec, sizeof(iv_dec));
 
 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
     /* Add CID */
-    memcpy( &t_in->in_cid,  cid0, cid0_len );
-    memcpy( &t_in->out_cid, cid1, cid1_len );
+    memcpy(&t_in->in_cid,  cid0, cid0_len);
+    memcpy(&t_in->out_cid, cid1, cid1_len);
     t_in->in_cid_len = cid0_len;
     t_in->out_cid_len = cid1_len;
-    memcpy( &t_out->in_cid,  cid1, cid1_len );
-    memcpy( &t_out->out_cid, cid0, cid0_len );
+    memcpy(&t_out->in_cid,  cid1, cid1_len);
+    memcpy(&t_out->out_cid, cid0, cid0_len);
     t_out->in_cid_len = cid1_len;
     t_out->out_cid_len = cid0_len;
 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
 
 cleanup:
 
-    mbedtls_free( key0 );
-    mbedtls_free( key1 );
+    mbedtls_free(key0);
+    mbedtls_free(key1);
 
-    mbedtls_free( md0 );
-    mbedtls_free( md1 );
+    mbedtls_free(md0);
+    mbedtls_free(md1);
 
-    return( ret );
+    return ret;
 }
 
 /*
  * Populate a session structure for serialization tests.
  * Choose dummy values, mostly non-0 to distinguish from the init default.
  */
-static int ssl_populate_session( mbedtls_ssl_session *session,
-                                 int ticket_len,
-                                 const char *crt_file )
+static int ssl_populate_session(mbedtls_ssl_session *session,
+                                int ticket_len,
+                                const char *crt_file)
 {
 #if defined(MBEDTLS_HAVE_TIME)
-    session->start = mbedtls_time( NULL ) - 42;
+    session->start = mbedtls_time(NULL) - 42;
 #endif
     session->ciphersuite = 0xabcd;
     session->compression = 1;
-    session->id_len = sizeof( session->id );
-    memset( session->id, 66, session->id_len );
-    memset( session->master, 17, sizeof( session->master ) );
+    session->id_len = sizeof(session->id);
+    memset(session->id, 66, session->id_len);
+    memset(session->master, 17, sizeof(session->master));
 
 #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) && defined(MBEDTLS_FS_IO)
-    if( strlen( crt_file ) != 0 )
-    {
+    if (strlen(crt_file) != 0) {
         mbedtls_x509_crt tmp_crt;
         int ret;
 
-        mbedtls_x509_crt_init( &tmp_crt );
-        ret = mbedtls_x509_crt_parse_file( &tmp_crt, crt_file );
-        if( ret != 0 )
-            return( ret );
+        mbedtls_x509_crt_init(&tmp_crt);
+        ret = mbedtls_x509_crt_parse_file(&tmp_crt, crt_file);
+        if (ret != 0) {
+            return ret;
+        }
 
 #if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
         /* Move temporary CRT. */
-        session->peer_cert = mbedtls_calloc( 1, sizeof( *session->peer_cert ) );
-        if( session->peer_cert == NULL )
-            return( -1 );
+        session->peer_cert = mbedtls_calloc(1, sizeof(*session->peer_cert));
+        if (session->peer_cert == NULL) {
+            return -1;
+        }
         *session->peer_cert = tmp_crt;
-        memset( &tmp_crt, 0, sizeof( tmp_crt ) );
+        memset(&tmp_crt, 0, sizeof(tmp_crt));
 #else /* MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
         /* Calculate digest of temporary CRT. */
         session->peer_cert_digest =
-            mbedtls_calloc( 1, MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_LEN );
-        if( session->peer_cert_digest == NULL )
-            return( -1 );
-        ret = mbedtls_md( mbedtls_md_info_from_type(
-                              MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_TYPE ),
-                          tmp_crt.raw.p, tmp_crt.raw.len,
-                          session->peer_cert_digest );
-        if( ret != 0 )
-            return( ret );
+            mbedtls_calloc(1, MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_LEN);
+        if (session->peer_cert_digest == NULL) {
+            return -1;
+        }
+        ret = mbedtls_md(mbedtls_md_info_from_type(
+                             MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_TYPE),
+                         tmp_crt.raw.p, tmp_crt.raw.len,
+                         session->peer_cert_digest);
+        if (ret != 0) {
+            return ret;
+        }
         session->peer_cert_digest_type =
             MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_TYPE;
         session->peer_cert_digest_len =
             MBEDTLS_SSL_PEER_CERT_DIGEST_DFL_LEN;
 #endif /* MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
 
-        mbedtls_x509_crt_free( &tmp_crt );
+        mbedtls_x509_crt_free(&tmp_crt);
     }
 #else /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED && MBEDTLS_FS_IO */
     (void) crt_file;
@@ -1533,12 +1479,12 @@
     session->verify_result = 0xdeadbeef;
 
 #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
-    if( ticket_len != 0 )
-    {
-        session->ticket = mbedtls_calloc( 1, ticket_len );
-        if( session->ticket == NULL )
-            return( -1 );
-        memset( session->ticket, 33, ticket_len );
+    if (ticket_len != 0) {
+        session->ticket = mbedtls_calloc(1, ticket_len);
+        if (session->ticket == NULL) {
+            return -1;
+        }
+        memset(session->ticket, 33, ticket_len);
     }
     session->ticket_len = ticket_len;
     session->ticket_lifetime = 86401;
@@ -1556,7 +1502,7 @@
     session->encrypt_then_mac = 1;
 #endif
 
-    return( 0 );
+    return 0;
 }
 
 /*
@@ -1579,22 +1525,21 @@
  *
  * \retval  0 on success, otherwise error code.
  */
-int mbedtls_exchange_data( mbedtls_ssl_context *ssl_1,
-                           int msg_len_1, const int expected_fragments_1,
-                           mbedtls_ssl_context *ssl_2,
-                           int msg_len_2, const int expected_fragments_2 )
+int mbedtls_exchange_data(mbedtls_ssl_context *ssl_1,
+                          int msg_len_1, const int expected_fragments_1,
+                          mbedtls_ssl_context *ssl_2,
+                          int msg_len_2, const int expected_fragments_2)
 {
-    unsigned char *msg_buf_1 = malloc( msg_len_1 );
-    unsigned char *msg_buf_2 = malloc( msg_len_2 );
-    unsigned char *in_buf_1  = malloc( msg_len_2 );
-    unsigned char *in_buf_2  = malloc( msg_len_1 );
+    unsigned char *msg_buf_1 = malloc(msg_len_1);
+    unsigned char *msg_buf_2 = malloc(msg_len_2);
+    unsigned char *in_buf_1  = malloc(msg_len_2);
+    unsigned char *in_buf_2  = malloc(msg_len_1);
     int msg_type, ret = -1;
 
     /* Perform this test with two message types. At first use a message
      * consisting of only 0x00 for the client and only 0xFF for the server.
      * At the second time use message with generated data */
-    for( msg_type = 0; msg_type < 2; msg_type++ )
-    {
+    for (msg_type = 0; msg_type < 2; msg_type++) {
         int written_1 = 0;
         int written_2 = 0;
         int read_1 = 0;
@@ -1602,99 +1547,83 @@
         int fragments_1 = 0;
         int fragments_2 = 0;
 
-        if( msg_type == 0 )
-        {
-            memset( msg_buf_1, 0x00, msg_len_1 );
-            memset( msg_buf_2, 0xff, msg_len_2 );
-        }
-        else
-        {
+        if (msg_type == 0) {
+            memset(msg_buf_1, 0x00, msg_len_1);
+            memset(msg_buf_2, 0xff, msg_len_2);
+        } else {
             int i, j = 0;
-            for( i = 0; i < msg_len_1; i++ )
-            {
+            for (i = 0; i < msg_len_1; i++) {
                 msg_buf_1[i] = j++ & 0xFF;
             }
-            for( i = 0; i < msg_len_2; i++ )
-            {
-                msg_buf_2[i] = ( j -= 5 ) & 0xFF;
+            for (i = 0; i < msg_len_2; i++) {
+                msg_buf_2[i] = (j -= 5) & 0xFF;
             }
         }
 
-        while( read_1 < msg_len_2 || read_2 < msg_len_1 )
-        {
+        while (read_1 < msg_len_2 || read_2 < msg_len_1) {
             /* ssl_1 sending */
-            if( msg_len_1 > written_1 )
-            {
-                ret = mbedtls_ssl_write_fragment( ssl_1, msg_buf_1,
-                                                  msg_len_1, &written_1,
-                                                  expected_fragments_1 );
-                if( expected_fragments_1 == 0 )
-                {
+            if (msg_len_1 > written_1) {
+                ret = mbedtls_ssl_write_fragment(ssl_1, msg_buf_1,
+                                                 msg_len_1, &written_1,
+                                                 expected_fragments_1);
+                if (expected_fragments_1 == 0) {
                     /* This error is expected when the message is too large and
                      * cannot be fragmented */
-                    TEST_ASSERT( ret == MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
+                    TEST_ASSERT(ret == MBEDTLS_ERR_SSL_BAD_INPUT_DATA);
                     msg_len_1 = 0;
-                }
-                else
-                {
-                    TEST_ASSERT( ret == 0 );
+                } else {
+                    TEST_ASSERT(ret == 0);
                 }
             }
 
             /* ssl_2 sending */
-            if( msg_len_2 > written_2 )
-            {
-                ret = mbedtls_ssl_write_fragment( ssl_2, msg_buf_2,
-                                                  msg_len_2, &written_2,
-                                                  expected_fragments_2 );
-                if( expected_fragments_2 == 0 )
-                {
+            if (msg_len_2 > written_2) {
+                ret = mbedtls_ssl_write_fragment(ssl_2, msg_buf_2,
+                                                 msg_len_2, &written_2,
+                                                 expected_fragments_2);
+                if (expected_fragments_2 == 0) {
                     /* This error is expected when the message is too large and
                      * cannot be fragmented */
-                    TEST_ASSERT( ret == MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
+                    TEST_ASSERT(ret == MBEDTLS_ERR_SSL_BAD_INPUT_DATA);
                     msg_len_2 = 0;
-                }
-                else
-                {
-                    TEST_ASSERT( ret == 0 );
+                } else {
+                    TEST_ASSERT(ret == 0);
                 }
             }
 
             /* ssl_1 reading */
-            if( read_1 < msg_len_2 )
-            {
-                ret = mbedtls_ssl_read_fragment( ssl_1, in_buf_1,
-                                                 msg_len_2, &read_1,
-                                                 &fragments_2,
-                                                 expected_fragments_2 );
-                TEST_ASSERT( ret == 0 );
+            if (read_1 < msg_len_2) {
+                ret = mbedtls_ssl_read_fragment(ssl_1, in_buf_1,
+                                                msg_len_2, &read_1,
+                                                &fragments_2,
+                                                expected_fragments_2);
+                TEST_ASSERT(ret == 0);
             }
 
             /* ssl_2 reading */
-            if( read_2 < msg_len_1 )
-            {
-                ret = mbedtls_ssl_read_fragment( ssl_2, in_buf_2,
-                                                 msg_len_1, &read_2,
-                                                 &fragments_1,
-                                                 expected_fragments_1 );
-                TEST_ASSERT( ret == 0 );
+            if (read_2 < msg_len_1) {
+                ret = mbedtls_ssl_read_fragment(ssl_2, in_buf_2,
+                                                msg_len_1, &read_2,
+                                                &fragments_1,
+                                                expected_fragments_1);
+                TEST_ASSERT(ret == 0);
             }
         }
 
         ret = -1;
-        TEST_ASSERT( 0 == memcmp( msg_buf_1, in_buf_2, msg_len_1 ) );
-        TEST_ASSERT( 0 == memcmp( msg_buf_2, in_buf_1, msg_len_2 ) );
-        TEST_ASSERT( fragments_1 == expected_fragments_1 );
-        TEST_ASSERT( fragments_2 == expected_fragments_2 );
+        TEST_ASSERT(0 == memcmp(msg_buf_1, in_buf_2, msg_len_1));
+        TEST_ASSERT(0 == memcmp(msg_buf_2, in_buf_1, msg_len_2));
+        TEST_ASSERT(fragments_1 == expected_fragments_1);
+        TEST_ASSERT(fragments_2 == expected_fragments_2);
     }
 
     ret = 0;
 
 exit:
-    free( msg_buf_1 );
-    free( in_buf_1 );
-    free( msg_buf_2 );
-    free( in_buf_2 );
+    free(msg_buf_1);
+    free(in_buf_1);
+    free(msg_buf_2);
+    free(in_buf_2);
 
     return ret;
 }
@@ -1705,17 +1634,17 @@
  *
  * \retval  0 on success, otherwise error code.
  */
-int exchange_data( mbedtls_ssl_context *ssl_1,
-                   mbedtls_ssl_context *ssl_2 )
+int exchange_data(mbedtls_ssl_context *ssl_1,
+                  mbedtls_ssl_context *ssl_2)
 {
-    return mbedtls_exchange_data( ssl_1, 256, 1,
-                                  ssl_2, 256, 1 );
+    return mbedtls_exchange_data(ssl_1, 256, 1,
+                                 ssl_2, 256, 1);
 }
 
 #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED) && \
     defined(MBEDTLS_ENTROPY_C) && \
     defined(MBEDTLS_CTR_DRBG_C)
-void perform_handshake( handshake_test_options* options )
+void perform_handshake(handshake_test_options *options)
 {
     /* forced_ciphersuite needs to last until the end of the handshake */
     int forced_ciphersuite[2];
@@ -1736,360 +1665,332 @@
 #endif
     int expected_handshake_result = 0;
 
-    USE_PSA_INIT( );
-    mbedtls_platform_zeroize( &client, sizeof( client ) );
-    mbedtls_platform_zeroize( &server, sizeof( server ) );
+    USE_PSA_INIT();
+    mbedtls_platform_zeroize(&client, sizeof(client));
+    mbedtls_platform_zeroize(&server, sizeof(server));
 
     mbedtls_test_message_queue server_queue, client_queue;
     mbedtls_test_message_socket_context server_context, client_context;
-    mbedtls_message_socket_init( &server_context );
-    mbedtls_message_socket_init( &client_context );
+    mbedtls_message_socket_init(&server_context);
+    mbedtls_message_socket_init(&client_context);
 
     /* Client side */
-    if( options->dtls != 0 )
-    {
-        TEST_ASSERT( mbedtls_endpoint_init( &client, MBEDTLS_SSL_IS_CLIENT,
-                                            options->pk_alg, &client_context,
-                                            &client_queue,
-                                            &server_queue, NULL ) == 0 );
+    if (options->dtls != 0) {
+        TEST_ASSERT(mbedtls_endpoint_init(&client, MBEDTLS_SSL_IS_CLIENT,
+                                          options->pk_alg, &client_context,
+                                          &client_queue,
+                                          &server_queue, NULL) == 0);
 #if defined(MBEDTLS_TIMING_C)
-        mbedtls_ssl_set_timer_cb( &client.ssl, &timer_client,
-                                  mbedtls_timing_set_delay,
-                                  mbedtls_timing_get_delay );
+        mbedtls_ssl_set_timer_cb(&client.ssl, &timer_client,
+                                 mbedtls_timing_set_delay,
+                                 mbedtls_timing_get_delay);
 #endif
-    }
-    else
-    {
-        TEST_ASSERT( mbedtls_endpoint_init( &client, MBEDTLS_SSL_IS_CLIENT,
-                                            options->pk_alg, NULL, NULL,
-                                            NULL, NULL ) == 0 );
+    } else {
+        TEST_ASSERT(mbedtls_endpoint_init(&client, MBEDTLS_SSL_IS_CLIENT,
+                                          options->pk_alg, NULL, NULL,
+                                          NULL, NULL) == 0);
     }
 
-    if( options->client_min_version != TEST_SSL_MINOR_VERSION_NONE )
-    {
-        mbedtls_ssl_conf_min_version( &client.conf, MBEDTLS_SSL_MAJOR_VERSION_3,
-                                          options->client_min_version );
+    if (options->client_min_version != TEST_SSL_MINOR_VERSION_NONE) {
+        mbedtls_ssl_conf_min_version(&client.conf, MBEDTLS_SSL_MAJOR_VERSION_3,
+                                     options->client_min_version);
     }
 
-    if( options->client_max_version != TEST_SSL_MINOR_VERSION_NONE )
-    {
-        mbedtls_ssl_conf_max_version( &client.conf, MBEDTLS_SSL_MAJOR_VERSION_3,
-                                          options->client_max_version );
+    if (options->client_max_version != TEST_SSL_MINOR_VERSION_NONE) {
+        mbedtls_ssl_conf_max_version(&client.conf, MBEDTLS_SSL_MAJOR_VERSION_3,
+                                     options->client_max_version);
     }
 
-    if( strlen( options->cipher ) > 0 )
-    {
-        set_ciphersuite( &client.conf, options->cipher, forced_ciphersuite );
+    if (strlen(options->cipher) > 0) {
+        set_ciphersuite(&client.conf, options->cipher, forced_ciphersuite);
     }
 
-#if defined (MBEDTLS_DEBUG_C)
-    if( options->cli_log_fun )
-    {
-        mbedtls_debug_set_threshold( 4 );
-        mbedtls_ssl_conf_dbg( &client.conf, options->cli_log_fun,
-                                            options->cli_log_obj );
+#if defined(MBEDTLS_DEBUG_C)
+    if (options->cli_log_fun) {
+        mbedtls_debug_set_threshold(4);
+        mbedtls_ssl_conf_dbg(&client.conf, options->cli_log_fun,
+                             options->cli_log_obj);
     }
 #endif
 
     /* Server side */
-    if( options->dtls != 0 )
-    {
-        TEST_ASSERT( mbedtls_endpoint_init( &server, MBEDTLS_SSL_IS_SERVER,
-                                            options->pk_alg, &server_context,
-                                            &server_queue,
-                                            &client_queue, NULL ) == 0 );
+    if (options->dtls != 0) {
+        TEST_ASSERT(mbedtls_endpoint_init(&server, MBEDTLS_SSL_IS_SERVER,
+                                          options->pk_alg, &server_context,
+                                          &server_queue,
+                                          &client_queue, NULL) == 0);
 #if defined(MBEDTLS_TIMING_C)
-        mbedtls_ssl_set_timer_cb( &server.ssl, &timer_server,
-                                  mbedtls_timing_set_delay,
-                                  mbedtls_timing_get_delay );
+        mbedtls_ssl_set_timer_cb(&server.ssl, &timer_server,
+                                 mbedtls_timing_set_delay,
+                                 mbedtls_timing_get_delay);
 #endif
-    }
-    else
-    {
-        TEST_ASSERT( mbedtls_endpoint_init( &server, MBEDTLS_SSL_IS_SERVER,
-                                            options->pk_alg, NULL, NULL,
-                                            NULL, NULL ) == 0 );
+    } else {
+        TEST_ASSERT(mbedtls_endpoint_init(&server, MBEDTLS_SSL_IS_SERVER,
+                                          options->pk_alg, NULL, NULL,
+                                          NULL, NULL) == 0);
     }
 
-    mbedtls_ssl_conf_authmode( &server.conf, options->srv_auth_mode );
+    mbedtls_ssl_conf_authmode(&server.conf, options->srv_auth_mode);
 
-    if( options->server_min_version != TEST_SSL_MINOR_VERSION_NONE )
-    {
-        mbedtls_ssl_conf_min_version( &server.conf, MBEDTLS_SSL_MAJOR_VERSION_3,
-                                          options->server_min_version );
+    if (options->server_min_version != TEST_SSL_MINOR_VERSION_NONE) {
+        mbedtls_ssl_conf_min_version(&server.conf, MBEDTLS_SSL_MAJOR_VERSION_3,
+                                     options->server_min_version);
     }
 
-    if( options->server_max_version != TEST_SSL_MINOR_VERSION_NONE )
-    {
-        mbedtls_ssl_conf_max_version( &server.conf, MBEDTLS_SSL_MAJOR_VERSION_3,
-                                          options->server_max_version );
+    if (options->server_max_version != TEST_SSL_MINOR_VERSION_NONE) {
+        mbedtls_ssl_conf_max_version(&server.conf, MBEDTLS_SSL_MAJOR_VERSION_3,
+                                     options->server_max_version);
     }
 
 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
-    TEST_ASSERT( mbedtls_ssl_conf_max_frag_len( &(server.conf),
-                                         (unsigned char) options->mfl ) == 0 );
-    TEST_ASSERT( mbedtls_ssl_conf_max_frag_len( &(client.conf),
-                                         (unsigned char) options->mfl ) == 0 );
+    TEST_ASSERT(mbedtls_ssl_conf_max_frag_len(&(server.conf),
+                                              (unsigned char) options->mfl) == 0);
+    TEST_ASSERT(mbedtls_ssl_conf_max_frag_len(&(client.conf),
+                                              (unsigned char) options->mfl) == 0);
 #else
-    TEST_ASSERT( MBEDTLS_SSL_MAX_FRAG_LEN_NONE == options->mfl );
+    TEST_ASSERT(MBEDTLS_SSL_MAX_FRAG_LEN_NONE == options->mfl);
 #endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
 
 #if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
-    if( options->psk_str != NULL && options->psk_str->len > 0 )
-    {
-        TEST_ASSERT( mbedtls_ssl_conf_psk( &client.conf, options->psk_str->x,
-                             options->psk_str->len,
-                             (const unsigned char *) psk_identity,
-                             strlen( psk_identity ) ) == 0 );
+    if (options->psk_str != NULL && options->psk_str->len > 0) {
+        TEST_ASSERT(mbedtls_ssl_conf_psk(&client.conf, options->psk_str->x,
+                                         options->psk_str->len,
+                                         (const unsigned char *) psk_identity,
+                                         strlen(psk_identity)) == 0);
 
-        TEST_ASSERT( mbedtls_ssl_conf_psk( &server.conf, options->psk_str->x,
-                             options->psk_str->len,
-                             (const unsigned char *) psk_identity,
-                             strlen( psk_identity ) ) == 0 );
+        TEST_ASSERT(mbedtls_ssl_conf_psk(&server.conf, options->psk_str->x,
+                                         options->psk_str->len,
+                                         (const unsigned char *) psk_identity,
+                                         strlen(psk_identity)) == 0);
 
-        mbedtls_ssl_conf_psk_cb( &server.conf, psk_dummy_callback, NULL );
+        mbedtls_ssl_conf_psk_cb(&server.conf, psk_dummy_callback, NULL);
     }
 #endif
 #if defined(MBEDTLS_SSL_RENEGOTIATION)
-    if( options->renegotiate )
-    {
-        mbedtls_ssl_conf_renegotiation( &(server.conf),
-                                        MBEDTLS_SSL_RENEGOTIATION_ENABLED );
-        mbedtls_ssl_conf_renegotiation( &(client.conf),
-                                        MBEDTLS_SSL_RENEGOTIATION_ENABLED );
+    if (options->renegotiate) {
+        mbedtls_ssl_conf_renegotiation(&(server.conf),
+                                       MBEDTLS_SSL_RENEGOTIATION_ENABLED);
+        mbedtls_ssl_conf_renegotiation(&(client.conf),
+                                       MBEDTLS_SSL_RENEGOTIATION_ENABLED);
 
-        mbedtls_ssl_conf_legacy_renegotiation( &(server.conf),
-                                               options->legacy_renegotiation );
-        mbedtls_ssl_conf_legacy_renegotiation( &(client.conf),
-                                               options->legacy_renegotiation );
+        mbedtls_ssl_conf_legacy_renegotiation(&(server.conf),
+                                              options->legacy_renegotiation);
+        mbedtls_ssl_conf_legacy_renegotiation(&(client.conf),
+                                              options->legacy_renegotiation);
     }
 #endif /* MBEDTLS_SSL_RENEGOTIATION */
 
-#if defined (MBEDTLS_DEBUG_C)
-    if( options->srv_log_fun )
-    {
-        mbedtls_debug_set_threshold( 4 );
-        mbedtls_ssl_conf_dbg( &server.conf, options->srv_log_fun,
-                                            options->srv_log_obj );
+#if defined(MBEDTLS_DEBUG_C)
+    if (options->srv_log_fun) {
+        mbedtls_debug_set_threshold(4);
+        mbedtls_ssl_conf_dbg(&server.conf, options->srv_log_fun,
+                             options->srv_log_obj);
     }
 #endif
 
-    TEST_ASSERT( mbedtls_mock_socket_connect( &(client.socket),
-                                              &(server.socket),
-                                              BUFFSIZE ) == 0 );
+    TEST_ASSERT(mbedtls_mock_socket_connect(&(client.socket),
+                                            &(server.socket),
+                                            BUFFSIZE) == 0);
 
 #if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
-    if( options->resize_buffers != 0 )
-    {
+    if (options->resize_buffers != 0) {
         /* Ensure that the buffer sizes are appropriate before resizes */
-        TEST_ASSERT( client.ssl.out_buf_len == MBEDTLS_SSL_OUT_BUFFER_LEN );
-        TEST_ASSERT( client.ssl.in_buf_len == MBEDTLS_SSL_IN_BUFFER_LEN );
-        TEST_ASSERT( server.ssl.out_buf_len == MBEDTLS_SSL_OUT_BUFFER_LEN );
-        TEST_ASSERT( server.ssl.in_buf_len == MBEDTLS_SSL_IN_BUFFER_LEN );
+        TEST_ASSERT(client.ssl.out_buf_len == MBEDTLS_SSL_OUT_BUFFER_LEN);
+        TEST_ASSERT(client.ssl.in_buf_len == MBEDTLS_SSL_IN_BUFFER_LEN);
+        TEST_ASSERT(server.ssl.out_buf_len == MBEDTLS_SSL_OUT_BUFFER_LEN);
+        TEST_ASSERT(server.ssl.in_buf_len == MBEDTLS_SSL_IN_BUFFER_LEN);
     }
 #endif
 
-    if( options->expected_negotiated_version == TEST_SSL_MINOR_VERSION_NONE )
-    {
+    if (options->expected_negotiated_version == TEST_SSL_MINOR_VERSION_NONE) {
         expected_handshake_result = MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION;
     }
 
-    TEST_ASSERT( mbedtls_move_handshake_to_state( &(client.ssl),
-                                                  &(server.ssl),
-                                                  MBEDTLS_SSL_HANDSHAKE_OVER )
-                 ==  expected_handshake_result );
+    TEST_ASSERT(mbedtls_move_handshake_to_state(&(client.ssl),
+                                                &(server.ssl),
+                                                MBEDTLS_SSL_HANDSHAKE_OVER)
+                ==  expected_handshake_result);
 
-    if( expected_handshake_result != 0 )
-    {
+    if (expected_handshake_result != 0) {
         /* Connection will have failed by this point, skip to cleanup */
         goto exit;
     }
 
-    TEST_ASSERT( client.ssl.state == MBEDTLS_SSL_HANDSHAKE_OVER );
-    TEST_ASSERT( server.ssl.state == MBEDTLS_SSL_HANDSHAKE_OVER );
+    TEST_ASSERT(client.ssl.state == MBEDTLS_SSL_HANDSHAKE_OVER);
+    TEST_ASSERT(server.ssl.state == MBEDTLS_SSL_HANDSHAKE_OVER);
 
     /* Check that we agree on the version... */
-    TEST_ASSERT( client.ssl.minor_ver == server.ssl.minor_ver );
+    TEST_ASSERT(client.ssl.minor_ver == server.ssl.minor_ver);
 
     /* And check that the version negotiated is the expected one. */
-    TEST_EQUAL( client.ssl.minor_ver, options->expected_negotiated_version );
+    TEST_EQUAL(client.ssl.minor_ver, options->expected_negotiated_version);
 
 #if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
-    if( options->resize_buffers != 0 )
-    {
-        if( options->expected_negotiated_version != MBEDTLS_SSL_MINOR_VERSION_0 &&
-            options->expected_negotiated_version != MBEDTLS_SSL_MINOR_VERSION_1 )
-        {
+    if (options->resize_buffers != 0) {
+        if (options->expected_negotiated_version != MBEDTLS_SSL_MINOR_VERSION_0 &&
+            options->expected_negotiated_version != MBEDTLS_SSL_MINOR_VERSION_1) {
             /* A server, when using DTLS, might delay a buffer resize to happen
              * after it receives a message, so we force it. */
-            TEST_ASSERT( exchange_data( &(client.ssl), &(server.ssl) ) == 0 );
+            TEST_ASSERT(exchange_data(&(client.ssl), &(server.ssl)) == 0);
 
-            TEST_ASSERT( client.ssl.out_buf_len ==
-                         mbedtls_ssl_get_output_buflen( &client.ssl ) );
-            TEST_ASSERT( client.ssl.in_buf_len ==
-                         mbedtls_ssl_get_input_buflen( &client.ssl ) );
-            TEST_ASSERT( server.ssl.out_buf_len ==
-                         mbedtls_ssl_get_output_buflen( &server.ssl ) );
-            TEST_ASSERT( server.ssl.in_buf_len ==
-                         mbedtls_ssl_get_input_buflen( &server.ssl ) );
+            TEST_ASSERT(client.ssl.out_buf_len ==
+                        mbedtls_ssl_get_output_buflen(&client.ssl));
+            TEST_ASSERT(client.ssl.in_buf_len ==
+                        mbedtls_ssl_get_input_buflen(&client.ssl));
+            TEST_ASSERT(server.ssl.out_buf_len ==
+                        mbedtls_ssl_get_output_buflen(&server.ssl));
+            TEST_ASSERT(server.ssl.in_buf_len ==
+                        mbedtls_ssl_get_input_buflen(&server.ssl));
         }
     }
 #endif
 
-    if( options->cli_msg_len != 0 || options->srv_msg_len != 0 )
-    {
+    if (options->cli_msg_len != 0 || options->srv_msg_len != 0) {
         /* Start data exchanging test */
-        TEST_ASSERT( mbedtls_exchange_data( &(client.ssl), options->cli_msg_len,
-                                            options->expected_cli_fragments,
-                                            &(server.ssl), options->srv_msg_len,
-                                            options->expected_srv_fragments )
-                     == 0 );
+        TEST_ASSERT(mbedtls_exchange_data(&(client.ssl), options->cli_msg_len,
+                                          options->expected_cli_fragments,
+                                          &(server.ssl), options->srv_msg_len,
+                                          options->expected_srv_fragments)
+                    == 0);
     }
 #if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION)
-    if( options->serialize == 1 )
-    {
-        TEST_ASSERT( options->dtls == 1 );
+    if (options->serialize == 1) {
+        TEST_ASSERT(options->dtls == 1);
 
-        TEST_ASSERT( mbedtls_ssl_context_save( &(server.ssl), NULL,
-                                               0, &context_buf_len )
-                                             == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
+        TEST_ASSERT(mbedtls_ssl_context_save(&(server.ssl), NULL,
+                                             0, &context_buf_len)
+                    == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL);
 
-        context_buf = mbedtls_calloc( 1, context_buf_len );
-        TEST_ASSERT( context_buf != NULL );
+        context_buf = mbedtls_calloc(1, context_buf_len);
+        TEST_ASSERT(context_buf != NULL);
 
-        TEST_ASSERT( mbedtls_ssl_context_save( &(server.ssl), context_buf,
-                                               context_buf_len,
-                                               &context_buf_len ) == 0 );
+        TEST_ASSERT(mbedtls_ssl_context_save(&(server.ssl), context_buf,
+                                             context_buf_len,
+                                             &context_buf_len) == 0);
 
-        mbedtls_ssl_free( &(server.ssl) );
-        mbedtls_ssl_init( &(server.ssl) );
+        mbedtls_ssl_free(&(server.ssl));
+        mbedtls_ssl_init(&(server.ssl));
 
-        TEST_ASSERT( mbedtls_ssl_setup( &(server.ssl), &(server.conf) ) == 0 );
+        TEST_ASSERT(mbedtls_ssl_setup(&(server.ssl), &(server.conf)) == 0);
 
-        mbedtls_ssl_set_bio( &( server.ssl ), &server_context,
-                             mbedtls_mock_tcp_send_msg,
-                             mbedtls_mock_tcp_recv_msg,
-                             NULL );
+        mbedtls_ssl_set_bio(&(server.ssl), &server_context,
+                            mbedtls_mock_tcp_send_msg,
+                            mbedtls_mock_tcp_recv_msg,
+                            NULL);
 
 #if defined(MBEDTLS_TIMING_C)
-        mbedtls_ssl_set_timer_cb( &server.ssl, &timer_server,
-                                  mbedtls_timing_set_delay,
-                                  mbedtls_timing_get_delay );
+        mbedtls_ssl_set_timer_cb(&server.ssl, &timer_server,
+                                 mbedtls_timing_set_delay,
+                                 mbedtls_timing_get_delay);
 #endif
 #if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
-        if( options->resize_buffers != 0 )
-        {
+        if (options->resize_buffers != 0) {
             /* Ensure that the buffer sizes are appropriate before resizes */
-            TEST_ASSERT( server.ssl.out_buf_len == MBEDTLS_SSL_OUT_BUFFER_LEN );
-            TEST_ASSERT( server.ssl.in_buf_len == MBEDTLS_SSL_IN_BUFFER_LEN );
+            TEST_ASSERT(server.ssl.out_buf_len == MBEDTLS_SSL_OUT_BUFFER_LEN);
+            TEST_ASSERT(server.ssl.in_buf_len == MBEDTLS_SSL_IN_BUFFER_LEN);
         }
 #endif
-        TEST_ASSERT( mbedtls_ssl_context_load( &( server.ssl ), context_buf,
-                                               context_buf_len ) == 0 );
+        TEST_ASSERT(mbedtls_ssl_context_load(&(server.ssl), context_buf,
+                                             context_buf_len) == 0);
 
 #if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
         /* Validate buffer sizes after context deserialization */
-        if( options->resize_buffers != 0 )
-        {
-            TEST_ASSERT( server.ssl.out_buf_len ==
-                         mbedtls_ssl_get_output_buflen( &server.ssl ) );
-            TEST_ASSERT( server.ssl.in_buf_len ==
-                         mbedtls_ssl_get_input_buflen( &server.ssl ) );
+        if (options->resize_buffers != 0) {
+            TEST_ASSERT(server.ssl.out_buf_len ==
+                        mbedtls_ssl_get_output_buflen(&server.ssl));
+            TEST_ASSERT(server.ssl.in_buf_len ==
+                        mbedtls_ssl_get_input_buflen(&server.ssl));
         }
 #endif
         /* Retest writing/reading */
-        if( options->cli_msg_len != 0 || options->srv_msg_len != 0 )
-        {
-            TEST_ASSERT( mbedtls_exchange_data( &(client.ssl),
-                                                options->cli_msg_len,
-                                                options->expected_cli_fragments,
-                                                &(server.ssl),
-                                                options->srv_msg_len,
-                                                options->expected_srv_fragments )
-                                                == 0 );
+        if (options->cli_msg_len != 0 || options->srv_msg_len != 0) {
+            TEST_ASSERT(mbedtls_exchange_data(&(client.ssl),
+                                              options->cli_msg_len,
+                                              options->expected_cli_fragments,
+                                              &(server.ssl),
+                                              options->srv_msg_len,
+                                              options->expected_srv_fragments)
+                        == 0);
         }
     }
 #endif /* MBEDTLS_SSL_CONTEXT_SERIALIZATION */
 
 #if defined(MBEDTLS_SSL_RENEGOTIATION)
-    if( options->renegotiate )
-    {
+    if (options->renegotiate) {
         /* Start test with renegotiation */
-        TEST_ASSERT( server.ssl.renego_status ==
-                     MBEDTLS_SSL_INITIAL_HANDSHAKE );
-        TEST_ASSERT( client.ssl.renego_status ==
-                     MBEDTLS_SSL_INITIAL_HANDSHAKE );
+        TEST_ASSERT(server.ssl.renego_status ==
+                    MBEDTLS_SSL_INITIAL_HANDSHAKE);
+        TEST_ASSERT(client.ssl.renego_status ==
+                    MBEDTLS_SSL_INITIAL_HANDSHAKE);
 
         /* After calling this function for the server, it only sends a handshake
          * request. All renegotiation should happen during data exchanging */
-        TEST_ASSERT( mbedtls_ssl_renegotiate( &(server.ssl) ) == 0 );
-        TEST_ASSERT( server.ssl.renego_status ==
-                     MBEDTLS_SSL_RENEGOTIATION_PENDING );
-        TEST_ASSERT( client.ssl.renego_status ==
-                     MBEDTLS_SSL_INITIAL_HANDSHAKE );
+        TEST_ASSERT(mbedtls_ssl_renegotiate(&(server.ssl)) == 0);
+        TEST_ASSERT(server.ssl.renego_status ==
+                    MBEDTLS_SSL_RENEGOTIATION_PENDING);
+        TEST_ASSERT(client.ssl.renego_status ==
+                    MBEDTLS_SSL_INITIAL_HANDSHAKE);
 
-        TEST_ASSERT( exchange_data( &(client.ssl), &(server.ssl) ) == 0 );
-        TEST_ASSERT( server.ssl.renego_status ==
-                     MBEDTLS_SSL_RENEGOTIATION_DONE );
-        TEST_ASSERT( client.ssl.renego_status ==
-                     MBEDTLS_SSL_RENEGOTIATION_DONE );
+        TEST_ASSERT(exchange_data(&(client.ssl), &(server.ssl)) == 0);
+        TEST_ASSERT(server.ssl.renego_status ==
+                    MBEDTLS_SSL_RENEGOTIATION_DONE);
+        TEST_ASSERT(client.ssl.renego_status ==
+                    MBEDTLS_SSL_RENEGOTIATION_DONE);
 
         /* After calling mbedtls_ssl_renegotiate for the client all renegotiation
          * should happen inside this function. However in this test, we cannot
          * perform simultaneous communication between client and server so this
          * function will return waiting error on the socket. All rest of
          * renegotiation should happen during data exchanging */
-        ret = mbedtls_ssl_renegotiate( &(client.ssl) );
+        ret = mbedtls_ssl_renegotiate(&(client.ssl));
 #if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
-        if( options->resize_buffers != 0 )
-        {
+        if (options->resize_buffers != 0) {
             /* Ensure that the buffer sizes are appropriate before resizes */
-            TEST_ASSERT( client.ssl.out_buf_len == MBEDTLS_SSL_OUT_BUFFER_LEN );
-            TEST_ASSERT( client.ssl.in_buf_len == MBEDTLS_SSL_IN_BUFFER_LEN );
+            TEST_ASSERT(client.ssl.out_buf_len == MBEDTLS_SSL_OUT_BUFFER_LEN);
+            TEST_ASSERT(client.ssl.in_buf_len == MBEDTLS_SSL_IN_BUFFER_LEN);
         }
 #endif
-        TEST_ASSERT( ret == 0 ||
-                     ret == MBEDTLS_ERR_SSL_WANT_READ ||
-                     ret == MBEDTLS_ERR_SSL_WANT_WRITE );
-        TEST_ASSERT( server.ssl.renego_status ==
-                     MBEDTLS_SSL_RENEGOTIATION_DONE );
-        TEST_ASSERT( client.ssl.renego_status ==
-                     MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS );
+        TEST_ASSERT(ret == 0 ||
+                    ret == MBEDTLS_ERR_SSL_WANT_READ ||
+                    ret == MBEDTLS_ERR_SSL_WANT_WRITE);
+        TEST_ASSERT(server.ssl.renego_status ==
+                    MBEDTLS_SSL_RENEGOTIATION_DONE);
+        TEST_ASSERT(client.ssl.renego_status ==
+                    MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS);
 
-        TEST_ASSERT( exchange_data( &(client.ssl), &(server.ssl) ) == 0 );
-        TEST_ASSERT( server.ssl.renego_status ==
-                     MBEDTLS_SSL_RENEGOTIATION_DONE );
-        TEST_ASSERT( client.ssl.renego_status ==
-                     MBEDTLS_SSL_RENEGOTIATION_DONE );
+        TEST_ASSERT(exchange_data(&(client.ssl), &(server.ssl)) == 0);
+        TEST_ASSERT(server.ssl.renego_status ==
+                    MBEDTLS_SSL_RENEGOTIATION_DONE);
+        TEST_ASSERT(client.ssl.renego_status ==
+                    MBEDTLS_SSL_RENEGOTIATION_DONE);
 #if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
         /* Validate buffer sizes after renegotiation */
-        if( options->resize_buffers != 0 )
-        {
-            TEST_ASSERT( client.ssl.out_buf_len ==
-                         mbedtls_ssl_get_output_buflen( &client.ssl ) );
-            TEST_ASSERT( client.ssl.in_buf_len ==
-                         mbedtls_ssl_get_input_buflen( &client.ssl ) );
-            TEST_ASSERT( server.ssl.out_buf_len ==
-                         mbedtls_ssl_get_output_buflen( &server.ssl ) );
-            TEST_ASSERT( server.ssl.in_buf_len ==
-                         mbedtls_ssl_get_input_buflen( &server.ssl ) );
+        if (options->resize_buffers != 0) {
+            TEST_ASSERT(client.ssl.out_buf_len ==
+                        mbedtls_ssl_get_output_buflen(&client.ssl));
+            TEST_ASSERT(client.ssl.in_buf_len ==
+                        mbedtls_ssl_get_input_buflen(&client.ssl));
+            TEST_ASSERT(server.ssl.out_buf_len ==
+                        mbedtls_ssl_get_output_buflen(&server.ssl));
+            TEST_ASSERT(server.ssl.in_buf_len ==
+                        mbedtls_ssl_get_input_buflen(&server.ssl));
         }
 #endif /* MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH */
     }
 #endif /* MBEDTLS_SSL_RENEGOTIATION */
 
 exit:
-    mbedtls_endpoint_free( &client, options->dtls != 0 ? &client_context : NULL );
-    mbedtls_endpoint_free( &server, options->dtls != 0 ? &server_context : NULL );
-#if defined (MBEDTLS_DEBUG_C)
-    if( options->cli_log_fun || options->srv_log_fun )
-    {
-        mbedtls_debug_set_threshold( 0 );
+    mbedtls_endpoint_free(&client, options->dtls != 0 ? &client_context : NULL);
+    mbedtls_endpoint_free(&server, options->dtls != 0 ? &server_context : NULL);
+#if defined(MBEDTLS_DEBUG_C)
+    if (options->cli_log_fun || options->srv_log_fun) {
+        mbedtls_debug_set_threshold(0);
     }
 #endif
 #if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION)
-    if( context_buf != NULL )
-        mbedtls_free( context_buf );
+    if (context_buf != NULL) {
+        mbedtls_free(context_buf);
+    }
 #endif
 }
 #endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C */
@@ -2109,56 +2010,56 @@
     unsigned char input[MSGLEN];
     unsigned char output[MSGLEN];
 
-    memset( input, 0, sizeof( input ) );
+    memset(input, 0, sizeof(input));
 
     /* Make sure calling put and get on NULL buffer results in error. */
-    TEST_ASSERT( mbedtls_test_buffer_put( NULL, input, sizeof( input ) )
-                    == -1 );
-    TEST_ASSERT( mbedtls_test_buffer_get( NULL, output, sizeof( output ) )
-                    == -1 );
-    TEST_ASSERT( mbedtls_test_buffer_put( NULL, NULL, sizeof( input ) ) == -1 );
+    TEST_ASSERT(mbedtls_test_buffer_put(NULL, input, sizeof(input))
+                == -1);
+    TEST_ASSERT(mbedtls_test_buffer_get(NULL, output, sizeof(output))
+                == -1);
+    TEST_ASSERT(mbedtls_test_buffer_put(NULL, NULL, sizeof(input)) == -1);
 
-    TEST_ASSERT( mbedtls_test_buffer_put( NULL, NULL, 0 ) == -1 );
-    TEST_ASSERT( mbedtls_test_buffer_get( NULL, NULL, 0 ) == -1 );
+    TEST_ASSERT(mbedtls_test_buffer_put(NULL, NULL, 0) == -1);
+    TEST_ASSERT(mbedtls_test_buffer_get(NULL, NULL, 0) == -1);
 
     /* Make sure calling put and get on a buffer that hasn't been set up results
      * in error. */
-    mbedtls_test_buffer_init( &buf );
+    mbedtls_test_buffer_init(&buf);
 
-    TEST_ASSERT( mbedtls_test_buffer_put( &buf, input, sizeof( input ) ) == -1 );
-    TEST_ASSERT( mbedtls_test_buffer_get( &buf, output, sizeof( output ) )
-                    == -1 );
-    TEST_ASSERT( mbedtls_test_buffer_put( &buf, NULL, sizeof( input ) ) == -1 );
+    TEST_ASSERT(mbedtls_test_buffer_put(&buf, input, sizeof(input)) == -1);
+    TEST_ASSERT(mbedtls_test_buffer_get(&buf, output, sizeof(output))
+                == -1);
+    TEST_ASSERT(mbedtls_test_buffer_put(&buf, NULL, sizeof(input)) == -1);
 
-    TEST_ASSERT( mbedtls_test_buffer_put( &buf, NULL, 0 ) == -1 );
-    TEST_ASSERT( mbedtls_test_buffer_get( &buf, NULL, 0 ) == -1 );
+    TEST_ASSERT(mbedtls_test_buffer_put(&buf, NULL, 0) == -1);
+    TEST_ASSERT(mbedtls_test_buffer_get(&buf, NULL, 0) == -1);
 
     /* Make sure calling put and get on NULL input only results in
      * error if the length is not zero, and that a NULL output is valid for data
      * dropping.
      */
 
-    TEST_ASSERT( mbedtls_test_buffer_setup( &buf, sizeof( input ) ) == 0 );
+    TEST_ASSERT(mbedtls_test_buffer_setup(&buf, sizeof(input)) == 0);
 
-    TEST_ASSERT( mbedtls_test_buffer_put( &buf, NULL, sizeof( input ) ) == -1 );
-    TEST_ASSERT( mbedtls_test_buffer_get( &buf, NULL, sizeof( output ) )
-                    == 0 );
-    TEST_ASSERT( mbedtls_test_buffer_put( &buf, NULL, 0 ) == 0 );
-    TEST_ASSERT( mbedtls_test_buffer_get( &buf, NULL, 0 ) == 0 );
+    TEST_ASSERT(mbedtls_test_buffer_put(&buf, NULL, sizeof(input)) == -1);
+    TEST_ASSERT(mbedtls_test_buffer_get(&buf, NULL, sizeof(output))
+                == 0);
+    TEST_ASSERT(mbedtls_test_buffer_put(&buf, NULL, 0) == 0);
+    TEST_ASSERT(mbedtls_test_buffer_get(&buf, NULL, 0) == 0);
 
     /* Make sure calling put several times in the row is safe */
 
-    TEST_ASSERT( mbedtls_test_buffer_put( &buf, input, sizeof( input ) )
-                                          == sizeof( input ) );
-    TEST_ASSERT( mbedtls_test_buffer_get( &buf, output, 2 ) == 2 );
-    TEST_ASSERT( mbedtls_test_buffer_put( &buf, input, 1 ) == 1 );
-    TEST_ASSERT( mbedtls_test_buffer_put( &buf, input, 2 ) == 1 );
-    TEST_ASSERT( mbedtls_test_buffer_put( &buf, input, 2 ) == 0 );
+    TEST_ASSERT(mbedtls_test_buffer_put(&buf, input, sizeof(input))
+                == sizeof(input));
+    TEST_ASSERT(mbedtls_test_buffer_get(&buf, output, 2) == 2);
+    TEST_ASSERT(mbedtls_test_buffer_put(&buf, input, 1) == 1);
+    TEST_ASSERT(mbedtls_test_buffer_put(&buf, input, 2) == 1);
+    TEST_ASSERT(mbedtls_test_buffer_put(&buf, input, 2) == 0);
 
 
 exit:
 
-    mbedtls_test_buffer_free( &buf );
+    mbedtls_test_buffer_free(&buf);
 }
 /* END_CASE */
 
@@ -2176,9 +2077,9 @@
  */
 
 /* BEGIN_CASE */
-void test_callback_buffer( int size, int put1, int put1_ret,
-                           int get1, int get1_ret, int put2, int put2_ret,
-                           int get2, int get2_ret )
+void test_callback_buffer(int size, int put1, int put1_ret,
+                          int get1, int get1_ret, int put2, int put2_ret,
+                          int get2, int get2_ret)
 {
     enum { ROUNDS = 2 };
     size_t put[ROUNDS];
@@ -2186,96 +2087,91 @@
     size_t get[ROUNDS];
     int get_ret[ROUNDS];
     mbedtls_test_buffer buf;
-    unsigned char* input = NULL;
+    unsigned char *input = NULL;
     size_t input_len;
-    unsigned char* output = NULL;
+    unsigned char *output = NULL;
     size_t output_len;
     size_t i, j, written, read;
 
-    mbedtls_test_buffer_init( &buf );
-    TEST_ASSERT( mbedtls_test_buffer_setup( &buf, size ) == 0 );
+    mbedtls_test_buffer_init(&buf);
+    TEST_ASSERT(mbedtls_test_buffer_setup(&buf, size) == 0);
 
     /* Check the sanity of input parameters and initialise local variables. That
      * is, ensure that the amount of data is not negative and that we are not
      * expecting more to put or get than we actually asked for. */
-    TEST_ASSERT( put1 >= 0 );
+    TEST_ASSERT(put1 >= 0);
     put[0] = put1;
     put_ret[0] = put1_ret;
-    TEST_ASSERT( put1_ret <= put1 );
-    TEST_ASSERT( put2 >= 0 );
+    TEST_ASSERT(put1_ret <= put1);
+    TEST_ASSERT(put2 >= 0);
     put[1] = put2;
     put_ret[1] = put2_ret;
-    TEST_ASSERT( put2_ret <= put2 );
+    TEST_ASSERT(put2_ret <= put2);
 
-    TEST_ASSERT( get1 >= 0 );
+    TEST_ASSERT(get1 >= 0);
     get[0] = get1;
     get_ret[0] = get1_ret;
-    TEST_ASSERT( get1_ret <= get1 );
-    TEST_ASSERT( get2 >= 0 );
+    TEST_ASSERT(get1_ret <= get1);
+    TEST_ASSERT(get2 >= 0);
     get[1] = get2;
     get_ret[1] = get2_ret;
-    TEST_ASSERT( get2_ret <= get2 );
+    TEST_ASSERT(get2_ret <= get2);
 
     input_len = 0;
     /* Calculate actual input and output lengths */
-    for( j = 0; j < ROUNDS; j++ )
-    {
-        if( put_ret[j] > 0 )
-        {
+    for (j = 0; j < ROUNDS; j++) {
+        if (put_ret[j] > 0) {
             input_len += put_ret[j];
         }
     }
     /* In order to always have a valid pointer we always allocate at least 1
      * byte. */
-    if( input_len == 0 )
+    if (input_len == 0) {
         input_len = 1;
-    ASSERT_ALLOC( input, input_len );
+    }
+    ASSERT_ALLOC(input, input_len);
 
     output_len = 0;
-    for( j = 0; j < ROUNDS; j++ )
-    {
-        if( get_ret[j] > 0 )
-        {
+    for (j = 0; j < ROUNDS; j++) {
+        if (get_ret[j] > 0) {
             output_len += get_ret[j];
         }
     }
-    TEST_ASSERT( output_len <= input_len );
+    TEST_ASSERT(output_len <= input_len);
     /* In order to always have a valid pointer we always allocate at least 1
      * byte. */
-    if( output_len == 0 )
+    if (output_len == 0) {
         output_len = 1;
-    ASSERT_ALLOC( output, output_len );
+    }
+    ASSERT_ALLOC(output, output_len);
 
     /* Fill up the buffer with structured data so that unwanted changes
      * can be detected */
-    for( i = 0; i < input_len; i++ )
-    {
+    for (i = 0; i < input_len; i++) {
         input[i] = i & 0xFF;
     }
 
     written = read = 0;
-    for( j = 0; j < ROUNDS; j++ )
-    {
-        TEST_ASSERT( put_ret[j] == mbedtls_test_buffer_put( &buf,
-                                        input + written, put[j] ) );
+    for (j = 0; j < ROUNDS; j++) {
+        TEST_ASSERT(put_ret[j] == mbedtls_test_buffer_put(&buf,
+                                                          input + written, put[j]));
         written += put_ret[j];
-        TEST_ASSERT( get_ret[j] == mbedtls_test_buffer_get( &buf,
-                                        output + read, get[j] ) );
+        TEST_ASSERT(get_ret[j] == mbedtls_test_buffer_get(&buf,
+                                                          output + read, get[j]));
         read += get_ret[j];
-        TEST_ASSERT( read <= written );
-        if( get_ret[j] > 0 )
-        {
-            TEST_ASSERT( memcmp( output + read - get_ret[j],
-                                 input + read - get_ret[j], get_ret[j] )
-                         == 0 );
+        TEST_ASSERT(read <= written);
+        if (get_ret[j] > 0) {
+            TEST_ASSERT(memcmp(output + read - get_ret[j],
+                               input + read - get_ret[j], get_ret[j])
+                        == 0);
         }
     }
 
 exit:
 
-    mbedtls_free( input );
-    mbedtls_free( output );
-    mbedtls_test_buffer_free( &buf );
+    mbedtls_free(input);
+    mbedtls_free(output);
+    mbedtls_test_buffer_free(&buf);
 }
 /* END_CASE */
 
@@ -2285,30 +2181,30 @@
  */
 
 /* BEGIN_CASE */
-void ssl_mock_sanity( )
+void ssl_mock_sanity()
 {
     enum { MSGLEN = 105 };
     unsigned char message[MSGLEN] = { 0 };
     unsigned char received[MSGLEN] = { 0 };
     mbedtls_mock_socket socket;
 
-    mbedtls_mock_socket_init( &socket );
-    TEST_ASSERT( mbedtls_mock_tcp_send_b( &socket, message, MSGLEN ) < 0 );
-    mbedtls_mock_socket_close( &socket );
-    mbedtls_mock_socket_init( &socket );
-    TEST_ASSERT( mbedtls_mock_tcp_recv_b( &socket, received, MSGLEN ) < 0 );
-    mbedtls_mock_socket_close( &socket );
+    mbedtls_mock_socket_init(&socket);
+    TEST_ASSERT(mbedtls_mock_tcp_send_b(&socket, message, MSGLEN) < 0);
+    mbedtls_mock_socket_close(&socket);
+    mbedtls_mock_socket_init(&socket);
+    TEST_ASSERT(mbedtls_mock_tcp_recv_b(&socket, received, MSGLEN) < 0);
+    mbedtls_mock_socket_close(&socket);
 
-    mbedtls_mock_socket_init( &socket );
-    TEST_ASSERT( mbedtls_mock_tcp_send_nb( &socket, message, MSGLEN ) < 0 );
-    mbedtls_mock_socket_close( &socket );
-    mbedtls_mock_socket_init( &socket );
-    TEST_ASSERT( mbedtls_mock_tcp_recv_nb( &socket, received, MSGLEN ) < 0 );
-    mbedtls_mock_socket_close( &socket );
+    mbedtls_mock_socket_init(&socket);
+    TEST_ASSERT(mbedtls_mock_tcp_send_nb(&socket, message, MSGLEN) < 0);
+    mbedtls_mock_socket_close(&socket);
+    mbedtls_mock_socket_init(&socket);
+    TEST_ASSERT(mbedtls_mock_tcp_recv_nb(&socket, received, MSGLEN) < 0);
+    mbedtls_mock_socket_close(&socket);
 
 exit:
 
-    mbedtls_mock_socket_close( &socket );
+    mbedtls_mock_socket_close(&socket);
 }
 /* END_CASE */
 
@@ -2318,7 +2214,7 @@
  */
 
 /* BEGIN_CASE */
-void ssl_mock_tcp( int blocking )
+void ssl_mock_tcp(int blocking)
 {
     enum { MSGLEN = 105 };
     enum { BUFLEN = MSGLEN / 5 };
@@ -2332,94 +2228,76 @@
     mbedtls_ssl_recv_t *recv;
     unsigned i;
 
-    if( blocking == 0 )
-    {
+    if (blocking == 0) {
         send = mbedtls_mock_tcp_send_nb;
         recv = mbedtls_mock_tcp_recv_nb;
-    }
-    else
-    {
+    } else {
         send = mbedtls_mock_tcp_send_b;
         recv = mbedtls_mock_tcp_recv_b;
     }
 
-    mbedtls_mock_socket_init( &client );
-    mbedtls_mock_socket_init( &server );
+    mbedtls_mock_socket_init(&client);
+    mbedtls_mock_socket_init(&server);
 
     /* Fill up the buffer with structured data so that unwanted changes
      * can be detected */
-    for( i = 0; i < MSGLEN; i++ )
-    {
+    for (i = 0; i < MSGLEN; i++) {
         message[i] = i & 0xFF;
     }
 
     /* Make sure that sending a message takes a few  iterations. */
-    TEST_ASSERT( 0 == mbedtls_mock_socket_connect( &client, &server, BUFLEN ) );
+    TEST_ASSERT(0 == mbedtls_mock_socket_connect(&client, &server, BUFLEN));
 
     /* Send the message to the server */
     send_ret = recv_ret = 1;
     written = read = 0;
-    while( send_ret != 0 || recv_ret != 0 )
-    {
-        send_ret = send( &client, message + written, MSGLEN - written );
+    while (send_ret != 0 || recv_ret != 0) {
+        send_ret = send(&client, message + written, MSGLEN - written);
 
-        TEST_ASSERT( send_ret >= 0 );
-        TEST_ASSERT( send_ret <= BUFLEN );
+        TEST_ASSERT(send_ret >= 0);
+        TEST_ASSERT(send_ret <= BUFLEN);
         written += send_ret;
 
         /* If the buffer is full we can test blocking and non-blocking send */
-        if ( send_ret == BUFLEN )
-        {
-            int blocking_ret = send( &client, message , 1 );
-            if ( blocking )
-            {
-                TEST_ASSERT( blocking_ret == 0 );
-            }
-            else
-            {
-                TEST_ASSERT( blocking_ret == MBEDTLS_ERR_SSL_WANT_WRITE );
+        if (send_ret == BUFLEN) {
+            int blocking_ret = send(&client, message, 1);
+            if (blocking) {
+                TEST_ASSERT(blocking_ret == 0);
+            } else {
+                TEST_ASSERT(blocking_ret == MBEDTLS_ERR_SSL_WANT_WRITE);
             }
         }
 
-        recv_ret = recv( &server, received + read, MSGLEN - read );
+        recv_ret = recv(&server, received + read, MSGLEN - read);
 
         /* The result depends on whether any data was sent */
-        if ( send_ret > 0 )
-        {
-            TEST_ASSERT( recv_ret > 0 );
-            TEST_ASSERT( recv_ret <= BUFLEN );
+        if (send_ret > 0) {
+            TEST_ASSERT(recv_ret > 0);
+            TEST_ASSERT(recv_ret <= BUFLEN);
             read += recv_ret;
-        }
-        else if( blocking )
-        {
-            TEST_ASSERT( recv_ret == 0 );
-        }
-        else
-        {
-            TEST_ASSERT( recv_ret == MBEDTLS_ERR_SSL_WANT_READ );
+        } else if (blocking) {
+            TEST_ASSERT(recv_ret == 0);
+        } else {
+            TEST_ASSERT(recv_ret == MBEDTLS_ERR_SSL_WANT_READ);
             recv_ret = 0;
         }
 
         /* If the buffer is empty we can test blocking and non-blocking read */
-        if ( recv_ret == BUFLEN )
-        {
-            int blocking_ret = recv( &server, received, 1 );
-            if ( blocking )
-            {
-                TEST_ASSERT( blocking_ret == 0 );
-            }
-            else
-            {
-                TEST_ASSERT( blocking_ret == MBEDTLS_ERR_SSL_WANT_READ );
+        if (recv_ret == BUFLEN) {
+            int blocking_ret = recv(&server, received, 1);
+            if (blocking) {
+                TEST_ASSERT(blocking_ret == 0);
+            } else {
+                TEST_ASSERT(blocking_ret == MBEDTLS_ERR_SSL_WANT_READ);
             }
         }
     }
-    TEST_ASSERT( memcmp( message, received, MSGLEN ) == 0 );
+    TEST_ASSERT(memcmp(message, received, MSGLEN) == 0);
 
 exit:
 
-    mbedtls_mock_socket_close( &client );
-    mbedtls_mock_socket_close( &server );
+    mbedtls_mock_socket_close(&client);
+    mbedtls_mock_socket_close(&server);
 }
 /* END_CASE */
 
@@ -2430,7 +2308,7 @@
  */
 
 /* BEGIN_CASE */
-void ssl_mock_tcp_interleaving( int blocking )
+void ssl_mock_tcp_interleaving(int blocking)
 {
     enum { ROUNDS = 2 };
     enum { MSGLEN = 105 };
@@ -2447,305 +2325,283 @@
     mbedtls_ssl_send_t *send;
     mbedtls_ssl_recv_t *recv;
 
-    if( blocking == 0 )
-    {
+    if (blocking == 0) {
         send = mbedtls_mock_tcp_send_nb;
         recv = mbedtls_mock_tcp_recv_nb;
-    }
-    else
-    {
+    } else {
         send = mbedtls_mock_tcp_send_b;
         recv = mbedtls_mock_tcp_recv_b;
     }
 
-    mbedtls_mock_socket_init( &client );
-    mbedtls_mock_socket_init( &server );
+    mbedtls_mock_socket_init(&client);
+    mbedtls_mock_socket_init(&server);
 
     /* Fill up the buffers with structured data so that unwanted changes
      * can be detected */
-    for( i = 0; i < ROUNDS; i++ )
-    {
-        for( j = 0; j < MSGLEN; j++ )
-        {
-            message[i][j] = ( i * MSGLEN + j ) & 0xFF;
+    for (i = 0; i < ROUNDS; i++) {
+        for (j = 0; j < MSGLEN; j++) {
+            message[i][j] = (i * MSGLEN + j) & 0xFF;
         }
     }
 
     /* Make sure that sending a message takes a few  iterations. */
-    TEST_ASSERT( 0 == mbedtls_mock_socket_connect( &client, &server, BUFLEN ) );
+    TEST_ASSERT(0 == mbedtls_mock_socket_connect(&client, &server, BUFLEN));
 
     /* Send the message from both sides, interleaving. */
     progress = 1;
-    for( i = 0; i < ROUNDS; i++ )
-    {
+    for (i = 0; i < ROUNDS; i++) {
         written[i] = 0;
         read[i] = 0;
     }
     /* This loop does not stop as long as there was a successful write or read
      * of at least one byte on either side. */
-    while( progress != 0 )
-    {
+    while (progress != 0) {
         mbedtls_mock_socket *socket;
 
-        for( i = 0; i < ROUNDS; i++ )
-        {
+        for (i = 0; i < ROUNDS; i++) {
             /* First sending is from the client */
-            socket = ( i % 2 == 0 ) ? ( &client ) : ( &server );
+            socket = (i % 2 == 0) ? (&client) : (&server);
 
-            send_ret[i] = send( socket, message[i] + written[i],
-                                               MSGLEN - written[i] );
-            TEST_ASSERT( send_ret[i] >= 0 );
-            TEST_ASSERT( send_ret[i] <= BUFLEN );
+            send_ret[i] = send(socket, message[i] + written[i],
+                               MSGLEN - written[i]);
+            TEST_ASSERT(send_ret[i] >= 0);
+            TEST_ASSERT(send_ret[i] <= BUFLEN);
             written[i] += send_ret[i];
 
             /* If the buffer is full we can test blocking and non-blocking
              * send */
-            if ( send_ret[i] == BUFLEN )
-            {
-                int blocking_ret = send( socket, message[i] , 1 );
-                if ( blocking )
-                {
-                    TEST_ASSERT( blocking_ret == 0 );
-                }
-                else
-                {
-                    TEST_ASSERT( blocking_ret == MBEDTLS_ERR_SSL_WANT_WRITE );
+            if (send_ret[i] == BUFLEN) {
+                int blocking_ret = send(socket, message[i], 1);
+                if (blocking) {
+                    TEST_ASSERT(blocking_ret == 0);
+                } else {
+                    TEST_ASSERT(blocking_ret == MBEDTLS_ERR_SSL_WANT_WRITE);
                 }
             }
         }
 
-        for( i = 0; i < ROUNDS; i++ )
-        {
+        for (i = 0; i < ROUNDS; i++) {
             /* First receiving is from the server */
-            socket = ( i % 2 == 0 ) ? ( &server ) : ( &client );
+            socket = (i % 2 == 0) ? (&server) : (&client);
 
-            recv_ret[i] = recv( socket, received[i] + read[i],
-                                               MSGLEN - read[i] );
+            recv_ret[i] = recv(socket, received[i] + read[i],
+                               MSGLEN - read[i]);
 
             /* The result depends on whether any data was sent */
-            if ( send_ret[i] > 0 )
-            {
-                TEST_ASSERT( recv_ret[i] > 0 );
-                TEST_ASSERT( recv_ret[i] <= BUFLEN );
+            if (send_ret[i] > 0) {
+                TEST_ASSERT(recv_ret[i] > 0);
+                TEST_ASSERT(recv_ret[i] <= BUFLEN);
                 read[i] += recv_ret[i];
-            }
-            else if( blocking )
-            {
-                TEST_ASSERT( recv_ret[i] == 0 );
-            }
-            else
-            {
-                TEST_ASSERT( recv_ret[i] == MBEDTLS_ERR_SSL_WANT_READ );
+            } else if (blocking) {
+                TEST_ASSERT(recv_ret[i] == 0);
+            } else {
+                TEST_ASSERT(recv_ret[i] == MBEDTLS_ERR_SSL_WANT_READ);
                 recv_ret[i] = 0;
             }
 
             /* If the buffer is empty we can test blocking and non-blocking
              * read */
-            if ( recv_ret[i] == BUFLEN )
-            {
-                int blocking_ret = recv( socket, received[i], 1 );
-                if ( blocking )
-                {
-                    TEST_ASSERT( blocking_ret == 0 );
-                }
-                else
-                {
-                    TEST_ASSERT( blocking_ret == MBEDTLS_ERR_SSL_WANT_READ );
+            if (recv_ret[i] == BUFLEN) {
+                int blocking_ret = recv(socket, received[i], 1);
+                if (blocking) {
+                    TEST_ASSERT(blocking_ret == 0);
+                } else {
+                    TEST_ASSERT(blocking_ret == MBEDTLS_ERR_SSL_WANT_READ);
                 }
             }
         }
 
         progress = 0;
-        for( i = 0; i < ROUNDS; i++ )
-        {
+        for (i = 0; i < ROUNDS; i++) {
             progress += send_ret[i] + recv_ret[i];
         }
     }
 
-    for( i = 0; i < ROUNDS; i++ )
-        TEST_ASSERT( memcmp( message[i], received[i], MSGLEN ) == 0 );
+    for (i = 0; i < ROUNDS; i++) {
+        TEST_ASSERT(memcmp(message[i], received[i], MSGLEN) == 0);
+    }
 
 exit:
 
-    mbedtls_mock_socket_close( &client );
-    mbedtls_mock_socket_close( &server );
+    mbedtls_mock_socket_close(&client);
+    mbedtls_mock_socket_close(&server);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_message_queue_sanity( )
+void ssl_message_queue_sanity()
 {
     mbedtls_test_message_queue queue;
 
     /* Trying to push/pull to an empty queue */
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( NULL, 1 )
-                 == MBEDTLS_TEST_ERROR_ARG_NULL );
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( NULL, 1 )
-                 == MBEDTLS_TEST_ERROR_ARG_NULL );
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(NULL, 1)
+                == MBEDTLS_TEST_ERROR_ARG_NULL);
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(NULL, 1)
+                == MBEDTLS_TEST_ERROR_ARG_NULL);
 
-    TEST_ASSERT( mbedtls_test_message_queue_setup( &queue, 3 ) == 0 );
-    TEST_ASSERT( queue.capacity == 3 );
-    TEST_ASSERT( queue.num == 0 );
+    TEST_ASSERT(mbedtls_test_message_queue_setup(&queue, 3) == 0);
+    TEST_ASSERT(queue.capacity == 3);
+    TEST_ASSERT(queue.num == 0);
 
 exit:
-    mbedtls_test_message_queue_free( &queue );
+    mbedtls_test_message_queue_free(&queue);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_message_queue_basic( )
+void ssl_message_queue_basic()
 {
     mbedtls_test_message_queue queue;
 
-    TEST_ASSERT( mbedtls_test_message_queue_setup( &queue, 3 ) == 0 );
+    TEST_ASSERT(mbedtls_test_message_queue_setup(&queue, 3) == 0);
 
     /* Sanity test - 3 pushes and 3 pops with sufficient space */
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &queue, 1 ) == 1 );
-    TEST_ASSERT( queue.capacity == 3 );
-    TEST_ASSERT( queue.num == 1 );
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &queue, 1 ) == 1 );
-    TEST_ASSERT( queue.capacity == 3 );
-    TEST_ASSERT( queue.num == 2 );
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &queue, 2 ) == 2 );
-    TEST_ASSERT( queue.capacity == 3 );
-    TEST_ASSERT( queue.num == 3 );
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&queue, 1) == 1);
+    TEST_ASSERT(queue.capacity == 3);
+    TEST_ASSERT(queue.num == 1);
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&queue, 1) == 1);
+    TEST_ASSERT(queue.capacity == 3);
+    TEST_ASSERT(queue.num == 2);
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&queue, 2) == 2);
+    TEST_ASSERT(queue.capacity == 3);
+    TEST_ASSERT(queue.num == 3);
 
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( &queue, 1 ) == 1 );
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( &queue, 1 ) == 1 );
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( &queue, 2 ) == 2 );
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(&queue, 1) == 1);
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(&queue, 1) == 1);
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(&queue, 2) == 2);
 
 exit:
-    mbedtls_test_message_queue_free( &queue );
+    mbedtls_test_message_queue_free(&queue);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_message_queue_overflow_underflow( )
+void ssl_message_queue_overflow_underflow()
 {
     mbedtls_test_message_queue queue;
 
-    TEST_ASSERT( mbedtls_test_message_queue_setup( &queue, 3 ) == 0 );
+    TEST_ASSERT(mbedtls_test_message_queue_setup(&queue, 3) == 0);
 
     /* 4 pushes (last one with an error), 4 pops (last one with an error) */
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &queue, 1 ) == 1 );
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &queue, 1 ) == 1 );
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &queue, 2 ) == 2 );
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &queue, 3 )
-                 == MBEDTLS_ERR_SSL_WANT_WRITE );
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&queue, 1) == 1);
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&queue, 1) == 1);
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&queue, 2) == 2);
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&queue, 3)
+                == MBEDTLS_ERR_SSL_WANT_WRITE);
 
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( &queue, 1 ) == 1 );
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( &queue, 1 ) == 1 );
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( &queue, 2 ) == 2 );
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(&queue, 1) == 1);
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(&queue, 1) == 1);
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(&queue, 2) == 2);
 
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( &queue, 1 )
-                 == MBEDTLS_ERR_SSL_WANT_READ );
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(&queue, 1)
+                == MBEDTLS_ERR_SSL_WANT_READ);
 
 exit:
-    mbedtls_test_message_queue_free( &queue );
+    mbedtls_test_message_queue_free(&queue);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_message_queue_interleaved( )
+void ssl_message_queue_interleaved()
 {
     mbedtls_test_message_queue queue;
 
-    TEST_ASSERT( mbedtls_test_message_queue_setup( &queue, 3 ) == 0 );
+    TEST_ASSERT(mbedtls_test_message_queue_setup(&queue, 3) == 0);
 
     /* Interleaved test - [2 pushes, 1 pop] twice, and then two pops
      * (to wrap around the buffer) */
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &queue, 1 ) == 1 );
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &queue, 1 ) == 1 );
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&queue, 1) == 1);
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&queue, 1) == 1);
 
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( &queue, 1 ) == 1 );
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(&queue, 1) == 1);
 
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &queue, 2 ) == 2 );
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &queue, 3 ) == 3 );
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&queue, 2) == 2);
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&queue, 3) == 3);
 
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( &queue, 1 ) == 1 );
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( &queue, 2 ) == 2 );
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(&queue, 1) == 1);
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(&queue, 2) == 2);
 
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &queue, 5 ) == 5 );
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &queue, 8 ) == 8 );
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&queue, 5) == 5);
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&queue, 8) == 8);
 
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( &queue, 3 ) == 3 );
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(&queue, 3) == 3);
 
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( &queue, 5 ) == 5 );
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(&queue, 5) == 5);
 
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( &queue, 8 ) == 8 );
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(&queue, 8) == 8);
 
 exit:
-    mbedtls_test_message_queue_free( &queue );
+    mbedtls_test_message_queue_free(&queue);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_message_queue_insufficient_buffer( )
+void ssl_message_queue_insufficient_buffer()
 {
     mbedtls_test_message_queue queue;
     size_t message_len = 10;
     size_t buffer_len = 5;
 
-    TEST_ASSERT( mbedtls_test_message_queue_setup( &queue, 1 ) == 0 );
+    TEST_ASSERT(mbedtls_test_message_queue_setup(&queue, 1) == 0);
 
     /* Popping without a sufficient buffer */
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &queue, message_len )
-                 == (int) message_len );
-    TEST_ASSERT( mbedtls_test_message_queue_pop_info( &queue, buffer_len )
-                 == (int) buffer_len );
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&queue, message_len)
+                == (int) message_len);
+    TEST_ASSERT(mbedtls_test_message_queue_pop_info(&queue, buffer_len)
+                == (int) buffer_len);
 exit:
-    mbedtls_test_message_queue_free( &queue );
+    mbedtls_test_message_queue_free(&queue);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_message_mock_uninitialized( )
+void ssl_message_mock_uninitialized()
 {
     enum { MSGLEN = 10 };
-    unsigned char message[MSGLEN] = {0}, received[MSGLEN];
+    unsigned char message[MSGLEN] = { 0 }, received[MSGLEN];
     mbedtls_mock_socket client, server;
     mbedtls_test_message_queue server_queue, client_queue;
     mbedtls_test_message_socket_context server_context, client_context;
-    mbedtls_message_socket_init( &server_context );
-    mbedtls_message_socket_init( &client_context );
+    mbedtls_message_socket_init(&server_context);
+    mbedtls_message_socket_init(&client_context);
 
     /* Send with a NULL context */
-    TEST_ASSERT( mbedtls_mock_tcp_send_msg( NULL, message, MSGLEN )
-                 == MBEDTLS_TEST_ERROR_CONTEXT_ERROR );
+    TEST_ASSERT(mbedtls_mock_tcp_send_msg(NULL, message, MSGLEN)
+                == MBEDTLS_TEST_ERROR_CONTEXT_ERROR);
 
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( NULL, message, MSGLEN )
-                 == MBEDTLS_TEST_ERROR_CONTEXT_ERROR );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(NULL, message, MSGLEN)
+                == MBEDTLS_TEST_ERROR_CONTEXT_ERROR);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &server_queue, &client_queue, 1,
-                                               &server,
-                                               &server_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&server_queue, &client_queue, 1,
+                                             &server,
+                                             &server_context) == 0);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &client_queue, &server_queue, 1,
-                                               &client,
-                                               &client_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&client_queue, &server_queue, 1,
+                                             &client,
+                                             &client_context) == 0);
 
-    TEST_ASSERT( mbedtls_mock_tcp_send_msg( &client_context, message, MSGLEN )
-                 == MBEDTLS_TEST_ERROR_SEND_FAILED );
+    TEST_ASSERT(mbedtls_mock_tcp_send_msg(&client_context, message, MSGLEN)
+                == MBEDTLS_TEST_ERROR_SEND_FAILED);
 
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received, MSGLEN )
-                 == MBEDTLS_ERR_SSL_WANT_READ );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received, MSGLEN)
+                == MBEDTLS_ERR_SSL_WANT_READ);
 
     /* Push directly to a queue to later simulate a disconnected behavior */
-    TEST_ASSERT( mbedtls_test_message_queue_push_info( &server_queue, MSGLEN )
-                 == MSGLEN );
+    TEST_ASSERT(mbedtls_test_message_queue_push_info(&server_queue, MSGLEN)
+                == MSGLEN);
 
     /* Test if there's an error when trying to read from a disconnected
      * socket */
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received, MSGLEN )
-                 == MBEDTLS_TEST_ERROR_RECV_FAILED );
-    exit:
-    mbedtls_message_socket_close( &server_context );
-    mbedtls_message_socket_close( &client_context );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received, MSGLEN)
+                == MBEDTLS_TEST_ERROR_RECV_FAILED);
+exit:
+    mbedtls_message_socket_close(&server_context);
+    mbedtls_message_socket_close(&client_context);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_message_mock_basic( )
+void ssl_message_mock_basic()
 {
     enum { MSGLEN = 10 };
     unsigned char message[MSGLEN], received[MSGLEN];
@@ -2753,54 +2609,53 @@
     unsigned i;
     mbedtls_test_message_queue server_queue, client_queue;
     mbedtls_test_message_socket_context server_context, client_context;
-    mbedtls_message_socket_init( &server_context );
-    mbedtls_message_socket_init( &client_context );
+    mbedtls_message_socket_init(&server_context);
+    mbedtls_message_socket_init(&client_context);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &server_queue, &client_queue, 1,
-                                               &server,
-                                               &server_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&server_queue, &client_queue, 1,
+                                             &server,
+                                             &server_context) == 0);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &client_queue, &server_queue, 1,
-                                               &client,
-                                               &client_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&client_queue, &server_queue, 1,
+                                             &client,
+                                             &client_context) == 0);
 
     /* Fill up the buffer with structured data so that unwanted changes
      * can be detected */
-    for( i = 0; i < MSGLEN; i++ )
-    {
+    for (i = 0; i < MSGLEN; i++) {
         message[i] = i & 0xFF;
     }
-    TEST_ASSERT( 0 == mbedtls_mock_socket_connect( &client, &server,
-                                                   MSGLEN ) );
+    TEST_ASSERT(0 == mbedtls_mock_socket_connect(&client, &server,
+                                                 MSGLEN));
 
     /* Send the message to the server */
-    TEST_ASSERT( mbedtls_mock_tcp_send_msg( &client_context, message,
-                                            MSGLEN ) == MSGLEN );
+    TEST_ASSERT(mbedtls_mock_tcp_send_msg(&client_context, message,
+                                          MSGLEN) == MSGLEN);
 
     /* Read from the server */
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received, MSGLEN )
-                 == MSGLEN );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received, MSGLEN)
+                == MSGLEN);
 
-    TEST_ASSERT( memcmp( message, received, MSGLEN ) == 0 );
-    memset( received, 0, MSGLEN );
+    TEST_ASSERT(memcmp(message, received, MSGLEN) == 0);
+    memset(received, 0, MSGLEN);
 
     /* Send the message to the client */
-    TEST_ASSERT( mbedtls_mock_tcp_send_msg( &server_context, message,
-                                            MSGLEN ) == MSGLEN );
+    TEST_ASSERT(mbedtls_mock_tcp_send_msg(&server_context, message,
+                                          MSGLEN) == MSGLEN);
 
     /* Read from the client */
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &client_context, received, MSGLEN )
-                 == MSGLEN );
-    TEST_ASSERT( memcmp( message, received, MSGLEN ) == 0 );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&client_context, received, MSGLEN)
+                == MSGLEN);
+    TEST_ASSERT(memcmp(message, received, MSGLEN) == 0);
 
-    exit:
-    mbedtls_message_socket_close( &server_context );
-    mbedtls_message_socket_close( &client_context );
+exit:
+    mbedtls_message_socket_close(&server_context);
+    mbedtls_message_socket_close(&client_context);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_message_mock_queue_overflow_underflow( )
+void ssl_message_mock_queue_overflow_underflow()
 {
     enum { MSGLEN = 10 };
     unsigned char message[MSGLEN], received[MSGLEN];
@@ -2808,57 +2663,56 @@
     unsigned i;
     mbedtls_test_message_queue server_queue, client_queue;
     mbedtls_test_message_socket_context server_context, client_context;
-    mbedtls_message_socket_init( &server_context );
-    mbedtls_message_socket_init( &client_context );
+    mbedtls_message_socket_init(&server_context);
+    mbedtls_message_socket_init(&client_context);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &server_queue, &client_queue, 2,
-                                               &server,
-                                               &server_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&server_queue, &client_queue, 2,
+                                             &server,
+                                             &server_context) == 0);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &client_queue, &server_queue, 2,
-                                               &client,
-                                               &client_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&client_queue, &server_queue, 2,
+                                             &client,
+                                             &client_context) == 0);
 
     /* Fill up the buffer with structured data so that unwanted changes
      * can be detected */
-    for( i = 0; i < MSGLEN; i++ )
-    {
+    for (i = 0; i < MSGLEN; i++) {
         message[i] = i & 0xFF;
     }
-    TEST_ASSERT( 0 == mbedtls_mock_socket_connect( &client, &server,
-                                                   MSGLEN*2 ) );
+    TEST_ASSERT(0 == mbedtls_mock_socket_connect(&client, &server,
+                                                 MSGLEN*2));
 
     /* Send three message to the server, last one with an error */
-    TEST_ASSERT( mbedtls_mock_tcp_send_msg( &client_context, message,
-                                            MSGLEN - 1 ) == MSGLEN - 1 );
+    TEST_ASSERT(mbedtls_mock_tcp_send_msg(&client_context, message,
+                                          MSGLEN - 1) == MSGLEN - 1);
 
-    TEST_ASSERT( mbedtls_mock_tcp_send_msg( &client_context, message,
-                                            MSGLEN ) == MSGLEN );
+    TEST_ASSERT(mbedtls_mock_tcp_send_msg(&client_context, message,
+                                          MSGLEN) == MSGLEN);
 
-    TEST_ASSERT( mbedtls_mock_tcp_send_msg( &client_context, message,
-                                            MSGLEN )
-                 == MBEDTLS_ERR_SSL_WANT_WRITE );
+    TEST_ASSERT(mbedtls_mock_tcp_send_msg(&client_context, message,
+                                          MSGLEN)
+                == MBEDTLS_ERR_SSL_WANT_WRITE);
 
     /* Read three messages from the server, last one with an error */
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received,
-                                            MSGLEN - 1 ) == MSGLEN - 1 );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received,
+                                          MSGLEN - 1) == MSGLEN - 1);
 
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received, MSGLEN )
-                 == MSGLEN );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received, MSGLEN)
+                == MSGLEN);
 
-    TEST_ASSERT( memcmp( message, received, MSGLEN ) == 0 );
+    TEST_ASSERT(memcmp(message, received, MSGLEN) == 0);
 
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received, MSGLEN )
-                 == MBEDTLS_ERR_SSL_WANT_READ );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received, MSGLEN)
+                == MBEDTLS_ERR_SSL_WANT_READ);
 
-    exit:
-    mbedtls_message_socket_close( &server_context );
-    mbedtls_message_socket_close( &client_context );
+exit:
+    mbedtls_message_socket_close(&server_context);
+    mbedtls_message_socket_close(&client_context);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_message_mock_socket_overflow( )
+void ssl_message_mock_socket_overflow()
 {
     enum { MSGLEN = 10 };
     unsigned char message[MSGLEN], received[MSGLEN];
@@ -2866,48 +2720,47 @@
     unsigned i;
     mbedtls_test_message_queue server_queue, client_queue;
     mbedtls_test_message_socket_context server_context, client_context;
-    mbedtls_message_socket_init( &server_context );
-    mbedtls_message_socket_init( &client_context );
+    mbedtls_message_socket_init(&server_context);
+    mbedtls_message_socket_init(&client_context);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &server_queue, &client_queue, 2,
-                                               &server,
-                                               &server_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&server_queue, &client_queue, 2,
+                                             &server,
+                                             &server_context) == 0);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &client_queue, &server_queue, 2,
-                                               &client,
-                                               &client_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&client_queue, &server_queue, 2,
+                                             &client,
+                                             &client_context) == 0);
 
     /* Fill up the buffer with structured data so that unwanted changes
      * can be detected */
-    for( i = 0; i < MSGLEN; i++ )
-    {
+    for (i = 0; i < MSGLEN; i++) {
         message[i] = i & 0xFF;
     }
-    TEST_ASSERT( 0 == mbedtls_mock_socket_connect( &client, &server,
-                                                   MSGLEN ) );
+    TEST_ASSERT(0 == mbedtls_mock_socket_connect(&client, &server,
+                                                 MSGLEN));
 
     /* Send two message to the server, second one with an error */
-    TEST_ASSERT( mbedtls_mock_tcp_send_msg( &client_context, message,
-                                            MSGLEN ) == MSGLEN );
+    TEST_ASSERT(mbedtls_mock_tcp_send_msg(&client_context, message,
+                                          MSGLEN) == MSGLEN);
 
-    TEST_ASSERT( mbedtls_mock_tcp_send_msg( &client_context, message,
-                                            MSGLEN )
-                 == MBEDTLS_TEST_ERROR_SEND_FAILED );
+    TEST_ASSERT(mbedtls_mock_tcp_send_msg(&client_context, message,
+                                          MSGLEN)
+                == MBEDTLS_TEST_ERROR_SEND_FAILED);
 
     /* Read the only message from the server */
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received, MSGLEN )
-                 == MSGLEN );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received, MSGLEN)
+                == MSGLEN);
 
-    TEST_ASSERT( memcmp( message, received, MSGLEN ) == 0 );
+    TEST_ASSERT(memcmp(message, received, MSGLEN) == 0);
 
-    exit:
-    mbedtls_message_socket_close( &server_context );
-    mbedtls_message_socket_close( &client_context );
+exit:
+    mbedtls_message_socket_close(&server_context);
+    mbedtls_message_socket_close(&client_context);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_message_mock_truncated( )
+void ssl_message_mock_truncated()
 {
     enum { MSGLEN = 10 };
     unsigned char message[MSGLEN], received[MSGLEN];
@@ -2915,58 +2768,57 @@
     unsigned i;
     mbedtls_test_message_queue server_queue, client_queue;
     mbedtls_test_message_socket_context server_context, client_context;
-    mbedtls_message_socket_init( &server_context );
-    mbedtls_message_socket_init( &client_context );
+    mbedtls_message_socket_init(&server_context);
+    mbedtls_message_socket_init(&client_context);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &server_queue, &client_queue, 2,
-                                               &server,
-                                               &server_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&server_queue, &client_queue, 2,
+                                             &server,
+                                             &server_context) == 0);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &client_queue, &server_queue, 2,
-                                               &client,
-                                               &client_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&client_queue, &server_queue, 2,
+                                             &client,
+                                             &client_context) == 0);
 
-    memset( received, 0, MSGLEN );
+    memset(received, 0, MSGLEN);
     /* Fill up the buffer with structured data so that unwanted changes
      * can be detected */
-    for( i = 0; i < MSGLEN; i++ )
-    {
+    for (i = 0; i < MSGLEN; i++) {
         message[i] = i & 0xFF;
     }
-    TEST_ASSERT( 0 == mbedtls_mock_socket_connect( &client, &server,
-                                                   2 * MSGLEN ) );
+    TEST_ASSERT(0 == mbedtls_mock_socket_connect(&client, &server,
+                                                 2 * MSGLEN));
 
     /* Send two messages to the server, the second one small enough to fit in the
      * receiver's buffer. */
-    TEST_ASSERT( mbedtls_mock_tcp_send_msg( &client_context, message,
-                                            MSGLEN ) == MSGLEN );
-    TEST_ASSERT( mbedtls_mock_tcp_send_msg( &client_context, message,
-                                            MSGLEN / 2 ) == MSGLEN / 2 );
+    TEST_ASSERT(mbedtls_mock_tcp_send_msg(&client_context, message,
+                                          MSGLEN) == MSGLEN);
+    TEST_ASSERT(mbedtls_mock_tcp_send_msg(&client_context, message,
+                                          MSGLEN / 2) == MSGLEN / 2);
     /* Read a truncated message from the server */
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received, MSGLEN/2 )
-                 == MSGLEN/2 );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received, MSGLEN/2)
+                == MSGLEN/2);
 
     /* Test that the first half of the message is valid, and second one isn't */
-    TEST_ASSERT( memcmp( message, received, MSGLEN/2 ) == 0 );
-    TEST_ASSERT( memcmp( message + MSGLEN/2, received + MSGLEN/2, MSGLEN/2 )
-                 != 0 );
-    memset( received, 0, MSGLEN );
+    TEST_ASSERT(memcmp(message, received, MSGLEN/2) == 0);
+    TEST_ASSERT(memcmp(message + MSGLEN/2, received + MSGLEN/2, MSGLEN/2)
+                != 0);
+    memset(received, 0, MSGLEN);
 
     /* Read a full message from the server */
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received, MSGLEN/2 )
-                 == MSGLEN / 2 );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received, MSGLEN/2)
+                == MSGLEN / 2);
 
     /* Test that the first half of the message is valid */
-    TEST_ASSERT( memcmp( message, received, MSGLEN/2 ) == 0 );
+    TEST_ASSERT(memcmp(message, received, MSGLEN/2) == 0);
 
-    exit:
-    mbedtls_message_socket_close( &server_context );
-    mbedtls_message_socket_close( &client_context );
+exit:
+    mbedtls_message_socket_close(&server_context);
+    mbedtls_message_socket_close(&client_context);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_message_mock_socket_read_error( )
+void ssl_message_mock_socket_read_error()
 {
     enum { MSGLEN = 10 };
     unsigned char message[MSGLEN], received[MSGLEN];
@@ -2974,53 +2826,52 @@
     unsigned i;
     mbedtls_test_message_queue server_queue, client_queue;
     mbedtls_test_message_socket_context server_context, client_context;
-    mbedtls_message_socket_init( &server_context );
-    mbedtls_message_socket_init( &client_context );
+    mbedtls_message_socket_init(&server_context);
+    mbedtls_message_socket_init(&client_context);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &server_queue, &client_queue, 1,
-                                               &server,
-                                               &server_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&server_queue, &client_queue, 1,
+                                             &server,
+                                             &server_context) == 0);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &client_queue, &server_queue, 1,
-                                               &client,
-                                               &client_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&client_queue, &server_queue, 1,
+                                             &client,
+                                             &client_context) == 0);
 
     /* Fill up the buffer with structured data so that unwanted changes
      * can be detected */
-    for( i = 0; i < MSGLEN; i++ )
-    {
+    for (i = 0; i < MSGLEN; i++) {
         message[i] = i & 0xFF;
     }
-    TEST_ASSERT( 0 == mbedtls_mock_socket_connect( &client, &server,
-                                                   MSGLEN ) );
+    TEST_ASSERT(0 == mbedtls_mock_socket_connect(&client, &server,
+                                                 MSGLEN));
 
-    TEST_ASSERT( mbedtls_mock_tcp_send_msg( &client_context, message,
-                                            MSGLEN ) == MSGLEN );
+    TEST_ASSERT(mbedtls_mock_tcp_send_msg(&client_context, message,
+                                          MSGLEN) == MSGLEN);
 
     /* Force a read error by disconnecting the socket by hand */
     server.status = 0;
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received, MSGLEN )
-                 == MBEDTLS_TEST_ERROR_RECV_FAILED );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received, MSGLEN)
+                == MBEDTLS_TEST_ERROR_RECV_FAILED);
     /* Return to a valid state */
     server.status = MBEDTLS_MOCK_SOCKET_CONNECTED;
 
-    memset( received, 0, sizeof( received ) );
+    memset(received, 0, sizeof(received));
 
     /* Test that even though the server tried to read once disconnected, the
      * continuity is preserved */
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received, MSGLEN )
-                 == MSGLEN );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received, MSGLEN)
+                == MSGLEN);
 
-    TEST_ASSERT( memcmp( message, received, MSGLEN ) == 0 );
+    TEST_ASSERT(memcmp(message, received, MSGLEN) == 0);
 
-    exit:
-    mbedtls_message_socket_close( &server_context );
-    mbedtls_message_socket_close( &client_context );
+exit:
+    mbedtls_message_socket_close(&server_context);
+    mbedtls_message_socket_close(&client_context);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_message_mock_interleaved_one_way( )
+void ssl_message_mock_interleaved_one_way()
 {
     enum { MSGLEN = 10 };
     unsigned char message[MSGLEN], received[MSGLEN];
@@ -3028,59 +2879,56 @@
     unsigned i;
     mbedtls_test_message_queue server_queue, client_queue;
     mbedtls_test_message_socket_context server_context, client_context;
-    mbedtls_message_socket_init( &server_context );
-    mbedtls_message_socket_init( &client_context );
+    mbedtls_message_socket_init(&server_context);
+    mbedtls_message_socket_init(&client_context);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &server_queue, &client_queue, 3,
-                                               &server,
-                                               &server_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&server_queue, &client_queue, 3,
+                                             &server,
+                                             &server_context) == 0);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &client_queue, &server_queue, 3,
-                                               &client,
-                                               &client_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&client_queue, &server_queue, 3,
+                                             &client,
+                                             &client_context) == 0);
 
     /* Fill up the buffer with structured data so that unwanted changes
      * can be detected */
-    for( i = 0; i < MSGLEN; i++ )
-    {
+    for (i = 0; i < MSGLEN; i++) {
         message[i] = i & 0xFF;
     }
-    TEST_ASSERT( 0 == mbedtls_mock_socket_connect( &client, &server,
-                                                   MSGLEN*3 ) );
+    TEST_ASSERT(0 == mbedtls_mock_socket_connect(&client, &server,
+                                                 MSGLEN*3));
 
     /* Interleaved test - [2 sends, 1 read] twice, and then two reads
      * (to wrap around the buffer) */
-    for( i = 0; i < 2; i++ )
-    {
-        TEST_ASSERT( mbedtls_mock_tcp_send_msg( &client_context, message,
-                                                MSGLEN ) == MSGLEN );
+    for (i = 0; i < 2; i++) {
+        TEST_ASSERT(mbedtls_mock_tcp_send_msg(&client_context, message,
+                                              MSGLEN) == MSGLEN);
 
-        TEST_ASSERT( mbedtls_mock_tcp_send_msg( &client_context, message,
-                                                MSGLEN ) == MSGLEN );
+        TEST_ASSERT(mbedtls_mock_tcp_send_msg(&client_context, message,
+                                              MSGLEN) == MSGLEN);
 
-        TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received,
-                                                MSGLEN ) == MSGLEN );
-        TEST_ASSERT( memcmp( message, received, MSGLEN ) == 0 );
-        memset( received, 0, sizeof( received ) );
+        TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received,
+                                              MSGLEN) == MSGLEN);
+        TEST_ASSERT(memcmp(message, received, MSGLEN) == 0);
+        memset(received, 0, sizeof(received));
     }
 
-    for( i = 0; i < 2; i++ )
-    {
-        TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received,
-                                                MSGLEN ) == MSGLEN );
+    for (i = 0; i < 2; i++) {
+        TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received,
+                                              MSGLEN) == MSGLEN);
 
-        TEST_ASSERT( memcmp( message, received, MSGLEN ) == 0 );
+        TEST_ASSERT(memcmp(message, received, MSGLEN) == 0);
     }
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received, MSGLEN )
-                 == MBEDTLS_ERR_SSL_WANT_READ );
-    exit:
-    mbedtls_message_socket_close( &server_context );
-    mbedtls_message_socket_close( &client_context );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received, MSGLEN)
+                == MBEDTLS_ERR_SSL_WANT_READ);
+exit:
+    mbedtls_message_socket_close(&server_context);
+    mbedtls_message_socket_close(&client_context);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_message_mock_interleaved_two_ways( )
+void ssl_message_mock_interleaved_two_ways()
 {
     enum { MSGLEN = 10 };
     unsigned char message[MSGLEN], received[MSGLEN];
@@ -3088,132 +2936,128 @@
     unsigned i;
     mbedtls_test_message_queue server_queue, client_queue;
     mbedtls_test_message_socket_context server_context, client_context;
-    mbedtls_message_socket_init( &server_context );
-    mbedtls_message_socket_init( &client_context );
+    mbedtls_message_socket_init(&server_context);
+    mbedtls_message_socket_init(&client_context);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &server_queue, &client_queue, 3,
-                                               &server,
-                                               &server_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&server_queue, &client_queue, 3,
+                                             &server,
+                                             &server_context) == 0);
 
-    TEST_ASSERT( mbedtls_message_socket_setup( &client_queue, &server_queue, 3,
-                                               &client,
-                                               &client_context ) == 0 );
+    TEST_ASSERT(mbedtls_message_socket_setup(&client_queue, &server_queue, 3,
+                                             &client,
+                                             &client_context) == 0);
 
     /* Fill up the buffer with structured data so that unwanted changes
      * can be detected */
-    for( i = 0; i < MSGLEN; i++ )
-    {
+    for (i = 0; i < MSGLEN; i++) {
         message[i] = i & 0xFF;
     }
-    TEST_ASSERT( 0 == mbedtls_mock_socket_connect( &client, &server,
-                                                   MSGLEN*3 ) );
+    TEST_ASSERT(0 == mbedtls_mock_socket_connect(&client, &server,
+                                                 MSGLEN*3));
 
     /* Interleaved test - [2 sends, 1 read] twice, both ways, and then two reads
      * (to wrap around the buffer) both ways. */
-    for( i = 0; i < 2; i++ )
-    {
-        TEST_ASSERT( mbedtls_mock_tcp_send_msg( &client_context, message,
-                                                MSGLEN ) == MSGLEN );
+    for (i = 0; i < 2; i++) {
+        TEST_ASSERT(mbedtls_mock_tcp_send_msg(&client_context, message,
+                                              MSGLEN) == MSGLEN);
 
-        TEST_ASSERT( mbedtls_mock_tcp_send_msg( &client_context, message,
-                                                MSGLEN ) == MSGLEN );
+        TEST_ASSERT(mbedtls_mock_tcp_send_msg(&client_context, message,
+                                              MSGLEN) == MSGLEN);
 
-        TEST_ASSERT( mbedtls_mock_tcp_send_msg( &server_context, message,
-                                                MSGLEN ) == MSGLEN );
+        TEST_ASSERT(mbedtls_mock_tcp_send_msg(&server_context, message,
+                                              MSGLEN) == MSGLEN);
 
-        TEST_ASSERT( mbedtls_mock_tcp_send_msg( &server_context, message,
-                                                MSGLEN ) == MSGLEN );
+        TEST_ASSERT(mbedtls_mock_tcp_send_msg(&server_context, message,
+                                              MSGLEN) == MSGLEN);
 
-        TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received,
-                     MSGLEN ) == MSGLEN );
+        TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received,
+                                              MSGLEN) == MSGLEN);
 
-        TEST_ASSERT( memcmp( message, received, MSGLEN ) == 0 );
+        TEST_ASSERT(memcmp(message, received, MSGLEN) == 0);
 
-        memset( received, 0, sizeof( received ) );
+        memset(received, 0, sizeof(received));
 
-        TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &client_context, received,
-                     MSGLEN ) == MSGLEN );
+        TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&client_context, received,
+                                              MSGLEN) == MSGLEN);
 
-        TEST_ASSERT( memcmp( message, received, MSGLEN ) == 0 );
+        TEST_ASSERT(memcmp(message, received, MSGLEN) == 0);
 
-        memset( received, 0, sizeof( received ) );
+        memset(received, 0, sizeof(received));
     }
 
-    for( i = 0; i < 2; i++ )
-    {
-        TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received,
-                    MSGLEN ) == MSGLEN );
+    for (i = 0; i < 2; i++) {
+        TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received,
+                                              MSGLEN) == MSGLEN);
 
-        TEST_ASSERT( memcmp( message, received, MSGLEN ) == 0 );
-        memset( received, 0, sizeof( received ) );
+        TEST_ASSERT(memcmp(message, received, MSGLEN) == 0);
+        memset(received, 0, sizeof(received));
 
-        TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &client_context, received,
-                     MSGLEN ) == MSGLEN );
+        TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&client_context, received,
+                                              MSGLEN) == MSGLEN);
 
-        TEST_ASSERT( memcmp( message, received, MSGLEN ) == 0 );
-        memset( received, 0, sizeof( received ) );
+        TEST_ASSERT(memcmp(message, received, MSGLEN) == 0);
+        memset(received, 0, sizeof(received));
     }
 
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &server_context, received, MSGLEN )
-                 == MBEDTLS_ERR_SSL_WANT_READ );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&server_context, received, MSGLEN)
+                == MBEDTLS_ERR_SSL_WANT_READ);
 
-    TEST_ASSERT( mbedtls_mock_tcp_recv_msg( &client_context, received, MSGLEN )
-                 == MBEDTLS_ERR_SSL_WANT_READ );
-    exit:
-    mbedtls_message_socket_close( &server_context );
-    mbedtls_message_socket_close( &client_context );
+    TEST_ASSERT(mbedtls_mock_tcp_recv_msg(&client_context, received, MSGLEN)
+                == MBEDTLS_ERR_SSL_WANT_READ);
+exit:
+    mbedtls_message_socket_close(&server_context);
+    mbedtls_message_socket_close(&client_context);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SSL_DTLS_ANTI_REPLAY */
-void ssl_dtls_replay( data_t * prevs, data_t * new, int ret )
+void ssl_dtls_replay(data_t *prevs, data_t *new, int ret)
 {
     uint32_t len = 0;
     mbedtls_ssl_context ssl;
     mbedtls_ssl_config conf;
 
-    mbedtls_ssl_init( &ssl );
-    mbedtls_ssl_config_init( &conf );
+    mbedtls_ssl_init(&ssl);
+    mbedtls_ssl_config_init(&conf);
 
-    TEST_ASSERT( mbedtls_ssl_config_defaults( &conf,
-                 MBEDTLS_SSL_IS_CLIENT,
-                 MBEDTLS_SSL_TRANSPORT_DATAGRAM,
-                 MBEDTLS_SSL_PRESET_DEFAULT ) == 0 );
-    TEST_ASSERT( mbedtls_ssl_setup( &ssl, &conf ) == 0 );
+    TEST_ASSERT(mbedtls_ssl_config_defaults(&conf,
+                                            MBEDTLS_SSL_IS_CLIENT,
+                                            MBEDTLS_SSL_TRANSPORT_DATAGRAM,
+                                            MBEDTLS_SSL_PRESET_DEFAULT) == 0);
+    TEST_ASSERT(mbedtls_ssl_setup(&ssl, &conf) == 0);
 
     /* Read previous record numbers */
-    for( len = 0; len < prevs->len; len += 6 )
-    {
-        memcpy( ssl.in_ctr + 2, prevs->x + len, 6 );
-        mbedtls_ssl_dtls_replay_update( &ssl );
+    for (len = 0; len < prevs->len; len += 6) {
+        memcpy(ssl.in_ctr + 2, prevs->x + len, 6);
+        mbedtls_ssl_dtls_replay_update(&ssl);
     }
 
     /* Check new number */
-    memcpy( ssl.in_ctr + 2, new->x, 6 );
-    TEST_ASSERT( mbedtls_ssl_dtls_replay_check( &ssl ) == ret );
+    memcpy(ssl.in_ctr + 2, new->x, 6);
+    TEST_ASSERT(mbedtls_ssl_dtls_replay_check(&ssl) == ret);
 
-    mbedtls_ssl_free( &ssl );
-    mbedtls_ssl_config_free( &conf );
+    mbedtls_ssl_free(&ssl);
+    mbedtls_ssl_config_free(&conf);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
-void ssl_set_hostname_twice( char *hostname0, char *hostname1 )
+void ssl_set_hostname_twice(char *hostname0, char *hostname1)
 {
     mbedtls_ssl_context ssl;
-    mbedtls_ssl_init( &ssl );
+    mbedtls_ssl_init(&ssl);
 
-    TEST_ASSERT( mbedtls_ssl_set_hostname( &ssl, hostname0 ) == 0 );
-    TEST_ASSERT( mbedtls_ssl_set_hostname( &ssl, hostname1 ) == 0 );
+    TEST_ASSERT(mbedtls_ssl_set_hostname(&ssl, hostname0) == 0);
+    TEST_ASSERT(mbedtls_ssl_set_hostname(&ssl, hostname1) == 0);
 
-    mbedtls_ssl_free( &ssl );
+    mbedtls_ssl_free(&ssl);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_crypt_record( int cipher_type, int hash_id,
-                       int etm, int tag_mode, int ver,
-                       int cid0_len, int cid1_len )
+void ssl_crypt_record(int cipher_type, int hash_id,
+                      int etm, int tag_mode, int ver,
+                      int cid0_len, int cid1_len)
 {
     /*
      * Test several record encryptions and decryptions
@@ -3230,27 +3074,23 @@
     size_t const buflen = 512;
     mbedtls_record rec, rec_backup;
 
-    mbedtls_ssl_init( &ssl );
-    mbedtls_ssl_transform_init( &t0 );
-    mbedtls_ssl_transform_init( &t1 );
-    TEST_ASSERT( build_transforms( &t0, &t1, cipher_type, hash_id,
-                                   etm, tag_mode, ver,
-                                   (size_t) cid0_len,
-                                   (size_t) cid1_len ) == 0 );
+    mbedtls_ssl_init(&ssl);
+    mbedtls_ssl_transform_init(&t0);
+    mbedtls_ssl_transform_init(&t1);
+    TEST_ASSERT(build_transforms(&t0, &t1, cipher_type, hash_id,
+                                 etm, tag_mode, ver,
+                                 (size_t) cid0_len,
+                                 (size_t) cid1_len) == 0);
 
-    TEST_ASSERT( ( buf = mbedtls_calloc( 1, buflen ) ) != NULL );
+    TEST_ASSERT((buf = mbedtls_calloc(1, buflen)) != NULL);
 
-    while( num_records-- > 0 )
-    {
+    while (num_records-- > 0) {
         mbedtls_ssl_transform *t_dec, *t_enc;
         /* Take turns in who's sending and who's receiving. */
-        if( num_records % 3 == 0 )
-        {
+        if (num_records % 3 == 0) {
             t_dec = &t0;
             t_enc = &t1;
-        }
-        else
-        {
+        } else {
             t_dec = &t1;
             t_enc = &t0;
         }
@@ -3267,7 +3107,7 @@
          * type is sensible.
          */
 
-        memset( rec.ctr, num_records, sizeof( rec.ctr ) );
+        memset(rec.ctr, num_records, sizeof(rec.ctr));
         rec.type    = 42;
         rec.ver[0]  = num_records;
         rec.ver[1]  = num_records;
@@ -3282,71 +3122,68 @@
          * paddings. */
         rec.data_len = 1 + num_records;
 
-        memset( rec.buf + rec.data_offset, 42, rec.data_len );
+        memset(rec.buf + rec.data_offset, 42, rec.data_len);
 
         /* Make a copy for later comparison */
         rec_backup = rec;
 
         /* Encrypt record */
-        ret = mbedtls_ssl_encrypt_buf( &ssl, t_enc, &rec,
-                                       mbedtls_test_rnd_std_rand, NULL );
-        TEST_ASSERT( ret == 0 || ret == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
-        if( ret != 0 )
-        {
+        ret = mbedtls_ssl_encrypt_buf(&ssl, t_enc, &rec,
+                                      mbedtls_test_rnd_std_rand, NULL);
+        TEST_ASSERT(ret == 0 || ret == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL);
+        if (ret != 0) {
             continue;
         }
 
 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
-        if( rec.cid_len != 0 )
-        {
+        if (rec.cid_len != 0) {
             /* DTLS 1.2 + CID hides the real content type and
              * uses a special CID content type in the protected
              * record. Double-check this. */
-            TEST_ASSERT( rec.type == MBEDTLS_SSL_MSG_CID );
+            TEST_ASSERT(rec.type == MBEDTLS_SSL_MSG_CID);
         }
 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
 
 #if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL)
-        if( t_enc->minor_ver == MBEDTLS_SSL_MINOR_VERSION_4 )
-        {
+        if (t_enc->minor_ver == MBEDTLS_SSL_MINOR_VERSION_4) {
             /* TLS 1.3 hides the real content type and
              * always uses Application Data as the content type
              * for protected records. Double-check this. */
-            TEST_ASSERT( rec.type == MBEDTLS_SSL_MSG_APPLICATION_DATA );
+            TEST_ASSERT(rec.type == MBEDTLS_SSL_MSG_APPLICATION_DATA);
         }
 #endif /* MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
 
         /* Decrypt record with t_dec */
-        ret = mbedtls_ssl_decrypt_buf( &ssl, t_dec, &rec );
-        TEST_ASSERT( ret == 0 );
+        ret = mbedtls_ssl_decrypt_buf(&ssl, t_dec, &rec);
+        TEST_ASSERT(ret == 0);
 
         /* Compare results */
-        TEST_ASSERT( rec.type == rec_backup.type );
-        TEST_ASSERT( memcmp( rec.ctr, rec_backup.ctr, 8 ) == 0 );
-        TEST_ASSERT( rec.ver[0] == rec_backup.ver[0] );
-        TEST_ASSERT( rec.ver[1] == rec_backup.ver[1] );
-        TEST_ASSERT( rec.data_len == rec_backup.data_len );
-        TEST_ASSERT( rec.data_offset == rec_backup.data_offset );
-        TEST_ASSERT( memcmp( rec.buf + rec.data_offset,
-                             rec_backup.buf + rec_backup.data_offset,
-                             rec.data_len ) == 0 );
+        TEST_ASSERT(rec.type == rec_backup.type);
+        TEST_ASSERT(memcmp(rec.ctr, rec_backup.ctr, 8) == 0);
+        TEST_ASSERT(rec.ver[0] == rec_backup.ver[0]);
+        TEST_ASSERT(rec.ver[1] == rec_backup.ver[1]);
+        TEST_ASSERT(rec.data_len == rec_backup.data_len);
+        TEST_ASSERT(rec.data_offset == rec_backup.data_offset);
+        TEST_ASSERT(memcmp(rec.buf + rec.data_offset,
+                           rec_backup.buf + rec_backup.data_offset,
+                           rec.data_len) == 0);
     }
 
 exit:
 
     /* Cleanup */
-    mbedtls_ssl_free( &ssl );
-    mbedtls_ssl_transform_free( &t0 );
-    mbedtls_ssl_transform_free( &t1 );
+    mbedtls_ssl_free(&ssl);
+    mbedtls_ssl_transform_free(&t0);
+    mbedtls_ssl_transform_free(&t1);
 
-    mbedtls_free( buf );
+    mbedtls_free(buf);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_crypt_record_small( int cipher_type, int hash_id,
-                             int etm, int tag_mode, int ver,
-                             int cid0_len, int cid1_len )
+void ssl_crypt_record_small(int cipher_type, int hash_id,
+                            int etm, int tag_mode, int ver,
+                            int cid0_len, int cid1_len)
 {
     /*
      * Test pairs of encryption and decryption with an increasing
@@ -3386,26 +3223,24 @@
     int seen_success; /* Indicates if in the current mode we've
                        * already seen a successful test. */
 
-    mbedtls_ssl_init( &ssl );
-    mbedtls_ssl_transform_init( &t0 );
-    mbedtls_ssl_transform_init( &t1 );
-    TEST_ASSERT( build_transforms( &t0, &t1, cipher_type, hash_id,
-                                   etm, tag_mode, ver,
-                                   (size_t) cid0_len,
-                                   (size_t) cid1_len ) == 0 );
+    mbedtls_ssl_init(&ssl);
+    mbedtls_ssl_transform_init(&t0);
+    mbedtls_ssl_transform_init(&t1);
+    TEST_ASSERT(build_transforms(&t0, &t1, cipher_type, hash_id,
+                                 etm, tag_mode, ver,
+                                 (size_t) cid0_len,
+                                 (size_t) cid1_len) == 0);
 
-    TEST_ASSERT( ( buf = mbedtls_calloc( 1, buflen ) ) != NULL );
+    TEST_ASSERT((buf = mbedtls_calloc(1, buflen)) != NULL);
 
-    for( mode=1; mode <= 3; mode++ )
-    {
+    for (mode = 1; mode <= 3; mode++) {
         seen_success = 0;
-        for( offset=0; offset <= threshold; offset++ )
-        {
+        for (offset = 0; offset <= threshold; offset++) {
             mbedtls_ssl_transform *t_dec, *t_enc;
             t_dec = &t0;
             t_enc = &t1;
 
-            memset( rec.ctr, offset, sizeof( rec.ctr ) );
+            memset(rec.ctr, offset, sizeof(rec.ctr));
             rec.type    = 42;
             rec.ver[0]  = offset;
             rec.ver[1]  = offset;
@@ -3415,8 +3250,7 @@
             rec.cid_len = 0;
 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
 
-            switch( mode )
-            {
+            switch (mode) {
                 case 1: /* Space in the beginning */
                     rec.data_offset = offset;
                     rec.data_len = buflen - offset - default_post_padding;
@@ -3433,85 +3267,82 @@
                     break;
 
                 default:
-                    TEST_ASSERT( 0 );
+                    TEST_ASSERT(0);
                     break;
             }
 
-            memset( rec.buf + rec.data_offset, 42, rec.data_len );
+            memset(rec.buf + rec.data_offset, 42, rec.data_len);
 
             /* Make a copy for later comparison */
             rec_backup = rec;
 
             /* Encrypt record */
-            ret = mbedtls_ssl_encrypt_buf( &ssl, t_enc, &rec,
-                                           mbedtls_test_rnd_std_rand, NULL );
+            ret = mbedtls_ssl_encrypt_buf(&ssl, t_enc, &rec,
+                                          mbedtls_test_rnd_std_rand, NULL);
 
-            if( ( mode == 1 || mode == 2 ) && seen_success )
-            {
-                TEST_ASSERT( ret == 0 );
-            }
-            else
-            {
-                TEST_ASSERT( ret == 0 || ret == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
-                if( ret == 0 )
+            if ((mode == 1 || mode == 2) && seen_success) {
+                TEST_ASSERT(ret == 0);
+            } else {
+                TEST_ASSERT(ret == 0 || ret == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL);
+                if (ret == 0) {
                     seen_success = 1;
+                }
             }
 
-            if( ret != 0 )
+            if (ret != 0) {
                 continue;
+            }
 
 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
-            if( rec.cid_len != 0 )
-            {
+            if (rec.cid_len != 0) {
                 /* DTLS 1.2 + CID hides the real content type and
                  * uses a special CID content type in the protected
                  * record. Double-check this. */
-                TEST_ASSERT( rec.type == MBEDTLS_SSL_MSG_CID );
+                TEST_ASSERT(rec.type == MBEDTLS_SSL_MSG_CID);
             }
 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
 
 #if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL)
-            if( t_enc->minor_ver == MBEDTLS_SSL_MINOR_VERSION_4 )
-            {
+            if (t_enc->minor_ver == MBEDTLS_SSL_MINOR_VERSION_4) {
                 /* TLS 1.3 hides the real content type and
                  * always uses Application Data as the content type
                  * for protected records. Double-check this. */
-                TEST_ASSERT( rec.type == MBEDTLS_SSL_MSG_APPLICATION_DATA );
+                TEST_ASSERT(rec.type == MBEDTLS_SSL_MSG_APPLICATION_DATA);
             }
 #endif /* MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
 
             /* Decrypt record with t_dec */
-            TEST_ASSERT( mbedtls_ssl_decrypt_buf( &ssl, t_dec, &rec ) == 0 );
+            TEST_ASSERT(mbedtls_ssl_decrypt_buf(&ssl, t_dec, &rec) == 0);
 
             /* Compare results */
-            TEST_ASSERT( rec.type == rec_backup.type );
-            TEST_ASSERT( memcmp( rec.ctr, rec_backup.ctr, 8 ) == 0 );
-            TEST_ASSERT( rec.ver[0] == rec_backup.ver[0] );
-            TEST_ASSERT( rec.ver[1] == rec_backup.ver[1] );
-            TEST_ASSERT( rec.data_len == rec_backup.data_len );
-            TEST_ASSERT( rec.data_offset == rec_backup.data_offset );
-            TEST_ASSERT( memcmp( rec.buf + rec.data_offset,
-                                 rec_backup.buf + rec_backup.data_offset,
-                                 rec.data_len ) == 0 );
+            TEST_ASSERT(rec.type == rec_backup.type);
+            TEST_ASSERT(memcmp(rec.ctr, rec_backup.ctr, 8) == 0);
+            TEST_ASSERT(rec.ver[0] == rec_backup.ver[0]);
+            TEST_ASSERT(rec.ver[1] == rec_backup.ver[1]);
+            TEST_ASSERT(rec.data_len == rec_backup.data_len);
+            TEST_ASSERT(rec.data_offset == rec_backup.data_offset);
+            TEST_ASSERT(memcmp(rec.buf + rec.data_offset,
+                               rec_backup.buf + rec_backup.data_offset,
+                               rec.data_len) == 0);
         }
 
-        TEST_ASSERT( seen_success == 1 );
+        TEST_ASSERT(seen_success == 1);
     }
 
 exit:
 
     /* Cleanup */
-    mbedtls_ssl_free( &ssl );
-    mbedtls_ssl_transform_free( &t0 );
-    mbedtls_ssl_transform_free( &t1 );
+    mbedtls_ssl_free(&ssl);
+    mbedtls_ssl_transform_free(&t0);
+    mbedtls_ssl_transform_free(&t1);
 
-    mbedtls_free( buf );
+    mbedtls_free(buf);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_AES_C:MBEDTLS_SSL_PROTO_TLS1_2 */
-void ssl_decrypt_non_etm_cbc( int cipher_type, int hash_id, int trunc_hmac,
-                              int length_selector )
+void ssl_decrypt_non_etm_cbc(int cipher_type, int hash_id, int trunc_hmac,
+                             int length_selector)
 {
     /*
      * Test record decryption for CBC without EtM, focused on the verification
@@ -3542,50 +3373,48 @@
     int exp_ret;
     const unsigned char pad_max_len = 255; /* Per the standard */
 
-    mbedtls_ssl_init( &ssl );
-    mbedtls_ssl_transform_init( &t0 );
-    mbedtls_ssl_transform_init( &t1 );
+    mbedtls_ssl_init(&ssl);
+    mbedtls_ssl_transform_init(&t0);
+    mbedtls_ssl_transform_init(&t1);
 
     /* Set up transforms with dummy keys */
-    TEST_ASSERT( build_transforms( &t0, &t1, cipher_type, hash_id,
-                                   0, trunc_hmac,
-                                   MBEDTLS_SSL_MINOR_VERSION_3,
-                                   0 , 0 ) == 0 );
+    TEST_ASSERT(build_transforms(&t0, &t1, cipher_type, hash_id,
+                                 0, trunc_hmac,
+                                 MBEDTLS_SSL_MINOR_VERSION_3,
+                                 0, 0) == 0);
 
     /* Determine padding/plaintext length */
-    TEST_ASSERT( length_selector >= -2 && length_selector <= 255 );
+    TEST_ASSERT(length_selector >= -2 && length_selector <= 255);
     block_size = t0.ivlen;
-    if( length_selector < 0 )
-    {
+    if (length_selector < 0) {
         plaintext_len = 0;
 
         /* Minimal padding
          * The +1 is for the padding_length byte, not counted in padlen. */
-        padlen = block_size - ( t0.maclen + 1 ) % block_size;
+        padlen = block_size - (t0.maclen + 1) % block_size;
 
         /* Maximal padding? */
-        if( length_selector == -2 )
-            padlen += block_size * ( ( pad_max_len - padlen ) / block_size );
-    }
-    else
-    {
+        if (length_selector == -2) {
+            padlen += block_size * ((pad_max_len - padlen) / block_size);
+        }
+    } else {
         padlen = length_selector;
 
         /* Minimal non-zero plaintext_length giving desired padding.
          * The +1 is for the padding_length byte, not counted in padlen. */
-        plaintext_len = block_size - ( padlen + t0.maclen + 1 ) % block_size;
+        plaintext_len = block_size - (padlen + t0.maclen + 1) % block_size;
     }
 
     /* Prepare a buffer for record data */
     buflen = block_size
-           + plaintext_len
-           + t0.maclen
-           + padlen + 1;
-    ASSERT_ALLOC( buf, buflen );
-    ASSERT_ALLOC( buf_save, buflen );
+             + plaintext_len
+             + t0.maclen
+             + padlen + 1;
+    ASSERT_ALLOC(buf, buflen);
+    ASSERT_ALLOC(buf_save, buflen);
 
     /* Prepare a dummy record header */
-    memset( rec.ctr, 0, sizeof( rec.ctr ) );
+    memset(rec.ctr, 0, sizeof(rec.ctr));
     rec.type    = MBEDTLS_SSL_MSG_APPLICATION_DATA;
     rec.ver[0]  = MBEDTLS_SSL_MAJOR_VERSION_3;
     rec.ver[1]  = MBEDTLS_SSL_MINOR_VERSION_3;
@@ -3598,82 +3427,81 @@
     rec.buf_len = buflen;
     rec.data_offset = block_size;
     rec.data_len = plaintext_len;
-    memset( rec.buf + rec.data_offset, 42, rec.data_len );
+    memset(rec.buf + rec.data_offset, 42, rec.data_len);
 
     /* Serialized version of record header for MAC purposes */
-    memcpy( add_data, rec.ctr, 8 );
+    memcpy(add_data, rec.ctr, 8);
     add_data[8] = rec.type;
     add_data[9] = rec.ver[0];
     add_data[10] = rec.ver[1];
-    add_data[11] = ( rec.data_len >> 8 ) & 0xff;
-    add_data[12] = ( rec.data_len >> 0 ) & 0xff;
+    add_data[11] = (rec.data_len >> 8) & 0xff;
+    add_data[12] = (rec.data_len >> 0) & 0xff;
 
     /* Set dummy IV */
-    memset( t0.iv_enc, 0x55, t0.ivlen );
-    memcpy( rec.buf, t0.iv_enc, t0.ivlen );
+    memset(t0.iv_enc, 0x55, t0.ivlen);
+    memcpy(rec.buf, t0.iv_enc, t0.ivlen);
 
     /*
      * Prepare a pre-encryption record (with MAC and padding), and save it.
      */
 
     /* MAC with additional data */
-    TEST_EQUAL( 0, mbedtls_md_hmac_update( &t0.md_ctx_enc, add_data, 13 ) );
-    TEST_EQUAL( 0, mbedtls_md_hmac_update( &t0.md_ctx_enc,
-                                           rec.buf + rec.data_offset,
-                                           rec.data_len ) );
-    TEST_EQUAL( 0, mbedtls_md_hmac_finish( &t0.md_ctx_enc, mac ) );
+    TEST_EQUAL(0, mbedtls_md_hmac_update(&t0.md_ctx_enc, add_data, 13));
+    TEST_EQUAL(0, mbedtls_md_hmac_update(&t0.md_ctx_enc,
+                                         rec.buf + rec.data_offset,
+                                         rec.data_len));
+    TEST_EQUAL(0, mbedtls_md_hmac_finish(&t0.md_ctx_enc, mac));
 
-    memcpy( rec.buf + rec.data_offset + rec.data_len, mac, t0.maclen );
+    memcpy(rec.buf + rec.data_offset + rec.data_len, mac, t0.maclen);
     rec.data_len += t0.maclen;
 
     /* Pad */
-    memset( rec.buf + rec.data_offset + rec.data_len, padlen, padlen + 1 );
+    memset(rec.buf + rec.data_offset + rec.data_len, padlen, padlen + 1);
     rec.data_len += padlen + 1;
 
     /* Save correct pre-encryption record */
     rec_save = rec;
     rec_save.buf = buf_save;
-    memcpy( buf_save, buf, buflen );
+    memcpy(buf_save, buf, buflen);
 
     /*
      * Encrypt and decrypt the correct record, expecting success
      */
-    TEST_EQUAL( 0, mbedtls_cipher_crypt( &t0.cipher_ctx_enc,
-                                  t0.iv_enc, t0.ivlen,
-                                  rec.buf + rec.data_offset, rec.data_len,
-                                  rec.buf + rec.data_offset, &olen ) );
+    TEST_EQUAL(0, mbedtls_cipher_crypt(&t0.cipher_ctx_enc,
+                                       t0.iv_enc, t0.ivlen,
+                                       rec.buf + rec.data_offset, rec.data_len,
+                                       rec.buf + rec.data_offset, &olen));
     rec.data_offset -= t0.ivlen;
     rec.data_len    += t0.ivlen;
 
-    TEST_EQUAL( 0, mbedtls_ssl_decrypt_buf( &ssl, &t1, &rec ) );
+    TEST_EQUAL(0, mbedtls_ssl_decrypt_buf(&ssl, &t1, &rec));
 
     /*
      * Modify each byte of the pre-encryption record before encrypting and
      * decrypting it, expecting failure every time.
      */
-    for( i = block_size; i < buflen; i++ )
-    {
-        mbedtls_test_set_step( i );
+    for (i = block_size; i < buflen; i++) {
+        mbedtls_test_set_step(i);
 
         /* Restore correct pre-encryption record */
         rec = rec_save;
         rec.buf = buf;
-        memcpy( buf, buf_save, buflen );
+        memcpy(buf, buf_save, buflen);
 
         /* Corrupt one byte of the data (could be plaintext, MAC or padding) */
         rec.buf[i] ^= 0x01;
 
         /* Encrypt */
-        TEST_EQUAL( 0, mbedtls_cipher_crypt( &t0.cipher_ctx_enc,
-                                      t0.iv_enc, t0.ivlen,
-                                      rec.buf + rec.data_offset, rec.data_len,
-                                      rec.buf + rec.data_offset, &olen ) );
+        TEST_EQUAL(0, mbedtls_cipher_crypt(&t0.cipher_ctx_enc,
+                                           t0.iv_enc, t0.ivlen,
+                                           rec.buf + rec.data_offset, rec.data_len,
+                                           rec.buf + rec.data_offset, &olen));
         rec.data_offset -= t0.ivlen;
         rec.data_len    += t0.ivlen;
 
         /* Decrypt and expect failure */
-        TEST_EQUAL( MBEDTLS_ERR_SSL_INVALID_MAC,
-                    mbedtls_ssl_decrypt_buf( &ssl, &t1, &rec ) );
+        TEST_EQUAL(MBEDTLS_ERR_SSL_INVALID_MAC,
+                   mbedtls_ssl_decrypt_buf(&ssl, &t1, &rec));
     }
 
     /*
@@ -3688,214 +3516,213 @@
      * (Start the loop with correct padding, just to double-check that record
      * saving did work, and that we're overwriting the correct bytes.)
      */
-    for( i = padlen; i <= pad_max_len; i++ )
-    {
-        mbedtls_test_set_step( i );
+    for (i = padlen; i <= pad_max_len; i++) {
+        mbedtls_test_set_step(i);
 
         /* Restore correct pre-encryption record */
         rec = rec_save;
         rec.buf = buf;
-        memcpy( buf, buf_save, buflen );
+        memcpy(buf, buf_save, buflen);
 
         /* Set padding bytes to new value */
-        memset( buf + buflen - padlen - 1, i, padlen + 1 );
+        memset(buf + buflen - padlen - 1, i, padlen + 1);
 
         /* Encrypt */
-        TEST_EQUAL( 0, mbedtls_cipher_crypt( &t0.cipher_ctx_enc,
-                                      t0.iv_enc, t0.ivlen,
-                                      rec.buf + rec.data_offset, rec.data_len,
-                                      rec.buf + rec.data_offset, &olen ) );
+        TEST_EQUAL(0, mbedtls_cipher_crypt(&t0.cipher_ctx_enc,
+                                           t0.iv_enc, t0.ivlen,
+                                           rec.buf + rec.data_offset, rec.data_len,
+                                           rec.buf + rec.data_offset, &olen));
         rec.data_offset -= t0.ivlen;
         rec.data_len    += t0.ivlen;
 
         /* Decrypt and expect failure except the first time */
-        exp_ret = ( i == padlen ) ? 0 : MBEDTLS_ERR_SSL_INVALID_MAC;
-        TEST_EQUAL( exp_ret, mbedtls_ssl_decrypt_buf( &ssl, &t1, &rec ) );
+        exp_ret = (i == padlen) ? 0 : MBEDTLS_ERR_SSL_INVALID_MAC;
+        TEST_EQUAL(exp_ret, mbedtls_ssl_decrypt_buf(&ssl, &t1, &rec));
     }
 
 exit:
-    mbedtls_ssl_free( &ssl );
-    mbedtls_ssl_transform_free( &t0 );
-    mbedtls_ssl_transform_free( &t1 );
-    mbedtls_free( buf );
-    mbedtls_free( buf_save );
+    mbedtls_ssl_free(&ssl);
+    mbedtls_ssl_transform_free(&t0);
+    mbedtls_ssl_transform_free(&t1);
+    mbedtls_free(buf);
+    mbedtls_free(buf_save);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
-void ssl_tls1_3_hkdf_expand_label( int hash_alg,
-                                   data_t *secret,
-                                   int label_idx,
-                                   data_t *ctx,
-                                   int desired_length,
-                                   data_t *expected )
+void ssl_tls1_3_hkdf_expand_label(int hash_alg,
+                                  data_t *secret,
+                                  int label_idx,
+                                  data_t *ctx,
+                                  int desired_length,
+                                  data_t *expected)
 {
-    unsigned char dst[ 100 ];
+    unsigned char dst[100];
 
     unsigned char const *lbl = NULL;
     size_t lbl_len;
-#define MBEDTLS_SSL_TLS1_3_LABEL( name, string )                        \
-    if( label_idx == (int) tls1_3_label_ ## name )                      \
+#define MBEDTLS_SSL_TLS1_3_LABEL(name, string)                        \
+    if (label_idx == (int) tls1_3_label_ ## name)                      \
     {                                                                   \
         lbl = mbedtls_ssl_tls1_3_labels.name;                           \
-        lbl_len = sizeof( mbedtls_ssl_tls1_3_labels.name );             \
+        lbl_len = sizeof(mbedtls_ssl_tls1_3_labels.name);             \
     }
-MBEDTLS_SSL_TLS1_3_LABEL_LIST
+    MBEDTLS_SSL_TLS1_3_LABEL_LIST
 #undef MBEDTLS_SSL_TLS1_3_LABEL
-    TEST_ASSERT( lbl != NULL );
+    TEST_ASSERT(lbl != NULL);
 
     /* Check sanity of test parameters. */
-    TEST_ASSERT( (size_t) desired_length <= sizeof( dst ) );
-    TEST_ASSERT( (size_t) desired_length == expected->len );
+    TEST_ASSERT((size_t) desired_length <= sizeof(dst));
+    TEST_ASSERT((size_t) desired_length == expected->len);
 
-    TEST_ASSERT( mbedtls_ssl_tls1_3_hkdf_expand_label(
-                      (mbedtls_md_type_t) hash_alg,
-                      secret->x, secret->len,
-                      lbl, lbl_len,
-                      ctx->x, ctx->len,
-                      dst, desired_length ) == 0 );
+    TEST_ASSERT(mbedtls_ssl_tls1_3_hkdf_expand_label(
+                    (mbedtls_md_type_t) hash_alg,
+                    secret->x, secret->len,
+                    lbl, lbl_len,
+                    ctx->x, ctx->len,
+                    dst, desired_length) == 0);
 
-    ASSERT_COMPARE( dst, (size_t) desired_length,
-                    expected->x, (size_t) expected->len );
+    ASSERT_COMPARE(dst, (size_t) desired_length,
+                   expected->x, (size_t) expected->len);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
-void ssl_tls1_3_traffic_key_generation( int hash_alg,
-                                        data_t *server_secret,
-                                        data_t *client_secret,
-                                        int desired_iv_len,
-                                        int desired_key_len,
-                                        data_t *expected_server_write_key,
-                                        data_t *expected_server_write_iv,
-                                        data_t *expected_client_write_key,
-                                        data_t *expected_client_write_iv )
+void ssl_tls1_3_traffic_key_generation(int hash_alg,
+                                       data_t *server_secret,
+                                       data_t *client_secret,
+                                       int desired_iv_len,
+                                       int desired_key_len,
+                                       data_t *expected_server_write_key,
+                                       data_t *expected_server_write_iv,
+                                       data_t *expected_client_write_key,
+                                       data_t *expected_client_write_iv)
 {
     mbedtls_ssl_key_set keys;
 
     /* Check sanity of test parameters. */
-    TEST_ASSERT( client_secret->len == server_secret->len );
-    TEST_ASSERT( expected_client_write_iv->len == expected_server_write_iv->len &&
-                 expected_client_write_iv->len == (size_t) desired_iv_len );
-    TEST_ASSERT( expected_client_write_key->len == expected_server_write_key->len &&
-                 expected_client_write_key->len == (size_t) desired_key_len );
+    TEST_ASSERT(client_secret->len == server_secret->len);
+    TEST_ASSERT(expected_client_write_iv->len == expected_server_write_iv->len &&
+                expected_client_write_iv->len == (size_t) desired_iv_len);
+    TEST_ASSERT(expected_client_write_key->len == expected_server_write_key->len &&
+                expected_client_write_key->len == (size_t) desired_key_len);
 
-    TEST_ASSERT( mbedtls_ssl_tls1_3_make_traffic_keys(
-                     (mbedtls_md_type_t) hash_alg,
-                     client_secret->x,
-                     server_secret->x,
-                     client_secret->len /* == server_secret->len */,
-                     desired_key_len, desired_iv_len,
-                     &keys ) == 0 );
+    TEST_ASSERT(mbedtls_ssl_tls1_3_make_traffic_keys(
+                    (mbedtls_md_type_t) hash_alg,
+                    client_secret->x,
+                    server_secret->x,
+                    client_secret->len /* == server_secret->len */,
+                    desired_key_len, desired_iv_len,
+                    &keys) == 0);
 
-    ASSERT_COMPARE( keys.client_write_key,
-                    keys.key_len,
-                    expected_client_write_key->x,
-                    (size_t) desired_key_len );
-    ASSERT_COMPARE( keys.server_write_key,
-                    keys.key_len,
-                    expected_server_write_key->x,
-                    (size_t) desired_key_len );
-    ASSERT_COMPARE( keys.client_write_iv,
-                    keys.iv_len,
-                    expected_client_write_iv->x,
-                    (size_t) desired_iv_len );
-    ASSERT_COMPARE( keys.server_write_iv,
-                    keys.iv_len,
-                    expected_server_write_iv->x,
-                    (size_t) desired_iv_len );
+    ASSERT_COMPARE(keys.client_write_key,
+                   keys.key_len,
+                   expected_client_write_key->x,
+                   (size_t) desired_key_len);
+    ASSERT_COMPARE(keys.server_write_key,
+                   keys.key_len,
+                   expected_server_write_key->x,
+                   (size_t) desired_key_len);
+    ASSERT_COMPARE(keys.client_write_iv,
+                   keys.iv_len,
+                   expected_client_write_iv->x,
+                   (size_t) desired_iv_len);
+    ASSERT_COMPARE(keys.server_write_iv,
+                   keys.iv_len,
+                   expected_server_write_iv->x,
+                   (size_t) desired_iv_len);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
-void ssl_tls1_3_derive_secret( int hash_alg,
-                               data_t *secret,
-                               int label_idx,
-                               data_t *ctx,
-                               int desired_length,
-                               int already_hashed,
-                               data_t *expected )
+void ssl_tls1_3_derive_secret(int hash_alg,
+                              data_t *secret,
+                              int label_idx,
+                              data_t *ctx,
+                              int desired_length,
+                              int already_hashed,
+                              data_t *expected)
 {
-    unsigned char dst[ 100 ];
+    unsigned char dst[100];
 
     unsigned char const *lbl = NULL;
     size_t lbl_len;
-#define MBEDTLS_SSL_TLS1_3_LABEL( name, string )                        \
-    if( label_idx == (int) tls1_3_label_ ## name )                      \
+#define MBEDTLS_SSL_TLS1_3_LABEL(name, string)                        \
+    if (label_idx == (int) tls1_3_label_ ## name)                      \
     {                                                                   \
         lbl = mbedtls_ssl_tls1_3_labels.name;                           \
-        lbl_len = sizeof( mbedtls_ssl_tls1_3_labels.name );             \
+        lbl_len = sizeof(mbedtls_ssl_tls1_3_labels.name);             \
     }
-MBEDTLS_SSL_TLS1_3_LABEL_LIST
+    MBEDTLS_SSL_TLS1_3_LABEL_LIST
 #undef MBEDTLS_SSL_TLS1_3_LABEL
-    TEST_ASSERT( lbl != NULL );
+    TEST_ASSERT(lbl != NULL);
 
     /* Check sanity of test parameters. */
-    TEST_ASSERT( (size_t) desired_length <= sizeof( dst ) );
-    TEST_ASSERT( (size_t) desired_length == expected->len );
+    TEST_ASSERT((size_t) desired_length <= sizeof(dst));
+    TEST_ASSERT((size_t) desired_length == expected->len);
 
-    TEST_ASSERT( mbedtls_ssl_tls1_3_derive_secret(
-                      (mbedtls_md_type_t) hash_alg,
-                      secret->x, secret->len,
-                      lbl, lbl_len,
-                      ctx->x, ctx->len,
-                      already_hashed,
-                      dst, desired_length ) == 0 );
+    TEST_ASSERT(mbedtls_ssl_tls1_3_derive_secret(
+                    (mbedtls_md_type_t) hash_alg,
+                    secret->x, secret->len,
+                    lbl, lbl_len,
+                    ctx->x, ctx->len,
+                    already_hashed,
+                    dst, desired_length) == 0);
 
-    ASSERT_COMPARE( dst, desired_length,
-                    expected->x, desired_length );
+    ASSERT_COMPARE(dst, desired_length,
+                   expected->x, desired_length);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
-void ssl_tls1_3_key_evolution( int hash_alg,
-                               data_t *secret,
-                               data_t *input,
-                               data_t *expected )
+void ssl_tls1_3_key_evolution(int hash_alg,
+                              data_t *secret,
+                              data_t *input,
+                              data_t *expected)
 {
-    unsigned char secret_new[ MBEDTLS_MD_MAX_SIZE ];
+    unsigned char secret_new[MBEDTLS_MD_MAX_SIZE];
 
-    TEST_ASSERT( mbedtls_ssl_tls1_3_evolve_secret(
-                      (mbedtls_md_type_t) hash_alg,
-                      secret->len ? secret->x : NULL,
-                      input->len ? input->x : NULL, input->len,
-                      secret_new ) == 0 );
+    TEST_ASSERT(mbedtls_ssl_tls1_3_evolve_secret(
+                    (mbedtls_md_type_t) hash_alg,
+                    secret->len ? secret->x : NULL,
+                    input->len ? input->x : NULL, input->len,
+                    secret_new) == 0);
 
-    ASSERT_COMPARE( secret_new, (size_t) expected->len,
-                    expected->x, (size_t) expected->len );
+    ASSERT_COMPARE(secret_new, (size_t) expected->len,
+                   expected->x, (size_t) expected->len);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_tls_prf( int type, data_t * secret, data_t * random,
-                  char *label, data_t *result_str, int exp_ret )
+void ssl_tls_prf(int type, data_t *secret, data_t *random,
+                 char *label, data_t *result_str, int exp_ret)
 {
     unsigned char *output;
 
-    output = mbedtls_calloc( 1, result_str->len );
-    if( output == NULL )
+    output = mbedtls_calloc(1, result_str->len);
+    if (output == NULL) {
         goto exit;
+    }
 
-    USE_PSA_INIT( );
+    USE_PSA_INIT();
 
-    TEST_ASSERT( mbedtls_ssl_tls_prf( type, secret->x, secret->len,
-                                      label, random->x, random->len,
-                                      output, result_str->len ) == exp_ret );
+    TEST_ASSERT(mbedtls_ssl_tls_prf(type, secret->x, secret->len,
+                                    label, random->x, random->len,
+                                    output, result_str->len) == exp_ret);
 
-    if( exp_ret == 0 )
-    {
-        TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                     result_str->len, result_str->len ) == 0 );
+    if (exp_ret == 0) {
+        TEST_ASSERT(mbedtls_test_hexcmp(output, result_str->x,
+                                        result_str->len, result_str->len) == 0);
     }
 exit:
 
-    mbedtls_free( output );
-    USE_PSA_DONE( );
+    mbedtls_free(output);
+    USE_PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_serialize_session_save_load( int ticket_len, char *crt_file )
+void ssl_serialize_session_save_load(int ticket_len, char *crt_file)
 {
     mbedtls_ssl_session original, restored;
     unsigned char *buf = NULL;
@@ -3905,98 +3732,95 @@
      * Test that a save-load pair is the identity
      */
 
-    mbedtls_ssl_session_init( &original );
-    mbedtls_ssl_session_init( &restored );
+    mbedtls_ssl_session_init(&original);
+    mbedtls_ssl_session_init(&restored);
 
     /* Prepare a dummy session to work on */
-    TEST_ASSERT( ssl_populate_session( &original, ticket_len, crt_file ) == 0 );
+    TEST_ASSERT(ssl_populate_session(&original, ticket_len, crt_file) == 0);
 
     /* Serialize it */
-    TEST_ASSERT( mbedtls_ssl_session_save( &original, NULL, 0, &len )
-                 == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
-    TEST_ASSERT( ( buf = mbedtls_calloc( 1, len ) ) != NULL );
-    TEST_ASSERT( mbedtls_ssl_session_save( &original, buf, len, &len )
-                 == 0 );
+    TEST_ASSERT(mbedtls_ssl_session_save(&original, NULL, 0, &len)
+                == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL);
+    TEST_ASSERT((buf = mbedtls_calloc(1, len)) != NULL);
+    TEST_ASSERT(mbedtls_ssl_session_save(&original, buf, len, &len)
+                == 0);
 
     /* Restore session from serialized data */
-    TEST_ASSERT( mbedtls_ssl_session_load( &restored, buf, len) == 0 );
+    TEST_ASSERT(mbedtls_ssl_session_load(&restored, buf, len) == 0);
 
     /*
      * Make sure both session structures are identical
      */
 #if defined(MBEDTLS_HAVE_TIME)
-    TEST_ASSERT( original.start == restored.start );
+    TEST_ASSERT(original.start == restored.start);
 #endif
-    TEST_ASSERT( original.ciphersuite == restored.ciphersuite );
-    TEST_ASSERT( original.compression == restored.compression );
-    TEST_ASSERT( original.id_len == restored.id_len );
-    TEST_ASSERT( memcmp( original.id,
-                         restored.id, sizeof( original.id ) ) == 0 );
-    TEST_ASSERT( memcmp( original.master,
-                         restored.master, sizeof( original.master ) ) == 0 );
+    TEST_ASSERT(original.ciphersuite == restored.ciphersuite);
+    TEST_ASSERT(original.compression == restored.compression);
+    TEST_ASSERT(original.id_len == restored.id_len);
+    TEST_ASSERT(memcmp(original.id,
+                       restored.id, sizeof(original.id)) == 0);
+    TEST_ASSERT(memcmp(original.master,
+                       restored.master, sizeof(original.master)) == 0);
 
 #if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
 #if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
-    TEST_ASSERT( ( original.peer_cert == NULL ) ==
-                 ( restored.peer_cert == NULL ) );
-    if( original.peer_cert != NULL )
-    {
-        TEST_ASSERT( original.peer_cert->raw.len ==
-                     restored.peer_cert->raw.len );
-        TEST_ASSERT( memcmp( original.peer_cert->raw.p,
-                             restored.peer_cert->raw.p,
-                             original.peer_cert->raw.len ) == 0 );
+    TEST_ASSERT((original.peer_cert == NULL) ==
+                (restored.peer_cert == NULL));
+    if (original.peer_cert != NULL) {
+        TEST_ASSERT(original.peer_cert->raw.len ==
+                    restored.peer_cert->raw.len);
+        TEST_ASSERT(memcmp(original.peer_cert->raw.p,
+                           restored.peer_cert->raw.p,
+                           original.peer_cert->raw.len) == 0);
     }
 #else /* MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
-    TEST_ASSERT( original.peer_cert_digest_type ==
-                 restored.peer_cert_digest_type );
-    TEST_ASSERT( original.peer_cert_digest_len ==
-                 restored.peer_cert_digest_len );
-    TEST_ASSERT( ( original.peer_cert_digest == NULL ) ==
-                 ( restored.peer_cert_digest == NULL ) );
-    if( original.peer_cert_digest != NULL )
-    {
-        TEST_ASSERT( memcmp( original.peer_cert_digest,
-                             restored.peer_cert_digest,
-                             original.peer_cert_digest_len ) == 0 );
+    TEST_ASSERT(original.peer_cert_digest_type ==
+                restored.peer_cert_digest_type);
+    TEST_ASSERT(original.peer_cert_digest_len ==
+                restored.peer_cert_digest_len);
+    TEST_ASSERT((original.peer_cert_digest == NULL) ==
+                (restored.peer_cert_digest == NULL));
+    if (original.peer_cert_digest != NULL) {
+        TEST_ASSERT(memcmp(original.peer_cert_digest,
+                           restored.peer_cert_digest,
+                           original.peer_cert_digest_len) == 0);
     }
 #endif /* MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
 #endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */
-    TEST_ASSERT( original.verify_result == restored.verify_result );
+    TEST_ASSERT(original.verify_result == restored.verify_result);
 
 #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
-    TEST_ASSERT( original.ticket_len == restored.ticket_len );
-    if( original.ticket_len != 0 )
-    {
-        TEST_ASSERT( original.ticket != NULL );
-        TEST_ASSERT( restored.ticket != NULL );
-        TEST_ASSERT( memcmp( original.ticket,
-                             restored.ticket, original.ticket_len ) == 0 );
+    TEST_ASSERT(original.ticket_len == restored.ticket_len);
+    if (original.ticket_len != 0) {
+        TEST_ASSERT(original.ticket != NULL);
+        TEST_ASSERT(restored.ticket != NULL);
+        TEST_ASSERT(memcmp(original.ticket,
+                           restored.ticket, original.ticket_len) == 0);
     }
-    TEST_ASSERT( original.ticket_lifetime == restored.ticket_lifetime );
+    TEST_ASSERT(original.ticket_lifetime == restored.ticket_lifetime);
 #endif
 
 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
-    TEST_ASSERT( original.mfl_code == restored.mfl_code );
+    TEST_ASSERT(original.mfl_code == restored.mfl_code);
 #endif
 
 #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
-    TEST_ASSERT( original.trunc_hmac == restored.trunc_hmac );
+    TEST_ASSERT(original.trunc_hmac == restored.trunc_hmac);
 #endif
 
 #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
-    TEST_ASSERT( original.encrypt_then_mac == restored.encrypt_then_mac );
+    TEST_ASSERT(original.encrypt_then_mac == restored.encrypt_then_mac);
 #endif
 
 exit:
-    mbedtls_ssl_session_free( &original );
-    mbedtls_ssl_session_free( &restored );
-    mbedtls_free( buf );
+    mbedtls_ssl_session_free(&original);
+    mbedtls_ssl_session_free(&restored);
+    mbedtls_free(buf);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_serialize_session_load_save( int ticket_len, char *crt_file )
+void ssl_serialize_session_load_save(int ticket_len, char *crt_file)
 {
     mbedtls_ssl_session session;
     unsigned char *buf1 = NULL, *buf2 = NULL;
@@ -4006,47 +3830,47 @@
      * Test that a load-save pair is the identity
      */
 
-    mbedtls_ssl_session_init( &session );
+    mbedtls_ssl_session_init(&session);
 
     /* Prepare a dummy session to work on */
-    TEST_ASSERT( ssl_populate_session( &session, ticket_len, crt_file ) == 0 );
+    TEST_ASSERT(ssl_populate_session(&session, ticket_len, crt_file) == 0);
 
     /* Get desired buffer size for serializing */
-    TEST_ASSERT( mbedtls_ssl_session_save( &session, NULL, 0, &len0 )
-                 == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
+    TEST_ASSERT(mbedtls_ssl_session_save(&session, NULL, 0, &len0)
+                == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL);
 
     /* Allocate first buffer */
-    buf1 = mbedtls_calloc( 1, len0 );
-    TEST_ASSERT( buf1 != NULL );
+    buf1 = mbedtls_calloc(1, len0);
+    TEST_ASSERT(buf1 != NULL);
 
     /* Serialize to buffer and free live session */
-    TEST_ASSERT( mbedtls_ssl_session_save( &session, buf1, len0, &len1 )
-                 == 0 );
-    TEST_ASSERT( len0 == len1 );
-    mbedtls_ssl_session_free( &session );
+    TEST_ASSERT(mbedtls_ssl_session_save(&session, buf1, len0, &len1)
+                == 0);
+    TEST_ASSERT(len0 == len1);
+    mbedtls_ssl_session_free(&session);
 
     /* Restore session from serialized data */
-    TEST_ASSERT( mbedtls_ssl_session_load( &session, buf1, len1 ) == 0 );
+    TEST_ASSERT(mbedtls_ssl_session_load(&session, buf1, len1) == 0);
 
     /* Allocate second buffer and serialize to it */
-    buf2 = mbedtls_calloc( 1, len0 );
-    TEST_ASSERT( buf2 != NULL );
-    TEST_ASSERT( mbedtls_ssl_session_save( &session, buf2, len0, &len2 )
-                 == 0 );
+    buf2 = mbedtls_calloc(1, len0);
+    TEST_ASSERT(buf2 != NULL);
+    TEST_ASSERT(mbedtls_ssl_session_save(&session, buf2, len0, &len2)
+                == 0);
 
     /* Make sure both serialized versions are identical */
-    TEST_ASSERT( len1 == len2 );
-    TEST_ASSERT( memcmp( buf1, buf2, len1 ) == 0 );
+    TEST_ASSERT(len1 == len2);
+    TEST_ASSERT(memcmp(buf1, buf2, len1) == 0);
 
 exit:
-    mbedtls_ssl_session_free( &session );
-    mbedtls_free( buf1 );
-    mbedtls_free( buf2 );
+    mbedtls_ssl_session_free(&session);
+    mbedtls_free(buf1);
+    mbedtls_free(buf2);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_serialize_session_save_buf_size( int ticket_len, char *crt_file )
+void ssl_serialize_session_save_buf_size(int ticket_len, char *crt_file)
 {
     mbedtls_ssl_session session;
     unsigned char *buf = NULL;
@@ -4056,33 +3880,32 @@
      * Test that session_save() fails cleanly on small buffers
      */
 
-    mbedtls_ssl_session_init( &session );
+    mbedtls_ssl_session_init(&session);
 
     /* Prepare dummy session and get serialized size */
-    TEST_ASSERT( ssl_populate_session( &session, ticket_len, crt_file ) == 0 );
-    TEST_ASSERT( mbedtls_ssl_session_save( &session, NULL, 0, &good_len )
-                 == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
+    TEST_ASSERT(ssl_populate_session(&session, ticket_len, crt_file) == 0);
+    TEST_ASSERT(mbedtls_ssl_session_save(&session, NULL, 0, &good_len)
+                == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL);
 
     /* Try all possible bad lengths */
-    for( bad_len = 1; bad_len < good_len; bad_len++ )
-    {
+    for (bad_len = 1; bad_len < good_len; bad_len++) {
         /* Allocate exact size so that asan/valgrind can detect any overwrite */
-        mbedtls_free( buf );
-        TEST_ASSERT( ( buf = mbedtls_calloc( 1, bad_len ) ) != NULL );
-        TEST_ASSERT( mbedtls_ssl_session_save( &session, buf, bad_len,
-                                               &test_len )
-                     == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
-        TEST_ASSERT( test_len == good_len );
+        mbedtls_free(buf);
+        TEST_ASSERT((buf = mbedtls_calloc(1, bad_len)) != NULL);
+        TEST_ASSERT(mbedtls_ssl_session_save(&session, buf, bad_len,
+                                             &test_len)
+                    == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL);
+        TEST_ASSERT(test_len == good_len);
     }
 
 exit:
-    mbedtls_ssl_session_free( &session );
-    mbedtls_free( buf );
+    mbedtls_ssl_session_free(&session);
+    mbedtls_free(buf);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_serialize_session_load_buf_size( int ticket_len, char *crt_file )
+void ssl_serialize_session_load_buf_size(int ticket_len, char *crt_file)
 {
     mbedtls_ssl_session session;
     unsigned char *good_buf = NULL, *bad_buf = NULL;
@@ -4092,44 +3915,43 @@
      * Test that session_load() fails cleanly on small buffers
      */
 
-    mbedtls_ssl_session_init( &session );
+    mbedtls_ssl_session_init(&session);
 
     /* Prepare serialized session data */
-    TEST_ASSERT( ssl_populate_session( &session, ticket_len, crt_file ) == 0 );
-    TEST_ASSERT( mbedtls_ssl_session_save( &session, NULL, 0, &good_len )
-                 == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
-    TEST_ASSERT( ( good_buf = mbedtls_calloc( 1, good_len ) ) != NULL );
-    TEST_ASSERT( mbedtls_ssl_session_save( &session, good_buf, good_len,
-                                           &good_len ) == 0 );
-    mbedtls_ssl_session_free( &session );
+    TEST_ASSERT(ssl_populate_session(&session, ticket_len, crt_file) == 0);
+    TEST_ASSERT(mbedtls_ssl_session_save(&session, NULL, 0, &good_len)
+                == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL);
+    TEST_ASSERT((good_buf = mbedtls_calloc(1, good_len)) != NULL);
+    TEST_ASSERT(mbedtls_ssl_session_save(&session, good_buf, good_len,
+                                         &good_len) == 0);
+    mbedtls_ssl_session_free(&session);
 
     /* Try all possible bad lengths */
-    for( bad_len = 0; bad_len < good_len; bad_len++ )
-    {
+    for (bad_len = 0; bad_len < good_len; bad_len++) {
         /* Allocate exact size so that asan/valgrind can detect any overread */
-        mbedtls_free( bad_buf );
-        bad_buf = mbedtls_calloc( 1, bad_len ? bad_len : 1 );
-        TEST_ASSERT( bad_buf != NULL );
-        memcpy( bad_buf, good_buf, bad_len );
+        mbedtls_free(bad_buf);
+        bad_buf = mbedtls_calloc(1, bad_len ? bad_len : 1);
+        TEST_ASSERT(bad_buf != NULL);
+        memcpy(bad_buf, good_buf, bad_len);
 
-        TEST_ASSERT( mbedtls_ssl_session_load( &session, bad_buf, bad_len )
-                     == MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
+        TEST_ASSERT(mbedtls_ssl_session_load(&session, bad_buf, bad_len)
+                    == MBEDTLS_ERR_SSL_BAD_INPUT_DATA);
     }
 
 exit:
-    mbedtls_ssl_session_free( &session );
-    mbedtls_free( good_buf );
-    mbedtls_free( bad_buf );
+    mbedtls_ssl_session_free(&session);
+    mbedtls_free(good_buf);
+    mbedtls_free(bad_buf);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void ssl_session_serialize_version_check( int corrupt_major,
-                                          int corrupt_minor,
-                                          int corrupt_patch,
-                                          int corrupt_config )
+void ssl_session_serialize_version_check(int corrupt_major,
+                                         int corrupt_minor,
+                                         int corrupt_patch,
+                                         int corrupt_config)
 {
-    unsigned char serialized_session[ 2048 ];
+    unsigned char serialized_session[2048];
     size_t serialized_session_len;
     unsigned cur_byte;
     mbedtls_ssl_session session;
@@ -4139,44 +3961,43 @@
                                       corrupt_config == 1,
                                       corrupt_config == 1 };
 
-    mbedtls_ssl_session_init( &session );
+    mbedtls_ssl_session_init(&session);
 
     /* Infer length of serialized session. */
-    TEST_ASSERT( mbedtls_ssl_session_save( &session,
-                                           serialized_session,
-                                           sizeof( serialized_session ),
-                                           &serialized_session_len ) == 0 );
+    TEST_ASSERT(mbedtls_ssl_session_save(&session,
+                                         serialized_session,
+                                         sizeof(serialized_session),
+                                         &serialized_session_len) == 0);
 
-    mbedtls_ssl_session_free( &session );
+    mbedtls_ssl_session_free(&session);
 
     /* Without any modification, we should be able to successfully
      * de-serialize the session - double-check that. */
-    TEST_ASSERT( mbedtls_ssl_session_load( &session,
-                                           serialized_session,
-                                           serialized_session_len ) == 0 );
-    mbedtls_ssl_session_free( &session );
+    TEST_ASSERT(mbedtls_ssl_session_load(&session,
+                                         serialized_session,
+                                         serialized_session_len) == 0);
+    mbedtls_ssl_session_free(&session);
 
     /* Go through the bytes in the serialized session header and
      * corrupt them bit-by-bit. */
-    for( cur_byte = 0; cur_byte < sizeof( should_corrupt_byte ); cur_byte++ )
-    {
+    for (cur_byte = 0; cur_byte < sizeof(should_corrupt_byte); cur_byte++) {
         int cur_bit;
-        unsigned char * const byte = &serialized_session[ cur_byte ];
+        unsigned char * const byte = &serialized_session[cur_byte];
 
-        if( should_corrupt_byte[ cur_byte ] == 0 )
+        if (should_corrupt_byte[cur_byte] == 0) {
             continue;
+        }
 
-        for( cur_bit = 0; cur_bit < CHAR_BIT; cur_bit++ )
-        {
+        for (cur_bit = 0; cur_bit < CHAR_BIT; cur_bit++) {
             unsigned char const corrupted_bit = 0x1u << cur_bit;
             /* Modify a single bit in the serialized session. */
             *byte ^= corrupted_bit;
 
             /* Attempt to deserialize */
-            TEST_ASSERT( mbedtls_ssl_session_load( &session,
-                                                   serialized_session,
-                                                   serialized_session_len ) ==
-                         MBEDTLS_ERR_SSL_VERSION_MISMATCH );
+            TEST_ASSERT(mbedtls_ssl_session_load(&session,
+                                                 serialized_session,
+                                                 serialized_session_len) ==
+                        MBEDTLS_ERR_SSL_VERSION_MISMATCH);
 
             /* Undo the change */
             *byte ^= corrupted_bit;
@@ -4187,25 +4008,25 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_ENTROPY_C:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C:MBEDTLS_SHA256_C */
-void mbedtls_endpoint_sanity( int endpoint_type )
+void mbedtls_endpoint_sanity(int endpoint_type)
 {
     enum { BUFFSIZE = 1024 };
     mbedtls_endpoint ep;
     int ret = -1;
 
-    ret = mbedtls_endpoint_init( NULL, endpoint_type, MBEDTLS_PK_RSA,
-                                 NULL, NULL, NULL, NULL );
-    TEST_ASSERT( MBEDTLS_ERR_SSL_BAD_INPUT_DATA == ret );
+    ret = mbedtls_endpoint_init(NULL, endpoint_type, MBEDTLS_PK_RSA,
+                                NULL, NULL, NULL, NULL);
+    TEST_ASSERT(MBEDTLS_ERR_SSL_BAD_INPUT_DATA == ret);
 
-    ret = mbedtls_endpoint_certificate_init( NULL, MBEDTLS_PK_RSA );
-    TEST_ASSERT( MBEDTLS_ERR_SSL_BAD_INPUT_DATA == ret );
+    ret = mbedtls_endpoint_certificate_init(NULL, MBEDTLS_PK_RSA);
+    TEST_ASSERT(MBEDTLS_ERR_SSL_BAD_INPUT_DATA == ret);
 
-    ret = mbedtls_endpoint_init( &ep, endpoint_type, MBEDTLS_PK_RSA,
-                                 NULL, NULL, NULL, NULL );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_endpoint_init(&ep, endpoint_type, MBEDTLS_PK_RSA,
+                                NULL, NULL, NULL, NULL);
+    TEST_ASSERT(ret == 0);
 
 exit:
-    mbedtls_endpoint_free( &ep, NULL );
+    mbedtls_endpoint_free(&ep, NULL);
 }
 /* END_CASE */
 
@@ -4216,51 +4037,48 @@
     mbedtls_endpoint base_ep, second_ep;
     int ret = -1;
 
-    mbedtls_platform_zeroize( &base_ep, sizeof( base_ep ) );
-    mbedtls_platform_zeroize( &second_ep, sizeof( second_ep ) );
+    mbedtls_platform_zeroize(&base_ep, sizeof(base_ep));
+    mbedtls_platform_zeroize(&second_ep, sizeof(second_ep));
 
-    ret = mbedtls_endpoint_init( &base_ep, endpoint_type, MBEDTLS_PK_RSA,
-                                 NULL, NULL, NULL, NULL );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_endpoint_init(&base_ep, endpoint_type, MBEDTLS_PK_RSA,
+                                NULL, NULL, NULL, NULL);
+    TEST_ASSERT(ret == 0);
 
-    ret = mbedtls_endpoint_init( &second_ep,
-                            ( endpoint_type == MBEDTLS_SSL_IS_SERVER ) ?
-                            MBEDTLS_SSL_IS_CLIENT : MBEDTLS_SSL_IS_SERVER,
-                                 MBEDTLS_PK_RSA, NULL, NULL, NULL, NULL );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_endpoint_init(&second_ep,
+                                (endpoint_type == MBEDTLS_SSL_IS_SERVER) ?
+                                MBEDTLS_SSL_IS_CLIENT : MBEDTLS_SSL_IS_SERVER,
+                                MBEDTLS_PK_RSA, NULL, NULL, NULL, NULL);
+    TEST_ASSERT(ret == 0);
 
-    ret = mbedtls_mock_socket_connect( &(base_ep.socket),
-                                       &(second_ep.socket),
-                                       BUFFSIZE );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_mock_socket_connect(&(base_ep.socket),
+                                      &(second_ep.socket),
+                                      BUFFSIZE);
+    TEST_ASSERT(ret == 0);
 
-    ret = mbedtls_move_handshake_to_state( &(base_ep.ssl),
-                                           &(second_ep.ssl),
-                                           state );
-    if( need_pass )
-    {
-        TEST_ASSERT( ret == 0 );
-        TEST_ASSERT( base_ep.ssl.state == state );
-    }
-    else
-    {
-        TEST_ASSERT( ret != 0 );
-        TEST_ASSERT( base_ep.ssl.state != state );
+    ret = mbedtls_move_handshake_to_state(&(base_ep.ssl),
+                                          &(second_ep.ssl),
+                                          state);
+    if (need_pass) {
+        TEST_ASSERT(ret == 0);
+        TEST_ASSERT(base_ep.ssl.state == state);
+    } else {
+        TEST_ASSERT(ret != 0);
+        TEST_ASSERT(base_ep.ssl.state != state);
     }
 
 exit:
-    mbedtls_endpoint_free( &base_ep, NULL );
-    mbedtls_endpoint_free( &second_ep, NULL );
+    mbedtls_endpoint_free(&base_ep, NULL);
+    mbedtls_endpoint_free(&second_ep, NULL);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C */
-void handshake_version( int dtls, int client_min_version, int client_max_version,
-                        int server_min_version, int server_max_version,
-                        int expected_negotiated_version )
+void handshake_version(int dtls, int client_min_version, int client_max_version,
+                       int server_min_version, int server_max_version,
+                       int expected_negotiated_version)
 {
     handshake_test_options options;
-    init_handshake_options( &options );
+    init_handshake_options(&options);
 
     options.client_min_version = client_min_version;
     options.client_max_version = client_max_version;
@@ -4272,13 +4090,12 @@
     options.dtls = dtls;
     /* By default, SSLv3.0 and TLSv1.0 use 1/n-1 splitting when sending data, so
      * the number of fragments will be twice as big. */
-    if( expected_negotiated_version == MBEDTLS_SSL_MINOR_VERSION_0 ||
-        expected_negotiated_version == MBEDTLS_SSL_MINOR_VERSION_1 )
-    {
+    if (expected_negotiated_version == MBEDTLS_SSL_MINOR_VERSION_0 ||
+        expected_negotiated_version == MBEDTLS_SSL_MINOR_VERSION_1) {
         options.expected_cli_fragments = 2;
         options.expected_srv_fragments = 2;
     }
-    perform_handshake( &options );
+    perform_handshake(&options);
 
     /* The goto below is used to avoid an "unused label" warning.*/
     goto exit;
@@ -4286,17 +4103,17 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C:MBEDTLS_SHA256_C */
-void handshake_psk_cipher( char* cipher, int pk_alg, data_t *psk_str, int dtls )
+void handshake_psk_cipher(char *cipher, int pk_alg, data_t *psk_str, int dtls)
 {
     handshake_test_options options;
-    init_handshake_options( &options );
+    init_handshake_options(&options);
 
     options.cipher = cipher;
     options.dtls = dtls;
     options.psk_str = psk_str;
     options.pk_alg = pk_alg;
 
-    perform_handshake( &options );
+    perform_handshake(&options);
 
     /* The goto below is used to avoid an "unused label" warning.*/
     goto exit;
@@ -4304,9 +4121,9 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C:MBEDTLS_SHA256_C */
-void handshake_cipher( char* cipher, int pk_alg, int dtls )
+void handshake_cipher(char *cipher, int pk_alg, int dtls)
 {
-    test_handshake_psk_cipher( cipher, pk_alg, NULL, dtls );
+    test_handshake_psk_cipher(cipher, pk_alg, NULL, dtls);
 
     /* The goto below is used to avoid an "unused label" warning.*/
     goto exit;
@@ -4314,12 +4131,12 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C:MBEDTLS_SHA256_C */
-void app_data( int mfl, int cli_msg_len, int srv_msg_len,
-               int expected_cli_fragments,
-               int expected_srv_fragments, int dtls )
+void app_data(int mfl, int cli_msg_len, int srv_msg_len,
+              int expected_cli_fragments,
+              int expected_srv_fragments, int dtls)
 {
     handshake_test_options options;
-    init_handshake_options( &options );
+    init_handshake_options(&options);
 
     options.mfl = mfl;
     options.cli_msg_len = cli_msg_len;
@@ -4328,52 +4145,54 @@
     options.expected_srv_fragments = expected_srv_fragments;
     options.dtls = dtls;
 
-    perform_handshake( &options );
+    perform_handshake(&options);
     /* The goto below is used to avoid an "unused label" warning.*/
     goto exit;
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C:MBEDTLS_ECP_C:MBEDTLS_SHA256_C */
-void app_data_tls( int mfl, int cli_msg_len, int srv_msg_len,
-                   int expected_cli_fragments,
-                   int expected_srv_fragments )
+void app_data_tls(int mfl, int cli_msg_len, int srv_msg_len,
+                  int expected_cli_fragments,
+                  int expected_srv_fragments)
 {
-    test_app_data( mfl, cli_msg_len, srv_msg_len, expected_cli_fragments,
-                   expected_srv_fragments, 0 );
+    test_app_data(mfl, cli_msg_len, srv_msg_len, expected_cli_fragments,
+                  expected_srv_fragments, 0);
     /* The goto below is used to avoid an "unused label" warning.*/
     goto exit;
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SSL_PROTO_DTLS:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C:MBEDTLS_SHA256_C */
-void app_data_dtls( int mfl, int cli_msg_len, int srv_msg_len,
-                    int expected_cli_fragments,
-                    int expected_srv_fragments )
+void app_data_dtls(int mfl, int cli_msg_len, int srv_msg_len,
+                   int expected_cli_fragments,
+                   int expected_srv_fragments)
 {
-    test_app_data( mfl, cli_msg_len, srv_msg_len, expected_cli_fragments,
-                   expected_srv_fragments, 1 );
+    test_app_data(mfl, cli_msg_len, srv_msg_len, expected_cli_fragments,
+                  expected_srv_fragments, 1);
     /* The goto below is used to avoid an "unused label" warning.*/
     goto exit;
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SSL_PROTO_DTLS:MBEDTLS_SSL_RENEGOTIATION:MBEDTLS_SSL_CONTEXT_SERIALIZATION:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C:MBEDTLS_SHA256_C */
-void handshake_serialization( )
+void handshake_serialization()
 {
     handshake_test_options options;
-    init_handshake_options( &options );
+    init_handshake_options(&options);
 
     options.serialize = 1;
     options.dtls = 1;
-    perform_handshake( &options );
+    perform_handshake(&options);
     /* The goto below is used to avoid an "unused label" warning.*/
     goto exit;
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_DEBUG_C:MBEDTLS_SSL_MAX_FRAGMENT_LENGTH:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C:MBEDTLS_SHA256_C */
-void handshake_fragmentation( int mfl, int expected_srv_hs_fragmentation, int expected_cli_hs_fragmentation)
+void handshake_fragmentation(int mfl,
+                             int expected_srv_hs_fragmentation,
+                             int expected_cli_hs_fragmentation)
 {
     handshake_test_options options;
     log_pattern srv_pattern, cli_pattern;
@@ -4382,7 +4201,7 @@
     srv_pattern.counter = 0;
     cli_pattern.counter = 0;
 
-    init_handshake_options( &options );
+    init_handshake_options(&options);
     options.dtls = 1;
     options.mfl = mfl;
     /* Set cipher to one using CBC so that record splitting can be tested */
@@ -4393,43 +4212,41 @@
     options.srv_log_fun = log_analyzer;
     options.cli_log_fun = log_analyzer;
 
-    perform_handshake( &options );
+    perform_handshake(&options);
 
     /* Test if the server received a fragmented handshake */
-    if( expected_srv_hs_fragmentation )
-    {
-        TEST_ASSERT( srv_pattern.counter >= 1 );
+    if (expected_srv_hs_fragmentation) {
+        TEST_ASSERT(srv_pattern.counter >= 1);
     }
     /* Test if the client received a fragmented handshake */
-    if( expected_cli_hs_fragmentation )
-    {
-        TEST_ASSERT( cli_pattern.counter >= 1 );
+    if (expected_cli_hs_fragmentation) {
+        TEST_ASSERT(cli_pattern.counter >= 1);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SSL_PROTO_DTLS:MBEDTLS_SSL_RENEGOTIATION:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C:MBEDTLS_SHA256_C */
-void renegotiation( int legacy_renegotiation )
+void renegotiation(int legacy_renegotiation)
 {
     handshake_test_options options;
-    init_handshake_options( &options );
+    init_handshake_options(&options);
 
     options.renegotiate = 1;
     options.legacy_renegotiation = legacy_renegotiation;
     options.dtls = 1;
 
-    perform_handshake( &options );
+    perform_handshake(&options);
     /* The goto below is used to avoid an "unused label" warning.*/
     goto exit;
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C:MBEDTLS_SHA256_C */
-void resize_buffers( int mfl, int renegotiation, int legacy_renegotiation,
-                     int serialize, int dtls, char *cipher )
+void resize_buffers(int mfl, int renegotiation, int legacy_renegotiation,
+                    int serialize, int dtls, char *cipher)
 {
     handshake_test_options options;
-    init_handshake_options( &options );
+    init_handshake_options(&options);
 
     options.mfl = mfl;
     options.cipher = cipher;
@@ -4439,17 +4256,17 @@
     options.dtls = dtls;
     options.resize_buffers = 1;
 
-    perform_handshake( &options );
+    perform_handshake(&options);
     /* The goto below is used to avoid an "unused label" warning.*/
     goto exit;
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH:MBEDTLS_SSL_CONTEXT_SERIALIZATION:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_SSL_PROTO_DTLS:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C:MBEDTLS_SHA256_C */
-void resize_buffers_serialize_mfl( int mfl )
+void resize_buffers_serialize_mfl(int mfl)
 {
-    test_resize_buffers( mfl, 0, MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION, 1, 1,
-                         (char *) "" );
+    test_resize_buffers(mfl, 0, MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION, 1, 1,
+                        (char *) "");
 
     /* The goto below is used to avoid an "unused label" warning.*/
     goto exit;
@@ -4457,10 +4274,10 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH:MBEDTLS_SSL_RENEGOTIATION:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_C:MBEDTLS_SHA256_C */
-void resize_buffers_renegotiate_mfl( int mfl, int legacy_renegotiation,
-                                     char *cipher )
+void resize_buffers_renegotiate_mfl(int mfl, int legacy_renegotiation,
+                                    char *cipher)
 {
-    test_resize_buffers( mfl, 1, legacy_renegotiation, 0, 1, cipher );
+    test_resize_buffers(mfl, 1, legacy_renegotiation, 0, 1, cipher);
 
     /* The goto below is used to avoid an "unused label" warning.*/
     goto exit;
@@ -4468,7 +4285,7 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED:MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ENTROPY_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_CTR_DRBG_C:MBEDTLS_ECP_C:MBEDTLS_ECDSA_C */
-void raw_key_agreement_fail( int bad_server_ecdhe_key )
+void raw_key_agreement_fail(int bad_server_ecdhe_key)
 {
     enum { BUFFSIZE = 17000 };
     mbedtls_endpoint client, server;
@@ -4477,87 +4294,87 @@
 
     mbedtls_ecp_group_id curve_list[] = { MBEDTLS_ECP_DP_SECP256R1,
                                           MBEDTLS_ECP_DP_NONE };
-    USE_PSA_INIT( );
-    mbedtls_platform_zeroize( &client, sizeof( client ) );
-    mbedtls_platform_zeroize( &server, sizeof( server ) );
+    USE_PSA_INIT();
+    mbedtls_platform_zeroize(&client, sizeof(client));
+    mbedtls_platform_zeroize(&server, sizeof(server));
 
     /* Client side, force SECP256R1 to make one key bitflip fail
      * the raw key agreement. Flipping the first byte makes the
      * required 0x04 identifier invalid. */
-    TEST_EQUAL( mbedtls_endpoint_init( &client, MBEDTLS_SSL_IS_CLIENT,
-                                        MBEDTLS_PK_ECDSA, NULL, NULL,
-                                        NULL, curve_list ), 0 );
+    TEST_EQUAL(mbedtls_endpoint_init(&client, MBEDTLS_SSL_IS_CLIENT,
+                                     MBEDTLS_PK_ECDSA, NULL, NULL,
+                                     NULL, curve_list), 0);
 
     /* Server side */
-    TEST_EQUAL( mbedtls_endpoint_init( &server, MBEDTLS_SSL_IS_SERVER,
-                                        MBEDTLS_PK_ECDSA, NULL, NULL,
-                                        NULL, NULL ), 0 );
+    TEST_EQUAL(mbedtls_endpoint_init(&server, MBEDTLS_SSL_IS_SERVER,
+                                     MBEDTLS_PK_ECDSA, NULL, NULL,
+                                     NULL, NULL), 0);
 
-    TEST_EQUAL( mbedtls_mock_socket_connect( &(client.socket),
-                                              &(server.socket),
-                                              BUFFSIZE ), 0 );
+    TEST_EQUAL(mbedtls_mock_socket_connect(&(client.socket),
+                                           &(server.socket),
+                                           BUFFSIZE), 0);
 
-    TEST_EQUAL( mbedtls_move_handshake_to_state( &(client.ssl),
-                                                  &(server.ssl),
-                                                  MBEDTLS_SSL_CLIENT_KEY_EXCHANGE )
-                 , 0 );
+    TEST_EQUAL(mbedtls_move_handshake_to_state(&(client.ssl),
+                                               &(server.ssl),
+                                               MBEDTLS_SSL_CLIENT_KEY_EXCHANGE)
+               , 0);
 
-    mbedtls_psa_get_stats( &stats );
+    mbedtls_psa_get_stats(&stats);
     /* Save the number of slots in use up to this point.
      * With PSA, one can be used for the ECDH private key. */
     free_slots_before = stats.empty_slots;
 
-    if( bad_server_ecdhe_key )
-    {
+    if (bad_server_ecdhe_key) {
         /* Force a simulated bitflip in the server key. to make the
          * raw key agreement in ssl_write_client_key_exchange fail. */
         (client.ssl).handshake->ecdh_psa_peerkey[0] ^= 0x02;
     }
 
-    TEST_EQUAL( mbedtls_move_handshake_to_state( &(client.ssl),
-                                                 &(server.ssl),
-                                                 MBEDTLS_SSL_HANDSHAKE_OVER ),
-                bad_server_ecdhe_key ? MBEDTLS_ERR_SSL_HW_ACCEL_FAILED : 0 );
+    TEST_EQUAL(mbedtls_move_handshake_to_state(&(client.ssl),
+                                               &(server.ssl),
+                                               MBEDTLS_SSL_HANDSHAKE_OVER),
+               bad_server_ecdhe_key ? MBEDTLS_ERR_SSL_HW_ACCEL_FAILED : 0);
 
-    mbedtls_psa_get_stats( &stats );
+    mbedtls_psa_get_stats(&stats);
 
     /* Make sure that the key slot is already destroyed in case of failure,
      * without waiting to close the connection. */
-    if( bad_server_ecdhe_key )
-        TEST_EQUAL( free_slots_before, stats.empty_slots );
+    if (bad_server_ecdhe_key) {
+        TEST_EQUAL(free_slots_before, stats.empty_slots);
+    }
 
 exit:
-    mbedtls_endpoint_free( &client, NULL );
-    mbedtls_endpoint_free( &server, NULL );
+    mbedtls_endpoint_free(&client, NULL);
+    mbedtls_endpoint_free(&server, NULL);
 
-    USE_PSA_DONE( );
+    USE_PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SSL_SRV_C:MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE:MBEDTLS_TEST_HOOKS */
-void cookie_parsing( data_t *cookie, int exp_ret )
+void cookie_parsing(data_t *cookie, int exp_ret)
 {
     mbedtls_ssl_context ssl;
     mbedtls_ssl_config conf;
     size_t len;
 
-    mbedtls_ssl_init( &ssl );
-    mbedtls_ssl_config_init( &conf );
-    TEST_EQUAL( mbedtls_ssl_config_defaults( &conf, MBEDTLS_SSL_IS_SERVER,
-                                             MBEDTLS_SSL_TRANSPORT_DATAGRAM,
-                                             MBEDTLS_SSL_PRESET_DEFAULT ),
-                0 );
+    mbedtls_ssl_init(&ssl);
+    mbedtls_ssl_config_init(&conf);
+    TEST_EQUAL(mbedtls_ssl_config_defaults(&conf, MBEDTLS_SSL_IS_SERVER,
+                                           MBEDTLS_SSL_TRANSPORT_DATAGRAM,
+                                           MBEDTLS_SSL_PRESET_DEFAULT),
+               0);
 
-    TEST_EQUAL( mbedtls_ssl_setup( &ssl, &conf ), 0 );
-    TEST_EQUAL( mbedtls_ssl_check_dtls_clihlo_cookie( &ssl, ssl.cli_id,
-                                                  ssl.cli_id_len,
-                                                  cookie->x, cookie->len,
-                                                  ssl.out_buf,
-                                                  MBEDTLS_SSL_OUT_CONTENT_LEN,
-                                                  &len ),
-                exp_ret );
+    TEST_EQUAL(mbedtls_ssl_setup(&ssl, &conf), 0);
+    TEST_EQUAL(mbedtls_ssl_check_dtls_clihlo_cookie(&ssl, ssl.cli_id,
+                                                    ssl.cli_id_len,
+                                                    cookie->x, cookie->len,
+                                                    ssl.out_buf,
+                                                    MBEDTLS_SSL_OUT_CONTENT_LEN,
+                                                    &len),
+               exp_ret);
 
-    mbedtls_ssl_free( &ssl );
-    mbedtls_ssl_config_free( &conf );
+    mbedtls_ssl_free(&ssl);
+    mbedtls_ssl_config_free(&conf);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_timing.function b/tests/suites/test_suite_timing.function
index 74dc823..59c1207 100644
--- a/tests/suites/test_suite_timing.function
+++ b/tests/suites/test_suite_timing.function
@@ -17,7 +17,7 @@
  */
 
 /* BEGIN_CASE */
-void timing_hardclock( )
+void timing_hardclock()
 {
     (void) mbedtls_timing_hardclock();
     /* This goto is added to avoid warnings from the generated code. */
@@ -26,49 +26,43 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void timing_get_timer( )
+void timing_get_timer()
 {
     struct mbedtls_timing_hr_time time;
-    (void) mbedtls_timing_get_timer( &time, 1 );
-    (void) mbedtls_timing_get_timer( &time, 0 );
+    (void) mbedtls_timing_get_timer(&time, 1);
+    (void) mbedtls_timing_get_timer(&time, 0);
     /* This goto is added to avoid warnings from the generated code. */
     goto exit;
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void timing_set_alarm( int seconds )
+void timing_set_alarm(int seconds)
 {
-    if( seconds == 0 )
-    {
-        mbedtls_set_alarm( seconds );
-        TEST_ASSERT( mbedtls_timing_alarmed == 1 );
-    }
-    else
-    {
-        mbedtls_set_alarm( seconds );
-        TEST_ASSERT( mbedtls_timing_alarmed == 0 ||
-                     mbedtls_timing_alarmed == 1 );
+    if (seconds == 0) {
+        mbedtls_set_alarm(seconds);
+        TEST_ASSERT(mbedtls_timing_alarmed == 1);
+    } else {
+        mbedtls_set_alarm(seconds);
+        TEST_ASSERT(mbedtls_timing_alarmed == 0 ||
+                    mbedtls_timing_alarmed == 1);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void timing_delay( int fin_ms )
+void timing_delay(int fin_ms)
 {
     mbedtls_timing_delay_context ctx;
     int result;
-    if( fin_ms == 0 )
-    {
-        mbedtls_timing_set_delay( &ctx, 0, 0 );
-        result = mbedtls_timing_get_delay( &ctx );
-        TEST_ASSERT( result == -1 );
-    }
-    else
-    {
-        mbedtls_timing_set_delay( &ctx, fin_ms / 2, fin_ms );
-        result = mbedtls_timing_get_delay( &ctx );
-        TEST_ASSERT( result >= 0 && result <= 2 );
+    if (fin_ms == 0) {
+        mbedtls_timing_set_delay(&ctx, 0, 0);
+        result = mbedtls_timing_get_delay(&ctx);
+        TEST_ASSERT(result == -1);
+    } else {
+        mbedtls_timing_set_delay(&ctx, fin_ms / 2, fin_ms);
+        result = mbedtls_timing_get_delay(&ctx);
+        TEST_ASSERT(result >= 0 && result <= 2);
     }
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_version.function b/tests/suites/test_suite_version.function
index 7d59794..981f8ab 100644
--- a/tests/suites/test_suite_version.function
+++ b/tests/suites/test_suite_version.function
@@ -8,34 +8,34 @@
  */
 
 /* BEGIN_CASE */
-void check_compiletime_version( char * version_str )
+void check_compiletime_version(char *version_str)
 {
     char build_str[100];
     char build_str_full[100];
     unsigned int build_int;
 
-    memset( build_str, 0, 100 );
-    memset( build_str_full, 0, 100 );
+    memset(build_str, 0, 100);
+    memset(build_str_full, 0, 100);
 
-    mbedtls_snprintf( build_str, 100, "%d.%d.%d", MBEDTLS_VERSION_MAJOR,
-        MBEDTLS_VERSION_MINOR, MBEDTLS_VERSION_PATCH );
+    mbedtls_snprintf(build_str, 100, "%d.%d.%d", MBEDTLS_VERSION_MAJOR,
+                     MBEDTLS_VERSION_MINOR, MBEDTLS_VERSION_PATCH);
 
-    mbedtls_snprintf( build_str_full, 100, "mbed TLS %d.%d.%d", MBEDTLS_VERSION_MAJOR,
-        MBEDTLS_VERSION_MINOR, MBEDTLS_VERSION_PATCH );
+    mbedtls_snprintf(build_str_full, 100, "mbed TLS %d.%d.%d", MBEDTLS_VERSION_MAJOR,
+                     MBEDTLS_VERSION_MINOR, MBEDTLS_VERSION_PATCH);
 
     build_int = MBEDTLS_VERSION_MAJOR << 24 |
-            MBEDTLS_VERSION_MINOR << 16 |
-            MBEDTLS_VERSION_PATCH << 8;
+                MBEDTLS_VERSION_MINOR << 16 |
+                MBEDTLS_VERSION_PATCH << 8;
 
-    TEST_ASSERT( build_int == MBEDTLS_VERSION_NUMBER );
-    TEST_ASSERT( strcmp( build_str, MBEDTLS_VERSION_STRING ) == 0 );
-    TEST_ASSERT( strcmp( build_str_full, MBEDTLS_VERSION_STRING_FULL ) == 0 );
-    TEST_ASSERT( strcmp( version_str, MBEDTLS_VERSION_STRING ) == 0 );
+    TEST_ASSERT(build_int == MBEDTLS_VERSION_NUMBER);
+    TEST_ASSERT(strcmp(build_str, MBEDTLS_VERSION_STRING) == 0);
+    TEST_ASSERT(strcmp(build_str_full, MBEDTLS_VERSION_STRING_FULL) == 0);
+    TEST_ASSERT(strcmp(version_str, MBEDTLS_VERSION_STRING) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void check_runtime_version( char * version_str )
+void check_runtime_version(char *version_str)
 {
     char build_str[100];
     char get_str[100];
@@ -43,31 +43,31 @@
     char get_str_full[100];
     unsigned int get_int;
 
-    memset( build_str, 0, 100 );
-    memset( get_str, 0, 100 );
-    memset( build_str_full, 0, 100 );
-    memset( get_str_full, 0, 100 );
+    memset(build_str, 0, 100);
+    memset(get_str, 0, 100);
+    memset(build_str_full, 0, 100);
+    memset(get_str_full, 0, 100);
 
     get_int = mbedtls_version_get_number();
-    mbedtls_version_get_string( get_str );
-    mbedtls_version_get_string_full( get_str_full );
+    mbedtls_version_get_string(get_str);
+    mbedtls_version_get_string_full(get_str_full);
 
-    mbedtls_snprintf( build_str, 100, "%u.%u.%u",
-        (get_int >> 24) & 0xFF,
-        (get_int >> 16) & 0xFF,
-        (get_int >> 8) & 0xFF );
-    mbedtls_snprintf( build_str_full, 100, "mbed TLS %s", version_str );
+    mbedtls_snprintf(build_str, 100, "%u.%u.%u",
+                     (get_int >> 24) & 0xFF,
+                     (get_int >> 16) & 0xFF,
+                     (get_int >> 8) & 0xFF);
+    mbedtls_snprintf(build_str_full, 100, "mbed TLS %s", version_str);
 
-    TEST_ASSERT( strcmp( build_str, version_str ) == 0 );
-    TEST_ASSERT( strcmp( build_str_full, get_str_full ) == 0 );
-    TEST_ASSERT( strcmp( version_str, get_str ) == 0 );
+    TEST_ASSERT(strcmp(build_str, version_str) == 0);
+    TEST_ASSERT(strcmp(build_str_full, get_str_full) == 0);
+    TEST_ASSERT(strcmp(version_str, get_str) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_VERSION_FEATURES */
-void check_feature( char *feature, int result )
+void check_feature(char *feature, int result)
 {
-    int check = mbedtls_version_check_feature( feature );
-    TEST_ASSERT( check == result );
+    int check = mbedtls_version_check_feature(feature);
+    TEST_ASSERT(check == result);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_x509parse.function b/tests/suites/test_suite_x509parse.function
index ba5c860..91ac00d 100644
--- a/tests/suites/test_suite_x509parse.function
+++ b/tests/suites/test_suite_x509parse.function
@@ -12,8 +12,8 @@
 
 #if MBEDTLS_X509_MAX_INTERMEDIATE_CA > 19
 #error "The value of MBEDTLS_X509_MAX_INTERMEDIATE_C is larger \
-than the current threshold 19. To test larger values, please \
-adapt the script tests/data_files/dir-max/long.sh."
+    than the current threshold 19. To test larger values, please \
+    adapt the script tests/data_files/dir-max/long.sh."
 #endif
 
 /* Test-only profile allowing all digests, PK algorithms, and curves. */
@@ -29,12 +29,12 @@
    profile. */
 const mbedtls_x509_crt_profile compat_profile =
 {
-    MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA1 ) |
-    MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_RIPEMD160 ) |
-    MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA224 ) |
-    MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA256 ) |
-    MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA384 ) |
-    MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA512 ),
+    MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA1) |
+    MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_RIPEMD160) |
+    MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA224) |
+    MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA256) |
+    MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA384) |
+    MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA512),
     0xFFFFFFFF, /* Any PK alg    */
     0xFFFFFFFF, /* Any curve     */
     1024,
@@ -42,23 +42,23 @@
 
 const mbedtls_x509_crt_profile profile_rsa3072 =
 {
-    MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA256 ) |
-    MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA384 ) |
-    MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA512 ),
-    MBEDTLS_X509_ID_FLAG( MBEDTLS_PK_RSA ),
+    MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA256) |
+    MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA384) |
+    MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA512),
+    MBEDTLS_X509_ID_FLAG(MBEDTLS_PK_RSA),
     0,
     3072,
 };
 
 const mbedtls_x509_crt_profile profile_sha512 =
 {
-    MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA512 ),
+    MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA512),
     0xFFFFFFFF, /* Any PK alg    */
     0xFFFFFFFF, /* Any curve     */
     1024,
 };
 
-int verify_none( void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags )
+int verify_none(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags)
 {
     ((void) data);
     ((void) crt);
@@ -68,7 +68,7 @@
     return 0;
 }
 
-int verify_all( void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags )
+int verify_all(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags)
 {
     ((void) data);
     ((void) crt);
@@ -79,7 +79,7 @@
 }
 
 #if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
-int ca_callback_fail( void *data, mbedtls_x509_crt const *child, mbedtls_x509_crt **candidates )
+int ca_callback_fail(void *data, mbedtls_x509_crt const *child, mbedtls_x509_crt **candidates)
 {
     ((void) data);
     ((void) child);
@@ -88,8 +88,8 @@
     return -1;
 }
 
-int ca_callback( void *data, mbedtls_x509_crt const *child,
-                 mbedtls_x509_crt **candidates )
+int ca_callback(void *data, mbedtls_x509_crt const *child,
+                mbedtls_x509_crt **candidates)
 {
     int ret = 0;
     mbedtls_x509_crt *ca = (mbedtls_x509_crt *) data;
@@ -105,25 +105,21 @@
      * and parent `Subject` field. */
     ((void) child);
 
-    first = mbedtls_calloc( 1, sizeof( mbedtls_x509_crt ) );
-    if( first == NULL )
-    {
+    first = mbedtls_calloc(1, sizeof(mbedtls_x509_crt));
+    if (first == NULL) {
         ret = -1;
         goto exit;
     }
-    mbedtls_x509_crt_init( first );
+    mbedtls_x509_crt_init(first);
 
-    if( mbedtls_x509_crt_parse_der( first, ca->raw.p, ca->raw.len ) != 0 )
-    {
+    if (mbedtls_x509_crt_parse_der(first, ca->raw.p, ca->raw.len) != 0) {
         ret = -1;
         goto exit;
     }
 
-    while( ca->next != NULL )
-    {
+    while (ca->next != NULL) {
         ca = ca->next;
-        if( mbedtls_x509_crt_parse_der( first, ca->raw.p, ca->raw.len ) != 0 )
-        {
+        if (mbedtls_x509_crt_parse_der(first, ca->raw.p, ca->raw.len) != 0) {
             ret = -1;
             goto exit;
         }
@@ -131,19 +127,18 @@
 
 exit:
 
-    if( ret != 0 )
-    {
-        mbedtls_x509_crt_free( first );
-        mbedtls_free( first );
+    if (ret != 0) {
+        mbedtls_x509_crt_free(first);
+        mbedtls_free(first);
         first = NULL;
     }
 
     *candidates = first;
-    return( ret );
+    return ret;
 }
 #endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
 
-int verify_fatal( void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags )
+int verify_fatal(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags)
 {
     int *levels = (int *) data;
 
@@ -151,13 +146,12 @@
     ((void) certificate_depth);
 
     /* Simulate a fatal error in the callback */
-    if( *levels & ( 1 << certificate_depth ) )
-    {
-        *flags |= ( 1 << certificate_depth );
-        return( -1 - certificate_depth );
+    if (*levels & (1 << certificate_depth)) {
+        *flags |= (1 << certificate_depth);
+        return -1 - certificate_depth;
     }
 
-    return( 0 );
+    return 0;
 }
 
 /* strsep() not available on Windows */
@@ -166,28 +160,27 @@
     const char *p;
     char *ret = *stringp;
 
-    if( *stringp == NULL )
-        return( NULL );
+    if (*stringp == NULL) {
+        return NULL;
+    }
 
-    for( ; ; (*stringp)++ )
-    {
-        if( **stringp == '\0' )
-        {
+    for (;; (*stringp)++) {
+        if (**stringp == '\0') {
             *stringp = NULL;
             goto done;
         }
 
-        for( p = delim; *p != '\0'; p++ )
-            if( **stringp == *p )
-            {
+        for (p = delim; *p != '\0'; p++) {
+            if (**stringp == *p) {
                 **stringp = '\0';
                 (*stringp)++;
                 goto done;
             }
+        }
     }
 
 done:
-    return( ret );
+    return ret;
 }
 
 #if defined(MBEDTLS_X509_CRT_PARSE_C)
@@ -196,195 +189,204 @@
     char *p;
 } verify_print_context;
 
-void verify_print_init( verify_print_context *ctx )
+void verify_print_init(verify_print_context *ctx)
 {
-    memset( ctx, 0, sizeof( verify_print_context ) );
+    memset(ctx, 0, sizeof(verify_print_context));
     ctx->p = ctx->buf;
 }
 
-int verify_print( void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags )
+int verify_print(void *data, mbedtls_x509_crt *crt, int certificate_depth, uint32_t *flags)
 {
     int ret;
     verify_print_context *ctx = (verify_print_context *) data;
     char *p = ctx->p;
-    size_t n = ctx->buf + sizeof( ctx->buf ) - ctx->p;
+    size_t n = ctx->buf + sizeof(ctx->buf) - ctx->p;
     ((void) flags);
 
-    ret = mbedtls_snprintf( p, n, "depth %d - serial ", certificate_depth );
+    ret = mbedtls_snprintf(p, n, "depth %d - serial ", certificate_depth);
     MBEDTLS_X509_SAFE_SNPRINTF;
 
-    ret = mbedtls_x509_serial_gets( p, n, &crt->serial );
+    ret = mbedtls_x509_serial_gets(p, n, &crt->serial);
     MBEDTLS_X509_SAFE_SNPRINTF;
 
-    ret = mbedtls_snprintf( p, n, " - subject " );
+    ret = mbedtls_snprintf(p, n, " - subject ");
     MBEDTLS_X509_SAFE_SNPRINTF;
 
-    ret = mbedtls_x509_dn_gets( p, n, &crt->subject );
+    ret = mbedtls_x509_dn_gets(p, n, &crt->subject);
     MBEDTLS_X509_SAFE_SNPRINTF;
 
-    ret = mbedtls_snprintf( p, n, " - flags 0x%08x\n", *flags );
+    ret = mbedtls_snprintf(p, n, " - flags 0x%08x\n", *flags);
     MBEDTLS_X509_SAFE_SNPRINTF;
 
     ctx->p = p;
 
-    return( 0 );
+    return 0;
 }
 
-int verify_parse_san( mbedtls_x509_subject_alternative_name *san,
-                      char **buf, size_t *size )
+int verify_parse_san(mbedtls_x509_subject_alternative_name *san,
+                     char **buf, size_t *size)
 {
     int ret;
     size_t i;
     char *p = *buf;
     size_t n = *size;
 
-    ret = mbedtls_snprintf( p, n, "type : %d", san->type );
+    ret = mbedtls_snprintf(p, n, "type : %d", san->type);
     MBEDTLS_X509_SAFE_SNPRINTF;
 
-    switch( san->type )
-    {
-        case( MBEDTLS_X509_SAN_OTHER_NAME ):
-            ret = mbedtls_snprintf( p, n, "\notherName :");
+    switch (san->type) {
+        case (MBEDTLS_X509_SAN_OTHER_NAME):
+            ret = mbedtls_snprintf(p, n, "\notherName :");
             MBEDTLS_X509_SAFE_SNPRINTF;
 
-            if( MBEDTLS_OID_CMP( MBEDTLS_OID_ON_HW_MODULE_NAME,
-                        &san->san.other_name.value.hardware_module_name.oid ) != 0 )
-            {
-                ret = mbedtls_snprintf( p, n, " hardware module name :" );
+            if (MBEDTLS_OID_CMP(MBEDTLS_OID_ON_HW_MODULE_NAME,
+                                &san->san.other_name.value.hardware_module_name.oid) != 0) {
+                ret = mbedtls_snprintf(p, n, " hardware module name :");
                 MBEDTLS_X509_SAFE_SNPRINTF;
-                ret = mbedtls_snprintf( p, n, " hardware type : " );
+                ret = mbedtls_snprintf(p, n, " hardware type : ");
                 MBEDTLS_X509_SAFE_SNPRINTF;
 
-                ret = mbedtls_oid_get_numeric_string( p, n,
-                            &san->san.other_name.value.hardware_module_name.oid );
+                ret = mbedtls_oid_get_numeric_string(p,
+                                                     n,
+                                                     &san->san.other_name.value.hardware_module_name.oid);
                 MBEDTLS_X509_SAFE_SNPRINTF;
 
-                ret = mbedtls_snprintf( p, n, ", hardware serial number : " );
+                ret = mbedtls_snprintf(p, n, ", hardware serial number : ");
                 MBEDTLS_X509_SAFE_SNPRINTF;
 
-                for( i = 0; i < san->san.other_name.value.hardware_module_name.val.len; i++ )
-                {
-                    ret = mbedtls_snprintf( p, n, "%02X", san->san.other_name.value.hardware_module_name.val.p[i] );
+                for (i = 0; i < san->san.other_name.value.hardware_module_name.val.len; i++) {
+                    ret = mbedtls_snprintf(p,
+                                           n,
+                                           "%02X",
+                                           san->san.other_name.value.hardware_module_name.val.p[i]);
                     MBEDTLS_X509_SAFE_SNPRINTF;
                 }
             }
-        break;/* MBEDTLS_OID_ON_HW_MODULE_NAME */
-        case(  MBEDTLS_X509_SAN_DNS_NAME ):
-            ret = mbedtls_snprintf( p, n, "\ndNSName : " );
+            break;/* MBEDTLS_OID_ON_HW_MODULE_NAME */
+        case (MBEDTLS_X509_SAN_DNS_NAME):
+            ret = mbedtls_snprintf(p, n, "\ndNSName : ");
             MBEDTLS_X509_SAFE_SNPRINTF;
-            if( san->san.unstructured_name.len >= n )
-            {
+            if (san->san.unstructured_name.len >= n) {
                 *p = '\0';
-                return( MBEDTLS_ERR_X509_BUFFER_TOO_SMALL );
+                return MBEDTLS_ERR_X509_BUFFER_TOO_SMALL;
             }
             n -= san->san.unstructured_name.len;
-            for( i = 0; i < san->san.unstructured_name.len; i++ )
+            for (i = 0; i < san->san.unstructured_name.len; i++) {
                 *p++ = san->san.unstructured_name.p[i];
-        break;/* MBEDTLS_X509_SAN_DNS_NAME */
+            }
+            break;/* MBEDTLS_X509_SAN_DNS_NAME */
 
         default:
-        /*
-         * Should not happen.
-         */
-        return( -1 );
+            /*
+             * Should not happen.
+             */
+            return -1;
     }
-    ret = mbedtls_snprintf( p, n, "\n" );
+    ret = mbedtls_snprintf(p, n, "\n");
     MBEDTLS_X509_SAFE_SNPRINTF;
 
     *size = n;
     *buf = p;
 
-    return( 0 );
+    return 0;
 }
 
-int parse_crt_ext_cb( void *p_ctx, mbedtls_x509_crt const *crt, mbedtls_x509_buf const *oid,
-                      int critical, const unsigned char *cp, const unsigned char *end )
+int parse_crt_ext_cb(void *p_ctx, mbedtls_x509_crt const *crt, mbedtls_x509_buf const *oid,
+                     int critical, const unsigned char *cp, const unsigned char *end)
 {
-    ( void ) crt;
-    ( void ) critical;
-    mbedtls_x509_buf *new_oid = (mbedtls_x509_buf *)p_ctx;
-    if( oid->tag == MBEDTLS_ASN1_OID &&
-        MBEDTLS_OID_CMP( MBEDTLS_OID_CERTIFICATE_POLICIES, oid ) == 0 )
-    {
+    (void) crt;
+    (void) critical;
+    mbedtls_x509_buf *new_oid = (mbedtls_x509_buf *) p_ctx;
+    if (oid->tag == MBEDTLS_ASN1_OID &&
+        MBEDTLS_OID_CMP(MBEDTLS_OID_CERTIFICATE_POLICIES, oid) == 0) {
         /* Handle unknown certificate policy */
         int ret, parse_ret = 0;
         size_t len;
-        unsigned char **p = (unsigned char **)&cp;
+        unsigned char **p = (unsigned char **) &cp;
 
         /* Get main sequence tag */
-        ret = mbedtls_asn1_get_tag( p, end, &len,
-                                 MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE );
-        if( ret != 0 )
-            return( MBEDTLS_ERROR_ADD( MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret ) );
+        ret = mbedtls_asn1_get_tag(p, end, &len,
+                                   MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE);
+        if (ret != 0) {
+            return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret);
+        }
 
-        if( *p + len != end )
-            return( MBEDTLS_ERROR_ADD( MBEDTLS_ERR_X509_INVALID_EXTENSIONS,
-                    MBEDTLS_ERR_ASN1_LENGTH_MISMATCH ) );
+        if (*p + len != end) {
+            return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS,
+                                     MBEDTLS_ERR_ASN1_LENGTH_MISMATCH);
+        }
 
         /*
          * Cannot be an empty sequence.
          */
-        if( len == 0 )
-            return( MBEDTLS_ERROR_ADD( MBEDTLS_ERR_X509_INVALID_EXTENSIONS,
-                    MBEDTLS_ERR_ASN1_LENGTH_MISMATCH ) );
+        if (len == 0) {
+            return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS,
+                                     MBEDTLS_ERR_ASN1_LENGTH_MISMATCH);
+        }
 
-        while( *p < end )
-        {
+        while (*p < end) {
             const unsigned char *policy_end;
 
             /*
              * Get the policy sequence
              */
-            if( ( ret = mbedtls_asn1_get_tag( p, end, &len,
-                    MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )
-                return( MBEDTLS_ERROR_ADD( MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret ) );
+            if ((ret = mbedtls_asn1_get_tag(p, end, &len,
+                                            MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE)) !=
+                0) {
+                return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret);
+            }
 
             policy_end = *p + len;
 
-            if( ( ret = mbedtls_asn1_get_tag( p, policy_end, &len,
-                                              MBEDTLS_ASN1_OID ) ) != 0 )
-                return( MBEDTLS_ERROR_ADD( MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret ) );
+            if ((ret = mbedtls_asn1_get_tag(p, policy_end, &len,
+                                            MBEDTLS_ASN1_OID)) != 0) {
+                return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret);
+            }
 
             /*
              * Recognize exclusively the policy with OID 1
              */
-            if( len != 1 || *p[0] != 1 )
+            if (len != 1 || *p[0] != 1) {
                 parse_ret = MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE;
+            }
 
             *p += len;
 
-           /*
-            * If there is an optional qualifier, then *p < policy_end
-            * Check the Qualifier len to verify it doesn't exceed policy_end.
-            */
-            if( *p < policy_end )
-            {
-                if( ( ret = mbedtls_asn1_get_tag( p, policy_end, &len,
-                         MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )
-                    return( MBEDTLS_ERROR_ADD( MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret ) );
+            /*
+             * If there is an optional qualifier, then *p < policy_end
+             * Check the Qualifier len to verify it doesn't exceed policy_end.
+             */
+            if (*p < policy_end) {
+                if ((ret = mbedtls_asn1_get_tag(p, policy_end, &len,
+                                                MBEDTLS_ASN1_CONSTRUCTED |
+                                                MBEDTLS_ASN1_SEQUENCE)) != 0) {
+                    return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS, ret);
+                }
                 /*
                  * Skip the optional policy qualifiers.
                  */
                 *p += len;
             }
 
-            if( *p != policy_end )
-                return( MBEDTLS_ERROR_ADD( MBEDTLS_ERR_X509_INVALID_EXTENSIONS,
-                        MBEDTLS_ERR_ASN1_LENGTH_MISMATCH ) );
+            if (*p != policy_end) {
+                return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS,
+                                         MBEDTLS_ERR_ASN1_LENGTH_MISMATCH);
+            }
         }
 
-        if( *p != end )
-            return( MBEDTLS_ERROR_ADD( MBEDTLS_ERR_X509_INVALID_EXTENSIONS,
-                    MBEDTLS_ERR_ASN1_LENGTH_MISMATCH ) );
+        if (*p != end) {
+            return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS,
+                                     MBEDTLS_ERR_ASN1_LENGTH_MISMATCH);
+        }
 
-        return( parse_ret );
+        return parse_ret;
+    } else if (new_oid != NULL && new_oid->tag == oid->tag && new_oid->len == oid->len &&
+               memcmp(new_oid->p, oid->p, oid->len) == 0) {
+        return 0;
+    } else {
+        return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS,
+                                 MBEDTLS_ERR_ASN1_UNEXPECTED_TAG);
     }
-    else if( new_oid != NULL && new_oid->tag == oid->tag && new_oid->len == oid->len &&
-             memcmp( new_oid->p, oid->p, oid->len ) == 0 )
-        return( 0 );
-    else
-        return( MBEDTLS_ERROR_ADD( MBEDTLS_ERR_X509_INVALID_EXTENSIONS,
-                                   MBEDTLS_ERR_ASN1_UNEXPECTED_TAG ) );
 }
 #endif /* MBEDTLS_X509_CRT_PARSE_C */
 /* END_HEADER */
@@ -395,7 +397,7 @@
  */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C */
-void x509_parse_san( char * crt_file, char * result_str )
+void x509_parse_san(char *crt_file, char *result_str)
 {
     int ret;
     mbedtls_x509_crt   crt;
@@ -403,142 +405,141 @@
     mbedtls_x509_sequence *cur = NULL;
     char buf[2000];
     char *p = buf;
-    size_t n = sizeof( buf );
+    size_t n = sizeof(buf);
 
-    mbedtls_x509_crt_init( &crt );
-    memset( buf, 0, 2000 );
+    mbedtls_x509_crt_init(&crt);
+    memset(buf, 0, 2000);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &crt, crt_file ) == 0 );
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
 
-    if( crt.ext_types & MBEDTLS_X509_EXT_SUBJECT_ALT_NAME )
-    {
+    if (crt.ext_types & MBEDTLS_X509_EXT_SUBJECT_ALT_NAME) {
         cur = &crt.subject_alt_names;
-        while( cur != NULL )
-        {
-            ret = mbedtls_x509_parse_subject_alt_name( &cur->buf, &san );
-            TEST_ASSERT( ret == 0 || ret == MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE );
+        while (cur != NULL) {
+            ret = mbedtls_x509_parse_subject_alt_name(&cur->buf, &san);
+            TEST_ASSERT(ret == 0 || ret == MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE);
             /*
              * If san type not supported, ignore.
              */
-            if( ret == 0)
-                TEST_ASSERT( verify_parse_san( &san, &p, &n ) == 0 );
+            if (ret == 0) {
+                TEST_ASSERT(verify_parse_san(&san, &p, &n) == 0);
+            }
             cur = cur->next;
         }
     }
 
-    TEST_ASSERT( strcmp( buf, result_str ) == 0 );
+    TEST_ASSERT(strcmp(buf, result_str) == 0);
 
 exit:
 
-    mbedtls_x509_crt_free( &crt );
+    mbedtls_x509_crt_free(&crt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C */
-void x509_cert_info( char * crt_file, char * result_str )
+void x509_cert_info(char *crt_file, char *result_str)
 {
     mbedtls_x509_crt   crt;
     char buf[2000];
     int res;
 
-    mbedtls_x509_crt_init( &crt );
-    memset( buf, 0, 2000 );
+    mbedtls_x509_crt_init(&crt);
+    memset(buf, 0, 2000);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &crt, crt_file ) == 0 );
-    res = mbedtls_x509_crt_info( buf, 2000, "", &crt );
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
+    res = mbedtls_x509_crt_info(buf, 2000, "", &crt);
 
-    TEST_ASSERT( res != -1 );
-    TEST_ASSERT( res != -2 );
+    TEST_ASSERT(res != -1);
+    TEST_ASSERT(res != -2);
 
-    TEST_ASSERT( strcmp( buf, result_str ) == 0 );
+    TEST_ASSERT(strcmp(buf, result_str) == 0);
 
 exit:
-    mbedtls_x509_crt_free( &crt );
+    mbedtls_x509_crt_free(&crt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRL_PARSE_C */
-void mbedtls_x509_crl_info( char * crl_file, char * result_str )
+void mbedtls_x509_crl_info(char *crl_file, char *result_str)
 {
     mbedtls_x509_crl   crl;
     char buf[2000];
     int res;
 
-    mbedtls_x509_crl_init( &crl );
-    memset( buf, 0, 2000 );
+    mbedtls_x509_crl_init(&crl);
+    memset(buf, 0, 2000);
 
-    TEST_ASSERT( mbedtls_x509_crl_parse_file( &crl, crl_file ) == 0 );
-    res = mbedtls_x509_crl_info( buf, 2000, "", &crl );
+    TEST_ASSERT(mbedtls_x509_crl_parse_file(&crl, crl_file) == 0);
+    res = mbedtls_x509_crl_info(buf, 2000, "", &crl);
 
-    TEST_ASSERT( res != -1 );
-    TEST_ASSERT( res != -2 );
+    TEST_ASSERT(res != -1);
+    TEST_ASSERT(res != -2);
 
-    TEST_ASSERT( strcmp( buf, result_str ) == 0 );
+    TEST_ASSERT(strcmp(buf, result_str) == 0);
 
 exit:
-    mbedtls_x509_crl_free( &crl );
+    mbedtls_x509_crl_free(&crl);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRL_PARSE_C */
-void mbedtls_x509_crl_parse( char * crl_file, int result )
+void mbedtls_x509_crl_parse(char *crl_file, int result)
 {
     mbedtls_x509_crl   crl;
     char buf[2000];
 
-    mbedtls_x509_crl_init( &crl );
-    memset( buf, 0, 2000 );
+    mbedtls_x509_crl_init(&crl);
+    memset(buf, 0, 2000);
 
-    TEST_ASSERT( mbedtls_x509_crl_parse_file( &crl, crl_file ) == result );
+    TEST_ASSERT(mbedtls_x509_crl_parse_file(&crl, crl_file) == result);
 
 exit:
-    mbedtls_x509_crl_free( &crl );
+    mbedtls_x509_crl_free(&crl);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CSR_PARSE_C */
-void mbedtls_x509_csr_info( char * csr_file, char * result_str )
+void mbedtls_x509_csr_info(char *csr_file, char *result_str)
 {
     mbedtls_x509_csr   csr;
     char buf[2000];
     int res;
 
-    mbedtls_x509_csr_init( &csr );
-    memset( buf, 0, 2000 );
+    mbedtls_x509_csr_init(&csr);
+    memset(buf, 0, 2000);
 
-    TEST_ASSERT( mbedtls_x509_csr_parse_file( &csr, csr_file ) == 0 );
-    res = mbedtls_x509_csr_info( buf, 2000, "", &csr );
+    TEST_ASSERT(mbedtls_x509_csr_parse_file(&csr, csr_file) == 0);
+    res = mbedtls_x509_csr_info(buf, 2000, "", &csr);
 
-    TEST_ASSERT( res != -1 );
-    TEST_ASSERT( res != -2 );
+    TEST_ASSERT(res != -1);
+    TEST_ASSERT(res != -2);
 
-    TEST_ASSERT( strcmp( buf, result_str ) == 0 );
+    TEST_ASSERT(strcmp(buf, result_str) == 0);
 
 exit:
-    mbedtls_x509_csr_free( &csr );
+    mbedtls_x509_csr_free(&csr);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C */
-void x509_verify_info( int flags, char * prefix, char * result_str )
+void x509_verify_info(int flags, char *prefix, char *result_str)
 {
     char buf[2000];
     int res;
 
-    memset( buf, 0, sizeof( buf ) );
+    memset(buf, 0, sizeof(buf));
 
-    res = mbedtls_x509_crt_verify_info( buf, sizeof( buf ), prefix, flags );
+    res = mbedtls_x509_crt_verify_info(buf, sizeof(buf), prefix, flags);
 
-    TEST_ASSERT( res >= 0 );
+    TEST_ASSERT(res >= 0);
 
-    TEST_ASSERT( strcmp( buf, result_str ) == 0 );
+    TEST_ASSERT(strcmp(buf, result_str) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_X509_CRL_PARSE_C:MBEDTLS_ECP_RESTARTABLE:MBEDTLS_ECDSA_C */
-void x509_verify_restart( char *crt_file, char *ca_file,
-                          int result, int flags_result,
-                          int max_ops, int min_restart, int max_restart )
+void x509_verify_restart(char *crt_file, char *ca_file,
+                         int result, int flags_result,
+                         int max_ops, int min_restart, int max_restart)
 {
     int ret, cnt_restart;
     mbedtls_x509_crt_restart_ctx rs_ctx;
@@ -556,46 +557,46 @@
      * - x509_verify() for server10 -> int-ca3 -> int-ca2:  ~ 25500
      */
 
-    mbedtls_x509_crt_restart_init( &rs_ctx );
-    mbedtls_x509_crt_init( &crt );
-    mbedtls_x509_crt_init( &ca );
+    mbedtls_x509_crt_restart_init(&rs_ctx);
+    mbedtls_x509_crt_init(&crt);
+    mbedtls_x509_crt_init(&ca);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &crt, crt_file ) == 0 );
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &ca, ca_file ) == 0 );
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&ca, ca_file) == 0);
 
-    mbedtls_ecp_set_max_ops( max_ops );
+    mbedtls_ecp_set_max_ops(max_ops);
 
     cnt_restart = 0;
     do {
-        ret = mbedtls_x509_crt_verify_restartable( &crt, &ca, NULL,
-                &mbedtls_x509_crt_profile_default, NULL, &flags,
-                NULL, NULL, &rs_ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart );
+        ret = mbedtls_x509_crt_verify_restartable(&crt, &ca, NULL,
+                                                  &mbedtls_x509_crt_profile_default, NULL, &flags,
+                                                  NULL, NULL, &rs_ctx);
+    } while (ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart);
 
-    TEST_ASSERT( ret == result );
-    TEST_ASSERT( flags == (uint32_t) flags_result );
+    TEST_ASSERT(ret == result);
+    TEST_ASSERT(flags == (uint32_t) flags_result);
 
-    TEST_ASSERT( cnt_restart >= min_restart );
-    TEST_ASSERT( cnt_restart <= max_restart );
+    TEST_ASSERT(cnt_restart >= min_restart);
+    TEST_ASSERT(cnt_restart <= max_restart);
 
     /* Do we leak memory when aborting? */
-    ret = mbedtls_x509_crt_verify_restartable( &crt, &ca, NULL,
-            &mbedtls_x509_crt_profile_default, NULL, &flags,
-            NULL, NULL, &rs_ctx );
-    TEST_ASSERT( ret == result || ret == MBEDTLS_ERR_ECP_IN_PROGRESS );
+    ret = mbedtls_x509_crt_verify_restartable(&crt, &ca, NULL,
+                                              &mbedtls_x509_crt_profile_default, NULL, &flags,
+                                              NULL, NULL, &rs_ctx);
+    TEST_ASSERT(ret == result || ret == MBEDTLS_ERR_ECP_IN_PROGRESS);
 
 exit:
-    mbedtls_x509_crt_restart_free( &rs_ctx );
-    mbedtls_x509_crt_free( &crt );
-    mbedtls_x509_crt_free( &ca );
+    mbedtls_x509_crt_restart_free(&rs_ctx);
+    mbedtls_x509_crt_free(&crt);
+    mbedtls_x509_crt_free(&ca);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_X509_CRL_PARSE_C */
-void x509_verify( char *crt_file, char *ca_file, char *crl_file,
-                  char *cn_name_str, int result, int flags_result,
-                  char *profile_str,
-                  char *verify_callback )
+void x509_verify(char *crt_file, char *ca_file, char *crl_file,
+                 char *cn_name_str, int result, int flags_result,
+                 char *profile_str,
+                 char *verify_callback)
 {
     mbedtls_x509_crt   crt;
     mbedtls_x509_crt   ca;
@@ -603,103 +604,120 @@
     uint32_t         flags = 0;
     int         res;
     int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *) = NULL;
-    char *      cn_name = NULL;
+    char *cn_name = NULL;
     const mbedtls_x509_crt_profile *profile;
 
-    mbedtls_x509_crt_init( &crt );
-    mbedtls_x509_crt_init( &ca );
-    mbedtls_x509_crl_init( &crl );
+    mbedtls_x509_crt_init(&crt);
+    mbedtls_x509_crt_init(&ca);
+    mbedtls_x509_crl_init(&crl);
 
-    USE_PSA_INIT( );
+    USE_PSA_INIT();
 
-    if( strcmp( cn_name_str, "NULL" ) != 0 )
+    if (strcmp(cn_name_str, "NULL") != 0) {
         cn_name = cn_name_str;
+    }
 
-    if( strcmp( profile_str, "" ) == 0 )
+    if (strcmp(profile_str, "") == 0) {
         profile = &mbedtls_x509_crt_profile_default;
-    else if( strcmp( profile_str, "next" ) == 0 )
+    } else if (strcmp(profile_str, "next") == 0) {
         profile = &mbedtls_x509_crt_profile_next;
-    else if( strcmp( profile_str, "suite_b" ) == 0 )
+    } else if (strcmp(profile_str, "suite_b") == 0) {
         profile = &mbedtls_x509_crt_profile_suiteb;
-    else if( strcmp( profile_str, "compat" ) == 0 )
+    } else if (strcmp(profile_str, "compat") == 0) {
         profile = &compat_profile;
-    else if( strcmp( profile_str, "all" ) == 0 )
+    } else if (strcmp(profile_str, "all") == 0) {
         profile = &profile_all;
-    else
-        TEST_ASSERT( "Unknown algorithm profile" == 0 );
+    } else {
+        TEST_ASSERT("Unknown algorithm profile" == 0);
+    }
 
-    if( strcmp( verify_callback, "NULL" ) == 0 )
+    if (strcmp(verify_callback, "NULL") == 0) {
         f_vrfy = NULL;
-    else if( strcmp( verify_callback, "verify_none" ) == 0 )
+    } else if (strcmp(verify_callback, "verify_none") == 0) {
         f_vrfy = verify_none;
-    else if( strcmp( verify_callback, "verify_all" ) == 0 )
+    } else if (strcmp(verify_callback, "verify_all") == 0) {
         f_vrfy = verify_all;
-    else
-        TEST_ASSERT( "No known verify callback selected" == 0 );
+    } else {
+        TEST_ASSERT("No known verify callback selected" == 0);
+    }
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &crt, crt_file ) == 0 );
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &ca, ca_file ) == 0 );
-    TEST_ASSERT( mbedtls_x509_crl_parse_file( &crl, crl_file ) == 0 );
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&ca, ca_file) == 0);
+    TEST_ASSERT(mbedtls_x509_crl_parse_file(&crl, crl_file) == 0);
 
-    res = mbedtls_x509_crt_verify_with_profile( &crt, &ca, &crl, profile, cn_name, &flags, f_vrfy, NULL );
+    res = mbedtls_x509_crt_verify_with_profile(&crt,
+                                               &ca,
+                                               &crl,
+                                               profile,
+                                               cn_name,
+                                               &flags,
+                                               f_vrfy,
+                                               NULL);
 
-    TEST_ASSERT( res == ( result ) );
-    TEST_ASSERT( flags == (uint32_t)( flags_result ) );
+    TEST_ASSERT(res == (result));
+    TEST_ASSERT(flags == (uint32_t) (flags_result));
 
 #if defined(MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK)
     /* CRLs aren't supported with CA callbacks, so skip the CA callback
      * version of the test if CRLs are in use. */
-    if( crl_file == NULL || strcmp( crl_file, "" ) == 0 )
-    {
+    if (crl_file == NULL || strcmp(crl_file, "") == 0) {
         flags = 0;
 
-        res = mbedtls_x509_crt_verify_with_ca_cb( &crt, ca_callback, &ca, profile, cn_name, &flags, f_vrfy, NULL );
+        res = mbedtls_x509_crt_verify_with_ca_cb(&crt,
+                                                 ca_callback,
+                                                 &ca,
+                                                 profile,
+                                                 cn_name,
+                                                 &flags,
+                                                 f_vrfy,
+                                                 NULL);
 
-        TEST_ASSERT( res == ( result ) );
-        TEST_ASSERT( flags == (uint32_t)( flags_result ) );
+        TEST_ASSERT(res == (result));
+        TEST_ASSERT(flags == (uint32_t) (flags_result));
     }
 #endif /* MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
 exit:
-    mbedtls_x509_crt_free( &crt );
-    mbedtls_x509_crt_free( &ca );
-    mbedtls_x509_crl_free( &crl );
-    USE_PSA_DONE( );
+    mbedtls_x509_crt_free(&crt);
+    mbedtls_x509_crt_free(&ca);
+    mbedtls_x509_crl_free(&crl);
+    USE_PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_X509_CRL_PARSE_C:MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK */
-void x509_verify_ca_cb_failure( char *crt_file, char *ca_file, char *name,
-                                int exp_ret )
+void x509_verify_ca_cb_failure(char *crt_file, char *ca_file, char *name,
+                               int exp_ret)
 {
     int ret;
     mbedtls_x509_crt crt;
     mbedtls_x509_crt ca;
     uint32_t flags = 0;
 
-    mbedtls_x509_crt_init( &crt );
-    mbedtls_x509_crt_init( &ca );
+    mbedtls_x509_crt_init(&crt);
+    mbedtls_x509_crt_init(&ca);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &crt, crt_file ) == 0 );
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &ca, ca_file ) == 0 );
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&ca, ca_file) == 0);
 
-    if( strcmp( name, "NULL" ) == 0 )
+    if (strcmp(name, "NULL") == 0) {
         name = NULL;
+    }
 
-    ret = mbedtls_x509_crt_verify_with_ca_cb( &crt, ca_callback_fail, &ca,
-                                              &compat_profile, name, &flags,
-                                              NULL, NULL );
+    ret = mbedtls_x509_crt_verify_with_ca_cb(&crt, ca_callback_fail, &ca,
+                                             &compat_profile, name, &flags,
+                                             NULL, NULL);
 
-    TEST_ASSERT( ret == exp_ret );
-    TEST_ASSERT( flags == (uint32_t)( -1 ) );
+    TEST_ASSERT(ret == exp_ret);
+    TEST_ASSERT(flags == (uint32_t) (-1));
 exit:
-    mbedtls_x509_crt_free( &crt );
-    mbedtls_x509_crt_free( &ca );
+    mbedtls_x509_crt_free(&crt);
+    mbedtls_x509_crt_free(&ca);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C */
-void x509_verify_callback( char *crt_file, char *ca_file, char *name,
-                           int exp_ret, char *exp_vrfy_out )
+void x509_verify_callback(char *crt_file, char *ca_file, char *name,
+                          int exp_ret, char *exp_vrfy_out)
 {
     int ret;
     mbedtls_x509_crt crt;
@@ -707,94 +725,96 @@
     uint32_t flags = 0;
     verify_print_context vrfy_ctx;
 
-    mbedtls_x509_crt_init( &crt );
-    mbedtls_x509_crt_init( &ca );
-    verify_print_init( &vrfy_ctx );
+    mbedtls_x509_crt_init(&crt);
+    mbedtls_x509_crt_init(&ca);
+    verify_print_init(&vrfy_ctx);
 
-    USE_PSA_INIT( );
+    USE_PSA_INIT();
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &crt, crt_file ) == 0 );
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &ca, ca_file ) == 0 );
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&ca, ca_file) == 0);
 
-    if( strcmp( name, "NULL" ) == 0 )
+    if (strcmp(name, "NULL") == 0) {
         name = NULL;
+    }
 
-    ret = mbedtls_x509_crt_verify_with_profile( &crt, &ca, NULL,
-                                                &compat_profile,
-                                                name, &flags,
-                                                verify_print, &vrfy_ctx );
+    ret = mbedtls_x509_crt_verify_with_profile(&crt, &ca, NULL,
+                                               &compat_profile,
+                                               name, &flags,
+                                               verify_print, &vrfy_ctx);
 
-    TEST_ASSERT( ret == exp_ret );
-    TEST_ASSERT( strcmp( vrfy_ctx.buf, exp_vrfy_out ) == 0 );
+    TEST_ASSERT(ret == exp_ret);
+    TEST_ASSERT(strcmp(vrfy_ctx.buf, exp_vrfy_out) == 0);
 
 exit:
-    mbedtls_x509_crt_free( &crt );
-    mbedtls_x509_crt_free( &ca );
-    USE_PSA_DONE( );
+    mbedtls_x509_crt_free(&crt);
+    mbedtls_x509_crt_free(&ca);
+    USE_PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C */
-void mbedtls_x509_dn_gets( char * crt_file, char * entity, char * result_str )
+void mbedtls_x509_dn_gets(char *crt_file, char *entity, char *result_str)
 {
     mbedtls_x509_crt   crt;
     char buf[2000];
     int res = 0;
 
-    mbedtls_x509_crt_init( &crt );
-    memset( buf, 0, 2000 );
+    mbedtls_x509_crt_init(&crt);
+    memset(buf, 0, 2000);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &crt, crt_file ) == 0 );
-    if( strcmp( entity, "subject" ) == 0 )
-        res =  mbedtls_x509_dn_gets( buf, 2000, &crt.subject );
-    else if( strcmp( entity, "issuer" ) == 0 )
-        res =  mbedtls_x509_dn_gets( buf, 2000, &crt.issuer );
-    else
-        TEST_ASSERT( "Unknown entity" == 0 );
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
+    if (strcmp(entity, "subject") == 0) {
+        res =  mbedtls_x509_dn_gets(buf, 2000, &crt.subject);
+    } else if (strcmp(entity, "issuer") == 0) {
+        res =  mbedtls_x509_dn_gets(buf, 2000, &crt.issuer);
+    } else {
+        TEST_ASSERT("Unknown entity" == 0);
+    }
 
-    TEST_ASSERT( res != -1 );
-    TEST_ASSERT( res != -2 );
+    TEST_ASSERT(res != -1);
+    TEST_ASSERT(res != -2);
 
-    TEST_ASSERT( strcmp( buf, result_str ) == 0 );
+    TEST_ASSERT(strcmp(buf, result_str) == 0);
 
 exit:
-    mbedtls_x509_crt_free( &crt );
+    mbedtls_x509_crt_free(&crt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_X509_REMOVE_INFO */
-void mbedtls_x509_dn_gets_subject_replace( char * crt_file, char * new_subject_ou, char * result_str, int ret )
+void mbedtls_x509_dn_gets_subject_replace(char *crt_file,
+                                          char *new_subject_ou,
+                                          char *result_str,
+                                          int ret)
 {
     mbedtls_x509_crt   crt;
     char buf[2000];
     int res = 0;
 
-    mbedtls_x509_crt_init( &crt );
-    memset( buf, 0, 2000 );
+    mbedtls_x509_crt_init(&crt);
+    memset(buf, 0, 2000);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &crt, crt_file ) == 0 );
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
     crt.subject.next->val.p = (unsigned char *) new_subject_ou;
-    crt.subject.next->val.len = strlen( new_subject_ou );
+    crt.subject.next->val.len = strlen(new_subject_ou);
 
-    res =  mbedtls_x509_dn_gets( buf, 2000, &crt.subject );
+    res =  mbedtls_x509_dn_gets(buf, 2000, &crt.subject);
 
-    if ( ret != 0 )
-    {
-        TEST_ASSERT( res == ret );
-    }
-    else
-    {
-        TEST_ASSERT( res != -1 );
-        TEST_ASSERT( res != -2 );
-        TEST_ASSERT( strcmp( buf, result_str ) == 0 );
+    if (ret != 0) {
+        TEST_ASSERT(res == ret);
+    } else {
+        TEST_ASSERT(res != -1);
+        TEST_ASSERT(res != -2);
+        TEST_ASSERT(strcmp(buf, result_str) == 0);
     }
 exit:
-    mbedtls_x509_crt_free( &crt );
+    mbedtls_x509_crt_free(&crt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C */
-void mbedtls_x509_get_name( char * rdn_sequence, int exp_ret )
+void mbedtls_x509_get_name(char *rdn_sequence, int exp_ret)
 {
     unsigned char *name;
     unsigned char *p;
@@ -803,160 +823,158 @@
     mbedtls_x509_name *allocated, *prev;
     int ret;
 
-    memset( &head, 0, sizeof( head ) );
+    memset(&head, 0, sizeof(head));
 
-    name = mbedtls_test_unhexify_alloc( rdn_sequence, &name_len );
+    name = mbedtls_test_unhexify_alloc(rdn_sequence, &name_len);
     p = name;
 
-    ret = mbedtls_x509_get_name( &p, ( name + name_len ), &head );
-    if( ret == 0 )
-    {
+    ret = mbedtls_x509_get_name(&p, (name + name_len), &head);
+    if (ret == 0) {
         allocated = head.next;
 
-        while( allocated != NULL )
-        {
+        while (allocated != NULL) {
             prev = allocated;
             allocated = allocated->next;
 
-            mbedtls_free( prev );
+            mbedtls_free(prev);
         }
     }
 
-    TEST_EQUAL( ret, exp_ret );
+    TEST_EQUAL(ret, exp_ret);
 
-    mbedtls_free( name );
+    mbedtls_free(name);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C */
-void mbedtls_x509_time_is_past( char * crt_file, char * entity, int result )
+void mbedtls_x509_time_is_past(char *crt_file, char *entity, int result)
 {
     mbedtls_x509_crt   crt;
 
-    mbedtls_x509_crt_init( &crt );
+    mbedtls_x509_crt_init(&crt);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &crt, crt_file ) == 0 );
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
 
-    if( strcmp( entity, "valid_from" ) == 0 )
-        TEST_ASSERT( mbedtls_x509_time_is_past( &crt.valid_from ) == result );
-    else if( strcmp( entity, "valid_to" ) == 0 )
-        TEST_ASSERT( mbedtls_x509_time_is_past( &crt.valid_to ) == result );
-    else
-        TEST_ASSERT( "Unknown entity" == 0 );
+    if (strcmp(entity, "valid_from") == 0) {
+        TEST_ASSERT(mbedtls_x509_time_is_past(&crt.valid_from) == result);
+    } else if (strcmp(entity, "valid_to") == 0) {
+        TEST_ASSERT(mbedtls_x509_time_is_past(&crt.valid_to) == result);
+    } else {
+        TEST_ASSERT("Unknown entity" == 0);
+    }
 
 exit:
-    mbedtls_x509_crt_free( &crt );
+    mbedtls_x509_crt_free(&crt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C */
-void mbedtls_x509_time_is_future( char * crt_file, char * entity, int result )
+void mbedtls_x509_time_is_future(char *crt_file, char *entity, int result)
 {
     mbedtls_x509_crt   crt;
 
-    mbedtls_x509_crt_init( &crt );
+    mbedtls_x509_crt_init(&crt);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &crt, crt_file ) == 0 );
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
 
-    if( strcmp( entity, "valid_from" ) == 0 )
-        TEST_ASSERT( mbedtls_x509_time_is_future( &crt.valid_from ) == result );
-    else if( strcmp( entity, "valid_to" ) == 0 )
-        TEST_ASSERT( mbedtls_x509_time_is_future( &crt.valid_to ) == result );
-    else
-        TEST_ASSERT( "Unknown entity" == 0 );
+    if (strcmp(entity, "valid_from") == 0) {
+        TEST_ASSERT(mbedtls_x509_time_is_future(&crt.valid_from) == result);
+    } else if (strcmp(entity, "valid_to") == 0) {
+        TEST_ASSERT(mbedtls_x509_time_is_future(&crt.valid_to) == result);
+    } else {
+        TEST_ASSERT("Unknown entity" == 0);
+    }
 
 exit:
-    mbedtls_x509_crt_free( &crt );
+    mbedtls_x509_crt_free(&crt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_FS_IO */
-void x509parse_crt_file( char * crt_file, int result )
+void x509parse_crt_file(char *crt_file, int result)
 {
     mbedtls_x509_crt crt;
 
-    mbedtls_x509_crt_init( &crt );
+    mbedtls_x509_crt_init(&crt);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &crt, crt_file ) == result );
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == result);
 
 exit:
-    mbedtls_x509_crt_free( &crt );
+    mbedtls_x509_crt_free(&crt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C */
-void x509parse_crt( data_t * buf, char * result_str, int result )
+void x509parse_crt(data_t *buf, char *result_str, int result)
 {
     mbedtls_x509_crt   crt;
     unsigned char output[2000];
     int res;
 
-    mbedtls_x509_crt_init( &crt );
-    memset( output, 0, 2000 );
+    mbedtls_x509_crt_init(&crt);
+    memset(output, 0, 2000);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_der( &crt, buf->x, buf->len ) == ( result ) );
-    if( ( result ) == 0 )
-    {
-        res = mbedtls_x509_crt_info( (char *) output, 2000, "", &crt );
+    TEST_ASSERT(mbedtls_x509_crt_parse_der(&crt, buf->x, buf->len) == (result));
+    if ((result) == 0) {
+        res = mbedtls_x509_crt_info((char *) output, 2000, "", &crt);
 
-        TEST_ASSERT( res != -1 );
-        TEST_ASSERT( res != -2 );
+        TEST_ASSERT(res != -1);
+        TEST_ASSERT(res != -2);
 
-        TEST_ASSERT( strcmp( (char *) output, result_str ) == 0 );
+        TEST_ASSERT(strcmp((char *) output, result_str) == 0);
     }
 
-    mbedtls_x509_crt_free( &crt );
-    mbedtls_x509_crt_init( &crt );
-    memset( output, 0, 2000 );
+    mbedtls_x509_crt_free(&crt);
+    mbedtls_x509_crt_init(&crt);
+    memset(output, 0, 2000);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_der_nocopy( &crt, buf->x, buf->len ) == ( result ) );
-    if( ( result ) == 0 )
-    {
-        res = mbedtls_x509_crt_info( (char *) output, 2000, "", &crt );
+    TEST_ASSERT(mbedtls_x509_crt_parse_der_nocopy(&crt, buf->x, buf->len) == (result));
+    if ((result) == 0) {
+        res = mbedtls_x509_crt_info((char *) output, 2000, "", &crt);
 
-        TEST_ASSERT( res != -1 );
-        TEST_ASSERT( res != -2 );
+        TEST_ASSERT(res != -1);
+        TEST_ASSERT(res != -2);
 
-        TEST_ASSERT( strcmp( (char *) output, result_str ) == 0 );
+        TEST_ASSERT(strcmp((char *) output, result_str) == 0);
     }
 
-    mbedtls_x509_crt_free( &crt );
-    mbedtls_x509_crt_init( &crt );
-    memset( output, 0, 2000 );
+    mbedtls_x509_crt_free(&crt);
+    mbedtls_x509_crt_init(&crt);
+    memset(output, 0, 2000);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_der_with_ext_cb( &crt, buf->x, buf->len, 0, NULL, NULL ) == ( result ) );
-    if( ( result ) == 0 )
-    {
-        res = mbedtls_x509_crt_info( (char *) output, 2000, "", &crt );
+    TEST_ASSERT(mbedtls_x509_crt_parse_der_with_ext_cb(&crt, buf->x, buf->len, 0, NULL,
+                                                       NULL) == (result));
+    if ((result) == 0) {
+        res = mbedtls_x509_crt_info((char *) output, 2000, "", &crt);
 
-        TEST_ASSERT( res != -1 );
-        TEST_ASSERT( res != -2 );
+        TEST_ASSERT(res != -1);
+        TEST_ASSERT(res != -2);
 
-        TEST_ASSERT( strcmp( (char *) output, result_str ) == 0 );
+        TEST_ASSERT(strcmp((char *) output, result_str) == 0);
     }
 
-    mbedtls_x509_crt_free( &crt );
-    mbedtls_x509_crt_init( &crt );
-    memset( output, 0, 2000 );
+    mbedtls_x509_crt_free(&crt);
+    mbedtls_x509_crt_init(&crt);
+    memset(output, 0, 2000);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_der_with_ext_cb( &crt, buf->x, buf->len, 1, NULL, NULL ) == ( result ) );
-    if( ( result ) == 0 )
-    {
-        res = mbedtls_x509_crt_info( (char *) output, 2000, "", &crt );
+    TEST_ASSERT(mbedtls_x509_crt_parse_der_with_ext_cb(&crt, buf->x, buf->len, 1, NULL,
+                                                       NULL) == (result));
+    if ((result) == 0) {
+        res = mbedtls_x509_crt_info((char *) output, 2000, "", &crt);
 
-        TEST_ASSERT( res != -1 );
-        TEST_ASSERT( res != -2 );
+        TEST_ASSERT(res != -1);
+        TEST_ASSERT(res != -2);
 
-        TEST_ASSERT( strcmp( (char *) output, result_str ) == 0 );
+        TEST_ASSERT(strcmp((char *) output, result_str) == 0);
     }
 
 exit:
-    mbedtls_x509_crt_free( &crt );
+    mbedtls_x509_crt_free(&crt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C */
-void x509parse_crt_cb( data_t * buf, char * result_str, int result )
+void x509parse_crt_cb(data_t *buf, char *result_str, int result)
 {
     mbedtls_x509_crt   crt;
     mbedtls_x509_buf   oid;
@@ -965,119 +983,119 @@
 
     oid.tag = MBEDTLS_ASN1_OID;
     oid.len = MBEDTLS_OID_SIZE(MBEDTLS_OID_PKIX "\x01\x1F");
-    oid.p = (unsigned char *)MBEDTLS_OID_PKIX "\x01\x1F";
+    oid.p = (unsigned char *) MBEDTLS_OID_PKIX "\x01\x1F";
 
-    mbedtls_x509_crt_init( &crt );
-    memset( output, 0, 2000 );
+    mbedtls_x509_crt_init(&crt);
+    memset(output, 0, 2000);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_der_with_ext_cb( &crt, buf->x, buf->len, 0, parse_crt_ext_cb, &oid ) == ( result ) );
-    if( ( result ) == 0 )
-    {
-        res = mbedtls_x509_crt_info( (char *) output, 2000, "", &crt );
+    TEST_ASSERT(mbedtls_x509_crt_parse_der_with_ext_cb(&crt, buf->x, buf->len, 0, parse_crt_ext_cb,
+                                                       &oid) == (result));
+    if ((result) == 0) {
+        res = mbedtls_x509_crt_info((char *) output, 2000, "", &crt);
 
-        TEST_ASSERT( res != -1 );
-        TEST_ASSERT( res != -2 );
+        TEST_ASSERT(res != -1);
+        TEST_ASSERT(res != -2);
 
-        TEST_ASSERT( strcmp( (char *) output, result_str ) == 0 );
+        TEST_ASSERT(strcmp((char *) output, result_str) == 0);
     }
 
-    mbedtls_x509_crt_free( &crt );
-    mbedtls_x509_crt_init( &crt );
-    memset( output, 0, 2000 );
+    mbedtls_x509_crt_free(&crt);
+    mbedtls_x509_crt_init(&crt);
+    memset(output, 0, 2000);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_der_with_ext_cb( &crt, buf->x, buf->len, 1, parse_crt_ext_cb, &oid ) == ( result ) );
-    if( ( result ) == 0 )
-    {
-        res = mbedtls_x509_crt_info( (char *) output, 2000, "", &crt );
+    TEST_ASSERT(mbedtls_x509_crt_parse_der_with_ext_cb(&crt, buf->x, buf->len, 1, parse_crt_ext_cb,
+                                                       &oid) == (result));
+    if ((result) == 0) {
+        res = mbedtls_x509_crt_info((char *) output, 2000, "", &crt);
 
-        TEST_ASSERT( res != -1 );
-        TEST_ASSERT( res != -2 );
+        TEST_ASSERT(res != -1);
+        TEST_ASSERT(res != -2);
 
-        TEST_ASSERT( strcmp( (char *) output, result_str ) == 0 );
+        TEST_ASSERT(strcmp((char *) output, result_str) == 0);
     }
 
 exit:
-    mbedtls_x509_crt_free( &crt );
+    mbedtls_x509_crt_free(&crt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRL_PARSE_C */
-void x509parse_crl( data_t * buf, char * result_str, int result )
+void x509parse_crl(data_t *buf, char *result_str, int result)
 {
     mbedtls_x509_crl   crl;
     unsigned char output[2000];
     int res;
 
-    mbedtls_x509_crl_init( &crl );
-    memset( output, 0, 2000 );
+    mbedtls_x509_crl_init(&crl);
+    memset(output, 0, 2000);
 
 
-    TEST_ASSERT( mbedtls_x509_crl_parse( &crl, buf->x, buf->len ) == ( result ) );
-    if( ( result ) == 0 )
-    {
-        res = mbedtls_x509_crl_info( (char *) output, 2000, "", &crl );
+    TEST_ASSERT(mbedtls_x509_crl_parse(&crl, buf->x, buf->len) == (result));
+    if ((result) == 0) {
+        res = mbedtls_x509_crl_info((char *) output, 2000, "", &crl);
 
-        TEST_ASSERT( res != -1 );
-        TEST_ASSERT( res != -2 );
+        TEST_ASSERT(res != -1);
+        TEST_ASSERT(res != -2);
 
-        TEST_ASSERT( strcmp( (char *) output, result_str ) == 0 );
+        TEST_ASSERT(strcmp((char *) output, result_str) == 0);
     }
 
 exit:
-    mbedtls_x509_crl_free( &crl );
+    mbedtls_x509_crl_free(&crl);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CSR_PARSE_C */
-void mbedtls_x509_csr_parse( data_t * csr_der, char * ref_out, int ref_ret )
+void mbedtls_x509_csr_parse(data_t *csr_der, char *ref_out, int ref_ret)
 {
     mbedtls_x509_csr csr;
     char my_out[1000];
     int my_ret;
 
-    mbedtls_x509_csr_init( &csr );
-    memset( my_out, 0, sizeof( my_out ) );
+    mbedtls_x509_csr_init(&csr);
+    memset(my_out, 0, sizeof(my_out));
 
-    my_ret = mbedtls_x509_csr_parse_der( &csr, csr_der->x, csr_der->len );
-    TEST_ASSERT( my_ret == ref_ret );
+    my_ret = mbedtls_x509_csr_parse_der(&csr, csr_der->x, csr_der->len);
+    TEST_ASSERT(my_ret == ref_ret);
 
-    if( ref_ret == 0 )
-    {
-        size_t my_out_len = mbedtls_x509_csr_info( my_out, sizeof( my_out ), "", &csr );
-        TEST_ASSERT( my_out_len == strlen( ref_out ) );
-        TEST_ASSERT( strcmp( my_out, ref_out ) == 0 );
+    if (ref_ret == 0) {
+        size_t my_out_len = mbedtls_x509_csr_info(my_out, sizeof(my_out), "", &csr);
+        TEST_ASSERT(my_out_len == strlen(ref_out));
+        TEST_ASSERT(strcmp(my_out, ref_out) == 0);
     }
 
 exit:
-    mbedtls_x509_csr_free( &csr );
+    mbedtls_x509_csr_free(&csr);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C */
-void mbedtls_x509_crt_parse_path( char * crt_path, int ret, int nb_crt )
+void mbedtls_x509_crt_parse_path(char *crt_path, int ret, int nb_crt)
 {
     mbedtls_x509_crt chain, *cur;
     int i;
 
-    mbedtls_x509_crt_init( &chain );
+    mbedtls_x509_crt_init(&chain);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_path( &chain, crt_path ) == ret );
+    TEST_ASSERT(mbedtls_x509_crt_parse_path(&chain, crt_path) == ret);
 
     /* Check how many certs we got */
-    for( i = 0, cur = &chain; cur != NULL; cur = cur->next )
-        if( cur->raw.p != NULL )
+    for (i = 0, cur = &chain; cur != NULL; cur = cur->next) {
+        if (cur->raw.p != NULL) {
             i++;
+        }
+    }
 
-    TEST_ASSERT( i == nb_crt );
+    TEST_ASSERT(i == nb_crt);
 
 exit:
-    mbedtls_x509_crt_free( &chain );
+    mbedtls_x509_crt_free(&chain);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C */
-void mbedtls_x509_crt_verify_max( char *ca_file, char *chain_dir, int nb_int,
-                                  int ret_chk, int flags_chk )
+void mbedtls_x509_crt_verify_max(char *ca_file, char *chain_dir, int nb_int,
+                                 int ret_chk, int flags_chk)
 {
     char file_buf[128];
     int ret;
@@ -1089,80 +1107,82 @@
      * with NN.crt signed by NN-1.crt
      */
 
-    mbedtls_x509_crt_init( &trusted );
-    mbedtls_x509_crt_init( &chain );
+    mbedtls_x509_crt_init(&trusted);
+    mbedtls_x509_crt_init(&chain);
 
-    USE_PSA_INIT( );
+    USE_PSA_INIT();
 
     /* Load trusted root */
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &trusted, ca_file ) == 0 );
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&trusted, ca_file) == 0);
 
     /* Load a chain with nb_int intermediates (from 01 to nb_int),
      * plus one "end-entity" cert (nb_int + 1) */
-    ret = mbedtls_snprintf( file_buf, sizeof file_buf, "%s/c%02d.pem", chain_dir,
-                                                            nb_int + 1 );
-    TEST_ASSERT( ret > 0 && (size_t) ret < sizeof file_buf );
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &chain, file_buf ) == 0 );
+    ret = mbedtls_snprintf(file_buf, sizeof file_buf, "%s/c%02d.pem", chain_dir,
+                           nb_int + 1);
+    TEST_ASSERT(ret > 0 && (size_t) ret < sizeof file_buf);
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&chain, file_buf) == 0);
 
     /* Try to verify that chain */
-    ret = mbedtls_x509_crt_verify( &chain, &trusted, NULL, NULL, &flags,
-                                   NULL, NULL );
-    TEST_ASSERT( ret == ret_chk );
-    TEST_ASSERT( flags == (uint32_t) flags_chk );
+    ret = mbedtls_x509_crt_verify(&chain, &trusted, NULL, NULL, &flags,
+                                  NULL, NULL);
+    TEST_ASSERT(ret == ret_chk);
+    TEST_ASSERT(flags == (uint32_t) flags_chk);
 
 exit:
-    mbedtls_x509_crt_free( &chain );
-    mbedtls_x509_crt_free( &trusted );
-    USE_PSA_DONE( );
+    mbedtls_x509_crt_free(&chain);
+    mbedtls_x509_crt_free(&trusted);
+    USE_PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C */
-void mbedtls_x509_crt_verify_chain(  char *chain_paths, char *trusted_ca,
-                                     int flags_result, int result,
-                                     char *profile_name, int vrfy_fatal_lvls )
+void mbedtls_x509_crt_verify_chain(char *chain_paths, char *trusted_ca,
+                                   int flags_result, int result,
+                                   char *profile_name, int vrfy_fatal_lvls)
 {
-    char* act;
+    char *act;
     uint32_t flags;
     int res;
     mbedtls_x509_crt trusted, chain;
     const mbedtls_x509_crt_profile *profile = NULL;
 
-    mbedtls_x509_crt_init( &chain );
-    mbedtls_x509_crt_init( &trusted );
+    mbedtls_x509_crt_init(&chain);
+    mbedtls_x509_crt_init(&trusted);
 
-    USE_PSA_INIT( );
+    USE_PSA_INIT();
 
-    while( ( act = mystrsep( &chain_paths, " " ) ) != NULL )
-        TEST_ASSERT( mbedtls_x509_crt_parse_file( &chain, act ) == 0 );
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &trusted, trusted_ca ) == 0 );
+    while ((act = mystrsep(&chain_paths, " ")) != NULL) {
+        TEST_ASSERT(mbedtls_x509_crt_parse_file(&chain, act) == 0);
+    }
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&trusted, trusted_ca) == 0);
 
-    if( strcmp( profile_name, "" ) == 0 )
+    if (strcmp(profile_name, "") == 0) {
         profile = &mbedtls_x509_crt_profile_default;
-    else if( strcmp( profile_name, "next" ) == 0 )
+    } else if (strcmp(profile_name, "next") == 0) {
         profile = &mbedtls_x509_crt_profile_next;
-    else if( strcmp( profile_name, "suiteb" ) == 0 )
+    } else if (strcmp(profile_name, "suiteb") == 0) {
         profile = &mbedtls_x509_crt_profile_suiteb;
-    else if( strcmp( profile_name, "rsa3072" ) == 0 )
+    } else if (strcmp(profile_name, "rsa3072") == 0) {
         profile = &profile_rsa3072;
-    else if( strcmp( profile_name, "sha512" ) == 0 )
+    } else if (strcmp(profile_name, "sha512") == 0) {
         profile = &profile_sha512;
+    }
 
-    res = mbedtls_x509_crt_verify_with_profile( &chain, &trusted, NULL, profile,
-            NULL, &flags, verify_fatal, &vrfy_fatal_lvls );
+    res = mbedtls_x509_crt_verify_with_profile(&chain, &trusted, NULL, profile,
+                                               NULL, &flags, verify_fatal, &vrfy_fatal_lvls);
 
-    TEST_ASSERT( res == ( result ) );
-    TEST_ASSERT( flags == (uint32_t)( flags_result ) );
+    TEST_ASSERT(res == (result));
+    TEST_ASSERT(flags == (uint32_t) (flags_result));
 
 exit:
-    mbedtls_x509_crt_free( &trusted );
-    mbedtls_x509_crt_free( &chain );
-    USE_PSA_DONE( );
+    mbedtls_x509_crt_free(&trusted);
+    mbedtls_x509_crt_free(&chain);
+    USE_PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_USE_C */
-void x509_oid_desc( data_t * buf, char * ref_desc )
+void x509_oid_desc(data_t *buf, char *ref_desc)
 {
     mbedtls_x509_buf oid;
     const char *desc = NULL;
@@ -1173,114 +1193,110 @@
     oid.p   = buf->x;
     oid.len   = buf->len;
 
-    ret = mbedtls_oid_get_extended_key_usage( &oid, &desc );
+    ret = mbedtls_oid_get_extended_key_usage(&oid, &desc);
 
-    if( strcmp( ref_desc, "notfound" ) == 0 )
-    {
-        TEST_ASSERT( ret != 0 );
-        TEST_ASSERT( desc == NULL );
-    }
-    else
-    {
-        TEST_ASSERT( ret == 0 );
-        TEST_ASSERT( desc != NULL );
-        TEST_ASSERT( strcmp( desc, ref_desc ) == 0 );
+    if (strcmp(ref_desc, "notfound") == 0) {
+        TEST_ASSERT(ret != 0);
+        TEST_ASSERT(desc == NULL);
+    } else {
+        TEST_ASSERT(ret == 0);
+        TEST_ASSERT(desc != NULL);
+        TEST_ASSERT(strcmp(desc, ref_desc) == 0);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_USE_C */
-void x509_oid_numstr( data_t * oid_buf, char * numstr, int blen, int ret )
+void x509_oid_numstr(data_t *oid_buf, char *numstr, int blen, int ret)
 {
     mbedtls_x509_buf oid;
     char num_buf[100];
 
-    memset( num_buf, 0x2a, sizeof num_buf );
+    memset(num_buf, 0x2a, sizeof num_buf);
 
     oid.tag = MBEDTLS_ASN1_OID;
     oid.p   = oid_buf->x;
     oid.len   = oid_buf->len;
 
-    TEST_ASSERT( (size_t) blen <= sizeof num_buf );
+    TEST_ASSERT((size_t) blen <= sizeof num_buf);
 
-    TEST_ASSERT( mbedtls_oid_get_numeric_string( num_buf, blen, &oid ) == ret );
+    TEST_ASSERT(mbedtls_oid_get_numeric_string(num_buf, blen, &oid) == ret);
 
-    if( ret >= 0 )
-    {
-        TEST_ASSERT( num_buf[ret] == 0 );
-        TEST_ASSERT( strcmp( num_buf, numstr ) == 0 );
+    if (ret >= 0) {
+        TEST_ASSERT(num_buf[ret] == 0);
+        TEST_ASSERT(strcmp(num_buf, numstr) == 0);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_X509_CHECK_KEY_USAGE */
-void x509_check_key_usage( char * crt_file, int usage, int ret )
+void x509_check_key_usage(char *crt_file, int usage, int ret)
 {
     mbedtls_x509_crt crt;
 
-    mbedtls_x509_crt_init( &crt );
+    mbedtls_x509_crt_init(&crt);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &crt, crt_file ) == 0 );
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
 
-    TEST_ASSERT( mbedtls_x509_crt_check_key_usage( &crt, usage ) == ret );
+    TEST_ASSERT(mbedtls_x509_crt_check_key_usage(&crt, usage) == ret);
 
 exit:
-    mbedtls_x509_crt_free( &crt );
+    mbedtls_x509_crt_free(&crt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE */
-void x509_check_extended_key_usage( char * crt_file, data_t * oid, int ret
-                                    )
+void x509_check_extended_key_usage(char *crt_file, data_t *oid, int ret
+                                   )
 {
     mbedtls_x509_crt crt;
 
-    mbedtls_x509_crt_init( &crt );
+    mbedtls_x509_crt_init(&crt);
 
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_file( &crt, crt_file ) == 0 );
+    TEST_ASSERT(mbedtls_x509_crt_parse_file(&crt, crt_file) == 0);
 
-    TEST_ASSERT( mbedtls_x509_crt_check_extended_key_usage( &crt, (const char *)oid->x, oid->len ) == ret );
+    TEST_ASSERT(mbedtls_x509_crt_check_extended_key_usage(&crt, (const char *) oid->x,
+                                                          oid->len) == ret);
 
 exit:
-    mbedtls_x509_crt_free( &crt );
+    mbedtls_x509_crt_free(&crt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_USE_C */
-void x509_get_time( int tag, char * time_str, int ret, int year, int mon,
-                    int day, int hour, int min, int sec )
+void x509_get_time(int tag, char *time_str, int ret, int year, int mon,
+                   int day, int hour, int min, int sec)
 {
     mbedtls_x509_time time;
     unsigned char buf[21];
-    unsigned char* start = buf;
-    unsigned char* end = buf;
+    unsigned char *start = buf;
+    unsigned char *end = buf;
 
-    memset( &time, 0x00, sizeof( time ) );
-    *end = (unsigned char)tag; end++;
-    *end = strlen( time_str );
-    TEST_ASSERT( *end < 20 );
+    memset(&time, 0x00, sizeof(time));
+    *end = (unsigned char) tag; end++;
+    *end = strlen(time_str);
+    TEST_ASSERT(*end < 20);
     end++;
-    memcpy( end, time_str, (size_t)*(end - 1) );
+    memcpy(end, time_str, (size_t) *(end - 1));
     end += *(end - 1);
 
-    TEST_ASSERT( mbedtls_x509_get_time( &start, end, &time ) == ret );
-    if( ret == 0 )
-    {
-        TEST_ASSERT( year == time.year );
-        TEST_ASSERT( mon  == time.mon  );
-        TEST_ASSERT( day  == time.day  );
-        TEST_ASSERT( hour == time.hour );
-        TEST_ASSERT( min  == time.min  );
-        TEST_ASSERT( sec  == time.sec  );
+    TEST_ASSERT(mbedtls_x509_get_time(&start, end, &time) == ret);
+    if (ret == 0) {
+        TEST_ASSERT(year == time.year);
+        TEST_ASSERT(mon  == time.mon);
+        TEST_ASSERT(day  == time.day);
+        TEST_ASSERT(hour == time.hour);
+        TEST_ASSERT(min  == time.min);
+        TEST_ASSERT(sec  == time.sec);
     }
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_X509_RSASSA_PSS_SUPPORT */
-void x509_parse_rsassa_pss_params( data_t * params, int params_tag,
-                                   int ref_msg_md, int ref_mgf_md,
-                                   int ref_salt_len, int ref_ret )
+void x509_parse_rsassa_pss_params(data_t *params, int params_tag,
+                                  int ref_msg_md, int ref_mgf_md,
+                                  int ref_salt_len, int ref_ret)
 {
     int my_ret;
     mbedtls_x509_buf buf;
@@ -1291,16 +1307,15 @@
     buf.len = params->len;
     buf.tag = params_tag;
 
-    my_ret = mbedtls_x509_get_rsassa_pss_params( &buf, &my_msg_md, &my_mgf_md,
-                                                 &my_salt_len );
+    my_ret = mbedtls_x509_get_rsassa_pss_params(&buf, &my_msg_md, &my_mgf_md,
+                                                &my_salt_len);
 
-    TEST_ASSERT( my_ret == ref_ret );
+    TEST_ASSERT(my_ret == ref_ret);
 
-    if( ref_ret == 0 )
-    {
-        TEST_ASSERT( my_msg_md == (mbedtls_md_type_t) ref_msg_md );
-        TEST_ASSERT( my_mgf_md == (mbedtls_md_type_t) ref_mgf_md );
-        TEST_ASSERT( my_salt_len == ref_salt_len );
+    if (ref_ret == 0) {
+        TEST_ASSERT(my_msg_md == (mbedtls_md_type_t) ref_msg_md);
+        TEST_ASSERT(my_mgf_md == (mbedtls_md_type_t) ref_mgf_md);
+        TEST_ASSERT(my_salt_len == ref_salt_len);
     }
 
 exit:
@@ -1309,8 +1324,8 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_SELF_TEST */
-void x509_selftest(  )
+void x509_selftest()
 {
-    TEST_ASSERT( mbedtls_x509_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_x509_self_test(1) == 0);
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_x509write.function b/tests/suites/test_suite_x509write.function
index b27a252..84da143 100644
--- a/tests/suites/test_suite_x509write.function
+++ b/tests/suites/test_suite_x509write.function
@@ -8,64 +8,61 @@
 #include "mbedtls/asn1write.h"
 
 #if defined(MBEDTLS_RSA_C)
-int mbedtls_rsa_decrypt_func( void *ctx, int mode, size_t *olen,
-                       const unsigned char *input, unsigned char *output,
-                       size_t output_max_len )
+int mbedtls_rsa_decrypt_func(void *ctx, int mode, size_t *olen,
+                             const unsigned char *input, unsigned char *output,
+                             size_t output_max_len)
 {
-    return( mbedtls_rsa_pkcs1_decrypt( (mbedtls_rsa_context *) ctx, NULL, NULL, mode, olen,
-                               input, output, output_max_len ) );
+    return mbedtls_rsa_pkcs1_decrypt((mbedtls_rsa_context *) ctx, NULL, NULL, mode, olen,
+                                     input, output, output_max_len);
 }
-int mbedtls_rsa_sign_func( void *ctx,
-                   int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
-                   int mode, mbedtls_md_type_t md_alg, unsigned int hashlen,
-                   const unsigned char *hash, unsigned char *sig )
+int mbedtls_rsa_sign_func(void *ctx,
+                          int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
+                          int mode, mbedtls_md_type_t md_alg, unsigned int hashlen,
+                          const unsigned char *hash, unsigned char *sig)
 {
-    return( mbedtls_rsa_pkcs1_sign( (mbedtls_rsa_context *) ctx, f_rng, p_rng, mode,
-                            md_alg, hashlen, hash, sig ) );
+    return mbedtls_rsa_pkcs1_sign((mbedtls_rsa_context *) ctx, f_rng, p_rng, mode,
+                                  md_alg, hashlen, hash, sig);
 }
-size_t mbedtls_rsa_key_len_func( void *ctx )
+size_t mbedtls_rsa_key_len_func(void *ctx)
 {
-    return( ((const mbedtls_rsa_context *) ctx)->len );
+    return ((const mbedtls_rsa_context *) ctx)->len;
 }
 #endif /* MBEDTLS_RSA_C */
 
 #if defined(MBEDTLS_USE_PSA_CRYPTO) && \
     defined(MBEDTLS_PEM_WRITE_C) && defined(MBEDTLS_X509_CSR_WRITE_C)
-static int x509_crt_verifycsr( const unsigned char *buf, size_t buflen )
+static int x509_crt_verifycsr(const unsigned char *buf, size_t buflen)
 {
     unsigned char hash[MBEDTLS_MD_MAX_SIZE];
     const mbedtls_md_info_t *md_info;
     mbedtls_x509_csr csr;
     int ret = 0;
 
-    mbedtls_x509_csr_init( &csr );
+    mbedtls_x509_csr_init(&csr);
 
-    if( mbedtls_x509_csr_parse( &csr, buf, buflen ) != 0 )
-    {
+    if (mbedtls_x509_csr_parse(&csr, buf, buflen) != 0) {
         ret = MBEDTLS_ERR_X509_BAD_INPUT_DATA;
         goto cleanup;
     }
 
-    md_info = mbedtls_md_info_from_type( csr.sig_md );
-    if( mbedtls_md( md_info, csr.cri.p, csr.cri.len, hash ) != 0 )
-    {
+    md_info = mbedtls_md_info_from_type(csr.sig_md);
+    if (mbedtls_md(md_info, csr.cri.p, csr.cri.len, hash) != 0) {
         /* Note: this can't happen except after an internal error */
         ret = MBEDTLS_ERR_X509_BAD_INPUT_DATA;
         goto cleanup;
     }
 
-    if( mbedtls_pk_verify_ext( csr.sig_pk, csr.sig_opts, &csr.pk,
-                       csr.sig_md, hash, mbedtls_md_get_size( md_info ),
-                       csr.sig.p, csr.sig.len ) != 0 )
-    {
+    if (mbedtls_pk_verify_ext(csr.sig_pk, csr.sig_opts, &csr.pk,
+                              csr.sig_md, hash, mbedtls_md_get_size(md_info),
+                              csr.sig.p, csr.sig.len) != 0) {
         ret = MBEDTLS_ERR_X509_CERT_VERIFY_FAILED;
         goto cleanup;
     }
 
 cleanup:
 
-    mbedtls_x509_csr_free( &csr );
-    return( ret );
+    mbedtls_x509_csr_free(&csr);
+    return ret;
 }
 #endif /* MBEDTLS_USE_PSA_CRYPTO && MBEDTLS_PEM_WRITE_C && MBEDTLS_X509_CSR_WRITE_C */
 
@@ -91,11 +88,11 @@
  */
 #define EXT_KEY_USAGE_TMP_BUF_MAX_LENGTH    12
 
-static int csr_set_extended_key_usage( mbedtls_x509write_csr *ctx,
-                        const char *oid, size_t oid_len )
+static int csr_set_extended_key_usage(mbedtls_x509write_csr *ctx,
+                                      const char *oid, size_t oid_len)
 {
     unsigned char buf[EXT_KEY_USAGE_TMP_BUF_MAX_LENGTH] = { 0 };
-    unsigned char *p = buf + sizeof( buf );
+    unsigned char *p = buf + sizeof(buf);
     int ret;
     size_t len = 0;
 
@@ -103,18 +100,21 @@
      * Following functions fail anyway if the temporary buffer is not large,
      * but we set an extra check here to emphasize a possible source of errors
      */
-    if ( oid_len > EXT_KEY_USAGE_TMP_BUF_MAX_LENGTH )
-    {
+    if (oid_len > EXT_KEY_USAGE_TMP_BUF_MAX_LENGTH) {
         return MBEDTLS_ERR_X509_BAD_INPUT_DATA;
     }
 
-    MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_oid( &p, buf, oid, oid_len ) );
-    MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( &p, buf, ret ) );
-    MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( &p, buf,
-                        MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) );
+    MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_oid(&p, buf, oid, oid_len));
+    MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_len(&p, buf, ret));
+    MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_tag(&p, buf,
+                                                     MBEDTLS_ASN1_CONSTRUCTED |
+                                                     MBEDTLS_ASN1_SEQUENCE));
 
-    ret = mbedtls_x509write_csr_set_extension( ctx, MBEDTLS_OID_EXTENDED_KEY_USAGE,
-              MBEDTLS_OID_SIZE( MBEDTLS_OID_EXTENDED_KEY_USAGE ), p, len );
+    ret = mbedtls_x509write_csr_set_extension(ctx,
+                                              MBEDTLS_OID_EXTENDED_KEY_USAGE,
+                                              MBEDTLS_OID_SIZE(MBEDTLS_OID_EXTENDED_KEY_USAGE),
+                                              p,
+                                              len);
 
     return ret;
 }
@@ -127,9 +127,9 @@
  */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PEM_WRITE_C:MBEDTLS_X509_CSR_WRITE_C */
-void x509_csr_check( char * key_file, char * cert_req_check_file, int md_type,
-                     int key_usage, int set_key_usage, int cert_type,
-                     int set_cert_type, int set_extension )
+void x509_csr_check(char *key_file, char *cert_req_check_file, int md_type,
+                    int key_usage, int set_key_usage, int cert_type,
+                    int set_cert_type, int set_extension)
 {
     mbedtls_pk_context key;
     mbedtls_x509write_csr req;
@@ -142,64 +142,67 @@
     const char *subject_name = "C=NL,O=PolarSSL,CN=PolarSSL Server 1";
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    memset( &rnd_info, 0x2a, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    memset(&rnd_info, 0x2a, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    mbedtls_x509write_csr_init( &req );
+    mbedtls_x509write_csr_init(&req);
 
-    mbedtls_pk_init( &key );
-    TEST_ASSERT( mbedtls_pk_parse_keyfile( &key, key_file, NULL ) == 0 );
+    mbedtls_pk_init(&key);
+    TEST_ASSERT(mbedtls_pk_parse_keyfile(&key, key_file, NULL) == 0);
 
-    mbedtls_x509write_csr_set_md_alg( &req, md_type );
-    mbedtls_x509write_csr_set_key( &req, &key );
-    TEST_ASSERT( mbedtls_x509write_csr_set_subject_name( &req, subject_name ) == 0 );
-    if( set_key_usage != 0 )
-        TEST_ASSERT( mbedtls_x509write_csr_set_key_usage( &req, key_usage ) == 0 );
-    if( set_cert_type != 0 )
-        TEST_ASSERT( mbedtls_x509write_csr_set_ns_cert_type( &req, cert_type ) == 0 );
-    if ( set_extension != 0 )
-        TEST_ASSERT( csr_set_extended_key_usage( &req, MBEDTLS_OID_SERVER_AUTH,
-                            MBEDTLS_OID_SIZE( MBEDTLS_OID_SERVER_AUTH ) ) == 0 );
-
-    ret = mbedtls_x509write_csr_pem( &req, buf, sizeof( buf ),
-                                     mbedtls_test_rnd_pseudo_rand, &rnd_info );
-    TEST_ASSERT( ret == 0 );
-
-    pem_len = strlen( (char *) buf );
-
-    for( buf_index = pem_len; buf_index < sizeof( buf ); ++buf_index )
-    {
-        TEST_ASSERT( buf[buf_index] == 0 );
+    mbedtls_x509write_csr_set_md_alg(&req, md_type);
+    mbedtls_x509write_csr_set_key(&req, &key);
+    TEST_ASSERT(mbedtls_x509write_csr_set_subject_name(&req, subject_name) == 0);
+    if (set_key_usage != 0) {
+        TEST_ASSERT(mbedtls_x509write_csr_set_key_usage(&req, key_usage) == 0);
+    }
+    if (set_cert_type != 0) {
+        TEST_ASSERT(mbedtls_x509write_csr_set_ns_cert_type(&req, cert_type) == 0);
+    }
+    if (set_extension != 0) {
+        TEST_ASSERT(csr_set_extended_key_usage(&req, MBEDTLS_OID_SERVER_AUTH,
+                                               MBEDTLS_OID_SIZE(MBEDTLS_OID_SERVER_AUTH)) == 0);
     }
 
-    f = fopen( cert_req_check_file, "r" );
-    TEST_ASSERT( f != NULL );
-    olen = fread( check_buf, 1, sizeof( check_buf ), f );
-    fclose( f );
+    ret = mbedtls_x509write_csr_pem(&req, buf, sizeof(buf),
+                                    mbedtls_test_rnd_pseudo_rand, &rnd_info);
+    TEST_ASSERT(ret == 0);
 
-    TEST_ASSERT( olen >= pem_len - 1 );
-    TEST_ASSERT( memcmp( buf, check_buf, pem_len - 1 ) == 0 );
+    pem_len = strlen((char *) buf);
 
-    der_len = mbedtls_x509write_csr_der( &req, buf, sizeof( buf ),
-                                         mbedtls_test_rnd_pseudo_rand,
-                                         &rnd_info );
-    TEST_ASSERT( der_len >= 0 );
+    for (buf_index = pem_len; buf_index < sizeof(buf); ++buf_index) {
+        TEST_ASSERT(buf[buf_index] == 0);
+    }
 
-    if( der_len == 0 )
+    f = fopen(cert_req_check_file, "r");
+    TEST_ASSERT(f != NULL);
+    olen = fread(check_buf, 1, sizeof(check_buf), f);
+    fclose(f);
+
+    TEST_ASSERT(olen >= pem_len - 1);
+    TEST_ASSERT(memcmp(buf, check_buf, pem_len - 1) == 0);
+
+    der_len = mbedtls_x509write_csr_der(&req, buf, sizeof(buf),
+                                        mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info);
+    TEST_ASSERT(der_len >= 0);
+
+    if (der_len == 0) {
         goto exit;
+    }
 
-    ret = mbedtls_x509write_csr_der( &req, buf, (size_t)( der_len - 1 ),
-                                     mbedtls_test_rnd_pseudo_rand, &rnd_info );
-    TEST_ASSERT( ret == MBEDTLS_ERR_ASN1_BUF_TOO_SMALL );
+    ret = mbedtls_x509write_csr_der(&req, buf, (size_t) (der_len - 1),
+                                    mbedtls_test_rnd_pseudo_rand, &rnd_info);
+    TEST_ASSERT(ret == MBEDTLS_ERR_ASN1_BUF_TOO_SMALL);
 
 exit:
-    mbedtls_x509write_csr_free( &req );
-    mbedtls_pk_free( &key );
+    mbedtls_x509write_csr_free(&req);
+    mbedtls_pk_free(&key);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PEM_WRITE_C:MBEDTLS_X509_CSR_WRITE_C:MBEDTLS_USE_PSA_CRYPTO */
-void x509_csr_check_opaque( char *key_file, int md_type, int key_usage,
-                                 int cert_type )
+void x509_csr_check_opaque(char *key_file, int md_type, int key_usage,
+                           int cert_type)
 {
     mbedtls_pk_context key;
     mbedtls_svc_key_id_t key_id = MBEDTLS_SVC_KEY_ID_INIT;
@@ -211,53 +214,55 @@
     const char *subject_name = "C=NL,O=PolarSSL,CN=PolarSSL Server 1";
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    memset( &rnd_info, 0x2a, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    memset(&rnd_info, 0x2a, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    mbedtls_x509write_csr_init( &req );
+    mbedtls_x509write_csr_init(&req);
 
-    USE_PSA_INIT( );
+    USE_PSA_INIT();
 
-    md_alg_psa = mbedtls_psa_translate_md( (mbedtls_md_type_t) md_type );
-    TEST_ASSERT( md_alg_psa != MBEDTLS_MD_NONE );
+    md_alg_psa = mbedtls_psa_translate_md((mbedtls_md_type_t) md_type);
+    TEST_ASSERT(md_alg_psa != MBEDTLS_MD_NONE);
 
-    mbedtls_pk_init( &key );
-    TEST_ASSERT( mbedtls_pk_parse_keyfile( &key, key_file, NULL ) == 0 );
-    TEST_ASSERT( mbedtls_pk_wrap_as_opaque( &key, &key_id, md_alg_psa ) == 0 );
+    mbedtls_pk_init(&key);
+    TEST_ASSERT(mbedtls_pk_parse_keyfile(&key, key_file, NULL) == 0);
+    TEST_ASSERT(mbedtls_pk_wrap_as_opaque(&key, &key_id, md_alg_psa) == 0);
 
-    mbedtls_x509write_csr_set_md_alg( &req, md_type );
-    mbedtls_x509write_csr_set_key( &req, &key );
-    TEST_ASSERT( mbedtls_x509write_csr_set_subject_name( &req, subject_name ) == 0 );
-    if( key_usage != 0 )
-        TEST_ASSERT( mbedtls_x509write_csr_set_key_usage( &req, key_usage ) == 0 );
-    if( cert_type != 0 )
-        TEST_ASSERT( mbedtls_x509write_csr_set_ns_cert_type( &req, cert_type ) == 0 );
+    mbedtls_x509write_csr_set_md_alg(&req, md_type);
+    mbedtls_x509write_csr_set_key(&req, &key);
+    TEST_ASSERT(mbedtls_x509write_csr_set_subject_name(&req, subject_name) == 0);
+    if (key_usage != 0) {
+        TEST_ASSERT(mbedtls_x509write_csr_set_key_usage(&req, key_usage) == 0);
+    }
+    if (cert_type != 0) {
+        TEST_ASSERT(mbedtls_x509write_csr_set_ns_cert_type(&req, cert_type) == 0);
+    }
 
-    ret = mbedtls_x509write_csr_pem( &req, buf, sizeof( buf ) - 1,
-                                     mbedtls_test_rnd_pseudo_rand, &rnd_info );
+    ret = mbedtls_x509write_csr_pem(&req, buf, sizeof(buf) - 1,
+                                    mbedtls_test_rnd_pseudo_rand, &rnd_info);
 
-    TEST_ASSERT( ret == 0 );
+    TEST_ASSERT(ret == 0);
 
-    pem_len = strlen( (char *) buf );
+    pem_len = strlen((char *) buf);
     buf[pem_len] = '\0';
-    TEST_ASSERT( x509_crt_verifycsr( buf, pem_len + 1 ) == 0 );
+    TEST_ASSERT(x509_crt_verifycsr(buf, pem_len + 1) == 0);
 
 
 exit:
-    mbedtls_x509write_csr_free( &req );
-    mbedtls_pk_free( &key );
-    psa_destroy_key( key_id );
-    PSA_DONE( );
+    mbedtls_x509write_csr_free(&req);
+    mbedtls_pk_free(&key);
+    psa_destroy_key(key_id);
+    PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_PEM_WRITE_C:MBEDTLS_X509_CRT_WRITE_C:MBEDTLS_SHA1_C */
-void x509_crt_check( char *subject_key_file, char *subject_pwd,
-                     char *subject_name, char *issuer_key_file,
-                     char *issuer_pwd, char *issuer_name,
-                     char *serial_str, char *not_before, char *not_after,
-                     int md_type, int key_usage, int set_key_usage,
-                     int cert_type, int set_cert_type, int auth_ident,
-                     int ver, char *cert_check_file, int rsa_alt, int is_ca )
+void x509_crt_check(char *subject_key_file, char *subject_pwd,
+                    char *subject_name, char *issuer_key_file,
+                    char *issuer_pwd, char *issuer_name,
+                    char *serial_str, char *not_before, char *not_after,
+                    int md_type, int key_usage, int set_key_usage,
+                    int cert_type, int set_cert_type, int auth_ident,
+                    int ver, char *cert_check_file, int rsa_alt, int is_ca)
 {
     mbedtls_pk_context subject_key, issuer_key, issuer_key_alt;
     mbedtls_pk_context *key = &issuer_key;
@@ -274,30 +279,29 @@
     FILE *f;
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    memset( &rnd_info, 0x2a, sizeof( mbedtls_test_rnd_pseudo_info ) );
-    mbedtls_mpi_init( &serial );
+    memset(&rnd_info, 0x2a, sizeof(mbedtls_test_rnd_pseudo_info));
+    mbedtls_mpi_init(&serial);
 
-    mbedtls_pk_init( &subject_key );
-    mbedtls_pk_init( &issuer_key  );
-    mbedtls_pk_init( &issuer_key_alt );
+    mbedtls_pk_init(&subject_key);
+    mbedtls_pk_init(&issuer_key);
+    mbedtls_pk_init(&issuer_key_alt);
 
-    mbedtls_x509write_crt_init( &crt );
+    mbedtls_x509write_crt_init(&crt);
 
-    TEST_ASSERT( mbedtls_pk_parse_keyfile( &subject_key, subject_key_file,
-                                         subject_pwd ) == 0 );
+    TEST_ASSERT(mbedtls_pk_parse_keyfile(&subject_key, subject_key_file,
+                                         subject_pwd) == 0);
 
-    TEST_ASSERT( mbedtls_pk_parse_keyfile( &issuer_key, issuer_key_file,
-                                         issuer_pwd ) == 0 );
+    TEST_ASSERT(mbedtls_pk_parse_keyfile(&issuer_key, issuer_key_file,
+                                         issuer_pwd) == 0);
 
 #if defined(MBEDTLS_RSA_C)
     /* For RSA PK contexts, create a copy as an alternative RSA context. */
-    if( rsa_alt == 1 && mbedtls_pk_get_type( &issuer_key ) == MBEDTLS_PK_RSA )
-    {
-        TEST_ASSERT( mbedtls_pk_setup_rsa_alt( &issuer_key_alt,
-                                            mbedtls_pk_rsa( issuer_key ),
-                                            mbedtls_rsa_decrypt_func,
-                                            mbedtls_rsa_sign_func,
-                                            mbedtls_rsa_key_len_func ) == 0 );
+    if (rsa_alt == 1 && mbedtls_pk_get_type(&issuer_key) == MBEDTLS_PK_RSA) {
+        TEST_ASSERT(mbedtls_pk_setup_rsa_alt(&issuer_key_alt,
+                                             mbedtls_pk_rsa(issuer_key),
+                                             mbedtls_rsa_decrypt_func,
+                                             mbedtls_rsa_sign_func,
+                                             mbedtls_rsa_key_len_func) == 0);
 
         key = &issuer_key_alt;
     }
@@ -305,130 +309,125 @@
     (void) rsa_alt;
 #endif
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &serial, serial_str ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&serial, serial_str) == 0);
 
-    if( ver != -1 )
-        mbedtls_x509write_crt_set_version( &crt, ver );
-
-    TEST_ASSERT( mbedtls_x509write_crt_set_serial( &crt, &serial ) == 0 );
-    TEST_ASSERT( mbedtls_x509write_crt_set_validity( &crt, not_before,
-                                                     not_after ) == 0 );
-    mbedtls_x509write_crt_set_md_alg( &crt, md_type );
-    TEST_ASSERT( mbedtls_x509write_crt_set_issuer_name( &crt, issuer_name ) == 0 );
-    TEST_ASSERT( mbedtls_x509write_crt_set_subject_name( &crt, subject_name ) == 0 );
-    mbedtls_x509write_crt_set_subject_key( &crt, &subject_key );
-
-    mbedtls_x509write_crt_set_issuer_key( &crt, key );
-
-    if( crt.version >= MBEDTLS_X509_CRT_VERSION_3 )
-    {
-        /* For the CA case, a path length of -1 means unlimited. */
-        TEST_ASSERT( mbedtls_x509write_crt_set_basic_constraints( &crt, is_ca,
-                                                                  (is_ca ? -1 : 0) ) == 0 );
-        TEST_ASSERT( mbedtls_x509write_crt_set_subject_key_identifier( &crt ) == 0 );
-        if( auth_ident )
-            TEST_ASSERT( mbedtls_x509write_crt_set_authority_key_identifier( &crt ) == 0 );
-        if( set_key_usage != 0 )
-            TEST_ASSERT( mbedtls_x509write_crt_set_key_usage( &crt, key_usage ) == 0 );
-        if( set_cert_type != 0 )
-            TEST_ASSERT( mbedtls_x509write_crt_set_ns_cert_type( &crt, cert_type ) == 0 );
+    if (ver != -1) {
+        mbedtls_x509write_crt_set_version(&crt, ver);
     }
 
-    ret = mbedtls_x509write_crt_pem( &crt, buf, sizeof( buf ),
-                                     mbedtls_test_rnd_pseudo_rand, &rnd_info );
-    TEST_ASSERT( ret == 0 );
+    TEST_ASSERT(mbedtls_x509write_crt_set_serial(&crt, &serial) == 0);
+    TEST_ASSERT(mbedtls_x509write_crt_set_validity(&crt, not_before,
+                                                   not_after) == 0);
+    mbedtls_x509write_crt_set_md_alg(&crt, md_type);
+    TEST_ASSERT(mbedtls_x509write_crt_set_issuer_name(&crt, issuer_name) == 0);
+    TEST_ASSERT(mbedtls_x509write_crt_set_subject_name(&crt, subject_name) == 0);
+    mbedtls_x509write_crt_set_subject_key(&crt, &subject_key);
 
-    pem_len = strlen( (char *) buf );
+    mbedtls_x509write_crt_set_issuer_key(&crt, key);
+
+    if (crt.version >= MBEDTLS_X509_CRT_VERSION_3) {
+        /* For the CA case, a path length of -1 means unlimited. */
+        TEST_ASSERT(mbedtls_x509write_crt_set_basic_constraints(&crt, is_ca,
+                                                                (is_ca ? -1 : 0)) == 0);
+        TEST_ASSERT(mbedtls_x509write_crt_set_subject_key_identifier(&crt) == 0);
+        if (auth_ident) {
+            TEST_ASSERT(mbedtls_x509write_crt_set_authority_key_identifier(&crt) == 0);
+        }
+        if (set_key_usage != 0) {
+            TEST_ASSERT(mbedtls_x509write_crt_set_key_usage(&crt, key_usage) == 0);
+        }
+        if (set_cert_type != 0) {
+            TEST_ASSERT(mbedtls_x509write_crt_set_ns_cert_type(&crt, cert_type) == 0);
+        }
+    }
+
+    ret = mbedtls_x509write_crt_pem(&crt, buf, sizeof(buf),
+                                    mbedtls_test_rnd_pseudo_rand, &rnd_info);
+    TEST_ASSERT(ret == 0);
+
+    pem_len = strlen((char *) buf);
 
     // check that the rest of the buffer remains clear
-    for( buf_index = pem_len; buf_index < sizeof( buf ); ++buf_index )
-    {
-        TEST_ASSERT( buf[buf_index] == 0 );
+    for (buf_index = pem_len; buf_index < sizeof(buf); ++buf_index) {
+        TEST_ASSERT(buf[buf_index] == 0);
     }
 
-    if( *cert_check_file != '\0' )
-    {
-        f = fopen( cert_check_file, "r" );
-        TEST_ASSERT( f != NULL );
-        olen = fread( check_buf, 1, sizeof( check_buf ), f );
-        fclose( f );
-        TEST_ASSERT( olen < sizeof( check_buf ) );
-        TEST_ASSERT( olen >= pem_len - 1 );
-        TEST_ASSERT( memcmp( buf, check_buf, pem_len - 1 ) == 0 );
+    if (*cert_check_file != '\0') {
+        f = fopen(cert_check_file, "r");
+        TEST_ASSERT(f != NULL);
+        olen = fread(check_buf, 1, sizeof(check_buf), f);
+        fclose(f);
+        TEST_ASSERT(olen < sizeof(check_buf));
+        TEST_ASSERT(olen >= pem_len - 1);
+        TEST_ASSERT(memcmp(buf, check_buf, pem_len - 1) == 0);
     }
 
-    der_len = mbedtls_x509write_crt_der( &crt, buf, sizeof( buf ),
-                                         mbedtls_test_rnd_pseudo_rand,
-                                         &rnd_info );
-    TEST_ASSERT( der_len >= 0 );
+    der_len = mbedtls_x509write_crt_der(&crt, buf, sizeof(buf),
+                                        mbedtls_test_rnd_pseudo_rand,
+                                        &rnd_info);
+    TEST_ASSERT(der_len >= 0);
 
-    if( der_len == 0 )
+    if (der_len == 0) {
         goto exit;
+    }
 
     // Not testing against file, check date format
-    if( *cert_check_file == '\0' )
-    {
+    if (*cert_check_file == '\0') {
         // UTC tag if before 2050, 2 digits less for year
-        if( not_before[0] == '2' && ( not_before[1] > '0' || not_before[2] > '4' ) )
-        {
+        if (not_before[0] == '2' && (not_before[1] > '0' || not_before[2] > '4')) {
             before_tag = MBEDTLS_ASN1_GENERALIZED_TIME;
-        }
-        else
-        {
+        } else {
             before_tag = MBEDTLS_ASN1_UTC_TIME;
             not_before += 2;
         }
-        if( not_after[0] == '2' && ( not_after[1] > '0' || not_after[2] > '4' ) )
-        {
+        if (not_after[0] == '2' && (not_after[1] > '0' || not_after[2] > '4')) {
             after_tag = MBEDTLS_ASN1_GENERALIZED_TIME;
-        }
-        else
-        {
+        } else {
             after_tag = MBEDTLS_ASN1_UTC_TIME;
             not_after += 2;
         }
-        end = buf + sizeof( buf );
-        for( p = end - der_len ; p < end ; )
-        {
+        end = buf + sizeof(buf);
+        for (p = end - der_len; p < end;) {
             tag = *p++;
             sz = *p++;
-            if( tag == MBEDTLS_ASN1_UTC_TIME || tag == MBEDTLS_ASN1_GENERALIZED_TIME )
-            {
+            if (tag == MBEDTLS_ASN1_UTC_TIME || tag == MBEDTLS_ASN1_GENERALIZED_TIME) {
                 // Check correct tag and time written
-                TEST_ASSERT( before_tag == tag );
-                TEST_ASSERT( memcmp( p, not_before, sz - 1 ) == 0 );
+                TEST_ASSERT(before_tag == tag);
+                TEST_ASSERT(memcmp(p, not_before, sz - 1) == 0);
                 p += sz;
                 tag = *p++;
                 sz = *p++;
-                TEST_ASSERT( after_tag == tag );
-                TEST_ASSERT( memcmp( p, not_after, sz - 1 ) == 0 );
+                TEST_ASSERT(after_tag == tag);
+                TEST_ASSERT(memcmp(p, not_after, sz - 1) == 0);
                 break;
             }
             // Increment if long form ASN1 length
-            if( sz & 0x80 )
+            if (sz & 0x80) {
                 p += sz & 0x0F;
-            if( tag != ( MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) )
+            }
+            if (tag != (MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE)) {
                 p += sz;
+            }
         }
-        TEST_ASSERT( p < end );
+        TEST_ASSERT(p < end);
     }
 
-    ret = mbedtls_x509write_crt_der( &crt, buf, (size_t)( der_len - 1 ),
-                                     mbedtls_test_rnd_pseudo_rand, &rnd_info );
-    TEST_ASSERT( ret == MBEDTLS_ERR_ASN1_BUF_TOO_SMALL );
+    ret = mbedtls_x509write_crt_der(&crt, buf, (size_t) (der_len - 1),
+                                    mbedtls_test_rnd_pseudo_rand, &rnd_info);
+    TEST_ASSERT(ret == MBEDTLS_ERR_ASN1_BUF_TOO_SMALL);
 
 exit:
-    mbedtls_x509write_crt_free( &crt );
-    mbedtls_pk_free( &issuer_key_alt );
-    mbedtls_pk_free( &subject_key );
-    mbedtls_pk_free( &issuer_key );
-    mbedtls_mpi_free( &serial );
+    mbedtls_x509write_crt_free(&crt);
+    mbedtls_pk_free(&issuer_key_alt);
+    mbedtls_pk_free(&subject_key);
+    mbedtls_pk_free(&issuer_key);
+    mbedtls_mpi_free(&serial);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CREATE_C:MBEDTLS_X509_USE_C */
-void mbedtls_x509_string_to_names( char * name, char * parsed_name, int result
-                                   )
+void mbedtls_x509_string_to_names(char *name, char *parsed_name, int result
+                                  )
 {
     int ret;
     size_t len = 0;
@@ -436,38 +435,38 @@
     mbedtls_x509_name parsed, *parsed_cur, *parsed_prv;
     unsigned char buf[1024], out[1024], *c;
 
-    memset( &parsed, 0, sizeof( parsed ) );
-    memset( out, 0, sizeof( out ) );
-    memset( buf, 0, sizeof( buf ) );
-    c = buf + sizeof( buf );
+    memset(&parsed, 0, sizeof(parsed));
+    memset(out, 0, sizeof(out));
+    memset(buf, 0, sizeof(buf));
+    c = buf + sizeof(buf);
 
-    ret = mbedtls_x509_string_to_names( &names, name );
-    TEST_ASSERT( ret == result );
+    ret = mbedtls_x509_string_to_names(&names, name);
+    TEST_ASSERT(ret == result);
 
-    if( ret != 0 )
+    if (ret != 0) {
         goto exit;
+    }
 
-    ret = mbedtls_x509_write_names( &c, buf, names );
-    TEST_ASSERT( ret > 0 );
+    ret = mbedtls_x509_write_names(&c, buf, names);
+    TEST_ASSERT(ret > 0);
 
-    TEST_ASSERT( mbedtls_asn1_get_tag( &c, buf + sizeof( buf ), &len,
-                        MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) == 0 );
-    TEST_ASSERT( mbedtls_x509_get_name( &c, buf + sizeof( buf ), &parsed ) == 0 );
+    TEST_ASSERT(mbedtls_asn1_get_tag(&c, buf + sizeof(buf), &len,
+                                     MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE) == 0);
+    TEST_ASSERT(mbedtls_x509_get_name(&c, buf + sizeof(buf), &parsed) == 0);
 
-    ret = mbedtls_x509_dn_gets( (char *) out, sizeof( out ), &parsed );
-    TEST_ASSERT( ret > 0 );
+    ret = mbedtls_x509_dn_gets((char *) out, sizeof(out), &parsed);
+    TEST_ASSERT(ret > 0);
 
-    TEST_ASSERT( strcmp( (char *) out, parsed_name ) == 0 );
+    TEST_ASSERT(strcmp((char *) out, parsed_name) == 0);
 
 exit:
-    mbedtls_asn1_free_named_data_list( &names );
+    mbedtls_asn1_free_named_data_list(&names);
 
     parsed_cur = parsed.next;
-    while( parsed_cur != 0 )
-    {
+    while (parsed_cur != 0) {
         parsed_prv = parsed_cur;
         parsed_cur = parsed_cur->next;
-        mbedtls_free( parsed_prv );
+        mbedtls_free(parsed_prv);
     }
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_xtea.function b/tests/suites/test_suite_xtea.function
index 1d5b29b..7e06e30 100644
--- a/tests/suites/test_suite_xtea.function
+++ b/tests/suites/test_suite_xtea.function
@@ -8,8 +8,8 @@
  */
 
 /* BEGIN_CASE */
-void xtea_encrypt_ecb( data_t * key_str, data_t * src_str,
-                       data_t * dst )
+void xtea_encrypt_ecb(data_t *key_str, data_t *src_str,
+                      data_t *dst)
 {
     unsigned char output[100];
     mbedtls_xtea_context ctx;
@@ -17,15 +17,15 @@
     memset(output, 0x00, 100);
 
 
-    mbedtls_xtea_setup( &ctx, key_str->x );
-    TEST_ASSERT( mbedtls_xtea_crypt_ecb( &ctx, MBEDTLS_XTEA_ENCRYPT, src_str->x, output ) == 0 );
+    mbedtls_xtea_setup(&ctx, key_str->x);
+    TEST_ASSERT(mbedtls_xtea_crypt_ecb(&ctx, MBEDTLS_XTEA_ENCRYPT, src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 8, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 8, dst->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void xtea_decrypt_ecb( data_t * key_str, data_t * src_str, data_t * dst )
+void xtea_decrypt_ecb(data_t *key_str, data_t *src_str, data_t *dst)
 {
     unsigned char output[100];
     mbedtls_xtea_context ctx;
@@ -33,16 +33,16 @@
     memset(output, 0x00, 100);
 
 
-    mbedtls_xtea_setup( &ctx, key_str->x );
-    TEST_ASSERT( mbedtls_xtea_crypt_ecb( &ctx, MBEDTLS_XTEA_DECRYPT, src_str->x, output ) == 0 );
+    mbedtls_xtea_setup(&ctx, key_str->x);
+    TEST_ASSERT(mbedtls_xtea_crypt_ecb(&ctx, MBEDTLS_XTEA_DECRYPT, src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 8, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x, 8, dst->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void xtea_encrypt_cbc( data_t * key_str, data_t * iv_str,
-                       data_t * src_str, data_t * dst )
+void xtea_encrypt_cbc(data_t *key_str, data_t *iv_str,
+                      data_t *src_str, data_t *dst)
 {
     unsigned char output[100];
     mbedtls_xtea_context ctx;
@@ -50,18 +50,18 @@
     memset(output, 0x00, 100);
 
 
-    mbedtls_xtea_setup( &ctx, key_str->x );
-    TEST_ASSERT( mbedtls_xtea_crypt_cbc( &ctx, MBEDTLS_XTEA_ENCRYPT, src_str->len, iv_str->x,
-                                 src_str->x, output ) == 0 );
+    mbedtls_xtea_setup(&ctx, key_str->x);
+    TEST_ASSERT(mbedtls_xtea_crypt_cbc(&ctx, MBEDTLS_XTEA_ENCRYPT, src_str->len, iv_str->x,
+                                       src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x,
-                                      src_str->len, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x,
+                                    src_str->len, dst->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
-void xtea_decrypt_cbc( data_t * key_str, data_t * iv_str,
-                       data_t * src_str, data_t * dst )
+void xtea_decrypt_cbc(data_t *key_str, data_t *iv_str,
+                      data_t *src_str, data_t *dst)
 {
     unsigned char output[100];
     mbedtls_xtea_context ctx;
@@ -69,18 +69,18 @@
     memset(output, 0x00, 100);
 
 
-    mbedtls_xtea_setup( &ctx, key_str->x );
-    TEST_ASSERT( mbedtls_xtea_crypt_cbc( &ctx, MBEDTLS_XTEA_DECRYPT, src_str->len, iv_str->x,
-                                 src_str->x, output ) == 0 );
+    mbedtls_xtea_setup(&ctx, key_str->x);
+    TEST_ASSERT(mbedtls_xtea_crypt_cbc(&ctx, MBEDTLS_XTEA_DECRYPT, src_str->len, iv_str->x,
+                                       src_str->x, output) == 0);
 
-    TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x,
-                                      src_str->len, dst->len ) == 0 );
+    TEST_ASSERT(mbedtls_test_hexcmp(output, dst->x,
+                                    src_str->len, dst->len) == 0);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-void xtea_selftest(  )
+void xtea_selftest()
 {
-    TEST_ASSERT( mbedtls_xtea_self_test( 1 ) == 0 );
+    TEST_ASSERT(mbedtls_xtea_self_test(1) == 0);
 }
 /* END_CASE */