Apply clang formatting.

Executed with:
`find . -regextype posix-egrep -regex ".*\.([hc]|fmt|function)" | xargs -L1 clang-format-12 -i`

Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
diff --git a/tests/configs/config-wrapper-malloc-0-null.h b/tests/configs/config-wrapper-malloc-0-null.h
index 2cb7722..e28e13d 100644
--- a/tests/configs/config-wrapper-malloc-0-null.h
+++ b/tests/configs/config-wrapper-malloc-0-null.h
@@ -21,11 +21,11 @@
 #include "mbedtls/mbedtls_config.h"
 
 #include <stdlib.h>
-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/data_files/format_pkcs12.fmt b/tests/data_files/format_pkcs12.fmt
index 296d599..0035f26 100644
--- a/tests/data_files/format_pkcs12.fmt
+++ b/tests/data_files/format_pkcs12.fmt
Binary files differ
diff --git a/tests/include/alt-dummy/aes_alt.h b/tests/include/alt-dummy/aes_alt.h
index f226188..ca8d801 100644
--- a/tests/include/alt-dummy/aes_alt.h
+++ b/tests/include/alt-dummy/aes_alt.h
@@ -19,19 +19,15 @@
 #ifndef AES_ALT_H
 #define AES_ALT_H
 
-typedef struct mbedtls_aes_context
-{
+typedef struct mbedtls_aes_context {
     int dummy;
-}
-mbedtls_aes_context;
+} mbedtls_aes_context;
 
 #if defined(MBEDTLS_CIPHER_MODE_XTS)
 
-typedef struct mbedtls_aes_xts_context
-{
+typedef struct mbedtls_aes_xts_context {
     int dummy;
 } mbedtls_aes_xts_context;
 #endif
 
-
 #endif /* aes_alt.h */
diff --git a/tests/include/alt-dummy/aria_alt.h b/tests/include/alt-dummy/aria_alt.h
index 5f2335b..d4d6a2f 100644
--- a/tests/include/alt-dummy/aria_alt.h
+++ b/tests/include/alt-dummy/aria_alt.h
@@ -19,11 +19,8 @@
 #ifndef ARIA_ALT_H
 #define ARIA_ALT_H
 
-typedef struct mbedtls_aria_context
-{
+typedef struct mbedtls_aria_context {
     int dummy;
-}
-mbedtls_aria_context;
-
+} mbedtls_aria_context;
 
 #endif /* aria_alt.h */
diff --git a/tests/include/alt-dummy/camellia_alt.h b/tests/include/alt-dummy/camellia_alt.h
index c23d1b4..b8f964b 100644
--- a/tests/include/alt-dummy/camellia_alt.h
+++ b/tests/include/alt-dummy/camellia_alt.h
@@ -19,11 +19,8 @@
 #ifndef CAMELLIA_ALT_H
 #define CAMELLIA_ALT_H
 
-typedef struct mbedtls_camellia_context
-{
+typedef struct mbedtls_camellia_context {
     int dummy;
-}
-mbedtls_camellia_context;
-
+} mbedtls_camellia_context;
 
 #endif /* camellia_alt.h */
diff --git a/tests/include/alt-dummy/ccm_alt.h b/tests/include/alt-dummy/ccm_alt.h
index dcb834e..d50f23e 100644
--- a/tests/include/alt-dummy/ccm_alt.h
+++ b/tests/include/alt-dummy/ccm_alt.h
@@ -19,11 +19,8 @@
 #ifndef CCM_ALT_H
 #define CCM_ALT_H
 
-typedef struct mbedtls_ccm_context
-{
+typedef struct mbedtls_ccm_context {
     int dummy;
-}
-mbedtls_ccm_context;
-
+} mbedtls_ccm_context;
 
 #endif /* ccm_alt.h */
diff --git a/tests/include/alt-dummy/chacha20_alt.h b/tests/include/alt-dummy/chacha20_alt.h
index 7a5a25c..63dcee2 100644
--- a/tests/include/alt-dummy/chacha20_alt.h
+++ b/tests/include/alt-dummy/chacha20_alt.h
@@ -19,11 +19,8 @@
 #ifndef CHACHA20_ALT_H
 #define CHACHA20_ALT_H
 
-typedef struct mbedtls_chacha20_context
-{
+typedef struct mbedtls_chacha20_context {
     int dummy;
-}
-mbedtls_chacha20_context;
-
+} mbedtls_chacha20_context;
 
 #endif /* chacha20_alt.h */
diff --git a/tests/include/alt-dummy/chachapoly_alt.h b/tests/include/alt-dummy/chachapoly_alt.h
index 448517d..fb6a72b 100644
--- a/tests/include/alt-dummy/chachapoly_alt.h
+++ b/tests/include/alt-dummy/chachapoly_alt.h
@@ -21,11 +21,8 @@
 
 #include "mbedtls/chacha20.h"
 
-typedef struct mbedtls_chachapoly_context
-{
+typedef struct mbedtls_chachapoly_context {
     int dummy;
-}
-mbedtls_chachapoly_context;
-
+} mbedtls_chachapoly_context;
 
 #endif /* chachapoly_alt.h */
diff --git a/tests/include/alt-dummy/cmac_alt.h b/tests/include/alt-dummy/cmac_alt.h
index 4c9feee..1aa887f 100644
--- a/tests/include/alt-dummy/cmac_alt.h
+++ b/tests/include/alt-dummy/cmac_alt.h
@@ -19,10 +19,8 @@
 #ifndef CMAC_ALT_H
 #define CMAC_ALT_H
 
-struct mbedtls_cmac_context_t
-{
+struct mbedtls_cmac_context_t {
     int dummy;
 };
 
-
 #endif /* cmac_alt.h */
diff --git a/tests/include/alt-dummy/des_alt.h b/tests/include/alt-dummy/des_alt.h
index e5a0bd3..09be00c 100644
--- a/tests/include/alt-dummy/des_alt.h
+++ b/tests/include/alt-dummy/des_alt.h
@@ -20,17 +20,12 @@
 #ifndef DES_ALT_H
 #define DES_ALT_H
 
-typedef struct mbedtls_des_context
-{
+typedef struct mbedtls_des_context {
     int dummy;
-}
-mbedtls_des_context;
+} mbedtls_des_context;
 
-typedef struct mbedtls_des3_context
-{
+typedef struct mbedtls_des3_context {
     int dummy;
-}
-mbedtls_des3_context;
-
+} mbedtls_des3_context;
 
 #endif /* des_alt.h */
diff --git a/tests/include/alt-dummy/dhm_alt.h b/tests/include/alt-dummy/dhm_alt.h
index 6289a41..884c54c 100644
--- a/tests/include/alt-dummy/dhm_alt.h
+++ b/tests/include/alt-dummy/dhm_alt.h
@@ -19,11 +19,8 @@
 #ifndef DHM_ALT_H
 #define DHM_ALT_H
 
-typedef struct mbedtls_dhm_context
-{
+typedef struct mbedtls_dhm_context {
     int dummy;
-}
-mbedtls_dhm_context;
-
+} mbedtls_dhm_context;
 
 #endif /* dhm_alt.h */
diff --git a/tests/include/alt-dummy/ecjpake_alt.h b/tests/include/alt-dummy/ecjpake_alt.h
index 8de0fcf..52cc75d 100644
--- a/tests/include/alt-dummy/ecjpake_alt.h
+++ b/tests/include/alt-dummy/ecjpake_alt.h
@@ -19,10 +19,8 @@
 #ifndef ECJPAKE_ALT_H
 #define ECJPAKE_ALT_H
 
-typedef struct mbedtls_ecjpake_context
-{
+typedef struct mbedtls_ecjpake_context {
     int dummy;
 } mbedtls_ecjpake_context;
 
-
 #endif /* ecjpake_alt.h */
diff --git a/tests/include/alt-dummy/ecp_alt.h b/tests/include/alt-dummy/ecp_alt.h
index d263871..7efbb16 100644
--- a/tests/include/alt-dummy/ecp_alt.h
+++ b/tests/include/alt-dummy/ecp_alt.h
@@ -19,8 +19,7 @@
 #ifndef ECP_ALT_H
 #define ECP_ALT_H
 
-typedef struct mbedtls_ecp_group
-{
+typedef struct mbedtls_ecp_group {
     const mbedtls_ecp_group_id id;
     const mbedtls_mpi P;
     const mbedtls_mpi A;
@@ -29,7 +28,6 @@
     const mbedtls_mpi N;
     const size_t pbits;
     const size_t nbits;
-}
-mbedtls_ecp_group;
+} mbedtls_ecp_group;
 
 #endif /* ecp_alt.h */
diff --git a/tests/include/alt-dummy/gcm_alt.h b/tests/include/alt-dummy/gcm_alt.h
index 94986ff..17de58a 100644
--- a/tests/include/alt-dummy/gcm_alt.h
+++ b/tests/include/alt-dummy/gcm_alt.h
@@ -19,11 +19,8 @@
 #ifndef GCM_ALT_H
 #define GCM_ALT_H
 
-typedef struct mbedtls_gcm_context
-{
+typedef struct mbedtls_gcm_context {
     int dummy;
-}
-mbedtls_gcm_context;
-
+} mbedtls_gcm_context;
 
 #endif /* gcm_alt.h */
diff --git a/tests/include/alt-dummy/md5_alt.h b/tests/include/alt-dummy/md5_alt.h
index c119147..839859f 100644
--- a/tests/include/alt-dummy/md5_alt.h
+++ b/tests/include/alt-dummy/md5_alt.h
@@ -19,11 +19,8 @@
 #ifndef MD5_ALT_H
 #define MD5_ALT_H
 
-typedef struct mbedtls_md5_context
-{
+typedef struct mbedtls_md5_context {
     int dummy;
-}
-mbedtls_md5_context;
-
+} mbedtls_md5_context;
 
 #endif /* md5_alt.h */
diff --git a/tests/include/alt-dummy/nist_kw_alt.h b/tests/include/alt-dummy/nist_kw_alt.h
index 8fec116..7ef2b4a 100644
--- a/tests/include/alt-dummy/nist_kw_alt.h
+++ b/tests/include/alt-dummy/nist_kw_alt.h
@@ -23,5 +23,4 @@
     int dummy;
 } mbedtls_nist_kw_context;
 
-
 #endif /* nist_kw_alt.h */
diff --git a/tests/include/alt-dummy/platform_alt.h b/tests/include/alt-dummy/platform_alt.h
index 2bf712d..bb2e069 100644
--- a/tests/include/alt-dummy/platform_alt.h
+++ b/tests/include/alt-dummy/platform_alt.h
@@ -19,11 +19,8 @@
 #ifndef PLATFORM_ALT_H
 #define PLATFORM_ALT_H
 
-typedef struct mbedtls_platform_context
-{
+typedef struct mbedtls_platform_context {
     int dummy;
-}
-mbedtls_platform_context;
-
+} mbedtls_platform_context;
 
 #endif /* platform_alt.h */
diff --git a/tests/include/alt-dummy/poly1305_alt.h b/tests/include/alt-dummy/poly1305_alt.h
index b8c1210..233f30a 100644
--- a/tests/include/alt-dummy/poly1305_alt.h
+++ b/tests/include/alt-dummy/poly1305_alt.h
@@ -19,11 +19,8 @@
 #ifndef POLY1305_ALT_H
 #define POLY1305_ALT_H
 
-typedef struct mbedtls_poly1305_context
-{
+typedef struct mbedtls_poly1305_context {
     int dummy;
-}
-mbedtls_poly1305_context;
-
+} mbedtls_poly1305_context;
 
 #endif /* poly1305_alt.h */
diff --git a/tests/include/alt-dummy/ripemd160_alt.h b/tests/include/alt-dummy/ripemd160_alt.h
index 722aeeb..4ee6034 100644
--- a/tests/include/alt-dummy/ripemd160_alt.h
+++ b/tests/include/alt-dummy/ripemd160_alt.h
@@ -19,11 +19,8 @@
 #ifndef RIPEMD160_ALT_H
 #define RIPEMD160_ALT_H
 
-typedef struct mbedtls_ripemd160_context
-{
+typedef struct mbedtls_ripemd160_context {
     int dummy;
-}
-mbedtls_ripemd160_context;
-
+} mbedtls_ripemd160_context;
 
 #endif /* ripemd160_alt.h */
diff --git a/tests/include/alt-dummy/rsa_alt.h b/tests/include/alt-dummy/rsa_alt.h
index ae80dba..456243c 100644
--- a/tests/include/alt-dummy/rsa_alt.h
+++ b/tests/include/alt-dummy/rsa_alt.h
@@ -19,11 +19,8 @@
 #ifndef RSA_ALT_H
 #define RSA_ALT_H
 
-typedef struct mbedtls_rsa_context
-{
+typedef struct mbedtls_rsa_context {
     int dummy;
-}
-mbedtls_rsa_context;
-
+} mbedtls_rsa_context;
 
 #endif /* rsa_alt.h */
diff --git a/tests/include/alt-dummy/sha1_alt.h b/tests/include/alt-dummy/sha1_alt.h
index df2990b..4609ed2 100644
--- a/tests/include/alt-dummy/sha1_alt.h
+++ b/tests/include/alt-dummy/sha1_alt.h
@@ -19,11 +19,8 @@
 #ifndef SHA1_ALT_H
 #define SHA1_ALT_H
 
-typedef struct mbedtls_sha1_context
-{
+typedef struct mbedtls_sha1_context {
     int dummy;
-}
-mbedtls_sha1_context;
-
+} mbedtls_sha1_context;
 
 #endif /* sha1_alt.h */
diff --git a/tests/include/alt-dummy/sha256_alt.h b/tests/include/alt-dummy/sha256_alt.h
index 7e501ed..9ffb7f2 100644
--- a/tests/include/alt-dummy/sha256_alt.h
+++ b/tests/include/alt-dummy/sha256_alt.h
@@ -19,11 +19,8 @@
 #ifndef SHA256_ALT_H
 #define SHA256_ALT_H
 
-typedef struct mbedtls_sha256_context
-{
+typedef struct mbedtls_sha256_context {
     int dummy;
-}
-mbedtls_sha256_context;
-
+} mbedtls_sha256_context;
 
 #endif /* sha256_alt.h */
diff --git a/tests/include/alt-dummy/sha512_alt.h b/tests/include/alt-dummy/sha512_alt.h
index 45c9599..4f0e8f6 100644
--- a/tests/include/alt-dummy/sha512_alt.h
+++ b/tests/include/alt-dummy/sha512_alt.h
@@ -19,11 +19,8 @@
 #ifndef SHA512_ALT_H
 #define SHA512_ALT_H
 
-typedef struct mbedtls_sha512_context
-{
+typedef struct mbedtls_sha512_context {
     int dummy;
-}
-mbedtls_sha512_context;
-
+} mbedtls_sha512_context;
 
 #endif /* sha512_alt.h */
diff --git a/tests/include/alt-dummy/threading_alt.h b/tests/include/alt-dummy/threading_alt.h
index ff2fed5..4003506 100644
--- a/tests/include/alt-dummy/threading_alt.h
+++ b/tests/include/alt-dummy/threading_alt.h
@@ -19,8 +19,7 @@
 #ifndef THREADING_ALT_H
 #define THREADING_ALT_H
 
-typedef struct mbedtls_threading_mutex_t
-{
+typedef struct mbedtls_threading_mutex_t {
     int dummy;
 } mbedtls_threading_mutex_t;
 
diff --git a/tests/include/alt-dummy/timing_alt.h b/tests/include/alt-dummy/timing_alt.h
index f2da154..fb64167 100644
--- a/tests/include/alt-dummy/timing_alt.h
+++ b/tests/include/alt-dummy/timing_alt.h
@@ -19,15 +19,12 @@
 #ifndef TIMING_ALT_H
 #define TIMING_ALT_H
 
-struct mbedtls_timing_hr_time
-{
+struct mbedtls_timing_hr_time {
     int dummy;
 };
 
-typedef struct mbedtls_timing_delay_context
-{
+typedef struct mbedtls_timing_delay_context {
     int dummy;
 } mbedtls_timing_delay_context;
 
-
 #endif /* timing_alt.h */
diff --git a/tests/include/spe/crypto_spe.h b/tests/include/spe/crypto_spe.h
index f80fd86..79ff49a 100644
--- a/tests/include/spe/crypto_spe.h
+++ b/tests/include/spe/crypto_spe.h
@@ -20,113 +20,67 @@
 #ifndef CRYPTO_SPE_H
 #define CRYPTO_SPE_H
 
-#define PSA_FUNCTION_NAME(x) mbedcrypto__ ## x
+#define PSA_FUNCTION_NAME(x) mbedcrypto__##x
 
-#define psa_crypto_init \
-        PSA_FUNCTION_NAME(psa_crypto_init)
+#define 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)
-#define 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_output_key)
+#define psa_key_derivation_setup PSA_FUNCTION_NAME(psa_key_derivation_setup)
+#define 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)
-#define psa_raw_key_agreement \
-        PSA_FUNCTION_NAME(psa_raw_key_agreement)
-#define psa_generate_random \
-        PSA_FUNCTION_NAME(psa_generate_random)
-#define psa_aead_encrypt \
-        PSA_FUNCTION_NAME(psa_aead_encrypt)
-#define psa_aead_decrypt \
-        PSA_FUNCTION_NAME(psa_aead_decrypt)
-#define psa_open_key \
-        PSA_FUNCTION_NAME(psa_open_key)
-#define psa_close_key \
-        PSA_FUNCTION_NAME(psa_close_key)
-#define psa_import_key \
-        PSA_FUNCTION_NAME(psa_import_key)
-#define psa_destroy_key \
-        PSA_FUNCTION_NAME(psa_destroy_key)
-#define psa_get_key_attributes \
-        PSA_FUNCTION_NAME(psa_get_key_attributes)
-#define psa_reset_key_attributes \
-        PSA_FUNCTION_NAME(psa_reset_key_attributes)
-#define psa_export_key \
-        PSA_FUNCTION_NAME(psa_export_key)
-#define psa_export_public_key \
-        PSA_FUNCTION_NAME(psa_export_public_key)
-#define psa_purge_key \
-        PSA_FUNCTION_NAME(psa_purge_key)
-#define psa_copy_key \
-        PSA_FUNCTION_NAME(psa_copy_key)
-#define psa_cipher_operation_init \
-        PSA_FUNCTION_NAME(psa_cipher_operation_init)
-#define psa_cipher_generate_iv \
-        PSA_FUNCTION_NAME(psa_cipher_generate_iv)
-#define psa_cipher_set_iv \
-        PSA_FUNCTION_NAME(psa_cipher_set_iv)
-#define psa_cipher_encrypt_setup \
-        PSA_FUNCTION_NAME(psa_cipher_encrypt_setup)
-#define psa_cipher_decrypt_setup \
-        PSA_FUNCTION_NAME(psa_cipher_decrypt_setup)
-#define psa_cipher_update \
-        PSA_FUNCTION_NAME(psa_cipher_update)
-#define psa_cipher_finish \
-        PSA_FUNCTION_NAME(psa_cipher_finish)
-#define psa_cipher_abort \
-        PSA_FUNCTION_NAME(psa_cipher_abort)
-#define psa_hash_operation_init \
-        PSA_FUNCTION_NAME(psa_hash_operation_init)
-#define psa_hash_setup \
-        PSA_FUNCTION_NAME(psa_hash_setup)
-#define psa_hash_update \
-        PSA_FUNCTION_NAME(psa_hash_update)
-#define psa_hash_finish \
-        PSA_FUNCTION_NAME(psa_hash_finish)
-#define psa_hash_verify \
-        PSA_FUNCTION_NAME(psa_hash_verify)
-#define psa_hash_abort \
-        PSA_FUNCTION_NAME(psa_hash_abort)
-#define psa_hash_clone \
-        PSA_FUNCTION_NAME(psa_hash_clone)
-#define psa_hash_compute \
-        PSA_FUNCTION_NAME(psa_hash_compute)
-#define psa_hash_compare \
-        PSA_FUNCTION_NAME(psa_hash_compare)
-#define psa_mac_operation_init \
-        PSA_FUNCTION_NAME(psa_mac_operation_init)
-#define psa_mac_sign_setup \
-        PSA_FUNCTION_NAME(psa_mac_sign_setup)
-#define psa_mac_verify_setup \
-        PSA_FUNCTION_NAME(psa_mac_verify_setup)
-#define psa_mac_update \
-        PSA_FUNCTION_NAME(psa_mac_update)
-#define psa_mac_sign_finish \
-        PSA_FUNCTION_NAME(psa_mac_sign_finish)
-#define psa_mac_verify_finish \
-        PSA_FUNCTION_NAME(psa_mac_verify_finish)
-#define psa_mac_abort \
-        PSA_FUNCTION_NAME(psa_mac_abort)
-#define psa_sign_hash \
-        PSA_FUNCTION_NAME(psa_sign_hash)
-#define psa_verify_hash \
-        PSA_FUNCTION_NAME(psa_verify_hash)
-#define psa_asymmetric_encrypt \
-        PSA_FUNCTION_NAME(psa_asymmetric_encrypt)
-#define psa_asymmetric_decrypt \
-        PSA_FUNCTION_NAME(psa_asymmetric_decrypt)
-#define psa_generate_key \
-        PSA_FUNCTION_NAME(psa_generate_key)
+    PSA_FUNCTION_NAME(psa_key_derivation_key_agreement)
+#define psa_raw_key_agreement     PSA_FUNCTION_NAME(psa_raw_key_agreement)
+#define psa_generate_random       PSA_FUNCTION_NAME(psa_generate_random)
+#define psa_aead_encrypt          PSA_FUNCTION_NAME(psa_aead_encrypt)
+#define psa_aead_decrypt          PSA_FUNCTION_NAME(psa_aead_decrypt)
+#define psa_open_key              PSA_FUNCTION_NAME(psa_open_key)
+#define psa_close_key             PSA_FUNCTION_NAME(psa_close_key)
+#define psa_import_key            PSA_FUNCTION_NAME(psa_import_key)
+#define psa_destroy_key           PSA_FUNCTION_NAME(psa_destroy_key)
+#define psa_get_key_attributes    PSA_FUNCTION_NAME(psa_get_key_attributes)
+#define psa_reset_key_attributes  PSA_FUNCTION_NAME(psa_reset_key_attributes)
+#define psa_export_key            PSA_FUNCTION_NAME(psa_export_key)
+#define psa_export_public_key     PSA_FUNCTION_NAME(psa_export_public_key)
+#define psa_purge_key             PSA_FUNCTION_NAME(psa_purge_key)
+#define psa_copy_key              PSA_FUNCTION_NAME(psa_copy_key)
+#define psa_cipher_operation_init PSA_FUNCTION_NAME(psa_cipher_operation_init)
+#define psa_cipher_generate_iv    PSA_FUNCTION_NAME(psa_cipher_generate_iv)
+#define psa_cipher_set_iv         PSA_FUNCTION_NAME(psa_cipher_set_iv)
+#define psa_cipher_encrypt_setup  PSA_FUNCTION_NAME(psa_cipher_encrypt_setup)
+#define psa_cipher_decrypt_setup  PSA_FUNCTION_NAME(psa_cipher_decrypt_setup)
+#define psa_cipher_update         PSA_FUNCTION_NAME(psa_cipher_update)
+#define psa_cipher_finish         PSA_FUNCTION_NAME(psa_cipher_finish)
+#define psa_cipher_abort          PSA_FUNCTION_NAME(psa_cipher_abort)
+#define psa_hash_operation_init   PSA_FUNCTION_NAME(psa_hash_operation_init)
+#define psa_hash_setup            PSA_FUNCTION_NAME(psa_hash_setup)
+#define psa_hash_update           PSA_FUNCTION_NAME(psa_hash_update)
+#define psa_hash_finish           PSA_FUNCTION_NAME(psa_hash_finish)
+#define psa_hash_verify           PSA_FUNCTION_NAME(psa_hash_verify)
+#define psa_hash_abort            PSA_FUNCTION_NAME(psa_hash_abort)
+#define psa_hash_clone            PSA_FUNCTION_NAME(psa_hash_clone)
+#define psa_hash_compute          PSA_FUNCTION_NAME(psa_hash_compute)
+#define psa_hash_compare          PSA_FUNCTION_NAME(psa_hash_compare)
+#define psa_mac_operation_init    PSA_FUNCTION_NAME(psa_mac_operation_init)
+#define psa_mac_sign_setup        PSA_FUNCTION_NAME(psa_mac_sign_setup)
+#define psa_mac_verify_setup      PSA_FUNCTION_NAME(psa_mac_verify_setup)
+#define psa_mac_update            PSA_FUNCTION_NAME(psa_mac_update)
+#define psa_mac_sign_finish       PSA_FUNCTION_NAME(psa_mac_sign_finish)
+#define psa_mac_verify_finish     PSA_FUNCTION_NAME(psa_mac_verify_finish)
+#define psa_mac_abort             PSA_FUNCTION_NAME(psa_mac_abort)
+#define psa_sign_hash             PSA_FUNCTION_NAME(psa_sign_hash)
+#define psa_verify_hash           PSA_FUNCTION_NAME(psa_verify_hash)
+#define psa_asymmetric_encrypt    PSA_FUNCTION_NAME(psa_asymmetric_encrypt)
+#define psa_asymmetric_decrypt    PSA_FUNCTION_NAME(psa_asymmetric_decrypt)
+#define 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..408855c 100644
--- a/tests/include/test/asn1_helpers.h
+++ b/tests/include/test/asn1_helpers.h
@@ -43,8 +43,10 @@
  *
  * \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/certs.h b/tests/include/test/certs.h
index 03f0d03..242e202 100644
--- a/tests/include/test/certs.h
+++ b/tests/include/test/certs.h
@@ -33,16 +33,16 @@
 /* List of all PEM-encoded CA certificates, terminated by NULL;
  * PEM encoded if MBEDTLS_PEM_PARSE_C is enabled, DER encoded
  * otherwise. */
-extern const char * mbedtls_test_cas[];
+extern const char *mbedtls_test_cas[];
 extern const size_t mbedtls_test_cas_len[];
 
 /* List of all DER-encoded CA certificates, terminated by NULL */
-extern const unsigned char * mbedtls_test_cas_der[];
+extern const unsigned char *mbedtls_test_cas_der[];
 extern const size_t mbedtls_test_cas_der_len[];
 
 #if defined(MBEDTLS_PEM_PARSE_C)
 /* Concatenation of all CA certificates in PEM format if available */
-extern const char   mbedtls_test_cas_pem[];
+extern const char mbedtls_test_cas_pem[];
 extern const size_t mbedtls_test_cas_pem_len;
 #endif /* MBEDTLS_PEM_PARSE_C */
 
@@ -108,9 +108,9 @@
 /* Config-dependent dispatch between EC and RSA
  * (RSA if enabled, otherwise EC) */
 
-extern const char * mbedtls_test_ca_crt;
-extern const char * mbedtls_test_ca_key;
-extern const char * mbedtls_test_ca_pwd;
+extern const char *mbedtls_test_ca_crt;
+extern const char *mbedtls_test_ca_key;
+extern const char *mbedtls_test_ca_pwd;
 extern const size_t mbedtls_test_ca_crt_len;
 extern const size_t mbedtls_test_ca_key_len;
 extern const size_t mbedtls_test_ca_pwd_len;
@@ -177,9 +177,9 @@
 /* Config-dependent dispatch between EC and RSA
  * (RSA if enabled, otherwise EC) */
 
-extern const char * mbedtls_test_srv_crt;
-extern const char * mbedtls_test_srv_key;
-extern const char * mbedtls_test_srv_pwd;
+extern const char *mbedtls_test_srv_crt;
+extern const char *mbedtls_test_srv_key;
+extern const char *mbedtls_test_srv_pwd;
 extern const size_t mbedtls_test_srv_crt_len;
 extern const size_t mbedtls_test_srv_key_len;
 extern const size_t mbedtls_test_srv_pwd_len;
@@ -232,9 +232,9 @@
 /* Config-dependent dispatch between EC and RSA
  * (RSA if enabled, otherwise EC) */
 
-extern const char * mbedtls_test_cli_crt;
-extern const char * mbedtls_test_cli_key;
-extern const char * mbedtls_test_cli_pwd;
+extern const char *mbedtls_test_cli_crt;
+extern const char *mbedtls_test_cli_key;
+extern const char *mbedtls_test_cli_pwd;
 extern const size_t mbedtls_test_cli_crt_len;
 extern const size_t mbedtls_test_cli_key_len;
 extern const size_t mbedtls_test_cli_pwd_len;
diff --git a/tests/include/test/constant_flow.h b/tests/include/test/constant_flow.h
index 9626af9..171144d 100644
--- a/tests/include/test/constant_flow.h
+++ b/tests/include/test/constant_flow.h
@@ -49,29 +49,29 @@
  */
 
 #if defined(MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN)
-#include <sanitizer/msan_interface.h>
+#    include <sanitizer/msan_interface.h>
 
 /* Use macros to avoid messing up with origin tracking */
-#define TEST_CF_SECRET  __msan_allocated_memory
+#    define TEST_CF_SECRET __msan_allocated_memory
 // void __msan_allocated_memory(const volatile void* data, size_t size);
-#define TEST_CF_PUBLIC  __msan_unpoison
+#    define TEST_CF_PUBLIC __msan_unpoison
 // void __msan_unpoison(const volatile void *a, size_t size);
 
 #elif defined(MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND)
-#include <valgrind/memcheck.h>
+#    include <valgrind/memcheck.h>
 
-#define TEST_CF_SECRET  VALGRIND_MAKE_MEM_UNDEFINED
+#    define TEST_CF_SECRET VALGRIND_MAKE_MEM_UNDEFINED
 // VALGRIND_MAKE_MEM_UNDEFINED(_qzz_addr, _qzz_len)
-#define TEST_CF_PUBLIC  VALGRIND_MAKE_MEM_DEFINED
+#    define TEST_CF_PUBLIC VALGRIND_MAKE_MEM_DEFINED
 // VALGRIND_MAKE_MEM_DEFINED(_qzz_addr, _qzz_len)
 
-#else /* MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN ||
+#else /* MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN || \
          MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND */
 
-#define TEST_CF_SECRET(ptr, size)
-#define TEST_CF_PUBLIC(ptr, size)
+#    define TEST_CF_SECRET(ptr, size)
+#    define TEST_CF_PUBLIC(ptr, size)
 
-#endif /* MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN ||
+#endif /* MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN || \
           MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND */
 
 #endif /* TEST_CONSTANT_FLOW_H */
diff --git a/tests/include/test/drivers/aead.h b/tests/include/test/drivers/aead.h
index 92c2989..01302cf 100644
--- a/tests/include/test/drivers/aead.h
+++ b/tests/include/test/drivers/aead.h
@@ -23,7 +23,7 @@
 #include "mbedtls/build_info.h"
 
 #if defined(PSA_CRYPTO_DRIVER_TEST)
-#include <psa/crypto_driver_common.h>
+#    include <psa/crypto_driver_common.h>
 
 typedef struct {
     /* If not PSA_SUCCESS, return this error code instead of processing the
@@ -35,33 +35,48 @@
     psa_status_t driver_status;
 } mbedtls_test_driver_aead_hooks_t;
 
-#define MBEDTLS_TEST_DRIVER_AEAD_INIT { 0, 0, 0 }
+#    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;
 
-psa_status_t mbedtls_test_transparent_aead_encrypt(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key_buffer, size_t key_buffer_size,
-    psa_algorithm_t alg,
-    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 );
+psa_status_t
+mbedtls_test_transparent_aead_encrypt(const psa_key_attributes_t *attributes,
+                                      const uint8_t *key_buffer,
+                                      size_t key_buffer_size,
+                                      psa_algorithm_t alg,
+                                      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);
 
-psa_status_t mbedtls_test_transparent_aead_decrypt(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key_buffer, size_t key_buffer_size,
-    psa_algorithm_t alg,
-    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 );
+psa_status_t
+mbedtls_test_transparent_aead_decrypt(const psa_key_attributes_t *attributes,
+                                      const uint8_t *key_buffer,
+                                      size_t key_buffer_size,
+                                      psa_algorithm_t alg,
+                                      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);
 
 #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 8dbee92..4686955 100644
--- a/tests/include/test/drivers/cipher.h
+++ b/tests/include/test/drivers/cipher.h
@@ -23,10 +23,10 @@
 #include "mbedtls/build_info.h"
 
 #if defined(PSA_CRYPTO_DRIVER_TEST)
-#include <psa/crypto_driver_common.h>
-#include <psa/crypto.h>
+#    include <psa/crypto_driver_common.h>
+#    include <psa/crypto.h>
 
-#include "mbedtls/cipher.h"
+#    include "mbedtls/cipher.h"
 
 typedef struct {
     /* If non-null, on success, copy this to the output. */
@@ -35,89 +35,120 @@
     /* If not PSA_SUCCESS, return this error code instead of processing the
      * function call. */
     psa_status_t forced_status;
-    /* Count the amount of times one of the cipher driver functions is called. */
+    /* Count the amount of times one of the cipher driver functions is called.
+     */
     unsigned long hits;
 } mbedtls_test_driver_cipher_hooks_t;
 
-#define MBEDTLS_TEST_DRIVER_CIPHER_INIT { NULL, 0, PSA_SUCCESS, 0 }
+#    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 ;
+    const mbedtls_test_driver_cipher_hooks_t v =
+        MBEDTLS_TEST_DRIVER_CIPHER_INIT;
+    return v;
 }
 
 extern mbedtls_test_driver_cipher_hooks_t mbedtls_test_driver_cipher_hooks;
 
-psa_status_t mbedtls_test_transparent_cipher_encrypt(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
-    psa_algorithm_t alg,
-    const uint8_t *input, size_t input_length,
-    uint8_t *output, size_t output_size, size_t *output_length);
+psa_status_t
+mbedtls_test_transparent_cipher_encrypt(const psa_key_attributes_t *attributes,
+                                        const uint8_t *key,
+                                        size_t key_length,
+                                        psa_algorithm_t alg,
+                                        const uint8_t *input,
+                                        size_t input_length,
+                                        uint8_t *output,
+                                        size_t output_size,
+                                        size_t *output_length);
 
-psa_status_t mbedtls_test_transparent_cipher_decrypt(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
-    psa_algorithm_t alg,
-    const uint8_t *input, size_t input_length,
-    uint8_t *output, size_t output_size, size_t *output_length);
+psa_status_t
+mbedtls_test_transparent_cipher_decrypt(const psa_key_attributes_t *attributes,
+                                        const uint8_t *key,
+                                        size_t key_length,
+                                        psa_algorithm_t alg,
+                                        const uint8_t *input,
+                                        size_t input_length,
+                                        uint8_t *output,
+                                        size_t output_size,
+                                        size_t *output_length);
 
 psa_status_t mbedtls_test_transparent_cipher_encrypt_setup(
     mbedtls_transparent_test_driver_cipher_operation_t *operation,
     const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
+    const uint8_t *key,
+    size_t key_length,
     psa_algorithm_t alg);
 
 psa_status_t mbedtls_test_transparent_cipher_decrypt_setup(
     mbedtls_transparent_test_driver_cipher_operation_t *operation,
     const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
+    const uint8_t *key,
+    size_t key_length,
     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,
-    const uint8_t *iv, size_t iv_length);
+    const uint8_t *iv,
+    size_t iv_length);
 
 psa_status_t mbedtls_test_transparent_cipher_update(
     mbedtls_transparent_test_driver_cipher_operation_t *operation,
-    const uint8_t *input, size_t input_length,
-    uint8_t *output, size_t output_size, size_t *output_length);
+    const uint8_t *input,
+    size_t input_length,
+    uint8_t *output,
+    size_t output_size,
+    size_t *output_length);
 
 psa_status_t mbedtls_test_transparent_cipher_finish(
     mbedtls_transparent_test_driver_cipher_operation_t *operation,
-    uint8_t *output, size_t output_size, size_t *output_length);
+    uint8_t *output,
+    size_t output_size,
+    size_t *output_length);
 
 /*
  * opaque versions
  */
-psa_status_t mbedtls_test_opaque_cipher_encrypt(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
-    psa_algorithm_t alg,
-    const uint8_t *input, size_t input_length,
-    uint8_t *output, size_t output_size, size_t *output_length);
+psa_status_t
+mbedtls_test_opaque_cipher_encrypt(const psa_key_attributes_t *attributes,
+                                   const uint8_t *key,
+                                   size_t key_length,
+                                   psa_algorithm_t alg,
+                                   const uint8_t *input,
+                                   size_t input_length,
+                                   uint8_t *output,
+                                   size_t output_size,
+                                   size_t *output_length);
 
-psa_status_t mbedtls_test_opaque_cipher_decrypt(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
-    psa_algorithm_t alg,
-    const uint8_t *input, size_t input_length,
-    uint8_t *output, size_t output_size, size_t *output_length);
+psa_status_t
+mbedtls_test_opaque_cipher_decrypt(const psa_key_attributes_t *attributes,
+                                   const uint8_t *key,
+                                   size_t key_length,
+                                   psa_algorithm_t alg,
+                                   const uint8_t *input,
+                                   size_t input_length,
+                                   uint8_t *output,
+                                   size_t output_size,
+                                   size_t *output_length);
 
 psa_status_t mbedtls_test_opaque_cipher_encrypt_setup(
     mbedtls_opaque_test_driver_cipher_operation_t *operation,
     const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
+    const uint8_t *key,
+    size_t key_length,
     psa_algorithm_t alg);
 
 psa_status_t mbedtls_test_opaque_cipher_decrypt_setup(
     mbedtls_opaque_test_driver_cipher_operation_t *operation,
     const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
+    const uint8_t *key,
+    size_t key_length,
     psa_algorithm_t alg);
 
 psa_status_t mbedtls_test_opaque_cipher_abort(
@@ -125,16 +156,22 @@
 
 psa_status_t mbedtls_test_opaque_cipher_set_iv(
     mbedtls_opaque_test_driver_cipher_operation_t *operation,
-    const uint8_t *iv, size_t iv_length);
+    const uint8_t *iv,
+    size_t iv_length);
 
 psa_status_t mbedtls_test_opaque_cipher_update(
     mbedtls_opaque_test_driver_cipher_operation_t *operation,
-    const uint8_t *input, size_t input_length,
-    uint8_t *output, size_t output_size, size_t *output_length);
+    const uint8_t *input,
+    size_t input_length,
+    uint8_t *output,
+    size_t output_size,
+    size_t *output_length);
 
 psa_status_t mbedtls_test_opaque_cipher_finish(
     mbedtls_opaque_test_driver_cipher_operation_t *operation,
-    uint8_t *output, size_t output_size, size_t *output_length);
+    uint8_t *output,
+    size_t output_size,
+    size_t *output_length);
 
 #endif /* PSA_CRYPTO_DRIVER_TEST */
 #endif /* PSA_CRYPTO_TEST_DRIVERS_CIPHER_H */
diff --git a/tests/include/test/drivers/hash.h b/tests/include/test/drivers/hash.h
index f72a1a5..c9dc292 100644
--- a/tests/include/test/drivers/hash.h
+++ b/tests/include/test/drivers/hash.h
@@ -23,7 +23,7 @@
 #include "mbedtls/build_info.h"
 
 #if defined(PSA_CRYPTO_DRIVER_TEST)
-#include <psa/crypto_driver_common.h>
+#    include <psa/crypto_driver_common.h>
 
 typedef struct {
     /* If not PSA_SUCCESS, return this error code instead of processing the
@@ -35,42 +35,47 @@
     psa_status_t driver_status;
 } mbedtls_test_driver_hash_hooks_t;
 
-#define MBEDTLS_TEST_DRIVER_HASH_INIT { 0, 0, 0 }
+#    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;
 
-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 );
+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);
 
 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_psa_hash_operation_t *operation );
+psa_status_t
+mbedtls_test_transparent_hash_abort(mbedtls_psa_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 8c9c628..2ba36aa 100644
--- a/tests/include/test/drivers/key_management.h
+++ b/tests/include/test/drivers/key_management.h
@@ -23,10 +23,10 @@
 #include "mbedtls/build_info.h"
 
 #if defined(PSA_CRYPTO_DRIVER_TEST)
-#include <psa/crypto_driver_common.h>
+#    include <psa/crypto_driver_common.h>
 
-#define PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT     0
-#define PSA_CRYPTO_TEST_DRIVER_BUILTIN_ECDSA_KEY_SLOT   1
+#    define PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT   0
+#    define PSA_CRYPTO_TEST_DRIVER_BUILTIN_ECDSA_KEY_SLOT 1
 
 typedef struct {
     /* If non-null, on success, copy this to the output. */
@@ -40,54 +40,72 @@
     unsigned long hits;
 } mbedtls_test_driver_key_management_hooks_t;
 
-#define MBEDTLS_TEST_DRIVER_KEY_MANAGEMENT_INIT { NULL, 0, PSA_SUCCESS, 0 }
+#    define MBEDTLS_TEST_DRIVER_KEY_MANAGEMENT_INIT \
+        {                                           \
+            NULL, 0, PSA_SUCCESS, 0                 \
+        }
 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 ;
+    const mbedtls_test_driver_key_management_hooks_t v =
+        MBEDTLS_TEST_DRIVER_KEY_MANAGEMENT_INIT;
+    return v;
 }
 
 extern mbedtls_test_driver_key_management_hooks_t
     mbedtls_test_driver_key_management_hooks;
 
-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 );
+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);
 
-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 );
+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);
 
-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 );
+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);
 
 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 );
+    const uint8_t *key,
+    size_t key_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 );
+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);
 
-psa_status_t mbedtls_test_transparent_import_key(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *data,
-    size_t data_length,
-    uint8_t *key_buffer,
-    size_t key_buffer_size,
-    size_t *key_buffer_length,
-    size_t *bits);
+psa_status_t
+mbedtls_test_transparent_import_key(const psa_key_attributes_t *attributes,
+                                    const uint8_t *data,
+                                    size_t data_length,
+                                    uint8_t *key_buffer,
+                                    size_t key_buffer_size,
+                                    size_t *key_buffer_length,
+                                    size_t *bits);
 
-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 );
+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);
 
 #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 6c0e96b..55e868e 100644
--- a/tests/include/test/drivers/mac.h
+++ b/tests/include/test/drivers/mac.h
@@ -23,7 +23,7 @@
 #include "mbedtls/build_info.h"
 
 #if defined(PSA_CRYPTO_DRIVER_TEST)
-#include <psa/crypto_driver_common.h>
+#    include <psa/crypto_driver_common.h>
 
 typedef struct {
     /* If not PSA_SUCCESS, return this error code instead of processing the
@@ -35,103 +35,106 @@
     psa_status_t driver_status;
 } mbedtls_test_driver_mac_hooks_t;
 
-#define MBEDTLS_TEST_DRIVER_MAC_INIT { 0, 0, 0 }
+#    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;
 
-psa_status_t mbedtls_test_transparent_mac_compute(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key_buffer,
-    size_t key_buffer_size,
-    psa_algorithm_t alg,
-    const uint8_t *input,
-    size_t input_length,
-    uint8_t *mac,
-    size_t mac_size,
-    size_t *mac_length );
+psa_status_t
+mbedtls_test_transparent_mac_compute(const psa_key_attributes_t *attributes,
+                                     const uint8_t *key_buffer,
+                                     size_t key_buffer_size,
+                                     psa_algorithm_t alg,
+                                     const uint8_t *input,
+                                     size_t input_length,
+                                     uint8_t *mac,
+                                     size_t mac_size,
+                                     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,
-    const uint8_t *key_buffer,
-    size_t key_buffer_size,
-    psa_algorithm_t alg,
-    const uint8_t *input,
-    size_t input_length,
-    uint8_t *mac,
-    size_t mac_size,
-    size_t *mac_length );
+psa_status_t
+mbedtls_test_opaque_mac_compute(const psa_key_attributes_t *attributes,
+                                const uint8_t *key_buffer,
+                                size_t key_buffer_size,
+                                psa_algorithm_t alg,
+                                const uint8_t *input,
+                                size_t input_length,
+                                uint8_t *mac,
+                                size_t mac_size,
+                                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 c540d4c..d311df9 100644
--- a/tests/include/test/drivers/signature.h
+++ b/tests/include/test/drivers/signature.h
@@ -23,7 +23,7 @@
 #include "mbedtls/build_info.h"
 
 #if defined(PSA_CRYPTO_DRIVER_TEST)
-#include <psa/crypto_driver_common.h>
+#    include <psa/crypto_driver_common.h>
 
 typedef struct {
     /* If non-null, on success, copy this to the output. */
@@ -32,17 +32,21 @@
     /* If not PSA_SUCCESS, return this error code instead of processing the
      * function call. */
     psa_status_t forced_status;
-    /* Count the amount of times one of the signature driver functions is called. */
+    /* Count the amount of times one of the signature driver functions is
+     * called. */
     unsigned long hits;
 } mbedtls_test_driver_signature_hooks_t;
 
-#define MBEDTLS_TEST_DRIVER_SIGNATURE_INIT { NULL, 0, PSA_SUCCESS, 0 }
+#    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 ;
+    const mbedtls_test_driver_signature_hooks_t v =
+        MBEDTLS_TEST_DRIVER_SIGNATURE_INIT;
+    return v;
 }
 
 extern mbedtls_test_driver_signature_hooks_t
@@ -59,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,
@@ -70,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,
@@ -80,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,
@@ -90,35 +94,49 @@
     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,
+    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 );
+    const uint8_t *hash,
+    size_t hash_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 );
+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);
 
 psa_status_t mbedtls_test_transparent_signature_verify_hash(
     const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
+    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 *hash,
+    size_t hash_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,
+    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 *hash,
+    size_t hash_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 4e3301c..b81b54b 100644
--- a/tests/include/test/drivers/size.h
+++ b/tests/include/test/drivers/size.h
@@ -23,11 +23,10 @@
 #include "mbedtls/build_info.h"
 
 #if defined(PSA_CRYPTO_DRIVER_TEST)
-#include <psa/crypto_driver_common.h>
+#    include <psa/crypto_driver_common.h>
 
-size_t mbedtls_test_size_function(
-    const psa_key_type_t key_type,
-    const size_t key_bits );
+size_t mbedtls_test_size_function(const psa_key_type_t key_type,
+                                  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 9d56dab..01bfb91 100644
--- a/tests/include/test/fake_external_rng_for_test.h
+++ b/tests/include/test/fake_external_rng_for_test.h
@@ -40,13 +40,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 27e5599..578eb22 100644
--- a/tests/include/test/helpers.h
+++ b/tests/include/test/helpers.h
@@ -34,29 +34,29 @@
 
 #if defined(MBEDTLS_THREADING_C) && defined(MBEDTLS_THREADING_PTHREAD) && \
     defined(MBEDTLS_TEST_HOOKS)
-#define MBEDTLS_TEST_MUTEX_USAGE
+#    define MBEDTLS_TEST_MUTEX_USAGE
 #endif
 
 #if defined(MBEDTLS_PLATFORM_C)
-#include "mbedtls/platform.h"
+#    include "mbedtls/platform.h"
 #else
-#include <stdio.h>
-#define mbedtls_fprintf    fprintf
-#define mbedtls_snprintf   snprintf
-#define mbedtls_calloc     calloc
-#define mbedtls_free       free
-#define mbedtls_exit       exit
-#define mbedtls_time       time
-#define mbedtls_time_t     time_t
-#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS
-#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
+#    include <stdio.h>
+#    define mbedtls_fprintf      fprintf
+#    define mbedtls_snprintf     snprintf
+#    define mbedtls_calloc       calloc
+#    define mbedtls_free         free
+#    define mbedtls_exit         exit
+#    define mbedtls_time         time
+#    define mbedtls_time_t       time_t
+#    define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS
+#    define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
 #endif
 
 #include <stddef.h>
 #include <stdint.h>
 
 #if defined(MBEDTLS_BIGNUM_C)
-#include "mbedtls/bignum.h"
+#    include "mbedtls/bignum.h"
 #endif
 
 typedef enum
@@ -66,8 +66,7 @@
     MBEDTLS_TEST_RESULT_SKIPPED
 } mbedtls_test_result_t;
 
-typedef struct
-{
+typedef struct {
     mbedtls_test_result_t result;
     const char *test;
     const char *filename;
@@ -76,12 +75,11 @@
 #if defined(MBEDTLS_TEST_MUTEX_USAGE)
     const char *mutex_usage_error;
 #endif
-}
-mbedtls_test_info_t;
+} 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.
@@ -99,7 +97,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.
@@ -112,7 +110,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.
@@ -124,12 +122,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          This function decodes the hexadecimal representation of
@@ -149,12 +147,14 @@
  * \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.
@@ -163,7 +163,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.
@@ -175,23 +175,22 @@
  *
  * 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_PSA_CRYPTO_C) && defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
-#include "test/fake_external_rng_for_test.h"
+#    include "test/fake_external_rng_for_test.h"
 #endif
 
 #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)
@@ -206,8 +205,7 @@
  *
  * \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)
@@ -228,7 +226,7 @@
  * \return \c 0 on success, an \c MBEDTLS_ERR_MPI_xxx error code otherwise.
  */
 /* Since the library has exactly the desired behavior, this is trivial. */
-int mbedtls_test_read_mpi( mbedtls_mpi *X, int radix, const char *s );
+int mbedtls_test_read_mpi(mbedtls_mpi *X, int radix, const char *s);
 #endif /* MBEDTLS_BIGNUM_C */
 
 #endif /* TEST_HELPERS_H */
diff --git a/tests/include/test/macros.h b/tests/include/test/macros.h
index 9b3fc9c..dcb4281 100644
--- a/tests/include/test/macros.h
+++ b/tests/include/test/macros.h
@@ -29,22 +29,22 @@
 #include <stdlib.h>
 
 #if defined(MBEDTLS_PLATFORM_C)
-#include "mbedtls/platform.h"
+#    include "mbedtls/platform.h"
 #else
-#include <stdio.h>
-#define mbedtls_fprintf    fprintf
-#define mbedtls_snprintf   snprintf
-#define mbedtls_calloc     calloc
-#define mbedtls_free       free
-#define mbedtls_exit       exit
-#define mbedtls_time       time
-#define mbedtls_time_t     time_t
-#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS
-#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
+#    include <stdio.h>
+#    define mbedtls_fprintf      fprintf
+#    define mbedtls_snprintf     snprintf
+#    define mbedtls_calloc       calloc
+#    define mbedtls_free         free
+#    define mbedtls_exit         exit
+#    define mbedtls_time         time
+#    define mbedtls_time_t       time_t
+#    define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS
+#    define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
 #endif
 
 #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
-#include "mbedtls/memory_buffer_alloc.h"
+#    include "mbedtls/memory_buffer_alloc.h"
 #endif
 
 /**
@@ -64,14 +64,13 @@
  *
  * \param   TEST    The test expression to be tested.
  */
-#define TEST_ASSERT( TEST )                                 \
-    do {                                                    \
-       if( ! (TEST) )                                       \
-       {                                                    \
-          mbedtls_test_fail( #TEST, __LINE__, __FILE__ );   \
-          goto exit;                                        \
-       }                                                    \
-    } while( 0 )
+#define TEST_ASSERT(TEST)                                 \
+    do {                                                  \
+        if (!(TEST)) {                                    \
+            mbedtls_test_fail(#TEST, __LINE__, __FILE__); \
+            goto exit;                                    \
+        }                                                 \
+    } while (0)
 
 /** Evaluate two expressions and fail the test case if they have different
  * values.
@@ -80,8 +79,7 @@
  * \param expr2     The expected value of \p expr1. This can be any
  *                  expression, but it is typically a constant.
  */
-#define TEST_EQUAL( expr1, expr2 )              \
-    TEST_ASSERT( ( expr1 ) == ( expr2 ) )
+#define TEST_EQUAL(expr1, expr2) TEST_ASSERT((expr1) == (expr2))
 
 /** Allocate memory dynamically and fail the test case if this fails.
  * The allocated memory will be filled with zeros.
@@ -103,36 +101,28 @@
  *                  This expression may be evaluated multiple times.
  *
  */
-#define ASSERT_ALLOC( pointer, length )                           \
-    do                                                            \
-    {                                                             \
-        TEST_ASSERT( ( pointer ) == NULL );                       \
-        if( ( length ) != 0 )                                     \
-        {                                                         \
-            ( pointer ) = mbedtls_calloc( sizeof( *( pointer ) ), \
-                                          ( length ) );           \
-            TEST_ASSERT( ( pointer ) != NULL );                   \
-        }                                                         \
-    }                                                             \
-    while( 0 )
+#define ASSERT_ALLOC(pointer, length)                                 \
+    do {                                                              \
+        TEST_ASSERT((pointer) == NULL);                               \
+        if ((length) != 0) {                                          \
+            (pointer) = mbedtls_calloc(sizeof(*(pointer)), (length)); \
+            TEST_ASSERT((pointer) != NULL);                           \
+        }                                                             \
+    } 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 )                      \
-    do                                                            \
-    {                                                             \
-        TEST_ASSERT( ( pointer ) == NULL );                       \
-        if( ( length ) != 0 )                                     \
-        {                                                         \
-            ( pointer ) = mbedtls_calloc( sizeof( *( pointer ) ), \
-                                          ( length ) );           \
-            TEST_ASSUME( ( pointer ) != NULL );                   \
-        }                                                         \
-    }                                                             \
-    while( 0 )
+#define ASSERT_ALLOC_WEAK(pointer, length)                            \
+    do {                                                              \
+        TEST_ASSERT((pointer) == NULL);                               \
+        if ((length) != 0) {                                          \
+            (pointer) = mbedtls_calloc(sizeof(*(pointer)), (length)); \
+            TEST_ASSUME((pointer) != NULL);                           \
+        }                                                             \
+    } while (0)
 
 /** Compare two buffers and fail the test case if they differ.
  *
@@ -146,14 +136,12 @@
  * \param size2     Size of the second buffer in bytes.
  *                  This expression may be evaluated multiple times.
  */
-#define ASSERT_COMPARE( p1, size1, p2, size2 )                          \
-    do                                                                  \
-    {                                                                   \
-        TEST_ASSERT( ( size1 ) == ( size2 ) );                          \
-        if( ( size1 ) != 0 )                                            \
-            TEST_ASSERT( memcmp( ( p1 ), ( p2 ), ( size1 ) ) == 0 );    \
-    }                                                                   \
-    while( 0 )
+#define ASSERT_COMPARE(p1, size1, p2, size2)               \
+    do {                                                   \
+        TEST_ASSERT((size1) == (size2));                   \
+        if ((size1) != 0)                                  \
+            TEST_ASSERT(memcmp((p1), (p2), (size1)) == 0); \
+    } while (0)
 
 /**
  * \brief   This macro tests the expression passed to it and skips the
@@ -161,21 +149,20 @@
  *
  * \param   TEST    The test expression to be tested.
  */
-#define TEST_ASSUME( TEST )                                 \
-    do {                                                    \
-        if( ! (TEST) )                                      \
-        {                                                   \
-            mbedtls_test_skip( #TEST, __LINE__, __FILE__ ); \
-            goto exit;                                      \
-        }                                                   \
-    } while( 0 )
+#define TEST_ASSUME(TEST)                                 \
+    do {                                                  \
+        if (!(TEST)) {                                    \
+            mbedtls_test_skip(#TEST, __LINE__, __FILE__); \
+            goto exit;                                    \
+        }                                                 \
+    } while (0)
 
-#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.
@@ -186,34 +173,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.
@@ -223,7 +210,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.
  *
@@ -232,29 +219,28 @@
  *
  * \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 8a8c37e..8e14cc2 100644
--- a/tests/include/test/psa_crypto_helpers.h
+++ b/tests/include/test/psa_crypto_helpers.h
@@ -25,23 +25,24 @@
 
 #if defined(MBEDTLS_PSA_CRYPTO_C)
 
-#include "test/psa_helpers.h"
+#    include "test/psa_helpers.h"
 
-#include <psa/crypto.h>
-#include <psa_crypto_slot_management.h>
+#    include <psa/crypto.h>
+#    include <psa_crypto_slot_management.h>
 
-#if defined(MBEDTLS_USE_PSA_CRYPTO)
-#include "mbedtls/psa_util.h"
-#endif
+#    if defined(MBEDTLS_USE_PSA_CRYPTO)
+#        include "mbedtls/psa_util.h"
+#    endif
 
-#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C)
+#    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 );
+/* 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);
 
 /** 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.
@@ -49,7 +50,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
  *
@@ -76,18 +77,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 */
+#    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 */
+#    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.
@@ -96,7 +97,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.
  *
@@ -105,13 +106,11 @@
  * `TEST_ASSERT( ! mbedtls_test_helper_is_psa_leaking( ) )`
  * but with a more informative message.
  */
-#define ASSERT_PSA_PRISTINE( )                                          \
-    do                                                                  \
-    {                                                                   \
-        if( test_fail_if_psa_leaking( __LINE__, __FILE__ ) )            \
-            goto exit;                                                  \
-    }                                                                   \
-    while( 0 )
+#    define ASSERT_PSA_PRISTINE()                             \
+        do {                                                  \
+            if (test_fail_if_psa_leaking(__LINE__, __FILE__)) \
+                goto exit;                                    \
+        } while (0)
 
 /** Shut down the PSA Crypto subsystem and destroy persistent keys.
  * Expect a clean shutdown, with no slots in use.
@@ -123,14 +122,12 @@
  * \note Persistent keys must be recorded with #TEST_USES_KEY_ID before
  *       creating them.
  */
-#define PSA_DONE( )                                                     \
-    do                                                                  \
-    {                                                                   \
-        test_fail_if_psa_leaking( __LINE__, __FILE__ );                 \
-        mbedtls_test_psa_purge_key_storage( );                          \
-        mbedtls_psa_crypto_free( );                                     \
-    }                                                                   \
-    while( 0 )
+#    define PSA_DONE()                                    \
+        do {                                              \
+            test_fail_if_psa_leaking(__LINE__, __FILE__); \
+            mbedtls_test_psa_purge_key_storage();         \
+            mbedtls_psa_crypto_free();                    \
+        } while (0)
 
 /** Shut down the PSA Crypto subsystem, allowing persistent keys to survive.
  * Expect a clean shutdown, with no slots in use.
@@ -138,22 +135,19 @@
  * If some key slots are still in use, record the test case as failed and
  * jump to the `exit` label.
  */
-#define PSA_SESSION_DONE( )                                             \
-    do                                                                  \
-    {                                                                   \
-        mbedtls_test_psa_purge_key_cache( );                            \
-        ASSERT_PSA_PRISTINE( );                                         \
-        mbedtls_psa_crypto_free( );                                     \
-    }                                                                   \
-    while( 0 )
+#    define PSA_SESSION_DONE()                  \
+        do {                                    \
+            mbedtls_test_psa_purge_key_cache(); \
+            ASSERT_PSA_PRISTINE();              \
+            mbedtls_psa_crypto_free();          \
+        } 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 );
+#    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);
 
 /** Return value logging wrapper macro.
  *
@@ -179,12 +173,13 @@
  *                  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"
+#        include "instrument_record_status.h"
 
-#endif /* defined(RECORD_PSA_STATUS_COVERAGE_LOG) */
+#    endif /* defined(RECORD_PSA_STATUS_COVERAGE_LOG) */
 
 /** Return extended key usage policies.
  *
@@ -192,7 +187,8 @@
  * permissions of other usage policies
  * (like PSA_KEY_USAGE_SIGN_HASH involves PSA_KEY_USAGE_SIGN_MESSGAE).
  */
-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
@@ -213,26 +209,22 @@
  *  \param key_type  Key type
  *  \param key_bits  Key length in number of bits.
  */
-#if defined(MBEDTLS_AES_ALT) || \
-    defined(MBEDTLS_AES_SETKEY_ENC_ALT) || \
-    defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_AES)
-#define MBEDTLS_TEST_HAVE_ALT_AES 1
-#else
-#define MBEDTLS_TEST_HAVE_ALT_AES 0
-#endif
+#    if defined(MBEDTLS_AES_ALT) || defined(MBEDTLS_AES_SETKEY_ENC_ALT) || \
+        defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_AES)
+#        define MBEDTLS_TEST_HAVE_ALT_AES 1
+#    else
+#        define MBEDTLS_TEST_HAVE_ALT_AES 0
+#    endif
 
-#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 ) )                                         \
-        {                                                                 \
-            mbedtls_test_skip( "AES-192 not supported", __LINE__, __FILE__ );     \
-            goto exit;                                                    \
-        }                                                                 \
-    }                                                                     \
-    while( 0 )
+#    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)) { \
+                mbedtls_test_skip("AES-192 not supported", __LINE__,     \
+                                  __FILE__);                             \
+                goto exit;                                               \
+            }                                                            \
+        } 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
@@ -256,27 +248,24 @@
  *  \param  alg             The AEAD algorithm.
  *  \param  nonce_length    The nonce length in number of bytes.
  */
-#if defined(MBEDTLS_GCM_ALT) || \
-    defined(MBEDTLS_PSA_ACCEL_ALG_GCM)
-#define MBEDTLS_TEST_HAVE_ALT_GCM  1
-#else
-#define MBEDTLS_TEST_HAVE_ALT_GCM  0
-#endif
+#    if defined(MBEDTLS_GCM_ALT) || defined(MBEDTLS_PSA_ACCEL_ALG_GCM)
+#        define MBEDTLS_TEST_HAVE_ALT_GCM 1
+#    else
+#        define MBEDTLS_TEST_HAVE_ALT_GCM 0
+#    endif
 
-#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 ) )                                   \
-        {                                                                  \
-            mbedtls_test_skip( "GCM with non-12-byte IV is not supported", __LINE__, __FILE__ ); \
-            goto exit;                                                     \
-        }                                                                  \
-    }                                                                      \
-    while( 0 )
+#    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)) {                                     \
+                mbedtls_test_skip("GCM with non-12-byte IV is not supported", \
+                                  __LINE__, __FILE__);                        \
+                goto exit;                                                    \
+            }                                                                 \
+        } while (0)
 
 #endif /* MBEDTLS_PSA_CRYPTO_C */
 
@@ -293,14 +282,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 aa0aeb5..7fc84b5 100644
--- a/tests/include/test/psa_exercise_key.h
+++ b/tests/include/test/psa_exercise_key.h
@@ -33,23 +33,23 @@
  * This is used in some smoke tests.
  */
 #if defined(PSA_WANT_ALG_MD5)
-#define KNOWN_SUPPORTED_HASH_ALG PSA_ALG_MD5
+#    define KNOWN_SUPPORTED_HASH_ALG PSA_ALG_MD5
 /* MBEDTLS_RIPEMD160_C omitted. This is necessary for the sake of
  * exercise_signature_key() because Mbed TLS doesn't support RIPEMD160
  * in RSA PKCS#1v1.5 signatures. A RIPEMD160-only configuration would be
  * implausible anyway. */
 #elif defined(PSA_WANT_ALG_SHA_1)
-#define KNOWN_SUPPORTED_HASH_ALG PSA_ALG_SHA_1
+#    define KNOWN_SUPPORTED_HASH_ALG PSA_ALG_SHA_1
 #elif defined(PSA_WANT_ALG_SHA_256)
-#define KNOWN_SUPPORTED_HASH_ALG PSA_ALG_SHA_256
+#    define KNOWN_SUPPORTED_HASH_ALG PSA_ALG_SHA_256
 #elif defined(PSA_WANT_ALG_SHA_384)
-#define KNOWN_SUPPORTED_HASH_ALG PSA_ALG_SHA_384
+#    define KNOWN_SUPPORTED_HASH_ALG PSA_ALG_SHA_384
 #elif defined(PSA_WANT_ALG_SHA_512)
-#define KNOWN_SUPPORTED_HASH_ALG PSA_ALG_SHA_512
+#    define KNOWN_SUPPORTED_HASH_ALG PSA_ALG_SHA_512
 #elif defined(PSA_WANT_ALG_SHA3_256)
-#define KNOWN_SUPPORTED_HASH_ALG PSA_ALG_SHA3_256
+#    define KNOWN_SUPPORTED_HASH_ALG PSA_ALG_SHA3_256
 #else
-#undef KNOWN_SUPPORTED_HASH_ALG
+#    undef KNOWN_SUPPORTED_HASH_ALG
 #endif
 
 /** \def KNOWN_SUPPORTED_BLOCK_CIPHER
@@ -59,12 +59,12 @@
  * For simplicity's sake, stick to block ciphers with 16-byte blocks.
  */
 #if defined(MBEDTLS_AES_C)
-#define KNOWN_SUPPORTED_BLOCK_CIPHER PSA_KEY_TYPE_AES
+#    define KNOWN_SUPPORTED_BLOCK_CIPHER PSA_KEY_TYPE_AES
 #elif defined(MBEDTLS_ARIA_C)
-#define KNOWN_SUPPORTED_BLOCK_CIPHER PSA_KEY_TYPE_ARIA
+#    define KNOWN_SUPPORTED_BLOCK_CIPHER PSA_KEY_TYPE_ARIA
 #elif defined(MBEDTLS_CAMELLIA_C)
-#define KNOWN_SUPPORTED_BLOCK_CIPHER PSA_KEY_TYPE_CAMELLIA
-#undef KNOWN_SUPPORTED_BLOCK_CIPHER
+#    define KNOWN_SUPPORTED_BLOCK_CIPHER PSA_KEY_TYPE_CAMELLIA
+#    undef KNOWN_SUPPORTED_BLOCK_CIPHER
 #endif
 
 /** \def KNOWN_SUPPORTED_MAC_ALG
@@ -77,14 +77,14 @@
  * 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_KEY_TYPE PSA_KEY_TYPE_HMAC
+#    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
-#define KNOWN_SUPPORTED_MAC_KEY_TYPE KNOWN_SUPPORTED_BLOCK_CIPHER
+#    define KNOWN_SUPPORTED_MAC_ALG      PSA_ALG_CMAC
+#    define KNOWN_SUPPORTED_MAC_KEY_TYPE KNOWN_SUPPORTED_BLOCK_CIPHER
 #else
-#undef KNOWN_SUPPORTED_MAC_ALG
-#undef KNOWN_SUPPORTED_MAC_KEY_TYPE
+#    undef KNOWN_SUPPORTED_MAC_ALG
+#    undef KNOWN_SUPPORTED_MAC_KEY_TYPE
 #endif
 
 /** \def KNOWN_SUPPORTED_BLOCK_CIPHER_ALG
@@ -94,22 +94,22 @@
  * This is used in some smoke tests.
  */
 #if defined(KNOWN_SUPPORTED_BLOCK_CIPHER) && defined(MBEDTLS_CIPHER_MODE_CTR)
-#define KNOWN_SUPPORTED_BLOCK_CIPHER_ALG PSA_ALG_CTR
+#    define KNOWN_SUPPORTED_BLOCK_CIPHER_ALG PSA_ALG_CTR
 #elif defined(KNOWN_SUPPORTED_BLOCK_CIPHER) && defined(MBEDTLS_CIPHER_MODE_CBC)
-#define KNOWN_SUPPORTED_BLOCK_CIPHER_ALG PSA_ALG_CBC_NO_PADDING
+#    define KNOWN_SUPPORTED_BLOCK_CIPHER_ALG PSA_ALG_CBC_NO_PADDING
 #elif defined(KNOWN_SUPPORTED_BLOCK_CIPHER) && defined(MBEDTLS_CIPHER_MODE_CFB)
-#define KNOWN_SUPPORTED_BLOCK_CIPHER_ALG PSA_ALG_CFB
+#    define KNOWN_SUPPORTED_BLOCK_CIPHER_ALG PSA_ALG_CFB
 #elif defined(KNOWN_SUPPORTED_BLOCK_CIPHER) && defined(MBEDTLS_CIPHER_MODE_OFB)
-#define KNOWN_SUPPORTED_BLOCK_CIPHER_ALG PSA_ALG_OFB
+#    define KNOWN_SUPPORTED_BLOCK_CIPHER_ALG PSA_ALG_OFB
 #else
-#undef KNOWN_SUPPORTED_BLOCK_CIPHER_ALG
+#    undef KNOWN_SUPPORTED_BLOCK_CIPHER_ALG
 #endif
 #if defined(KNOWN_SUPPORTED_BLOCK_CIPHER_ALG)
-#define KNOWN_SUPPORTED_CIPHER_ALG KNOWN_SUPPORTED_BLOCK_CIPHER_ALG
-#define KNOWN_SUPPORTED_CIPHER_KEY_TYPE KNOWN_SUPPORTED_BLOCK_CIPHER
+#    define KNOWN_SUPPORTED_CIPHER_ALG      KNOWN_SUPPORTED_BLOCK_CIPHER_ALG
+#    define KNOWN_SUPPORTED_CIPHER_KEY_TYPE KNOWN_SUPPORTED_BLOCK_CIPHER
 #else
-#undef KNOWN_SUPPORTED_CIPHER_ALG
-#undef KNOWN_SUPPORTED_CIPHER_KEY_TYPE
+#    undef KNOWN_SUPPORTED_CIPHER_ALG
+#    undef KNOWN_SUPPORTED_CIPHER_KEY_TYPE
 #endif
 
 /** Convenience function to set up a key derivation.
@@ -133,12 +133,14 @@
  * \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().
@@ -152,9 +154,9 @@
  *
  * \return                  \c 1 on success, \c 0 on failure.
  */
-psa_status_t mbedtls_test_psa_raw_key_agreement_with_self(
-    psa_algorithm_t alg,
-    mbedtls_svc_key_id_t key );
+psa_status_t
+mbedtls_test_psa_raw_key_agreement_with_self(psa_algorithm_t alg,
+                                             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().
@@ -173,7 +175,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.
  *
@@ -193,9 +195,10 @@
  *
  * \return                  \c 1 if all checks passed, \c 0 on failure.
  */
-int mbedtls_test_psa_exported_key_sanity_check(
-    psa_key_type_t type, size_t bits,
-    const uint8_t *exported, size_t exported_length );
+int mbedtls_test_psa_exported_key_sanity_check(psa_key_type_t type,
+                                               size_t bits,
+                                               const uint8_t *exported,
+                                               size_t exported_length);
 
 /** Do smoke tests on a key.
  *
@@ -224,11 +227,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..9ce945d 100644
--- a/tests/include/test/psa_helpers.h
+++ b/tests/include/test/psa_helpers.h
@@ -22,7 +22,7 @@
 #define PSA_HELPERS_H
 
 #if defined(MBEDTLS_PSA_CRYPTO_SPM)
-#include "spm/psa_defs.h"
+#    include "spm/psa_defs.h"
 #endif
 
 /** Evaluate an expression and fail the test case if it returns an error.
@@ -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 58548a2..c557208 100644
--- a/tests/include/test/random.h
+++ b/tests/include/test/random.h
@@ -30,12 +30,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;
 
@@ -46,8 +45,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;
@@ -61,18 +59,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.
@@ -86,9 +84,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.
@@ -98,8 +96,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 8ece1e3..126e2df 100644
--- a/tests/src/asn1_helpers.c
+++ b/tests/src/asn1_helpers.c
@@ -25,50 +25,48 @@
 
 #if defined(MBEDTLS_ASN1_PARSE_C)
 
-#include <mbedtls/asn1.h>
+#    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/certs.c b/tests/src/certs.c
index 831395c..4d97318 100644
--- a/tests/src/certs.c
+++ b/tests/src/certs.c
@@ -53,57 +53,64 @@
 /* END FILE */
 
 /* This is generated from tests/data_files/test-ca2.crt.der using `xxd -i`. */
-/* BEGIN FILE binary macro TEST_CA_CRT_EC_DER tests/data_files/test-ca2.crt.der */
-#define TEST_CA_CRT_EC_DER {                                                 \
-  0x30, 0x82, 0x02, 0x04, 0x30, 0x82, 0x01, 0x88, 0xa0, 0x03, 0x02, 0x01,    \
-  0x02, 0x02, 0x09, 0x00, 0xc1, 0x43, 0xe2, 0x7e, 0x62, 0x43, 0xcc, 0xe8,    \
-  0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02,    \
-  0x05, 0x00, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,    \
-  0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55,    \
-  0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c,    \
-  0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x13, 0x50,    \
-  0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, 0x73, 0x74,    \
-  0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x39,    \
-  0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, 0x30, 0x5a, 0x17,    \
-  0x0d, 0x32, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30,    \
-  0x30, 0x5a, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,    \
-  0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55,    \
-  0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c,    \
-  0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x13, 0x50,    \
-  0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, 0x73, 0x74,    \
-  0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x76, 0x30, 0x10, 0x06, 0x07,    \
-  0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04,    \
-  0x00, 0x22, 0x03, 0x62, 0x00, 0x04, 0xc3, 0xda, 0x2b, 0x34, 0x41, 0x37,    \
-  0x58, 0x2f, 0x87, 0x56, 0xfe, 0xfc, 0x89, 0xba, 0x29, 0x43, 0x4b, 0x4e,    \
-  0xe0, 0x6e, 0xc3, 0x0e, 0x57, 0x53, 0x33, 0x39, 0x58, 0xd4, 0x52, 0xb4,    \
-  0x91, 0x95, 0x39, 0x0b, 0x23, 0xdf, 0x5f, 0x17, 0x24, 0x62, 0x48, 0xfc,    \
-  0x1a, 0x95, 0x29, 0xce, 0x2c, 0x2d, 0x87, 0xc2, 0x88, 0x52, 0x80, 0xaf,    \
-  0xd6, 0x6a, 0xab, 0x21, 0xdd, 0xb8, 0xd3, 0x1c, 0x6e, 0x58, 0xb8, 0xca,    \
-  0xe8, 0xb2, 0x69, 0x8e, 0xf3, 0x41, 0xad, 0x29, 0xc3, 0xb4, 0x5f, 0x75,    \
-  0xa7, 0x47, 0x6f, 0xd5, 0x19, 0x29, 0x55, 0x69, 0x9a, 0x53, 0x3b, 0x20,    \
-  0xb4, 0x66, 0x16, 0x60, 0x33, 0x1e, 0xa3, 0x50, 0x30, 0x4e, 0x30, 0x0c,    \
-  0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff,    \
-  0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x9d,    \
-  0x6d, 0x20, 0x24, 0x49, 0x01, 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc,    \
-  0x7e, 0x24, 0xc9, 0xdb, 0xfb, 0x36, 0x7c, 0x30, 0x1f, 0x06, 0x03, 0x55,    \
-  0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x9d, 0x6d, 0x20, 0x24,    \
-  0x49, 0x01, 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, 0x7e, 0x24, 0xc9,    \
-  0xdb, 0xfb, 0x36, 0x7c, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce,    \
-  0x3d, 0x04, 0x03, 0x02, 0x05, 0x00, 0x03, 0x68, 0x00, 0x30, 0x65, 0x02,    \
-  0x30, 0x51, 0xca, 0xae, 0x30, 0x0f, 0xa4, 0x70, 0x74, 0x04, 0xdd, 0x5a,    \
-  0x2c, 0x7f, 0x13, 0xc1, 0xc2, 0x77, 0xbe, 0x1d, 0x00, 0xc5, 0xe2, 0x99,    \
-  0x8f, 0x7d, 0x26, 0x45, 0xd3, 0x8a, 0x06, 0x68, 0x3f, 0x8c, 0xb4, 0xb7,    \
-  0xad, 0x4d, 0xe0, 0xf1, 0x54, 0x01, 0x1e, 0x99, 0xfc, 0xb0, 0xe4, 0xd3,    \
-  0x07, 0x02, 0x31, 0x00, 0xdc, 0x4f, 0x3b, 0x90, 0x1e, 0xae, 0x29, 0x99,    \
-  0x84, 0x28, 0xcc, 0x7b, 0x47, 0x78, 0x09, 0x31, 0xdf, 0xd6, 0x01, 0x59,    \
-  0x30, 0x5e, 0xf4, 0xf8, 0x8a, 0x84, 0x3f, 0xea, 0x39, 0x54, 0x7b, 0x08,    \
-  0xa7, 0x60, 0xaa, 0xbd, 0xf9, 0x5b, 0xd1, 0x51, 0x96, 0x14, 0x2e, 0x65,    \
-  0xf5, 0xae, 0x1c, 0x42                                                     \
-}
+/* BEGIN FILE binary macro TEST_CA_CRT_EC_DER tests/data_files/test-ca2.crt.der
+ */
+#define TEST_CA_CRT_EC_DER                                                    \
+    {                                                                         \
+        0x30, 0x82, 0x02, 0x04, 0x30, 0x82, 0x01, 0x88, 0xa0, 0x03, 0x02,     \
+            0x01, 0x02, 0x02, 0x09, 0x00, 0xc1, 0x43, 0xe2, 0x7e, 0x62, 0x43, \
+            0xcc, 0xe8, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, \
+            0x04, 0x03, 0x02, 0x05, 0x00, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, \
+            0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, \
+            0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, \
+            0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, 0x06, \
+            0x03, 0x55, 0x04, 0x03, 0x0c, 0x13, 0x50, 0x6f, 0x6c, 0x61, 0x72, \
+            0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x43, \
+            0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x39, 0x30, 0x32, \
+            0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, 0x30, 0x5a, 0x17, 0x0d, \
+            0x32, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, \
+            0x30, 0x5a, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, \
+            0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, \
+            0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, \
+            0x53, 0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, \
+            0x03, 0x0c, 0x13, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, \
+            0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, \
+            0x30, 0x76, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, \
+            0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x22, 0x03, 0x62, \
+            0x00, 0x04, 0xc3, 0xda, 0x2b, 0x34, 0x41, 0x37, 0x58, 0x2f, 0x87, \
+            0x56, 0xfe, 0xfc, 0x89, 0xba, 0x29, 0x43, 0x4b, 0x4e, 0xe0, 0x6e, \
+            0xc3, 0x0e, 0x57, 0x53, 0x33, 0x39, 0x58, 0xd4, 0x52, 0xb4, 0x91, \
+            0x95, 0x39, 0x0b, 0x23, 0xdf, 0x5f, 0x17, 0x24, 0x62, 0x48, 0xfc, \
+            0x1a, 0x95, 0x29, 0xce, 0x2c, 0x2d, 0x87, 0xc2, 0x88, 0x52, 0x80, \
+            0xaf, 0xd6, 0x6a, 0xab, 0x21, 0xdd, 0xb8, 0xd3, 0x1c, 0x6e, 0x58, \
+            0xb8, 0xca, 0xe8, 0xb2, 0x69, 0x8e, 0xf3, 0x41, 0xad, 0x29, 0xc3, \
+            0xb4, 0x5f, 0x75, 0xa7, 0x47, 0x6f, 0xd5, 0x19, 0x29, 0x55, 0x69, \
+            0x9a, 0x53, 0x3b, 0x20, 0xb4, 0x66, 0x16, 0x60, 0x33, 0x1e, 0xa3, \
+            0x50, 0x30, 0x4e, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, \
+            0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1d, 0x06, 0x03, 0x55, \
+            0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x9d, 0x6d, 0x20, 0x24, 0x49, \
+            0x01, 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, 0x7e, 0x24, 0xc9, \
+            0xdb, 0xfb, 0x36, 0x7c, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, \
+            0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x9d, 0x6d, 0x20, 0x24, 0x49, \
+            0x01, 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, 0x7e, 0x24, 0xc9, \
+            0xdb, 0xfb, 0x36, 0x7c, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, \
+            0xce, 0x3d, 0x04, 0x03, 0x02, 0x05, 0x00, 0x03, 0x68, 0x00, 0x30, \
+            0x65, 0x02, 0x30, 0x51, 0xca, 0xae, 0x30, 0x0f, 0xa4, 0x70, 0x74, \
+            0x04, 0xdd, 0x5a, 0x2c, 0x7f, 0x13, 0xc1, 0xc2, 0x77, 0xbe, 0x1d, \
+            0x00, 0xc5, 0xe2, 0x99, 0x8f, 0x7d, 0x26, 0x45, 0xd3, 0x8a, 0x06, \
+            0x68, 0x3f, 0x8c, 0xb4, 0xb7, 0xad, 0x4d, 0xe0, 0xf1, 0x54, 0x01, \
+            0x1e, 0x99, 0xfc, 0xb0, 0xe4, 0xd3, 0x07, 0x02, 0x31, 0x00, 0xdc, \
+            0x4f, 0x3b, 0x90, 0x1e, 0xae, 0x29, 0x99, 0x84, 0x28, 0xcc, 0x7b, \
+            0x47, 0x78, 0x09, 0x31, 0xdf, 0xd6, 0x01, 0x59, 0x30, 0x5e, 0xf4, \
+            0xf8, 0x8a, 0x84, 0x3f, 0xea, 0x39, 0x54, 0x7b, 0x08, 0xa7, 0x60, \
+            0xaa, 0xbd, 0xf9, 0x5b, 0xd1, 0x51, 0x96, 0x14, 0x2e, 0x65, 0xf5, \
+            0xae, 0x1c, 0x42                                                  \
+    }
 /* END FILE */
 
 /* This is taken from tests/data_files/test-ca2.key.enc */
-/* BEGIN FILE string macro TEST_CA_KEY_EC_PEM tests/data_files/test-ca2.key.enc */
+/* BEGIN FILE string macro TEST_CA_KEY_EC_PEM tests/data_files/test-ca2.key.enc
+ */
 #define TEST_CA_KEY_EC_PEM                                                 \
     "-----BEGIN EC PRIVATE KEY-----\r\n"                                   \
     "Proc-Type: 4,ENCRYPTED\r\n"                                           \
@@ -119,27 +126,32 @@
 #define TEST_CA_PWD_EC_PEM "PolarSSLTest"
 
 /* This is generated from tests/data_files/test-ca2.key.der using `xxd -i`. */
-/* BEGIN FILE binary macro TEST_CA_KEY_EC_DER tests/data_files/test-ca2.key.der */
-#define TEST_CA_KEY_EC_DER {                                                 \
-    0x30, 0x81, 0xa4, 0x02, 0x01, 0x01, 0x04, 0x30, 0x83, 0xd9, 0x15, 0x0e,  \
-    0xa0, 0x71, 0xf0, 0x57, 0x10, 0x33, 0xa3, 0x38, 0xb8, 0x86, 0xc1, 0xa6,  \
-    0x11, 0x5d, 0x6d, 0xb4, 0x03, 0xe1, 0x29, 0x76, 0x45, 0xd7, 0x87, 0x6f,  \
-    0x23, 0xab, 0x44, 0x20, 0xea, 0x64, 0x7b, 0x85, 0xb1, 0x76, 0xe7, 0x85,  \
-    0x95, 0xaa, 0x74, 0xd6, 0xd1, 0xa4, 0x5e, 0xea, 0xa0, 0x07, 0x06, 0x05,  \
-    0x2b, 0x81, 0x04, 0x00, 0x22, 0xa1, 0x64, 0x03, 0x62, 0x00, 0x04, 0xc3,  \
-    0xda, 0x2b, 0x34, 0x41, 0x37, 0x58, 0x2f, 0x87, 0x56, 0xfe, 0xfc, 0x89,  \
-    0xba, 0x29, 0x43, 0x4b, 0x4e, 0xe0, 0x6e, 0xc3, 0x0e, 0x57, 0x53, 0x33,  \
-    0x39, 0x58, 0xd4, 0x52, 0xb4, 0x91, 0x95, 0x39, 0x0b, 0x23, 0xdf, 0x5f,  \
-    0x17, 0x24, 0x62, 0x48, 0xfc, 0x1a, 0x95, 0x29, 0xce, 0x2c, 0x2d, 0x87,  \
-    0xc2, 0x88, 0x52, 0x80, 0xaf, 0xd6, 0x6a, 0xab, 0x21, 0xdd, 0xb8, 0xd3,  \
-    0x1c, 0x6e, 0x58, 0xb8, 0xca, 0xe8, 0xb2, 0x69, 0x8e, 0xf3, 0x41, 0xad,  \
-    0x29, 0xc3, 0xb4, 0x5f, 0x75, 0xa7, 0x47, 0x6f, 0xd5, 0x19, 0x29, 0x55,  \
-    0x69, 0x9a, 0x53, 0x3b, 0x20, 0xb4, 0x66, 0x16, 0x60, 0x33, 0x1e         \
-}
+/* BEGIN FILE binary macro TEST_CA_KEY_EC_DER tests/data_files/test-ca2.key.der
+ */
+#define TEST_CA_KEY_EC_DER                                                    \
+    {                                                                         \
+        0x30, 0x81, 0xa4, 0x02, 0x01, 0x01, 0x04, 0x30, 0x83, 0xd9, 0x15,     \
+            0x0e, 0xa0, 0x71, 0xf0, 0x57, 0x10, 0x33, 0xa3, 0x38, 0xb8, 0x86, \
+            0xc1, 0xa6, 0x11, 0x5d, 0x6d, 0xb4, 0x03, 0xe1, 0x29, 0x76, 0x45, \
+            0xd7, 0x87, 0x6f, 0x23, 0xab, 0x44, 0x20, 0xea, 0x64, 0x7b, 0x85, \
+            0xb1, 0x76, 0xe7, 0x85, 0x95, 0xaa, 0x74, 0xd6, 0xd1, 0xa4, 0x5e, \
+            0xea, 0xa0, 0x07, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x22, 0xa1, \
+            0x64, 0x03, 0x62, 0x00, 0x04, 0xc3, 0xda, 0x2b, 0x34, 0x41, 0x37, \
+            0x58, 0x2f, 0x87, 0x56, 0xfe, 0xfc, 0x89, 0xba, 0x29, 0x43, 0x4b, \
+            0x4e, 0xe0, 0x6e, 0xc3, 0x0e, 0x57, 0x53, 0x33, 0x39, 0x58, 0xd4, \
+            0x52, 0xb4, 0x91, 0x95, 0x39, 0x0b, 0x23, 0xdf, 0x5f, 0x17, 0x24, \
+            0x62, 0x48, 0xfc, 0x1a, 0x95, 0x29, 0xce, 0x2c, 0x2d, 0x87, 0xc2, \
+            0x88, 0x52, 0x80, 0xaf, 0xd6, 0x6a, 0xab, 0x21, 0xdd, 0xb8, 0xd3, \
+            0x1c, 0x6e, 0x58, 0xb8, 0xca, 0xe8, 0xb2, 0x69, 0x8e, 0xf3, 0x41, \
+            0xad, 0x29, 0xc3, 0xb4, 0x5f, 0x75, 0xa7, 0x47, 0x6f, 0xd5, 0x19, \
+            0x29, 0x55, 0x69, 0x9a, 0x53, 0x3b, 0x20, 0xb4, 0x66, 0x16, 0x60, \
+            0x33, 0x1e                                                        \
+    }
 /* END FILE */
 
 /* This is taken from tests/data_files/test-ca-sha256.crt. */
-/* BEGIN FILE string macro TEST_CA_CRT_RSA_SHA256_PEM tests/data_files/test-ca-sha256.crt */
+/* BEGIN FILE string macro TEST_CA_CRT_RSA_SHA256_PEM
+ * tests/data_files/test-ca-sha256.crt */
 #define TEST_CA_CRT_RSA_SHA256_PEM                                         \
     "-----BEGIN CERTIFICATE-----\r\n"                                      \
     "MIIDQTCCAimgAwIBAgIBAzANBgkqhkiG9w0BAQsFADA7MQswCQYDVQQGEwJOTDER\r\n" \
@@ -165,83 +177,93 @@
 
 /* This is generated from tests/data_files/test-ca-sha256.crt.der
  * using `xxd -i`. */
-/* BEGIN FILE binary macro TEST_CA_CRT_RSA_SHA256_DER tests/data_files/test-ca-sha256.crt.der */
-#define TEST_CA_CRT_RSA_SHA256_DER {                                         \
-  0x30, 0x82, 0x03, 0x41, 0x30, 0x82, 0x02, 0x29, 0xa0, 0x03, 0x02, 0x01,    \
-  0x02, 0x02, 0x01, 0x03, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,    \
-  0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x3b, 0x31, 0x0b, 0x30,    \
-  0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11,    \
-  0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c,    \
-  0x61, 0x72, 0x53, 0x53, 0x4c, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55,    \
-  0x04, 0x03, 0x0c, 0x10, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c,    \
-  0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d,    \
-  0x31, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, 0x30,    \
-  0x5a, 0x17, 0x0d, 0x32, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34,    \
-  0x34, 0x30, 0x30, 0x5a, 0x30, 0x3b, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,    \
-  0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06,    \
-  0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53,    \
-  0x53, 0x4c, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,    \
-  0x10, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x20, 0x54, 0x65,    \
-  0x73, 0x74, 0x20, 0x43, 0x41, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06,    \
-  0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00,    \
-  0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01,    \
-  0x01, 0x00, 0xc0, 0xdf, 0x37, 0xfc, 0x17, 0xbb, 0xe0, 0x96, 0x9d, 0x3f,    \
-  0x86, 0xde, 0x96, 0x32, 0x7d, 0x44, 0xa5, 0x16, 0xa0, 0xcd, 0x21, 0xf1,    \
-  0x99, 0xd4, 0xec, 0xea, 0xcb, 0x7c, 0x18, 0x58, 0x08, 0x94, 0xa5, 0xec,    \
-  0x9b, 0xc5, 0x8b, 0xdf, 0x1a, 0x1e, 0x99, 0x38, 0x99, 0x87, 0x1e, 0x7b,    \
-  0xc0, 0x8d, 0x39, 0xdf, 0x38, 0x5d, 0x70, 0x78, 0x07, 0xd3, 0x9e, 0xd9,    \
-  0x93, 0xe8, 0xb9, 0x72, 0x51, 0xc5, 0xce, 0xa3, 0x30, 0x52, 0xa9, 0xf2,    \
-  0xe7, 0x40, 0x70, 0x14, 0xcb, 0x44, 0xa2, 0x72, 0x0b, 0xc2, 0xe5, 0x40,    \
-  0xf9, 0x3e, 0xe5, 0xa6, 0x0e, 0xb3, 0xf9, 0xec, 0x4a, 0x63, 0xc0, 0xb8,    \
-  0x29, 0x00, 0x74, 0x9c, 0x57, 0x3b, 0xa8, 0xa5, 0x04, 0x90, 0x71, 0xf1,    \
-  0xbd, 0x83, 0xd9, 0x3f, 0xd6, 0xa5, 0xe2, 0x3c, 0x2a, 0x8f, 0xef, 0x27,    \
-  0x60, 0xc3, 0xc6, 0x9f, 0xcb, 0xba, 0xec, 0x60, 0x7d, 0xb7, 0xe6, 0x84,    \
-  0x32, 0xbe, 0x4f, 0xfb, 0x58, 0x26, 0x22, 0x03, 0x5b, 0xd4, 0xb4, 0xd5,    \
-  0xfb, 0xf5, 0xe3, 0x96, 0x2e, 0x70, 0xc0, 0xe4, 0x2e, 0xbd, 0xfc, 0x2e,    \
-  0xee, 0xe2, 0x41, 0x55, 0xc0, 0x34, 0x2e, 0x7d, 0x24, 0x72, 0x69, 0xcb,    \
-  0x47, 0xb1, 0x14, 0x40, 0x83, 0x7d, 0x67, 0xf4, 0x86, 0xf6, 0x31, 0xab,    \
-  0xf1, 0x79, 0xa4, 0xb2, 0xb5, 0x2e, 0x12, 0xf9, 0x84, 0x17, 0xf0, 0x62,    \
-  0x6f, 0x27, 0x3e, 0x13, 0x58, 0xb1, 0x54, 0x0d, 0x21, 0x9a, 0x73, 0x37,    \
-  0xa1, 0x30, 0xcf, 0x6f, 0x92, 0xdc, 0xf6, 0xe9, 0xfc, 0xac, 0xdb, 0x2e,    \
-  0x28, 0xd1, 0x7e, 0x02, 0x4b, 0x23, 0xa0, 0x15, 0xf2, 0x38, 0x65, 0x64,    \
-  0x09, 0xea, 0x0c, 0x6e, 0x8e, 0x1b, 0x17, 0xa0, 0x71, 0xc8, 0xb3, 0x9b,    \
-  0xc9, 0xab, 0xe9, 0xc3, 0xf2, 0xcf, 0x87, 0x96, 0x8f, 0x80, 0x02, 0x32,    \
-  0x9e, 0x99, 0x58, 0x6f, 0xa2, 0xd5, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3,    \
-  0x50, 0x30, 0x4e, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05,    \
-  0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e,    \
-  0x04, 0x16, 0x04, 0x14, 0xb4, 0x5a, 0xe4, 0xa5, 0xb3, 0xde, 0xd2, 0x52,    \
-  0xf6, 0xb9, 0xd5, 0xa6, 0x95, 0x0f, 0xeb, 0x3e, 0xbc, 0xc7, 0xfd, 0xff,    \
-  0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80,    \
-  0x14, 0xb4, 0x5a, 0xe4, 0xa5, 0xb3, 0xde, 0xd2, 0x52, 0xf6, 0xb9, 0xd5,    \
-  0xa6, 0x95, 0x0f, 0xeb, 0x3e, 0xbc, 0xc7, 0xfd, 0xff, 0x30, 0x0d, 0x06,    \
-  0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00,    \
-  0x03, 0x82, 0x01, 0x01, 0x00, 0x38, 0xa8, 0x54, 0x82, 0xb6, 0x1d, 0xaa,    \
-  0xdb, 0x6b, 0x89, 0x21, 0xd1, 0x38, 0x28, 0x61, 0xc9, 0xb0, 0x98, 0xd5,    \
-  0x11, 0xfc, 0x36, 0xff, 0x19, 0xfe, 0x32, 0x44, 0xef, 0x08, 0xc7, 0xf1,    \
-  0x56, 0xbb, 0xe6, 0x46, 0xfa, 0x82, 0xb6, 0x31, 0x38, 0xb4, 0xa0, 0xe5,    \
-  0xa0, 0xae, 0x0c, 0xc4, 0x53, 0x9e, 0x93, 0x4e, 0xe8, 0x0d, 0x9c, 0x2f,    \
-  0xb4, 0x04, 0xfd, 0x8a, 0x39, 0xf5, 0x84, 0x77, 0xed, 0x4c, 0xd4, 0xbb,    \
-  0x44, 0x7f, 0x73, 0x77, 0xf7, 0xf1, 0x36, 0x97, 0xdc, 0x1e, 0x73, 0x19,    \
-  0x5d, 0x50, 0xb8, 0xc3, 0x80, 0xcd, 0x03, 0x57, 0xd2, 0x00, 0xdb, 0x56,    \
-  0xe6, 0xc6, 0x35, 0x24, 0x1e, 0x49, 0x7b, 0xd8, 0xd2, 0x72, 0xbb, 0x0b,    \
-  0x49, 0x2f, 0xa6, 0x02, 0x3c, 0xaf, 0xd0, 0xec, 0x37, 0x1d, 0xbd, 0x81,    \
-  0x8b, 0x1f, 0x30, 0xbb, 0xbc, 0x4d, 0x36, 0xb5, 0x79, 0x7c, 0x87, 0xfb,    \
-  0x51, 0xb9, 0xbe, 0xc2, 0xde, 0x92, 0xa8, 0x40, 0x71, 0xbb, 0x72, 0x9b,    \
-  0xf8, 0x47, 0xce, 0x6c, 0x04, 0xf8, 0x86, 0xe7, 0xf7, 0x73, 0x3c, 0xe7,    \
-  0x84, 0x7d, 0xc2, 0xd7, 0xb7, 0x9d, 0xe8, 0xd4, 0x9b, 0x5f, 0x0a, 0x17,    \
-  0x7d, 0xbc, 0xbb, 0xb2, 0xd5, 0x94, 0x0d, 0xe4, 0x49, 0xbf, 0x4f, 0x11,    \
-  0x68, 0x53, 0xb2, 0x91, 0xff, 0xc0, 0x69, 0xee, 0xdb, 0x63, 0x93, 0xcb,    \
-  0xc9, 0x35, 0x6b, 0x90, 0x09, 0xe2, 0x90, 0xc9, 0xed, 0x27, 0xd6, 0x08,    \
-  0xfa, 0x13, 0x4d, 0x62, 0xdd, 0xe2, 0x9e, 0xaa, 0xb5, 0xd4, 0x0e, 0x5c,    \
-  0x37, 0x4f, 0xab, 0x55, 0x3b, 0x2d, 0xf1, 0x42, 0x82, 0xc7, 0x34, 0x38,    \
-  0x1a, 0x9b, 0xeb, 0xa1, 0x2c, 0x0f, 0x29, 0x31, 0x64, 0x6c, 0xcc, 0x38,    \
-  0xfd, 0xa9, 0xd3, 0xd5, 0xd5, 0x71, 0xaf, 0xf0, 0x6d, 0xc0, 0x97, 0xe2,    \
-  0x11, 0x2a, 0x0a, 0xdf, 0xfe, 0x02, 0x79, 0x74, 0x75                       \
-}
+/* BEGIN FILE binary macro TEST_CA_CRT_RSA_SHA256_DER
+ * tests/data_files/test-ca-sha256.crt.der */
+#define TEST_CA_CRT_RSA_SHA256_DER                                            \
+    {                                                                         \
+        0x30, 0x82, 0x03, 0x41, 0x30, 0x82, 0x02, 0x29, 0xa0, 0x03, 0x02,     \
+            0x01, 0x02, 0x02, 0x01, 0x03, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, \
+            0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x3b, \
+            0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, \
+            0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, \
+            0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x31, \
+            0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x10, 0x50, \
+            0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x20, 0x54, 0x65, 0x73, \
+            0x74, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x39, 0x30, \
+            0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, 0x30, 0x5a, 0x17, \
+            0x0d, 0x32, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, \
+            0x30, 0x30, 0x5a, 0x30, 0x3b, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \
+            0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, \
+            0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, \
+            0x72, 0x53, 0x53, 0x4c, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, \
+            0x04, 0x03, 0x0c, 0x10, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, \
+            0x4c, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x30, 0x82, \
+            0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, \
+            0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, \
+            0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xc0, 0xdf, \
+            0x37, 0xfc, 0x17, 0xbb, 0xe0, 0x96, 0x9d, 0x3f, 0x86, 0xde, 0x96, \
+            0x32, 0x7d, 0x44, 0xa5, 0x16, 0xa0, 0xcd, 0x21, 0xf1, 0x99, 0xd4, \
+            0xec, 0xea, 0xcb, 0x7c, 0x18, 0x58, 0x08, 0x94, 0xa5, 0xec, 0x9b, \
+            0xc5, 0x8b, 0xdf, 0x1a, 0x1e, 0x99, 0x38, 0x99, 0x87, 0x1e, 0x7b, \
+            0xc0, 0x8d, 0x39, 0xdf, 0x38, 0x5d, 0x70, 0x78, 0x07, 0xd3, 0x9e, \
+            0xd9, 0x93, 0xe8, 0xb9, 0x72, 0x51, 0xc5, 0xce, 0xa3, 0x30, 0x52, \
+            0xa9, 0xf2, 0xe7, 0x40, 0x70, 0x14, 0xcb, 0x44, 0xa2, 0x72, 0x0b, \
+            0xc2, 0xe5, 0x40, 0xf9, 0x3e, 0xe5, 0xa6, 0x0e, 0xb3, 0xf9, 0xec, \
+            0x4a, 0x63, 0xc0, 0xb8, 0x29, 0x00, 0x74, 0x9c, 0x57, 0x3b, 0xa8, \
+            0xa5, 0x04, 0x90, 0x71, 0xf1, 0xbd, 0x83, 0xd9, 0x3f, 0xd6, 0xa5, \
+            0xe2, 0x3c, 0x2a, 0x8f, 0xef, 0x27, 0x60, 0xc3, 0xc6, 0x9f, 0xcb, \
+            0xba, 0xec, 0x60, 0x7d, 0xb7, 0xe6, 0x84, 0x32, 0xbe, 0x4f, 0xfb, \
+            0x58, 0x26, 0x22, 0x03, 0x5b, 0xd4, 0xb4, 0xd5, 0xfb, 0xf5, 0xe3, \
+            0x96, 0x2e, 0x70, 0xc0, 0xe4, 0x2e, 0xbd, 0xfc, 0x2e, 0xee, 0xe2, \
+            0x41, 0x55, 0xc0, 0x34, 0x2e, 0x7d, 0x24, 0x72, 0x69, 0xcb, 0x47, \
+            0xb1, 0x14, 0x40, 0x83, 0x7d, 0x67, 0xf4, 0x86, 0xf6, 0x31, 0xab, \
+            0xf1, 0x79, 0xa4, 0xb2, 0xb5, 0x2e, 0x12, 0xf9, 0x84, 0x17, 0xf0, \
+            0x62, 0x6f, 0x27, 0x3e, 0x13, 0x58, 0xb1, 0x54, 0x0d, 0x21, 0x9a, \
+            0x73, 0x37, 0xa1, 0x30, 0xcf, 0x6f, 0x92, 0xdc, 0xf6, 0xe9, 0xfc, \
+            0xac, 0xdb, 0x2e, 0x28, 0xd1, 0x7e, 0x02, 0x4b, 0x23, 0xa0, 0x15, \
+            0xf2, 0x38, 0x65, 0x64, 0x09, 0xea, 0x0c, 0x6e, 0x8e, 0x1b, 0x17, \
+            0xa0, 0x71, 0xc8, 0xb3, 0x9b, 0xc9, 0xab, 0xe9, 0xc3, 0xf2, 0xcf, \
+            0x87, 0x96, 0x8f, 0x80, 0x02, 0x32, 0x9e, 0x99, 0x58, 0x6f, 0xa2, \
+            0xd5, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x50, 0x30, 0x4e, 0x30, \
+            0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, \
+            0x01, 0xff, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, \
+            0x04, 0x14, 0xb4, 0x5a, 0xe4, 0xa5, 0xb3, 0xde, 0xd2, 0x52, 0xf6, \
+            0xb9, 0xd5, 0xa6, 0x95, 0x0f, 0xeb, 0x3e, 0xbc, 0xc7, 0xfd, 0xff, \
+            0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, \
+            0x80, 0x14, 0xb4, 0x5a, 0xe4, 0xa5, 0xb3, 0xde, 0xd2, 0x52, 0xf6, \
+            0xb9, 0xd5, 0xa6, 0x95, 0x0f, 0xeb, 0x3e, 0xbc, 0xc7, 0xfd, 0xff, \
+            0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, \
+            0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x38, 0xa8, \
+            0x54, 0x82, 0xb6, 0x1d, 0xaa, 0xdb, 0x6b, 0x89, 0x21, 0xd1, 0x38, \
+            0x28, 0x61, 0xc9, 0xb0, 0x98, 0xd5, 0x11, 0xfc, 0x36, 0xff, 0x19, \
+            0xfe, 0x32, 0x44, 0xef, 0x08, 0xc7, 0xf1, 0x56, 0xbb, 0xe6, 0x46, \
+            0xfa, 0x82, 0xb6, 0x31, 0x38, 0xb4, 0xa0, 0xe5, 0xa0, 0xae, 0x0c, \
+            0xc4, 0x53, 0x9e, 0x93, 0x4e, 0xe8, 0x0d, 0x9c, 0x2f, 0xb4, 0x04, \
+            0xfd, 0x8a, 0x39, 0xf5, 0x84, 0x77, 0xed, 0x4c, 0xd4, 0xbb, 0x44, \
+            0x7f, 0x73, 0x77, 0xf7, 0xf1, 0x36, 0x97, 0xdc, 0x1e, 0x73, 0x19, \
+            0x5d, 0x50, 0xb8, 0xc3, 0x80, 0xcd, 0x03, 0x57, 0xd2, 0x00, 0xdb, \
+            0x56, 0xe6, 0xc6, 0x35, 0x24, 0x1e, 0x49, 0x7b, 0xd8, 0xd2, 0x72, \
+            0xbb, 0x0b, 0x49, 0x2f, 0xa6, 0x02, 0x3c, 0xaf, 0xd0, 0xec, 0x37, \
+            0x1d, 0xbd, 0x81, 0x8b, 0x1f, 0x30, 0xbb, 0xbc, 0x4d, 0x36, 0xb5, \
+            0x79, 0x7c, 0x87, 0xfb, 0x51, 0xb9, 0xbe, 0xc2, 0xde, 0x92, 0xa8, \
+            0x40, 0x71, 0xbb, 0x72, 0x9b, 0xf8, 0x47, 0xce, 0x6c, 0x04, 0xf8, \
+            0x86, 0xe7, 0xf7, 0x73, 0x3c, 0xe7, 0x84, 0x7d, 0xc2, 0xd7, 0xb7, \
+            0x9d, 0xe8, 0xd4, 0x9b, 0x5f, 0x0a, 0x17, 0x7d, 0xbc, 0xbb, 0xb2, \
+            0xd5, 0x94, 0x0d, 0xe4, 0x49, 0xbf, 0x4f, 0x11, 0x68, 0x53, 0xb2, \
+            0x91, 0xff, 0xc0, 0x69, 0xee, 0xdb, 0x63, 0x93, 0xcb, 0xc9, 0x35, \
+            0x6b, 0x90, 0x09, 0xe2, 0x90, 0xc9, 0xed, 0x27, 0xd6, 0x08, 0xfa, \
+            0x13, 0x4d, 0x62, 0xdd, 0xe2, 0x9e, 0xaa, 0xb5, 0xd4, 0x0e, 0x5c, \
+            0x37, 0x4f, 0xab, 0x55, 0x3b, 0x2d, 0xf1, 0x42, 0x82, 0xc7, 0x34, \
+            0x38, 0x1a, 0x9b, 0xeb, 0xa1, 0x2c, 0x0f, 0x29, 0x31, 0x64, 0x6c, \
+            0xcc, 0x38, 0xfd, 0xa9, 0xd3, 0xd5, 0xd5, 0x71, 0xaf, 0xf0, 0x6d, \
+            0xc0, 0x97, 0xe2, 0x11, 0x2a, 0x0a, 0xdf, 0xfe, 0x02, 0x79, 0x74, \
+            0x75                                                              \
+    }
 /* END FILE */
 
 /* This is taken from tests/data_files/test-ca-sha1.crt. */
-/* BEGIN FILE string macro TEST_CA_CRT_RSA_SHA1_PEM tests/data_files/test-ca-sha1.crt */
+/* BEGIN FILE string macro TEST_CA_CRT_RSA_SHA1_PEM
+ * tests/data_files/test-ca-sha1.crt */
 #define TEST_CA_CRT_RSA_SHA1_PEM                                           \
     "-----BEGIN CERTIFICATE-----\r\n"                                      \
     "MIIDQTCCAimgAwIBAgIBAzANBgkqhkiG9w0BAQUFADA7MQswCQYDVQQGEwJOTDER\r\n" \
@@ -266,79 +288,88 @@
 /* END FILE */
 
 /* This is taken from tests/data_files/test-ca-sha1.crt.der. */
-/* BEGIN FILE binary macro TEST_CA_CRT_RSA_SHA1_DER tests/data_files/test-ca-sha1.crt.der */
-#define TEST_CA_CRT_RSA_SHA1_DER {                                           \
-    0x30, 0x82, 0x03, 0x41, 0x30, 0x82, 0x02, 0x29, 0xa0, 0x03, 0x02, 0x01,  \
-    0x02, 0x02, 0x01, 0x03, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,  \
-    0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x3b, 0x31, 0x0b, 0x30,  \
-    0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11,  \
-    0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c,  \
-    0x61, 0x72, 0x53, 0x53, 0x4c, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55,  \
-    0x04, 0x03, 0x0c, 0x10, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c,  \
-    0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d,  \
-    0x31, 0x31, 0x30, 0x32, 0x31, 0x32, 0x31, 0x34, 0x34, 0x34, 0x30, 0x30,  \
-    0x5a, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x32, 0x31, 0x32, 0x31, 0x34, 0x34,  \
-    0x34, 0x30, 0x30, 0x5a, 0x30, 0x3b, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,  \
-    0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06,  \
-    0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53,  \
-    0x53, 0x4c, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,  \
-    0x10, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x20, 0x54, 0x65,  \
-    0x73, 0x74, 0x20, 0x43, 0x41, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06,  \
-    0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00,  \
-    0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01,  \
-    0x01, 0x00, 0xc0, 0xdf, 0x37, 0xfc, 0x17, 0xbb, 0xe0, 0x96, 0x9d, 0x3f,  \
-    0x86, 0xde, 0x96, 0x32, 0x7d, 0x44, 0xa5, 0x16, 0xa0, 0xcd, 0x21, 0xf1,  \
-    0x99, 0xd4, 0xec, 0xea, 0xcb, 0x7c, 0x18, 0x58, 0x08, 0x94, 0xa5, 0xec,  \
-    0x9b, 0xc5, 0x8b, 0xdf, 0x1a, 0x1e, 0x99, 0x38, 0x99, 0x87, 0x1e, 0x7b,  \
-    0xc0, 0x8d, 0x39, 0xdf, 0x38, 0x5d, 0x70, 0x78, 0x07, 0xd3, 0x9e, 0xd9,  \
-    0x93, 0xe8, 0xb9, 0x72, 0x51, 0xc5, 0xce, 0xa3, 0x30, 0x52, 0xa9, 0xf2,  \
-    0xe7, 0x40, 0x70, 0x14, 0xcb, 0x44, 0xa2, 0x72, 0x0b, 0xc2, 0xe5, 0x40,  \
-    0xf9, 0x3e, 0xe5, 0xa6, 0x0e, 0xb3, 0xf9, 0xec, 0x4a, 0x63, 0xc0, 0xb8,  \
-    0x29, 0x00, 0x74, 0x9c, 0x57, 0x3b, 0xa8, 0xa5, 0x04, 0x90, 0x71, 0xf1,  \
-    0xbd, 0x83, 0xd9, 0x3f, 0xd6, 0xa5, 0xe2, 0x3c, 0x2a, 0x8f, 0xef, 0x27,  \
-    0x60, 0xc3, 0xc6, 0x9f, 0xcb, 0xba, 0xec, 0x60, 0x7d, 0xb7, 0xe6, 0x84,  \
-    0x32, 0xbe, 0x4f, 0xfb, 0x58, 0x26, 0x22, 0x03, 0x5b, 0xd4, 0xb4, 0xd5,  \
-    0xfb, 0xf5, 0xe3, 0x96, 0x2e, 0x70, 0xc0, 0xe4, 0x2e, 0xbd, 0xfc, 0x2e,  \
-    0xee, 0xe2, 0x41, 0x55, 0xc0, 0x34, 0x2e, 0x7d, 0x24, 0x72, 0x69, 0xcb,  \
-    0x47, 0xb1, 0x14, 0x40, 0x83, 0x7d, 0x67, 0xf4, 0x86, 0xf6, 0x31, 0xab,  \
-    0xf1, 0x79, 0xa4, 0xb2, 0xb5, 0x2e, 0x12, 0xf9, 0x84, 0x17, 0xf0, 0x62,  \
-    0x6f, 0x27, 0x3e, 0x13, 0x58, 0xb1, 0x54, 0x0d, 0x21, 0x9a, 0x73, 0x37,  \
-    0xa1, 0x30, 0xcf, 0x6f, 0x92, 0xdc, 0xf6, 0xe9, 0xfc, 0xac, 0xdb, 0x2e,  \
-    0x28, 0xd1, 0x7e, 0x02, 0x4b, 0x23, 0xa0, 0x15, 0xf2, 0x38, 0x65, 0x64,  \
-    0x09, 0xea, 0x0c, 0x6e, 0x8e, 0x1b, 0x17, 0xa0, 0x71, 0xc8, 0xb3, 0x9b,  \
-    0xc9, 0xab, 0xe9, 0xc3, 0xf2, 0xcf, 0x87, 0x96, 0x8f, 0x80, 0x02, 0x32,  \
-    0x9e, 0x99, 0x58, 0x6f, 0xa2, 0xd5, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3,  \
-    0x50, 0x30, 0x4e, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05,  \
-    0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e,  \
-    0x04, 0x16, 0x04, 0x14, 0xb4, 0x5a, 0xe4, 0xa5, 0xb3, 0xde, 0xd2, 0x52,  \
-    0xf6, 0xb9, 0xd5, 0xa6, 0x95, 0x0f, 0xeb, 0x3e, 0xbc, 0xc7, 0xfd, 0xff,  \
-    0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80,  \
-    0x14, 0xb4, 0x5a, 0xe4, 0xa5, 0xb3, 0xde, 0xd2, 0x52, 0xf6, 0xb9, 0xd5,  \
-    0xa6, 0x95, 0x0f, 0xeb, 0x3e, 0xbc, 0xc7, 0xfd, 0xff, 0x30, 0x0d, 0x06,  \
-    0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00,  \
-    0x03, 0x82, 0x01, 0x01, 0x00, 0x01, 0x13, 0x73, 0x84, 0x3d, 0xf1, 0x1d,  \
-    0xfd, 0xb7, 0x09, 0x5b, 0x96, 0x5d, 0x53, 0x7f, 0xd5, 0x80, 0xf3, 0x52,  \
-    0xe2, 0xd3, 0x33, 0x87, 0xc8, 0x27, 0x24, 0xff, 0xd5, 0xd8, 0x57, 0x2f,  \
-    0x16, 0xd1, 0xb2, 0x94, 0xca, 0x50, 0xab, 0xa6, 0x27, 0x10, 0x16, 0x08,  \
-    0xc8, 0x11, 0xc0, 0x2f, 0x80, 0xd1, 0xbe, 0x53, 0x18, 0xe6, 0xb9, 0xd7,  \
-    0x18, 0x1a, 0x77, 0x38, 0x34, 0x7c, 0x32, 0x9a, 0x87, 0x0b, 0xa0, 0x2a,  \
-    0xb9, 0x14, 0xc2, 0x2f, 0x38, 0xd2, 0xe7, 0xb8, 0x98, 0x7d, 0xff, 0xff,  \
-    0xe1, 0x01, 0x50, 0xa9, 0x6f, 0x67, 0xf7, 0x6c, 0xdc, 0xb6, 0xca, 0x6f,  \
-    0x73, 0x39, 0x1a, 0x3c, 0xa8, 0x23, 0xaa, 0x8d, 0x4d, 0xa3, 0x75, 0x2a,  \
-    0xd1, 0x76, 0xb3, 0xd7, 0x4a, 0xdc, 0xc7, 0x24, 0xd4, 0x3e, 0xb7, 0xf9,  \
-    0xc0, 0xd5, 0x51, 0x67, 0x65, 0x74, 0x2a, 0xf9, 0x65, 0xbc, 0x00, 0x15,  \
-    0x4b, 0x36, 0xc8, 0xe2, 0x6a, 0x5d, 0x51, 0x7c, 0xed, 0x8e, 0x14, 0x93,  \
-    0x4b, 0x90, 0x36, 0x05, 0xe5, 0x90, 0x00, 0x03, 0xab, 0xd3, 0x3a, 0xb5,  \
-    0x17, 0xb4, 0xd2, 0x45, 0x52, 0x69, 0x26, 0xce, 0xe3, 0x98, 0x1d, 0x9a,  \
-    0x8b, 0xf8, 0xa0, 0x92, 0x1d, 0x48, 0x02, 0x37, 0x2e, 0xc1, 0x5e, 0x95,  \
-    0xc2, 0x53, 0xfe, 0xb1, 0xbc, 0x34, 0x82, 0x34, 0x34, 0x36, 0x91, 0x8c,  \
-    0x88, 0x7a, 0x67, 0x97, 0x34, 0x40, 0x8b, 0xfb, 0x48, 0x6e, 0xd3, 0xaf,  \
-    0x30, 0x81, 0x8e, 0x05, 0x4d, 0x93, 0x21, 0xf6, 0xb1, 0xff, 0x98, 0xea,  \
-    0xd5, 0xa8, 0x14, 0xc7, 0x96, 0x8f, 0x99, 0x3e, 0x53, 0x58, 0x08, 0x89,  \
-    0x3c, 0xe3, 0x8f, 0xea, 0x5e, 0x71, 0x5e, 0x70, 0xf0, 0xc5, 0xe6, 0x12,  \
-    0x35, 0x6a, 0xa2, 0x5f, 0xd1, 0xb2, 0xba, 0xc0, 0x59, 0x8d, 0xec, 0xda,  \
-    0x09, 0xa1, 0xda, 0x6e, 0x30, 0xcb, 0x53, 0x4a, 0x90                     \
-}
+/* BEGIN FILE binary macro TEST_CA_CRT_RSA_SHA1_DER
+ * tests/data_files/test-ca-sha1.crt.der */
+#define TEST_CA_CRT_RSA_SHA1_DER                                              \
+    {                                                                         \
+        0x30, 0x82, 0x03, 0x41, 0x30, 0x82, 0x02, 0x29, 0xa0, 0x03, 0x02,     \
+            0x01, 0x02, 0x02, 0x01, 0x03, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, \
+            0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x3b, \
+            0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, \
+            0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, \
+            0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x31, \
+            0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x10, 0x50, \
+            0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x20, 0x54, 0x65, 0x73, \
+            0x74, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x31, 0x30, \
+            0x32, 0x31, 0x32, 0x31, 0x34, 0x34, 0x34, 0x30, 0x30, 0x5a, 0x17, \
+            0x0d, 0x32, 0x31, 0x30, 0x32, 0x31, 0x32, 0x31, 0x34, 0x34, 0x34, \
+            0x30, 0x30, 0x5a, 0x30, 0x3b, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \
+            0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, \
+            0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, \
+            0x72, 0x53, 0x53, 0x4c, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55, \
+            0x04, 0x03, 0x0c, 0x10, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, \
+            0x4c, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x30, 0x82, \
+            0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, \
+            0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, \
+            0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xc0, 0xdf, \
+            0x37, 0xfc, 0x17, 0xbb, 0xe0, 0x96, 0x9d, 0x3f, 0x86, 0xde, 0x96, \
+            0x32, 0x7d, 0x44, 0xa5, 0x16, 0xa0, 0xcd, 0x21, 0xf1, 0x99, 0xd4, \
+            0xec, 0xea, 0xcb, 0x7c, 0x18, 0x58, 0x08, 0x94, 0xa5, 0xec, 0x9b, \
+            0xc5, 0x8b, 0xdf, 0x1a, 0x1e, 0x99, 0x38, 0x99, 0x87, 0x1e, 0x7b, \
+            0xc0, 0x8d, 0x39, 0xdf, 0x38, 0x5d, 0x70, 0x78, 0x07, 0xd3, 0x9e, \
+            0xd9, 0x93, 0xe8, 0xb9, 0x72, 0x51, 0xc5, 0xce, 0xa3, 0x30, 0x52, \
+            0xa9, 0xf2, 0xe7, 0x40, 0x70, 0x14, 0xcb, 0x44, 0xa2, 0x72, 0x0b, \
+            0xc2, 0xe5, 0x40, 0xf9, 0x3e, 0xe5, 0xa6, 0x0e, 0xb3, 0xf9, 0xec, \
+            0x4a, 0x63, 0xc0, 0xb8, 0x29, 0x00, 0x74, 0x9c, 0x57, 0x3b, 0xa8, \
+            0xa5, 0x04, 0x90, 0x71, 0xf1, 0xbd, 0x83, 0xd9, 0x3f, 0xd6, 0xa5, \
+            0xe2, 0x3c, 0x2a, 0x8f, 0xef, 0x27, 0x60, 0xc3, 0xc6, 0x9f, 0xcb, \
+            0xba, 0xec, 0x60, 0x7d, 0xb7, 0xe6, 0x84, 0x32, 0xbe, 0x4f, 0xfb, \
+            0x58, 0x26, 0x22, 0x03, 0x5b, 0xd4, 0xb4, 0xd5, 0xfb, 0xf5, 0xe3, \
+            0x96, 0x2e, 0x70, 0xc0, 0xe4, 0x2e, 0xbd, 0xfc, 0x2e, 0xee, 0xe2, \
+            0x41, 0x55, 0xc0, 0x34, 0x2e, 0x7d, 0x24, 0x72, 0x69, 0xcb, 0x47, \
+            0xb1, 0x14, 0x40, 0x83, 0x7d, 0x67, 0xf4, 0x86, 0xf6, 0x31, 0xab, \
+            0xf1, 0x79, 0xa4, 0xb2, 0xb5, 0x2e, 0x12, 0xf9, 0x84, 0x17, 0xf0, \
+            0x62, 0x6f, 0x27, 0x3e, 0x13, 0x58, 0xb1, 0x54, 0x0d, 0x21, 0x9a, \
+            0x73, 0x37, 0xa1, 0x30, 0xcf, 0x6f, 0x92, 0xdc, 0xf6, 0xe9, 0xfc, \
+            0xac, 0xdb, 0x2e, 0x28, 0xd1, 0x7e, 0x02, 0x4b, 0x23, 0xa0, 0x15, \
+            0xf2, 0x38, 0x65, 0x64, 0x09, 0xea, 0x0c, 0x6e, 0x8e, 0x1b, 0x17, \
+            0xa0, 0x71, 0xc8, 0xb3, 0x9b, 0xc9, 0xab, 0xe9, 0xc3, 0xf2, 0xcf, \
+            0x87, 0x96, 0x8f, 0x80, 0x02, 0x32, 0x9e, 0x99, 0x58, 0x6f, 0xa2, \
+            0xd5, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x50, 0x30, 0x4e, 0x30, \
+            0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, \
+            0x01, 0xff, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, \
+            0x04, 0x14, 0xb4, 0x5a, 0xe4, 0xa5, 0xb3, 0xde, 0xd2, 0x52, 0xf6, \
+            0xb9, 0xd5, 0xa6, 0x95, 0x0f, 0xeb, 0x3e, 0xbc, 0xc7, 0xfd, 0xff, \
+            0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, \
+            0x80, 0x14, 0xb4, 0x5a, 0xe4, 0xa5, 0xb3, 0xde, 0xd2, 0x52, 0xf6, \
+            0xb9, 0xd5, 0xa6, 0x95, 0x0f, 0xeb, 0x3e, 0xbc, 0xc7, 0xfd, 0xff, \
+            0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, \
+            0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x01, 0x13, \
+            0x73, 0x84, 0x3d, 0xf1, 0x1d, 0xfd, 0xb7, 0x09, 0x5b, 0x96, 0x5d, \
+            0x53, 0x7f, 0xd5, 0x80, 0xf3, 0x52, 0xe2, 0xd3, 0x33, 0x87, 0xc8, \
+            0x27, 0x24, 0xff, 0xd5, 0xd8, 0x57, 0x2f, 0x16, 0xd1, 0xb2, 0x94, \
+            0xca, 0x50, 0xab, 0xa6, 0x27, 0x10, 0x16, 0x08, 0xc8, 0x11, 0xc0, \
+            0x2f, 0x80, 0xd1, 0xbe, 0x53, 0x18, 0xe6, 0xb9, 0xd7, 0x18, 0x1a, \
+            0x77, 0x38, 0x34, 0x7c, 0x32, 0x9a, 0x87, 0x0b, 0xa0, 0x2a, 0xb9, \
+            0x14, 0xc2, 0x2f, 0x38, 0xd2, 0xe7, 0xb8, 0x98, 0x7d, 0xff, 0xff, \
+            0xe1, 0x01, 0x50, 0xa9, 0x6f, 0x67, 0xf7, 0x6c, 0xdc, 0xb6, 0xca, \
+            0x6f, 0x73, 0x39, 0x1a, 0x3c, 0xa8, 0x23, 0xaa, 0x8d, 0x4d, 0xa3, \
+            0x75, 0x2a, 0xd1, 0x76, 0xb3, 0xd7, 0x4a, 0xdc, 0xc7, 0x24, 0xd4, \
+            0x3e, 0xb7, 0xf9, 0xc0, 0xd5, 0x51, 0x67, 0x65, 0x74, 0x2a, 0xf9, \
+            0x65, 0xbc, 0x00, 0x15, 0x4b, 0x36, 0xc8, 0xe2, 0x6a, 0x5d, 0x51, \
+            0x7c, 0xed, 0x8e, 0x14, 0x93, 0x4b, 0x90, 0x36, 0x05, 0xe5, 0x90, \
+            0x00, 0x03, 0xab, 0xd3, 0x3a, 0xb5, 0x17, 0xb4, 0xd2, 0x45, 0x52, \
+            0x69, 0x26, 0xce, 0xe3, 0x98, 0x1d, 0x9a, 0x8b, 0xf8, 0xa0, 0x92, \
+            0x1d, 0x48, 0x02, 0x37, 0x2e, 0xc1, 0x5e, 0x95, 0xc2, 0x53, 0xfe, \
+            0xb1, 0xbc, 0x34, 0x82, 0x34, 0x34, 0x36, 0x91, 0x8c, 0x88, 0x7a, \
+            0x67, 0x97, 0x34, 0x40, 0x8b, 0xfb, 0x48, 0x6e, 0xd3, 0xaf, 0x30, \
+            0x81, 0x8e, 0x05, 0x4d, 0x93, 0x21, 0xf6, 0xb1, 0xff, 0x98, 0xea, \
+            0xd5, 0xa8, 0x14, 0xc7, 0x96, 0x8f, 0x99, 0x3e, 0x53, 0x58, 0x08, \
+            0x89, 0x3c, 0xe3, 0x8f, 0xea, 0x5e, 0x71, 0x5e, 0x70, 0xf0, 0xc5, \
+            0xe6, 0x12, 0x35, 0x6a, 0xa2, 0x5f, 0xd1, 0xb2, 0xba, 0xc0, 0x59, \
+            0x8d, 0xec, 0xda, 0x09, 0xa1, 0xda, 0x6e, 0x30, 0xcb, 0x53, 0x4a, \
+            0x90                                                              \
+    }
 /* END FILE */
 
 /* This is taken from tests/data_files/test-ca.key */
@@ -379,109 +410,120 @@
 #define TEST_CA_PWD_RSA_PEM "PolarSSLTest"
 
 /* This was generated from test-ca.key.der using `xxd -i`. */
-/* BEGIN FILE binary macro TEST_CA_KEY_RSA_DER tests/data_files/test-ca.key.der */
-#define TEST_CA_KEY_RSA_DER {                                                \
-    0x30, 0x82, 0x04, 0xa4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00,  \
-    0xc0, 0xdf, 0x37, 0xfc, 0x17, 0xbb, 0xe0, 0x96, 0x9d, 0x3f, 0x86, 0xde,  \
-    0x96, 0x32, 0x7d, 0x44, 0xa5, 0x16, 0xa0, 0xcd, 0x21, 0xf1, 0x99, 0xd4,  \
-    0xec, 0xea, 0xcb, 0x7c, 0x18, 0x58, 0x08, 0x94, 0xa5, 0xec, 0x9b, 0xc5,  \
-    0x8b, 0xdf, 0x1a, 0x1e, 0x99, 0x38, 0x99, 0x87, 0x1e, 0x7b, 0xc0, 0x8d,  \
-    0x39, 0xdf, 0x38, 0x5d, 0x70, 0x78, 0x07, 0xd3, 0x9e, 0xd9, 0x93, 0xe8,  \
-    0xb9, 0x72, 0x51, 0xc5, 0xce, 0xa3, 0x30, 0x52, 0xa9, 0xf2, 0xe7, 0x40,  \
-    0x70, 0x14, 0xcb, 0x44, 0xa2, 0x72, 0x0b, 0xc2, 0xe5, 0x40, 0xf9, 0x3e,  \
-    0xe5, 0xa6, 0x0e, 0xb3, 0xf9, 0xec, 0x4a, 0x63, 0xc0, 0xb8, 0x29, 0x00,  \
-    0x74, 0x9c, 0x57, 0x3b, 0xa8, 0xa5, 0x04, 0x90, 0x71, 0xf1, 0xbd, 0x83,  \
-    0xd9, 0x3f, 0xd6, 0xa5, 0xe2, 0x3c, 0x2a, 0x8f, 0xef, 0x27, 0x60, 0xc3,  \
-    0xc6, 0x9f, 0xcb, 0xba, 0xec, 0x60, 0x7d, 0xb7, 0xe6, 0x84, 0x32, 0xbe,  \
-    0x4f, 0xfb, 0x58, 0x26, 0x22, 0x03, 0x5b, 0xd4, 0xb4, 0xd5, 0xfb, 0xf5,  \
-    0xe3, 0x96, 0x2e, 0x70, 0xc0, 0xe4, 0x2e, 0xbd, 0xfc, 0x2e, 0xee, 0xe2,  \
-    0x41, 0x55, 0xc0, 0x34, 0x2e, 0x7d, 0x24, 0x72, 0x69, 0xcb, 0x47, 0xb1,  \
-    0x14, 0x40, 0x83, 0x7d, 0x67, 0xf4, 0x86, 0xf6, 0x31, 0xab, 0xf1, 0x79,  \
-    0xa4, 0xb2, 0xb5, 0x2e, 0x12, 0xf9, 0x84, 0x17, 0xf0, 0x62, 0x6f, 0x27,  \
-    0x3e, 0x13, 0x58, 0xb1, 0x54, 0x0d, 0x21, 0x9a, 0x73, 0x37, 0xa1, 0x30,  \
-    0xcf, 0x6f, 0x92, 0xdc, 0xf6, 0xe9, 0xfc, 0xac, 0xdb, 0x2e, 0x28, 0xd1,  \
-    0x7e, 0x02, 0x4b, 0x23, 0xa0, 0x15, 0xf2, 0x38, 0x65, 0x64, 0x09, 0xea,  \
-    0x0c, 0x6e, 0x8e, 0x1b, 0x17, 0xa0, 0x71, 0xc8, 0xb3, 0x9b, 0xc9, 0xab,  \
-    0xe9, 0xc3, 0xf2, 0xcf, 0x87, 0x96, 0x8f, 0x80, 0x02, 0x32, 0x9e, 0x99,  \
-    0x58, 0x6f, 0xa2, 0xd5, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x82, 0x01,  \
-    0x00, 0x3f, 0xf7, 0x07, 0xd3, 0x34, 0x6f, 0xdb, 0xc9, 0x37, 0xb7, 0x84,  \
-    0xdc, 0x37, 0x45, 0xe1, 0x63, 0xad, 0xb8, 0xb6, 0x75, 0xb1, 0xc7, 0x35,  \
-    0xb4, 0x77, 0x2a, 0x5b, 0x77, 0xf9, 0x7e, 0xe0, 0xc1, 0xa3, 0xd1, 0xb7,  \
-    0xcb, 0xa9, 0x5a, 0xc1, 0x87, 0xda, 0x5a, 0xfa, 0x17, 0xe4, 0xd5, 0x38,  \
-    0x03, 0xde, 0x68, 0x98, 0x81, 0xec, 0xb5, 0xf2, 0x2a, 0x8d, 0xe9, 0x2c,  \
-    0xf3, 0xa6, 0xe5, 0x32, 0x17, 0x7f, 0x33, 0x81, 0xe8, 0x38, 0x72, 0xd5,  \
-    0x9c, 0xfa, 0x4e, 0xfb, 0x26, 0xf5, 0x15, 0x0b, 0xaf, 0x84, 0x66, 0xab,  \
-    0x02, 0xe0, 0x18, 0xd5, 0x91, 0x7c, 0xd6, 0x8f, 0xc9, 0x4b, 0x76, 0x08,  \
-    0x2b, 0x1d, 0x81, 0x68, 0x30, 0xe1, 0xfa, 0x70, 0x6c, 0x13, 0x4e, 0x10,  \
-    0x03, 0x35, 0x3e, 0xc5, 0xca, 0x58, 0x20, 0x8a, 0x21, 0x18, 0x38, 0xa0,  \
-    0x0f, 0xed, 0xc4, 0xbb, 0x45, 0x6f, 0xf5, 0x84, 0x5b, 0xb0, 0xcf, 0x4e,  \
-    0x9d, 0x58, 0x13, 0x6b, 0x35, 0x35, 0x69, 0xa1, 0xd2, 0xc4, 0xf2, 0xc1,  \
-    0x48, 0x04, 0x20, 0x51, 0xb9, 0x6b, 0xa4, 0x5d, 0xa5, 0x4b, 0x84, 0x88,  \
-    0x43, 0x48, 0x99, 0x2c, 0xbb, 0xa4, 0x97, 0xd6, 0xd6, 0x18, 0xf6, 0xec,  \
-    0x5c, 0xd1, 0x31, 0x49, 0xc9, 0xf2, 0x8f, 0x0b, 0x4d, 0xef, 0x09, 0x02,  \
-    0xfe, 0x7d, 0xfd, 0xbb, 0xaf, 0x2b, 0x83, 0x94, 0x22, 0xc4, 0xa7, 0x3e,  \
-    0x66, 0xf5, 0xe0, 0x57, 0xdc, 0xf2, 0xed, 0x2c, 0x3e, 0x81, 0x74, 0x76,  \
-    0x1e, 0x96, 0x6f, 0x74, 0x1e, 0x32, 0x0e, 0x14, 0x31, 0xd0, 0x74, 0xf0,  \
-    0xf4, 0x07, 0xbd, 0xc3, 0xd1, 0x22, 0xc2, 0xa8, 0x95, 0x92, 0x06, 0x7f,  \
-    0x43, 0x02, 0x91, 0xbc, 0xdd, 0x23, 0x01, 0x89, 0x94, 0x20, 0x44, 0x64,  \
-    0xf5, 0x1d, 0x67, 0xd2, 0x8f, 0xe8, 0x69, 0xa5, 0x29, 0x25, 0xe6, 0x50,  \
-    0x9c, 0xe3, 0xe9, 0xcb, 0x75, 0x02, 0x81, 0x81, 0x00, 0xe2, 0x29, 0x3e,  \
-    0xaa, 0x6b, 0xd5, 0x59, 0x1e, 0x9c, 0xe6, 0x47, 0xd5, 0xb6, 0xd7, 0xe3,  \
-    0xf1, 0x8e, 0x9e, 0xe9, 0x83, 0x5f, 0x10, 0x9f, 0x63, 0xec, 0x04, 0x44,  \
-    0xcc, 0x3f, 0xf8, 0xd9, 0x3a, 0x17, 0xe0, 0x4f, 0xfe, 0xd8, 0x4d, 0xcd,  \
-    0x46, 0x54, 0x74, 0xbf, 0x0a, 0xc4, 0x67, 0x9c, 0xa7, 0xd8, 0x89, 0x65,  \
-    0x4c, 0xfd, 0x58, 0x2a, 0x47, 0x0f, 0xf4, 0x37, 0xb6, 0x55, 0xb0, 0x1d,  \
-    0xed, 0xa7, 0x39, 0xfc, 0x4f, 0xa3, 0xc4, 0x75, 0x3a, 0xa3, 0x98, 0xa7,  \
-    0x45, 0xf5, 0x66, 0xcb, 0x7c, 0x65, 0xfb, 0x80, 0x23, 0xe6, 0xff, 0xfd,  \
-    0x99, 0x1f, 0x8e, 0x6b, 0xff, 0x5e, 0x93, 0x66, 0xdf, 0x6c, 0x6f, 0xc3,  \
-    0xf6, 0x38, 0x2e, 0xff, 0x69, 0xb5, 0xac, 0xae, 0xbb, 0xc6, 0x71, 0x16,  \
-    0x6b, 0xd0, 0xf8, 0x22, 0xd9, 0xf8, 0xa2, 0x72, 0x20, 0xd2, 0xe2, 0x3a,  \
-    0x70, 0x4b, 0xde, 0xab, 0x2f, 0x02, 0x81, 0x81, 0x00, 0xda, 0x51, 0x9b,  \
-    0xb8, 0xb2, 0x2a, 0x14, 0x75, 0x58, 0x40, 0x8d, 0x27, 0x70, 0xfa, 0x31,  \
-    0x48, 0xb0, 0x20, 0x21, 0x34, 0xfa, 0x4c, 0x57, 0xa8, 0x11, 0x88, 0xf3,  \
-    0xa7, 0xae, 0x21, 0xe9, 0xb6, 0x2b, 0xd1, 0xcd, 0xa7, 0xf8, 0xd8, 0x0c,  \
-    0x8a, 0x76, 0x22, 0x35, 0x44, 0xce, 0x3f, 0x25, 0x29, 0x83, 0x7d, 0x79,  \
-    0xa7, 0x31, 0xd6, 0xec, 0xb2, 0xbf, 0xda, 0x34, 0xb6, 0xf6, 0xb2, 0x3b,  \
-    0xf3, 0x78, 0x5a, 0x04, 0x83, 0x33, 0x3e, 0xa2, 0xe2, 0x81, 0x82, 0x13,  \
-    0xd4, 0x35, 0x17, 0x63, 0x9b, 0x9e, 0xc4, 0x8d, 0x91, 0x4c, 0x03, 0x77,  \
-    0xc7, 0x71, 0x5b, 0xee, 0x83, 0x6d, 0xd5, 0x78, 0x88, 0xf6, 0x2c, 0x79,  \
-    0xc2, 0x4a, 0xb4, 0x79, 0x90, 0x70, 0xbf, 0xdf, 0x34, 0x56, 0x96, 0x71,  \
-    0xe3, 0x0e, 0x68, 0x91, 0xbc, 0xea, 0xcb, 0x33, 0xc0, 0xbe, 0x45, 0xd7,  \
-    0xfc, 0x30, 0xfd, 0x01, 0x3b, 0x02, 0x81, 0x81, 0x00, 0xd2, 0x9f, 0x2a,  \
-    0xb7, 0x38, 0x19, 0xc7, 0x17, 0x95, 0x73, 0x78, 0xae, 0xf5, 0xcb, 0x75,  \
-    0x83, 0x7f, 0x19, 0x4b, 0xcb, 0x86, 0xfb, 0x4a, 0x15, 0x9a, 0xb6, 0x17,  \
-    0x04, 0x49, 0x07, 0x8d, 0xf6, 0x66, 0x4a, 0x06, 0xf6, 0x05, 0xa7, 0xdf,  \
-    0x66, 0x82, 0x3c, 0xff, 0xb6, 0x1d, 0x57, 0x89, 0x33, 0x5f, 0x9c, 0x05,  \
-    0x75, 0x7f, 0xf3, 0x5d, 0xdc, 0x34, 0x65, 0x72, 0x85, 0x22, 0xa4, 0x14,  \
-    0x1b, 0x41, 0xc3, 0xe4, 0xd0, 0x9e, 0x69, 0xd5, 0xeb, 0x38, 0x74, 0x70,  \
-    0x43, 0xdc, 0xd9, 0x50, 0xe4, 0x97, 0x6d, 0x73, 0xd6, 0xfb, 0xc8, 0xa7,  \
-    0xfa, 0xb4, 0xc2, 0xc4, 0x9d, 0x5d, 0x0c, 0xd5, 0x9f, 0x79, 0xb3, 0x54,  \
-    0xc2, 0xb7, 0x6c, 0x3d, 0x7d, 0xcb, 0x2d, 0xf8, 0xc4, 0xf3, 0x78, 0x5a,  \
-    0x33, 0x2a, 0xb8, 0x0c, 0x6d, 0x06, 0xfa, 0xf2, 0x62, 0xd3, 0x42, 0xd0,  \
-    0xbd, 0xc8, 0x4a, 0xa5, 0x0d, 0x02, 0x81, 0x81, 0x00, 0xd4, 0xa9, 0x90,  \
-    0x15, 0xde, 0xbf, 0x2c, 0xc4, 0x8d, 0x9d, 0xfb, 0xa1, 0xc2, 0xe4, 0x83,  \
-    0xe3, 0x79, 0x65, 0x22, 0xd3, 0xb7, 0x49, 0x6c, 0x4d, 0x94, 0x1f, 0x22,  \
-    0xb1, 0x60, 0xe7, 0x3a, 0x00, 0xb1, 0x38, 0xa2, 0xab, 0x0f, 0xb4, 0x6c,  \
-    0xaa, 0xe7, 0x9e, 0x34, 0xe3, 0x7c, 0x40, 0x78, 0x53, 0xb2, 0xf9, 0x23,  \
-    0xea, 0xa0, 0x9a, 0xea, 0x60, 0xc8, 0x8f, 0xa6, 0xaf, 0xdf, 0x29, 0x09,  \
-    0x4b, 0x06, 0x1e, 0x31, 0xad, 0x17, 0xda, 0xd8, 0xd1, 0xe9, 0x33, 0xab,  \
-    0x5b, 0x18, 0x08, 0x5b, 0x87, 0xf8, 0xa5, 0x1f, 0xfd, 0xbb, 0xdc, 0xd8,  \
-    0xed, 0x97, 0x57, 0xe4, 0xc3, 0x73, 0xd6, 0xf0, 0x9e, 0x01, 0xa6, 0x9b,  \
-    0x48, 0x8e, 0x7a, 0xb4, 0xbb, 0xe5, 0x88, 0x91, 0xc5, 0x2a, 0xdf, 0x4b,  \
-    0xba, 0xd0, 0x8b, 0x3e, 0x03, 0x97, 0x77, 0x2f, 0x47, 0x7e, 0x51, 0x0c,  \
-    0xae, 0x65, 0x8d, 0xde, 0x87, 0x02, 0x81, 0x80, 0x20, 0x24, 0x0f, 0xd2,  \
-    0xaf, 0xc2, 0x28, 0x3b, 0x97, 0x20, 0xb2, 0x92, 0x49, 0xeb, 0x09, 0x68,  \
-    0x40, 0xb2, 0xbe, 0xd1, 0xc3, 0x83, 0x94, 0x34, 0x38, 0xd6, 0xc9, 0xec,  \
-    0x34, 0x09, 0xf9, 0x41, 0x6d, 0x5c, 0x42, 0x94, 0xf7, 0x04, 0xfc, 0x32,  \
-    0x39, 0x69, 0xbc, 0x1c, 0xfb, 0x3e, 0x61, 0x98, 0xc0, 0x80, 0xd8, 0x36,  \
-    0x47, 0xc3, 0x6d, 0xc2, 0x2e, 0xe7, 0x81, 0x2a, 0x17, 0x34, 0x64, 0x30,  \
-    0x4e, 0x96, 0xbb, 0x26, 0x16, 0xb9, 0x41, 0x36, 0xfe, 0x8a, 0xd6, 0x53,  \
-    0x7c, 0xaa, 0xec, 0x39, 0x42, 0x50, 0xef, 0xe3, 0xb3, 0x01, 0x28, 0x32,  \
-    0xca, 0x6d, 0xf5, 0x9a, 0x1e, 0x9f, 0x37, 0xbe, 0xfe, 0x38, 0x20, 0x22,  \
-    0x91, 0x8c, 0xcd, 0x95, 0x02, 0xf2, 0x4d, 0x6f, 0x1a, 0xb4, 0x43, 0xf0,  \
-    0x19, 0xdf, 0x65, 0xc0, 0x92, 0xe7, 0x9d, 0x2f, 0x09, 0xe7, 0xec, 0x69,  \
-    0xa8, 0xc2, 0x8f, 0x0d                                                   \
-}
+/* BEGIN FILE binary macro TEST_CA_KEY_RSA_DER tests/data_files/test-ca.key.der
+ */
+#define TEST_CA_KEY_RSA_DER                                                   \
+    {                                                                         \
+        0x30, 0x82, 0x04, 0xa4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01,     \
+            0x00, 0xc0, 0xdf, 0x37, 0xfc, 0x17, 0xbb, 0xe0, 0x96, 0x9d, 0x3f, \
+            0x86, 0xde, 0x96, 0x32, 0x7d, 0x44, 0xa5, 0x16, 0xa0, 0xcd, 0x21, \
+            0xf1, 0x99, 0xd4, 0xec, 0xea, 0xcb, 0x7c, 0x18, 0x58, 0x08, 0x94, \
+            0xa5, 0xec, 0x9b, 0xc5, 0x8b, 0xdf, 0x1a, 0x1e, 0x99, 0x38, 0x99, \
+            0x87, 0x1e, 0x7b, 0xc0, 0x8d, 0x39, 0xdf, 0x38, 0x5d, 0x70, 0x78, \
+            0x07, 0xd3, 0x9e, 0xd9, 0x93, 0xe8, 0xb9, 0x72, 0x51, 0xc5, 0xce, \
+            0xa3, 0x30, 0x52, 0xa9, 0xf2, 0xe7, 0x40, 0x70, 0x14, 0xcb, 0x44, \
+            0xa2, 0x72, 0x0b, 0xc2, 0xe5, 0x40, 0xf9, 0x3e, 0xe5, 0xa6, 0x0e, \
+            0xb3, 0xf9, 0xec, 0x4a, 0x63, 0xc0, 0xb8, 0x29, 0x00, 0x74, 0x9c, \
+            0x57, 0x3b, 0xa8, 0xa5, 0x04, 0x90, 0x71, 0xf1, 0xbd, 0x83, 0xd9, \
+            0x3f, 0xd6, 0xa5, 0xe2, 0x3c, 0x2a, 0x8f, 0xef, 0x27, 0x60, 0xc3, \
+            0xc6, 0x9f, 0xcb, 0xba, 0xec, 0x60, 0x7d, 0xb7, 0xe6, 0x84, 0x32, \
+            0xbe, 0x4f, 0xfb, 0x58, 0x26, 0x22, 0x03, 0x5b, 0xd4, 0xb4, 0xd5, \
+            0xfb, 0xf5, 0xe3, 0x96, 0x2e, 0x70, 0xc0, 0xe4, 0x2e, 0xbd, 0xfc, \
+            0x2e, 0xee, 0xe2, 0x41, 0x55, 0xc0, 0x34, 0x2e, 0x7d, 0x24, 0x72, \
+            0x69, 0xcb, 0x47, 0xb1, 0x14, 0x40, 0x83, 0x7d, 0x67, 0xf4, 0x86, \
+            0xf6, 0x31, 0xab, 0xf1, 0x79, 0xa4, 0xb2, 0xb5, 0x2e, 0x12, 0xf9, \
+            0x84, 0x17, 0xf0, 0x62, 0x6f, 0x27, 0x3e, 0x13, 0x58, 0xb1, 0x54, \
+            0x0d, 0x21, 0x9a, 0x73, 0x37, 0xa1, 0x30, 0xcf, 0x6f, 0x92, 0xdc, \
+            0xf6, 0xe9, 0xfc, 0xac, 0xdb, 0x2e, 0x28, 0xd1, 0x7e, 0x02, 0x4b, \
+            0x23, 0xa0, 0x15, 0xf2, 0x38, 0x65, 0x64, 0x09, 0xea, 0x0c, 0x6e, \
+            0x8e, 0x1b, 0x17, 0xa0, 0x71, 0xc8, 0xb3, 0x9b, 0xc9, 0xab, 0xe9, \
+            0xc3, 0xf2, 0xcf, 0x87, 0x96, 0x8f, 0x80, 0x02, 0x32, 0x9e, 0x99, \
+            0x58, 0x6f, 0xa2, 0xd5, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x82, \
+            0x01, 0x00, 0x3f, 0xf7, 0x07, 0xd3, 0x34, 0x6f, 0xdb, 0xc9, 0x37, \
+            0xb7, 0x84, 0xdc, 0x37, 0x45, 0xe1, 0x63, 0xad, 0xb8, 0xb6, 0x75, \
+            0xb1, 0xc7, 0x35, 0xb4, 0x77, 0x2a, 0x5b, 0x77, 0xf9, 0x7e, 0xe0, \
+            0xc1, 0xa3, 0xd1, 0xb7, 0xcb, 0xa9, 0x5a, 0xc1, 0x87, 0xda, 0x5a, \
+            0xfa, 0x17, 0xe4, 0xd5, 0x38, 0x03, 0xde, 0x68, 0x98, 0x81, 0xec, \
+            0xb5, 0xf2, 0x2a, 0x8d, 0xe9, 0x2c, 0xf3, 0xa6, 0xe5, 0x32, 0x17, \
+            0x7f, 0x33, 0x81, 0xe8, 0x38, 0x72, 0xd5, 0x9c, 0xfa, 0x4e, 0xfb, \
+            0x26, 0xf5, 0x15, 0x0b, 0xaf, 0x84, 0x66, 0xab, 0x02, 0xe0, 0x18, \
+            0xd5, 0x91, 0x7c, 0xd6, 0x8f, 0xc9, 0x4b, 0x76, 0x08, 0x2b, 0x1d, \
+            0x81, 0x68, 0x30, 0xe1, 0xfa, 0x70, 0x6c, 0x13, 0x4e, 0x10, 0x03, \
+            0x35, 0x3e, 0xc5, 0xca, 0x58, 0x20, 0x8a, 0x21, 0x18, 0x38, 0xa0, \
+            0x0f, 0xed, 0xc4, 0xbb, 0x45, 0x6f, 0xf5, 0x84, 0x5b, 0xb0, 0xcf, \
+            0x4e, 0x9d, 0x58, 0x13, 0x6b, 0x35, 0x35, 0x69, 0xa1, 0xd2, 0xc4, \
+            0xf2, 0xc1, 0x48, 0x04, 0x20, 0x51, 0xb9, 0x6b, 0xa4, 0x5d, 0xa5, \
+            0x4b, 0x84, 0x88, 0x43, 0x48, 0x99, 0x2c, 0xbb, 0xa4, 0x97, 0xd6, \
+            0xd6, 0x18, 0xf6, 0xec, 0x5c, 0xd1, 0x31, 0x49, 0xc9, 0xf2, 0x8f, \
+            0x0b, 0x4d, 0xef, 0x09, 0x02, 0xfe, 0x7d, 0xfd, 0xbb, 0xaf, 0x2b, \
+            0x83, 0x94, 0x22, 0xc4, 0xa7, 0x3e, 0x66, 0xf5, 0xe0, 0x57, 0xdc, \
+            0xf2, 0xed, 0x2c, 0x3e, 0x81, 0x74, 0x76, 0x1e, 0x96, 0x6f, 0x74, \
+            0x1e, 0x32, 0x0e, 0x14, 0x31, 0xd0, 0x74, 0xf0, 0xf4, 0x07, 0xbd, \
+            0xc3, 0xd1, 0x22, 0xc2, 0xa8, 0x95, 0x92, 0x06, 0x7f, 0x43, 0x02, \
+            0x91, 0xbc, 0xdd, 0x23, 0x01, 0x89, 0x94, 0x20, 0x44, 0x64, 0xf5, \
+            0x1d, 0x67, 0xd2, 0x8f, 0xe8, 0x69, 0xa5, 0x29, 0x25, 0xe6, 0x50, \
+            0x9c, 0xe3, 0xe9, 0xcb, 0x75, 0x02, 0x81, 0x81, 0x00, 0xe2, 0x29, \
+            0x3e, 0xaa, 0x6b, 0xd5, 0x59, 0x1e, 0x9c, 0xe6, 0x47, 0xd5, 0xb6, \
+            0xd7, 0xe3, 0xf1, 0x8e, 0x9e, 0xe9, 0x83, 0x5f, 0x10, 0x9f, 0x63, \
+            0xec, 0x04, 0x44, 0xcc, 0x3f, 0xf8, 0xd9, 0x3a, 0x17, 0xe0, 0x4f, \
+            0xfe, 0xd8, 0x4d, 0xcd, 0x46, 0x54, 0x74, 0xbf, 0x0a, 0xc4, 0x67, \
+            0x9c, 0xa7, 0xd8, 0x89, 0x65, 0x4c, 0xfd, 0x58, 0x2a, 0x47, 0x0f, \
+            0xf4, 0x37, 0xb6, 0x55, 0xb0, 0x1d, 0xed, 0xa7, 0x39, 0xfc, 0x4f, \
+            0xa3, 0xc4, 0x75, 0x3a, 0xa3, 0x98, 0xa7, 0x45, 0xf5, 0x66, 0xcb, \
+            0x7c, 0x65, 0xfb, 0x80, 0x23, 0xe6, 0xff, 0xfd, 0x99, 0x1f, 0x8e, \
+            0x6b, 0xff, 0x5e, 0x93, 0x66, 0xdf, 0x6c, 0x6f, 0xc3, 0xf6, 0x38, \
+            0x2e, 0xff, 0x69, 0xb5, 0xac, 0xae, 0xbb, 0xc6, 0x71, 0x16, 0x6b, \
+            0xd0, 0xf8, 0x22, 0xd9, 0xf8, 0xa2, 0x72, 0x20, 0xd2, 0xe2, 0x3a, \
+            0x70, 0x4b, 0xde, 0xab, 0x2f, 0x02, 0x81, 0x81, 0x00, 0xda, 0x51, \
+            0x9b, 0xb8, 0xb2, 0x2a, 0x14, 0x75, 0x58, 0x40, 0x8d, 0x27, 0x70, \
+            0xfa, 0x31, 0x48, 0xb0, 0x20, 0x21, 0x34, 0xfa, 0x4c, 0x57, 0xa8, \
+            0x11, 0x88, 0xf3, 0xa7, 0xae, 0x21, 0xe9, 0xb6, 0x2b, 0xd1, 0xcd, \
+            0xa7, 0xf8, 0xd8, 0x0c, 0x8a, 0x76, 0x22, 0x35, 0x44, 0xce, 0x3f, \
+            0x25, 0x29, 0x83, 0x7d, 0x79, 0xa7, 0x31, 0xd6, 0xec, 0xb2, 0xbf, \
+            0xda, 0x34, 0xb6, 0xf6, 0xb2, 0x3b, 0xf3, 0x78, 0x5a, 0x04, 0x83, \
+            0x33, 0x3e, 0xa2, 0xe2, 0x81, 0x82, 0x13, 0xd4, 0x35, 0x17, 0x63, \
+            0x9b, 0x9e, 0xc4, 0x8d, 0x91, 0x4c, 0x03, 0x77, 0xc7, 0x71, 0x5b, \
+            0xee, 0x83, 0x6d, 0xd5, 0x78, 0x88, 0xf6, 0x2c, 0x79, 0xc2, 0x4a, \
+            0xb4, 0x79, 0x90, 0x70, 0xbf, 0xdf, 0x34, 0x56, 0x96, 0x71, 0xe3, \
+            0x0e, 0x68, 0x91, 0xbc, 0xea, 0xcb, 0x33, 0xc0, 0xbe, 0x45, 0xd7, \
+            0xfc, 0x30, 0xfd, 0x01, 0x3b, 0x02, 0x81, 0x81, 0x00, 0xd2, 0x9f, \
+            0x2a, 0xb7, 0x38, 0x19, 0xc7, 0x17, 0x95, 0x73, 0x78, 0xae, 0xf5, \
+            0xcb, 0x75, 0x83, 0x7f, 0x19, 0x4b, 0xcb, 0x86, 0xfb, 0x4a, 0x15, \
+            0x9a, 0xb6, 0x17, 0x04, 0x49, 0x07, 0x8d, 0xf6, 0x66, 0x4a, 0x06, \
+            0xf6, 0x05, 0xa7, 0xdf, 0x66, 0x82, 0x3c, 0xff, 0xb6, 0x1d, 0x57, \
+            0x89, 0x33, 0x5f, 0x9c, 0x05, 0x75, 0x7f, 0xf3, 0x5d, 0xdc, 0x34, \
+            0x65, 0x72, 0x85, 0x22, 0xa4, 0x14, 0x1b, 0x41, 0xc3, 0xe4, 0xd0, \
+            0x9e, 0x69, 0xd5, 0xeb, 0x38, 0x74, 0x70, 0x43, 0xdc, 0xd9, 0x50, \
+            0xe4, 0x97, 0x6d, 0x73, 0xd6, 0xfb, 0xc8, 0xa7, 0xfa, 0xb4, 0xc2, \
+            0xc4, 0x9d, 0x5d, 0x0c, 0xd5, 0x9f, 0x79, 0xb3, 0x54, 0xc2, 0xb7, \
+            0x6c, 0x3d, 0x7d, 0xcb, 0x2d, 0xf8, 0xc4, 0xf3, 0x78, 0x5a, 0x33, \
+            0x2a, 0xb8, 0x0c, 0x6d, 0x06, 0xfa, 0xf2, 0x62, 0xd3, 0x42, 0xd0, \
+            0xbd, 0xc8, 0x4a, 0xa5, 0x0d, 0x02, 0x81, 0x81, 0x00, 0xd4, 0xa9, \
+            0x90, 0x15, 0xde, 0xbf, 0x2c, 0xc4, 0x8d, 0x9d, 0xfb, 0xa1, 0xc2, \
+            0xe4, 0x83, 0xe3, 0x79, 0x65, 0x22, 0xd3, 0xb7, 0x49, 0x6c, 0x4d, \
+            0x94, 0x1f, 0x22, 0xb1, 0x60, 0xe7, 0x3a, 0x00, 0xb1, 0x38, 0xa2, \
+            0xab, 0x0f, 0xb4, 0x6c, 0xaa, 0xe7, 0x9e, 0x34, 0xe3, 0x7c, 0x40, \
+            0x78, 0x53, 0xb2, 0xf9, 0x23, 0xea, 0xa0, 0x9a, 0xea, 0x60, 0xc8, \
+            0x8f, 0xa6, 0xaf, 0xdf, 0x29, 0x09, 0x4b, 0x06, 0x1e, 0x31, 0xad, \
+            0x17, 0xda, 0xd8, 0xd1, 0xe9, 0x33, 0xab, 0x5b, 0x18, 0x08, 0x5b, \
+            0x87, 0xf8, 0xa5, 0x1f, 0xfd, 0xbb, 0xdc, 0xd8, 0xed, 0x97, 0x57, \
+            0xe4, 0xc3, 0x73, 0xd6, 0xf0, 0x9e, 0x01, 0xa6, 0x9b, 0x48, 0x8e, \
+            0x7a, 0xb4, 0xbb, 0xe5, 0x88, 0x91, 0xc5, 0x2a, 0xdf, 0x4b, 0xba, \
+            0xd0, 0x8b, 0x3e, 0x03, 0x97, 0x77, 0x2f, 0x47, 0x7e, 0x51, 0x0c, \
+            0xae, 0x65, 0x8d, 0xde, 0x87, 0x02, 0x81, 0x80, 0x20, 0x24, 0x0f, \
+            0xd2, 0xaf, 0xc2, 0x28, 0x3b, 0x97, 0x20, 0xb2, 0x92, 0x49, 0xeb, \
+            0x09, 0x68, 0x40, 0xb2, 0xbe, 0xd1, 0xc3, 0x83, 0x94, 0x34, 0x38, \
+            0xd6, 0xc9, 0xec, 0x34, 0x09, 0xf9, 0x41, 0x6d, 0x5c, 0x42, 0x94, \
+            0xf7, 0x04, 0xfc, 0x32, 0x39, 0x69, 0xbc, 0x1c, 0xfb, 0x3e, 0x61, \
+            0x98, 0xc0, 0x80, 0xd8, 0x36, 0x47, 0xc3, 0x6d, 0xc2, 0x2e, 0xe7, \
+            0x81, 0x2a, 0x17, 0x34, 0x64, 0x30, 0x4e, 0x96, 0xbb, 0x26, 0x16, \
+            0xb9, 0x41, 0x36, 0xfe, 0x8a, 0xd6, 0x53, 0x7c, 0xaa, 0xec, 0x39, \
+            0x42, 0x50, 0xef, 0xe3, 0xb3, 0x01, 0x28, 0x32, 0xca, 0x6d, 0xf5, \
+            0x9a, 0x1e, 0x9f, 0x37, 0xbe, 0xfe, 0x38, 0x20, 0x22, 0x91, 0x8c, \
+            0xcd, 0x95, 0x02, 0xf2, 0x4d, 0x6f, 0x1a, 0xb4, 0x43, 0xf0, 0x19, \
+            0xdf, 0x65, 0xc0, 0x92, 0xe7, 0x9d, 0x2f, 0x09, 0xe7, 0xec, 0x69, \
+            0xa8, 0xc2, 0x8f, 0x0d                                            \
+    }
 /* END FILE */
 
 /*
@@ -517,55 +559,61 @@
 /* END FILE */
 
 /* This is generated from tests/data_files/server5.crt.der using `xxd -i`. */
-/* BEGIN FILE binary macro TEST_SRV_CRT_EC_DER tests/data_files/server5.crt.der */
-#define TEST_SRV_CRT_EC_DER {                                                \
-    0x30, 0x82, 0x02, 0x1f, 0x30, 0x82, 0x01, 0xa5, 0xa0, 0x03, 0x02, 0x01,  \
-    0x02, 0x02, 0x01, 0x09, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce,  \
-    0x3d, 0x04, 0x03, 0x02, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,  \
-    0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06,  \
-    0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53,  \
-    0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,  \
-    0x13, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65,  \
-    0x73, 0x74, 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d,  \
-    0x31, 0x33, 0x30, 0x39, 0x32, 0x34, 0x31, 0x35, 0x35, 0x32, 0x30, 0x34,  \
-    0x5a, 0x17, 0x0d, 0x32, 0x33, 0x30, 0x39, 0x32, 0x32, 0x31, 0x35, 0x35,  \
-    0x32, 0x30, 0x34, 0x5a, 0x30, 0x34, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,  \
-    0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06,  \
-    0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53,  \
-    0x53, 0x4c, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,  \
-    0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x30, 0x59,  \
-    0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06,  \
-    0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00,  \
-    0x04, 0x37, 0xcc, 0x56, 0xd9, 0x76, 0x09, 0x1e, 0x5a, 0x72, 0x3e, 0xc7,  \
-    0x59, 0x2d, 0xff, 0x20, 0x6e, 0xee, 0x7c, 0xf9, 0x06, 0x91, 0x74, 0xd0,  \
-    0xad, 0x14, 0xb5, 0xf7, 0x68, 0x22, 0x59, 0x62, 0x92, 0x4e, 0xe5, 0x00,  \
-    0xd8, 0x23, 0x11, 0xff, 0xea, 0x2f, 0xd2, 0x34, 0x5d, 0x5d, 0x16, 0xbd,  \
-    0x8a, 0x88, 0xc2, 0x6b, 0x77, 0x0d, 0x55, 0xcd, 0x8a, 0x2a, 0x0e, 0xfa,  \
-    0x01, 0xc8, 0xb4, 0xed, 0xff, 0xa3, 0x81, 0x9d, 0x30, 0x81, 0x9a, 0x30,  \
-    0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1d,  \
-    0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x50, 0x61, 0xa5,  \
-    0x8f, 0xd4, 0x07, 0xd9, 0xd7, 0x82, 0x01, 0x0c, 0xe5, 0x65, 0x7f, 0x8c,  \
-    0x63, 0x46, 0xa7, 0x13, 0xbe, 0x30, 0x6e, 0x06, 0x03, 0x55, 0x1d, 0x23,  \
-    0x04, 0x67, 0x30, 0x65, 0x80, 0x14, 0x9d, 0x6d, 0x20, 0x24, 0x49, 0x01,  \
-    0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, 0x7e, 0x24, 0xc9, 0xdb, 0xfb,  \
-    0x36, 0x7c, 0xa1, 0x42, 0xa4, 0x40, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09,  \
-    0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30,  \
-    0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x50, 0x6f, 0x6c, 0x61,  \
-    0x72, 0x53, 0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04,  \
-    0x03, 0x13, 0x13, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20,  \
-    0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x82, 0x09,  \
-    0x00, 0xc1, 0x43, 0xe2, 0x7e, 0x62, 0x43, 0xcc, 0xe8, 0x30, 0x0a, 0x06,  \
-    0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x68, 0x00,  \
-    0x30, 0x65, 0x02, 0x31, 0x00, 0x9a, 0x2c, 0x5c, 0xd7, 0xa6, 0xdb, 0xa2,  \
-    0xe5, 0x64, 0x0d, 0xf0, 0xb9, 0x4e, 0xdd, 0xd7, 0x61, 0xd6, 0x13, 0x31,  \
-    0xc7, 0xab, 0x73, 0x80, 0xbb, 0xd3, 0xd3, 0x73, 0x13, 0x54, 0xad, 0x92,  \
-    0x0b, 0x5d, 0xab, 0xd0, 0xbc, 0xf7, 0xae, 0x2f, 0xe6, 0xa1, 0x21, 0x29,  \
-    0x35, 0x95, 0xaa, 0x3e, 0x39, 0x02, 0x30, 0x21, 0x36, 0x7f, 0x9d, 0xc6,  \
-    0x5d, 0xc6, 0x0b, 0xab, 0x27, 0xf2, 0x25, 0x1d, 0x3b, 0xf1, 0xcf, 0xf1,  \
-    0x35, 0x25, 0x14, 0xe7, 0xe5, 0xf1, 0x97, 0xb5, 0x59, 0xe3, 0x5e, 0x15,  \
-    0x7c, 0x66, 0xb9, 0x90, 0x7b, 0xc7, 0x01, 0x10, 0x4f, 0x73, 0xc6, 0x00,  \
-    0x21, 0x52, 0x2a, 0x0e, 0xf1, 0xc7, 0xd5                                 \
-}
+/* BEGIN FILE binary macro TEST_SRV_CRT_EC_DER tests/data_files/server5.crt.der
+ */
+#define TEST_SRV_CRT_EC_DER                                                   \
+    {                                                                         \
+        0x30, 0x82, 0x02, 0x1f, 0x30, 0x82, 0x01, 0xa5, 0xa0, 0x03, 0x02,     \
+            0x01, 0x02, 0x02, 0x01, 0x09, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, \
+            0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x3e, 0x31, 0x0b, 0x30, \
+            0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, \
+            0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x50, \
+            0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, \
+            0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x13, 0x50, 0x6f, 0x6c, 0x61, \
+            0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, \
+            0x43, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x33, 0x30, \
+            0x39, 0x32, 0x34, 0x31, 0x35, 0x35, 0x32, 0x30, 0x34, 0x5a, 0x17, \
+            0x0d, 0x32, 0x33, 0x30, 0x39, 0x32, 0x32, 0x31, 0x35, 0x35, 0x32, \
+            0x30, 0x34, 0x5a, 0x30, 0x34, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \
+            0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, \
+            0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x50, 0x6f, 0x6c, 0x61, \
+            0x72, 0x53, 0x53, 0x4c, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, \
+            0x04, 0x03, 0x13, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, \
+            0x73, 0x74, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, \
+            0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, \
+            0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x37, 0xcc, 0x56, 0xd9, \
+            0x76, 0x09, 0x1e, 0x5a, 0x72, 0x3e, 0xc7, 0x59, 0x2d, 0xff, 0x20, \
+            0x6e, 0xee, 0x7c, 0xf9, 0x06, 0x91, 0x74, 0xd0, 0xad, 0x14, 0xb5, \
+            0xf7, 0x68, 0x22, 0x59, 0x62, 0x92, 0x4e, 0xe5, 0x00, 0xd8, 0x23, \
+            0x11, 0xff, 0xea, 0x2f, 0xd2, 0x34, 0x5d, 0x5d, 0x16, 0xbd, 0x8a, \
+            0x88, 0xc2, 0x6b, 0x77, 0x0d, 0x55, 0xcd, 0x8a, 0x2a, 0x0e, 0xfa, \
+            0x01, 0xc8, 0xb4, 0xed, 0xff, 0xa3, 0x81, 0x9d, 0x30, 0x81, 0x9a, \
+            0x30, 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, \
+            0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, \
+            0x50, 0x61, 0xa5, 0x8f, 0xd4, 0x07, 0xd9, 0xd7, 0x82, 0x01, 0x0c, \
+            0xe5, 0x65, 0x7f, 0x8c, 0x63, 0x46, 0xa7, 0x13, 0xbe, 0x30, 0x6e, \
+            0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x67, 0x30, 0x65, 0x80, 0x14, \
+            0x9d, 0x6d, 0x20, 0x24, 0x49, 0x01, 0x3f, 0x2b, 0xcb, 0x78, 0xb5, \
+            0x19, 0xbc, 0x7e, 0x24, 0xc9, 0xdb, 0xfb, 0x36, 0x7c, 0xa1, 0x42, \
+            0xa4, 0x40, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, \
+            0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, \
+            0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, \
+            0x53, 0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, \
+            0x03, 0x13, 0x13, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, \
+            0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, \
+            0x82, 0x09, 0x00, 0xc1, 0x43, 0xe2, 0x7e, 0x62, 0x43, 0xcc, 0xe8, \
+            0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, \
+            0x02, 0x03, 0x68, 0x00, 0x30, 0x65, 0x02, 0x31, 0x00, 0x9a, 0x2c, \
+            0x5c, 0xd7, 0xa6, 0xdb, 0xa2, 0xe5, 0x64, 0x0d, 0xf0, 0xb9, 0x4e, \
+            0xdd, 0xd7, 0x61, 0xd6, 0x13, 0x31, 0xc7, 0xab, 0x73, 0x80, 0xbb, \
+            0xd3, 0xd3, 0x73, 0x13, 0x54, 0xad, 0x92, 0x0b, 0x5d, 0xab, 0xd0, \
+            0xbc, 0xf7, 0xae, 0x2f, 0xe6, 0xa1, 0x21, 0x29, 0x35, 0x95, 0xaa, \
+            0x3e, 0x39, 0x02, 0x30, 0x21, 0x36, 0x7f, 0x9d, 0xc6, 0x5d, 0xc6, \
+            0x0b, 0xab, 0x27, 0xf2, 0x25, 0x1d, 0x3b, 0xf1, 0xcf, 0xf1, 0x35, \
+            0x25, 0x14, 0xe7, 0xe5, 0xf1, 0x97, 0xb5, 0x59, 0xe3, 0x5e, 0x15, \
+            0x7c, 0x66, 0xb9, 0x90, 0x7b, 0xc7, 0x01, 0x10, 0x4f, 0x73, 0xc6, \
+            0x00, 0x21, 0x52, 0x2a, 0x0e, 0xf1, 0xc7, 0xd5                    \
+    }
 /* END FILE */
 
 /* This is taken from tests/data_files/server5.key. */
@@ -579,24 +627,27 @@
 /* END FILE */
 
 /* This is generated from tests/data_files/server5.key.der using `xxd -i`. */
-/* BEGIN FILE binary macro TEST_SRV_KEY_EC_DER tests/data_files/server5.key.der */
-#define TEST_SRV_KEY_EC_DER {                                                \
-    0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0xf1, 0x2a, 0x13, 0x20, 0x76,  \
-    0x02, 0x70, 0xa8, 0x3c, 0xbf, 0xfd, 0x53, 0xf6, 0x03, 0x1e, 0xf7, 0x6a,  \
-    0x5d, 0x86, 0xc8, 0xa2, 0x04, 0xf2, 0xc3, 0x0c, 0xa9, 0xeb, 0xf5, 0x1f,  \
-    0x0f, 0x0e, 0xa7, 0xa0, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,  \
-    0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x37, 0xcc, 0x56,  \
-    0xd9, 0x76, 0x09, 0x1e, 0x5a, 0x72, 0x3e, 0xc7, 0x59, 0x2d, 0xff, 0x20,  \
-    0x6e, 0xee, 0x7c, 0xf9, 0x06, 0x91, 0x74, 0xd0, 0xad, 0x14, 0xb5, 0xf7,  \
-    0x68, 0x22, 0x59, 0x62, 0x92, 0x4e, 0xe5, 0x00, 0xd8, 0x23, 0x11, 0xff,  \
-    0xea, 0x2f, 0xd2, 0x34, 0x5d, 0x5d, 0x16, 0xbd, 0x8a, 0x88, 0xc2, 0x6b,  \
-    0x77, 0x0d, 0x55, 0xcd, 0x8a, 0x2a, 0x0e, 0xfa, 0x01, 0xc8, 0xb4, 0xed,  \
-    0xff                                                                     \
-}
+/* BEGIN FILE binary macro TEST_SRV_KEY_EC_DER tests/data_files/server5.key.der
+ */
+#define TEST_SRV_KEY_EC_DER                                                   \
+    {                                                                         \
+        0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0xf1, 0x2a, 0x13, 0x20,     \
+            0x76, 0x02, 0x70, 0xa8, 0x3c, 0xbf, 0xfd, 0x53, 0xf6, 0x03, 0x1e, \
+            0xf7, 0x6a, 0x5d, 0x86, 0xc8, 0xa2, 0x04, 0xf2, 0xc3, 0x0c, 0xa9, \
+            0xeb, 0xf5, 0x1f, 0x0f, 0x0e, 0xa7, 0xa0, 0x0a, 0x06, 0x08, 0x2a, \
+            0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, \
+            0x00, 0x04, 0x37, 0xcc, 0x56, 0xd9, 0x76, 0x09, 0x1e, 0x5a, 0x72, \
+            0x3e, 0xc7, 0x59, 0x2d, 0xff, 0x20, 0x6e, 0xee, 0x7c, 0xf9, 0x06, \
+            0x91, 0x74, 0xd0, 0xad, 0x14, 0xb5, 0xf7, 0x68, 0x22, 0x59, 0x62, \
+            0x92, 0x4e, 0xe5, 0x00, 0xd8, 0x23, 0x11, 0xff, 0xea, 0x2f, 0xd2, \
+            0x34, 0x5d, 0x5d, 0x16, 0xbd, 0x8a, 0x88, 0xc2, 0x6b, 0x77, 0x0d, \
+            0x55, 0xcd, 0x8a, 0x2a, 0x0e, 0xfa, 0x01, 0xc8, 0xb4, 0xed, 0xff  \
+    }
 /* END FILE */
 
 /* This is taken from tests/data_files/server2-sha256.crt. */
-/* BEGIN FILE string macro TEST_SRV_CRT_RSA_SHA256_PEM tests/data_files/server2-sha256.crt */
+/* BEGIN FILE string macro TEST_SRV_CRT_RSA_SHA256_PEM
+ * tests/data_files/server2-sha256.crt */
 #define TEST_SRV_CRT_RSA_SHA256_PEM                                        \
     "-----BEGIN CERTIFICATE-----\r\n"                                      \
     "MIIDNzCCAh+gAwIBAgIBAjANBgkqhkiG9w0BAQsFADA7MQswCQYDVQQGEwJOTDER\r\n" \
@@ -621,178 +672,197 @@
 /* END FILE */
 
 /* This is taken from tests/data_files/server2-sha256.crt.der. */
-/* BEGIN FILE binary macro TEST_SRV_CRT_RSA_SHA256_DER tests/data_files/server2-sha256.crt.der */
-#define TEST_SRV_CRT_RSA_SHA256_DER {                                        \
-  0x30, 0x82, 0x03, 0x37, 0x30, 0x82, 0x02, 0x1f, 0xa0, 0x03, 0x02, 0x01,    \
-  0x02, 0x02, 0x01, 0x02, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,    \
-  0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x3b, 0x31, 0x0b, 0x30,    \
-  0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11,    \
-  0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c,    \
-  0x61, 0x72, 0x53, 0x53, 0x4c, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55,    \
-  0x04, 0x03, 0x0c, 0x10, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c,    \
-  0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d,    \
-  0x31, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, 0x36,    \
-  0x5a, 0x17, 0x0d, 0x32, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34,    \
-  0x34, 0x30, 0x36, 0x5a, 0x30, 0x34, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,    \
-  0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06,    \
-  0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53,    \
-  0x53, 0x4c, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,    \
-  0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x30, 0x82,    \
-  0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,    \
-  0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82,    \
-  0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xc1, 0x4d, 0xa3, 0xdd, 0xe7,    \
-  0xcd, 0x1d, 0xd1, 0x04, 0xd7, 0x49, 0x72, 0xb8, 0x99, 0xac, 0x0e, 0x78,    \
-  0xe4, 0x3a, 0x3c, 0x4a, 0xcf, 0x3a, 0x13, 0x16, 0xd0, 0x5a, 0xe4, 0xcd,    \
-  0xa3, 0x00, 0x88, 0xa7, 0xee, 0x1e, 0x6b, 0x96, 0xa7, 0x52, 0xb4, 0x90,    \
-  0xef, 0x2d, 0x72, 0x7a, 0x3e, 0x24, 0x9a, 0xfc, 0xb6, 0x34, 0xac, 0x24,    \
-  0xf5, 0x77, 0xe0, 0x26, 0x64, 0x8c, 0x9c, 0xb0, 0x28, 0x7d, 0xa1, 0xda,    \
-  0xea, 0x8c, 0xe6, 0xc9, 0x1c, 0x96, 0xbc, 0xfe, 0xc1, 0x04, 0x52, 0xb3,    \
-  0x36, 0xd4, 0xa3, 0xfa, 0xe1, 0xb1, 0x76, 0xd8, 0x90, 0xc1, 0x61, 0xb4,    \
-  0x66, 0x52, 0x36, 0xa2, 0x26, 0x53, 0xaa, 0xab, 0x74, 0x5e, 0x07, 0x7d,    \
-  0x19, 0x82, 0xdb, 0x2a, 0xd8, 0x1f, 0xa0, 0xd9, 0x0d, 0x1c, 0x2d, 0x49,    \
-  0x66, 0xf7, 0x5b, 0x25, 0x73, 0x46, 0xe8, 0x0b, 0x8a, 0x4f, 0x69, 0x0c,    \
-  0xb5, 0x00, 0x90, 0xe1, 0xda, 0x82, 0x10, 0x66, 0x7d, 0xae, 0x54, 0x2b,    \
-  0x8b, 0x65, 0x79, 0x91, 0xa1, 0xe2, 0x61, 0xc3, 0xcd, 0x40, 0x49, 0x08,    \
-  0xee, 0x68, 0x0c, 0xf1, 0x8b, 0x86, 0xd2, 0x46, 0xbf, 0xd0, 0xb8, 0xaa,    \
-  0x11, 0x03, 0x1e, 0x7f, 0x56, 0xa8, 0x1a, 0x1e, 0x44, 0x18, 0x0f, 0x0f,    \
-  0x85, 0x8b, 0xda, 0x8b, 0x44, 0x5e, 0xe2, 0x18, 0xc6, 0x62, 0x2f, 0xc7,    \
-  0x66, 0x8d, 0xfa, 0x5d, 0xd8, 0x7d, 0xf3, 0x27, 0x89, 0x29, 0x01, 0xc5,    \
-  0x90, 0x0e, 0x3f, 0x27, 0xf1, 0x30, 0xc8, 0x4a, 0x0e, 0xef, 0xd6, 0xde,    \
-  0xc7, 0xc7, 0x27, 0x6b, 0xc7, 0x05, 0x3d, 0x7a, 0xc4, 0x02, 0x3c, 0x9a,    \
-  0x1d, 0x3e, 0x0f, 0xe8, 0x34, 0x98, 0x5b, 0xcb, 0x73, 0x4b, 0x52, 0x96,    \
-  0xd8, 0x11, 0xa2, 0x2c, 0x80, 0x88, 0x69, 0x39, 0x5a, 0xd3, 0x0f, 0xb0,    \
-  0xde, 0x59, 0x2f, 0x11, 0xc7, 0xf7, 0xea, 0x12, 0x01, 0x30, 0x97, 0x02,    \
-  0x03, 0x01, 0x00, 0x01, 0xa3, 0x4d, 0x30, 0x4b, 0x30, 0x09, 0x06, 0x03,    \
-  0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55,    \
-  0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xa5, 0x05, 0xe8, 0x64, 0xb8, 0xdc,    \
-  0xdf, 0x60, 0x0f, 0x50, 0x12, 0x4d, 0x60, 0xa8, 0x64, 0xaf, 0x4d, 0x8b,    \
-  0x43, 0x93, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30,    \
-  0x16, 0x80, 0x14, 0xb4, 0x5a, 0xe4, 0xa5, 0xb3, 0xde, 0xd2, 0x52, 0xf6,    \
-  0xb9, 0xd5, 0xa6, 0x95, 0x0f, 0xeb, 0x3e, 0xbc, 0xc7, 0xfd, 0xff, 0x30,    \
-  0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b,    \
-  0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x2e, 0x3a, 0xe4, 0x52, 0x61,    \
-  0x3e, 0xa7, 0xa5, 0xef, 0x32, 0x67, 0x80, 0x72, 0x07, 0x26, 0xba, 0xa3,    \
-  0xff, 0x05, 0x40, 0xc4, 0x60, 0x05, 0x39, 0x31, 0x77, 0xf7, 0xa5, 0xca,    \
-  0x01, 0x31, 0x80, 0xa7, 0xe1, 0xd1, 0x0a, 0xa2, 0x7c, 0xd5, 0x1c, 0xba,    \
-  0xd0, 0x23, 0x4a, 0xd6, 0x30, 0xf3, 0x93, 0xc7, 0x6f, 0xe8, 0xce, 0x94,    \
-  0x1e, 0x84, 0xbb, 0x44, 0x81, 0x62, 0x33, 0xff, 0x6b, 0x5d, 0x00, 0x9b,    \
-  0x25, 0xf8, 0x8f, 0x0f, 0x9c, 0x4c, 0x4d, 0xe8, 0xd9, 0xa7, 0x99, 0xf9,    \
-  0x51, 0x81, 0xc0, 0x9b, 0x1b, 0x31, 0x0d, 0xa6, 0xb3, 0x7c, 0x0e, 0x45,    \
-  0xb8, 0x18, 0x64, 0x7e, 0x89, 0x0a, 0x2b, 0xa8, 0xc3, 0xe0, 0x4a, 0xbd,    \
-  0xd4, 0x2f, 0x78, 0xc4, 0x62, 0x9b, 0xe9, 0x7e, 0x3f, 0x56, 0x46, 0x8f,    \
-  0x17, 0xb7, 0x2a, 0xa0, 0x10, 0x70, 0xfd, 0xb1, 0xf1, 0x6b, 0x05, 0xdc,    \
-  0xd1, 0x41, 0x0f, 0x8e, 0xa6, 0xb2, 0x88, 0x1a, 0x42, 0x61, 0x4f, 0xeb,    \
-  0x26, 0x85, 0x59, 0x80, 0xba, 0x85, 0x54, 0xfe, 0xcf, 0xc7, 0x7b, 0x2f,    \
-  0x6b, 0x59, 0xce, 0xac, 0xdc, 0x7c, 0xac, 0xf3, 0xc8, 0xd6, 0x12, 0x7e,    \
-  0x64, 0xe8, 0x3c, 0x99, 0xa8, 0x8f, 0x4f, 0x11, 0xd9, 0x9c, 0x15, 0x4b,    \
-  0x6a, 0x44, 0x92, 0x2d, 0x0c, 0xbf, 0xb1, 0x67, 0x96, 0xc9, 0xac, 0xce,    \
-  0xd5, 0x19, 0xeb, 0x6f, 0x18, 0xeb, 0x6e, 0x04, 0x2d, 0x60, 0xac, 0xf4,    \
-  0x7b, 0x79, 0xf0, 0x1a, 0x9b, 0xb5, 0xc3, 0x5d, 0xef, 0x7d, 0xc9, 0x05,    \
-  0x99, 0x44, 0x81, 0x84, 0x75, 0xc7, 0xec, 0x00, 0x12, 0xfc, 0x7a, 0x4a,    \
-  0x0b, 0x82, 0x07, 0xec, 0x6d, 0x86, 0x02, 0x4d, 0xfe, 0x9f, 0xc8, 0x92,    \
-  0x48, 0xde, 0xf5, 0xb1, 0x9c, 0xe9, 0xc6, 0x89, 0xd0, 0xc1, 0x56, 0xe8,    \
-  0xa4, 0xc6, 0x6a, 0x2e, 0x66, 0xc1, 0x9b, 0xfe, 0xd6, 0x3c, 0xb7           \
-}
+/* BEGIN FILE binary macro TEST_SRV_CRT_RSA_SHA256_DER
+ * tests/data_files/server2-sha256.crt.der */
+#define TEST_SRV_CRT_RSA_SHA256_DER                                           \
+    {                                                                         \
+        0x30, 0x82, 0x03, 0x37, 0x30, 0x82, 0x02, 0x1f, 0xa0, 0x03, 0x02,     \
+            0x01, 0x02, 0x02, 0x01, 0x02, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, \
+            0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x3b, \
+            0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, \
+            0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, \
+            0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x31, \
+            0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x10, 0x50, \
+            0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x20, 0x54, 0x65, 0x73, \
+            0x74, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x39, 0x30, \
+            0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, 0x36, 0x5a, 0x17, \
+            0x0d, 0x32, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, \
+            0x30, 0x36, 0x5a, 0x30, 0x34, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \
+            0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, \
+            0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, \
+            0x72, 0x53, 0x53, 0x4c, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, \
+            0x04, 0x03, 0x0c, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, \
+            0x73, 0x74, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, \
+            0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, \
+            0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, \
+            0x01, 0x00, 0xc1, 0x4d, 0xa3, 0xdd, 0xe7, 0xcd, 0x1d, 0xd1, 0x04, \
+            0xd7, 0x49, 0x72, 0xb8, 0x99, 0xac, 0x0e, 0x78, 0xe4, 0x3a, 0x3c, \
+            0x4a, 0xcf, 0x3a, 0x13, 0x16, 0xd0, 0x5a, 0xe4, 0xcd, 0xa3, 0x00, \
+            0x88, 0xa7, 0xee, 0x1e, 0x6b, 0x96, 0xa7, 0x52, 0xb4, 0x90, 0xef, \
+            0x2d, 0x72, 0x7a, 0x3e, 0x24, 0x9a, 0xfc, 0xb6, 0x34, 0xac, 0x24, \
+            0xf5, 0x77, 0xe0, 0x26, 0x64, 0x8c, 0x9c, 0xb0, 0x28, 0x7d, 0xa1, \
+            0xda, 0xea, 0x8c, 0xe6, 0xc9, 0x1c, 0x96, 0xbc, 0xfe, 0xc1, 0x04, \
+            0x52, 0xb3, 0x36, 0xd4, 0xa3, 0xfa, 0xe1, 0xb1, 0x76, 0xd8, 0x90, \
+            0xc1, 0x61, 0xb4, 0x66, 0x52, 0x36, 0xa2, 0x26, 0x53, 0xaa, 0xab, \
+            0x74, 0x5e, 0x07, 0x7d, 0x19, 0x82, 0xdb, 0x2a, 0xd8, 0x1f, 0xa0, \
+            0xd9, 0x0d, 0x1c, 0x2d, 0x49, 0x66, 0xf7, 0x5b, 0x25, 0x73, 0x46, \
+            0xe8, 0x0b, 0x8a, 0x4f, 0x69, 0x0c, 0xb5, 0x00, 0x90, 0xe1, 0xda, \
+            0x82, 0x10, 0x66, 0x7d, 0xae, 0x54, 0x2b, 0x8b, 0x65, 0x79, 0x91, \
+            0xa1, 0xe2, 0x61, 0xc3, 0xcd, 0x40, 0x49, 0x08, 0xee, 0x68, 0x0c, \
+            0xf1, 0x8b, 0x86, 0xd2, 0x46, 0xbf, 0xd0, 0xb8, 0xaa, 0x11, 0x03, \
+            0x1e, 0x7f, 0x56, 0xa8, 0x1a, 0x1e, 0x44, 0x18, 0x0f, 0x0f, 0x85, \
+            0x8b, 0xda, 0x8b, 0x44, 0x5e, 0xe2, 0x18, 0xc6, 0x62, 0x2f, 0xc7, \
+            0x66, 0x8d, 0xfa, 0x5d, 0xd8, 0x7d, 0xf3, 0x27, 0x89, 0x29, 0x01, \
+            0xc5, 0x90, 0x0e, 0x3f, 0x27, 0xf1, 0x30, 0xc8, 0x4a, 0x0e, 0xef, \
+            0xd6, 0xde, 0xc7, 0xc7, 0x27, 0x6b, 0xc7, 0x05, 0x3d, 0x7a, 0xc4, \
+            0x02, 0x3c, 0x9a, 0x1d, 0x3e, 0x0f, 0xe8, 0x34, 0x98, 0x5b, 0xcb, \
+            0x73, 0x4b, 0x52, 0x96, 0xd8, 0x11, 0xa2, 0x2c, 0x80, 0x88, 0x69, \
+            0x39, 0x5a, 0xd3, 0x0f, 0xb0, 0xde, 0x59, 0x2f, 0x11, 0xc7, 0xf7, \
+            0xea, 0x12, 0x01, 0x30, 0x97, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, \
+            0x4d, 0x30, 0x4b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, \
+            0x02, 0x30, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, \
+            0x16, 0x04, 0x14, 0xa5, 0x05, 0xe8, 0x64, 0xb8, 0xdc, 0xdf, 0x60, \
+            0x0f, 0x50, 0x12, 0x4d, 0x60, 0xa8, 0x64, 0xaf, 0x4d, 0x8b, 0x43, \
+            0x93, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, \
+            0x16, 0x80, 0x14, 0xb4, 0x5a, 0xe4, 0xa5, 0xb3, 0xde, 0xd2, 0x52, \
+            0xf6, 0xb9, 0xd5, 0xa6, 0x95, 0x0f, 0xeb, 0x3e, 0xbc, 0xc7, 0xfd, \
+            0xff, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, \
+            0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x2e, \
+            0x3a, 0xe4, 0x52, 0x61, 0x3e, 0xa7, 0xa5, 0xef, 0x32, 0x67, 0x80, \
+            0x72, 0x07, 0x26, 0xba, 0xa3, 0xff, 0x05, 0x40, 0xc4, 0x60, 0x05, \
+            0x39, 0x31, 0x77, 0xf7, 0xa5, 0xca, 0x01, 0x31, 0x80, 0xa7, 0xe1, \
+            0xd1, 0x0a, 0xa2, 0x7c, 0xd5, 0x1c, 0xba, 0xd0, 0x23, 0x4a, 0xd6, \
+            0x30, 0xf3, 0x93, 0xc7, 0x6f, 0xe8, 0xce, 0x94, 0x1e, 0x84, 0xbb, \
+            0x44, 0x81, 0x62, 0x33, 0xff, 0x6b, 0x5d, 0x00, 0x9b, 0x25, 0xf8, \
+            0x8f, 0x0f, 0x9c, 0x4c, 0x4d, 0xe8, 0xd9, 0xa7, 0x99, 0xf9, 0x51, \
+            0x81, 0xc0, 0x9b, 0x1b, 0x31, 0x0d, 0xa6, 0xb3, 0x7c, 0x0e, 0x45, \
+            0xb8, 0x18, 0x64, 0x7e, 0x89, 0x0a, 0x2b, 0xa8, 0xc3, 0xe0, 0x4a, \
+            0xbd, 0xd4, 0x2f, 0x78, 0xc4, 0x62, 0x9b, 0xe9, 0x7e, 0x3f, 0x56, \
+            0x46, 0x8f, 0x17, 0xb7, 0x2a, 0xa0, 0x10, 0x70, 0xfd, 0xb1, 0xf1, \
+            0x6b, 0x05, 0xdc, 0xd1, 0x41, 0x0f, 0x8e, 0xa6, 0xb2, 0x88, 0x1a, \
+            0x42, 0x61, 0x4f, 0xeb, 0x26, 0x85, 0x59, 0x80, 0xba, 0x85, 0x54, \
+            0xfe, 0xcf, 0xc7, 0x7b, 0x2f, 0x6b, 0x59, 0xce, 0xac, 0xdc, 0x7c, \
+            0xac, 0xf3, 0xc8, 0xd6, 0x12, 0x7e, 0x64, 0xe8, 0x3c, 0x99, 0xa8, \
+            0x8f, 0x4f, 0x11, 0xd9, 0x9c, 0x15, 0x4b, 0x6a, 0x44, 0x92, 0x2d, \
+            0x0c, 0xbf, 0xb1, 0x67, 0x96, 0xc9, 0xac, 0xce, 0xd5, 0x19, 0xeb, \
+            0x6f, 0x18, 0xeb, 0x6e, 0x04, 0x2d, 0x60, 0xac, 0xf4, 0x7b, 0x79, \
+            0xf0, 0x1a, 0x9b, 0xb5, 0xc3, 0x5d, 0xef, 0x7d, 0xc9, 0x05, 0x99, \
+            0x44, 0x81, 0x84, 0x75, 0xc7, 0xec, 0x00, 0x12, 0xfc, 0x7a, 0x4a, \
+            0x0b, 0x82, 0x07, 0xec, 0x6d, 0x86, 0x02, 0x4d, 0xfe, 0x9f, 0xc8, \
+            0x92, 0x48, 0xde, 0xf5, 0xb1, 0x9c, 0xe9, 0xc6, 0x89, 0xd0, 0xc1, \
+            0x56, 0xe8, 0xa4, 0xc6, 0x6a, 0x2e, 0x66, 0xc1, 0x9b, 0xfe, 0xd6, \
+            0x3c, 0xb7                                                        \
+    }
 /* END FILE */
 
 /* This is taken from tests/data_files/server2.crt. */
-/* BEGIN FILE string macro TEST_SRV_CRT_RSA_SHA1_PEM tests/data_files/server2.crt */
-#define TEST_SRV_CRT_RSA_SHA1_PEM                                       \
-"-----BEGIN CERTIFICATE-----\r\n"                                       \
-"MIIDNzCCAh+gAwIBAgIBAjANBgkqhkiG9w0BAQUFADA7MQswCQYDVQQGEwJOTDER\r\n"  \
-"MA8GA1UECgwIUG9sYXJTU0wxGTAXBgNVBAMMEFBvbGFyU1NMIFRlc3QgQ0EwHhcN\r\n"  \
-"MTkwMjEwMTQ0NDA2WhcNMjkwMjEwMTQ0NDA2WjA0MQswCQYDVQQGEwJOTDERMA8G\r\n"  \
-"A1UECgwIUG9sYXJTU0wxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcN\r\n"  \
-"AQEBBQADggEPADCCAQoCggEBAMFNo93nzR3RBNdJcriZrA545Do8Ss86ExbQWuTN\r\n"  \
-"owCIp+4ea5anUrSQ7y1yej4kmvy2NKwk9XfgJmSMnLAofaHa6ozmyRyWvP7BBFKz\r\n"  \
-"NtSj+uGxdtiQwWG0ZlI2oiZTqqt0Xgd9GYLbKtgfoNkNHC1JZvdbJXNG6AuKT2kM\r\n"  \
-"tQCQ4dqCEGZ9rlQri2V5kaHiYcPNQEkI7mgM8YuG0ka/0LiqEQMef1aoGh5EGA8P\r\n"  \
-"hYvai0Re4hjGYi/HZo36Xdh98yeJKQHFkA4/J/EwyEoO79bex8cna8cFPXrEAjya\r\n"  \
-"HT4P6DSYW8tzS1KW2BGiLICIaTla0w+w3lkvEcf36hIBMJcCAwEAAaNNMEswCQYD\r\n"  \
-"VR0TBAIwADAdBgNVHQ4EFgQUpQXoZLjc32APUBJNYKhkr02LQ5MwHwYDVR0jBBgw\r\n"  \
-"FoAUtFrkpbPe0lL2udWmlQ/rPrzH/f8wDQYJKoZIhvcNAQEFBQADggEBAJklg3Q4\r\n"  \
-"cB7v7BzsxM/vLyKccO6op0/gZzM4ghuLq2Y32kl0sM6kSNUUmduuq3u/+GmUZN2A\r\n"  \
-"O/7c+Hw7hDFEIvZk98aBGjCLqn3DmgHIv8ToQ67nellQxx2Uj309PdgjNi/r9HOc\r\n"  \
-"KNAYPbBcg6MJGWWj2TI6vNaceios/DhOYx5V0j5nfqSJ/pnU0g9Ign2LAhgYpGJE\r\n"  \
-"iEM9wW7hEMkwmk0h/sqZsrJsGH5YsF/VThSq/JVO1e2mZH2vruyZKJVBq+8tDNYp\r\n"  \
-"HkK6tSyVYQhzIt3StMJWKMl/o5k2AYz6tSC164+1oG+ML3LWg8XrGKa91H4UOKap\r\n"  \
-"Awgk0+4m0T25cNs=\r\n"                                                  \
-"-----END CERTIFICATE-----\r\n"
+/* BEGIN FILE string macro TEST_SRV_CRT_RSA_SHA1_PEM
+ * tests/data_files/server2.crt */
+#define TEST_SRV_CRT_RSA_SHA1_PEM                                          \
+    "-----BEGIN CERTIFICATE-----\r\n"                                      \
+    "MIIDNzCCAh+gAwIBAgIBAjANBgkqhkiG9w0BAQUFADA7MQswCQYDVQQGEwJOTDER\r\n" \
+    "MA8GA1UECgwIUG9sYXJTU0wxGTAXBgNVBAMMEFBvbGFyU1NMIFRlc3QgQ0EwHhcN\r\n" \
+    "MTkwMjEwMTQ0NDA2WhcNMjkwMjEwMTQ0NDA2WjA0MQswCQYDVQQGEwJOTDERMA8G\r\n" \
+    "A1UECgwIUG9sYXJTU0wxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcN\r\n" \
+    "AQEBBQADggEPADCCAQoCggEBAMFNo93nzR3RBNdJcriZrA545Do8Ss86ExbQWuTN\r\n" \
+    "owCIp+4ea5anUrSQ7y1yej4kmvy2NKwk9XfgJmSMnLAofaHa6ozmyRyWvP7BBFKz\r\n" \
+    "NtSj+uGxdtiQwWG0ZlI2oiZTqqt0Xgd9GYLbKtgfoNkNHC1JZvdbJXNG6AuKT2kM\r\n" \
+    "tQCQ4dqCEGZ9rlQri2V5kaHiYcPNQEkI7mgM8YuG0ka/0LiqEQMef1aoGh5EGA8P\r\n" \
+    "hYvai0Re4hjGYi/HZo36Xdh98yeJKQHFkA4/J/EwyEoO79bex8cna8cFPXrEAjya\r\n" \
+    "HT4P6DSYW8tzS1KW2BGiLICIaTla0w+w3lkvEcf36hIBMJcCAwEAAaNNMEswCQYD\r\n" \
+    "VR0TBAIwADAdBgNVHQ4EFgQUpQXoZLjc32APUBJNYKhkr02LQ5MwHwYDVR0jBBgw\r\n" \
+    "FoAUtFrkpbPe0lL2udWmlQ/rPrzH/f8wDQYJKoZIhvcNAQEFBQADggEBAJklg3Q4\r\n" \
+    "cB7v7BzsxM/vLyKccO6op0/gZzM4ghuLq2Y32kl0sM6kSNUUmduuq3u/+GmUZN2A\r\n" \
+    "O/7c+Hw7hDFEIvZk98aBGjCLqn3DmgHIv8ToQ67nellQxx2Uj309PdgjNi/r9HOc\r\n" \
+    "KNAYPbBcg6MJGWWj2TI6vNaceios/DhOYx5V0j5nfqSJ/pnU0g9Ign2LAhgYpGJE\r\n" \
+    "iEM9wW7hEMkwmk0h/sqZsrJsGH5YsF/VThSq/JVO1e2mZH2vruyZKJVBq+8tDNYp\r\n" \
+    "HkK6tSyVYQhzIt3StMJWKMl/o5k2AYz6tSC164+1oG+ML3LWg8XrGKa91H4UOKap\r\n" \
+    "Awgk0+4m0T25cNs=\r\n"                                                 \
+    "-----END CERTIFICATE-----\r\n"
 /* END FILE */
 
 /* This is taken from tests/data_files/server2.crt.der. */
-/* BEGIN FILE binary macro TEST_SRV_CRT_RSA_SHA1_DER tests/data_files/server2.crt.der */
-#define TEST_SRV_CRT_RSA_SHA1_DER {                                          \
-    0x30, 0x82, 0x03, 0x37, 0x30, 0x82, 0x02, 0x1f, 0xa0, 0x03, 0x02, 0x01,  \
-    0x02, 0x02, 0x01, 0x02, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,  \
-    0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x3b, 0x31, 0x0b, 0x30,  \
-    0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11,  \
-    0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c,  \
-    0x61, 0x72, 0x53, 0x53, 0x4c, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55,  \
-    0x04, 0x03, 0x0c, 0x10, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c,  \
-    0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d,  \
-    0x31, 0x31, 0x30, 0x32, 0x31, 0x32, 0x31, 0x34, 0x34, 0x34, 0x30, 0x36,  \
-    0x5a, 0x17, 0x0d, 0x32, 0x31, 0x30, 0x32, 0x31, 0x32, 0x31, 0x34, 0x34,  \
-    0x34, 0x30, 0x36, 0x5a, 0x30, 0x34, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,  \
-    0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06,  \
-    0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53,  \
-    0x53, 0x4c, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,  \
-    0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x30, 0x82,  \
-    0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,  \
-    0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82,  \
-    0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xc1, 0x4d, 0xa3, 0xdd, 0xe7,  \
-    0xcd, 0x1d, 0xd1, 0x04, 0xd7, 0x49, 0x72, 0xb8, 0x99, 0xac, 0x0e, 0x78,  \
-    0xe4, 0x3a, 0x3c, 0x4a, 0xcf, 0x3a, 0x13, 0x16, 0xd0, 0x5a, 0xe4, 0xcd,  \
-    0xa3, 0x00, 0x88, 0xa7, 0xee, 0x1e, 0x6b, 0x96, 0xa7, 0x52, 0xb4, 0x90,  \
-    0xef, 0x2d, 0x72, 0x7a, 0x3e, 0x24, 0x9a, 0xfc, 0xb6, 0x34, 0xac, 0x24,  \
-    0xf5, 0x77, 0xe0, 0x26, 0x64, 0x8c, 0x9c, 0xb0, 0x28, 0x7d, 0xa1, 0xda,  \
-    0xea, 0x8c, 0xe6, 0xc9, 0x1c, 0x96, 0xbc, 0xfe, 0xc1, 0x04, 0x52, 0xb3,  \
-    0x36, 0xd4, 0xa3, 0xfa, 0xe1, 0xb1, 0x76, 0xd8, 0x90, 0xc1, 0x61, 0xb4,  \
-    0x66, 0x52, 0x36, 0xa2, 0x26, 0x53, 0xaa, 0xab, 0x74, 0x5e, 0x07, 0x7d,  \
-    0x19, 0x82, 0xdb, 0x2a, 0xd8, 0x1f, 0xa0, 0xd9, 0x0d, 0x1c, 0x2d, 0x49,  \
-    0x66, 0xf7, 0x5b, 0x25, 0x73, 0x46, 0xe8, 0x0b, 0x8a, 0x4f, 0x69, 0x0c,  \
-    0xb5, 0x00, 0x90, 0xe1, 0xda, 0x82, 0x10, 0x66, 0x7d, 0xae, 0x54, 0x2b,  \
-    0x8b, 0x65, 0x79, 0x91, 0xa1, 0xe2, 0x61, 0xc3, 0xcd, 0x40, 0x49, 0x08,  \
-    0xee, 0x68, 0x0c, 0xf1, 0x8b, 0x86, 0xd2, 0x46, 0xbf, 0xd0, 0xb8, 0xaa,  \
-    0x11, 0x03, 0x1e, 0x7f, 0x56, 0xa8, 0x1a, 0x1e, 0x44, 0x18, 0x0f, 0x0f,  \
-    0x85, 0x8b, 0xda, 0x8b, 0x44, 0x5e, 0xe2, 0x18, 0xc6, 0x62, 0x2f, 0xc7,  \
-    0x66, 0x8d, 0xfa, 0x5d, 0xd8, 0x7d, 0xf3, 0x27, 0x89, 0x29, 0x01, 0xc5,  \
-    0x90, 0x0e, 0x3f, 0x27, 0xf1, 0x30, 0xc8, 0x4a, 0x0e, 0xef, 0xd6, 0xde,  \
-    0xc7, 0xc7, 0x27, 0x6b, 0xc7, 0x05, 0x3d, 0x7a, 0xc4, 0x02, 0x3c, 0x9a,  \
-    0x1d, 0x3e, 0x0f, 0xe8, 0x34, 0x98, 0x5b, 0xcb, 0x73, 0x4b, 0x52, 0x96,  \
-    0xd8, 0x11, 0xa2, 0x2c, 0x80, 0x88, 0x69, 0x39, 0x5a, 0xd3, 0x0f, 0xb0,  \
-    0xde, 0x59, 0x2f, 0x11, 0xc7, 0xf7, 0xea, 0x12, 0x01, 0x30, 0x97, 0x02,  \
-    0x03, 0x01, 0x00, 0x01, 0xa3, 0x4d, 0x30, 0x4b, 0x30, 0x09, 0x06, 0x03,  \
-    0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55,  \
-    0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xa5, 0x05, 0xe8, 0x64, 0xb8, 0xdc,  \
-    0xdf, 0x60, 0x0f, 0x50, 0x12, 0x4d, 0x60, 0xa8, 0x64, 0xaf, 0x4d, 0x8b,  \
-    0x43, 0x93, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30,  \
-    0x16, 0x80, 0x14, 0xb4, 0x5a, 0xe4, 0xa5, 0xb3, 0xde, 0xd2, 0x52, 0xf6,  \
-    0xb9, 0xd5, 0xa6, 0x95, 0x0f, 0xeb, 0x3e, 0xbc, 0xc7, 0xfd, 0xff, 0x30,  \
-    0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05,  \
-    0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x01, 0x73, 0x0b, 0x4a, 0xc5,  \
-    0xcb, 0xa0, 0xde, 0xf1, 0x63, 0x1c, 0x76, 0x04, 0x2b, 0x13, 0x0d, 0xc0,  \
-    0x84, 0x11, 0xc5, 0x8f, 0x3a, 0xa7, 0xc5, 0x9c, 0x35, 0x7a, 0x77, 0xb8,  \
-    0x20, 0x14, 0x82, 0xee, 0x54, 0xf0, 0xf2, 0xb0, 0x52, 0xcb, 0x78, 0xce,  \
-    0x59, 0x07, 0x4f, 0x51, 0x69, 0xfe, 0xd3, 0x2f, 0xe9, 0x09, 0xe7, 0x85,  \
-    0x92, 0xd8, 0xba, 0xb1, 0xeb, 0xc5, 0x76, 0x5d, 0x61, 0x2d, 0xe9, 0x86,  \
-    0xb5, 0xde, 0x2a, 0xf9, 0x3f, 0x53, 0x28, 0x42, 0x86, 0x83, 0x73, 0x43,  \
-    0xe0, 0x04, 0x5f, 0x07, 0x90, 0x14, 0x65, 0x9f, 0x6e, 0x10, 0x7a, 0xbc,  \
-    0x58, 0x19, 0x22, 0xc2, 0xeb, 0x39, 0x72, 0x51, 0x92, 0xd7, 0xb4, 0x1d,  \
-    0x75, 0x2f, 0xd3, 0x3a, 0x2b, 0x01, 0xe7, 0xdb, 0x50, 0xae, 0xe2, 0xf1,  \
-    0xd4, 0x4d, 0x5b, 0x3c, 0xbb, 0x41, 0x2b, 0x2a, 0xa4, 0xe2, 0x4a, 0x02,  \
-    0xe5, 0x60, 0x14, 0x2c, 0x9c, 0x1f, 0xa6, 0xcc, 0x06, 0x4b, 0x25, 0x89,  \
-    0x4e, 0x96, 0x30, 0x22, 0x9c, 0x5c, 0x58, 0x4d, 0xc3, 0xda, 0xd0, 0x6e,  \
-    0x50, 0x1e, 0x8c, 0x65, 0xf5, 0xd9, 0x17, 0x35, 0xa6, 0x58, 0x43, 0xb2,  \
-    0x29, 0xb7, 0xa8, 0x5e, 0x35, 0xde, 0xf0, 0x60, 0x42, 0x1a, 0x01, 0xcb,  \
-    0xcb, 0x0b, 0xd8, 0x0e, 0xc1, 0x90, 0xdf, 0xa1, 0xd2, 0x1a, 0xd1, 0x2c,  \
-    0x02, 0xf4, 0x76, 0x41, 0xa4, 0xcb, 0x4b, 0x15, 0x98, 0x71, 0xf9, 0x35,  \
-    0x7d, 0xb0, 0xe7, 0xe2, 0x34, 0x96, 0x91, 0xbe, 0x32, 0x67, 0x2d, 0x6b,  \
-    0xd3, 0x55, 0x04, 0x8a, 0x01, 0x50, 0xb4, 0xe3, 0x62, 0x78, 0x6c, 0x11,  \
-    0x15, 0xa5, 0x2a, 0x11, 0xc1, 0x49, 0x1c, 0x9b, 0xc4, 0x10, 0x65, 0x60,  \
-    0x87, 0xd9, 0x1e, 0x69, 0x59, 0x4e, 0x8f, 0x6b, 0xeb, 0xc1, 0xfe, 0x6b,  \
-    0xe2, 0x63, 0x78, 0x95, 0x6e, 0xe0, 0x2d, 0xd7, 0xa7, 0x37, 0xa8         \
-}
+/* BEGIN FILE binary macro TEST_SRV_CRT_RSA_SHA1_DER
+ * tests/data_files/server2.crt.der */
+#define TEST_SRV_CRT_RSA_SHA1_DER                                             \
+    {                                                                         \
+        0x30, 0x82, 0x03, 0x37, 0x30, 0x82, 0x02, 0x1f, 0xa0, 0x03, 0x02,     \
+            0x01, 0x02, 0x02, 0x01, 0x02, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, \
+            0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x3b, \
+            0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, \
+            0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, \
+            0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x31, \
+            0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x10, 0x50, \
+            0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x20, 0x54, 0x65, 0x73, \
+            0x74, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x31, 0x30, \
+            0x32, 0x31, 0x32, 0x31, 0x34, 0x34, 0x34, 0x30, 0x36, 0x5a, 0x17, \
+            0x0d, 0x32, 0x31, 0x30, 0x32, 0x31, 0x32, 0x31, 0x34, 0x34, 0x34, \
+            0x30, 0x36, 0x5a, 0x30, 0x34, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \
+            0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, \
+            0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, \
+            0x72, 0x53, 0x53, 0x4c, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, \
+            0x04, 0x03, 0x0c, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, \
+            0x73, 0x74, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, \
+            0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, \
+            0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, \
+            0x01, 0x00, 0xc1, 0x4d, 0xa3, 0xdd, 0xe7, 0xcd, 0x1d, 0xd1, 0x04, \
+            0xd7, 0x49, 0x72, 0xb8, 0x99, 0xac, 0x0e, 0x78, 0xe4, 0x3a, 0x3c, \
+            0x4a, 0xcf, 0x3a, 0x13, 0x16, 0xd0, 0x5a, 0xe4, 0xcd, 0xa3, 0x00, \
+            0x88, 0xa7, 0xee, 0x1e, 0x6b, 0x96, 0xa7, 0x52, 0xb4, 0x90, 0xef, \
+            0x2d, 0x72, 0x7a, 0x3e, 0x24, 0x9a, 0xfc, 0xb6, 0x34, 0xac, 0x24, \
+            0xf5, 0x77, 0xe0, 0x26, 0x64, 0x8c, 0x9c, 0xb0, 0x28, 0x7d, 0xa1, \
+            0xda, 0xea, 0x8c, 0xe6, 0xc9, 0x1c, 0x96, 0xbc, 0xfe, 0xc1, 0x04, \
+            0x52, 0xb3, 0x36, 0xd4, 0xa3, 0xfa, 0xe1, 0xb1, 0x76, 0xd8, 0x90, \
+            0xc1, 0x61, 0xb4, 0x66, 0x52, 0x36, 0xa2, 0x26, 0x53, 0xaa, 0xab, \
+            0x74, 0x5e, 0x07, 0x7d, 0x19, 0x82, 0xdb, 0x2a, 0xd8, 0x1f, 0xa0, \
+            0xd9, 0x0d, 0x1c, 0x2d, 0x49, 0x66, 0xf7, 0x5b, 0x25, 0x73, 0x46, \
+            0xe8, 0x0b, 0x8a, 0x4f, 0x69, 0x0c, 0xb5, 0x00, 0x90, 0xe1, 0xda, \
+            0x82, 0x10, 0x66, 0x7d, 0xae, 0x54, 0x2b, 0x8b, 0x65, 0x79, 0x91, \
+            0xa1, 0xe2, 0x61, 0xc3, 0xcd, 0x40, 0x49, 0x08, 0xee, 0x68, 0x0c, \
+            0xf1, 0x8b, 0x86, 0xd2, 0x46, 0xbf, 0xd0, 0xb8, 0xaa, 0x11, 0x03, \
+            0x1e, 0x7f, 0x56, 0xa8, 0x1a, 0x1e, 0x44, 0x18, 0x0f, 0x0f, 0x85, \
+            0x8b, 0xda, 0x8b, 0x44, 0x5e, 0xe2, 0x18, 0xc6, 0x62, 0x2f, 0xc7, \
+            0x66, 0x8d, 0xfa, 0x5d, 0xd8, 0x7d, 0xf3, 0x27, 0x89, 0x29, 0x01, \
+            0xc5, 0x90, 0x0e, 0x3f, 0x27, 0xf1, 0x30, 0xc8, 0x4a, 0x0e, 0xef, \
+            0xd6, 0xde, 0xc7, 0xc7, 0x27, 0x6b, 0xc7, 0x05, 0x3d, 0x7a, 0xc4, \
+            0x02, 0x3c, 0x9a, 0x1d, 0x3e, 0x0f, 0xe8, 0x34, 0x98, 0x5b, 0xcb, \
+            0x73, 0x4b, 0x52, 0x96, 0xd8, 0x11, 0xa2, 0x2c, 0x80, 0x88, 0x69, \
+            0x39, 0x5a, 0xd3, 0x0f, 0xb0, 0xde, 0x59, 0x2f, 0x11, 0xc7, 0xf7, \
+            0xea, 0x12, 0x01, 0x30, 0x97, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, \
+            0x4d, 0x30, 0x4b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, \
+            0x02, 0x30, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, \
+            0x16, 0x04, 0x14, 0xa5, 0x05, 0xe8, 0x64, 0xb8, 0xdc, 0xdf, 0x60, \
+            0x0f, 0x50, 0x12, 0x4d, 0x60, 0xa8, 0x64, 0xaf, 0x4d, 0x8b, 0x43, \
+            0x93, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, \
+            0x16, 0x80, 0x14, 0xb4, 0x5a, 0xe4, 0xa5, 0xb3, 0xde, 0xd2, 0x52, \
+            0xf6, 0xb9, 0xd5, 0xa6, 0x95, 0x0f, 0xeb, 0x3e, 0xbc, 0xc7, 0xfd, \
+            0xff, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, \
+            0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x01, \
+            0x73, 0x0b, 0x4a, 0xc5, 0xcb, 0xa0, 0xde, 0xf1, 0x63, 0x1c, 0x76, \
+            0x04, 0x2b, 0x13, 0x0d, 0xc0, 0x84, 0x11, 0xc5, 0x8f, 0x3a, 0xa7, \
+            0xc5, 0x9c, 0x35, 0x7a, 0x77, 0xb8, 0x20, 0x14, 0x82, 0xee, 0x54, \
+            0xf0, 0xf2, 0xb0, 0x52, 0xcb, 0x78, 0xce, 0x59, 0x07, 0x4f, 0x51, \
+            0x69, 0xfe, 0xd3, 0x2f, 0xe9, 0x09, 0xe7, 0x85, 0x92, 0xd8, 0xba, \
+            0xb1, 0xeb, 0xc5, 0x76, 0x5d, 0x61, 0x2d, 0xe9, 0x86, 0xb5, 0xde, \
+            0x2a, 0xf9, 0x3f, 0x53, 0x28, 0x42, 0x86, 0x83, 0x73, 0x43, 0xe0, \
+            0x04, 0x5f, 0x07, 0x90, 0x14, 0x65, 0x9f, 0x6e, 0x10, 0x7a, 0xbc, \
+            0x58, 0x19, 0x22, 0xc2, 0xeb, 0x39, 0x72, 0x51, 0x92, 0xd7, 0xb4, \
+            0x1d, 0x75, 0x2f, 0xd3, 0x3a, 0x2b, 0x01, 0xe7, 0xdb, 0x50, 0xae, \
+            0xe2, 0xf1, 0xd4, 0x4d, 0x5b, 0x3c, 0xbb, 0x41, 0x2b, 0x2a, 0xa4, \
+            0xe2, 0x4a, 0x02, 0xe5, 0x60, 0x14, 0x2c, 0x9c, 0x1f, 0xa6, 0xcc, \
+            0x06, 0x4b, 0x25, 0x89, 0x4e, 0x96, 0x30, 0x22, 0x9c, 0x5c, 0x58, \
+            0x4d, 0xc3, 0xda, 0xd0, 0x6e, 0x50, 0x1e, 0x8c, 0x65, 0xf5, 0xd9, \
+            0x17, 0x35, 0xa6, 0x58, 0x43, 0xb2, 0x29, 0xb7, 0xa8, 0x5e, 0x35, \
+            0xde, 0xf0, 0x60, 0x42, 0x1a, 0x01, 0xcb, 0xcb, 0x0b, 0xd8, 0x0e, \
+            0xc1, 0x90, 0xdf, 0xa1, 0xd2, 0x1a, 0xd1, 0x2c, 0x02, 0xf4, 0x76, \
+            0x41, 0xa4, 0xcb, 0x4b, 0x15, 0x98, 0x71, 0xf9, 0x35, 0x7d, 0xb0, \
+            0xe7, 0xe2, 0x34, 0x96, 0x91, 0xbe, 0x32, 0x67, 0x2d, 0x6b, 0xd3, \
+            0x55, 0x04, 0x8a, 0x01, 0x50, 0xb4, 0xe3, 0x62, 0x78, 0x6c, 0x11, \
+            0x15, 0xa5, 0x2a, 0x11, 0xc1, 0x49, 0x1c, 0x9b, 0xc4, 0x10, 0x65, \
+            0x60, 0x87, 0xd9, 0x1e, 0x69, 0x59, 0x4e, 0x8f, 0x6b, 0xeb, 0xc1, \
+            0xfe, 0x6b, 0xe2, 0x63, 0x78, 0x95, 0x6e, 0xe0, 0x2d, 0xd7, 0xa7, \
+            0x37, 0xa8                                                        \
+    }
 /* END FILE */
 
 /* This is taken from tests/data_files/server2.key. */
@@ -828,109 +898,120 @@
 /* END FILE */
 
 /* This was generated from tests/data_files/server2.key.der using `xxd -i`. */
-/* BEGIN FILE binary macro TEST_SRV_KEY_RSA_DER tests/data_files/server2.key.der */
-#define TEST_SRV_KEY_RSA_DER {                                               \
-    0x30, 0x82, 0x04, 0xa4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00,  \
-    0xc1, 0x4d, 0xa3, 0xdd, 0xe7, 0xcd, 0x1d, 0xd1, 0x04, 0xd7, 0x49, 0x72,  \
-    0xb8, 0x99, 0xac, 0x0e, 0x78, 0xe4, 0x3a, 0x3c, 0x4a, 0xcf, 0x3a, 0x13,  \
-    0x16, 0xd0, 0x5a, 0xe4, 0xcd, 0xa3, 0x00, 0x88, 0xa7, 0xee, 0x1e, 0x6b,  \
-    0x96, 0xa7, 0x52, 0xb4, 0x90, 0xef, 0x2d, 0x72, 0x7a, 0x3e, 0x24, 0x9a,  \
-    0xfc, 0xb6, 0x34, 0xac, 0x24, 0xf5, 0x77, 0xe0, 0x26, 0x64, 0x8c, 0x9c,  \
-    0xb0, 0x28, 0x7d, 0xa1, 0xda, 0xea, 0x8c, 0xe6, 0xc9, 0x1c, 0x96, 0xbc,  \
-    0xfe, 0xc1, 0x04, 0x52, 0xb3, 0x36, 0xd4, 0xa3, 0xfa, 0xe1, 0xb1, 0x76,  \
-    0xd8, 0x90, 0xc1, 0x61, 0xb4, 0x66, 0x52, 0x36, 0xa2, 0x26, 0x53, 0xaa,  \
-    0xab, 0x74, 0x5e, 0x07, 0x7d, 0x19, 0x82, 0xdb, 0x2a, 0xd8, 0x1f, 0xa0,  \
-    0xd9, 0x0d, 0x1c, 0x2d, 0x49, 0x66, 0xf7, 0x5b, 0x25, 0x73, 0x46, 0xe8,  \
-    0x0b, 0x8a, 0x4f, 0x69, 0x0c, 0xb5, 0x00, 0x90, 0xe1, 0xda, 0x82, 0x10,  \
-    0x66, 0x7d, 0xae, 0x54, 0x2b, 0x8b, 0x65, 0x79, 0x91, 0xa1, 0xe2, 0x61,  \
-    0xc3, 0xcd, 0x40, 0x49, 0x08, 0xee, 0x68, 0x0c, 0xf1, 0x8b, 0x86, 0xd2,  \
-    0x46, 0xbf, 0xd0, 0xb8, 0xaa, 0x11, 0x03, 0x1e, 0x7f, 0x56, 0xa8, 0x1a,  \
-    0x1e, 0x44, 0x18, 0x0f, 0x0f, 0x85, 0x8b, 0xda, 0x8b, 0x44, 0x5e, 0xe2,  \
-    0x18, 0xc6, 0x62, 0x2f, 0xc7, 0x66, 0x8d, 0xfa, 0x5d, 0xd8, 0x7d, 0xf3,  \
-    0x27, 0x89, 0x29, 0x01, 0xc5, 0x90, 0x0e, 0x3f, 0x27, 0xf1, 0x30, 0xc8,  \
-    0x4a, 0x0e, 0xef, 0xd6, 0xde, 0xc7, 0xc7, 0x27, 0x6b, 0xc7, 0x05, 0x3d,  \
-    0x7a, 0xc4, 0x02, 0x3c, 0x9a, 0x1d, 0x3e, 0x0f, 0xe8, 0x34, 0x98, 0x5b,  \
-    0xcb, 0x73, 0x4b, 0x52, 0x96, 0xd8, 0x11, 0xa2, 0x2c, 0x80, 0x88, 0x69,  \
-    0x39, 0x5a, 0xd3, 0x0f, 0xb0, 0xde, 0x59, 0x2f, 0x11, 0xc7, 0xf7, 0xea,  \
-    0x12, 0x01, 0x30, 0x97, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x82, 0x01,  \
-    0x01, 0x00, 0x97, 0x47, 0x44, 0xbc, 0x10, 0x81, 0xc5, 0x18, 0xe4, 0x59,  \
-    0xfb, 0xe0, 0x2d, 0x3a, 0x0e, 0x9e, 0x10, 0xdc, 0x43, 0xfb, 0x15, 0x6c,  \
-    0xd1, 0xfd, 0x48, 0x78, 0x6c, 0xf9, 0xed, 0x38, 0xe8, 0xdd, 0x09, 0xd7,  \
-    0x5f, 0xb5, 0x41, 0x64, 0xd7, 0x63, 0xfa, 0x9d, 0x44, 0x0a, 0xf8, 0x42,  \
-    0x13, 0xf1, 0xbb, 0x5e, 0x79, 0x20, 0x53, 0x98, 0x4b, 0x65, 0x7f, 0x86,  \
-    0x67, 0x48, 0xe4, 0xcf, 0xfb, 0x6a, 0x24, 0xe2, 0x34, 0xbd, 0x14, 0x9d,  \
-    0x2c, 0x16, 0xe2, 0xa4, 0x79, 0xd6, 0xa2, 0xec, 0x81, 0x43, 0x87, 0xbf,  \
-    0x03, 0x5c, 0x88, 0x25, 0xd9, 0x41, 0xb6, 0xa5, 0xf1, 0x27, 0x52, 0x84,  \
-    0xfe, 0x2b, 0x6e, 0x1d, 0x16, 0xcd, 0x73, 0x88, 0xf8, 0x90, 0xbf, 0x19,  \
-    0xfe, 0xbe, 0xa9, 0xbf, 0x09, 0xd3, 0x23, 0x43, 0xd2, 0xc7, 0x61, 0x2a,  \
-    0xb3, 0x4e, 0x3c, 0x61, 0xd4, 0xbd, 0xd8, 0xb4, 0xfa, 0xa8, 0x0b, 0xf8,  \
-    0x7e, 0x56, 0xcd, 0x0f, 0x13, 0x27, 0xda, 0xe6, 0x3b, 0xb3, 0x8c, 0x9c,  \
-    0x4b, 0x84, 0x3c, 0xc3, 0x52, 0x57, 0x9c, 0x27, 0x9a, 0x02, 0x76, 0x26,  \
-    0x59, 0x82, 0x39, 0xc3, 0x13, 0xbe, 0x6e, 0xf4, 0x44, 0x2d, 0x1d, 0x8c,  \
-    0x73, 0x3e, 0x43, 0x99, 0x59, 0xcb, 0xf2, 0x34, 0x72, 0x9a, 0x5e, 0xa5,  \
-    0xeb, 0x9f, 0x36, 0x6d, 0x2b, 0xf9, 0xa2, 0xe7, 0xd1, 0x78, 0x52, 0x1b,  \
-    0xc8, 0xf6, 0x5b, 0x41, 0x69, 0x57, 0x81, 0x89, 0xe9, 0xbb, 0xa1, 0xde,  \
-    0x19, 0x37, 0x3b, 0x13, 0x5c, 0xca, 0x61, 0x01, 0x86, 0xff, 0xdf, 0x83,  \
-    0x41, 0x49, 0x7f, 0xd6, 0xf4, 0x2e, 0x08, 0xfa, 0x90, 0xc2, 0x7c, 0xb4,  \
-    0xb5, 0x0a, 0x17, 0xdb, 0x0e, 0x6d, 0x75, 0x8a, 0x5d, 0x31, 0xd5, 0x66,  \
-    0xfb, 0x39, 0x0b, 0xb5, 0xb6, 0xa3, 0xcd, 0xd4, 0xef, 0x88, 0x92, 0x5a,  \
-    0x4d, 0x6c, 0xcb, 0xea, 0x5b, 0x79, 0x02, 0x81, 0x81, 0x00, 0xdf, 0x3a,  \
-    0xf9, 0x25, 0x5e, 0x24, 0x37, 0x26, 0x40, 0x97, 0x2f, 0xe0, 0x4a, 0xba,  \
-    0x52, 0x1b, 0x51, 0xaf, 0x84, 0x06, 0x32, 0x24, 0x0c, 0xcf, 0x44, 0xa8,  \
-    0x77, 0xa7, 0xad, 0xb5, 0x8c, 0x58, 0xcc, 0xc8, 0x31, 0xb7, 0x0d, 0xbc,  \
-    0x08, 0x8a, 0xe0, 0xa6, 0x8c, 0xc2, 0x73, 0xe5, 0x1a, 0x64, 0x92, 0xe8,  \
-    0xed, 0x4c, 0x6f, 0x0b, 0xa6, 0xa7, 0xf3, 0x9a, 0xf5, 0x6f, 0x69, 0xca,  \
-    0x3c, 0x22, 0xd0, 0x15, 0xa8, 0x20, 0x27, 0x41, 0xf8, 0x43, 0x42, 0x7f,  \
-    0xb1, 0x93, 0xa1, 0x04, 0x85, 0xda, 0xa0, 0x1c, 0xd6, 0xc6, 0xf7, 0x8a,  \
-    0x9e, 0xea, 0x5c, 0x78, 0xa7, 0x55, 0xc4, 0x6b, 0x05, 0x8b, 0xc0, 0x83,  \
-    0xcb, 0xce, 0x83, 0x05, 0xf8, 0xb2, 0x16, 0x2b, 0xdf, 0x06, 0x3f, 0xb8,  \
-    0xec, 0x16, 0xda, 0x43, 0x33, 0xc1, 0x8f, 0xb0, 0xb8, 0xac, 0xae, 0xd4,  \
-    0x94, 0xb8, 0xda, 0x6f, 0x6a, 0xc3, 0x02, 0x81, 0x81, 0x00, 0xdd, 0xae,  \
-    0x00, 0xcd, 0xa0, 0x72, 0x1a, 0x05, 0x8a, 0xee, 0x2f, 0xd4, 0x71, 0x4b,  \
-    0xf0, 0x3e, 0xe5, 0xc1, 0xe1, 0x29, 0x8b, 0xa6, 0x67, 0x30, 0x98, 0xe7,  \
-    0x12, 0xef, 0xdd, 0x12, 0x01, 0x90, 0x24, 0x58, 0xf0, 0x76, 0x92, 0xe7,  \
-    0x3d, 0xbb, 0x23, 0xe1, 0xce, 0xf9, 0xa1, 0xd4, 0x38, 0x1b, 0x3f, 0x20,  \
-    0xb3, 0x0f, 0x65, 0x6a, 0x8f, 0x55, 0x57, 0x36, 0xee, 0xb2, 0x84, 0x44,  \
-    0xfc, 0x91, 0x88, 0xe1, 0xa4, 0xdd, 0x3b, 0x4a, 0x40, 0x4d, 0x7c, 0x86,  \
-    0xed, 0xe1, 0xb5, 0x42, 0xef, 0xb9, 0x61, 0xcd, 0x58, 0x19, 0x77, 0x02,  \
-    0xae, 0x58, 0x80, 0xdb, 0x13, 0x3d, 0xc7, 0x1f, 0x9d, 0xed, 0xff, 0xac,  \
-    0x98, 0xfc, 0xcd, 0xf9, 0x62, 0x04, 0x83, 0x91, 0x89, 0x0d, 0x86, 0x43,  \
-    0x8c, 0x0c, 0xc7, 0x1b, 0x90, 0x4d, 0xbe, 0x2f, 0xc5, 0x7c, 0xcd, 0x42,  \
-    0xf5, 0xd3, 0xad, 0x8e, 0xfd, 0x9d, 0x02, 0x81, 0x80, 0x17, 0x4b, 0x79,  \
-    0x2a, 0x6c, 0x1b, 0x8d, 0x61, 0xc1, 0x85, 0xc5, 0x6a, 0x3b, 0x82, 0x1c,  \
-    0x05, 0x5b, 0xcd, 0xdc, 0x12, 0x25, 0x73, 0x5b, 0x9e, 0xd9, 0x84, 0x57,  \
-    0x10, 0x39, 0x71, 0x63, 0x96, 0xf4, 0xaf, 0xc3, 0x78, 0x5d, 0xc7, 0x8c,  \
-    0x80, 0xa9, 0x96, 0xd7, 0xc3, 0x87, 0x02, 0x96, 0x71, 0x7e, 0x5f, 0x2e,  \
-    0x3c, 0x36, 0xae, 0x59, 0x92, 0xd7, 0x3a, 0x09, 0x78, 0xb9, 0xea, 0x6f,  \
-    0xc2, 0x16, 0x42, 0xdc, 0x4b, 0x96, 0xad, 0x2c, 0xb2, 0x20, 0x23, 0x61,  \
-    0x2d, 0x8d, 0xb5, 0x02, 0x1e, 0xe1, 0x6c, 0x81, 0x01, 0x3c, 0x5d, 0xcb,  \
-    0xdd, 0x9b, 0x0e, 0xc0, 0x2f, 0x94, 0x12, 0xb2, 0xfe, 0x75, 0x75, 0x8b,  \
-    0x74, 0x1e, 0x7a, 0x26, 0x0c, 0xb7, 0x81, 0x96, 0x81, 0x79, 0x6e, 0xdb,  \
-    0xbc, 0x3a, 0xc4, 0x9e, 0x87, 0x09, 0x6e, 0xa0, 0xa6, 0xec, 0x8b, 0xa4,  \
-    0x85, 0x71, 0xce, 0x04, 0xaf, 0x02, 0x81, 0x81, 0x00, 0xc2, 0xa7, 0x47,  \
-    0x07, 0x48, 0x6a, 0xc8, 0xd4, 0xb3, 0x20, 0xe1, 0x98, 0xee, 0xff, 0x5a,  \
-    0x6f, 0x30, 0x7a, 0xa5, 0x47, 0x40, 0xdc, 0x16, 0x62, 0x42, 0xf1, 0x2c,  \
-    0xdc, 0xb8, 0xc7, 0x55, 0xde, 0x07, 0x3c, 0x9d, 0xb1, 0xd0, 0xdf, 0x02,  \
-    0x82, 0xb0, 0x48, 0x58, 0xe1, 0x34, 0xab, 0xcf, 0xb4, 0x85, 0x23, 0x26,  \
-    0x78, 0x4f, 0x7a, 0x59, 0x6f, 0xfb, 0x8c, 0x3d, 0xdf, 0x3d, 0x6c, 0x02,  \
-    0x47, 0x9c, 0xe5, 0x5e, 0x49, 0xf1, 0x05, 0x0b, 0x1f, 0xbf, 0x48, 0x0f,  \
-    0xdc, 0x10, 0xb9, 0x3d, 0x1d, 0x10, 0x77, 0x2a, 0x73, 0xf9, 0xdf, 0xbd,  \
-    0xcd, 0xf3, 0x1f, 0xeb, 0x6e, 0x64, 0xca, 0x2b, 0x78, 0x4f, 0xf8, 0x73,  \
-    0xc2, 0x10, 0xef, 0x79, 0x95, 0x33, 0x1e, 0x79, 0x35, 0x09, 0xff, 0x88,  \
-    0x1b, 0xb4, 0x3e, 0x4c, 0xe1, 0x27, 0x2e, 0x75, 0x80, 0x58, 0x11, 0x03,  \
-    0x21, 0x23, 0x96, 0x9a, 0xb5, 0x02, 0x81, 0x80, 0x05, 0x12, 0x64, 0x71,  \
-    0x83, 0x00, 0x1c, 0xfe, 0xef, 0x83, 0xea, 0xdd, 0x2c, 0xc8, 0x2c, 0x00,  \
-    0x62, 0x1e, 0x8f, 0x3a, 0xdb, 0x1c, 0xab, 0xd6, 0x34, 0x8b, 0xd1, 0xb2,  \
-    0x5a, 0x4f, 0x3d, 0x37, 0x38, 0x02, 0xe0, 0xd7, 0x70, 0xc1, 0xb0, 0x47,  \
-    0xe0, 0x08, 0x1a, 0x84, 0xec, 0x48, 0xc5, 0x7c, 0x76, 0x83, 0x12, 0x67,  \
-    0xab, 0x7c, 0x9f, 0x90, 0x97, 0xc8, 0x8f, 0x07, 0xf4, 0xb3, 0x60, 0xf2,  \
-    0x3f, 0x49, 0x18, 0xdb, 0x2e, 0x94, 0x6b, 0x53, 0x9e, 0xa2, 0x63, 0xde,  \
-    0x63, 0xd9, 0xab, 0x21, 0x2e, 0x2d, 0x0a, 0xe0, 0xd0, 0xe8, 0xba, 0xc4,  \
-    0x4c, 0x1e, 0xa5, 0xf5, 0x51, 0xa8, 0xc4, 0x92, 0xf8, 0x7f, 0x21, 0xe7,  \
-    0x65, 0xbf, 0x0b, 0xe6, 0x01, 0xaf, 0x9c, 0x1d, 0x5b, 0x6c, 0x3f, 0x1c,  \
-    0x2f, 0xa6, 0x0f, 0x68, 0x38, 0x8e, 0x85, 0xc4, 0x6c, 0x78, 0x2f, 0x6f,  \
-    0x06, 0x21, 0x2e, 0x56                                                   \
-}
+/* BEGIN FILE binary macro TEST_SRV_KEY_RSA_DER tests/data_files/server2.key.der
+ */
+#define TEST_SRV_KEY_RSA_DER                                                  \
+    {                                                                         \
+        0x30, 0x82, 0x04, 0xa4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01,     \
+            0x00, 0xc1, 0x4d, 0xa3, 0xdd, 0xe7, 0xcd, 0x1d, 0xd1, 0x04, 0xd7, \
+            0x49, 0x72, 0xb8, 0x99, 0xac, 0x0e, 0x78, 0xe4, 0x3a, 0x3c, 0x4a, \
+            0xcf, 0x3a, 0x13, 0x16, 0xd0, 0x5a, 0xe4, 0xcd, 0xa3, 0x00, 0x88, \
+            0xa7, 0xee, 0x1e, 0x6b, 0x96, 0xa7, 0x52, 0xb4, 0x90, 0xef, 0x2d, \
+            0x72, 0x7a, 0x3e, 0x24, 0x9a, 0xfc, 0xb6, 0x34, 0xac, 0x24, 0xf5, \
+            0x77, 0xe0, 0x26, 0x64, 0x8c, 0x9c, 0xb0, 0x28, 0x7d, 0xa1, 0xda, \
+            0xea, 0x8c, 0xe6, 0xc9, 0x1c, 0x96, 0xbc, 0xfe, 0xc1, 0x04, 0x52, \
+            0xb3, 0x36, 0xd4, 0xa3, 0xfa, 0xe1, 0xb1, 0x76, 0xd8, 0x90, 0xc1, \
+            0x61, 0xb4, 0x66, 0x52, 0x36, 0xa2, 0x26, 0x53, 0xaa, 0xab, 0x74, \
+            0x5e, 0x07, 0x7d, 0x19, 0x82, 0xdb, 0x2a, 0xd8, 0x1f, 0xa0, 0xd9, \
+            0x0d, 0x1c, 0x2d, 0x49, 0x66, 0xf7, 0x5b, 0x25, 0x73, 0x46, 0xe8, \
+            0x0b, 0x8a, 0x4f, 0x69, 0x0c, 0xb5, 0x00, 0x90, 0xe1, 0xda, 0x82, \
+            0x10, 0x66, 0x7d, 0xae, 0x54, 0x2b, 0x8b, 0x65, 0x79, 0x91, 0xa1, \
+            0xe2, 0x61, 0xc3, 0xcd, 0x40, 0x49, 0x08, 0xee, 0x68, 0x0c, 0xf1, \
+            0x8b, 0x86, 0xd2, 0x46, 0xbf, 0xd0, 0xb8, 0xaa, 0x11, 0x03, 0x1e, \
+            0x7f, 0x56, 0xa8, 0x1a, 0x1e, 0x44, 0x18, 0x0f, 0x0f, 0x85, 0x8b, \
+            0xda, 0x8b, 0x44, 0x5e, 0xe2, 0x18, 0xc6, 0x62, 0x2f, 0xc7, 0x66, \
+            0x8d, 0xfa, 0x5d, 0xd8, 0x7d, 0xf3, 0x27, 0x89, 0x29, 0x01, 0xc5, \
+            0x90, 0x0e, 0x3f, 0x27, 0xf1, 0x30, 0xc8, 0x4a, 0x0e, 0xef, 0xd6, \
+            0xde, 0xc7, 0xc7, 0x27, 0x6b, 0xc7, 0x05, 0x3d, 0x7a, 0xc4, 0x02, \
+            0x3c, 0x9a, 0x1d, 0x3e, 0x0f, 0xe8, 0x34, 0x98, 0x5b, 0xcb, 0x73, \
+            0x4b, 0x52, 0x96, 0xd8, 0x11, 0xa2, 0x2c, 0x80, 0x88, 0x69, 0x39, \
+            0x5a, 0xd3, 0x0f, 0xb0, 0xde, 0x59, 0x2f, 0x11, 0xc7, 0xf7, 0xea, \
+            0x12, 0x01, 0x30, 0x97, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x82, \
+            0x01, 0x01, 0x00, 0x97, 0x47, 0x44, 0xbc, 0x10, 0x81, 0xc5, 0x18, \
+            0xe4, 0x59, 0xfb, 0xe0, 0x2d, 0x3a, 0x0e, 0x9e, 0x10, 0xdc, 0x43, \
+            0xfb, 0x15, 0x6c, 0xd1, 0xfd, 0x48, 0x78, 0x6c, 0xf9, 0xed, 0x38, \
+            0xe8, 0xdd, 0x09, 0xd7, 0x5f, 0xb5, 0x41, 0x64, 0xd7, 0x63, 0xfa, \
+            0x9d, 0x44, 0x0a, 0xf8, 0x42, 0x13, 0xf1, 0xbb, 0x5e, 0x79, 0x20, \
+            0x53, 0x98, 0x4b, 0x65, 0x7f, 0x86, 0x67, 0x48, 0xe4, 0xcf, 0xfb, \
+            0x6a, 0x24, 0xe2, 0x34, 0xbd, 0x14, 0x9d, 0x2c, 0x16, 0xe2, 0xa4, \
+            0x79, 0xd6, 0xa2, 0xec, 0x81, 0x43, 0x87, 0xbf, 0x03, 0x5c, 0x88, \
+            0x25, 0xd9, 0x41, 0xb6, 0xa5, 0xf1, 0x27, 0x52, 0x84, 0xfe, 0x2b, \
+            0x6e, 0x1d, 0x16, 0xcd, 0x73, 0x88, 0xf8, 0x90, 0xbf, 0x19, 0xfe, \
+            0xbe, 0xa9, 0xbf, 0x09, 0xd3, 0x23, 0x43, 0xd2, 0xc7, 0x61, 0x2a, \
+            0xb3, 0x4e, 0x3c, 0x61, 0xd4, 0xbd, 0xd8, 0xb4, 0xfa, 0xa8, 0x0b, \
+            0xf8, 0x7e, 0x56, 0xcd, 0x0f, 0x13, 0x27, 0xda, 0xe6, 0x3b, 0xb3, \
+            0x8c, 0x9c, 0x4b, 0x84, 0x3c, 0xc3, 0x52, 0x57, 0x9c, 0x27, 0x9a, \
+            0x02, 0x76, 0x26, 0x59, 0x82, 0x39, 0xc3, 0x13, 0xbe, 0x6e, 0xf4, \
+            0x44, 0x2d, 0x1d, 0x8c, 0x73, 0x3e, 0x43, 0x99, 0x59, 0xcb, 0xf2, \
+            0x34, 0x72, 0x9a, 0x5e, 0xa5, 0xeb, 0x9f, 0x36, 0x6d, 0x2b, 0xf9, \
+            0xa2, 0xe7, 0xd1, 0x78, 0x52, 0x1b, 0xc8, 0xf6, 0x5b, 0x41, 0x69, \
+            0x57, 0x81, 0x89, 0xe9, 0xbb, 0xa1, 0xde, 0x19, 0x37, 0x3b, 0x13, \
+            0x5c, 0xca, 0x61, 0x01, 0x86, 0xff, 0xdf, 0x83, 0x41, 0x49, 0x7f, \
+            0xd6, 0xf4, 0x2e, 0x08, 0xfa, 0x90, 0xc2, 0x7c, 0xb4, 0xb5, 0x0a, \
+            0x17, 0xdb, 0x0e, 0x6d, 0x75, 0x8a, 0x5d, 0x31, 0xd5, 0x66, 0xfb, \
+            0x39, 0x0b, 0xb5, 0xb6, 0xa3, 0xcd, 0xd4, 0xef, 0x88, 0x92, 0x5a, \
+            0x4d, 0x6c, 0xcb, 0xea, 0x5b, 0x79, 0x02, 0x81, 0x81, 0x00, 0xdf, \
+            0x3a, 0xf9, 0x25, 0x5e, 0x24, 0x37, 0x26, 0x40, 0x97, 0x2f, 0xe0, \
+            0x4a, 0xba, 0x52, 0x1b, 0x51, 0xaf, 0x84, 0x06, 0x32, 0x24, 0x0c, \
+            0xcf, 0x44, 0xa8, 0x77, 0xa7, 0xad, 0xb5, 0x8c, 0x58, 0xcc, 0xc8, \
+            0x31, 0xb7, 0x0d, 0xbc, 0x08, 0x8a, 0xe0, 0xa6, 0x8c, 0xc2, 0x73, \
+            0xe5, 0x1a, 0x64, 0x92, 0xe8, 0xed, 0x4c, 0x6f, 0x0b, 0xa6, 0xa7, \
+            0xf3, 0x9a, 0xf5, 0x6f, 0x69, 0xca, 0x3c, 0x22, 0xd0, 0x15, 0xa8, \
+            0x20, 0x27, 0x41, 0xf8, 0x43, 0x42, 0x7f, 0xb1, 0x93, 0xa1, 0x04, \
+            0x85, 0xda, 0xa0, 0x1c, 0xd6, 0xc6, 0xf7, 0x8a, 0x9e, 0xea, 0x5c, \
+            0x78, 0xa7, 0x55, 0xc4, 0x6b, 0x05, 0x8b, 0xc0, 0x83, 0xcb, 0xce, \
+            0x83, 0x05, 0xf8, 0xb2, 0x16, 0x2b, 0xdf, 0x06, 0x3f, 0xb8, 0xec, \
+            0x16, 0xda, 0x43, 0x33, 0xc1, 0x8f, 0xb0, 0xb8, 0xac, 0xae, 0xd4, \
+            0x94, 0xb8, 0xda, 0x6f, 0x6a, 0xc3, 0x02, 0x81, 0x81, 0x00, 0xdd, \
+            0xae, 0x00, 0xcd, 0xa0, 0x72, 0x1a, 0x05, 0x8a, 0xee, 0x2f, 0xd4, \
+            0x71, 0x4b, 0xf0, 0x3e, 0xe5, 0xc1, 0xe1, 0x29, 0x8b, 0xa6, 0x67, \
+            0x30, 0x98, 0xe7, 0x12, 0xef, 0xdd, 0x12, 0x01, 0x90, 0x24, 0x58, \
+            0xf0, 0x76, 0x92, 0xe7, 0x3d, 0xbb, 0x23, 0xe1, 0xce, 0xf9, 0xa1, \
+            0xd4, 0x38, 0x1b, 0x3f, 0x20, 0xb3, 0x0f, 0x65, 0x6a, 0x8f, 0x55, \
+            0x57, 0x36, 0xee, 0xb2, 0x84, 0x44, 0xfc, 0x91, 0x88, 0xe1, 0xa4, \
+            0xdd, 0x3b, 0x4a, 0x40, 0x4d, 0x7c, 0x86, 0xed, 0xe1, 0xb5, 0x42, \
+            0xef, 0xb9, 0x61, 0xcd, 0x58, 0x19, 0x77, 0x02, 0xae, 0x58, 0x80, \
+            0xdb, 0x13, 0x3d, 0xc7, 0x1f, 0x9d, 0xed, 0xff, 0xac, 0x98, 0xfc, \
+            0xcd, 0xf9, 0x62, 0x04, 0x83, 0x91, 0x89, 0x0d, 0x86, 0x43, 0x8c, \
+            0x0c, 0xc7, 0x1b, 0x90, 0x4d, 0xbe, 0x2f, 0xc5, 0x7c, 0xcd, 0x42, \
+            0xf5, 0xd3, 0xad, 0x8e, 0xfd, 0x9d, 0x02, 0x81, 0x80, 0x17, 0x4b, \
+            0x79, 0x2a, 0x6c, 0x1b, 0x8d, 0x61, 0xc1, 0x85, 0xc5, 0x6a, 0x3b, \
+            0x82, 0x1c, 0x05, 0x5b, 0xcd, 0xdc, 0x12, 0x25, 0x73, 0x5b, 0x9e, \
+            0xd9, 0x84, 0x57, 0x10, 0x39, 0x71, 0x63, 0x96, 0xf4, 0xaf, 0xc3, \
+            0x78, 0x5d, 0xc7, 0x8c, 0x80, 0xa9, 0x96, 0xd7, 0xc3, 0x87, 0x02, \
+            0x96, 0x71, 0x7e, 0x5f, 0x2e, 0x3c, 0x36, 0xae, 0x59, 0x92, 0xd7, \
+            0x3a, 0x09, 0x78, 0xb9, 0xea, 0x6f, 0xc2, 0x16, 0x42, 0xdc, 0x4b, \
+            0x96, 0xad, 0x2c, 0xb2, 0x20, 0x23, 0x61, 0x2d, 0x8d, 0xb5, 0x02, \
+            0x1e, 0xe1, 0x6c, 0x81, 0x01, 0x3c, 0x5d, 0xcb, 0xdd, 0x9b, 0x0e, \
+            0xc0, 0x2f, 0x94, 0x12, 0xb2, 0xfe, 0x75, 0x75, 0x8b, 0x74, 0x1e, \
+            0x7a, 0x26, 0x0c, 0xb7, 0x81, 0x96, 0x81, 0x79, 0x6e, 0xdb, 0xbc, \
+            0x3a, 0xc4, 0x9e, 0x87, 0x09, 0x6e, 0xa0, 0xa6, 0xec, 0x8b, 0xa4, \
+            0x85, 0x71, 0xce, 0x04, 0xaf, 0x02, 0x81, 0x81, 0x00, 0xc2, 0xa7, \
+            0x47, 0x07, 0x48, 0x6a, 0xc8, 0xd4, 0xb3, 0x20, 0xe1, 0x98, 0xee, \
+            0xff, 0x5a, 0x6f, 0x30, 0x7a, 0xa5, 0x47, 0x40, 0xdc, 0x16, 0x62, \
+            0x42, 0xf1, 0x2c, 0xdc, 0xb8, 0xc7, 0x55, 0xde, 0x07, 0x3c, 0x9d, \
+            0xb1, 0xd0, 0xdf, 0x02, 0x82, 0xb0, 0x48, 0x58, 0xe1, 0x34, 0xab, \
+            0xcf, 0xb4, 0x85, 0x23, 0x26, 0x78, 0x4f, 0x7a, 0x59, 0x6f, 0xfb, \
+            0x8c, 0x3d, 0xdf, 0x3d, 0x6c, 0x02, 0x47, 0x9c, 0xe5, 0x5e, 0x49, \
+            0xf1, 0x05, 0x0b, 0x1f, 0xbf, 0x48, 0x0f, 0xdc, 0x10, 0xb9, 0x3d, \
+            0x1d, 0x10, 0x77, 0x2a, 0x73, 0xf9, 0xdf, 0xbd, 0xcd, 0xf3, 0x1f, \
+            0xeb, 0x6e, 0x64, 0xca, 0x2b, 0x78, 0x4f, 0xf8, 0x73, 0xc2, 0x10, \
+            0xef, 0x79, 0x95, 0x33, 0x1e, 0x79, 0x35, 0x09, 0xff, 0x88, 0x1b, \
+            0xb4, 0x3e, 0x4c, 0xe1, 0x27, 0x2e, 0x75, 0x80, 0x58, 0x11, 0x03, \
+            0x21, 0x23, 0x96, 0x9a, 0xb5, 0x02, 0x81, 0x80, 0x05, 0x12, 0x64, \
+            0x71, 0x83, 0x00, 0x1c, 0xfe, 0xef, 0x83, 0xea, 0xdd, 0x2c, 0xc8, \
+            0x2c, 0x00, 0x62, 0x1e, 0x8f, 0x3a, 0xdb, 0x1c, 0xab, 0xd6, 0x34, \
+            0x8b, 0xd1, 0xb2, 0x5a, 0x4f, 0x3d, 0x37, 0x38, 0x02, 0xe0, 0xd7, \
+            0x70, 0xc1, 0xb0, 0x47, 0xe0, 0x08, 0x1a, 0x84, 0xec, 0x48, 0xc5, \
+            0x7c, 0x76, 0x83, 0x12, 0x67, 0xab, 0x7c, 0x9f, 0x90, 0x97, 0xc8, \
+            0x8f, 0x07, 0xf4, 0xb3, 0x60, 0xf2, 0x3f, 0x49, 0x18, 0xdb, 0x2e, \
+            0x94, 0x6b, 0x53, 0x9e, 0xa2, 0x63, 0xde, 0x63, 0xd9, 0xab, 0x21, \
+            0x2e, 0x2d, 0x0a, 0xe0, 0xd0, 0xe8, 0xba, 0xc4, 0x4c, 0x1e, 0xa5, \
+            0xf5, 0x51, 0xa8, 0xc4, 0x92, 0xf8, 0x7f, 0x21, 0xe7, 0x65, 0xbf, \
+            0x0b, 0xe6, 0x01, 0xaf, 0x9c, 0x1d, 0x5b, 0x6c, 0x3f, 0x1c, 0x2f, \
+            0xa6, 0x0f, 0x68, 0x38, 0x8e, 0x85, 0xc4, 0x6c, 0x78, 0x2f, 0x6f, \
+            0x06, 0x21, 0x2e, 0x56                                            \
+    }
 /* END FILE */
 
 /*
@@ -960,55 +1041,59 @@
     "IwQYMBaAFJ1tICRJAT8ry3i1Gbx+JMnb+zZ8MAwGCCqGSM49BAMCBQADaAAwZQIx\r\n" \
     "AMqme4DKMldUlplDET9Q6Eptre7uUWKhsLOF+zPkKDlfzpIkJYEFgcloDHGYw80u\r\n" \
     "IgIwNftyPXsabTqMM7iEHgVpX/GRozKklY9yQI/5eoA6gGW7Y+imuGR/oao5ySOb\r\n" \
-    "a9Vk\r\n"       \
+    "a9Vk\r\n"                                                             \
     "-----END CERTIFICATE-----\r\n"
 /* END FILE */
 
 /* This is generated from tests/data_files/cli2.crt.der using `xxd -i`. */
 /* BEGIN FILE binary macro TEST_CLI_CRT_EC_DER tests/data_files/cli2.crt.der */
-#define TEST_CLI_CRT_EC_DER {                                                \
-    0x30, 0x82, 0x01, 0xdf, 0x30, 0x82, 0x01, 0x63, 0xa0, 0x03, 0x02, 0x01,  \
-    0x02, 0x02, 0x01, 0x0d, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce,  \
-    0x3d, 0x04, 0x03, 0x02, 0x05, 0x00, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09,  \
-    0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30,  \
-    0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61,  \
-    0x72, 0x53, 0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04,  \
-    0x03, 0x0c, 0x13, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x20,  \
-    0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x1e,  \
-    0x17, 0x0d, 0x31, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34,  \
-    0x30, 0x30, 0x5a, 0x17, 0x0d, 0x32, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31,  \
-    0x34, 0x34, 0x34, 0x30, 0x30, 0x5a, 0x30, 0x41, 0x31, 0x0b, 0x30, 0x09,  \
-    0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30,  \
-    0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61,  \
-    0x72, 0x53, 0x53, 0x4c, 0x31, 0x1f, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x04,  \
-    0x03, 0x0c, 0x16, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x20,  \
-    0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x20,  \
-    0x32, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d,  \
-    0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07,  \
-    0x03, 0x42, 0x00, 0x04, 0x57, 0xe5, 0xae, 0xb1, 0x73, 0xdf, 0xd3, 0xac,  \
-    0xbb, 0x93, 0xb8, 0x81, 0xff, 0x12, 0xae, 0xee, 0xe6, 0x53, 0xac, 0xce,  \
-    0x55, 0x53, 0xf6, 0x34, 0x0e, 0xcc, 0x2e, 0xe3, 0x63, 0x25, 0x0b, 0xdf,  \
-    0x98, 0xe2, 0xf3, 0x5c, 0x60, 0x36, 0x96, 0xc0, 0xd5, 0x18, 0x14, 0x70,  \
-    0xe5, 0x7f, 0x9f, 0xd5, 0x4b, 0x45, 0x18, 0xe5, 0xb0, 0x6c, 0xd5, 0x5c,  \
-    0xf8, 0x96, 0x8f, 0x87, 0x70, 0xa3, 0xe4, 0xc7, 0xa3, 0x4d, 0x30, 0x4b,  \
-    0x30, 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30,  \
-    0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x7a, 0x00,  \
-    0x5f, 0x86, 0x64, 0xfc, 0xe0, 0x5d, 0xe5, 0x11, 0x10, 0x3b, 0xb2, 0xe6,  \
-    0x3b, 0xc4, 0x26, 0x3f, 0xcf, 0xe2, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d,  \
-    0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x9d, 0x6d, 0x20, 0x24, 0x49,  \
-    0x01, 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, 0x7e, 0x24, 0xc9, 0xdb,  \
-    0xfb, 0x36, 0x7c, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,  \
-    0x04, 0x03, 0x02, 0x05, 0x00, 0x03, 0x68, 0x00, 0x30, 0x65, 0x02, 0x31,  \
-    0x00, 0xca, 0xa6, 0x7b, 0x80, 0xca, 0x32, 0x57, 0x54, 0x96, 0x99, 0x43,  \
-    0x11, 0x3f, 0x50, 0xe8, 0x4a, 0x6d, 0xad, 0xee, 0xee, 0x51, 0x62, 0xa1,  \
-    0xb0, 0xb3, 0x85, 0xfb, 0x33, 0xe4, 0x28, 0x39, 0x5f, 0xce, 0x92, 0x24,  \
-    0x25, 0x81, 0x05, 0x81, 0xc9, 0x68, 0x0c, 0x71, 0x98, 0xc3, 0xcd, 0x2e,  \
-    0x22, 0x02, 0x30, 0x35, 0xfb, 0x72, 0x3d, 0x7b, 0x1a, 0x6d, 0x3a, 0x8c,  \
-    0x33, 0xb8, 0x84, 0x1e, 0x05, 0x69, 0x5f, 0xf1, 0x91, 0xa3, 0x32, 0xa4,  \
-    0x95, 0x8f, 0x72, 0x40, 0x8f, 0xf9, 0x7a, 0x80, 0x3a, 0x80, 0x65, 0xbb,  \
-    0x63, 0xe8, 0xa6, 0xb8, 0x64, 0x7f, 0xa1, 0xaa, 0x39, 0xc9, 0x23, 0x9b,  \
-    0x6b, 0xd5, 0x64                           \
-}
+#define TEST_CLI_CRT_EC_DER                                                   \
+    {                                                                         \
+        0x30, 0x82, 0x01, 0xdf, 0x30, 0x82, 0x01, 0x63, 0xa0, 0x03, 0x02,     \
+            0x01, 0x02, 0x02, 0x01, 0x0d, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, \
+            0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x05, 0x00, 0x30, 0x3e, 0x31, \
+            0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, \
+            0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, \
+            0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x31, 0x1c, \
+            0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x13, 0x50, 0x6f, \
+            0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x20, 0x54, 0x65, 0x73, 0x74, \
+            0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, \
+            0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, 0x30, \
+            0x5a, 0x17, 0x0d, 0x32, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, \
+            0x34, 0x34, 0x30, 0x30, 0x5a, 0x30, 0x41, 0x31, 0x0b, 0x30, 0x09, \
+            0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, \
+            0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, \
+            0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x31, 0x1f, 0x30, 0x1d, 0x06, \
+            0x03, 0x55, 0x04, 0x03, 0x0c, 0x16, 0x50, 0x6f, 0x6c, 0x61, 0x72, \
+            0x53, 0x53, 0x4c, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x6c, \
+            0x69, 0x65, 0x6e, 0x74, 0x20, 0x32, 0x30, 0x59, 0x30, 0x13, 0x06, \
+            0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, \
+            0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, \
+            0x57, 0xe5, 0xae, 0xb1, 0x73, 0xdf, 0xd3, 0xac, 0xbb, 0x93, 0xb8, \
+            0x81, 0xff, 0x12, 0xae, 0xee, 0xe6, 0x53, 0xac, 0xce, 0x55, 0x53, \
+            0xf6, 0x34, 0x0e, 0xcc, 0x2e, 0xe3, 0x63, 0x25, 0x0b, 0xdf, 0x98, \
+            0xe2, 0xf3, 0x5c, 0x60, 0x36, 0x96, 0xc0, 0xd5, 0x18, 0x14, 0x70, \
+            0xe5, 0x7f, 0x9f, 0xd5, 0x4b, 0x45, 0x18, 0xe5, 0xb0, 0x6c, 0xd5, \
+            0x5c, 0xf8, 0x96, 0x8f, 0x87, 0x70, 0xa3, 0xe4, 0xc7, 0xa3, 0x4d, \
+            0x30, 0x4b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, \
+            0x30, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, \
+            0x04, 0x14, 0x7a, 0x00, 0x5f, 0x86, 0x64, 0xfc, 0xe0, 0x5d, 0xe5, \
+            0x11, 0x10, 0x3b, 0xb2, 0xe6, 0x3b, 0xc4, 0x26, 0x3f, 0xcf, 0xe2, \
+            0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, \
+            0x80, 0x14, 0x9d, 0x6d, 0x20, 0x24, 0x49, 0x01, 0x3f, 0x2b, 0xcb, \
+            0x78, 0xb5, 0x19, 0xbc, 0x7e, 0x24, 0xc9, 0xdb, 0xfb, 0x36, 0x7c, \
+            0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, \
+            0x02, 0x05, 0x00, 0x03, 0x68, 0x00, 0x30, 0x65, 0x02, 0x31, 0x00, \
+            0xca, 0xa6, 0x7b, 0x80, 0xca, 0x32, 0x57, 0x54, 0x96, 0x99, 0x43, \
+            0x11, 0x3f, 0x50, 0xe8, 0x4a, 0x6d, 0xad, 0xee, 0xee, 0x51, 0x62, \
+            0xa1, 0xb0, 0xb3, 0x85, 0xfb, 0x33, 0xe4, 0x28, 0x39, 0x5f, 0xce, \
+            0x92, 0x24, 0x25, 0x81, 0x05, 0x81, 0xc9, 0x68, 0x0c, 0x71, 0x98, \
+            0xc3, 0xcd, 0x2e, 0x22, 0x02, 0x30, 0x35, 0xfb, 0x72, 0x3d, 0x7b, \
+            0x1a, 0x6d, 0x3a, 0x8c, 0x33, 0xb8, 0x84, 0x1e, 0x05, 0x69, 0x5f, \
+            0xf1, 0x91, 0xa3, 0x32, 0xa4, 0x95, 0x8f, 0x72, 0x40, 0x8f, 0xf9, \
+            0x7a, 0x80, 0x3a, 0x80, 0x65, 0xbb, 0x63, 0xe8, 0xa6, 0xb8, 0x64, \
+            0x7f, 0xa1, 0xaa, 0x39, 0xc9, 0x23, 0x9b, 0x6b, 0xd5, 0x64        \
+    }
 /* END FILE */
 
 /* This is taken from tests/data_files/cli2.key. */
@@ -1023,23 +1108,25 @@
 
 /* This is generated from tests/data_files/cli2.key.der using `xxd -i`. */
 /* BEGIN FILE binary macro TEST_CLI_KEY_EC_DER tests/data_files/cli2.key.der */
-#define TEST_CLI_KEY_EC_DER {                                                \
-    0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0xf6, 0xf7, 0x86, 0x64, 0xf1,  \
-    0x67, 0x7f, 0xe6, 0x64, 0x8d, 0xef, 0xca, 0x4e, 0xe9, 0xdd, 0x4d, 0xf0,  \
-    0x05, 0xff, 0x96, 0x22, 0x8a, 0x7a, 0x84, 0x38, 0x64, 0x17, 0x32, 0x61,  \
-    0x98, 0xb7, 0x2a, 0xa0, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,  \
-    0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x57, 0xe5, 0xae,  \
-    0xb1, 0x73, 0xdf, 0xd3, 0xac, 0xbb, 0x93, 0xb8, 0x81, 0xff, 0x12, 0xae,  \
-    0xee, 0xe6, 0x53, 0xac, 0xce, 0x55, 0x53, 0xf6, 0x34, 0x0e, 0xcc, 0x2e,  \
-    0xe3, 0x63, 0x25, 0x0b, 0xdf, 0x98, 0xe2, 0xf3, 0x5c, 0x60, 0x36, 0x96,  \
-    0xc0, 0xd5, 0x18, 0x14, 0x70, 0xe5, 0x7f, 0x9f, 0xd5, 0x4b, 0x45, 0x18,  \
-    0xe5, 0xb0, 0x6c, 0xd5, 0x5c, 0xf8, 0x96, 0x8f, 0x87, 0x70, 0xa3, 0xe4,  \
-    0xc7                                                                     \
-}
+#define TEST_CLI_KEY_EC_DER                                                   \
+    {                                                                         \
+        0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0xf6, 0xf7, 0x86, 0x64,     \
+            0xf1, 0x67, 0x7f, 0xe6, 0x64, 0x8d, 0xef, 0xca, 0x4e, 0xe9, 0xdd, \
+            0x4d, 0xf0, 0x05, 0xff, 0x96, 0x22, 0x8a, 0x7a, 0x84, 0x38, 0x64, \
+            0x17, 0x32, 0x61, 0x98, 0xb7, 0x2a, 0xa0, 0x0a, 0x06, 0x08, 0x2a, \
+            0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, \
+            0x00, 0x04, 0x57, 0xe5, 0xae, 0xb1, 0x73, 0xdf, 0xd3, 0xac, 0xbb, \
+            0x93, 0xb8, 0x81, 0xff, 0x12, 0xae, 0xee, 0xe6, 0x53, 0xac, 0xce, \
+            0x55, 0x53, 0xf6, 0x34, 0x0e, 0xcc, 0x2e, 0xe3, 0x63, 0x25, 0x0b, \
+            0xdf, 0x98, 0xe2, 0xf3, 0x5c, 0x60, 0x36, 0x96, 0xc0, 0xd5, 0x18, \
+            0x14, 0x70, 0xe5, 0x7f, 0x9f, 0xd5, 0x4b, 0x45, 0x18, 0xe5, 0xb0, \
+            0x6c, 0xd5, 0x5c, 0xf8, 0x96, 0x8f, 0x87, 0x70, 0xa3, 0xe4, 0xc7  \
+    }
 /* END FILE */
 
 /* This is taken from tests/data_files/cli-rsa-sha256.crt. */
-/* BEGIN FILE string macro TEST_CLI_CRT_RSA_PEM tests/data_files/cli-rsa-sha256.crt */
+/* BEGIN FILE string macro TEST_CLI_CRT_RSA_PEM
+ * tests/data_files/cli-rsa-sha256.crt */
 #define TEST_CLI_CRT_RSA_PEM                                               \
     "-----BEGIN CERTIFICATE-----\r\n"                                      \
     "MIIDPzCCAiegAwIBAgIBBDANBgkqhkiG9w0BAQsFADA7MQswCQYDVQQGEwJOTDER\r\n" \
@@ -1065,79 +1152,87 @@
 
 /* This was generated from tests/data_files/cli-rsa-sha256.crt.der
    using `xxd -i.` */
-/* BEGIN FILE binary macro TEST_CLI_CRT_RSA_DER tests/data_files/cli-rsa-sha256.crt.der */
-#define TEST_CLI_CRT_RSA_DER {                                               \
-  0x30, 0x82, 0x03, 0x3f, 0x30, 0x82, 0x02, 0x27, 0xa0, 0x03, 0x02, 0x01,   \
-  0x02, 0x02, 0x01, 0x04, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86,   \
-  0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x3b, 0x31, 0x0b, 0x30,   \
-  0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11,   \
-  0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c,   \
-  0x61, 0x72, 0x53, 0x53, 0x4c, 0x31, 0x19, 0x30, 0x17, 0x06, 0x03, 0x55,   \
-  0x04, 0x03, 0x0c, 0x10, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c,   \
-  0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d,   \
-  0x31, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, 0x36,   \
-  0x5a, 0x17, 0x0d, 0x32, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34,   \
-  0x34, 0x30, 0x36, 0x5a, 0x30, 0x3c, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,   \
-  0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06,   \
-  0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53,   \
-  0x53, 0x4c, 0x31, 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,   \
-  0x11, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x20, 0x43, 0x6c,   \
-  0x69, 0x65, 0x6e, 0x74, 0x20, 0x32, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d,   \
-  0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05,   \
-  0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82,   \
-  0x01, 0x01, 0x00, 0xc8, 0x74, 0xc4, 0xcc, 0xb9, 0xf9, 0xb5, 0x79, 0xe9,   \
-  0x45, 0xd9, 0x14, 0x60, 0xb0, 0x7d, 0xbb, 0x93, 0xf2, 0x6b, 0x1e, 0x9f,   \
-  0x33, 0xad, 0x0d, 0x8f, 0x8a, 0x3c, 0x56, 0x65, 0xe5, 0xdc, 0x44, 0xd9,   \
-  0xcc, 0x66, 0x85, 0x07, 0xd5, 0xf8, 0x27, 0xb0, 0x4a, 0x35, 0xd0, 0x63,   \
-  0x9e, 0x0a, 0x6e, 0x1b, 0xb7, 0xda, 0xf0, 0x7e, 0xab, 0xee, 0x0c, 0x10,   \
-  0x93, 0x86, 0x49, 0x18, 0x34, 0xf3, 0xa8, 0x2a, 0xd2, 0x57, 0xf5, 0x2e,   \
-  0xd4, 0x2f, 0x77, 0x29, 0x84, 0x61, 0x4d, 0x82, 0x50, 0x8f, 0xa7, 0x95,   \
-  0x48, 0x70, 0xf5, 0x6e, 0x4d, 0xb2, 0xd5, 0x13, 0xc3, 0xd2, 0x1a, 0xed,   \
-  0xe6, 0x43, 0xea, 0x42, 0x14, 0xeb, 0x74, 0xea, 0xc0, 0xed, 0x1f, 0xd4,   \
-  0x57, 0x4e, 0xa9, 0xf3, 0xa8, 0xed, 0xd2, 0xe0, 0xc1, 0x30, 0x71, 0x30,   \
-  0x32, 0x30, 0xd5, 0xd3, 0xf6, 0x08, 0xd0, 0x56, 0x4f, 0x46, 0x8e, 0xf2,   \
-  0x5f, 0xf9, 0x3d, 0x67, 0x91, 0x88, 0x30, 0x2e, 0x42, 0xb2, 0xdf, 0x7d,   \
-  0xfb, 0xe5, 0x0c, 0x77, 0xff, 0xec, 0x31, 0xc0, 0x78, 0x8f, 0xbf, 0xc2,   \
-  0x7f, 0xca, 0xad, 0x6c, 0x21, 0xd6, 0x8d, 0xd9, 0x8b, 0x6a, 0x8e, 0x6f,   \
-  0xe0, 0x9b, 0xf8, 0x10, 0x56, 0xcc, 0xb3, 0x8e, 0x13, 0x15, 0xe6, 0x34,   \
-  0x04, 0x66, 0xc7, 0xee, 0xf9, 0x36, 0x0e, 0x6a, 0x95, 0xf6, 0x09, 0x9a,   \
-  0x06, 0x67, 0xf4, 0x65, 0x71, 0xf8, 0xca, 0xa4, 0xb1, 0x25, 0xe0, 0xfe,   \
-  0x3c, 0x8b, 0x35, 0x04, 0x67, 0xba, 0xe0, 0x4f, 0x76, 0x85, 0xfc, 0x7f,   \
-  0xfc, 0x36, 0x6b, 0xb5, 0xe9, 0xcd, 0x2d, 0x03, 0x62, 0x4e, 0xb3, 0x3d,   \
-  0x00, 0xcf, 0xaf, 0x76, 0xa0, 0x69, 0x56, 0x83, 0x6a, 0xd2, 0xa8, 0xd4,   \
-  0xe7, 0x50, 0x71, 0xe6, 0xb5, 0x36, 0x05, 0x77, 0x05, 0x6d, 0x7b, 0xc8,   \
-  0xe4, 0xc4, 0xfd, 0x4c, 0xd5, 0x21, 0x5f, 0x02, 0x03, 0x01, 0x00, 0x01,   \
-  0xa3, 0x4d, 0x30, 0x4b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04,   \
-  0x02, 0x30, 0x00, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16,   \
-  0x04, 0x14, 0x71, 0xa1, 0x00, 0x73, 0x72, 0x40, 0x2f, 0x54, 0x76, 0x5e,   \
-  0x33, 0xfc, 0x52, 0x8f, 0xbc, 0xf1, 0xdd, 0x6b, 0x46, 0x21, 0x30, 0x1f,   \
-  0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xb4,   \
-  0x5a, 0xe4, 0xa5, 0xb3, 0xde, 0xd2, 0x52, 0xf6, 0xb9, 0xd5, 0xa6, 0x95,   \
-  0x0f, 0xeb, 0x3e, 0xbc, 0xc7, 0xfd, 0xff, 0x30, 0x0d, 0x06, 0x09, 0x2a,   \
-  0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x03, 0x82,   \
-  0x01, 0x01, 0x00, 0x5e, 0x27, 0x6f, 0xd5, 0xde, 0x29, 0x2e, 0x50, 0x62,   \
-  0x29, 0x61, 0x03, 0xf7, 0x9a, 0xcc, 0xc9, 0xc0, 0x5d, 0x80, 0x37, 0x20,   \
-  0xc8, 0xda, 0x89, 0xc5, 0xa9, 0x05, 0x91, 0x17, 0xd1, 0xc8, 0x0d, 0xb2,   \
-  0xd6, 0x69, 0x72, 0x4e, 0x7e, 0xee, 0x05, 0x74, 0x64, 0x34, 0xb6, 0x39,   \
-  0x64, 0x5c, 0xca, 0xf3, 0x61, 0x82, 0x8e, 0x4d, 0x90, 0xd8, 0xe0, 0xf8,   \
-  0x45, 0x94, 0x82, 0x3c, 0x02, 0x49, 0xa8, 0xba, 0x47, 0x1d, 0x4d, 0xf8,   \
-  0xb7, 0xbd, 0x5c, 0x89, 0xf7, 0xef, 0xcb, 0x62, 0x8a, 0xf3, 0x56, 0x2f,   \
-  0xaf, 0x17, 0x33, 0x46, 0x13, 0x00, 0x13, 0xae, 0x22, 0xfa, 0xa9, 0xda,   \
-  0xc8, 0xfd, 0xd3, 0x77, 0x65, 0xee, 0x58, 0x94, 0x74, 0xe4, 0xf5, 0x4f,   \
-  0xa1, 0x27, 0xa6, 0xb0, 0xd1, 0x0b, 0xb3, 0xd8, 0x16, 0xb6, 0xd7, 0x67,   \
-  0x63, 0x2d, 0xdc, 0x7b, 0xe1, 0x18, 0xd9, 0x8d, 0x27, 0xed, 0x1b, 0x22,   \
-  0xef, 0xdf, 0x36, 0x11, 0xe2, 0xc8, 0x00, 0x0e, 0xc7, 0xe9, 0xc6, 0xb8,   \
-  0xd8, 0x4b, 0x3f, 0x35, 0x41, 0xff, 0xfc, 0x96, 0x49, 0x4f, 0x7d, 0x8e,   \
-  0x3f, 0x47, 0x68, 0x33, 0x17, 0x83, 0x44, 0x0f, 0xaf, 0xa6, 0x59, 0x0a,   \
-  0xa9, 0x32, 0xcb, 0x59, 0xfe, 0xdd, 0x5f, 0x6e, 0x8b, 0x22, 0xb8, 0x81,   \
-  0x90, 0x16, 0x91, 0x0a, 0x04, 0x79, 0x62, 0xff, 0x4b, 0x04, 0xf1, 0x5c,   \
-  0x34, 0xeb, 0x69, 0xce, 0xef, 0xcb, 0x6e, 0xb6, 0x3b, 0x40, 0x55, 0xca,   \
-  0x24, 0xc2, 0x3e, 0x25, 0x70, 0xee, 0x74, 0x2b, 0x0e, 0x9f, 0xc2, 0x82,   \
-  0x9a, 0x20, 0x38, 0x77, 0xa1, 0x26, 0x8a, 0xca, 0x9f, 0x87, 0x75, 0x77,   \
-  0xe3, 0xce, 0x65, 0xec, 0x71, 0x10, 0x35, 0xcb, 0xcb, 0x4f, 0x19, 0x43,   \
-  0xeb, 0x30, 0xd0, 0xca, 0x2d, 0x3f, 0xca, 0x46, 0x14, 0x61, 0x99, 0x30,   \
-  0x41, 0x32, 0xb5, 0x37, 0x63, 0x6f, 0x97                                  \
-}
+/* BEGIN FILE binary macro TEST_CLI_CRT_RSA_DER
+ * tests/data_files/cli-rsa-sha256.crt.der */
+#define TEST_CLI_CRT_RSA_DER                                                  \
+    {                                                                         \
+        0x30, 0x82, 0x03, 0x3f, 0x30, 0x82, 0x02, 0x27, 0xa0, 0x03, 0x02,     \
+            0x01, 0x02, 0x02, 0x01, 0x04, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, \
+            0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00, 0x30, 0x3b, \
+            0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, \
+            0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, \
+            0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x31, \
+            0x19, 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x10, 0x50, \
+            0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, 0x20, 0x54, 0x65, 0x73, \
+            0x74, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x39, 0x30, \
+            0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, 0x36, 0x5a, 0x17, \
+            0x0d, 0x32, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, \
+            0x30, 0x36, 0x5a, 0x30, 0x3c, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \
+            0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, \
+            0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, \
+            0x72, 0x53, 0x53, 0x4c, 0x31, 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, \
+            0x04, 0x03, 0x0c, 0x11, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, \
+            0x4c, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x32, 0x30, \
+            0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, \
+            0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, \
+            0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xc8, \
+            0x74, 0xc4, 0xcc, 0xb9, 0xf9, 0xb5, 0x79, 0xe9, 0x45, 0xd9, 0x14, \
+            0x60, 0xb0, 0x7d, 0xbb, 0x93, 0xf2, 0x6b, 0x1e, 0x9f, 0x33, 0xad, \
+            0x0d, 0x8f, 0x8a, 0x3c, 0x56, 0x65, 0xe5, 0xdc, 0x44, 0xd9, 0xcc, \
+            0x66, 0x85, 0x07, 0xd5, 0xf8, 0x27, 0xb0, 0x4a, 0x35, 0xd0, 0x63, \
+            0x9e, 0x0a, 0x6e, 0x1b, 0xb7, 0xda, 0xf0, 0x7e, 0xab, 0xee, 0x0c, \
+            0x10, 0x93, 0x86, 0x49, 0x18, 0x34, 0xf3, 0xa8, 0x2a, 0xd2, 0x57, \
+            0xf5, 0x2e, 0xd4, 0x2f, 0x77, 0x29, 0x84, 0x61, 0x4d, 0x82, 0x50, \
+            0x8f, 0xa7, 0x95, 0x48, 0x70, 0xf5, 0x6e, 0x4d, 0xb2, 0xd5, 0x13, \
+            0xc3, 0xd2, 0x1a, 0xed, 0xe6, 0x43, 0xea, 0x42, 0x14, 0xeb, 0x74, \
+            0xea, 0xc0, 0xed, 0x1f, 0xd4, 0x57, 0x4e, 0xa9, 0xf3, 0xa8, 0xed, \
+            0xd2, 0xe0, 0xc1, 0x30, 0x71, 0x30, 0x32, 0x30, 0xd5, 0xd3, 0xf6, \
+            0x08, 0xd0, 0x56, 0x4f, 0x46, 0x8e, 0xf2, 0x5f, 0xf9, 0x3d, 0x67, \
+            0x91, 0x88, 0x30, 0x2e, 0x42, 0xb2, 0xdf, 0x7d, 0xfb, 0xe5, 0x0c, \
+            0x77, 0xff, 0xec, 0x31, 0xc0, 0x78, 0x8f, 0xbf, 0xc2, 0x7f, 0xca, \
+            0xad, 0x6c, 0x21, 0xd6, 0x8d, 0xd9, 0x8b, 0x6a, 0x8e, 0x6f, 0xe0, \
+            0x9b, 0xf8, 0x10, 0x56, 0xcc, 0xb3, 0x8e, 0x13, 0x15, 0xe6, 0x34, \
+            0x04, 0x66, 0xc7, 0xee, 0xf9, 0x36, 0x0e, 0x6a, 0x95, 0xf6, 0x09, \
+            0x9a, 0x06, 0x67, 0xf4, 0x65, 0x71, 0xf8, 0xca, 0xa4, 0xb1, 0x25, \
+            0xe0, 0xfe, 0x3c, 0x8b, 0x35, 0x04, 0x67, 0xba, 0xe0, 0x4f, 0x76, \
+            0x85, 0xfc, 0x7f, 0xfc, 0x36, 0x6b, 0xb5, 0xe9, 0xcd, 0x2d, 0x03, \
+            0x62, 0x4e, 0xb3, 0x3d, 0x00, 0xcf, 0xaf, 0x76, 0xa0, 0x69, 0x56, \
+            0x83, 0x6a, 0xd2, 0xa8, 0xd4, 0xe7, 0x50, 0x71, 0xe6, 0xb5, 0x36, \
+            0x05, 0x77, 0x05, 0x6d, 0x7b, 0xc8, 0xe4, 0xc4, 0xfd, 0x4c, 0xd5, \
+            0x21, 0x5f, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x4d, 0x30, 0x4b, \
+            0x30, 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, \
+            0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, \
+            0x71, 0xa1, 0x00, 0x73, 0x72, 0x40, 0x2f, 0x54, 0x76, 0x5e, 0x33, \
+            0xfc, 0x52, 0x8f, 0xbc, 0xf1, 0xdd, 0x6b, 0x46, 0x21, 0x30, 0x1f, \
+            0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, \
+            0xb4, 0x5a, 0xe4, 0xa5, 0xb3, 0xde, 0xd2, 0x52, 0xf6, 0xb9, 0xd5, \
+            0xa6, 0x95, 0x0f, 0xeb, 0x3e, 0xbc, 0xc7, 0xfd, 0xff, 0x30, 0x0d, \
+            0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, \
+            0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x5e, 0x27, 0x6f, 0xd5, \
+            0xde, 0x29, 0x2e, 0x50, 0x62, 0x29, 0x61, 0x03, 0xf7, 0x9a, 0xcc, \
+            0xc9, 0xc0, 0x5d, 0x80, 0x37, 0x20, 0xc8, 0xda, 0x89, 0xc5, 0xa9, \
+            0x05, 0x91, 0x17, 0xd1, 0xc8, 0x0d, 0xb2, 0xd6, 0x69, 0x72, 0x4e, \
+            0x7e, 0xee, 0x05, 0x74, 0x64, 0x34, 0xb6, 0x39, 0x64, 0x5c, 0xca, \
+            0xf3, 0x61, 0x82, 0x8e, 0x4d, 0x90, 0xd8, 0xe0, 0xf8, 0x45, 0x94, \
+            0x82, 0x3c, 0x02, 0x49, 0xa8, 0xba, 0x47, 0x1d, 0x4d, 0xf8, 0xb7, \
+            0xbd, 0x5c, 0x89, 0xf7, 0xef, 0xcb, 0x62, 0x8a, 0xf3, 0x56, 0x2f, \
+            0xaf, 0x17, 0x33, 0x46, 0x13, 0x00, 0x13, 0xae, 0x22, 0xfa, 0xa9, \
+            0xda, 0xc8, 0xfd, 0xd3, 0x77, 0x65, 0xee, 0x58, 0x94, 0x74, 0xe4, \
+            0xf5, 0x4f, 0xa1, 0x27, 0xa6, 0xb0, 0xd1, 0x0b, 0xb3, 0xd8, 0x16, \
+            0xb6, 0xd7, 0x67, 0x63, 0x2d, 0xdc, 0x7b, 0xe1, 0x18, 0xd9, 0x8d, \
+            0x27, 0xed, 0x1b, 0x22, 0xef, 0xdf, 0x36, 0x11, 0xe2, 0xc8, 0x00, \
+            0x0e, 0xc7, 0xe9, 0xc6, 0xb8, 0xd8, 0x4b, 0x3f, 0x35, 0x41, 0xff, \
+            0xfc, 0x96, 0x49, 0x4f, 0x7d, 0x8e, 0x3f, 0x47, 0x68, 0x33, 0x17, \
+            0x83, 0x44, 0x0f, 0xaf, 0xa6, 0x59, 0x0a, 0xa9, 0x32, 0xcb, 0x59, \
+            0xfe, 0xdd, 0x5f, 0x6e, 0x8b, 0x22, 0xb8, 0x81, 0x90, 0x16, 0x91, \
+            0x0a, 0x04, 0x79, 0x62, 0xff, 0x4b, 0x04, 0xf1, 0x5c, 0x34, 0xeb, \
+            0x69, 0xce, 0xef, 0xcb, 0x6e, 0xb6, 0x3b, 0x40, 0x55, 0xca, 0x24, \
+            0xc2, 0x3e, 0x25, 0x70, 0xee, 0x74, 0x2b, 0x0e, 0x9f, 0xc2, 0x82, \
+            0x9a, 0x20, 0x38, 0x77, 0xa1, 0x26, 0x8a, 0xca, 0x9f, 0x87, 0x75, \
+            0x77, 0xe3, 0xce, 0x65, 0xec, 0x71, 0x10, 0x35, 0xcb, 0xcb, 0x4f, \
+            0x19, 0x43, 0xeb, 0x30, 0xd0, 0xca, 0x2d, 0x3f, 0xca, 0x46, 0x14, \
+            0x61, 0x99, 0x30, 0x41, 0x32, 0xb5, 0x37, 0x63, 0x6f, 0x97        \
+    }
 /* END FILE */
 
 /* This is taken from tests/data_files/cli-rsa.key. */
@@ -1169,112 +1264,123 @@
     "gxUwAQKBgQCcU6G2L8AG9d9c0UpOyL1tMvFe5Ttw0KjlQVdsh1MP6yigYo9DYuwu\r\n" \
     "bHFVW2r0dBTqegP2/KTOxKzaHfC1qf0RGDsUoJCNJrd1cwoCLG8P2EF4w3OBrKqv\r\n" \
     "8u4ytY0F+Vlanj5lm3TaoHSVF1+NWPyOTiwevIECGKwSxvlki4fDAA==\r\n"         \
-    "-----END RSA PRIVATE KEY-----\r\n"/* END FILE */
+    "-----END RSA PRIVATE KEY-----\r\n" /* END FILE */
 
 /* This was generated from tests/data_files/cli-rsa.key.der using `xxd -i`. */
-/* BEGIN FILE binary macro TEST_CLI_KEY_RSA_DER tests/data_files/cli-rsa.key.der */
-#define TEST_CLI_KEY_RSA_DER {                                               \
-    0x30, 0x82, 0x04, 0xa4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00,  \
-    0xc8, 0x74, 0xc4, 0xcc, 0xb9, 0xf9, 0xb5, 0x79, 0xe9, 0x45, 0xd9, 0x14,  \
-    0x60, 0xb0, 0x7d, 0xbb, 0x93, 0xf2, 0x6b, 0x1e, 0x9f, 0x33, 0xad, 0x0d,  \
-    0x8f, 0x8a, 0x3c, 0x56, 0x65, 0xe5, 0xdc, 0x44, 0xd9, 0xcc, 0x66, 0x85,  \
-    0x07, 0xd5, 0xf8, 0x27, 0xb0, 0x4a, 0x35, 0xd0, 0x63, 0x9e, 0x0a, 0x6e,  \
-    0x1b, 0xb7, 0xda, 0xf0, 0x7e, 0xab, 0xee, 0x0c, 0x10, 0x93, 0x86, 0x49,  \
-    0x18, 0x34, 0xf3, 0xa8, 0x2a, 0xd2, 0x57, 0xf5, 0x2e, 0xd4, 0x2f, 0x77,  \
-    0x29, 0x84, 0x61, 0x4d, 0x82, 0x50, 0x8f, 0xa7, 0x95, 0x48, 0x70, 0xf5,  \
-    0x6e, 0x4d, 0xb2, 0xd5, 0x13, 0xc3, 0xd2, 0x1a, 0xed, 0xe6, 0x43, 0xea,  \
-    0x42, 0x14, 0xeb, 0x74, 0xea, 0xc0, 0xed, 0x1f, 0xd4, 0x57, 0x4e, 0xa9,  \
-    0xf3, 0xa8, 0xed, 0xd2, 0xe0, 0xc1, 0x30, 0x71, 0x30, 0x32, 0x30, 0xd5,  \
-    0xd3, 0xf6, 0x08, 0xd0, 0x56, 0x4f, 0x46, 0x8e, 0xf2, 0x5f, 0xf9, 0x3d,  \
-    0x67, 0x91, 0x88, 0x30, 0x2e, 0x42, 0xb2, 0xdf, 0x7d, 0xfb, 0xe5, 0x0c,  \
-    0x77, 0xff, 0xec, 0x31, 0xc0, 0x78, 0x8f, 0xbf, 0xc2, 0x7f, 0xca, 0xad,  \
-    0x6c, 0x21, 0xd6, 0x8d, 0xd9, 0x8b, 0x6a, 0x8e, 0x6f, 0xe0, 0x9b, 0xf8,  \
-    0x10, 0x56, 0xcc, 0xb3, 0x8e, 0x13, 0x15, 0xe6, 0x34, 0x04, 0x66, 0xc7,  \
-    0xee, 0xf9, 0x36, 0x0e, 0x6a, 0x95, 0xf6, 0x09, 0x9a, 0x06, 0x67, 0xf4,  \
-    0x65, 0x71, 0xf8, 0xca, 0xa4, 0xb1, 0x25, 0xe0, 0xfe, 0x3c, 0x8b, 0x35,  \
-    0x04, 0x67, 0xba, 0xe0, 0x4f, 0x76, 0x85, 0xfc, 0x7f, 0xfc, 0x36, 0x6b,  \
-    0xb5, 0xe9, 0xcd, 0x2d, 0x03, 0x62, 0x4e, 0xb3, 0x3d, 0x00, 0xcf, 0xaf,  \
-    0x76, 0xa0, 0x69, 0x56, 0x83, 0x6a, 0xd2, 0xa8, 0xd4, 0xe7, 0x50, 0x71,  \
-    0xe6, 0xb5, 0x36, 0x05, 0x77, 0x05, 0x6d, 0x7b, 0xc8, 0xe4, 0xc4, 0xfd,  \
-    0x4c, 0xd5, 0x21, 0x5f, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x82, 0x01,  \
-    0x00, 0x67, 0x4d, 0xb5, 0xf6, 0x03, 0x89, 0xaa, 0x7a, 0x6f, 0x3b, 0x2d,  \
-    0xca, 0x10, 0xa2, 0x23, 0xc9, 0xbd, 0x4e, 0xda, 0xe1, 0x67, 0x0e, 0x0c,  \
-    0x8a, 0xc6, 0x84, 0x68, 0xdf, 0xe5, 0x97, 0x75, 0xd2, 0x8d, 0xa3, 0x86,  \
-    0xd9, 0xdb, 0xd5, 0xeb, 0x13, 0x19, 0x08, 0xc5, 0x7e, 0xe5, 0x37, 0x97,  \
-    0x0c, 0x73, 0x80, 0x66, 0x76, 0x35, 0xf1, 0x88, 0xb5, 0xf2, 0xfc, 0xf3,  \
-    0xe1, 0x4b, 0x76, 0x4e, 0x73, 0x45, 0xce, 0x2c, 0xc2, 0x10, 0x26, 0x0d,  \
-    0x68, 0x0d, 0x9f, 0x49, 0x3d, 0xd6, 0x80, 0x89, 0xe7, 0xc5, 0x49, 0x15,  \
-    0xdd, 0x85, 0xc0, 0xc8, 0xfe, 0x82, 0x37, 0x12, 0x5a, 0x0a, 0x6b, 0xf6,  \
-    0x68, 0x0d, 0x32, 0x16, 0xbd, 0xa4, 0x15, 0x54, 0x9e, 0x68, 0xa1, 0xad,  \
-    0xca, 0x6b, 0xe5, 0x8c, 0xda, 0x76, 0x35, 0x59, 0x2f, 0x9b, 0xb4, 0xe1,  \
-    0xf1, 0xf0, 0x50, 0x04, 0xee, 0xc8, 0xec, 0x05, 0xe1, 0xcf, 0x8d, 0xe4,  \
-    0xd2, 0x64, 0x7b, 0x5e, 0x63, 0xe0, 0x7b, 0x07, 0xbc, 0x02, 0x96, 0x4e,  \
-    0x1b, 0x78, 0x6c, 0xb6, 0x43, 0x9a, 0x32, 0xf6, 0xd6, 0x02, 0xf5, 0x80,  \
-    0xcc, 0x26, 0x6e, 0xa5, 0xd0, 0xe3, 0x65, 0x88, 0xce, 0x26, 0xa9, 0x40,  \
-    0xe1, 0xe1, 0x00, 0xe0, 0x7f, 0x3f, 0xc3, 0xb1, 0x7c, 0xde, 0xbe, 0x42,  \
-    0xba, 0x07, 0x81, 0x13, 0xc2, 0xe0, 0x11, 0x11, 0x23, 0x2c, 0xf8, 0xb2,  \
-    0x7a, 0x3a, 0xd4, 0xe4, 0x7d, 0x5f, 0xb9, 0xb1, 0x18, 0xfa, 0x1d, 0x1d,  \
-    0x97, 0x91, 0xd9, 0x04, 0x9e, 0xbc, 0xc9, 0xb4, 0xd7, 0x7d, 0x0e, 0x54,  \
-    0xf6, 0x8f, 0xd0, 0x28, 0x0d, 0xdd, 0x77, 0x4b, 0x68, 0x04, 0x48, 0x61,  \
-    0x75, 0x15, 0x03, 0x1b, 0x35, 0xad, 0x8e, 0xfc, 0x24, 0x11, 0x07, 0xea,  \
-    0x17, 0x5a, 0xde, 0x19, 0x68, 0xff, 0xb6, 0x87, 0x7f, 0x80, 0x2a, 0x5f,  \
-    0x0c, 0x58, 0xba, 0x5f, 0x41, 0x02, 0x81, 0x81, 0x00, 0xe3, 0x03, 0xaf,  \
-    0xfe, 0x98, 0xd2, 0x0b, 0x7b, 0x72, 0xe9, 0x3b, 0x8e, 0xbc, 0xa5, 0xf6,  \
-    0xac, 0xe5, 0x22, 0x06, 0xb2, 0xd7, 0x5e, 0xfd, 0x89, 0x4b, 0x16, 0x67,  \
-    0x32, 0x83, 0x22, 0x58, 0x8e, 0x62, 0xa4, 0xb4, 0x2d, 0xf9, 0x16, 0x13,  \
-    0x54, 0xf6, 0x9f, 0x2f, 0xf9, 0xbb, 0x0e, 0x7e, 0x8c, 0x6f, 0x08, 0xda,  \
-    0xc8, 0xe9, 0x1c, 0x66, 0x10, 0x70, 0x93, 0x90, 0x8d, 0xcf, 0x90, 0x3a,  \
-    0x43, 0x89, 0x49, 0xeb, 0x83, 0x2a, 0xfe, 0x5a, 0x87, 0xce, 0x74, 0x42,  \
-    0x41, 0x0d, 0x8c, 0x73, 0x51, 0xbc, 0x7b, 0x20, 0xc5, 0xfd, 0xf6, 0x0b,  \
-    0x65, 0xed, 0xa9, 0x2e, 0xfc, 0x0f, 0xf5, 0x50, 0xf9, 0x8d, 0x37, 0x36,  \
-    0x9a, 0x20, 0xdf, 0xc3, 0xe3, 0x27, 0xbc, 0x98, 0x72, 0xc1, 0x14, 0x4b,  \
-    0x71, 0xe9, 0x83, 0x14, 0xff, 0x24, 0xe2, 0x14, 0x15, 0xb6, 0x6f, 0x0f,  \
-    0x32, 0x9d, 0xd9, 0x98, 0xd1, 0x02, 0x81, 0x81, 0x00, 0xe2, 0x0c, 0xfb,  \
-    0xc3, 0x33, 0x9b, 0x47, 0x88, 0x27, 0xf2, 0x26, 0xde, 0xeb, 0x5e, 0xee,  \
-    0x40, 0xf6, 0x63, 0x5b, 0x35, 0x23, 0xf5, 0xd5, 0x07, 0x61, 0xdf, 0xa2,  \
-    0x9f, 0x58, 0x30, 0x04, 0x22, 0x2b, 0xb4, 0xd9, 0xda, 0x46, 0x7f, 0x48,  \
-    0xf5, 0x4f, 0xd0, 0xea, 0xd7, 0xa0, 0x45, 0x8a, 0x62, 0x8b, 0x8c, 0xac,  \
-    0x73, 0x5e, 0xfa, 0x36, 0x65, 0x3e, 0xba, 0x6c, 0xba, 0x5e, 0x6b, 0x92,  \
-    0x29, 0x5e, 0x6a, 0x0f, 0xd6, 0xd2, 0xa5, 0x95, 0x86, 0xda, 0x72, 0xc5,  \
-    0x9e, 0xc9, 0x6b, 0x37, 0x5e, 0x4b, 0x9b, 0x77, 0xe1, 0x67, 0x1a, 0x1e,  \
-    0x30, 0xd8, 0x41, 0x68, 0x40, 0xd3, 0x9c, 0xb4, 0xf6, 0xeb, 0x2a, 0x22,  \
-    0xdf, 0x78, 0x29, 0xd2, 0x64, 0x92, 0x5b, 0x2f, 0x78, 0x64, 0x4a, 0xa2,  \
-    0xa6, 0x6b, 0x3e, 0x50, 0xb1, 0x7a, 0xb1, 0x8d, 0x59, 0xb4, 0x55, 0xba,  \
-    0xb6, 0x91, 0x85, 0xa3, 0x2f, 0x02, 0x81, 0x80, 0x10, 0x1e, 0x19, 0xe7,  \
-    0xbc, 0x97, 0xe5, 0x22, 0xcd, 0xa4, 0xcb, 0x8a, 0xb5, 0xd0, 0x1e, 0xb4,  \
-    0x65, 0xcc, 0x45, 0xa7, 0x7a, 0xed, 0x0e, 0x99, 0x29, 0xd0, 0x9c, 0x61,  \
-    0x14, 0xb8, 0x62, 0x8b, 0x31, 0x6b, 0xba, 0x33, 0x2d, 0x65, 0x28, 0xd8,  \
-    0x36, 0x6e, 0x54, 0xec, 0xa9, 0x20, 0x3d, 0x51, 0xe1, 0x2c, 0x42, 0xc4,  \
-    0x52, 0xf0, 0xa6, 0x3a, 0x72, 0x93, 0xb7, 0x86, 0xa9, 0xfe, 0xf6, 0x74,  \
-    0x07, 0x12, 0x4d, 0x7b, 0x51, 0x99, 0x1f, 0x7a, 0x56, 0xe9, 0x20, 0x2f,  \
-    0x18, 0x34, 0x29, 0x97, 0xdb, 0x06, 0xee, 0xeb, 0xbf, 0xbd, 0x31, 0x4f,  \
-    0xfa, 0x50, 0xb1, 0xba, 0x49, 0xb3, 0xc4, 0x1d, 0x03, 0xae, 0xb0, 0xdc,  \
-    0xbe, 0x8a, 0xc4, 0x90, 0xa3, 0x28, 0x9b, 0xb6, 0x42, 0x09, 0x1b, 0xd6,  \
-    0x29, 0x9b, 0x19, 0xe9, 0x87, 0x87, 0xd9, 0x9f, 0x35, 0x05, 0xab, 0x91,  \
-    0x8f, 0x6d, 0x7c, 0x91, 0x02, 0x81, 0x81, 0x00, 0x94, 0x57, 0xf0, 0xe0,  \
-    0x28, 0xfd, 0xbd, 0xf3, 0x9c, 0x43, 0x4d, 0x3e, 0xfd, 0x37, 0x4f, 0x23,  \
-    0x52, 0x8d, 0xe1, 0x4c, 0xfe, 0x4c, 0x55, 0x80, 0x82, 0xba, 0x3f, 0xfe,  \
-    0x51, 0xe1, 0x30, 0xd5, 0x3b, 0xd9, 0x73, 0x1d, 0xcb, 0x25, 0xbc, 0xbb,  \
-    0x3f, 0xa5, 0xda, 0x77, 0xa6, 0xb5, 0xfc, 0x1a, 0xaf, 0x79, 0xa1, 0xb2,  \
-    0x14, 0xa2, 0x1f, 0x10, 0x52, 0x1a, 0x05, 0x40, 0x48, 0xb6, 0x4f, 0x34,  \
-    0xd6, 0xc0, 0xc3, 0xa4, 0x36, 0x98, 0x73, 0x88, 0x0b, 0xd3, 0x45, 0xdc,  \
-    0xee, 0x51, 0x6e, 0x04, 0x73, 0x99, 0x93, 0x12, 0x58, 0x96, 0xcb, 0x39,  \
-    0x42, 0xb1, 0xa9, 0xb8, 0xe1, 0x25, 0xf5, 0x9c, 0x14, 0xb7, 0x92, 0x2b,  \
-    0x14, 0xb0, 0x5d, 0x61, 0xa2, 0xaa, 0x34, 0x7c, 0xcd, 0x54, 0x2d, 0x69,  \
-    0x08, 0xf7, 0xdb, 0xfc, 0x9c, 0x87, 0xe8, 0x3a, 0xf6, 0x1d, 0x4c, 0x6a,  \
-    0x83, 0x15, 0x30, 0x01, 0x02, 0x81, 0x81, 0x00, 0x9c, 0x53, 0xa1, 0xb6,  \
-    0x2f, 0xc0, 0x06, 0xf5, 0xdf, 0x5c, 0xd1, 0x4a, 0x4e, 0xc8, 0xbd, 0x6d,  \
-    0x32, 0xf1, 0x5e, 0xe5, 0x3b, 0x70, 0xd0, 0xa8, 0xe5, 0x41, 0x57, 0x6c,  \
-    0x87, 0x53, 0x0f, 0xeb, 0x28, 0xa0, 0x62, 0x8f, 0x43, 0x62, 0xec, 0x2e,  \
-    0x6c, 0x71, 0x55, 0x5b, 0x6a, 0xf4, 0x74, 0x14, 0xea, 0x7a, 0x03, 0xf6,  \
-    0xfc, 0xa4, 0xce, 0xc4, 0xac, 0xda, 0x1d, 0xf0, 0xb5, 0xa9, 0xfd, 0x11,  \
-    0x18, 0x3b, 0x14, 0xa0, 0x90, 0x8d, 0x26, 0xb7, 0x75, 0x73, 0x0a, 0x02,  \
-    0x2c, 0x6f, 0x0f, 0xd8, 0x41, 0x78, 0xc3, 0x73, 0x81, 0xac, 0xaa, 0xaf,  \
-    0xf2, 0xee, 0x32, 0xb5, 0x8d, 0x05, 0xf9, 0x59, 0x5a, 0x9e, 0x3e, 0x65,  \
-    0x9b, 0x74, 0xda, 0xa0, 0x74, 0x95, 0x17, 0x5f, 0x8d, 0x58, 0xfc, 0x8e,  \
-    0x4e, 0x2c, 0x1e, 0xbc, 0x81, 0x02, 0x18, 0xac, 0x12, 0xc6, 0xf9, 0x64,  \
-    0x8b, 0x87, 0xc3, 0x00                                                   \
-}
+/* BEGIN FILE binary macro TEST_CLI_KEY_RSA_DER tests/data_files/cli-rsa.key.der
+ */
+#define TEST_CLI_KEY_RSA_DER                                                  \
+    {                                                                         \
+        0x30, 0x82, 0x04, 0xa4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01,     \
+            0x00, 0xc8, 0x74, 0xc4, 0xcc, 0xb9, 0xf9, 0xb5, 0x79, 0xe9, 0x45, \
+            0xd9, 0x14, 0x60, 0xb0, 0x7d, 0xbb, 0x93, 0xf2, 0x6b, 0x1e, 0x9f, \
+            0x33, 0xad, 0x0d, 0x8f, 0x8a, 0x3c, 0x56, 0x65, 0xe5, 0xdc, 0x44, \
+            0xd9, 0xcc, 0x66, 0x85, 0x07, 0xd5, 0xf8, 0x27, 0xb0, 0x4a, 0x35, \
+            0xd0, 0x63, 0x9e, 0x0a, 0x6e, 0x1b, 0xb7, 0xda, 0xf0, 0x7e, 0xab, \
+            0xee, 0x0c, 0x10, 0x93, 0x86, 0x49, 0x18, 0x34, 0xf3, 0xa8, 0x2a, \
+            0xd2, 0x57, 0xf5, 0x2e, 0xd4, 0x2f, 0x77, 0x29, 0x84, 0x61, 0x4d, \
+            0x82, 0x50, 0x8f, 0xa7, 0x95, 0x48, 0x70, 0xf5, 0x6e, 0x4d, 0xb2, \
+            0xd5, 0x13, 0xc3, 0xd2, 0x1a, 0xed, 0xe6, 0x43, 0xea, 0x42, 0x14, \
+            0xeb, 0x74, 0xea, 0xc0, 0xed, 0x1f, 0xd4, 0x57, 0x4e, 0xa9, 0xf3, \
+            0xa8, 0xed, 0xd2, 0xe0, 0xc1, 0x30, 0x71, 0x30, 0x32, 0x30, 0xd5, \
+            0xd3, 0xf6, 0x08, 0xd0, 0x56, 0x4f, 0x46, 0x8e, 0xf2, 0x5f, 0xf9, \
+            0x3d, 0x67, 0x91, 0x88, 0x30, 0x2e, 0x42, 0xb2, 0xdf, 0x7d, 0xfb, \
+            0xe5, 0x0c, 0x77, 0xff, 0xec, 0x31, 0xc0, 0x78, 0x8f, 0xbf, 0xc2, \
+            0x7f, 0xca, 0xad, 0x6c, 0x21, 0xd6, 0x8d, 0xd9, 0x8b, 0x6a, 0x8e, \
+            0x6f, 0xe0, 0x9b, 0xf8, 0x10, 0x56, 0xcc, 0xb3, 0x8e, 0x13, 0x15, \
+            0xe6, 0x34, 0x04, 0x66, 0xc7, 0xee, 0xf9, 0x36, 0x0e, 0x6a, 0x95, \
+            0xf6, 0x09, 0x9a, 0x06, 0x67, 0xf4, 0x65, 0x71, 0xf8, 0xca, 0xa4, \
+            0xb1, 0x25, 0xe0, 0xfe, 0x3c, 0x8b, 0x35, 0x04, 0x67, 0xba, 0xe0, \
+            0x4f, 0x76, 0x85, 0xfc, 0x7f, 0xfc, 0x36, 0x6b, 0xb5, 0xe9, 0xcd, \
+            0x2d, 0x03, 0x62, 0x4e, 0xb3, 0x3d, 0x00, 0xcf, 0xaf, 0x76, 0xa0, \
+            0x69, 0x56, 0x83, 0x6a, 0xd2, 0xa8, 0xd4, 0xe7, 0x50, 0x71, 0xe6, \
+            0xb5, 0x36, 0x05, 0x77, 0x05, 0x6d, 0x7b, 0xc8, 0xe4, 0xc4, 0xfd, \
+            0x4c, 0xd5, 0x21, 0x5f, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x82, \
+            0x01, 0x00, 0x67, 0x4d, 0xb5, 0xf6, 0x03, 0x89, 0xaa, 0x7a, 0x6f, \
+            0x3b, 0x2d, 0xca, 0x10, 0xa2, 0x23, 0xc9, 0xbd, 0x4e, 0xda, 0xe1, \
+            0x67, 0x0e, 0x0c, 0x8a, 0xc6, 0x84, 0x68, 0xdf, 0xe5, 0x97, 0x75, \
+            0xd2, 0x8d, 0xa3, 0x86, 0xd9, 0xdb, 0xd5, 0xeb, 0x13, 0x19, 0x08, \
+            0xc5, 0x7e, 0xe5, 0x37, 0x97, 0x0c, 0x73, 0x80, 0x66, 0x76, 0x35, \
+            0xf1, 0x88, 0xb5, 0xf2, 0xfc, 0xf3, 0xe1, 0x4b, 0x76, 0x4e, 0x73, \
+            0x45, 0xce, 0x2c, 0xc2, 0x10, 0x26, 0x0d, 0x68, 0x0d, 0x9f, 0x49, \
+            0x3d, 0xd6, 0x80, 0x89, 0xe7, 0xc5, 0x49, 0x15, 0xdd, 0x85, 0xc0, \
+            0xc8, 0xfe, 0x82, 0x37, 0x12, 0x5a, 0x0a, 0x6b, 0xf6, 0x68, 0x0d, \
+            0x32, 0x16, 0xbd, 0xa4, 0x15, 0x54, 0x9e, 0x68, 0xa1, 0xad, 0xca, \
+            0x6b, 0xe5, 0x8c, 0xda, 0x76, 0x35, 0x59, 0x2f, 0x9b, 0xb4, 0xe1, \
+            0xf1, 0xf0, 0x50, 0x04, 0xee, 0xc8, 0xec, 0x05, 0xe1, 0xcf, 0x8d, \
+            0xe4, 0xd2, 0x64, 0x7b, 0x5e, 0x63, 0xe0, 0x7b, 0x07, 0xbc, 0x02, \
+            0x96, 0x4e, 0x1b, 0x78, 0x6c, 0xb6, 0x43, 0x9a, 0x32, 0xf6, 0xd6, \
+            0x02, 0xf5, 0x80, 0xcc, 0x26, 0x6e, 0xa5, 0xd0, 0xe3, 0x65, 0x88, \
+            0xce, 0x26, 0xa9, 0x40, 0xe1, 0xe1, 0x00, 0xe0, 0x7f, 0x3f, 0xc3, \
+            0xb1, 0x7c, 0xde, 0xbe, 0x42, 0xba, 0x07, 0x81, 0x13, 0xc2, 0xe0, \
+            0x11, 0x11, 0x23, 0x2c, 0xf8, 0xb2, 0x7a, 0x3a, 0xd4, 0xe4, 0x7d, \
+            0x5f, 0xb9, 0xb1, 0x18, 0xfa, 0x1d, 0x1d, 0x97, 0x91, 0xd9, 0x04, \
+            0x9e, 0xbc, 0xc9, 0xb4, 0xd7, 0x7d, 0x0e, 0x54, 0xf6, 0x8f, 0xd0, \
+            0x28, 0x0d, 0xdd, 0x77, 0x4b, 0x68, 0x04, 0x48, 0x61, 0x75, 0x15, \
+            0x03, 0x1b, 0x35, 0xad, 0x8e, 0xfc, 0x24, 0x11, 0x07, 0xea, 0x17, \
+            0x5a, 0xde, 0x19, 0x68, 0xff, 0xb6, 0x87, 0x7f, 0x80, 0x2a, 0x5f, \
+            0x0c, 0x58, 0xba, 0x5f, 0x41, 0x02, 0x81, 0x81, 0x00, 0xe3, 0x03, \
+            0xaf, 0xfe, 0x98, 0xd2, 0x0b, 0x7b, 0x72, 0xe9, 0x3b, 0x8e, 0xbc, \
+            0xa5, 0xf6, 0xac, 0xe5, 0x22, 0x06, 0xb2, 0xd7, 0x5e, 0xfd, 0x89, \
+            0x4b, 0x16, 0x67, 0x32, 0x83, 0x22, 0x58, 0x8e, 0x62, 0xa4, 0xb4, \
+            0x2d, 0xf9, 0x16, 0x13, 0x54, 0xf6, 0x9f, 0x2f, 0xf9, 0xbb, 0x0e, \
+            0x7e, 0x8c, 0x6f, 0x08, 0xda, 0xc8, 0xe9, 0x1c, 0x66, 0x10, 0x70, \
+            0x93, 0x90, 0x8d, 0xcf, 0x90, 0x3a, 0x43, 0x89, 0x49, 0xeb, 0x83, \
+            0x2a, 0xfe, 0x5a, 0x87, 0xce, 0x74, 0x42, 0x41, 0x0d, 0x8c, 0x73, \
+            0x51, 0xbc, 0x7b, 0x20, 0xc5, 0xfd, 0xf6, 0x0b, 0x65, 0xed, 0xa9, \
+            0x2e, 0xfc, 0x0f, 0xf5, 0x50, 0xf9, 0x8d, 0x37, 0x36, 0x9a, 0x20, \
+            0xdf, 0xc3, 0xe3, 0x27, 0xbc, 0x98, 0x72, 0xc1, 0x14, 0x4b, 0x71, \
+            0xe9, 0x83, 0x14, 0xff, 0x24, 0xe2, 0x14, 0x15, 0xb6, 0x6f, 0x0f, \
+            0x32, 0x9d, 0xd9, 0x98, 0xd1, 0x02, 0x81, 0x81, 0x00, 0xe2, 0x0c, \
+            0xfb, 0xc3, 0x33, 0x9b, 0x47, 0x88, 0x27, 0xf2, 0x26, 0xde, 0xeb, \
+            0x5e, 0xee, 0x40, 0xf6, 0x63, 0x5b, 0x35, 0x23, 0xf5, 0xd5, 0x07, \
+            0x61, 0xdf, 0xa2, 0x9f, 0x58, 0x30, 0x04, 0x22, 0x2b, 0xb4, 0xd9, \
+            0xda, 0x46, 0x7f, 0x48, 0xf5, 0x4f, 0xd0, 0xea, 0xd7, 0xa0, 0x45, \
+            0x8a, 0x62, 0x8b, 0x8c, 0xac, 0x73, 0x5e, 0xfa, 0x36, 0x65, 0x3e, \
+            0xba, 0x6c, 0xba, 0x5e, 0x6b, 0x92, 0x29, 0x5e, 0x6a, 0x0f, 0xd6, \
+            0xd2, 0xa5, 0x95, 0x86, 0xda, 0x72, 0xc5, 0x9e, 0xc9, 0x6b, 0x37, \
+            0x5e, 0x4b, 0x9b, 0x77, 0xe1, 0x67, 0x1a, 0x1e, 0x30, 0xd8, 0x41, \
+            0x68, 0x40, 0xd3, 0x9c, 0xb4, 0xf6, 0xeb, 0x2a, 0x22, 0xdf, 0x78, \
+            0x29, 0xd2, 0x64, 0x92, 0x5b, 0x2f, 0x78, 0x64, 0x4a, 0xa2, 0xa6, \
+            0x6b, 0x3e, 0x50, 0xb1, 0x7a, 0xb1, 0x8d, 0x59, 0xb4, 0x55, 0xba, \
+            0xb6, 0x91, 0x85, 0xa3, 0x2f, 0x02, 0x81, 0x80, 0x10, 0x1e, 0x19, \
+            0xe7, 0xbc, 0x97, 0xe5, 0x22, 0xcd, 0xa4, 0xcb, 0x8a, 0xb5, 0xd0, \
+            0x1e, 0xb4, 0x65, 0xcc, 0x45, 0xa7, 0x7a, 0xed, 0x0e, 0x99, 0x29, \
+            0xd0, 0x9c, 0x61, 0x14, 0xb8, 0x62, 0x8b, 0x31, 0x6b, 0xba, 0x33, \
+            0x2d, 0x65, 0x28, 0xd8, 0x36, 0x6e, 0x54, 0xec, 0xa9, 0x20, 0x3d, \
+            0x51, 0xe1, 0x2c, 0x42, 0xc4, 0x52, 0xf0, 0xa6, 0x3a, 0x72, 0x93, \
+            0xb7, 0x86, 0xa9, 0xfe, 0xf6, 0x74, 0x07, 0x12, 0x4d, 0x7b, 0x51, \
+            0x99, 0x1f, 0x7a, 0x56, 0xe9, 0x20, 0x2f, 0x18, 0x34, 0x29, 0x97, \
+            0xdb, 0x06, 0xee, 0xeb, 0xbf, 0xbd, 0x31, 0x4f, 0xfa, 0x50, 0xb1, \
+            0xba, 0x49, 0xb3, 0xc4, 0x1d, 0x03, 0xae, 0xb0, 0xdc, 0xbe, 0x8a, \
+            0xc4, 0x90, 0xa3, 0x28, 0x9b, 0xb6, 0x42, 0x09, 0x1b, 0xd6, 0x29, \
+            0x9b, 0x19, 0xe9, 0x87, 0x87, 0xd9, 0x9f, 0x35, 0x05, 0xab, 0x91, \
+            0x8f, 0x6d, 0x7c, 0x91, 0x02, 0x81, 0x81, 0x00, 0x94, 0x57, 0xf0, \
+            0xe0, 0x28, 0xfd, 0xbd, 0xf3, 0x9c, 0x43, 0x4d, 0x3e, 0xfd, 0x37, \
+            0x4f, 0x23, 0x52, 0x8d, 0xe1, 0x4c, 0xfe, 0x4c, 0x55, 0x80, 0x82, \
+            0xba, 0x3f, 0xfe, 0x51, 0xe1, 0x30, 0xd5, 0x3b, 0xd9, 0x73, 0x1d, \
+            0xcb, 0x25, 0xbc, 0xbb, 0x3f, 0xa5, 0xda, 0x77, 0xa6, 0xb5, 0xfc, \
+            0x1a, 0xaf, 0x79, 0xa1, 0xb2, 0x14, 0xa2, 0x1f, 0x10, 0x52, 0x1a, \
+            0x05, 0x40, 0x48, 0xb6, 0x4f, 0x34, 0xd6, 0xc0, 0xc3, 0xa4, 0x36, \
+            0x98, 0x73, 0x88, 0x0b, 0xd3, 0x45, 0xdc, 0xee, 0x51, 0x6e, 0x04, \
+            0x73, 0x99, 0x93, 0x12, 0x58, 0x96, 0xcb, 0x39, 0x42, 0xb1, 0xa9, \
+            0xb8, 0xe1, 0x25, 0xf5, 0x9c, 0x14, 0xb7, 0x92, 0x2b, 0x14, 0xb0, \
+            0x5d, 0x61, 0xa2, 0xaa, 0x34, 0x7c, 0xcd, 0x54, 0x2d, 0x69, 0x08, \
+            0xf7, 0xdb, 0xfc, 0x9c, 0x87, 0xe8, 0x3a, 0xf6, 0x1d, 0x4c, 0x6a, \
+            0x83, 0x15, 0x30, 0x01, 0x02, 0x81, 0x81, 0x00, 0x9c, 0x53, 0xa1, \
+            0xb6, 0x2f, 0xc0, 0x06, 0xf5, 0xdf, 0x5c, 0xd1, 0x4a, 0x4e, 0xc8, \
+            0xbd, 0x6d, 0x32, 0xf1, 0x5e, 0xe5, 0x3b, 0x70, 0xd0, 0xa8, 0xe5, \
+            0x41, 0x57, 0x6c, 0x87, 0x53, 0x0f, 0xeb, 0x28, 0xa0, 0x62, 0x8f, \
+            0x43, 0x62, 0xec, 0x2e, 0x6c, 0x71, 0x55, 0x5b, 0x6a, 0xf4, 0x74, \
+            0x14, 0xea, 0x7a, 0x03, 0xf6, 0xfc, 0xa4, 0xce, 0xc4, 0xac, 0xda, \
+            0x1d, 0xf0, 0xb5, 0xa9, 0xfd, 0x11, 0x18, 0x3b, 0x14, 0xa0, 0x90, \
+            0x8d, 0x26, 0xb7, 0x75, 0x73, 0x0a, 0x02, 0x2c, 0x6f, 0x0f, 0xd8, \
+            0x41, 0x78, 0xc3, 0x73, 0x81, 0xac, 0xaa, 0xaf, 0xf2, 0xee, 0x32, \
+            0xb5, 0x8d, 0x05, 0xf9, 0x59, 0x5a, 0x9e, 0x3e, 0x65, 0x9b, 0x74, \
+            0xda, 0xa0, 0x74, 0x95, 0x17, 0x5f, 0x8d, 0x58, 0xfc, 0x8e, 0x4e, \
+            0x2c, 0x1e, 0xbc, 0x81, 0x02, 0x18, 0xac, 0x12, 0xc6, 0xf9, 0x64, \
+            0x8b, 0x87, 0xc3, 0x00                                            \
+    }
 /* END FILE */
 
 /*
@@ -1287,135 +1393,135 @@
  * CA
  */
 
-const char mbedtls_test_ca_crt_ec_pem[]           = TEST_CA_CRT_EC_PEM;
-const char mbedtls_test_ca_key_ec_pem[]           = TEST_CA_KEY_EC_PEM;
-const char mbedtls_test_ca_pwd_ec_pem[]           = TEST_CA_PWD_EC_PEM;
-const char mbedtls_test_ca_key_rsa_pem[]          = TEST_CA_KEY_RSA_PEM;
-const char mbedtls_test_ca_pwd_rsa_pem[]          = TEST_CA_PWD_RSA_PEM;
-const char mbedtls_test_ca_crt_rsa_sha1_pem[]     = TEST_CA_CRT_RSA_SHA1_PEM;
-const char mbedtls_test_ca_crt_rsa_sha256_pem[]   = TEST_CA_CRT_RSA_SHA256_PEM;
+const char mbedtls_test_ca_crt_ec_pem[] = TEST_CA_CRT_EC_PEM;
+const char mbedtls_test_ca_key_ec_pem[] = TEST_CA_KEY_EC_PEM;
+const char mbedtls_test_ca_pwd_ec_pem[] = TEST_CA_PWD_EC_PEM;
+const char mbedtls_test_ca_key_rsa_pem[] = TEST_CA_KEY_RSA_PEM;
+const char mbedtls_test_ca_pwd_rsa_pem[] = TEST_CA_PWD_RSA_PEM;
+const char mbedtls_test_ca_crt_rsa_sha1_pem[] = TEST_CA_CRT_RSA_SHA1_PEM;
+const char mbedtls_test_ca_crt_rsa_sha256_pem[] = TEST_CA_CRT_RSA_SHA256_PEM;
 
-const unsigned char mbedtls_test_ca_crt_ec_der[]   = TEST_CA_CRT_EC_DER;
-const unsigned char mbedtls_test_ca_key_ec_der[]   = TEST_CA_KEY_EC_DER;
-const unsigned char mbedtls_test_ca_key_rsa_der[]  = TEST_CA_KEY_RSA_DER;
-const unsigned char mbedtls_test_ca_crt_rsa_sha1_der[]   =
+const unsigned char mbedtls_test_ca_crt_ec_der[] = TEST_CA_CRT_EC_DER;
+const unsigned char mbedtls_test_ca_key_ec_der[] = TEST_CA_KEY_EC_DER;
+const unsigned char mbedtls_test_ca_key_rsa_der[] = TEST_CA_KEY_RSA_DER;
+const unsigned char mbedtls_test_ca_crt_rsa_sha1_der[] =
     TEST_CA_CRT_RSA_SHA1_DER;
 const unsigned char mbedtls_test_ca_crt_rsa_sha256_der[] =
     TEST_CA_CRT_RSA_SHA256_DER;
 
 const size_t mbedtls_test_ca_crt_ec_pem_len =
-    sizeof( mbedtls_test_ca_crt_ec_pem );
+    sizeof(mbedtls_test_ca_crt_ec_pem);
 const size_t mbedtls_test_ca_key_ec_pem_len =
-    sizeof( mbedtls_test_ca_key_ec_pem );
+    sizeof(mbedtls_test_ca_key_ec_pem);
 const size_t mbedtls_test_ca_pwd_ec_pem_len =
-    sizeof( mbedtls_test_ca_pwd_ec_pem ) - 1;
+    sizeof(mbedtls_test_ca_pwd_ec_pem) - 1;
 const size_t mbedtls_test_ca_key_rsa_pem_len =
-    sizeof( mbedtls_test_ca_key_rsa_pem );
+    sizeof(mbedtls_test_ca_key_rsa_pem);
 const size_t mbedtls_test_ca_pwd_rsa_pem_len =
-    sizeof( mbedtls_test_ca_pwd_rsa_pem ) - 1;
+    sizeof(mbedtls_test_ca_pwd_rsa_pem) - 1;
 const size_t mbedtls_test_ca_crt_rsa_sha1_pem_len =
-    sizeof( mbedtls_test_ca_crt_rsa_sha1_pem );
+    sizeof(mbedtls_test_ca_crt_rsa_sha1_pem);
 const size_t mbedtls_test_ca_crt_rsa_sha256_pem_len =
-    sizeof( mbedtls_test_ca_crt_rsa_sha256_pem );
+    sizeof(mbedtls_test_ca_crt_rsa_sha256_pem);
 
 const size_t mbedtls_test_ca_crt_ec_der_len =
-    sizeof( mbedtls_test_ca_crt_ec_der );
+    sizeof(mbedtls_test_ca_crt_ec_der);
 const size_t mbedtls_test_ca_key_ec_der_len =
-    sizeof( mbedtls_test_ca_key_ec_der );
+    sizeof(mbedtls_test_ca_key_ec_der);
 const size_t mbedtls_test_ca_pwd_ec_der_len = 0;
 const size_t mbedtls_test_ca_key_rsa_der_len =
-    sizeof( mbedtls_test_ca_key_rsa_der );
+    sizeof(mbedtls_test_ca_key_rsa_der);
 const size_t mbedtls_test_ca_pwd_rsa_der_len = 0;
 const size_t mbedtls_test_ca_crt_rsa_sha1_der_len =
-    sizeof( mbedtls_test_ca_crt_rsa_sha1_der );
+    sizeof(mbedtls_test_ca_crt_rsa_sha1_der);
 const size_t mbedtls_test_ca_crt_rsa_sha256_der_len =
-    sizeof( mbedtls_test_ca_crt_rsa_sha256_der );
+    sizeof(mbedtls_test_ca_crt_rsa_sha256_der);
 
 /*
  * Server
  */
 
-const char mbedtls_test_srv_crt_ec_pem[]           = TEST_SRV_CRT_EC_PEM;
-const char mbedtls_test_srv_key_ec_pem[]           = TEST_SRV_KEY_EC_PEM;
-const char mbedtls_test_srv_pwd_ec_pem[]           = "";
-const char mbedtls_test_srv_key_rsa_pem[]          = TEST_SRV_KEY_RSA_PEM;
-const char mbedtls_test_srv_pwd_rsa_pem[]          = "";
-const char mbedtls_test_srv_crt_rsa_sha1_pem[]     = TEST_SRV_CRT_RSA_SHA1_PEM;
-const char mbedtls_test_srv_crt_rsa_sha256_pem[]   = TEST_SRV_CRT_RSA_SHA256_PEM;
+const char mbedtls_test_srv_crt_ec_pem[] = TEST_SRV_CRT_EC_PEM;
+const char mbedtls_test_srv_key_ec_pem[] = TEST_SRV_KEY_EC_PEM;
+const char mbedtls_test_srv_pwd_ec_pem[] = "";
+const char mbedtls_test_srv_key_rsa_pem[] = TEST_SRV_KEY_RSA_PEM;
+const char mbedtls_test_srv_pwd_rsa_pem[] = "";
+const char mbedtls_test_srv_crt_rsa_sha1_pem[] = TEST_SRV_CRT_RSA_SHA1_PEM;
+const char mbedtls_test_srv_crt_rsa_sha256_pem[] = TEST_SRV_CRT_RSA_SHA256_PEM;
 
-const unsigned char mbedtls_test_srv_crt_ec_der[]   = TEST_SRV_CRT_EC_DER;
-const unsigned char mbedtls_test_srv_key_ec_der[]   = TEST_SRV_KEY_EC_DER;
-const unsigned char mbedtls_test_srv_key_rsa_der[]  = TEST_SRV_KEY_RSA_DER;
-const unsigned char mbedtls_test_srv_crt_rsa_sha1_der[]   =
+const unsigned char mbedtls_test_srv_crt_ec_der[] = TEST_SRV_CRT_EC_DER;
+const unsigned char mbedtls_test_srv_key_ec_der[] = TEST_SRV_KEY_EC_DER;
+const unsigned char mbedtls_test_srv_key_rsa_der[] = TEST_SRV_KEY_RSA_DER;
+const unsigned char mbedtls_test_srv_crt_rsa_sha1_der[] =
     TEST_SRV_CRT_RSA_SHA1_DER;
 const unsigned char mbedtls_test_srv_crt_rsa_sha256_der[] =
     TEST_SRV_CRT_RSA_SHA256_DER;
 
 const size_t mbedtls_test_srv_crt_ec_pem_len =
-    sizeof( mbedtls_test_srv_crt_ec_pem );
+    sizeof(mbedtls_test_srv_crt_ec_pem);
 const size_t mbedtls_test_srv_key_ec_pem_len =
-    sizeof( mbedtls_test_srv_key_ec_pem );
+    sizeof(mbedtls_test_srv_key_ec_pem);
 const size_t mbedtls_test_srv_pwd_ec_pem_len =
-    sizeof( mbedtls_test_srv_pwd_ec_pem ) - 1;
+    sizeof(mbedtls_test_srv_pwd_ec_pem) - 1;
 const size_t mbedtls_test_srv_key_rsa_pem_len =
-    sizeof( mbedtls_test_srv_key_rsa_pem );
+    sizeof(mbedtls_test_srv_key_rsa_pem);
 const size_t mbedtls_test_srv_pwd_rsa_pem_len =
-    sizeof( mbedtls_test_srv_pwd_rsa_pem ) - 1;
+    sizeof(mbedtls_test_srv_pwd_rsa_pem) - 1;
 const size_t mbedtls_test_srv_crt_rsa_sha1_pem_len =
-    sizeof( mbedtls_test_srv_crt_rsa_sha1_pem );
+    sizeof(mbedtls_test_srv_crt_rsa_sha1_pem);
 const size_t mbedtls_test_srv_crt_rsa_sha256_pem_len =
-    sizeof( mbedtls_test_srv_crt_rsa_sha256_pem );
+    sizeof(mbedtls_test_srv_crt_rsa_sha256_pem);
 
 const size_t mbedtls_test_srv_crt_ec_der_len =
-    sizeof( mbedtls_test_srv_crt_ec_der );
+    sizeof(mbedtls_test_srv_crt_ec_der);
 const size_t mbedtls_test_srv_key_ec_der_len =
-    sizeof( mbedtls_test_srv_key_ec_der );
+    sizeof(mbedtls_test_srv_key_ec_der);
 const size_t mbedtls_test_srv_pwd_ec_der_len = 0;
 const size_t mbedtls_test_srv_key_rsa_der_len =
-    sizeof( mbedtls_test_srv_key_rsa_der );
+    sizeof(mbedtls_test_srv_key_rsa_der);
 const size_t mbedtls_test_srv_pwd_rsa_der_len = 0;
 const size_t mbedtls_test_srv_crt_rsa_sha1_der_len =
-    sizeof( mbedtls_test_srv_crt_rsa_sha1_der );
+    sizeof(mbedtls_test_srv_crt_rsa_sha1_der);
 const size_t mbedtls_test_srv_crt_rsa_sha256_der_len =
-    sizeof( mbedtls_test_srv_crt_rsa_sha256_der );
+    sizeof(mbedtls_test_srv_crt_rsa_sha256_der);
 
 /*
  * Client
  */
 
-const char mbedtls_test_cli_crt_ec_pem[]   = TEST_CLI_CRT_EC_PEM;
-const char mbedtls_test_cli_key_ec_pem[]   = TEST_CLI_KEY_EC_PEM;
-const char mbedtls_test_cli_pwd_ec_pem[]   = "";
-const char mbedtls_test_cli_key_rsa_pem[]  = TEST_CLI_KEY_RSA_PEM;
-const char mbedtls_test_cli_pwd_rsa_pem[]  = "";
-const char mbedtls_test_cli_crt_rsa_pem[]  = TEST_CLI_CRT_RSA_PEM;
+const char mbedtls_test_cli_crt_ec_pem[] = TEST_CLI_CRT_EC_PEM;
+const char mbedtls_test_cli_key_ec_pem[] = TEST_CLI_KEY_EC_PEM;
+const char mbedtls_test_cli_pwd_ec_pem[] = "";
+const char mbedtls_test_cli_key_rsa_pem[] = TEST_CLI_KEY_RSA_PEM;
+const char mbedtls_test_cli_pwd_rsa_pem[] = "";
+const char mbedtls_test_cli_crt_rsa_pem[] = TEST_CLI_CRT_RSA_PEM;
 
-const unsigned char mbedtls_test_cli_crt_ec_der[]   = TEST_CLI_CRT_EC_DER;
-const unsigned char mbedtls_test_cli_key_ec_der[]   = TEST_CLI_KEY_EC_DER;
-const unsigned char mbedtls_test_cli_key_rsa_der[]  = TEST_CLI_KEY_RSA_DER;
-const unsigned char mbedtls_test_cli_crt_rsa_der[]  = TEST_CLI_CRT_RSA_DER;
+const unsigned char mbedtls_test_cli_crt_ec_der[] = TEST_CLI_CRT_EC_DER;
+const unsigned char mbedtls_test_cli_key_ec_der[] = TEST_CLI_KEY_EC_DER;
+const unsigned char mbedtls_test_cli_key_rsa_der[] = TEST_CLI_KEY_RSA_DER;
+const unsigned char mbedtls_test_cli_crt_rsa_der[] = TEST_CLI_CRT_RSA_DER;
 
 const size_t mbedtls_test_cli_crt_ec_pem_len =
-    sizeof( mbedtls_test_cli_crt_ec_pem );
+    sizeof(mbedtls_test_cli_crt_ec_pem);
 const size_t mbedtls_test_cli_key_ec_pem_len =
-    sizeof( mbedtls_test_cli_key_ec_pem );
+    sizeof(mbedtls_test_cli_key_ec_pem);
 const size_t mbedtls_test_cli_pwd_ec_pem_len =
-    sizeof( mbedtls_test_cli_pwd_ec_pem ) - 1;
+    sizeof(mbedtls_test_cli_pwd_ec_pem) - 1;
 const size_t mbedtls_test_cli_key_rsa_pem_len =
-    sizeof( mbedtls_test_cli_key_rsa_pem );
+    sizeof(mbedtls_test_cli_key_rsa_pem);
 const size_t mbedtls_test_cli_pwd_rsa_pem_len =
-    sizeof( mbedtls_test_cli_pwd_rsa_pem ) - 1;
+    sizeof(mbedtls_test_cli_pwd_rsa_pem) - 1;
 const size_t mbedtls_test_cli_crt_rsa_pem_len =
-    sizeof( mbedtls_test_cli_crt_rsa_pem );
+    sizeof(mbedtls_test_cli_crt_rsa_pem);
 
 const size_t mbedtls_test_cli_crt_ec_der_len =
-    sizeof( mbedtls_test_cli_crt_ec_der );
+    sizeof(mbedtls_test_cli_crt_ec_der);
 const size_t mbedtls_test_cli_key_ec_der_len =
-    sizeof( mbedtls_test_cli_key_ec_der );
+    sizeof(mbedtls_test_cli_key_ec_der);
 const size_t mbedtls_test_cli_key_rsa_der_len =
-    sizeof( mbedtls_test_cli_key_rsa_der );
+    sizeof(mbedtls_test_cli_key_rsa_der);
 const size_t mbedtls_test_cli_crt_rsa_der_len =
-    sizeof( mbedtls_test_cli_crt_rsa_der );
+    sizeof(mbedtls_test_cli_crt_rsa_der);
 
 /*
  *
@@ -1433,151 +1539,135 @@
 
 /* PEM encoded test CA certificates and keys */
 
-#define TEST_CA_KEY_RSA        TEST_CA_KEY_RSA_PEM
-#define TEST_CA_PWD_RSA        TEST_CA_PWD_RSA_PEM
-#define TEST_CA_CRT_RSA_SHA256 TEST_CA_CRT_RSA_SHA256_PEM
-#define TEST_CA_CRT_RSA_SHA1   TEST_CA_CRT_RSA_SHA1_PEM
-#define TEST_CA_KEY_EC         TEST_CA_KEY_EC_PEM
-#define TEST_CA_PWD_EC         TEST_CA_PWD_EC_PEM
-#define TEST_CA_CRT_EC         TEST_CA_CRT_EC_PEM
+#    define TEST_CA_KEY_RSA        TEST_CA_KEY_RSA_PEM
+#    define TEST_CA_PWD_RSA        TEST_CA_PWD_RSA_PEM
+#    define TEST_CA_CRT_RSA_SHA256 TEST_CA_CRT_RSA_SHA256_PEM
+#    define TEST_CA_CRT_RSA_SHA1   TEST_CA_CRT_RSA_SHA1_PEM
+#    define TEST_CA_KEY_EC         TEST_CA_KEY_EC_PEM
+#    define TEST_CA_PWD_EC         TEST_CA_PWD_EC_PEM
+#    define TEST_CA_CRT_EC         TEST_CA_CRT_EC_PEM
 
 /* PEM encoded test server certificates and keys */
 
-#define TEST_SRV_KEY_RSA        TEST_SRV_KEY_RSA_PEM
-#define TEST_SRV_PWD_RSA        ""
-#define TEST_SRV_CRT_RSA_SHA256 TEST_SRV_CRT_RSA_SHA256_PEM
-#define TEST_SRV_CRT_RSA_SHA1   TEST_SRV_CRT_RSA_SHA1_PEM
-#define TEST_SRV_KEY_EC         TEST_SRV_KEY_EC_PEM
-#define TEST_SRV_PWD_EC         ""
-#define TEST_SRV_CRT_EC         TEST_SRV_CRT_EC_PEM
+#    define TEST_SRV_KEY_RSA        TEST_SRV_KEY_RSA_PEM
+#    define TEST_SRV_PWD_RSA        ""
+#    define TEST_SRV_CRT_RSA_SHA256 TEST_SRV_CRT_RSA_SHA256_PEM
+#    define TEST_SRV_CRT_RSA_SHA1   TEST_SRV_CRT_RSA_SHA1_PEM
+#    define TEST_SRV_KEY_EC         TEST_SRV_KEY_EC_PEM
+#    define TEST_SRV_PWD_EC         ""
+#    define TEST_SRV_CRT_EC         TEST_SRV_CRT_EC_PEM
 
 /* PEM encoded test client certificates and keys */
 
-#define TEST_CLI_KEY_RSA  TEST_CLI_KEY_RSA_PEM
-#define TEST_CLI_PWD_RSA  ""
-#define TEST_CLI_CRT_RSA  TEST_CLI_CRT_RSA_PEM
-#define TEST_CLI_KEY_EC   TEST_CLI_KEY_EC_PEM
-#define TEST_CLI_PWD_EC   ""
-#define TEST_CLI_CRT_EC   TEST_CLI_CRT_EC_PEM
+#    define TEST_CLI_KEY_RSA TEST_CLI_KEY_RSA_PEM
+#    define TEST_CLI_PWD_RSA ""
+#    define TEST_CLI_CRT_RSA TEST_CLI_CRT_RSA_PEM
+#    define TEST_CLI_KEY_EC  TEST_CLI_KEY_EC_PEM
+#    define TEST_CLI_PWD_EC  ""
+#    define TEST_CLI_CRT_EC  TEST_CLI_CRT_EC_PEM
 
 #else /* MBEDTLS_PEM_PARSE_C */
 
 /* DER encoded test CA certificates and keys */
 
-#define TEST_CA_KEY_RSA        TEST_CA_KEY_RSA_DER
-#define TEST_CA_PWD_RSA        ""
-#define TEST_CA_CRT_RSA_SHA256 TEST_CA_CRT_RSA_SHA256_DER
-#define TEST_CA_CRT_RSA_SHA1   TEST_CA_CRT_RSA_SHA1_DER
-#define TEST_CA_KEY_EC         TEST_CA_KEY_EC_DER
-#define TEST_CA_PWD_EC         ""
-#define TEST_CA_CRT_EC         TEST_CA_CRT_EC_DER
+#    define TEST_CA_KEY_RSA        TEST_CA_KEY_RSA_DER
+#    define TEST_CA_PWD_RSA        ""
+#    define TEST_CA_CRT_RSA_SHA256 TEST_CA_CRT_RSA_SHA256_DER
+#    define TEST_CA_CRT_RSA_SHA1   TEST_CA_CRT_RSA_SHA1_DER
+#    define TEST_CA_KEY_EC         TEST_CA_KEY_EC_DER
+#    define TEST_CA_PWD_EC         ""
+#    define TEST_CA_CRT_EC         TEST_CA_CRT_EC_DER
 
 /* DER encoded test server certificates and keys */
 
-#define TEST_SRV_KEY_RSA        TEST_SRV_KEY_RSA_DER
-#define TEST_SRV_PWD_RSA        ""
-#define TEST_SRV_CRT_RSA_SHA256 TEST_SRV_CRT_RSA_SHA256_DER
-#define TEST_SRV_CRT_RSA_SHA1   TEST_SRV_CRT_RSA_SHA1_DER
-#define TEST_SRV_KEY_EC         TEST_SRV_KEY_EC_DER
-#define TEST_SRV_PWD_EC         ""
-#define TEST_SRV_CRT_EC         TEST_SRV_CRT_EC_DER
+#    define TEST_SRV_KEY_RSA        TEST_SRV_KEY_RSA_DER
+#    define TEST_SRV_PWD_RSA        ""
+#    define TEST_SRV_CRT_RSA_SHA256 TEST_SRV_CRT_RSA_SHA256_DER
+#    define TEST_SRV_CRT_RSA_SHA1   TEST_SRV_CRT_RSA_SHA1_DER
+#    define TEST_SRV_KEY_EC         TEST_SRV_KEY_EC_DER
+#    define TEST_SRV_PWD_EC         ""
+#    define TEST_SRV_CRT_EC         TEST_SRV_CRT_EC_DER
 
 /* DER encoded test client certificates and keys */
 
-#define TEST_CLI_KEY_RSA  TEST_CLI_KEY_RSA_DER
-#define TEST_CLI_PWD_RSA  ""
-#define TEST_CLI_CRT_RSA  TEST_CLI_CRT_RSA_DER
-#define TEST_CLI_KEY_EC   TEST_CLI_KEY_EC_DER
-#define TEST_CLI_PWD_EC   ""
-#define TEST_CLI_CRT_EC   TEST_CLI_CRT_EC_DER
+#    define TEST_CLI_KEY_RSA TEST_CLI_KEY_RSA_DER
+#    define TEST_CLI_PWD_RSA ""
+#    define TEST_CLI_CRT_RSA TEST_CLI_CRT_RSA_DER
+#    define TEST_CLI_KEY_EC  TEST_CLI_KEY_EC_DER
+#    define TEST_CLI_PWD_EC  ""
+#    define TEST_CLI_CRT_EC  TEST_CLI_CRT_EC_DER
 
 #endif /* MBEDTLS_PEM_PARSE_C */
 
-const char mbedtls_test_ca_key_rsa[]         = TEST_CA_KEY_RSA;
-const char mbedtls_test_ca_pwd_rsa[]         = TEST_CA_PWD_RSA;
-const char mbedtls_test_ca_crt_rsa_sha256[]  = TEST_CA_CRT_RSA_SHA256;
-const char mbedtls_test_ca_crt_rsa_sha1[]    = TEST_CA_CRT_RSA_SHA1;
-const char mbedtls_test_ca_key_ec[]          = TEST_CA_KEY_EC;
-const char mbedtls_test_ca_pwd_ec[]          = TEST_CA_PWD_EC;
-const char mbedtls_test_ca_crt_ec[]          = TEST_CA_CRT_EC;
+const char mbedtls_test_ca_key_rsa[] = TEST_CA_KEY_RSA;
+const char mbedtls_test_ca_pwd_rsa[] = TEST_CA_PWD_RSA;
+const char mbedtls_test_ca_crt_rsa_sha256[] = TEST_CA_CRT_RSA_SHA256;
+const char mbedtls_test_ca_crt_rsa_sha1[] = TEST_CA_CRT_RSA_SHA1;
+const char mbedtls_test_ca_key_ec[] = TEST_CA_KEY_EC;
+const char mbedtls_test_ca_pwd_ec[] = TEST_CA_PWD_EC;
+const char mbedtls_test_ca_crt_ec[] = TEST_CA_CRT_EC;
 
-const char mbedtls_test_srv_key_rsa[]        = TEST_SRV_KEY_RSA;
-const char mbedtls_test_srv_pwd_rsa[]        = TEST_SRV_PWD_RSA;
+const char mbedtls_test_srv_key_rsa[] = TEST_SRV_KEY_RSA;
+const char mbedtls_test_srv_pwd_rsa[] = TEST_SRV_PWD_RSA;
 const char mbedtls_test_srv_crt_rsa_sha256[] = TEST_SRV_CRT_RSA_SHA256;
-const char mbedtls_test_srv_crt_rsa_sha1[]   = TEST_SRV_CRT_RSA_SHA1;
-const char mbedtls_test_srv_key_ec[]         = TEST_SRV_KEY_EC;
-const char mbedtls_test_srv_pwd_ec[]         = TEST_SRV_PWD_EC;
-const char mbedtls_test_srv_crt_ec[]         = TEST_SRV_CRT_EC;
+const char mbedtls_test_srv_crt_rsa_sha1[] = TEST_SRV_CRT_RSA_SHA1;
+const char mbedtls_test_srv_key_ec[] = TEST_SRV_KEY_EC;
+const char mbedtls_test_srv_pwd_ec[] = TEST_SRV_PWD_EC;
+const char mbedtls_test_srv_crt_ec[] = TEST_SRV_CRT_EC;
 
-const char mbedtls_test_cli_key_rsa[]        = TEST_CLI_KEY_RSA;
-const char mbedtls_test_cli_pwd_rsa[]        = TEST_CLI_PWD_RSA;
-const char mbedtls_test_cli_crt_rsa[]        = TEST_CLI_CRT_RSA;
-const char mbedtls_test_cli_key_ec[]         = TEST_CLI_KEY_EC;
-const char mbedtls_test_cli_pwd_ec[]         = TEST_CLI_PWD_EC;
-const char mbedtls_test_cli_crt_ec[]         = TEST_CLI_CRT_EC;
+const char mbedtls_test_cli_key_rsa[] = TEST_CLI_KEY_RSA;
+const char mbedtls_test_cli_pwd_rsa[] = TEST_CLI_PWD_RSA;
+const char mbedtls_test_cli_crt_rsa[] = TEST_CLI_CRT_RSA;
+const char mbedtls_test_cli_key_ec[] = TEST_CLI_KEY_EC;
+const char mbedtls_test_cli_pwd_ec[] = TEST_CLI_PWD_EC;
+const char mbedtls_test_cli_crt_ec[] = TEST_CLI_CRT_EC;
 
-const size_t mbedtls_test_ca_key_rsa_len =
-    sizeof( mbedtls_test_ca_key_rsa );
-const size_t mbedtls_test_ca_pwd_rsa_len =
-    sizeof( mbedtls_test_ca_pwd_rsa ) - 1;
+const size_t mbedtls_test_ca_key_rsa_len = sizeof(mbedtls_test_ca_key_rsa);
+const size_t mbedtls_test_ca_pwd_rsa_len = sizeof(mbedtls_test_ca_pwd_rsa) - 1;
 const size_t mbedtls_test_ca_crt_rsa_sha256_len =
-    sizeof( mbedtls_test_ca_crt_rsa_sha256 );
+    sizeof(mbedtls_test_ca_crt_rsa_sha256);
 const size_t mbedtls_test_ca_crt_rsa_sha1_len =
-    sizeof( mbedtls_test_ca_crt_rsa_sha1 );
-const size_t mbedtls_test_ca_key_ec_len =
-    sizeof( mbedtls_test_ca_key_ec );
-const size_t mbedtls_test_ca_pwd_ec_len =
-    sizeof( mbedtls_test_ca_pwd_ec ) - 1;
-const size_t mbedtls_test_ca_crt_ec_len =
-    sizeof( mbedtls_test_ca_crt_ec );
+    sizeof(mbedtls_test_ca_crt_rsa_sha1);
+const size_t mbedtls_test_ca_key_ec_len = sizeof(mbedtls_test_ca_key_ec);
+const size_t mbedtls_test_ca_pwd_ec_len = sizeof(mbedtls_test_ca_pwd_ec) - 1;
+const size_t mbedtls_test_ca_crt_ec_len = sizeof(mbedtls_test_ca_crt_ec);
 
-const size_t mbedtls_test_srv_key_rsa_len =
-    sizeof( mbedtls_test_srv_key_rsa );
+const size_t mbedtls_test_srv_key_rsa_len = sizeof(mbedtls_test_srv_key_rsa);
 const size_t mbedtls_test_srv_pwd_rsa_len =
-    sizeof( mbedtls_test_srv_pwd_rsa ) -1;
+    sizeof(mbedtls_test_srv_pwd_rsa) - 1;
 const size_t mbedtls_test_srv_crt_rsa_sha256_len =
-    sizeof( mbedtls_test_srv_crt_rsa_sha256 );
+    sizeof(mbedtls_test_srv_crt_rsa_sha256);
 const size_t mbedtls_test_srv_crt_rsa_sha1_len =
-    sizeof( mbedtls_test_srv_crt_rsa_sha1 );
-const size_t mbedtls_test_srv_key_ec_len =
-    sizeof( mbedtls_test_srv_key_ec );
-const size_t mbedtls_test_srv_pwd_ec_len =
-    sizeof( mbedtls_test_srv_pwd_ec ) - 1;
-const size_t mbedtls_test_srv_crt_ec_len =
-    sizeof( mbedtls_test_srv_crt_ec );
+    sizeof(mbedtls_test_srv_crt_rsa_sha1);
+const size_t mbedtls_test_srv_key_ec_len = sizeof(mbedtls_test_srv_key_ec);
+const size_t mbedtls_test_srv_pwd_ec_len = sizeof(mbedtls_test_srv_pwd_ec) - 1;
+const size_t mbedtls_test_srv_crt_ec_len = sizeof(mbedtls_test_srv_crt_ec);
 
-const size_t mbedtls_test_cli_key_rsa_len =
-    sizeof( mbedtls_test_cli_key_rsa );
+const size_t mbedtls_test_cli_key_rsa_len = sizeof(mbedtls_test_cli_key_rsa);
 const size_t mbedtls_test_cli_pwd_rsa_len =
-    sizeof( mbedtls_test_cli_pwd_rsa ) - 1;
-const size_t mbedtls_test_cli_crt_rsa_len =
-    sizeof( mbedtls_test_cli_crt_rsa );
-const size_t mbedtls_test_cli_key_ec_len =
-    sizeof( mbedtls_test_cli_key_ec );
-const size_t mbedtls_test_cli_pwd_ec_len =
-    sizeof( mbedtls_test_cli_pwd_ec ) - 1;
-const size_t mbedtls_test_cli_crt_ec_len =
-    sizeof( mbedtls_test_cli_crt_ec );
+    sizeof(mbedtls_test_cli_pwd_rsa) - 1;
+const size_t mbedtls_test_cli_crt_rsa_len = sizeof(mbedtls_test_cli_crt_rsa);
+const size_t mbedtls_test_cli_key_ec_len = sizeof(mbedtls_test_cli_key_ec);
+const size_t mbedtls_test_cli_pwd_ec_len = sizeof(mbedtls_test_cli_pwd_ec) - 1;
+const size_t mbedtls_test_cli_crt_ec_len = sizeof(mbedtls_test_cli_crt_ec);
 
 /*
  * Dispatch between SHA-1 and SHA-256
  */
 
 #if defined(MBEDTLS_SHA256_C)
-#define TEST_CA_CRT_RSA  TEST_CA_CRT_RSA_SHA256
-#define TEST_SRV_CRT_RSA TEST_SRV_CRT_RSA_SHA256
+#    define TEST_CA_CRT_RSA  TEST_CA_CRT_RSA_SHA256
+#    define TEST_SRV_CRT_RSA TEST_SRV_CRT_RSA_SHA256
 #else
-#define TEST_CA_CRT_RSA  TEST_CA_CRT_RSA_SHA1
-#define TEST_SRV_CRT_RSA TEST_SRV_CRT_RSA_SHA1
+#    define TEST_CA_CRT_RSA  TEST_CA_CRT_RSA_SHA1
+#    define TEST_SRV_CRT_RSA TEST_SRV_CRT_RSA_SHA1
 #endif /* MBEDTLS_SHA256_C */
 
-const char mbedtls_test_ca_crt_rsa[]  = TEST_CA_CRT_RSA;
+const char mbedtls_test_ca_crt_rsa[] = TEST_CA_CRT_RSA;
 const char mbedtls_test_srv_crt_rsa[] = TEST_SRV_CRT_RSA;
 
-const size_t mbedtls_test_ca_crt_rsa_len =
-    sizeof( mbedtls_test_ca_crt_rsa );
-const size_t mbedtls_test_srv_crt_rsa_len =
-    sizeof( mbedtls_test_srv_crt_rsa );
+const size_t mbedtls_test_ca_crt_rsa_len = sizeof(mbedtls_test_ca_crt_rsa);
+const size_t mbedtls_test_srv_crt_rsa_len = sizeof(mbedtls_test_srv_crt_rsa);
 
 /*
  * Dispatch between RSA and EC
@@ -1585,31 +1675,31 @@
 
 #if defined(MBEDTLS_RSA_C)
 
-#define TEST_CA_KEY TEST_CA_KEY_RSA
-#define TEST_CA_PWD TEST_CA_PWD_RSA
-#define TEST_CA_CRT TEST_CA_CRT_RSA
+#    define TEST_CA_KEY TEST_CA_KEY_RSA
+#    define TEST_CA_PWD TEST_CA_PWD_RSA
+#    define TEST_CA_CRT TEST_CA_CRT_RSA
 
-#define TEST_SRV_KEY TEST_SRV_KEY_RSA
-#define TEST_SRV_PWD TEST_SRV_PWD_RSA
-#define TEST_SRV_CRT TEST_SRV_CRT_RSA
+#    define TEST_SRV_KEY TEST_SRV_KEY_RSA
+#    define TEST_SRV_PWD TEST_SRV_PWD_RSA
+#    define TEST_SRV_CRT TEST_SRV_CRT_RSA
 
-#define TEST_CLI_KEY TEST_CLI_KEY_RSA
-#define TEST_CLI_PWD TEST_CLI_PWD_RSA
-#define TEST_CLI_CRT TEST_CLI_CRT_RSA
+#    define TEST_CLI_KEY TEST_CLI_KEY_RSA
+#    define TEST_CLI_PWD TEST_CLI_PWD_RSA
+#    define TEST_CLI_CRT TEST_CLI_CRT_RSA
 
 #else /* no RSA, so assume ECDSA */
 
-#define TEST_CA_KEY TEST_CA_KEY_EC
-#define TEST_CA_PWD TEST_CA_PWD_EC
-#define TEST_CA_CRT TEST_CA_CRT_EC
+#    define TEST_CA_KEY TEST_CA_KEY_EC
+#    define TEST_CA_PWD TEST_CA_PWD_EC
+#    define TEST_CA_CRT TEST_CA_CRT_EC
 
-#define TEST_SRV_KEY TEST_SRV_KEY_EC
-#define TEST_SRV_PWD TEST_SRV_PWD_EC
-#define TEST_SRV_CRT TEST_SRV_CRT_EC
+#    define TEST_SRV_KEY TEST_SRV_KEY_EC
+#    define TEST_SRV_PWD TEST_SRV_PWD_EC
+#    define TEST_SRV_CRT TEST_SRV_CRT_EC
 
-#define TEST_CLI_KEY TEST_CLI_KEY_EC
-#define TEST_CLI_PWD TEST_CLI_PWD_EC
-#define TEST_CLI_CRT TEST_CLI_CRT_EC
+#    define TEST_CLI_KEY TEST_CLI_KEY_EC
+#    define TEST_CLI_PWD TEST_CLI_PWD_EC
+#    define TEST_CLI_CRT TEST_CLI_CRT_EC
 #endif /* MBEDTLS_RSA_C */
 
 /* API stability forces us to declare
@@ -1639,26 +1729,17 @@
 const char *mbedtls_test_cli_pwd = test_cli_pwd;
 const char *mbedtls_test_cli_crt = test_cli_crt;
 
-const size_t mbedtls_test_ca_key_len =
-    sizeof( test_ca_key );
-const size_t mbedtls_test_ca_pwd_len =
-    sizeof( test_ca_pwd ) - 1;
-const size_t mbedtls_test_ca_crt_len =
-    sizeof( test_ca_crt );
+const size_t mbedtls_test_ca_key_len = sizeof(test_ca_key);
+const size_t mbedtls_test_ca_pwd_len = sizeof(test_ca_pwd) - 1;
+const size_t mbedtls_test_ca_crt_len = sizeof(test_ca_crt);
 
-const size_t mbedtls_test_srv_key_len =
-    sizeof( test_srv_key );
-const size_t mbedtls_test_srv_pwd_len =
-    sizeof( test_srv_pwd ) - 1;
-const size_t mbedtls_test_srv_crt_len =
-    sizeof( test_srv_crt );
+const size_t mbedtls_test_srv_key_len = sizeof(test_srv_key);
+const size_t mbedtls_test_srv_pwd_len = sizeof(test_srv_pwd) - 1;
+const size_t mbedtls_test_srv_crt_len = sizeof(test_srv_crt);
 
-const size_t mbedtls_test_cli_key_len =
-    sizeof( test_cli_key );
-const size_t mbedtls_test_cli_pwd_len =
-    sizeof( test_cli_pwd ) - 1;
-const size_t mbedtls_test_cli_crt_len =
-    sizeof( test_cli_crt );
+const size_t mbedtls_test_cli_key_len = sizeof(test_cli_key);
+const size_t mbedtls_test_cli_pwd_len = sizeof(test_cli_pwd) - 1;
+const size_t mbedtls_test_cli_crt_len = sizeof(test_cli_crt);
 
 /*
  *
@@ -1667,7 +1748,7 @@
  */
 
 /* List of CAs in PEM or DER, depending on config */
-const char * mbedtls_test_cas[] = {
+const char *mbedtls_test_cas[] = {
 #if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_SHA1_C)
     mbedtls_test_ca_crt_rsa_sha1,
 #endif
@@ -1681,26 +1762,26 @@
 };
 const size_t mbedtls_test_cas_len[] = {
 #if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_SHA1_C)
-    sizeof( mbedtls_test_ca_crt_rsa_sha1 ),
+    sizeof(mbedtls_test_ca_crt_rsa_sha1),
 #endif
 #if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_SHA256_C)
-    sizeof( mbedtls_test_ca_crt_rsa_sha256 ),
+    sizeof(mbedtls_test_ca_crt_rsa_sha256),
 #endif
 #if defined(MBEDTLS_ECDSA_C)
-    sizeof( mbedtls_test_ca_crt_ec ),
+    sizeof(mbedtls_test_ca_crt_ec),
 #endif
     0
 };
 
 /* List of all available CA certificates in DER format */
-const unsigned char * mbedtls_test_cas_der[] = {
+const unsigned char *mbedtls_test_cas_der[] = {
 #if defined(MBEDTLS_RSA_C)
-#if defined(MBEDTLS_SHA256_C)
+#    if defined(MBEDTLS_SHA256_C)
     mbedtls_test_ca_crt_rsa_sha256_der,
-#endif /* MBEDTLS_SHA256_C */
-#if defined(MBEDTLS_SHA1_C)
+#    endif /* MBEDTLS_SHA256_C */
+#    if defined(MBEDTLS_SHA1_C)
     mbedtls_test_ca_crt_rsa_sha1_der,
-#endif /* MBEDTLS_SHA1_C */
+#    endif /* MBEDTLS_SHA1_C */
 #endif /* MBEDTLS_RSA_C */
 #if defined(MBEDTLS_ECDSA_C)
     mbedtls_test_ca_crt_ec_der,
@@ -1710,15 +1791,15 @@
 
 const size_t mbedtls_test_cas_der_len[] = {
 #if defined(MBEDTLS_RSA_C)
-#if defined(MBEDTLS_SHA256_C)
-    sizeof( mbedtls_test_ca_crt_rsa_sha256_der ),
-#endif /* MBEDTLS_SHA256_C */
-#if defined(MBEDTLS_SHA1_C)
-    sizeof( mbedtls_test_ca_crt_rsa_sha1_der ),
-#endif /* MBEDTLS_SHA1_C */
+#    if defined(MBEDTLS_SHA256_C)
+    sizeof(mbedtls_test_ca_crt_rsa_sha256_der),
+#    endif /* MBEDTLS_SHA256_C */
+#    if defined(MBEDTLS_SHA1_C)
+    sizeof(mbedtls_test_ca_crt_rsa_sha1_der),
+#    endif /* MBEDTLS_SHA1_C */
 #endif /* MBEDTLS_RSA_C */
 #if defined(MBEDTLS_ECDSA_C)
-    sizeof( mbedtls_test_ca_crt_ec_der ),
+    sizeof(mbedtls_test_ca_crt_ec_der),
 #endif /* MBEDTLS_ECDSA_C */
     0
 };
@@ -1726,17 +1807,17 @@
 /* Concatenation of all available CA certificates in PEM format */
 #if defined(MBEDTLS_PEM_PARSE_C)
 const char mbedtls_test_cas_pem[] =
-#if defined(MBEDTLS_RSA_C)
-#if defined(MBEDTLS_SHA256_C)
+#    if defined(MBEDTLS_RSA_C)
+#        if defined(MBEDTLS_SHA256_C)
     TEST_CA_CRT_RSA_SHA256_PEM
-#endif /* MBEDTLS_SHA256_C */
-#if defined(MBEDTLS_SHA1_C)
-    TEST_CA_CRT_RSA_SHA1_PEM
-#endif /* MBEDTLS_SHA1_C */
-#endif /* MBEDTLS_RSA_C */
-#if defined(MBEDTLS_ECDSA_C)
-    TEST_CA_CRT_EC_PEM
-#endif /* MBEDTLS_ECDSA_C */
+#        endif /* MBEDTLS_SHA256_C */
+#        if defined(MBEDTLS_SHA1_C)
+        TEST_CA_CRT_RSA_SHA1_PEM
+#        endif /* MBEDTLS_SHA1_C */
+#    endif /* MBEDTLS_RSA_C */
+#    if defined(MBEDTLS_ECDSA_C)
+            TEST_CA_CRT_EC_PEM
+#    endif /* MBEDTLS_ECDSA_C */
     "";
-const size_t mbedtls_test_cas_pem_len = sizeof( mbedtls_test_cas_pem );
+const size_t mbedtls_test_cas_pem_len = sizeof(mbedtls_test_cas_pem);
 #endif /* MBEDTLS_PEM_PARSE_C */
diff --git a/tests/src/drivers/hash.c b/tests/src/drivers/hash.c
index d57ce6c..e23c6fa 100644
--- a/tests/src/drivers/hash.c
+++ b/tests/src/drivers/hash.c
@@ -20,138 +20,121 @@
 #include <test/helpers.h>
 
 #if defined(MBEDTLS_PSA_CRYPTO_DRIVERS) && defined(PSA_CRYPTO_DRIVER_TEST)
-#include "psa_crypto_hash.h"
+#    include "psa_crypto_hash.h"
 
-#include "test/drivers/hash.h"
+#    include "test/drivers/hash.h"
 
-mbedtls_test_driver_hash_hooks_t
-    mbedtls_test_driver_hash_hooks = MBEDTLS_TEST_DRIVER_HASH_INIT;
+mbedtls_test_driver_hash_hooks_t mbedtls_test_driver_hash_hooks =
+    MBEDTLS_TEST_DRIVER_HASH_INIT;
 
-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 )
+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)
 {
     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 {
         mbedtls_test_driver_hash_hooks.driver_status =
             mbedtls_transparent_test_driver_hash_compute(
-                alg, input, input_length,
-                hash, hash_size, hash_length );
+                alg, input, input_length, hash, hash_size, hash_length);
     }
 
-    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 (mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS) {
         mbedtls_test_driver_hash_hooks.driver_status =
-            mbedtls_transparent_test_driver_hash_setup( operation, alg );
+            mbedtls_test_driver_hash_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_hash_hooks.driver_status =
+            mbedtls_transparent_test_driver_hash_setup(operation, alg);
     }
 
-    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 (mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS) {
         mbedtls_test_driver_hash_hooks.driver_status =
-            mbedtls_transparent_test_driver_hash_clone( source_operation,
-                                                        target_operation );
+            mbedtls_test_driver_hash_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_hash_hooks.driver_status =
+            mbedtls_transparent_test_driver_hash_clone(source_operation,
+                                                       target_operation);
     }
 
-    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_transparent_test_driver_hash_update(
-                operation, input, input_length );
+            mbedtls_test_driver_hash_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_hash_hooks.driver_status =
+            mbedtls_transparent_test_driver_hash_update(operation, input,
+                                                        input_length);
     }
 
-    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_transparent_test_driver_hash_finish(
-                operation, hash, hash_size, hash_length );
+            mbedtls_test_driver_hash_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_hash_hooks.driver_status =
+            mbedtls_transparent_test_driver_hash_finish(operation, hash,
+                                                        hash_size, hash_length);
     }
 
-    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 (mbedtls_test_driver_hash_hooks.forced_status != PSA_SUCCESS) {
         mbedtls_test_driver_hash_hooks.driver_status =
-            mbedtls_transparent_test_driver_hash_abort( operation );
+            mbedtls_test_driver_hash_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_hash_hooks.driver_status =
+            mbedtls_transparent_test_driver_hash_abort(operation);
     }
 
-    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 6d125a0..072f465 100644
--- a/tests/src/drivers/platform_builtin_keys.c
+++ b/tests/src/drivers/platform_builtin_keys.c
@@ -26,11 +26,10 @@
 #include <psa/crypto_extra.h>
 
 #if defined(PSA_CRYPTO_DRIVER_TEST)
-#include <test/drivers/test_driver.h>
+#    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;
@@ -42,52 +41,56 @@
      * 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_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_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 76afcd7..4cc7751 100644
--- a/tests/src/drivers/test_driver_aead.c
+++ b/tests/src/drivers/test_driver_aead.c
@@ -20,73 +20,71 @@
 #include <test/helpers.h>
 
 #if defined(MBEDTLS_PSA_CRYPTO_DRIVERS) && defined(PSA_CRYPTO_DRIVER_TEST)
-#include "psa_crypto_aead.h"
+#    include "psa_crypto_aead.h"
 
-#include "test/drivers/aead.h"
+#    include "test/drivers/aead.h"
 
-mbedtls_test_driver_aead_hooks_t
-    mbedtls_test_driver_aead_hooks = MBEDTLS_TEST_DRIVER_AEAD_INIT;
+mbedtls_test_driver_aead_hooks_t mbedtls_test_driver_aead_hooks =
+    MBEDTLS_TEST_DRIVER_AEAD_INIT;
 
-psa_status_t mbedtls_test_transparent_aead_encrypt(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key_buffer, size_t key_buffer_size,
-    psa_algorithm_t alg,
-    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 )
+psa_status_t
+mbedtls_test_transparent_aead_encrypt(const psa_key_attributes_t *attributes,
+                                      const uint8_t *key_buffer,
+                                      size_t key_buffer_size,
+                                      psa_algorithm_t alg,
+                                      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)
 {
     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_psa_aead_encrypt(
-                attributes, key_buffer, key_buffer_size,
-                alg,
-                nonce, nonce_length,
-                additional_data, additional_data_length,
-                plaintext, plaintext_length,
-                ciphertext, ciphertext_size, ciphertext_length );
+            mbedtls_test_driver_aead_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_aead_hooks.driver_status = mbedtls_psa_aead_encrypt(
+            attributes, key_buffer, key_buffer_size, alg, nonce, nonce_length,
+            additional_data, additional_data_length, plaintext,
+            plaintext_length, ciphertext, ciphertext_size, ciphertext_length);
     }
 
-    return mbedtls_test_driver_aead_hooks.driver_status ;
+    return mbedtls_test_driver_aead_hooks.driver_status;
 }
 
-psa_status_t mbedtls_test_transparent_aead_decrypt(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key_buffer, size_t key_buffer_size,
-    psa_algorithm_t alg,
-    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 )
+psa_status_t
+mbedtls_test_transparent_aead_decrypt(const psa_key_attributes_t *attributes,
+                                      const uint8_t *key_buffer,
+                                      size_t key_buffer_size,
+                                      psa_algorithm_t alg,
+                                      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)
 {
     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_psa_aead_decrypt(
-                attributes, key_buffer, key_buffer_size,
-                alg,
-                nonce, nonce_length,
-                additional_data, additional_data_length,
-                ciphertext, ciphertext_length,
-                plaintext, plaintext_size, plaintext_length );
+            mbedtls_test_driver_aead_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_aead_hooks.driver_status = mbedtls_psa_aead_decrypt(
+            attributes, key_buffer, key_buffer_size, alg, nonce, nonce_length,
+            additional_data, additional_data_length, ciphertext,
+            ciphertext_length, plaintext, plaintext_size, plaintext_length);
     }
 
-    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 20d79d8..0f369ba 100644
--- a/tests/src/drivers/test_driver_cipher.c
+++ b/tests/src/drivers/test_driver_cipher.c
@@ -21,96 +21,92 @@
 #include <test/helpers.h>
 
 #if defined(MBEDTLS_PSA_CRYPTO_DRIVERS) && defined(PSA_CRYPTO_DRIVER_TEST)
-#include "psa/crypto.h"
-#include "psa_crypto_cipher.h"
-#include "psa_crypto_core.h"
-#include "mbedtls/cipher.h"
+#    include "psa/crypto.h"
+#    include "psa_crypto_cipher.h"
+#    include "psa_crypto_core.h"
+#    include "mbedtls/cipher.h"
 
-#include "test/drivers/cipher.h"
+#    include "test/drivers/cipher.h"
 
-#include "test/random.h"
+#    include "test/random.h"
 
-#include <string.h>
+#    include <string.h>
 
 mbedtls_test_driver_cipher_hooks_t mbedtls_test_driver_cipher_hooks =
     MBEDTLS_TEST_DRIVER_CIPHER_INIT;
 
-psa_status_t mbedtls_test_transparent_cipher_encrypt(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key_buffer,
-    size_t key_buffer_size,
-    psa_algorithm_t alg,
-    const uint8_t *input,
-    size_t input_length,
-    uint8_t *output,
-    size_t output_size,
-    size_t *output_length )
+psa_status_t
+mbedtls_test_transparent_cipher_encrypt(const psa_key_attributes_t *attributes,
+                                        const uint8_t *key_buffer,
+                                        size_t key_buffer_size,
+                                        psa_algorithm_t alg,
+                                        const uint8_t *input,
+                                        size_t input_length,
+                                        uint8_t *output,
+                                        size_t output_size,
+                                        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;
 
-    psa_generate_random( output, PSA_CIPHER_IV_LENGTH( attributes->core.type, alg ) );
+    psa_generate_random(output,
+                        PSA_CIPHER_IV_LENGTH(attributes->core.type, alg));
 
-    return( mbedtls_transparent_test_driver_cipher_encrypt(
-                attributes, key_buffer, key_buffer_size,
-                alg, input, input_length,
-                output, output_size, output_length ) );
+    return (mbedtls_transparent_test_driver_cipher_encrypt(
+        attributes, key_buffer, key_buffer_size, alg, input, input_length,
+        output, output_size, output_length));
 }
 
-psa_status_t mbedtls_test_transparent_cipher_decrypt(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key_buffer,
-    size_t key_buffer_size,
-    psa_algorithm_t alg,
-    const uint8_t *input,
-    size_t input_length,
-    uint8_t *output,
-    size_t output_size,
-    size_t *output_length )
+psa_status_t
+mbedtls_test_transparent_cipher_decrypt(const psa_key_attributes_t *attributes,
+                                        const uint8_t *key_buffer,
+                                        size_t key_buffer_size,
+                                        psa_algorithm_t alg,
+                                        const uint8_t *input,
+                                        size_t input_length,
+                                        uint8_t *output,
+                                        size_t output_size,
+                                        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;
 
-    return( mbedtls_transparent_test_driver_cipher_decrypt(
-                attributes, key_buffer, key_buffer_size,
-                alg, input, input_length,
-                output, output_size, output_length ) );
+    return (mbedtls_transparent_test_driver_cipher_decrypt(
+        attributes, key_buffer, key_buffer_size, alg, input, input_length,
+        output, output_size, output_length));
 }
 
 psa_status_t mbedtls_test_transparent_cipher_encrypt_setup(
     mbedtls_transparent_test_driver_cipher_operation_t *operation,
     const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
+    const uint8_t *key,
+    size_t key_length,
     psa_algorithm_t alg)
 {
     mbedtls_test_driver_cipher_hooks.hits++;
@@ -119,28 +115,29 @@
      * 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;
 
-    return ( mbedtls_transparent_test_driver_cipher_encrypt_setup(
-                 operation, attributes, key, key_length, alg ) );
+    return (mbedtls_transparent_test_driver_cipher_encrypt_setup(
+        operation, attributes, key, key_length, alg));
 }
 
 psa_status_t mbedtls_test_transparent_cipher_decrypt_setup(
     mbedtls_transparent_test_driver_cipher_operation_t *operation,
     const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
+    const uint8_t *key,
+    size_t key_length,
     psa_algorithm_t alg)
 {
     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;
 
-    return ( mbedtls_transparent_test_driver_cipher_decrypt_setup(
-                 operation, attributes, key, key_length, alg ) );
+    return (mbedtls_transparent_test_driver_cipher_decrypt_setup(
+        operation, attributes, key, key_length, alg));
 }
 
 psa_status_t mbedtls_test_transparent_cipher_abort(
@@ -148,18 +145,18 @@
 {
     mbedtls_test_driver_cipher_hooks.hits++;
 
-    if( operation->alg == 0 )
-        return PSA_SUCCESS ;
+    if (operation->alg == 0)
+        return PSA_SUCCESS;
 
-    mbedtls_transparent_test_driver_cipher_abort( operation );
+    mbedtls_transparent_test_driver_cipher_abort(operation);
 
     /* 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(
@@ -169,11 +166,11 @@
 {
     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;
 
-    return( mbedtls_transparent_test_driver_cipher_set_iv(
-                operation, iv, iv_length ) );
+    return (mbedtls_transparent_test_driver_cipher_set_iv(operation, iv,
+                                                          iv_length));
 }
 
 psa_status_t mbedtls_test_transparent_cipher_update(
@@ -186,25 +183,22 @@
 {
     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;
 
-    return( mbedtls_transparent_test_driver_cipher_update(
-                operation, input, input_length,
-                output, output_size, output_length ) );
+    return (mbedtls_transparent_test_driver_cipher_update(
+        operation, input, input_length, output, output_size, output_length));
 }
 
 psa_status_t mbedtls_test_transparent_cipher_finish(
@@ -215,100 +209,108 @@
 {
     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;
 
-    return( mbedtls_transparent_test_driver_cipher_finish(
-                operation, output, output_size, output_length ) );
+    return (mbedtls_transparent_test_driver_cipher_finish(
+        operation, output, output_size, output_length));
 }
 
 /*
  * opaque versions, to do
  */
-psa_status_t mbedtls_test_opaque_cipher_encrypt(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
-    psa_algorithm_t alg,
-    const uint8_t *input, size_t input_length,
-    uint8_t *output, size_t output_size, size_t *output_length)
+psa_status_t
+mbedtls_test_opaque_cipher_encrypt(const psa_key_attributes_t *attributes,
+                                   const uint8_t *key,
+                                   size_t key_length,
+                                   psa_algorithm_t alg,
+                                   const uint8_t *input,
+                                   size_t input_length,
+                                   uint8_t *output,
+                                   size_t output_size,
+                                   size_t *output_length)
 {
-    (void) attributes;
-    (void) key;
-    (void) key_length;
-    (void) alg;
-    (void) input;
-    (void) input_length;
-    (void) output;
-    (void) output_size;
-    (void) output_length;
-    return PSA_ERROR_NOT_SUPPORTED ;
+    (void)attributes;
+    (void)key;
+    (void)key_length;
+    (void)alg;
+    (void)input;
+    (void)input_length;
+    (void)output;
+    (void)output_size;
+    (void)output_length;
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
-psa_status_t mbedtls_test_opaque_cipher_decrypt(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
-    psa_algorithm_t alg,
-    const uint8_t *input, size_t input_length,
-    uint8_t *output, size_t output_size, size_t *output_length)
+psa_status_t
+mbedtls_test_opaque_cipher_decrypt(const psa_key_attributes_t *attributes,
+                                   const uint8_t *key,
+                                   size_t key_length,
+                                   psa_algorithm_t alg,
+                                   const uint8_t *input,
+                                   size_t input_length,
+                                   uint8_t *output,
+                                   size_t output_size,
+                                   size_t *output_length)
 {
-    (void) attributes;
-    (void) key;
-    (void) key_length;
-    (void) alg;
-    (void) input;
-    (void) input_length;
-    (void) output;
-    (void) output_size;
-    (void) output_length;
-    return PSA_ERROR_NOT_SUPPORTED ;
+    (void)attributes;
+    (void)key;
+    (void)key_length;
+    (void)alg;
+    (void)input;
+    (void)input_length;
+    (void)output;
+    (void)output_size;
+    (void)output_length;
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_cipher_encrypt_setup(
     mbedtls_opaque_test_driver_cipher_operation_t *operation,
     const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
+    const uint8_t *key,
+    size_t key_length,
     psa_algorithm_t alg)
 {
-    (void) operation;
-    (void) attributes;
-    (void) key;
-    (void) key_length;
-    (void) alg;
-    return PSA_ERROR_NOT_SUPPORTED ;
+    (void)operation;
+    (void)attributes;
+    (void)key;
+    (void)key_length;
+    (void)alg;
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_cipher_decrypt_setup(
     mbedtls_opaque_test_driver_cipher_operation_t *operation,
     const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
+    const uint8_t *key,
+    size_t key_length,
     psa_algorithm_t alg)
 {
-    (void) operation;
-    (void) attributes;
-    (void) key;
-    (void) key_length;
-    (void) alg;
-    return PSA_ERROR_NOT_SUPPORTED ;
+    (void)operation;
+    (void)attributes;
+    (void)key;
+    (void)key_length;
+    (void)alg;
+    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 ;
+    (void)operation;
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_cipher_set_iv(
@@ -316,10 +318,10 @@
     const uint8_t *iv,
     size_t iv_length)
 {
-    (void) operation;
-    (void) iv;
-    (void) iv_length;
-    return PSA_ERROR_NOT_SUPPORTED ;
+    (void)operation;
+    (void)iv;
+    (void)iv_length;
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_cipher_update(
@@ -330,13 +332,13 @@
     size_t output_size,
     size_t *output_length)
 {
-    (void) operation;
-    (void) input;
-    (void) input_length;
-    (void) output;
-    (void) output_size;
-    (void) output_length;
-    return PSA_ERROR_NOT_SUPPORTED ;
+    (void)operation;
+    (void)input;
+    (void)input_length;
+    (void)output;
+    (void)output_size;
+    (void)output_length;
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_opaque_cipher_finish(
@@ -345,10 +347,10 @@
     size_t output_size,
     size_t *output_length)
 {
-    (void) operation;
-    (void) output;
-    (void) output_size;
-    (void) output_length;
-    return PSA_ERROR_NOT_SUPPORTED ;
+    (void)operation;
+    (void)output;
+    (void)output_size;
+    (void)output_length;
+    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 d2bc9b8..dd1b206 100644
--- a/tests/src/drivers/test_driver_key_management.c
+++ b/tests/src/drivers/test_driver_key_management.c
@@ -21,136 +21,130 @@
 #include <test/helpers.h>
 
 #if defined(MBEDTLS_PSA_CRYPTO_DRIVERS) && defined(PSA_CRYPTO_DRIVER_TEST)
-#include "psa/crypto.h"
-#include "psa_crypto_core.h"
-#include "psa_crypto_ecp.h"
-#include "psa_crypto_rsa.h"
-#include "mbedtls/ecp.h"
-#include "mbedtls/error.h"
+#    include "psa/crypto.h"
+#    include "psa_crypto_core.h"
+#    include "psa_crypto_ecp.h"
+#    include "psa_crypto_rsa.h"
+#    include "mbedtls/ecp.h"
+#    include "mbedtls/error.h"
 
-#include "test/drivers/key_management.h"
+#    include "test/drivers/key_management.h"
 
-#include "test/random.h"
+#    include "test/random.h"
 
-#include <string.h>
+#    include <string.h>
 
 mbedtls_test_driver_key_management_hooks_t
-    mbedtls_test_driver_key_management_hooks = MBEDTLS_TEST_DRIVER_KEY_MANAGEMENT_INIT;
+    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 };
-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 };
-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 };
+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 };
+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
+};
+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
+};
 
-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 )
+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)
 {
     ++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 );
-        *key_length = mbedtls_test_driver_key_management_hooks.forced_output_length;
-        return PSA_SUCCESS ;
+    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;
     }
 
     /* Copied from psa_crypto.c */
-#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR)
-    if ( PSA_KEY_TYPE_IS_ECC( psa_get_key_type( attributes ) )
-         && PSA_KEY_TYPE_IS_KEY_PAIR( psa_get_key_type( attributes ) ) )
-    {
-        return( mbedtls_transparent_test_driver_ecp_generate_key(
-                    attributes, key, key_size, key_length ) );
-    }
-    else
-#endif /* defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR) */
+#    if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR)
+    if (PSA_KEY_TYPE_IS_ECC(psa_get_key_type(attributes)) &&
+        PSA_KEY_TYPE_IS_KEY_PAIR(psa_get_key_type(attributes))) {
+        return (mbedtls_transparent_test_driver_ecp_generate_key(
+            attributes, key, key_size, key_length));
+    } else
+#    endif /* defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR) */
 
-#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR)
-    if ( psa_get_key_type( attributes ) == PSA_KEY_TYPE_RSA_KEY_PAIR )
-        return( mbedtls_transparent_test_driver_rsa_generate_key(
-                    attributes, key, key_size, key_length ) );
+#    if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR)
+        if (psa_get_key_type(attributes) == PSA_KEY_TYPE_RSA_KEY_PAIR)
+        return (mbedtls_transparent_test_driver_rsa_generate_key(
+            attributes, key, key_size, key_length));
     else
-#endif /* defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR) */
+#    endif /* defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR) */
     {
         (void)attributes;
-        return PSA_ERROR_NOT_SUPPORTED ;
+        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 )
+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)
 {
-    (void) attributes;
-    (void) key;
-    (void) key_size;
-    (void) key_length;
-    return PSA_ERROR_NOT_SUPPORTED ;
+    (void)attributes;
+    (void)key;
+    (void)key_size;
+    (void)key_length;
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
-psa_status_t mbedtls_test_transparent_import_key(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *data,
-    size_t data_length,
-    uint8_t *key_buffer,
-    size_t key_buffer_size,
-    size_t *key_buffer_length,
-    size_t *bits)
+psa_status_t
+mbedtls_test_transparent_import_key(const psa_key_attributes_t *attributes,
+                                    const uint8_t *data,
+                                    size_t data_length,
+                                    uint8_t *key_buffer,
+                                    size_t key_buffer_size,
+                                    size_t *key_buffer_length,
+                                    size_t *bits)
 {
     ++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;
 
     psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
-    psa_key_type_t type = psa_get_key_type( attributes );
+    psa_key_type_t type = psa_get_key_type(attributes);
 
-#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR) || \
-    defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY)
-    if( PSA_KEY_TYPE_IS_ECC( type ) )
-    {
+#    if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR) || \
+        defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY)
+    if (PSA_KEY_TYPE_IS_ECC(type)) {
         status = mbedtls_transparent_test_driver_ecp_import_key(
-                     attributes,
-                     data, data_length,
-                     key_buffer, key_buffer_size,
-                     key_buffer_length, bits );
-    }
-    else
-#endif
-#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR) || \
-    defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY)
-    if( PSA_KEY_TYPE_IS_RSA( type ) )
-    {
+            attributes, data, data_length, key_buffer, key_buffer_size,
+            key_buffer_length, bits);
+    } else
+#    endif
+#    if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR) || \
+        defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY)
+        if (PSA_KEY_TYPE_IS_RSA(type)) {
         status = mbedtls_transparent_test_driver_rsa_import_key(
-                     attributes,
-                     data, data_length,
-                     key_buffer, key_buffer_size,
-                     key_buffer_length, bits );
-    }
-    else
-#endif
+            attributes, data, data_length, key_buffer, key_buffer_size,
+            key_buffer_length, bits);
+    } else
+#    endif
     {
         status = PSA_ERROR_NOT_SUPPORTED;
         (void)data;
@@ -162,120 +156,118 @@
         (void)type;
     }
 
-    return status ;
+    return status;
 }
 
-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 )
+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)
 {
-    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 );
+    psa_drv_slot_number_t slot_number = *((psa_drv_slot_number_t *)key);
 
-    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 )
+    const uint8_t *key_buffer,
+    size_t key_buffer_size,
+    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 );
-        *data_length = mbedtls_test_driver_key_management_hooks.forced_output_length;
-        return PSA_SUCCESS ;
+    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;
     }
 
     psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
-    psa_key_type_t key_type = psa_get_key_type( attributes );
+    psa_key_type_t key_type = psa_get_key_type(attributes);
 
-#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR) || \
-    defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY)
-    if( PSA_KEY_TYPE_IS_ECC( key_type ) )
-    {
+#    if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR) || \
+        defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY)
+    if (PSA_KEY_TYPE_IS_ECC(key_type)) {
         status = mbedtls_transparent_test_driver_ecp_export_public_key(
-                      attributes,
-                      key_buffer, key_buffer_size,
-                      data, data_size, data_length );
-    }
-    else
-#endif
-#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR) || \
-    defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY)
-    if( PSA_KEY_TYPE_IS_RSA( key_type ) )
-    {
+            attributes, key_buffer, key_buffer_size, data, data_size,
+            data_length);
+    } else
+#    endif
+#    if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR) || \
+        defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY)
+        if (PSA_KEY_TYPE_IS_RSA(key_type)) {
         status = mbedtls_transparent_test_driver_rsa_export_public_key(
-                      attributes,
-                      key_buffer, key_buffer_size,
-                      data, data_size, data_length );
-    }
-    else
-#endif
+            attributes, key_buffer, key_buffer_size, data, data_size,
+            data_length);
+    } else
+#    endif
     {
         status = PSA_ERROR_NOT_SUPPORTED;
         (void)key_buffer;
@@ -283,46 +275,47 @@
         (void)key_type;
     }
 
-    return status ;
+    return status;
 }
 
-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 )
+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)
 {
-    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;
     }
 }
 
@@ -336,52 +329,47 @@
  * (i.e. for an actual driver this would mean 'builtin_key_size' =
  * sizeof(psa_drv_slot_number_t)).
  */
-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 )
+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)
 {
-    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_usage_flags(
-                attributes,
-                PSA_KEY_USAGE_ENCRYPT |
-                PSA_KEY_USAGE_DECRYPT |
-                PSA_KEY_USAGE_EXPORT );
-            psa_set_key_algorithm( attributes, PSA_ALG_CTR );
+            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);
 
-            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_set_key_usage_flags(
-                attributes,
-                PSA_KEY_USAGE_SIGN_HASH |
-                PSA_KEY_USAGE_VERIFY_HASH |
-                PSA_KEY_USAGE_EXPORT );
-            psa_set_key_algorithm(
-                attributes, PSA_ALG_ECDSA( PSA_ALG_ANY_HASH ) );
+            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_VERIFY_HASH |
+                                                    PSA_KEY_USAGE_EXPORT);
+            psa_set_key_algorithm(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 cfcf162..4a8504e 100644
--- a/tests/src/drivers/test_driver_mac.c
+++ b/tests/src/drivers/test_driver_mac.c
@@ -20,41 +20,37 @@
 #include <test/helpers.h>
 
 #if defined(MBEDTLS_PSA_CRYPTO_DRIVERS) && defined(PSA_CRYPTO_DRIVER_TEST)
-#include "psa_crypto_mac.h"
+#    include "psa_crypto_mac.h"
 
-#include "test/drivers/mac.h"
+#    include "test/drivers/mac.h"
 
 mbedtls_test_driver_mac_hooks_t mbedtls_test_driver_mac_hooks =
     MBEDTLS_TEST_DRIVER_MAC_INIT;
 
-psa_status_t mbedtls_test_transparent_mac_compute(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key_buffer,
-    size_t key_buffer_size,
-    psa_algorithm_t alg,
-    const uint8_t *input,
-    size_t input_length,
-    uint8_t *mac,
-    size_t mac_size,
-    size_t *mac_length )
+psa_status_t
+mbedtls_test_transparent_mac_compute(const psa_key_attributes_t *attributes,
+                                     const uint8_t *key_buffer,
+                                     size_t key_buffer_size,
+                                     psa_algorithm_t alg,
+                                     const uint8_t *input,
+                                     size_t input_length,
+                                     uint8_t *mac,
+                                     size_t mac_size,
+                                     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 {
         mbedtls_test_driver_mac_hooks.driver_status =
             mbedtls_transparent_test_driver_mac_compute(
-                attributes, key_buffer, key_buffer_size, alg,
-                input, input_length,
-                mac, mac_size, mac_length );
+                attributes, key_buffer, key_buffer_size, alg, input,
+                input_length, mac, mac_size, mac_length);
     }
 
-    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(
@@ -62,23 +58,20 @@
     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 {
         mbedtls_test_driver_mac_hooks.driver_status =
             mbedtls_transparent_test_driver_mac_sign_setup(
-                operation, attributes, key_buffer, key_buffer_size, alg );
+                operation, attributes, key_buffer, key_buffer_size, alg);
     }
 
-    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(
@@ -86,139 +79,121 @@
     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 {
         mbedtls_test_driver_mac_hooks.driver_status =
             mbedtls_transparent_test_driver_mac_verify_setup(
-                operation, attributes, key_buffer, key_buffer_size, alg );
+                operation, attributes, key_buffer, key_buffer_size, alg);
     }
 
-    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_transparent_test_driver_mac_update(
-                operation, input, input_length );
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_transparent_test_driver_mac_update(operation, input,
+                                                       input_length);
     }
 
-    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 {
         mbedtls_test_driver_mac_hooks.driver_status =
             mbedtls_transparent_test_driver_mac_sign_finish(
-                operation, mac, mac_size, mac_length );
+                operation, mac, mac_size, mac_length);
     }
 
-    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_transparent_test_driver_mac_verify_finish(
-                operation, mac, mac_length );
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_transparent_test_driver_mac_verify_finish(operation, mac,
+                                                              mac_length);
     }
 
-    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 (mbedtls_test_driver_mac_hooks.forced_status != PSA_SUCCESS) {
         mbedtls_test_driver_mac_hooks.driver_status =
-            mbedtls_transparent_test_driver_mac_abort( operation );
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_transparent_test_driver_mac_abort(operation);
     }
 
-    return mbedtls_test_driver_mac_hooks.driver_status ;
+    return mbedtls_test_driver_mac_hooks.driver_status;
 }
 
-psa_status_t mbedtls_test_opaque_mac_compute(
-    const psa_key_attributes_t *attributes,
-    const uint8_t *key_buffer,
-    size_t key_buffer_size,
-    psa_algorithm_t alg,
-    const uint8_t *input,
-    size_t input_length,
-    uint8_t *mac,
-    size_t mac_size,
-    size_t *mac_length )
+psa_status_t
+mbedtls_test_opaque_mac_compute(const psa_key_attributes_t *attributes,
+                                const uint8_t *key_buffer,
+                                size_t key_buffer_size,
+                                psa_algorithm_t alg,
+                                const uint8_t *input,
+                                size_t input_length,
+                                uint8_t *mac,
+                                size_t mac_size,
+                                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_opaque_test_driver_mac_compute(
-                attributes, key_buffer, key_buffer_size, alg,
-                input, input_length,
-                mac, mac_size, mac_length );
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_opaque_test_driver_mac_compute(attributes, key_buffer,
+                                                   key_buffer_size, alg, input,
+                                                   input_length, mac, mac_size,
+                                                   mac_length);
     }
 
-    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(
@@ -226,23 +201,20 @@
     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 {
         mbedtls_test_driver_mac_hooks.driver_status =
             mbedtls_opaque_test_driver_mac_sign_setup(
-                operation, attributes, key_buffer, key_buffer_size, alg );
+                operation, attributes, key_buffer, key_buffer_size, alg);
     }
 
-    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(
@@ -250,109 +222,94 @@
     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 {
         mbedtls_test_driver_mac_hooks.driver_status =
             mbedtls_opaque_test_driver_mac_verify_setup(
-                operation, attributes, key_buffer, key_buffer_size, alg );
+                operation, attributes, key_buffer, key_buffer_size, alg);
     }
 
-    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_opaque_test_driver_mac_update(
-                operation, input, input_length );
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_opaque_test_driver_mac_update(operation, input,
+                                                  input_length);
     }
 
-    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_opaque_test_driver_mac_sign_finish(
-                operation, mac, mac_size, mac_length );
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_opaque_test_driver_mac_sign_finish(operation, mac, mac_size,
+                                                       mac_length);
     }
 
-    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_opaque_test_driver_mac_verify_finish(
-                operation, mac, mac_length );
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_opaque_test_driver_mac_verify_finish(operation, mac,
+                                                         mac_length);
     }
 
-    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_opaque_test_driver_mac_abort( operation );
+            mbedtls_test_driver_mac_hooks.forced_status;
+    } else {
+        mbedtls_test_driver_mac_hooks.driver_status =
+            mbedtls_opaque_test_driver_mac_abort(operation);
     }
 
-    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 e573b72..4bf60a5 100644
--- a/tests/src/drivers/test_driver_signature.c
+++ b/tests/src/drivers/test_driver_signature.c
@@ -22,78 +22,66 @@
 #include <test/helpers.h>
 
 #if defined(MBEDTLS_PSA_CRYPTO_DRIVERS) && defined(PSA_CRYPTO_DRIVER_TEST)
-#include "psa/crypto.h"
-#include "psa_crypto_core.h"
-#include "psa_crypto_ecp.h"
-#include "psa_crypto_hash.h"
-#include "psa_crypto_rsa.h"
-#include "mbedtls/ecp.h"
+#    include "psa/crypto.h"
+#    include "psa_crypto_core.h"
+#    include "psa_crypto_ecp.h"
+#    include "psa_crypto_hash.h"
+#    include "psa_crypto_rsa.h"
+#    include "mbedtls/ecp.h"
 
-#include "test/drivers/signature.h"
+#    include "test/drivers/signature.h"
 
-#include "mbedtls/md.h"
-#include "mbedtls/ecdsa.h"
+#    include "mbedtls/md.h"
+#    include "mbedtls/ecdsa.h"
 
-#include "test/random.h"
+#    include "test/random.h"
 
-#include <string.h>
+#    include <string.h>
 
-mbedtls_test_driver_signature_hooks_t
-    mbedtls_test_driver_signature_sign_hooks = MBEDTLS_TEST_DRIVER_SIGNATURE_INIT;
-mbedtls_test_driver_signature_hooks_t
-    mbedtls_test_driver_signature_verify_hooks = MBEDTLS_TEST_DRIVER_SIGNATURE_INIT;
+mbedtls_test_driver_signature_hooks_t mbedtls_test_driver_signature_sign_hooks =
+    MBEDTLS_TEST_DRIVER_SIGNATURE_INIT;
+mbedtls_test_driver_signature_hooks_t mbedtls_test_driver_signature_verify_hooks =
+    MBEDTLS_TEST_DRIVER_SIGNATURE_INIT;
 
-psa_status_t sign_hash(
-    const psa_key_attributes_t *attributes,
-    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 )
+psa_status_t sign_hash(const psa_key_attributes_t *attributes,
+                       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)
 {
-#if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN) || \
-    defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS)
-    if( attributes->core.type == PSA_KEY_TYPE_RSA_KEY_PAIR )
-    {
-        return( mbedtls_transparent_test_driver_rsa_sign_hash(
-                    attributes,
-                    key_buffer, key_buffer_size,
-                    alg, hash, hash_length,
-                    signature, signature_size, signature_length ) );
-    }
-    else
-#endif /* defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN) ||
-        * defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS) */
+#    if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN) || \
+        defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS)
+    if (attributes->core.type == PSA_KEY_TYPE_RSA_KEY_PAIR) {
+        return (mbedtls_transparent_test_driver_rsa_sign_hash(
+            attributes, key_buffer, key_buffer_size, alg, hash, hash_length,
+            signature, signature_size, signature_length));
+    } else
+#    endif /* defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN) || \
+            * defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS) */
 
-#if defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) || \
-    defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
-    if( PSA_KEY_TYPE_IS_ECC( attributes->core.type ) )
-    {
-        if(
-#if defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
-            PSA_ALG_IS_ECDSA( alg )
-#else
-            PSA_ALG_IS_RANDOMIZED_ECDSA( alg )
-#endif
-            )
-        {
-            return( mbedtls_transparent_test_driver_ecdsa_sign_hash(
-                        attributes,
-                        key_buffer, key_buffer_size,
-                        alg, hash, hash_length,
-                        signature, signature_size, signature_length ) );
+#    if defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) || \
+        defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
+        if (PSA_KEY_TYPE_IS_ECC(attributes->core.type)) {
+        if (
+#        if defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
+            PSA_ALG_IS_ECDSA(alg)
+#        else
+            PSA_ALG_IS_RANDOMIZED_ECDSA(alg)
+#        endif
+        ) {
+            return (mbedtls_transparent_test_driver_ecdsa_sign_hash(
+                attributes, key_buffer, key_buffer_size, alg, hash, hash_length,
+                signature, signature_size, signature_length));
+        } else {
+            return PSA_ERROR_INVALID_ARGUMENT;
         }
-        else
-        {
-            return PSA_ERROR_INVALID_ARGUMENT ;
-        }
-    }
-    else
-#endif /* defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) ||
-        * defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA) */
+    } else
+#    endif /* defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) || \
+            * defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA) */
     {
         (void)attributes;
         (void)key_buffer;
@@ -104,54 +92,42 @@
         (void)signature;
         (void)signature_size;
         (void)signature_length;
-        return PSA_ERROR_NOT_SUPPORTED ;
+        return PSA_ERROR_NOT_SUPPORTED;
     }
 }
 
-psa_status_t verify_hash(
-    const psa_key_attributes_t *attributes,
-    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 )
+psa_status_t verify_hash(const psa_key_attributes_t *attributes,
+                         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)
 {
-#if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN) || \
-    defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS)
-    if( PSA_KEY_TYPE_IS_RSA( attributes->core.type ) )
-    {
-        return( mbedtls_transparent_test_driver_rsa_verify_hash(
-                    attributes,
-                    key_buffer, key_buffer_size,
-                    alg, hash, hash_length,
-                    signature, signature_length ) );
-    }
-    else
-#endif /* defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN) ||
-        * defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS) */
+#    if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN) || \
+        defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS)
+    if (PSA_KEY_TYPE_IS_RSA(attributes->core.type)) {
+        return (mbedtls_transparent_test_driver_rsa_verify_hash(
+            attributes, key_buffer, key_buffer_size, alg, hash, hash_length,
+            signature, signature_length));
+    } else
+#    endif /* defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN) || \
+            * defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS) */
 
-#if defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) || \
-    defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
-    if( PSA_KEY_TYPE_IS_ECC( attributes->core.type ) )
-    {
-        if( PSA_ALG_IS_ECDSA( alg ) )
-        {
-            return( mbedtls_transparent_test_driver_ecdsa_verify_hash(
-                        attributes,
-                        key_buffer, key_buffer_size,
-                        alg, hash, hash_length,
-                        signature, signature_length ) );
+#    if defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) || \
+        defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
+        if (PSA_KEY_TYPE_IS_ECC(attributes->core.type)) {
+        if (PSA_ALG_IS_ECDSA(alg)) {
+            return (mbedtls_transparent_test_driver_ecdsa_verify_hash(
+                attributes, key_buffer, key_buffer_size, alg, hash, hash_length,
+                signature, signature_length));
+        } else {
+            return PSA_ERROR_INVALID_ARGUMENT;
         }
-        else
-        {
-            return PSA_ERROR_INVALID_ARGUMENT ;
-        }
-    }
-    else
-#endif /* defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) ||
-        * defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA) */
+    } else
+#    endif /* defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) || \
+            * defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA) */
     {
         (void)attributes;
         (void)key_buffer;
@@ -162,7 +138,7 @@
         (void)signature;
         (void)signature_length;
 
-        return PSA_ERROR_NOT_SUPPORTED ;
+        return PSA_ERROR_NOT_SUPPORTED;
     }
 }
 
@@ -175,7 +151,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;
@@ -183,31 +159,32 @@
 
     ++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 );
-        *signature_length = 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;
     }
 
     status = mbedtls_transparent_test_driver_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);
 
-    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(
@@ -219,19 +196,19 @@
     size_t input_length,
     uint8_t *signature,
     size_t signature_size,
-    size_t *signature_length )
+    size_t *signature_length)
 {
-    (void) attributes;
-    (void) key;
-    (void) key_length;
-    (void) alg;
-    (void) input;
-    (void) input_length;
-    (void) signature;
-    (void) signature_size;
-    (void) signature_length;
+    (void)attributes;
+    (void)key;
+    (void)key_length;
+    (void)alg;
+    (void)input;
+    (void)input_length;
+    (void)signature;
+    (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(
@@ -242,7 +219,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;
@@ -250,19 +227,18 @@
 
     ++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;
 
     status = mbedtls_transparent_test_driver_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);
 
-    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(
@@ -273,100 +249,114 @@
     const uint8_t *input,
     size_t input_length,
     const uint8_t *signature,
-    size_t signature_length )
+    size_t signature_length)
 {
-    (void) attributes;
-    (void) key;
-    (void) key_length;
-    (void) alg;
-    (void) input;
-    (void) input_length;
-    (void) signature;
-    (void) signature_length;
+    (void)attributes;
+    (void)key;
+    (void)key_length;
+    (void)alg;
+    (void)input;
+    (void)input_length;
+    (void)signature;
+    (void)signature_length;
 
-    return PSA_ERROR_NOT_SUPPORTED ;
+    return PSA_ERROR_NOT_SUPPORTED;
 }
 
 psa_status_t mbedtls_test_transparent_signature_sign_hash(
     const psa_key_attributes_t *attributes,
-    const uint8_t *key_buffer, size_t key_buffer_size,
+    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 )
+    const uint8_t *hash,
+    size_t hash_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_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_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 );
+    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(
-    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 )
+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)
 {
-    (void) attributes;
-    (void) key;
-    (void) key_length;
-    (void) alg;
-    (void) hash;
-    (void) hash_length;
-    (void) signature;
-    (void) signature_size;
-    (void) signature_length;
+    (void)attributes;
+    (void)key;
+    (void)key_length;
+    (void)alg;
+    (void)hash;
+    (void)hash_length;
+    (void)signature;
+    (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(
     const psa_key_attributes_t *attributes,
-    const uint8_t *key_buffer, size_t key_buffer_size,
+    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 *hash,
+    size_t hash_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(
     const psa_key_attributes_t *attributes,
-    const uint8_t *key, size_t key_length,
+    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 *hash,
+    size_t hash_length,
+    const uint8_t *signature,
+    size_t signature_length)
 {
-    (void) attributes;
-    (void) key;
-    (void) key_length;
-    (void) alg;
-    (void) hash;
-    (void) hash_length;
-    (void) signature;
-    (void) signature_length;
-    return PSA_ERROR_NOT_SUPPORTED ;
+    (void)attributes;
+    (void)key;
+    (void)key_length;
+    (void)alg;
+    (void)hash;
+    (void)hash_length;
+    (void)signature;
+    (void)signature_length;
+    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 837d82a..66d8667 100644
--- a/tests/src/drivers/test_driver_size.c
+++ b/tests/src/drivers/test_driver_size.c
@@ -22,8 +22,8 @@
 
 #if defined(MBEDTLS_PSA_CRYPTO_DRIVERS) && defined(PSA_CRYPTO_DRIVER_TEST)
 
-#include "test/drivers/size.h"
-#include "psa/crypto.h"
+#    include "test/drivers/size.h"
+#    include "psa/crypto.h"
 
 typedef struct {
     unsigned int context;
@@ -33,7 +33,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.
@@ -42,56 +42,51 @@
  * Based on this value, the size of the private key can be derived by
  * subtracting the public key size below from this one.
  */
-#define TEST_DRIVER_KEY_CONTEXT_KEY_PAIR_SIZE      65
+#    define TEST_DRIVER_KEY_CONTEXT_KEY_PAIR_SIZE 65
 
 /*
  * Number of bytes included in every key context for a public key.
  *
  * For ECC public keys, it needs 257 bits so 33 bytes.
  */
-#define TEST_DRIVER_KEY_CONTEXT_PUBLIC_KEY_SIZE    33
+#    define TEST_DRIVER_KEY_CONTEXT_PUBLIC_KEY_SIZE 33
 
 /*
  * Every key context for a symmetric key includes this many times the key size.
  */
-#define TEST_DRIVER_KEY_CONTEXT_SYMMETRIC_FACTOR   0
+#    define TEST_DRIVER_KEY_CONTEXT_SYMMETRIC_FACTOR 0
 
 /*
- * If this is true for a key pair, the key context includes space for the public key.
- * If this is false, no additional space is added for the public key.
+ * If this is true for a key pair, the key context includes space for the public
+ * key. If this is false, no additional space is added for the public key.
  *
  * For this instance, store the public key with the private one.
  */
-#define TEST_DRIVER_KEY_CONTEXT_STORE_PUBLIC_KEY   1
+#    define TEST_DRIVER_KEY_CONTEXT_STORE_PUBLIC_KEY 1
 
-size_t mbedtls_test_size_function(
-    const psa_key_type_t key_type,
-    const size_t key_bits )
+size_t mbedtls_test_size_function(const psa_key_type_t key_type,
+                                  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 ) )
-    {
-        key_buffer_size = TEST_DRIVER_KEY_CONTEXT_BASE_SIZE +
-                          ( TEST_DRIVER_KEY_CONTEXT_SYMMETRIC_FACTOR *
-                            ( ( key_bits + 7 ) / 8 ) );
+    } 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));
     }
 
-    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 ec83541..bdcd3e3 100644
--- a/tests/src/fake_external_rng_for_test.c
+++ b/tests/src/fake_external_rng_for_test.c
@@ -23,34 +23,36 @@
 #include <test/fake_external_rng_for_test.h>
 
 #if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
-#include <test/random.h>
-#include <psa/crypto.h>
+#    include <test/random.h>
+#    include <psa/crypto.h>
 
 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 )
+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)
 {
-    (void) context;
+    (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 7bbfa50..a41585a 100644
--- a/tests/src/helpers.c
+++ b/tests/src/helpers.c
@@ -31,40 +31,39 @@
 /*----------------------------------------------------------------------------*/
 /* 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 ;
+        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;
@@ -75,7 +74,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;
@@ -83,68 +82,66 @@
     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;
 }
 
-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;
 }
 
-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 ;
+    if ((*len) > obufmax)
+        return -1;
 
-    while( *ibuf != 0 )
-    {
-        if ( ascii2uc( *(ibuf++), &uc ) != 0 )
-            return -1 ;
+    while (*ibuf != 0) {
+        if (ascii2uc(*(ibuf++), &uc) != 0)
+            return -1;
 
-        if ( ascii2uc( *(ibuf++), &uc2 ) != 0 )
-            return -1 ;
+        if (ascii2uc(*(ibuf++), &uc2) != 0)
+            return -1;
 
-        *(obuf++) = ( uc << 4 ) | uc2;
+        *(obuf++) = (uc << 4) | uc2;
     }
 
-    return 0 ;
+    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
             *obuf++ = 'a' + h - 10;
 
-        if( l < 10 )
+        if (l < 10)
             *obuf++ = '0' + l;
         else
             *obuf++ = 'a' + l - 10;
@@ -154,49 +151,46 @@
     }
 }
 
-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;
         }
@@ -205,8 +199,7 @@
 }
 
 #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
@@ -220,57 +213,47 @@
      *     and module-dependent error code (bits 7..11)).
      * l = low level error code.
      */
-    if ( high > -0x1000 && high != 0 )
+    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 )
+        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 )
+        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 )
+        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 );
+        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, int radix, const char *s )
+int mbedtls_test_read_mpi(mbedtls_mpi *X, int radix, const char *s)
 {
     /* 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 ;
-    }
-    else
-        return mbedtls_mpi_read_string( X, radix, s ) ;
+    if (s[0] == 0) {
+        mbedtls_mpi_free(X);
+        return 0;
+    } else
+        return mbedtls_mpi_read_string(X, radix, s);
 }
 #endif
diff --git a/tests/src/psa_crypto_helpers.c b/tests/src/psa_crypto_helpers.c
index cef4093..147929e 100644
--- a/tests/src/psa_crypto_helpers.c
+++ b/tests/src/psa_crypto_helpers.c
@@ -26,105 +26,104 @@
 
 #if defined(MBEDTLS_PSA_CRYPTO_C)
 
-#include <psa/crypto.h>
+#    include <psa/crypto.h>
 
-#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C)
+#    if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C)
 
-#include <psa_crypto_storage.h>
+#        include <psa_crypto_storage.h>
 
 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 */
+#    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)
+#    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"
+#        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) */
+#    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 f47f15a..c7c667f 100644
--- a/tests/src/psa_exercise_key.c
+++ b/tests/src/psa_exercise_key.c
@@ -25,21 +25,21 @@
 
 #if defined(MBEDTLS_PSA_CRYPTO_C)
 
-#include <mbedtls/asn1.h>
-#include <psa/crypto.h>
+#    include <mbedtls/asn1.h>
+#    include <psa/crypto.h>
 
-#include <test/asn1_helpers.h>
-#include <test/psa_crypto_helpers.h>
+#    include <test/asn1_helpers.h>
+#    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 )
+#    if defined(MBEDTLS_PSA_CRYPTO_SE_C)
+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
+#    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;
@@ -48,58 +48,51 @@
     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)
+#    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 );
+        TEST_EQUAL(status, 0);
+        TEST_ASSERT(slot_number != 0xec94d4a5058a1a21);
+    } else {
+        TEST_EQUAL(status, PSA_ERROR_INVALID_ARGUMENT);
     }
-    else
-    {
-        TEST_EQUAL( status, PSA_ERROR_INVALID_ARGUMENT );
-    }
-#endif
+#    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;
 
@@ -108,400 +101,339 @@
      * 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 )
-    {
-        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 );
+    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);
     }
 
-    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[16] = {0};
-    size_t iv_length = sizeof( iv );
+    unsigned char iv[16] = { 0 };
+    size_t iv_length = sizeof(iv);
     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;
 
-    if( usage & PSA_KEY_USAGE_ENCRYPT )
-    {
-        PSA_ASSERT( psa_cipher_encrypt_setup( &operation, key, alg ) );
-        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 ) );
+    if (usage & PSA_KEY_USAGE_ENCRYPT) {
+        PSA_ASSERT(psa_cipher_encrypt_setup(&operation, key, alg));
+        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));
         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 ) )
-        {
+        if (!(usage & PSA_KEY_USAGE_ENCRYPT)) {
             psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
-            PSA_ASSERT( psa_get_key_attributes( key, &attributes ) );
+            PSA_ASSERT(psa_get_key_attributes(key, &attributes));
             /* This should be PSA_CIPHER_GET_IV_SIZE but the API doesn't
              * have this macro yet. */
-            iv_length = PSA_BLOCK_CIPHER_BLOCK_LENGTH(
-                psa_get_key_type( &attributes ) );
-            maybe_invalid_padding = ! PSA_ALG_IS_STREAM_CIPHER( alg );
-            psa_reset_key_attributes( &attributes );
+            iv_length =
+                PSA_BLOCK_CIPHER_BLOCK_LENGTH(psa_get_key_type(&attributes));
+            maybe_invalid_padding = !PSA_ALG_IS_STREAM_CIPHER(alg);
+            psa_reset_key_attributes(&attributes);
         }
-        PSA_ASSERT( psa_cipher_decrypt_setup( &operation, key, alg ) );
-        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_decrypt_setup(&operation, key, alg));
+        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);
         /* For a stream cipher, all inputs are valid. For a block cipher,
          * if the input is some aribtrary 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 );
+        if (maybe_invalid_padding)
+            TEST_ASSERT(status == PSA_SUCCESS ||
+                        status == PSA_ERROR_INVALID_PADDING);
         else
-            PSA_ASSERT( status );
+            PSA_ASSERT(status);
     }
 
-    return 1 ;
+    return 1;
 
 exit:
-    psa_cipher_abort( &operation );
-    return 0 ;
+    psa_cipher_abort(&operation);
+    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[16] = {0};
-    size_t nonce_length = sizeof( nonce );
+    unsigned char nonce[16] = { 0 };
+    size_t nonce_length = sizeof(nonce);
     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));
     }
 
     /* Default IV length for AES-GCM is 12 bytes */
-    if( PSA_ALG_AEAD_WITH_SHORTENED_TAG( alg, 0 ) ==
-        PSA_ALG_AEAD_WITH_SHORTENED_TAG( PSA_ALG_GCM, 0 ) )
-    {
+    if (PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, 0) ==
+        PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_GCM, 0)) {
         nonce_length = 12;
     }
 
     /* IV length for CCM needs to be between 7 and 13 bytes */
-    if( PSA_ALG_AEAD_WITH_SHORTENED_TAG( alg, 0 ) ==
-        PSA_ALG_AEAD_WITH_SHORTENED_TAG( PSA_ALG_CCM, 0 ) )
-    {
+    if (PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, 0) ==
+        PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 0)) {
         nonce_length = 12;
     }
 
-    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 )
-    {
-        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 );
+    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);
     }
 
-    return 1 ;
+    return 1;
 
 exit:
-    return 0 ;
+    return 0;
 }
 
-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_HASH_AND_SIGN( alg ) && hash_alg == PSA_ALG_ANY_HASH )
-        {
-    #if defined(KNOWN_SUPPORTED_HASH_ALG)
+        if (PSA_ALG_IS_HASH_AND_SIGN(alg) && hash_alg == PSA_ALG_ANY_HASH) {
+#    if defined(KNOWN_SUPPORTED_HASH_ALG)
             hash_alg = KNOWN_SUPPORTED_HASH_ALG;
             alg ^= PSA_ALG_ANY_HASH ^ hash_alg;
-    #else
-            TEST_ASSERT( ! "No hash algorithm for hash-and-sign testing" );
-    #endif
+#    else
+            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,
-                                       payload, payload_length,
-                                       signature, sizeof( signature ),
-                                       &signature_length ) );
+        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, signature_length ),
-                        verify_status );
+        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);
         }
     }
 
-    if( usage & ( PSA_KEY_USAGE_SIGN_MESSAGE | PSA_KEY_USAGE_VERIFY_MESSAGE ) )
-    {
+    if (usage & (PSA_KEY_USAGE_SIGN_MESSAGE | PSA_KEY_USAGE_VERIFY_MESSAGE)) {
         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 )
-        {
-            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 );
+        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);
         }
     }
 
-    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 )
-    {
-        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 ) ) );
+    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)));
     }
 
-    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;
+    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;
@@ -514,34 +446,36 @@
     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 );
+    status = psa_key_derivation_key_agreement(operation,
+                                              PSA_KEY_DERIVATION_INPUT_SECRET,
+                                              key, 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 )
+psa_status_t
+mbedtls_test_psa_raw_key_agreement_with_self(psa_algorithm_t alg,
+                                             mbedtls_svc_key_id_t key)
 {
     psa_key_type_t private_key_type;
     psa_key_type_t public_key_type;
@@ -556,26 +490,22 @@
     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:
@@ -583,69 +513,66 @@
      * 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;
+    psa_key_derivation_operation_t operation =
+        PSA_KEY_DERIVATION_OPERATION_INIT;
     unsigned char output[1];
     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( psa_key_derivation_setup( &operation, alg ) );
-        PSA_ASSERT( mbedtls_test_psa_key_agreement_with_self( &operation, key ) );
-        PSA_ASSERT( psa_key_derivation_output_bytes( &operation,
-                                                     output,
-                                                     sizeof( output ) ) );
-        PSA_ASSERT( psa_key_derivation_abort( &operation ) );
+        PSA_ASSERT(psa_key_derivation_setup(&operation, alg));
+        PSA_ASSERT(mbedtls_test_psa_key_agreement_with_self(&operation, key));
+        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 )
+int mbedtls_test_psa_exported_key_sanity_check(psa_key_type_t type,
+                                               size_t bits,
+                                               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 ) );
+    if (PSA_KEY_TYPE_IS_UNSTRUCTURED(type))
+        TEST_EQUAL(exported_length, PSA_BITS_TO_BYTES(bits));
     else
-
-#if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_PK_PARSE_C)
-    if( type == PSA_KEY_TYPE_RSA_KEY_PAIR )
-    {
-        uint8_t *p = (uint8_t*) exported;
+#    if defined(MBEDTLS_RSA_C) && defined(MBEDTLS_PK_PARSE_C)
+        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 {
@@ -660,139 +587,123 @@
          *       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( p + len, end );
-        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(p + len, end);
+        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 );
+        TEST_EQUAL(p, end);
 
-        TEST_ASSERT( exported_length <= PSA_EXPORT_KEY_PAIR_MAX_SIZE );
-    }
-    else
-#endif /* MBEDTLS_RSA_C */
+        TEST_ASSERT(exported_length <= PSA_EXPORT_KEY_PAIR_MAX_SIZE);
+    } else
+#    endif /* MBEDTLS_RSA_C */
 
-#if defined(MBEDTLS_ECP_C)
-    if( PSA_KEY_TYPE_IS_ECC_KEY_PAIR( type ) )
-    {
+#    if defined(MBEDTLS_ECP_C)
+        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
-#endif /* MBEDTLS_ECP_C */
+        TEST_ASSERT(exported_length <= PSA_EXPORT_KEY_PAIR_MAX_SIZE);
+    } else
+#    endif /* MBEDTLS_ECP_C */
 
-#if defined(MBEDTLS_RSA_C)
-    if( type == PSA_KEY_TYPE_RSA_PUBLIC_KEY )
-    {
-        uint8_t *p = (uint8_t*) exported;
+#    if defined(MBEDTLS_RSA_C)
+        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( p + len, end );
-        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(p + len, end);
+        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 );
+        TEST_EQUAL(p, end);
 
+        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_RSA_C */
 
-        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_RSA_C */
+#    if defined(MBEDTLS_ECP_C)
+        if (PSA_KEY_TYPE_IS_ECC_PUBLIC_KEY(type)) {
 
-#if defined(MBEDTLS_ECP_C)
-    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
-#endif /* MBEDTLS_ECP_C */
+    } else
+#    endif /* MBEDTLS_ECP_C */
 
     {
-        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 defined(MBEDTLS_DES_C)
+    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
+#    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;
@@ -800,42 +711,38 @@
     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 );
+    exported_size = PSA_EXPORT_KEY_OUTPUT_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;
@@ -844,121 +751,111 @@
     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 );
+    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_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 algorihm, 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 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" );
+        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_HASH_AND_SIGN( 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 );
+    if (PSA_ALG_IS_MAC(alg) || PSA_ALG_IS_SIGN(alg)) {
+        if (PSA_ALG_IS_HASH_AND_SIGN(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);
 
-        return( PSA_KEY_TYPE_IS_PUBLIC_KEY( type ) ?
-                PSA_KEY_USAGE_VERIFY_HASH :
-                PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH );
+        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;
     }
-    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 ;
-    }
-
 }
 
 #endif /* MBEDTLS_PSA_CRYPTO_C */
diff --git a/tests/src/random.c b/tests/src/random.c
index d578985..10adc53 100644
--- a/tests/src/random.c
+++ b/tests/src/random.c
@@ -26,9 +26,9 @@
  * for arc4random_buf() from <stdlib.h>
  */
 #if defined(__NetBSD__)
-#define _NETBSD_SOURCE 1
+#    define _NETBSD_SOURCE 1
 #elif defined(__OpenBSD__)
-#define _BSD_SOURCE 1
+#    define _BSD_SOURCE 1
 #endif
 
 #include <test/macros.h>
@@ -37,109 +37,102 @@
 
 #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 )
-        rng_state  = NULL;
-
-    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 );
+    for (i = 0; i < len; ++i)
+        output[i] = rand();
+#else
+    if (rng_state != NULL)
+        rng_state = NULL;
+
+    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 )
-        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;
+    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 ) );
-        }
-        else
-            return MBEDTLS_ERR_ENTROPY_SOURCE_FAILED ;
+    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;
     }
 
-    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;
+        (mbedtls_test_rnd_pseudo_info *)rng_state;
+    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 f5a9564..32a4c6f 100644
--- a/tests/src/threading_helpers.c
+++ b/tests/src/threading_helpers.c
@@ -22,7 +22,7 @@
 
 #if defined(MBEDTLS_TEST_MUTEX_USAGE)
 
-#include "mbedtls/threading.h"
+#    include "mbedtls/threading.h"
 
 /** Mutex usage verification framework.
  *
@@ -82,12 +82,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 +97,92 @@
  */
 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 )
+    (void)mutex;
+    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 +194,23 @@
     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 0071f6f..5c22007 100644
--- a/tests/suites/helpers.function
+++ b/tests/suites/helpers.function
@@ -9,69 +9,70 @@
 
 #include <stdlib.h>
 
-#if defined (MBEDTLS_ERROR_C)
-#include "mbedtls/error.h"
+#if defined(MBEDTLS_ERROR_C)
+#    include "mbedtls/error.h"
 #endif
 #if defined(MBEDTLS_PLATFORM_C)
-#include "mbedtls/platform.h"
+#    include "mbedtls/platform.h"
 #else
-#include <stdio.h>
-#define mbedtls_fprintf    fprintf
-#define mbedtls_snprintf   snprintf
-#define mbedtls_calloc     calloc
-#define mbedtls_free       free
-#define mbedtls_exit       exit
-#define mbedtls_time       time
-#define mbedtls_time_t     time_t
-#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS
-#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
+#    include <stdio.h>
+#    define mbedtls_fprintf      fprintf
+#    define mbedtls_snprintf     snprintf
+#    define mbedtls_calloc       calloc
+#    define mbedtls_free         free
+#    define mbedtls_exit         exit
+#    define mbedtls_time         time
+#    define mbedtls_time_t       time_t
+#    define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS
+#    define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
 #endif
 
 #if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
-#include "mbedtls/memory_buffer_alloc.h"
+#    include "mbedtls/memory_buffer_alloc.h"
 #endif
 
 #ifdef _MSC_VER
-#include <basetsd.h>
+#    include <basetsd.h>
 typedef UINT8 uint8_t;
 typedef INT32 int32_t;
 typedef UINT32 uint32_t;
-#define strncasecmp _strnicmp
-#define strcasecmp _stricmp
+#    define strncasecmp _strnicmp
+#    define strcasecmp  _stricmp
 #else
-#include <stdint.h>
+#    include <stdint.h>
 #endif
 
 #include <string.h>
 
 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
-#include <unistd.h>
-#include <strings.h>
+#    include <unistd.h>
+#    include <strings.h>
 #endif
 
 /* Type for Hex parameters */
-typedef struct data_tag
-{
-    uint8_t *   x;
-    uint32_t    len;
+typedef struct data_tag {
+    uint8_t *x;
+    uint32_t len;
 } data_t;
 
 /*----------------------------------------------------------------------------*/
 /* Status and error constants */
 
-#define DEPENDENCY_SUPPORTED            0   /* Dependency supported by build */
-#define KEY_VALUE_MAPPING_FOUND         0   /* Integer expression found */
-#define DISPATCH_TEST_SUCCESS           0   /* Test dispatch successful */
+#define DEPENDENCY_SUPPORTED    0 /* Dependency supported by build */
+#define KEY_VALUE_MAPPING_FOUND 0 /* Integer expression found */
+#define DISPATCH_TEST_SUCCESS   0 /* Test dispatch successful */
 
-#define KEY_VALUE_MAPPING_NOT_FOUND     -1  /* Integer expression not found */
-#define DEPENDENCY_NOT_SUPPORTED        -2  /* Dependency not supported */
-#define DISPATCH_TEST_FN_NOT_FOUND      -3  /* Test function not found */
-#define DISPATCH_INVALID_TEST_DATA      -4  /* Invalid test parameter type.
-                                               Only int, string, binary data
-                                               and integer expressions are
-                                               allowed */
-#define DISPATCH_UNSUPPORTED_SUITE      -5  /* Test suite not supported by the
-                                               build */
+#define KEY_VALUE_MAPPING_NOT_FOUND -1 /* Integer expression not found */
+#define DEPENDENCY_NOT_SUPPORTED    -2 /* Dependency not supported */
+#define DISPATCH_TEST_FN_NOT_FOUND  -3 /* Test function not found */
+#define DISPATCH_INVALID_TEST_DATA      \
+    -4 /* Invalid test parameter type.  \
+          Only int, string, binary data \
+          and integer expressions are   \
+          allowed */
+#define DISPATCH_UNSUPPORTED_SUITE        \
+    -5 /* Test suite not supported by the \
+          build */
 
 /*----------------------------------------------------------------------------*/
 /* Global variables */
@@ -82,13 +83,11 @@
 /* Indicates whether we expect mbedtls_entropy_init
  * to initialize some strong entropy source. */
 #if !defined(MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES) && \
-    ( !defined(MBEDTLS_NO_PLATFORM_ENTROPY) ||      \
-        defined(MBEDTLS_ENTROPY_HARDWARE_ALT) ||    \
-        defined(ENTROPY_NV_SEED) )
-#define ENTROPY_HAVE_STRONG
+    (!defined(MBEDTLS_NO_PLATFORM_ENTROPY) ||       \
+     defined(MBEDTLS_ENTROPY_HARDWARE_ALT) || defined(ENTROPY_NV_SEED))
+#    define ENTROPY_HAVE_STRONG
 #endif
 
-
 /*----------------------------------------------------------------------------*/
 /* Helper Functions */
 
@@ -99,65 +98,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 f414c38..b2ce406 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,70 +32,62 @@
  *
  * \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 );
+    if (digits) {
+        if (hex)
+            *value = strtol(str, NULL, 16);
         else
-            *value = strtol( str, NULL, 10 );
+            *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;
 }
 
-
 /**
  * \brief       Usage string.
  *
  */
-#define USAGE \
-    "Usage: %s [OPTIONS] files...\n\n" \
-    "   Command line arguments:\n" \
+#define USAGE                                                             \
+    "Usage: %s [OPTIONS] files...\n\n"                                    \
+    "   Command line arguments:\n"                                        \
     "     files...          One or more test data files. If no file is\n" \
-    "                       specified the following default test case\n" \
-    "                       file is used:\n" \
-    "                           %s\n\n" \
-    "   Options:\n" \
-    "     -v | --verbose    Display full information about each test\n" \
-    "     -h | --help       Display this information\n\n", \
-    argv[0], \
-    "TESTCASE_FILENAME"
-
+    "                       specified the following default test case\n"  \
+    "                       file is used:\n"                              \
+    "                           %s\n\n"                                   \
+    "   Options:\n"                                                       \
+    "     -v | --verbose    Display full information about each test\n"   \
+    "     -h | --help       Display this information\n\n",                \
+        argv[0], "TESTCASE_FILENAME"
 
 /**
  * \brief       Read a line from the passed file pointer.
@@ -107,44 +98,41 @@
  *
  * \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 +145,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 +154,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 +173,27 @@
     }
 
     /* 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++ ) = '?';
-            }
-            else
-                *( q++ ) = *( p++ );
+                *(q++) = '?';
+            } else
+                *(q++) = *(p++);
         }
         *q = '\0';
     }
 
-    return cnt ;
+    return cnt;
 }
 
 /**
@@ -238,81 +214,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 );
+                TEST_HELPER_ASSERT(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 );
+            } 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 +289,25 @@
 #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 ;
+    if (strncmp(ref_buf, buf, sizeof(buf)) != 0 || ref_ret != ret ||
+        memcmp(buf + n, ref + n, sizeof(buf) - n) != 0) {
+        return 1;
     }
 
-    return 0 ;
+    return 0;
 }
 
 /**
@@ -362,14 +315,12 @@
  *
  * \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,34 +330,31 @@
  * \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
             test_suite = argv0;
@@ -414,8 +362,8 @@
 
     /* 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 +377,59 @@
  * \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 +442,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 +467,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 +485,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;
         }
 
@@ -596,228 +528,197 @@
     }
 
     /* 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 );
+                    mbedtls_fprintf(stdout, "line %d, %s",
+                                    mbedtls_test_info.line_no,
+                                    mbedtls_test_info.filename);
                 }
-                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" );
+    mbedtls_fprintf(
+        stdout,
+        "\n----------------------------------------------------------------------------\n\n");
+    if (total_errors == 0)
+        mbedtls_fprintf(stdout, "PASSED");
     else
-        mbedtls_fprintf( stdout, "FAILED" );
+        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)
-#if defined(MBEDTLS_MEMORY_DEBUG)
+#    if defined(MBEDTLS_MEMORY_DEBUG)
     mbedtls_memory_buffer_alloc_status();
-#endif
+#    endif
     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 cfad32e..f6700b2 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -18,9 +18,9 @@
  */
 
 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
-#if !defined(_POSIX_C_SOURCE)
-#define _POSIX_C_SOURCE 200112L // for fileno() from <stdio.h>
-#endif
+#    if !defined(_POSIX_C_SOURCE)
+#        define _POSIX_C_SOURCE 200112L // for fileno() from <stdio.h>
+#    endif
 #endif
 
 #include "mbedtls/build_info.h"
@@ -31,7 +31,7 @@
  * enabled but the corresponding warnings are not treated as errors.
  */
 #if !defined(MBEDTLS_DEPRECATED_REMOVED) && !defined(MBEDTLS_DEPRECATED_WARNING)
-#define MBEDTLS_TEST_DEPRECATED
+#    define MBEDTLS_TEST_DEPRECATED
 #endif
 
 /*----------------------------------------------------------------------------*/
@@ -41,55 +41,50 @@
 
 #line $line_no "suites/main_test.function"
 
-
 /*----------------------------------------------------------------------------*/
 /* Test Suite Code */
 
-
 #define TEST_SUITE_ACTIVE
 
-$functions_code
+    $functions_code
 
 #line $line_no "suites/main_test.function"
 
+    /*----------------------------------------------------------------------------*/
+    /* Test dispatch code */
 
-/*----------------------------------------------------------------------------*/
-/* Test dispatch code */
-
-
-/**
- * \brief       Evaluates an expression/macro into its literal integer value.
- *              For optimizing space for embedded targets each expression/macro
- *              is identified by a unique identifier instead of string literals.
- *              Identifiers and evaluation code is generated by script:
- *              $generator_script
- *
- * \param exp_id    Expression identifier.
- * \param out_value Pointer to int to hold the integer.
- *
- * \return       0 if exp_id is found. 1 otherwise.
- */
-int get_expression( int32_t exp_id, int32_t * out_value )
+    /**
+     * \brief       Evaluates an expression/macro into its literal integer value.
+     *              For optimizing space for embedded targets each expression/macro
+     *              is identified by a unique identifier instead of string literals.
+     *              Identifiers and evaluation code is generated by script:
+     *              $generator_script
+     *
+     * \param exp_id    Expression identifier.
+     * \param out_value Pointer to int to hold the integer.
+     *
+     * \return       0 if exp_id is found. 1 otherwise.
+     */
+    int
+    get_expression(int32_t exp_id, int32_t *out_value)
 {
     int ret = KEY_VALUE_MAPPING_FOUND;
 
-    (void) exp_id;
-    (void) out_value;
+    (void)exp_id;
+    (void)out_value;
 
-    switch( exp_id )
-    {
-$expression_code
+    switch (exp_id) {
+        $expression_code
 #line $line_no "suites/main_test.function"
-        default:
-           {
-                ret = KEY_VALUE_MAPPING_NOT_FOUND;
-           }
-           break;
+            default:
+        {
+            ret = KEY_VALUE_MAPPING_NOT_FOUND;
+        }
+        break;
     }
-    return ret ;
+    return ret;
 }
 
-
 /**
  * \brief       Checks if the dependency i.e. the compile flag is set.
  *              For optimizing space for embedded targets each dependency
@@ -101,23 +96,20 @@
  *
  * \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;
+    (void)dep_id;
 
-    switch( dep_id )
-    {
-$dep_check_code
+    switch (dep_id) {
+        $dep_check_code
 #line $line_no "suites/main_test.function"
-        default:
-            break;
+            default : break;
     }
-    return ret ;
+    return ret;
 }
 
-
 /**
  * \brief       Function pointer type for test function wrappers.
  *
@@ -131,8 +123,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);
 
 /**
  * \brief       Table of test function wrappers. Used by dispatch_test().
@@ -140,9 +131,7 @@
  *              $generator_script
  *
  */
-TestWrapper_t test_funcs[] =
-{
-$dispatch_code
+TestWrapper_t test_funcs[] = { $dispatch_code
 #line $line_no "suites/main_test.function"
 };
 
@@ -157,38 +146,32 @@
  *               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 defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
-                mbedtls_test_enable_insecure_external_rng( );
-            #endif
+        if (fp) {
+#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
+            mbedtls_test_enable_insecure_external_rng();
+#endif
 
-                fp( params );
+            fp(params);
 
-            #if defined(MBEDTLS_TEST_MUTEX_USAGE)
-                mbedtls_test_mutex_usage_check( );
-            #endif /* MBEDTLS_TEST_MUTEX_USAGE */
-        }
-        else
+#if defined(MBEDTLS_TEST_MUTEX_USAGE)
+            mbedtls_test_mutex_usage_check();
+#endif /* MBEDTLS_TEST_MUTEX_USAGE */
+        } else
             ret = DISPATCH_UNSUPPORTED_SUITE;
-    }
-    else
-    {
+    } else {
         ret = DISPATCH_TEST_FN_NOT_FOUND;
     }
 
-    return ret ;
+    return ret;
 }
 
-
 /**
  * \brief       Checks if test function is supported in this build-time
  *              configuration.
@@ -199,62 +182,57 @@
  *               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;
 }
 
-
 $platform_code
 
 #line $line_no "suites/main_test.function"
 
-/*----------------------------------------------------------------------------*/
-/* Main Test code */
+    /*----------------------------------------------------------------------------*/
+    /* Main Test code */
 
-
-/**
- * \brief       Program main. Invokes platform specific execute_tests().
- *
- * \param argc      Command line arguments count.
- * \param argv      Array of command line arguments.
- *
- * \return       Exit code.
- */
-int main( int argc, const char *argv[] )
+    /**
+     * \brief       Program main. Invokes platform specific execute_tests().
+     *
+     * \param argc      Command line arguments count.
+     * \param argv      Array of command line arguments.
+     *
+     * \return       Exit code.
+     */
+    int
+    main(int argc, const char *argv[])
 {
 #if defined(MBEDTLS_TEST_HOOKS)
-    extern void (*mbedtls_test_hook_test_fail)( const char * test, int line, const char * file );
+    extern void (*mbedtls_test_hook_test_fail)(const char *test, int line,
+                                               const char *file);
     mbedtls_test_hook_test_fail = &mbedtls_test_fail;
-#if defined(MBEDTLS_ERROR_C)
+#    if defined(MBEDTLS_ERROR_C)
     mbedtls_test_hook_error_add = &mbedtls_test_err_add_check;
-#endif
+#    endif
 #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/target_test.function b/tests/suites/target_test.function
index 3d0bc80..71bc260 100644
--- a/tests/suites/target_test.function
+++ b/tests/suites/target_test.function
@@ -11,17 +11,15 @@
  * \param step  Increment size
  *
  */
-#define INCR_ASSERT(p, start, len, step) do                     \
-{                                                               \
-    TEST_HELPER_ASSERT( ( p ) >= ( start ) );                               \
-    TEST_HELPER_ASSERT( sizeof( *( p ) ) == sizeof( *( start ) ) );         \
-    /* <= is checked to support use inside a loop where         \
-       pointer is incremented after reading data.       */      \
-    TEST_HELPER_ASSERT( (uint32_t)( ( ( p ) - ( start ) ) + ( step ) ) <= ( len ) );\
-    ( p ) += ( step );                                          \
-}                                                               \
-while( 0 )
-
+#define INCR_ASSERT(p, start, len, step)                                   \
+    do {                                                                   \
+        TEST_HELPER_ASSERT((p) >= (start));                                \
+        TEST_HELPER_ASSERT(sizeof(*(p)) == sizeof(*(start)));              \
+        /* <= is checked to support use inside a loop where                \
+           pointer is incremented after reading data.       */             \
+        TEST_HELPER_ASSERT((uint32_t)(((p) - (start)) + (step)) <= (len)); \
+        (p) += (step);                                                     \
+    } while (0)
 
 /**
  * \brief       4 byte align unsigned char pointer
@@ -31,13 +29,11 @@
  * \param len   Length of byte array
  *
  */
-#define ALIGN_32BIT(p, start, len) do               \
-{                                                   \
-    uint32_t align = ( - (uintptr_t)( p ) ) % 4;    \
-    INCR_ASSERT( ( p ), ( start ), ( len ), align );\
-}                                                   \
-while( 0 )
-
+#define ALIGN_32BIT(p, start, len)               \
+    do {                                         \
+        uint32_t align = (-(uintptr_t)(p)) % 4;  \
+        INCR_ASSERT((p), (start), (len), align); \
+    } while (0)
 
 /**
  * \brief       Verify dependencies. Dependency identifiers are
@@ -48,15 +44,14 @@
  *
  * \return          DEPENDENCY_SUPPORTED if success else DEPENDENCY_NOT_SUPPORTED.
  */
-int verify_dependencies( uint8_t count, uint8_t * dep_p )
+int verify_dependencies(uint8_t count, uint8_t *dep_p)
 {
     uint8_t i;
-    for ( i = 0; i < count; i++ )
-    {
-        if ( dep_check( (int)(dep_p[i]) ) != DEPENDENCY_SUPPORTED )
-            return DEPENDENCY_NOT_SUPPORTED ;
+    for (i = 0; i < count; i++) {
+        if (dep_check((int)(dep_p[i])) != DEPENDENCY_SUPPORTED)
+            return DEPENDENCY_NOT_SUPPORTED;
     }
-    return DEPENDENCY_SUPPORTED ;
+    return DEPENDENCY_SUPPORTED;
 }
 
 /**
@@ -76,11 +71,11 @@
     c[1] = greentea_getc();
     c[2] = '\0';
 
-    TEST_HELPER_ASSERT( mbedtls_test_unhexify( &byte, sizeof( byte ),
-                                               c, &len ) == 0 );
-    TEST_HELPER_ASSERT( len != 2 );
+    TEST_HELPER_ASSERT(mbedtls_test_unhexify(&byte, sizeof(byte), c, &len) ==
+                       0);
+    TEST_HELPER_ASSERT(len != 2);
 
-    return byte ;
+    return byte;
 }
 
 /**
@@ -95,23 +90,17 @@
 {
     uint32_t value;
     size_t len;
-    const uint8_t c_be[8] = { greentea_getc(),
-                              greentea_getc(),
-                              greentea_getc(),
-                              greentea_getc(),
-                              greentea_getc(),
-                              greentea_getc(),
-                              greentea_getc(),
-                              greentea_getc()
-                             };
+    const uint8_t c_be[8] = { greentea_getc(), greentea_getc(), greentea_getc(),
+                              greentea_getc(), greentea_getc(), greentea_getc(),
+                              greentea_getc(), greentea_getc() };
     const uint8_t c[9] = { c_be[6], c_be[7], c_be[4], c_be[5], c_be[2],
                            c_be[3], c_be[0], c_be[1], '\0' };
 
-    TEST_HELPER_ASSERT( mbedtls_test_unhexify( (uint8_t*)&value, sizeof( value ),
-                                               c, &len ) == 0 );
-    TEST_HELPER_ASSERT( len != 8 );
+    TEST_HELPER_ASSERT(
+        mbedtls_test_unhexify((uint8_t *)&value, sizeof(value), c, &len) == 0);
+    TEST_HELPER_ASSERT(len != 8);
 
-    return value ;
+    return value;
 }
 
 /**
@@ -122,17 +111,16 @@
  *
  * \return      unsigned int
  */
-uint32_t parse_uint32( uint8_t * p )
+uint32_t parse_uint32(uint8_t *p)
 {
     uint32_t value;
-    value =  *p++ << 24;
+    value = *p++ << 24;
     value |= *p++ << 16;
     value |= *p++ << 8;
     value |= *p;
-    return value ;
+    return value;
 }
 
-
 /**
  * \brief       Receives test data on serial as greentea key,value pair:
  *              {{<length>;<byte array>}}
@@ -141,54 +129,50 @@
  *
  * \return      Byte array.
  */
-uint8_t * receive_data( uint32_t * data_len )
+uint8_t *receive_data(uint32_t *data_len)
 {
     uint32_t i = 0, errors = 0;
     char c;
-    uint8_t * data = NULL;
+    uint8_t *data = NULL;
 
     /* Read opening braces */
     i = 0;
-    while ( i < 2 )
-    {
+    while (i < 2) {
         c = greentea_getc();
         /* Ignore any prevous CR LF characters */
-        if ( c == '\n' || c == '\r' )
+        if (c == '\n' || c == '\r')
             continue;
         i++;
-        if ( c != '{' )
-            return NULL ;
+        if (c != '{')
+            return NULL;
     }
 
     /* Read data length */
     *data_len = receive_uint32();
-    data = (uint8_t *)malloc( *data_len );
-    TEST_HELPER_ASSERT( data != NULL );
+    data = (uint8_t *)malloc(*data_len);
+    TEST_HELPER_ASSERT(data != NULL);
 
     greentea_getc(); // read ';' received after key i.e. *data_len
 
-    for( i = 0; i < *data_len; i++ )
+    for (i = 0; i < *data_len; i++)
         data[i] = receive_byte();
 
     /* Read closing braces */
-    for( i = 0; i < 2; i++ )
-    {
+    for (i = 0; i < 2; i++) {
         c = greentea_getc();
-        if ( c != '}' )
-        {
+        if (c != '}') {
             errors++;
             break;
         }
     }
 
-    if ( errors )
-    {
-        free( data );
+    if (errors) {
+        free(data);
         data = NULL;
         *data_len = 0;
     }
 
-    return data ;
+    return data;
 }
 
 /**
@@ -201,36 +185,34 @@
  *
  * \return      count of hex params
  */
-uint32_t find_hex_count( uint8_t count, uint8_t * data, uint32_t data_len )
+uint32_t find_hex_count(uint8_t count, uint8_t *data, uint32_t data_len)
 {
     uint32_t i = 0, sz = 0;
     char c;
-    uint8_t * p = NULL;
+    uint8_t *p = NULL;
     uint32_t hex_count = 0;
 
     p = data;
 
-    for( i = 0; i < count; i++ )
-    {
+    for (i = 0; i < count; i++) {
         c = (char)*p;
-        INCR_ASSERT( p, data, data_len, 1 );
+        INCR_ASSERT(p, data, data_len, 1);
 
         /* Align p to 4 bytes for int, expression, string len or hex length */
-        ALIGN_32BIT( p, data, data_len );
+        ALIGN_32BIT(p, data, data_len);
 
         /* Network to host conversion */
-        sz = (int32_t)parse_uint32( p );
+        sz = (int32_t)parse_uint32(p);
 
-        INCR_ASSERT( p, data, data_len, sizeof( int32_t ) );
+        INCR_ASSERT(p, data, data_len, sizeof(int32_t));
 
-        if ( c == 'H' || c == 'S' )
-        {
-            INCR_ASSERT( p, data, data_len, sz );
-            hex_count += ( c == 'H' )?1:0;
+        if (c == 'H' || c == 'S') {
+            INCR_ASSERT(p, data, data_len, sz);
+            hex_count += (c == 'H') ? 1 : 0;
         }
     }
 
-    return hex_count ;
+    return hex_count;
 }
 
 /**
@@ -245,41 +227,38 @@
  *              Note: Caller has the responsibility to delete
  *                    the memory after use.
  */
-void ** parse_parameters( uint8_t count, uint8_t * data, uint32_t data_len,
-                          int * error )
+void **
+parse_parameters(uint8_t count, uint8_t *data, uint32_t data_len, int *error)
 {
     uint32_t i = 0, hex_count = 0;
     char c;
-    void ** params = NULL;
-    void ** cur = NULL;
-    uint8_t * p = NULL;
+    void **params = NULL;
+    void **cur = NULL;
+    uint8_t *p = NULL;
 
     hex_count = find_hex_count(count, data, data_len);
 
-    params = (void **)malloc( sizeof( void *) * ( count + hex_count ) );
-    TEST_HELPER_ASSERT( params != NULL );
+    params = (void **)malloc(sizeof(void *) * (count + hex_count));
+    TEST_HELPER_ASSERT(params != NULL);
     cur = params;
 
     p = data;
 
     /* Parameters */
-    for( i = 0; i < count; i++ )
-    {
+    for (i = 0; i < count; i++) {
         c = (char)*p;
-        INCR_ASSERT( p, data, data_len, 1 );
+        INCR_ASSERT(p, data, data_len, 1);
 
         /* Align p to 4 bytes for int, expression, string len or hex length */
-        ALIGN_32BIT( p, data, data_len );
+        ALIGN_32BIT(p, data, data_len);
 
         /* Network to host conversion */
-        *( (int32_t *)p ) = (int32_t)parse_uint32( p );
+        *((int32_t *)p) = (int32_t)parse_uint32(p);
 
-        switch( c )
-        {
+        switch (c) {
             case 'E':
                 {
-                    if ( get_expression( *( (int32_t *)p ), (int32_t *)p ) )
-                    {
+                    if (get_expression(*((int32_t *)p), (int32_t *)p)) {
                         *error = KEY_VALUE_MAPPING_NOT_FOUND;
                         goto exit;
                     }
@@ -287,37 +266,36 @@
             case 'I':
                 {
                     *cur++ = (void *)p;
-                    INCR_ASSERT( p, data, data_len, sizeof( int32_t ) );
+                    INCR_ASSERT(p, data, data_len, sizeof(int32_t));
                 }
                 break;
             case 'H': /* Intentional fall through */
             case 'S':
                 {
-                    uint32_t * sz = (uint32_t *)p;
-                    INCR_ASSERT( p, data, data_len, sizeof( int32_t ) );
+                    uint32_t *sz = (uint32_t *)p;
+                    INCR_ASSERT(p, data, data_len, sizeof(int32_t));
                     *cur++ = (void *)p;
-                    if ( c == 'H' )
+                    if (c == 'H')
                         *cur++ = (void *)sz;
-                    INCR_ASSERT( p, data, data_len, ( *sz ) );
+                    INCR_ASSERT(p, data, data_len, (*sz));
                 }
                 break;
             default:
-                    {
-                        *error = DISPATCH_INVALID_TEST_DATA;
-                        goto exit;
-                    }
+                {
+                    *error = DISPATCH_INVALID_TEST_DATA;
+                    goto exit;
+                }
                 break;
         }
     }
 
 exit:
-    if ( *error )
-    {
-        free( params );
+    if (*error) {
+        free(params);
         params = NULL;
     }
 
-    return params ;
+    return params;
 }
 
 /**
@@ -328,11 +306,11 @@
  *
  * \return      void
  */
-void send_key_integer( char * key, int value )
+void send_key_integer(char *key, int value)
 {
     char str[50];
-    snprintf( str, sizeof( str ), "%d", value );
-    greentea_send_kv( key, str );
+    snprintf(str, sizeof(str), "%d", value);
+    greentea_send_kv(key, str);
 }
 
 /**
@@ -342,9 +320,9 @@
  *
  * \return      void
  */
-void send_failure( int failure )
+void send_failure(int failure)
 {
-    send_key_integer( "F", failure );
+    send_key_integer("F", failure);
 }
 
 /**
@@ -354,12 +332,11 @@
  *
  * \return      void
  */
-void send_status( int status )
+void send_status(int status)
 {
-    send_key_integer( "R", status );
+    send_key_integer("R", status);
 }
 
-
 /**
  * \brief       Embedded implementation of execute_tests().
  *              Ignores command line and received test data
@@ -370,80 +347,74 @@
  *
  * \return      Program exit status.
  */
-int execute_tests( int args, const char ** argv )
+int execute_tests(int args, const char **argv)
 {
     int ret = 0;
     uint32_t data_len = 0;
     uint8_t count = 0, function_id;
-    void ** params = NULL;
-    uint8_t * data = NULL, * p = NULL;
+    void **params = NULL;
+    uint8_t *data = NULL, *p = NULL;
 
-    GREENTEA_SETUP( 800, "mbedtls_test" );
-    greentea_send_kv( "GO", " " );
+    GREENTEA_SETUP(800, "mbedtls_test");
+    greentea_send_kv("GO", " ");
 
-    while ( 1 )
-    {
+    while (1) {
         ret = 0;
-        mbedtls_test_info_reset( );
+        mbedtls_test_info_reset();
         data_len = 0;
 
-        data = receive_data( &data_len );
-        if ( data == NULL )
+        data = receive_data(&data_len);
+        if (data == NULL)
             continue;
         p = data;
 
-        do
-        {
+        do {
             /* Read dependency count */
             count = *p;
-            TEST_HELPER_ASSERT( count < data_len );
-            INCR_ASSERT( p, data, data_len, sizeof( uint8_t ) );
-            ret = verify_dependencies( count, p );
-            if ( ret != DEPENDENCY_SUPPORTED )
+            TEST_HELPER_ASSERT(count < data_len);
+            INCR_ASSERT(p, data, data_len, sizeof(uint8_t));
+            ret = verify_dependencies(count, p);
+            if (ret != DEPENDENCY_SUPPORTED)
                 break;
 
-            if ( count )
-                INCR_ASSERT( p, data, data_len, count );
+            if (count)
+                INCR_ASSERT(p, data, data_len, count);
 
             /* Read function id */
             function_id = *p;
-            INCR_ASSERT( p, data, data_len, sizeof( uint8_t ) );
-            if ( ( ret = check_test( function_id ) ) != DISPATCH_TEST_SUCCESS )
+            INCR_ASSERT(p, data, data_len, sizeof(uint8_t));
+            if ((ret = check_test(function_id)) != DISPATCH_TEST_SUCCESS)
                 break;
 
             /* Read number of parameters */
             count = *p;
-            INCR_ASSERT( p, data, data_len, sizeof( uint8_t ) );
+            INCR_ASSERT(p, data, data_len, sizeof(uint8_t));
 
             /* Parse parameters if present */
-            if ( count )
-            {
-                params = parse_parameters( count, p, data_len - ( p - data ), &ret );
-                if ( ret )
+            if (count) {
+                params =
+                    parse_parameters(count, p, data_len - (p - data), &ret);
+                if (ret)
                     break;
             }
 
-            ret = dispatch_test( function_id, params );
-        }
-        while ( 0 );
+            ret = dispatch_test(function_id, params);
+        } while (0);
 
-        if ( data )
-        {
-            free( data );
+        if (data) {
+            free(data);
             data = NULL;
         }
 
-        if ( params )
-        {
-            free( params );
+        if (params) {
+            free(params);
             params = NULL;
         }
 
-        if ( ret )
-            send_failure( ret );
+        if (ret)
+            send_failure(ret);
         else
-            send_status( mbedtls_test_info.result );
+            send_status(mbedtls_test_info.result);
     }
-    return 0 ;
+    return 0;
 }
-
diff --git a/tests/suites/test_suite_aes.function b/tests/suites/test_suite_aes.function
index 1892c25..2158573 100644
--- a/tests/suites/test_suite_aes.function
+++ b/tests/suites/test_suite_aes.function
@@ -8,109 +8,124 @@
  */
 
 /* 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);
 
-    mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
-    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 );
+    mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8);
+    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);
     }
 
 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);
 
-    mbedtls_aes_setkey_dec( &ctx, key_str->x, key_str->len * 8 );
-    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 );
+    mbedtls_aes_setkey_dec(&ctx, key_str->x, key_str->len * 8);
+    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);
     }
 
 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 };
+    enum
+    {
+        AES_BLOCK_SIZE = 16
+    };
     unsigned char *data_unit = NULL;
     unsigned char *key = NULL;
     unsigned char *src = NULL;
@@ -119,42 +134,47 @@
     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 };
+    enum
+    {
+        AES_BLOCK_SIZE = 16
+    };
     unsigned char *data_unit = NULL;
     unsigned char *key = NULL;
     unsigned char *src = NULL;
@@ -163,39 +183,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,206 +223,214 @@
     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));
 
-    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);
 
+    mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_aes_crypt_cfb128(&ctx, MBEDTLS_AES_ENCRYPT, 16,
+                                         &iv_offset, iv_str->x, src_str->x,
+                                         output) == 0);
 
-    mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
-    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);
 
+    mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_aes_crypt_cfb128(&ctx, MBEDTLS_AES_DECRYPT, 16,
+                                         &iv_offset, iv_str->x, src_str->x,
+                                         output) == 0);
 
-    mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
-    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);
 
+    mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_aes_crypt_cfb8(&ctx, MBEDTLS_AES_ENCRYPT, src_str->len,
+                                       iv_str->x, src_str->x, output) == 0);
 
-    mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
-    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);
 
+    mbedtls_aes_setkey_enc(&ctx, key_str->x, key_str->len * 8);
+    TEST_ASSERT(mbedtls_aes_crypt_cfb8(&ctx, MBEDTLS_AES_DECRYPT, src_str->len,
+                                       iv_str->x, src_str->x, output) == 0);
 
-    mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
-    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:NOT_DEFINED */
-void aes_invalid_mode( )
+void aes_invalid_mode()
 {
     mbedtls_aes_context aes_ctx;
     const unsigned char in[16] = { 0 };
     unsigned char out[16];
     const int invalid_mode = 42;
 
-    TEST_EQUAL( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                mbedtls_aes_crypt_ecb( &aes_ctx, invalid_mode, in, out ) );
+    TEST_EQUAL(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+               mbedtls_aes_crypt_ecb(&aes_ctx, invalid_mode, in, out));
 
 #if defined(MBEDTLS_CIPHER_MODE_CBC)
-    TEST_EQUAL( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                mbedtls_aes_crypt_cbc( &aes_ctx, invalid_mode, 16,
-                                       out, in, out ) );
+    TEST_EQUAL(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+               mbedtls_aes_crypt_cbc(&aes_ctx, invalid_mode, 16, out, in, out));
 #endif /* MBEDTLS_CIPHER_MODE_CBC */
 
 #if defined(MBEDTLS_CIPHER_MODE_XTS)
     mbedtls_aes_xts_context xts_ctx;
 
-    TEST_EQUAL( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                mbedtls_aes_crypt_xts( &xts_ctx, invalid_mode, 16,
-                                       in, in, out ) );
+    TEST_EQUAL(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+               mbedtls_aes_crypt_xts(&xts_ctx, invalid_mode, 16, in, in, out));
 #endif /* MBEDTLS_CIPHER_MODE_XTS */
 
 #if defined(MBEDTLS_CIPHER_MODE_CFB)
     size_t size;
 
-    TEST_EQUAL( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                mbedtls_aes_crypt_cfb128( &aes_ctx, invalid_mode, 16,
-                                          &size, out, in, out ) );
-    TEST_EQUAL( MBEDTLS_ERR_AES_BAD_INPUT_DATA,
-                mbedtls_aes_crypt_cfb8( &aes_ctx, invalid_mode, 16,
-                                        out, in, out ) );
+    TEST_EQUAL(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+               mbedtls_aes_crypt_cfb128(&aes_ctx, invalid_mode, 16, &size, out,
+                                        in, out));
+    TEST_EQUAL(MBEDTLS_ERR_AES_BAD_INPUT_DATA,
+               mbedtls_aes_crypt_cfb8(&aes_ctx, invalid_mode, 16, out, in,
+                                      out));
 #endif /* MBEDTLS_CIPHER_MODE_CFB */
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void aes_misc_params( )
+void aes_misc_params()
 {
-#if defined(MBEDTLS_CIPHER_MODE_CBC) || \
-    defined(MBEDTLS_CIPHER_MODE_XTS) || \
-    defined(MBEDTLS_CIPHER_MODE_CFB) || \
-    defined(MBEDTLS_CIPHER_MODE_OFB)
+#if defined(MBEDTLS_CIPHER_MODE_CBC) || defined(MBEDTLS_CIPHER_MODE_XTS) || \
+    defined(MBEDTLS_CIPHER_MODE_CFB) || defined(MBEDTLS_CIPHER_MODE_OFB)
     mbedtls_aes_context aes_ctx;
     const unsigned char in[16] = { 0 };
     unsigned char out[16];
@@ -410,59 +438,54 @@
 #if defined(MBEDTLS_CIPHER_MODE_XTS)
     mbedtls_aes_xts_context xts_ctx;
 #endif
-#if defined(MBEDTLS_CIPHER_MODE_CFB) || \
-    defined(MBEDTLS_CIPHER_MODE_OFB)
+#if defined(MBEDTLS_CIPHER_MODE_CFB) || defined(MBEDTLS_CIPHER_MODE_OFB)
     size_t size;
 #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
 
-/*
- * The following line needs to be added to make the code compilable
- * when all the conditions above will be not define in a specific
- * choice of features.
- */
-    TEST_ASSERT( 1 );
-/* TODO: It will be removed when the whole test will be reworked */
+    /*
+     * The following line needs to be added to make the code compilable
+     * when all the conditions above will be not define in a specific
+     * choice of features.
+     */
+    TEST_ASSERT(1);
+    /* TODO: It will be removed when the whole test will be reworked */
 }
 /* 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_aria.function b/tests/suites/test_suite_aria.function
index 0426324..21eefe2 100644
--- a/tests/suites/test_suite_aria.function
+++ b/tests/suites/test_suite_aria.function
@@ -3,12 +3,12 @@
 
 /* Maxium size of data used by test vectors
  * WARNING: to be adapted if and when adding larger test cases */
-#define ARIA_MAX_DATASIZE  160
+#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,7 +17,7 @@
  */
 
 /* BEGIN_CASE depends_on:NOT_DEFINED */
-void aria_invalid_param( )
+void aria_invalid_param()
 {
     mbedtls_aria_context ctx;
     unsigned char input[MBEDTLS_ARIA_BLOCKSIZE] = { 0 };
@@ -25,258 +25,257 @@
     unsigned char iv[MBEDTLS_ARIA_BLOCKSIZE] = { 0 };
     size_t iv_off = 0;
 
-    ((void) iv_off);
-    ((void) iv);
-    ((void) ctx);
-    ((void) input);
-    ((void) output);
+    ((void)iv_off);
+    ((void)iv);
+    ((void)ctx);
+    ((void)input);
+    ((void)output);
 
 #if defined(MBEDTLS_CIPHER_MODE_CBC)
-    TEST_EQUAL( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_cbc( &ctx,
-                                                    42 /* invalid mode */,
-                                                    sizeof( input ),
-                                                    iv,
-                                                    input,
-                                                    output ) );
+    TEST_EQUAL(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+               mbedtls_aria_crypt_cbc(&ctx, 42 /* invalid mode */,
+                                      sizeof(input), iv, input, output));
 #endif /* MBEDTLS_CIPHER_MODE_CBC */
 
 #if defined(MBEDTLS_CIPHER_MODE_CFB)
-    TEST_EQUAL( MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
-                            mbedtls_aria_crypt_cfb128( &ctx,
-                                                    42, /* invalid mode */
-                                                    sizeof( input ),
-                                                    &iv_off,
-                                                    iv,
-                                                    input,
-                                                    output ) );
+    TEST_EQUAL(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA,
+               mbedtls_aria_crypt_cfb128(&ctx, 42, /* invalid mode */
+                                         sizeof(input), &iv_off, iv, input,
+                                         output));
 #endif /* MBEDTLS_CIPHER_MODE_CFB */
 
 exit:
     return;
-
 }
 /* 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 78ccdb0..e2a2b9f 100644
--- a/tests/suites/test_suite_asn1parse.function
+++ b/tests/suites/test_suite_asn1parse.function
@@ -6,18 +6,18 @@
 #include "mbedtls/bignum.h"
 #include "mbedtls/asn1.h"
 #if defined(MBEDTLS_ASN1_WRITE_C)
-#include "mbedtls/asn1write.h"
+#    include "mbedtls/asn1write.h"
 #endif
 
-/* Used internally to report an error that indicates a bug in a parsing function. */
+/* Used internally to report an error that indicates a bug in a parsing
+ * function. */
 #define ERR_PARSE_INCONSISTENCY INT_MAX
 
 /* Use this magic value in some tests to indicate that the expected result
  * 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,73 +28,71 @@
 
     /* 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 );
-            break;
-        }
-
-        case MBEDTLS_ASN1_INTEGER:
-        {
-#if defined(MBEDTLS_BIGNUM_C)
-            mbedtls_mpi mpi;
-            mbedtls_mpi_init( &mpi );
-            *p = start;
-            ret = mbedtls_asn1_get_mpi( p, end, &mpi );
-            mbedtls_mpi_free( &mpi );
-#else
-            *p = start + 1;
-            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 ) )
             {
                 int val = -257;
-                unsigned char *q = start;
-                ret = mbedtls_asn1_get_int( &q, end, &val );
-                TEST_ASSERT( *p == q );
+                *p = start;
+                ret = mbedtls_asn1_get_bool(p, end, &val);
+                if (ret == 0)
+                    TEST_ASSERT(val == 0 || val == 1);
+                break;
             }
-            break;
-        }
+
+        case MBEDTLS_ASN1_INTEGER:
+            {
+#if defined(MBEDTLS_BIGNUM_C)
+                mbedtls_mpi mpi;
+                mbedtls_mpi_init(&mpi);
+                *p = start;
+                ret = mbedtls_asn1_get_mpi(p, end, &mpi);
+                mbedtls_mpi_free(&mpi);
+#else
+                *p = start + 1;
+                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)) {
+                    int val = -257;
+                    unsigned char *q = start;
+                    ret = mbedtls_asn1_get_int(&q, end, &val);
+                    TEST_ASSERT(*p == q);
+                }
+                break;
+            }
 
         case MBEDTLS_ASN1_BIT_STRING:
-        {
-            mbedtls_asn1_bitstring bs;
-            *p = start;
-            ret = mbedtls_asn1_get_bitstring( p, end, &bs );
-            break;
-        }
+            {
+                mbedtls_asn1_bitstring bs;
+                *p = start;
+                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 );
-            break;
-        }
+            {
+                while (*p <= end && *p < content_start + len && ret == 0)
+                    ret = nested_parse(p, content_start + len);
+                break;
+            }
 
         case MBEDTLS_ASN1_OCTET_STRING:
         case MBEDTLS_ASN1_NULL:
@@ -111,18 +109,17 @@
         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 +127,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;
@@ -187,39 +174,38 @@
  * (see traverse_sequence_of). */
 #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 +216,7 @@
  */
 
 /* 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 +234,40 @@
      * 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 )
+        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 ) */
         {
-            TEST_EQUAL( ret, MBEDTLS_ERR_ASN1_OUT_OF_DATA );
+            if (overfull_result != UNPREDICTABLE_RESULT)
+                TEST_EQUAL(ret, overfull_result);
         }
-        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 );
-        }
-        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 +278,34 @@
      * 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 +314,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 +356,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 +382,27 @@
     }
 
     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, 16, 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, 16, 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 +415,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 +449,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 +469,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 +488,64 @@
         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 +561,50 @@
     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 +614,151 @@
      * "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 );
+    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_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 );
-    }
-    else
-        TEST_ASSERT( ret != 0 );
+    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);
 }
 /* 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;
     const 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++ )
-        nd[i].next = pointers[i+1];
+    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( (const mbedtls_asn1_named_data*) pointers[from],
-                                          (const char *) needle->x,
-                                          needle->len );
-    TEST_ASSERT( found == pointers[position] );
+    found = mbedtls_asn1_find_named_data(
+        (const mbedtls_asn1_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 };
-    mbedtls_asn1_named_data head =
-        { {0x06, 0, NULL}, {0, 0, NULL}, NULL, 0 };
+    mbedtls_asn1_named_data next = { { 0x06, 0, NULL },
+                                     { 0, 0xcafe, NULL },
+                                     NULL,
+                                     0 };
+    mbedtls_asn1_named_data head = { { 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, sizeof( mbedtls_asn1_named_data ) );
+        ASSERT_ALLOC(new, sizeof(mbedtls_asn1_named_data));
         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 312145d..0fd0517 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,39 @@
     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 );
-    ASSERT_ALLOC( data->output, data->size == 0 ? 1 : data->size );
+    mbedtls_test_set_step(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:
-    mbedtls_free( data->output );
+    mbedtls_free(data->output);
     data->output = NULL;
-    return ok ;
+    return ok;
 }
 
 /* END_HEADER */
@@ -58,198 +55,187 @@
  */
 
 /* 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;
     }
 
 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;
     }
 
 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;
     }
 
 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;
     }
 
 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;
     int ret;
 
-    mbedtls_mpi_init( &mpi );
-    TEST_ASSERT( mbedtls_mpi_read_binary( &mpi, val->x, val->len ) == 0 );
+    mbedtls_mpi_init(&mpi);
+    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( expected->len > 10 && data.size == 8 )
+        if (expected->len > 10 && data.size == 8)
             data.size = expected->len - 2;
     }
 
 exit:
-    mbedtls_mpi_free( &mpi );
-    mbedtls_free( data.output );
+    mbedtls_mpi_free(&mpi);
+    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 );
+                ret = mbedtls_asn1_write_octet_string(&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 );
+                ret = mbedtls_asn1_write_oid(&data.p, data.start,
+                                             (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 );
+                ret = mbedtls_asn1_write_utf8_string(&data.p, data.start,
+                                                     (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 );
+                    &data.p, data.start, (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 );
+                ret = mbedtls_asn1_write_ia5_string(&data.p, data.start,
+                                                    (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 );
+                ret = mbedtls_asn1_write_tagged_string(&data.p, data.start, tag,
+                                                       (const char *)content->x,
+                                                       content->len);
         }
-        if( ! generic_write_finish_step( &data, expected, ret ) )
+        if (!generic_write_finish_step(&data, expected, ret))
             goto exit;
-        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;
 
-    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 );
+            &data.p, data.start, (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;
     }
 
 exit:
-    mbedtls_free( data.output );
+    mbedtls_free(data.output);
 }
 /* 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];
@@ -257,217 +243,204 @@
     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, const 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, const unsigned char *start,
+                const unsigned char *buf,
+                size_t bits) = (is_named ? mbedtls_asn1_write_named_bitstring :
+                                           mbedtls_asn1_write_bitstring);
 
-    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;
     }
 
 exit:
-    mbedtls_free( data.output );
+    mbedtls_free(data.output);
 }
 /* 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];
+        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] );
+    for (i = 0; i < ARRAY_LENGTH(nd); i++)
+        TEST_ASSERT(nd[i].next == pointers[i + 1]);
 
-    if( position >= 0 )
-    {
+    if (position >= 0) {
         /* position should have been found and modified. */
-        TEST_ASSERT( head == pointers[from] );
-        TEST_ASSERT( found == pointers[position] );
-    }
-    else
-    {
+        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 };
+    mbedtls_asn1_named_data nd = { { 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";
+    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 );
+    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 );
+        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 )
+void store_named_data_val_new(int new_len)
 {
     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 );
-    const unsigned char *new_val = (unsigned char *) "new value";
+    const unsigned char *oid = (unsigned char *)"OID";
+    size_t oid_len = strlen((const char *)oid);
+    const unsigned char *new_val = (unsigned char *)"new value";
 
-    if( new_len <= 0 )
+    if (new_len <= 0)
         new_val = NULL;
-    if( new_len < 0 )
-        new_len = - new_len;
+    if (new_len < 0)
+        new_len = -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 );
+    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 be9b6e8..badaf6e 100644
--- a/tests/suites/test_suite_base64.function
+++ b/tests/suites/test_suite_base64.function
@@ -9,8 +9,10 @@
  */
 
 /* 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];
@@ -19,26 +21,26 @@
     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 );
+    /* 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);
 
-    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];
@@ -48,87 +50,85 @@
     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 );
+    /* 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);
 
-    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:
-    ;;
+exit:;
+    ;
 }
 /* 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_camellia.function b/tests/suites/test_suite_camellia.function
index cc18d5b..1635a38 100644
--- a/tests/suites/test_suite_camellia.function
+++ b/tests/suites/test_suite_camellia.function
@@ -8,34 +8,27 @@
  */
 
 /* BEGIN_CASE depends_on:NOT_DEFINED */
-void camellia_invalid_param( )
+void camellia_invalid_param()
 {
     mbedtls_camellia_context ctx;
     unsigned char buf[16] = { 0 };
     const int invalid_mode = 42;
     size_t off;
-    ((void) off);
+    ((void)off);
 
-    TEST_EQUAL( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_ecb( &ctx,
-                                                        invalid_mode,
-                                                        buf, buf ) );
+    TEST_EQUAL(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+               mbedtls_camellia_crypt_ecb(&ctx, invalid_mode, buf, buf));
 
 #if defined(MBEDTLS_CIPHER_MODE_CBC)
-    TEST_EQUAL( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_cbc( &ctx,
-                                                        invalid_mode,
-                                                        sizeof( buf ),
-                                                        buf, buf, buf ) );
+    TEST_EQUAL(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+               mbedtls_camellia_crypt_cbc(&ctx, invalid_mode, sizeof(buf), buf,
+                                          buf, buf));
 #endif /* MBEDTLS_CIPHER_MODE_CBC */
 
 #if defined(MBEDTLS_CIPHER_MODE_CFB)
-    TEST_EQUAL( MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
-                            mbedtls_camellia_crypt_cfb128( &ctx,
-                                                           invalid_mode,
-                                                           sizeof( buf ),
-                                                           &off, buf,
-                                                           buf, buf ) );
+    TEST_EQUAL(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA,
+               mbedtls_camellia_crypt_cfb128(&ctx, invalid_mode, sizeof(buf),
+                                             &off, buf, buf, buf));
 #endif /* MBEDTLS_CIPHER_MODE_CFB */
 
 exit:
@@ -44,152 +37,164 @@
 /* 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 )
-    {
-
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, src_str->len,
-                                          dst->len ) == 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);
     }
 
 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 )
-    {
-
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, src_str->len,
-                                          dst->len ) == 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);
     }
 
 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 840583c..c61288a 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,38 @@
     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 );
+    if (res == 0)
+        TEST_ASSERT(decrypt_ret == MBEDTLS_ERR_CCM_AUTH_FAILED);
     else
-        TEST_ASSERT( decrypt_ret == res );
+        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 +88,126 @@
     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 );
+    if (res == 0 && tag_len != 0)
+        TEST_ASSERT(decrypt_ret == MBEDTLS_ERR_CCM_AUTH_FAILED);
     else
-        TEST_ASSERT( decrypt_ret == res );
+        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 +215,51 @@
     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);
+        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,40 +267,39 @@
     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);
+        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 */
diff --git a/tests/suites/test_suite_chacha20.function b/tests/suites/test_suite_chacha20.function
index 9afadb7..17668c9 100644
--- a/tests/suites/test_suite_chacha20.function
+++ b/tests/suites/test_suite_chacha20.function
@@ -8,43 +8,45 @@
  */
 
 /* 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,23 +54,23 @@
 
     /* 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 */
 
 /* 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 2e1e7b2..80e582e 100644
--- a/tests/suites/test_suite_chachapoly.function
+++ b/tests/suites/test_suite_chachapoly.function
@@ -8,61 +8,69 @@
  */
 
 /* 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,80 +83,73 @@
     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 ff229e1..ad5c172 100644
--- a/tests/suites/test_suite_cipher.function
+++ b/tests/suites/test_suite_cipher.function
@@ -2,15 +2,15 @@
 #include "mbedtls/cipher.h"
 
 #if defined(MBEDTLS_AES_C)
-#include "mbedtls/aes.h"
+#    include "mbedtls/aes.h"
 #endif
 
 #if defined(MBEDTLS_GCM_C)
-#include "mbedtls/gcm.h"
+#    include "mbedtls/gcm.h"
 #endif
 
 #if defined(MBEDTLS_CIPHER_MODE_AEAD) || defined(MBEDTLS_NIST_KW_C)
-#define MBEDTLS_CIPHER_AUTH_CRYPT
+#    define MBEDTLS_CIPHER_AUTH_CRYPT
 #endif
 
 #if defined(MBEDTLS_CIPHER_AUTH_CRYPT)
@@ -23,35 +23,37 @@
  * 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 )
+#    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
+#    endif /* MBEDTLS_USE_PSA_CRYPTO */
     {
-        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;
 }
 
 /*
@@ -59,10 +61,10 @@
  * 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;
 }
@@ -76,17 +78,17 @@
  */
 
 /* 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;
@@ -95,120 +97,100 @@
     unsigned char valid_buffer[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
     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() ) );
+    const mbedtls_cipher_info_t *valid_info =
+        mbedtls_cipher_info_from_type(*(mbedtls_cipher_list()));
     size_t size_t_var;
 
     (void)valid_mode; /* In some configurations this is unused */
 
-    mbedtls_cipher_init( &valid_ctx );
-    mbedtls_cipher_setup( &valid_ctx, valid_info );
-    mbedtls_cipher_init( &invalid_ctx );
+    mbedtls_cipher_init(&valid_ctx);
+    mbedtls_cipher_setup(&valid_ctx, valid_info);
+    mbedtls_cipher_init(&invalid_ctx);
 
     /* 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_NONE);
+    TEST_ASSERT(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 );
+    TEST_ASSERT(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 );
+    TEST_ASSERT(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 );
+    TEST_ASSERT(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:NOT_DEFINED */
-void cipher_invalid_param_conditional( )
+void cipher_invalid_param_conditional()
 {
     mbedtls_cipher_context_t valid_ctx;
 
@@ -216,73 +198,72 @@
     unsigned char valid_buffer[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
     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() ) );
+    const mbedtls_cipher_info_t *valid_info =
+        mbedtls_cipher_info_from_type(*(mbedtls_cipher_list()));
 
-    TEST_EQUAL(
-        MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
-        mbedtls_cipher_setkey( &valid_ctx,
-                               valid_buffer,
-                               valid_bitlen,
-                               invalid_operation ) );
+    TEST_EQUAL(MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA,
+               mbedtls_cipher_setkey(&valid_ctx, valid_buffer, valid_bitlen,
+                                     invalid_operation));
 
-exit:
-    ;
+exit:;
 }
 /* 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;
     unsigned char key[64];
@@ -300,114 +281,116 @@
     /*
      * 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;
+    (void)pad_mode;
 #endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */
 
     /*
      * 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));
 
-    TEST_ASSERT( 0 == mbedtls_cipher_set_iv( &ctx_dec, iv, sizeof( iv ) ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_set_iv( &ctx_enc, iv, sizeof( iv ) ) );
+        TEST_ASSERT(0 == mbedtls_cipher_set_iv(&ctx_dec, iv, sizeof(iv)));
+        TEST_ASSERT(0 == mbedtls_cipher_set_iv(&ctx_enc, iv, sizeof(iv)));
 
-    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];
@@ -421,46 +404,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;
+    (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];
@@ -473,42 +456,40 @@
 
     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);
-    TEST_ASSERT( sizeof(key) * 8 >= cipher_info->key_bitlen );
+    cipher_info = mbedtls_cipher_info_from_type(cipher);
+    TEST_ASSERT(NULL != cipher_info);
+    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, 16 ) );
+    TEST_ASSERT(0 == mbedtls_cipher_set_iv(&ctx_dec, iv, 16));
 
-    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.
@@ -517,20 +498,25 @@
         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;
@@ -550,158 +536,177 @@
     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;
+    (void)pad_mode;
 #endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */
 
-    TEST_ASSERT( 0 == mbedtls_cipher_set_iv( &ctx_dec, iv, 16 ) );
-    TEST_ASSERT( 0 == mbedtls_cipher_set_iv( &ctx_enc, iv, 16 ) );
+    TEST_ASSERT(0 == mbedtls_cipher_set_iv(&ctx_dec, iv, 16));
+    TEST_ASSERT(0 == mbedtls_cipher_set_iv(&ctx_enc, iv, 16));
 
-    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);
-    ((void) tag);
+    ((void)ad);
+    ((void)tag);
 #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;
+    (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
@@ -726,21 +731,21 @@
     /* 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;
+    (void)use_psa;
 #endif
 
     /*
@@ -757,8 +762,8 @@
     /*
      * 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;
 
     /*
@@ -766,255 +771,257 @@
      * (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
         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);
     }
 
-    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;
     }
 
 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_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;
+    (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 */
diff --git a/tests/suites/test_suite_cmac.function b/tests/suites/test_suite_cmac.function
index cabf107..c628831 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,100 @@
     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);
 
-    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);
 
 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 +125,69 @@
 
     /* 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;
@@ -208,79 +195,69 @@
 
     /* Convert the test parameters to binary data */
 
-
-
-    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_ctr_drbg.function b/tests/suites/test_suite_ctr_drbg.function
index 1447a04..32092ef 100644
--- a/tests/suites/test_suite_ctr_drbg.function
+++ b/tests/suites/test_suite_ctr_drbg.function
@@ -13,84 +13,73 @@
 };
 
 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 size_t test_max_idx = 0;
+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 );
+    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);
     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;
+    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_prediction_resistance(
-            &ctx,
-            MBEDTLS_CTR_DRBG_PR_ON );
+    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);
 
-    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 +90,126 @@
  */
 
 /* 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 +218,108 @@
     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
         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(
-                     &ctx, entropy, sizeof( entropy ) ) != 0 );
+    TEST_ASSERT(mbedtls_ctr_drbg_update(&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 197a7ef..9e0b106 100644
--- a/tests/suites/test_suite_debug.function
+++ b/tests/suites/test_suite_debug.function
@@ -2,40 +2,44 @@
 #include "mbedtls/debug.h"
 #include "string.h"
 
-struct buffer_data
-{
+struct buffer_data {
     char buf[2000];
     char *ptr;
 };
 
-void string_debug(void *data, int level, const char *file, int line, const char *str)
+void string_debug(void *data,
+                  int level,
+                  const char *file,
+                  int line,
+                  const char *str)
 {
-    struct buffer_data *buffer = (struct buffer_data *) data;
+    struct buffer_data *buffer = (struct buffer_data *)data;
     char *p = buffer->ptr;
-    ((void) level);
+    ((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 +52,163 @@
  */
 
 /* 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:!MBEDTLS_X509_REMOVE_INFO */
-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_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( int radix, char * value, char * file, int line,
-                              char * prefix, char * result_str )
+void mbedtls_debug_print_mpi(int radix,
+                             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, radix, value ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&val, radix, 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 5b24935..63d0c0f 100644
--- a/tests/suites/test_suite_des.function
+++ b/tests/suites/test_suite_des.function
@@ -8,269 +8,271 @@
  */
 
 /* 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);
 
+    mbedtls_des_setkey_enc(&ctx, key_str->x);
+    TEST_ASSERT(mbedtls_des_crypt_ecb(&ctx, src_str->x, output) == 0);
 
-    mbedtls_des_setkey_enc( &ctx, key_str->x );
-    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);
 
+    mbedtls_des_setkey_dec(&ctx, key_str->x);
+    TEST_ASSERT(mbedtls_des_crypt_ecb(&ctx, src_str->x, output) == 0);
 
-    mbedtls_des_setkey_dec( &ctx, key_str->x );
-    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);
 
-
-    mbedtls_des_setkey_enc( &ctx, key_str->x );
-    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 );
+    mbedtls_des_setkey_enc(&ctx, key_str->x);
+    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);
     }
 
 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);
 
-
-    mbedtls_des_setkey_dec( &ctx, key_str->x );
-    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 );
+    mbedtls_des_setkey_dec(&ctx, key_str->x);
+    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);
     }
 
 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 )
-        mbedtls_des3_set2key_enc( &ctx, key_str->x );
-    else if( key_count == 3 )
-        mbedtls_des3_set3key_enc( &ctx, key_str->x );
+    if (key_count == 2)
+        mbedtls_des3_set2key_enc(&ctx, key_str->x);
+    else if (key_count == 3)
+        mbedtls_des3_set3key_enc(&ctx, key_str->x);
     else
-        TEST_ASSERT( 0 );
+        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 )
-        mbedtls_des3_set2key_dec( &ctx, key_str->x );
-    else if( key_count == 3 )
-        mbedtls_des3_set3key_dec( &ctx, key_str->x );
+    if (key_count == 2)
+        mbedtls_des3_set2key_dec(&ctx, key_str->x);
+    else if (key_count == 3)
+        mbedtls_des3_set3key_dec(&ctx, key_str->x);
     else
-        TEST_ASSERT( 0 );
+        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 )
-        mbedtls_des3_set2key_enc( &ctx, key_str->x );
-    else if( key_count == 3 )
-        mbedtls_des3_set3key_enc( &ctx, key_str->x );
+    if (key_count == 2)
+        mbedtls_des3_set2key_enc(&ctx, key_str->x);
+    else if (key_count == 3)
+        mbedtls_des3_set3key_enc(&ctx, key_str->x);
     else
-        TEST_ASSERT( 0 );
+        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 )
-    {
-
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x,
-                                          src_str->len, dst->len ) == 0 );
+    if (cbc_result == 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 )
-        mbedtls_des3_set2key_dec( &ctx, key_str->x );
-    else if( key_count == 3 )
-        mbedtls_des3_set3key_dec( &ctx, key_str->x );
+    if (key_count == 2)
+        mbedtls_des3_set2key_dec(&ctx, key_str->x);
+    else if (key_count == 3)
+        mbedtls_des3_set3key_dec(&ctx, key_str->x);
     else
-        TEST_ASSERT( 0 );
+        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 )
-    {
-
-        TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, src_str->len,
-                                          dst->len ) == 0 );
+    if (cbc_result == 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 );
-            parity = parity ^
-                    ( parity >> 1 ) ^
-                    ( parity >> 2 ) ^
-                    ( parity >> 3 );
+        for (j = 0; j < 8; j++) {
+            parity = key[j] ^ (key[j] >> 4);
+            parity = parity ^ (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 db88daa..6027feb 100644
--- a/tests/suites/test_suite_dhm.function
+++ b/tests/suites/test_suite_dhm.function
@@ -1,83 +1,84 @@
 /* BEGIN_HEADER */
 #include "mbedtls/dhm.h"
 
-int check_get_value( const mbedtls_dhm_context *ctx,
-                     mbedtls_dhm_parameter param,
-                     const mbedtls_mpi *expected )
+int check_get_value(const mbedtls_dhm_context *ctx,
+                    mbedtls_dhm_parameter param,
+                    const mbedtls_mpi *expected)
 {
     mbedtls_mpi actual;
     int ok = 0;
-    mbedtls_mpi_init( &actual );
+    mbedtls_mpi_init(&actual);
 
-    TEST_ASSERT( mbedtls_dhm_get_value( ctx, param, &actual ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &actual, expected ) == 0 );
+    TEST_ASSERT(mbedtls_dhm_get_value(ctx, param, &actual) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&actual, expected) == 0);
     ok = 1;
 
 exit:
-    mbedtls_mpi_free( &actual );
-    return ok ;
+    mbedtls_mpi_free(&actual);
+    return ok;
 }
 
 /* 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 */
@@ -88,8 +89,12 @@
  */
 
 /* BEGIN_CASE */
-void dhm_do_dhm( int radix_P, char *input_P, int x_size,
-                 int radix_G, char *input_G, int result )
+void dhm_do_dhm(int radix_P,
+                char *input_P,
+                int x_size,
+                int radix_G,
+                char *input_G,
+                int result)
 {
     mbedtls_dhm_context ctx_srv;
     mbedtls_dhm_context ctx_cli;
@@ -105,84 +110,81 @@
     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, radix_P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &ctx_srv.G, radix_G, input_G ) == 0 );
-    pub_cli_len = mbedtls_mpi_size( &ctx_srv.P );
-    TEST_ASSERT( check_get_value( &ctx_srv, MBEDTLS_DHM_PARAM_P, &ctx_srv.P ) );
-    TEST_ASSERT( check_get_value( &ctx_srv, MBEDTLS_DHM_PARAM_G, &ctx_srv.G ) );
+    TEST_ASSERT(mbedtls_test_read_mpi(&ctx_srv.P, radix_P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&ctx_srv.G, radix_G, input_G) == 0);
+    pub_cli_len = mbedtls_mpi_size(&ctx_srv.P);
+    TEST_ASSERT(check_get_value(&ctx_srv, MBEDTLS_DHM_PARAM_P, &ctx_srv.P));
+    TEST_ASSERT(check_get_value(&ctx_srv, MBEDTLS_DHM_PARAM_G, &ctx_srv.G));
 
     /*
      * 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);
     /* The domain parameters must be the same on both side. */
-    TEST_ASSERT( check_get_value( &ctx_cli, MBEDTLS_DHM_PARAM_P, &ctx_srv.P ) );
-    TEST_ASSERT( check_get_value( &ctx_cli, MBEDTLS_DHM_PARAM_G, &ctx_srv.G ) );
+    TEST_ASSERT(check_get_value(&ctx_cli, MBEDTLS_DHM_PARAM_P, &ctx_srv.P));
+    TEST_ASSERT(check_get_value(&ctx_cli, MBEDTLS_DHM_PARAM_G, &ctx_srv.G));
 
-    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,
-                                          &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(mbedtls_dhm_calc_secret(
+                    &ctx_cli, sec_cli, sizeof(sec_cli), &sec_cli_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);
 
     /* Internal value checks */
-    TEST_ASSERT( check_get_value( &ctx_cli, MBEDTLS_DHM_PARAM_X, &ctx_cli.X ) );
-    TEST_ASSERT( check_get_value( &ctx_srv, MBEDTLS_DHM_PARAM_X, &ctx_srv.X ) );
+    TEST_ASSERT(check_get_value(&ctx_cli, MBEDTLS_DHM_PARAM_X, &ctx_cli.X));
+    TEST_ASSERT(check_get_value(&ctx_srv, MBEDTLS_DHM_PARAM_X, &ctx_srv.X));
     /* Cross-checks */
-    TEST_ASSERT( check_get_value( &ctx_cli, MBEDTLS_DHM_PARAM_GX, &ctx_srv.GY ) );
-    TEST_ASSERT( check_get_value( &ctx_cli, MBEDTLS_DHM_PARAM_GY, &ctx_srv.GX ) );
-    TEST_ASSERT( check_get_value( &ctx_cli, MBEDTLS_DHM_PARAM_K, &ctx_srv.K ) );
-    TEST_ASSERT( check_get_value( &ctx_srv, MBEDTLS_DHM_PARAM_GX, &ctx_cli.GY ) );
-    TEST_ASSERT( check_get_value( &ctx_srv, MBEDTLS_DHM_PARAM_GY, &ctx_cli.GX ) );
-    TEST_ASSERT( check_get_value( &ctx_srv, MBEDTLS_DHM_PARAM_K, &ctx_cli.K ) );
+    TEST_ASSERT(check_get_value(&ctx_cli, MBEDTLS_DHM_PARAM_GX, &ctx_srv.GY));
+    TEST_ASSERT(check_get_value(&ctx_cli, MBEDTLS_DHM_PARAM_GY, &ctx_srv.GX));
+    TEST_ASSERT(check_get_value(&ctx_cli, MBEDTLS_DHM_PARAM_K, &ctx_srv.K));
+    TEST_ASSERT(check_get_value(&ctx_srv, MBEDTLS_DHM_PARAM_GX, &ctx_cli.GY));
+    TEST_ASSERT(check_get_value(&ctx_srv, MBEDTLS_DHM_PARAM_GY, &ctx_cli.GX));
+    TEST_ASSERT(check_get_value(&ctx_srv, MBEDTLS_DHM_PARAM_K, &ctx_cli.K));
 
-    /* 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 );
+    /* 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);
         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);
     }
 
     /*
@@ -190,98 +192,97 @@
      */
     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,
-                                          &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(mbedtls_dhm_calc_secret(
+                    &ctx_cli, sec_cli, sizeof(sec_cli), &sec_cli_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);
 
 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, int radix_G, char *input_G, int result )
+void dhm_make_public(int P_bytes, int radix_G, 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, radix_G, input_G ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&G, radix_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, 16, p ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &G, 16, g ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, 16, p) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&G, 16, g) == 0);
 
-    TEST_ASSERT( mbedtls_dhm_parse_dhmfile( &ctx, filename ) == 0 );
+    TEST_ASSERT(mbedtls_dhm_parse_dhmfile(&ctx, filename) == 0);
 
-    TEST_EQUAL( mbedtls_dhm_get_len( &ctx ), (size_t) len );
-    TEST_EQUAL( mbedtls_dhm_get_bitlen( &ctx ), mbedtls_mpi_bitlen( &P ) );
-    TEST_ASSERT( check_get_value( &ctx, MBEDTLS_DHM_PARAM_P, &P ) );
-    TEST_ASSERT( check_get_value( &ctx, MBEDTLS_DHM_PARAM_G, &G ) );
+    TEST_EQUAL(mbedtls_dhm_get_len(&ctx), (size_t)len);
+    TEST_EQUAL(mbedtls_dhm_get_bitlen(&ctx), mbedtls_mpi_bitlen(&P));
+    TEST_ASSERT(check_get_value(&ctx, MBEDTLS_DHM_PARAM_P, &P));
+    TEST_ASSERT(check_get_value(&ctx, MBEDTLS_DHM_PARAM_G, &G));
 
 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 b0cd2e4..018bc6f 100644
--- a/tests/suites/test_suite_ecdh.function
+++ b/tests/suites/test_suite_ecdh.function
@@ -1,39 +1,33 @@
 /* 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,15 +38,14 @@
  */
 
 /* BEGIN_CASE depends_on:NOT_DEFINED */
-void ecdh_invalid_param( )
+void ecdh_invalid_param()
 {
     mbedtls_ecdh_context ctx;
     mbedtls_ecp_keypair kp;
     int invalid_side = 42;
 
-    TEST_EQUAL( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecdh_get_params( &ctx, &kp,
-                                                     invalid_side ) );
+    TEST_EQUAL(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+               mbedtls_ecdh_get_params(&ctx, &kp, invalid_side));
 
 exit:
     return;
@@ -60,48 +53,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,
-                                              &mbedtls_test_rnd_pseudo_rand,
-                                              &rnd_info ) == 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,
+                                            &mbedtls_test_rnd_pseudo_rand,
+                                            &rnd_info) == 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;
@@ -109,13 +113,17 @@
     mbedtls_test_rnd_buf_info rnd_info_A, rnd_info_B;
     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 ); mbedtls_mpi_init( &check );
-    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);
+    mbedtls_mpi_init(&check);
+    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);
 
     rnd_info_A.buf = rnd_buf_A->x;
     rnd_info_A.length = rnd_buf_A->len;
@@ -123,16 +131,15 @@
     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++ )
-            rnd_buf_A->x[i] = rnd_buf_A->x[i] << shift
-                         | rnd_buf_A->x[i+1] >> ( 8 - shift );
+        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[rnd_info_A.length-1] <<= shift;
+        rnd_buf_A->x[rnd_info_A.length - 1] <<= shift;
     }
 
     rnd_info_B.buf = rnd_buf_B->x;
@@ -141,56 +148,59 @@
     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++ )
-            rnd_buf_B->x[i] = rnd_buf_B->x[i] << shift
-                         | rnd_buf_B->x[i+1] >> ( 8 - shift );
+        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[rnd_info_B.length-1] <<= 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, 16, xA_str ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &qA.X, &check ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &check, 16, 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, 16, xA_str) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&qA.X, &check) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&check, 16, 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, 16, xB_str ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &qB.X, &check ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &check, 16, 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, 16, xB_str) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&qB.X, &check) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&check, 16, yB_str) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&qB.Y, &check) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &check, 16, z_str ) == 0 );
-    TEST_ASSERT( mbedtls_ecdh_compute_shared( &grp, &zA, &qB, &dA,
-                                              &mbedtls_test_rnd_pseudo_rand,
-                                              &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &zA, &check ) == 0 );
-    TEST_ASSERT( mbedtls_ecdh_compute_shared( &grp, &zB, &qA, &dB,
-                                              &mbedtls_test_rnd_pseudo_rand,
-                                              &rnd_info ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &zB, &check ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&check, 16, z_str) == 0);
+    TEST_ASSERT(mbedtls_ecdh_compute_shared(&grp, &zA, &qB, &dA,
+                                            &mbedtls_test_rnd_pseudo_rand,
+                                            &rnd_info) == 0);
+    TEST_ASSERT(mbedtls_mpi_cmp_mpi(&zA, &check) == 0);
+    TEST_ASSERT(mbedtls_ecdh_compute_shared(&grp, &zB, &qA, &dB,
+                                            &mbedtls_test_rnd_pseudo_rand,
+                                            &rnd_info) == 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];
@@ -200,42 +210,49 @@
     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,
-                                           &mbedtls_test_rnd_pseudo_rand,
-                                           &rnd_info ) == 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,
+                                         &mbedtls_test_rnd_pseudo_rand,
+                                         &rnd_info) == 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;
@@ -247,10 +264,10 @@
     int cnt_restart;
     mbedtls_ecp_group grp;
 
-    mbedtls_ecp_group_init( &grp );
-    mbedtls_ecdh_init( &srv );
-    mbedtls_ecdh_init( &cli );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    mbedtls_ecp_group_init(&grp);
+    mbedtls_ecdh_init(&srv);
+    mbedtls_ecdh_init(&cli);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
 
     rnd_info_A.fallback_f_rng = mbedtls_test_rnd_std_rand;
     rnd_info_A.fallback_p_rng = NULL;
@@ -264,109 +281,108 @@
 
     /* The ECDH context is not guaranteed ot 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 ),
-                                        &mbedtls_test_rnd_pseudo_rand,
-                                        &rnd_info );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart );
+        ret = mbedtls_ecdh_calc_secret(&srv, &len, buf, sizeof(buf),
+                                       &mbedtls_test_rnd_pseudo_rand,
+                                       &rnd_info);
+    } 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 ),
-                                        &mbedtls_test_rnd_pseudo_rand,
-                                        &rnd_info );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart );
+        ret = mbedtls_ecdh_calc_secret(&cli, &len, buf, sizeof(buf),
+                                       &mbedtls_test_rnd_pseudo_rand,
+                                       &rnd_info);
+    } 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 */
-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;
@@ -375,92 +391,83 @@
     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 ) )
+    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 (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 4496812..654f14e 100644
--- a/tests/suites/test_suite_ecdsa.function
+++ b/tests/suites/test_suite_ecdsa.function
@@ -8,7 +8,7 @@
  */
 
 /* BEGIN_CASE */
-void ecdsa_prim_zero( int id )
+void ecdsa_prim_zero(int id)
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point Q;
@@ -16,31 +16,35 @@
     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;
@@ -48,102 +52,123 @@
     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;
     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_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);
 
-    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, 16, d_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &r_check, 16, r_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &s_check, 16, 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, 16, d_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&r_check, 16, r_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&s_check, 16, 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;
+        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)
-    {
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &r, &r_check ) == 0 );
-        TEST_ASSERT( mbedtls_mpi_cmp_mpi( &s, &s_check ) == 0 );
+    if (result == 0) {
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&r, &r_check) == 0);
+        TEST_ASSERT(mbedtls_mpi_cmp_mpi(&s, &s_check) == 0);
 
-        TEST_ASSERT( mbedtls_ecdsa_verify( &grp, hash->x, hash->len, &Q, &r_check, &s_check ) == 0 );
+        TEST_ASSERT(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q, &r_check,
+                                         &s_check) == 0);
 
-        TEST_ASSERT( mbedtls_mpi_sub_int( &r, &r, 1 ) == 0 );
-        TEST_ASSERT( mbedtls_mpi_add_int( &s, &s, 1 ) == 0 );
+        TEST_ASSERT(mbedtls_mpi_sub_int(&r, &r, 1) == 0);
+        TEST_ASSERT(mbedtls_mpi_add_int(&s, &s, 1) == 0);
 
-        TEST_ASSERT( mbedtls_ecdsa_verify( &grp, hash->x, hash->len,
-                     &Q, &r, &s_check ) == MBEDTLS_ERR_ECP_VERIFY_FAILED );
-        TEST_ASSERT( mbedtls_ecdsa_verify( &grp, hash->x, hash->len,
-                     &Q, &r_check, &s ) == MBEDTLS_ERR_ECP_VERIFY_FAILED );
-        TEST_ASSERT( mbedtls_ecdsa_verify( &grp, hash->x, hash->len,
-                     &grp.G, &r_check, &s_check ) == MBEDTLS_ERR_ECP_VERIFY_FAILED );
+        TEST_ASSERT(
+            mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q, &r, &s_check) ==
+            MBEDTLS_ERR_ECP_VERIFY_FAILED);
+        TEST_ASSERT(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &Q, &r_check,
+                                         &s) == MBEDTLS_ERR_ECP_VERIFY_FAILED);
+        TEST_ASSERT(mbedtls_ecdsa_verify(&grp, hash->x, hash->len, &grp.G,
+                                         &r_check, &s_check) ==
+                    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_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);
 }
 /* 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;
@@ -151,40 +176,44 @@
     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, 16, d_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &r_check, 16, r_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &s_check, 16, s_str ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&d, 16, d_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&r_check, 16, r_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&s_check, 16, 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 );
+    TEST_ASSERT(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;
@@ -192,59 +221,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, sizeof( 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,
+                    sizeof(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;
@@ -252,127 +282,137 @@
     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, sizeof( 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,
+                    sizeof(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;
@@ -382,51 +422,49 @@
     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, 16, d_str ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&ctx.grp, id) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&ctx.d, 16, 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, sizeof( sig ), &slen,
-                mbedtls_test_rnd_std_rand, NULL, &rs_ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart );
+        ret = mbedtls_ecdsa_write_signature_restartable(
+            &ctx, md_alg, hash, hlen, sig, sizeof(sig), &slen,
+            mbedtls_test_rnd_std_rand, 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, sizeof( sig ), &slen,
-                mbedtls_test_rnd_std_rand, 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, sizeof(sig), &slen,
+            mbedtls_test_rnd_std_rand, 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 */
diff --git a/tests/suites/test_suite_ecjpake.function b/tests/suites/test_suite_ecjpake.function
index 0ef334f..16ba964 100644
--- a/tests/suites/test_suite_ecjpake.function
+++ b/tests/suites/test_suite_ecjpake.function
@@ -3,93 +3,99 @@
 
 #if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) && defined(MBEDTLS_SHA256_C)
 static const unsigned char ecjpake_test_x1[] = {
-    0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
-    0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
-    0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x21
+    0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+    0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
+    0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x21
 };
 
 static const unsigned char ecjpake_test_x2[] = {
-    0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
-    0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
-    0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x81
+    0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
+    0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
+    0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x81
 };
 
 static const unsigned char ecjpake_test_x3[] = {
-    0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
-    0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
-    0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x81
+    0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
+    0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
+    0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x81
 };
 
 static const unsigned char ecjpake_test_x4[] = {
-    0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc,
-    0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
-    0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe1
+    0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb,
+    0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
+    0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe1
 };
 
 static const unsigned char ecjpake_test_X1[] = {
-    0x04, 0xac, 0xcf, 0x01, 0x06, 0xef, 0x85, 0x8f, 0xa2, 0xd9, 0x19, 0x33,
-    0x13, 0x46, 0x80, 0x5a, 0x78, 0xb5, 0x8b, 0xba, 0xd0, 0xb8, 0x44, 0xe5,
-    0xc7, 0x89, 0x28, 0x79, 0x14, 0x61, 0x87, 0xdd, 0x26, 0x66, 0xad, 0xa7,
-    0x81, 0xbb, 0x7f, 0x11, 0x13, 0x72, 0x25, 0x1a, 0x89, 0x10, 0x62, 0x1f,
-    0x63, 0x4d, 0xf1, 0x28, 0xac, 0x48, 0xe3, 0x81, 0xfd, 0x6e, 0xf9, 0x06,
-    0x07, 0x31, 0xf6, 0x94, 0xa4
+    0x04, 0xac, 0xcf, 0x01, 0x06, 0xef, 0x85, 0x8f, 0xa2, 0xd9, 0x19,
+    0x33, 0x13, 0x46, 0x80, 0x5a, 0x78, 0xb5, 0x8b, 0xba, 0xd0, 0xb8,
+    0x44, 0xe5, 0xc7, 0x89, 0x28, 0x79, 0x14, 0x61, 0x87, 0xdd, 0x26,
+    0x66, 0xad, 0xa7, 0x81, 0xbb, 0x7f, 0x11, 0x13, 0x72, 0x25, 0x1a,
+    0x89, 0x10, 0x62, 0x1f, 0x63, 0x4d, 0xf1, 0x28, 0xac, 0x48, 0xe3,
+    0x81, 0xfd, 0x6e, 0xf9, 0x06, 0x07, 0x31, 0xf6, 0x94, 0xa4
 };
 
 static const unsigned char ecjpake_test_X2[] = {
-    0x04, 0x7e, 0xa6, 0xe3, 0xa4, 0x48, 0x70, 0x37, 0xa9, 0xe0, 0xdb, 0xd7,
-    0x92, 0x62, 0xb2, 0xcc, 0x27, 0x3e, 0x77, 0x99, 0x30, 0xfc, 0x18, 0x40,
-    0x9a, 0xc5, 0x36, 0x1c, 0x5f, 0xe6, 0x69, 0xd7, 0x02, 0xe1, 0x47, 0x79,
-    0x0a, 0xeb, 0x4c, 0xe7, 0xfd, 0x65, 0x75, 0xab, 0x0f, 0x6c, 0x7f, 0xd1,
-    0xc3, 0x35, 0x93, 0x9a, 0xa8, 0x63, 0xba, 0x37, 0xec, 0x91, 0xb7, 0xe3,
-    0x2b, 0xb0, 0x13, 0xbb, 0x2b
+    0x04, 0x7e, 0xa6, 0xe3, 0xa4, 0x48, 0x70, 0x37, 0xa9, 0xe0, 0xdb,
+    0xd7, 0x92, 0x62, 0xb2, 0xcc, 0x27, 0x3e, 0x77, 0x99, 0x30, 0xfc,
+    0x18, 0x40, 0x9a, 0xc5, 0x36, 0x1c, 0x5f, 0xe6, 0x69, 0xd7, 0x02,
+    0xe1, 0x47, 0x79, 0x0a, 0xeb, 0x4c, 0xe7, 0xfd, 0x65, 0x75, 0xab,
+    0x0f, 0x6c, 0x7f, 0xd1, 0xc3, 0x35, 0x93, 0x9a, 0xa8, 0x63, 0xba,
+    0x37, 0xec, 0x91, 0xb7, 0xe3, 0x2b, 0xb0, 0x13, 0xbb, 0x2b
 };
 
 static const unsigned char ecjpake_test_X3[] = {
-    0x04, 0x7e, 0xa6, 0xe3, 0xa4, 0x48, 0x70, 0x37, 0xa9, 0xe0, 0xdb, 0xd7,
-    0x92, 0x62, 0xb2, 0xcc, 0x27, 0x3e, 0x77, 0x99, 0x30, 0xfc, 0x18, 0x40,
-    0x9a, 0xc5, 0x36, 0x1c, 0x5f, 0xe6, 0x69, 0xd7, 0x02, 0xe1, 0x47, 0x79,
-    0x0a, 0xeb, 0x4c, 0xe7, 0xfd, 0x65, 0x75, 0xab, 0x0f, 0x6c, 0x7f, 0xd1,
-    0xc3, 0x35, 0x93, 0x9a, 0xa8, 0x63, 0xba, 0x37, 0xec, 0x91, 0xb7, 0xe3,
-    0x2b, 0xb0, 0x13, 0xbb, 0x2b
+    0x04, 0x7e, 0xa6, 0xe3, 0xa4, 0x48, 0x70, 0x37, 0xa9, 0xe0, 0xdb,
+    0xd7, 0x92, 0x62, 0xb2, 0xcc, 0x27, 0x3e, 0x77, 0x99, 0x30, 0xfc,
+    0x18, 0x40, 0x9a, 0xc5, 0x36, 0x1c, 0x5f, 0xe6, 0x69, 0xd7, 0x02,
+    0xe1, 0x47, 0x79, 0x0a, 0xeb, 0x4c, 0xe7, 0xfd, 0x65, 0x75, 0xab,
+    0x0f, 0x6c, 0x7f, 0xd1, 0xc3, 0x35, 0x93, 0x9a, 0xa8, 0x63, 0xba,
+    0x37, 0xec, 0x91, 0xb7, 0xe3, 0x2b, 0xb0, 0x13, 0xbb, 0x2b
 };
 
 static const unsigned char ecjpake_test_X4[] = {
-    0x04, 0x19, 0x0a, 0x07, 0x70, 0x0f, 0xfa, 0x4b, 0xe6, 0xae, 0x1d, 0x79,
-    0xee, 0x0f, 0x06, 0xae, 0xb5, 0x44, 0xcd, 0x5a, 0xdd, 0xaa, 0xbe, 0xdf,
-    0x70, 0xf8, 0x62, 0x33, 0x21, 0x33, 0x2c, 0x54, 0xf3, 0x55, 0xf0, 0xfb,
-    0xfe, 0xc7, 0x83, 0xed, 0x35, 0x9e, 0x5d, 0x0b, 0xf7, 0x37, 0x7a, 0x0f,
-    0xc4, 0xea, 0x7a, 0xce, 0x47, 0x3c, 0x9c, 0x11, 0x2b, 0x41, 0xcc, 0xd4,
-    0x1a, 0xc5, 0x6a, 0x56, 0x12
+    0x04, 0x19, 0x0a, 0x07, 0x70, 0x0f, 0xfa, 0x4b, 0xe6, 0xae, 0x1d,
+    0x79, 0xee, 0x0f, 0x06, 0xae, 0xb5, 0x44, 0xcd, 0x5a, 0xdd, 0xaa,
+    0xbe, 0xdf, 0x70, 0xf8, 0x62, 0x33, 0x21, 0x33, 0x2c, 0x54, 0xf3,
+    0x55, 0xf0, 0xfb, 0xfe, 0xc7, 0x83, 0xed, 0x35, 0x9e, 0x5d, 0x0b,
+    0xf7, 0x37, 0x7a, 0x0f, 0xc4, 0xea, 0x7a, 0xce, 0x47, 0x3c, 0x9c,
+    0x11, 0x2b, 0x41, 0xcc, 0xd4, 0x1a, 0xc5, 0x6a, 0x56, 0x12
 };
 
 /* 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,21 +105,18 @@
  */
 
 /* BEGIN_CASE depends_on:NOT_DEFINED */
-void ecjpake_invalid_param( )
+void ecjpake_invalid_param()
 {
     mbedtls_ecjpake_context ctx;
     unsigned char buf[42] = { 0 };
-    size_t const len = sizeof( buf );
-    mbedtls_ecjpake_role invalid_role = (mbedtls_ecjpake_role) 42;
+    size_t const len = sizeof(buf);
+    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;
 
-    TEST_EQUAL( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecjpake_setup( &ctx,
-                                                   invalid_role,
-                                                   valid_md,
-                                                   valid_group,
-                                                   buf, len ) );
+    TEST_EQUAL(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+               mbedtls_ecjpake_setup(&ctx, invalid_role, valid_md, valid_group,
+                                     buf, len));
 
 exit:
     return;
@@ -121,98 +124,104 @@
 /* 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 2afc355..d6fad44 100644
--- a/tests/suites/test_suite_ecp.function
+++ b/tests/suites/test_suite_ecp.function
@@ -3,18 +3,18 @@
 
 #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) )
-#define HAVE_FIX_NEGATIVE
+#if defined(MBEDTLS_TEST_HOOKS) &&                \
+    (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_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);
 
 /* END_HEADER */
 
@@ -24,7 +24,7 @@
  */
 
 /* BEGIN_CASE depends_on:NOT_DEFINED */
-void ecp_invalid_param( )
+void ecp_invalid_param()
 {
     mbedtls_ecp_group grp;
     mbedtls_ecp_point P;
@@ -32,17 +32,12 @@
     size_t olen;
     unsigned char buf[42] = { 0 };
 
-    TEST_EQUAL( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_point_write_binary( &grp, &P,
-                                                      invalid_fmt,
-                                                      &olen,
-                                                      buf, sizeof( buf ) ) );
-    TEST_EQUAL( MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
-                            mbedtls_ecp_tls_write_point( &grp, &P,
-                                                     invalid_fmt,
-                                                     &olen,
-                                                     buf,
-                                                     sizeof( buf ) ) );
+    TEST_EQUAL(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+               mbedtls_ecp_point_write_binary(&grp, &P, invalid_fmt, &olen, buf,
+                                              sizeof(buf)));
+    TEST_EQUAL(MBEDTLS_ERR_ECP_BAD_INPUT_DATA,
+               mbedtls_ecp_tls_write_point(&grp, &P, invalid_fmt, &olen, buf,
+                                           sizeof(buf)));
 
 exit:
     return;
@@ -50,55 +45,60 @@
 /* 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, 16, x_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &P.Y, 16, y_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &P.Z, 16, z_hex ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P.X, 16, x_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&P.Y, 16, y_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&P.Z, 16, 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(),
@@ -126,79 +126,95 @@
     int ret;
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    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 );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    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);
+    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_test_read_mpi( &dA, 16, dA_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xA, 16, xA_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &yA, 16, yA_str ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&dA, 16, dA_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xA, 16, xA_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&yA, 16, yA_str) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &dB, 16, dB_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xZ, 16, xZ_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &yZ, 16, yZ_str ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&dB, 16, dB_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xZ, 16, xZ_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&yZ, 16, 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,
-                &mbedtls_test_rnd_pseudo_rand, &rnd_info, &ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restarts );
+        ECP_PT_RESET(&R);
+        ret = mbedtls_ecp_mul_restartable(&grp, &R, &dA, &grp.G,
+                                          &mbedtls_test_rnd_pseudo_rand,
+                                          &rnd_info, &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,
-                &mbedtls_test_rnd_pseudo_rand, &rnd_info, &ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restarts );
+        ECP_PT_RESET(&R);
+        ret = mbedtls_ecp_mul_restartable(
+            &grp, &R, &dB, &P, &mbedtls_test_rnd_pseudo_rand, &rnd_info, &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,
-                &mbedtls_test_rnd_pseudo_rand, &rnd_info, &ctx );
-        TEST_ASSERT( ret == MBEDTLS_ERR_ECP_IN_PROGRESS );
+    if (min_restarts > 0) {
+        ret = mbedtls_ecp_mul_restartable(
+            &grp, &R, &dB, &P, &mbedtls_test_rnd_pseudo_rand, &rnd_info, &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 */
-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
@@ -213,250 +229,291 @@
     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, 16, u1_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &u2, 16, u2_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xR, 16, xR_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &yR, 16, yR_str ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&u1, 16, u1_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&u2, 16, u2_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xR, 16, xR_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&yR, 16, yR_str) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q.X, 16, xQ_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q.Y, 16, yQ_str ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_lset( &Q.Z, 1 ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q.X, 16, xQ_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q.Y, 16, 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, 16, dA_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xA, 16, xA_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &yA, 16, yA_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &dB, 16, dB_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xB, 16, xB_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &yB, 16, yB_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xZ, 16, xZ_str ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &yZ, 16, yZ_str ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&dA, 16, dA_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xA, 16, xA_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&yA, 16, yA_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&dB, 16, dB_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xB, 16, xB_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&yB, 16, yB_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xZ, 16, xZ_str) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&yZ, 16, 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,
-                          &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, &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,
+                                &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,
-                          &mbedtls_test_rnd_pseudo_rand, &rnd_info ) == 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,
+                                &mbedtls_test_rnd_pseudo_rand, &rnd_info) == 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, 16, dA_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &dB, 16, dB_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xA, 16, xA_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xB, 16, xB_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &xS, 16, xS_hex ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&dA, 16, dA_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&dB, 16, dB_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xA, 16, xA_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xB, 16, xB_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&xS, 16, 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,
-                          &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, &xB ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_mul(&grp, &R, &dB, &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, &xB) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_mul( &grp, &R, &dA, &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, &dA, &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);
 
 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;
@@ -465,186 +522,204 @@
     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, 16, N_str ) == 0 );
-    TEST_ASSERT( mbedtls_ecp_group_load( &grp, id ) == 0 );
-    TEST_ASSERT( grp.modp != NULL );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, 16, 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, 16, x ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &P.Y, 16, y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &P.Z, 16, z ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P.X, 16, x) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&P.Y, 16, y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&P.Z, 16, 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, 16, x) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, 16, y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Z, 16, z) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, 16, x ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, 16, y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Z, 16, 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;
     mbedtls_mpi X, Y, Z;
     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, 16, x) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, 16, y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Z, 16, z) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, 16, x ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, 16, y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Z, 16, 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;
@@ -652,75 +727,84 @@
     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];
@@ -728,240 +812,238 @@
     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 */
-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, 16, key_hex ) == 0 );
+    TEST_ASSERT(mbedtls_ecp_group_load(&grp, id) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&d, 16, 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_test_rnd_pseudo_info rnd_info;
 
-    mbedtls_ecp_keypair_init( &pub );
-    mbedtls_ecp_keypair_init( &prv );
-    memset( &rnd_info, 0x00, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    mbedtls_ecp_keypair_init(&pub);
+    mbedtls_ecp_keypair_init(&prv);
+    memset(&rnd_info, 0x00, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    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, 16, 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, 16, d) == 0);
 
-    TEST_ASSERT( mbedtls_ecp_check_pub_priv( &pub, &prv,
-                          &mbedtls_test_rnd_pseudo_rand, &rnd_info ) == ret );
+    TEST_ASSERT(mbedtls_ecp_check_pub_priv(&pub, &prv,
+                                           &mbedtls_test_rnd_pseudo_rand,
+                                           &rnd_info) == 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
@@ -972,19 +1054,18 @@
          *   (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 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 */
diff --git a/tests/suites/test_suite_entropy.function b/tests/suites/test_suite_entropy.function
index 6f72add..31823ef 100644
--- a/tests/suites/test_suite_entropy.function
+++ b/tests/suites/test_suite_entropy.function
@@ -11,8 +11,7 @@
     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 +23,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 +37,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 +55,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 +66,63 @@
  */
 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 +133,7 @@
  */
 
 /* BEGIN_CASE */
-void entropy_init_free( int reinit )
+void entropy_init_free(int reinit)
 {
     mbedtls_entropy_context ctx;
 
@@ -143,12 +141,12 @@
      * 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 +155,188 @@
 /* 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);
+    ((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};
+    entropy_dummy_context strong = { 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 +344,96 @@
      */
 
     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"
+#    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 +443,83 @@
     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 );
+    // 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);
 
 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 2bcd1d7..2c73dbe 100644
--- a/tests/suites/test_suite_gcm.function
+++ b/tests/suites/test_suite_gcm.function
@@ -4,15 +4,15 @@
 /* Use the multipart interface to process the encrypted data in two parts
  * and check that the output matches the expected output.
  * The context must have been set up with the key. */
-static int check_multipart( mbedtls_gcm_context *ctx,
-                            int mode,
-                            const data_t *iv,
-                            const data_t *add,
-                            const data_t *input,
-                            const data_t *expected_output,
-                            const data_t *tag,
-                            size_t n1,
-                            size_t n1_add)
+static int check_multipart(mbedtls_gcm_context *ctx,
+                           int mode,
+                           const data_t *iv,
+                           const data_t *add,
+                           const data_t *input,
+                           const data_t *expected_output,
+                           const data_t *tag,
+                           size_t n1,
+                           size_t n1_add)
 {
     int ok = 0;
     uint8_t *output = NULL;
@@ -21,91 +21,90 @@
     size_t olen;
 
     /* Sanity checks on the test data */
-    TEST_ASSERT( n1 <= input->len );
-    TEST_ASSERT( n1_add <= add->len );
-    TEST_EQUAL( input->len, expected_output->len );
+    TEST_ASSERT(n1 <= input->len);
+    TEST_ASSERT(n1_add <= add->len);
+    TEST_EQUAL(input->len, expected_output->len);
 
-    TEST_EQUAL( 0, mbedtls_gcm_starts( ctx, mode,
-                                         iv->x, iv->len ) );
-    TEST_EQUAL( 0, mbedtls_gcm_update_ad( ctx, add->x, n1_add ) );
-    TEST_EQUAL( 0, mbedtls_gcm_update_ad( ctx, add->x + n1_add, n2_add ) );
+    TEST_EQUAL(0, mbedtls_gcm_starts(ctx, mode, iv->x, iv->len));
+    TEST_EQUAL(0, mbedtls_gcm_update_ad(ctx, add->x, n1_add));
+    TEST_EQUAL(0, mbedtls_gcm_update_ad(ctx, add->x + n1_add, n2_add));
 
     /* Allocate a tight buffer for each update call. This way, if the function
      * tries to write beyond the advertised required buffer size, this will
      * count as an overflow for memory sanitizers and static checkers. */
-    ASSERT_ALLOC( output, n1 );
+    ASSERT_ALLOC(output, n1);
     olen = 0xdeadbeef;
-    TEST_EQUAL( 0, mbedtls_gcm_update( ctx, input->x, n1, output, n1, &olen ) );
-    TEST_EQUAL( n1, olen );
-    ASSERT_COMPARE( output, olen, expected_output->x, n1 );
-    mbedtls_free( output );
+    TEST_EQUAL(0, mbedtls_gcm_update(ctx, input->x, n1, output, n1, &olen));
+    TEST_EQUAL(n1, olen);
+    ASSERT_COMPARE(output, olen, expected_output->x, n1);
+    mbedtls_free(output);
     output = NULL;
 
-    ASSERT_ALLOC( output, n2 );
+    ASSERT_ALLOC(output, n2);
     olen = 0xdeadbeef;
-    TEST_EQUAL( 0, mbedtls_gcm_update( ctx, input->x + n1, n2, output, n2, &olen ) );
-    TEST_EQUAL( n2, olen );
-    ASSERT_COMPARE( output, olen, expected_output->x + n1, n2 );
-    mbedtls_free( output );
+    TEST_EQUAL(0,
+               mbedtls_gcm_update(ctx, input->x + n1, n2, output, n2, &olen));
+    TEST_EQUAL(n2, olen);
+    ASSERT_COMPARE(output, olen, expected_output->x + n1, n2);
+    mbedtls_free(output);
     output = NULL;
 
-    ASSERT_ALLOC( output, tag->len );
-    TEST_EQUAL( 0, mbedtls_gcm_finish( ctx, NULL, 0, &olen, output, tag->len ) );
-    TEST_EQUAL( 0, olen );
-    ASSERT_COMPARE( output, tag->len, tag->x, tag->len );
-    mbedtls_free( output );
+    ASSERT_ALLOC(output, tag->len);
+    TEST_EQUAL(0, mbedtls_gcm_finish(ctx, NULL, 0, &olen, output, tag->len));
+    TEST_EQUAL(0, olen);
+    ASSERT_COMPARE(output, tag->len, tag->x, tag->len);
+    mbedtls_free(output);
     output = NULL;
 
     ok = 1;
 exit:
-    mbedtls_free( output );
-    return ok ;
+    mbedtls_free(output);
+    return ok;
 }
 
-static void check_cipher_with_empty_ad( mbedtls_gcm_context *ctx,
-                                        int mode,
-                                        const data_t *iv,
-                                        const data_t *input,
-                                        const data_t *expected_output,
-                                        const data_t *tag,
-                                        size_t ad_update_count)
+static void check_cipher_with_empty_ad(mbedtls_gcm_context *ctx,
+                                       int mode,
+                                       const data_t *iv,
+                                       const data_t *input,
+                                       const data_t *expected_output,
+                                       const data_t *tag,
+                                       size_t ad_update_count)
 {
     size_t n;
     uint8_t *output = NULL;
     size_t olen;
 
     /* Sanity checks on the test data */
-    TEST_EQUAL( input->len, expected_output->len );
+    TEST_EQUAL(input->len, expected_output->len);
 
-    TEST_EQUAL( 0, mbedtls_gcm_starts( ctx, mode,
-                                       iv->x, iv->len ) );
+    TEST_EQUAL(0, mbedtls_gcm_starts(ctx, mode, iv->x, iv->len));
 
-    for( n = 0; n < ad_update_count; n++ )
-    {
-        TEST_EQUAL( 0, mbedtls_gcm_update_ad( ctx, NULL, 0 ) );
+    for (n = 0; n < ad_update_count; n++) {
+        TEST_EQUAL(0, mbedtls_gcm_update_ad(ctx, NULL, 0));
     }
 
     /* Allocate a tight buffer for each update call. This way, if the function
      * tries to write beyond the advertised required buffer size, this will
      * count as an overflow for memory sanitizers and static checkers. */
-    ASSERT_ALLOC( output, input->len );
+    ASSERT_ALLOC(output, input->len);
     olen = 0xdeadbeef;
-    TEST_EQUAL( 0, mbedtls_gcm_update( ctx, input->x, input->len, output, input->len, &olen ) );
-    TEST_EQUAL( input->len, olen );
-    ASSERT_COMPARE( output, olen, expected_output->x, input->len );
-    mbedtls_free( output );
+    TEST_EQUAL(0, mbedtls_gcm_update(ctx, input->x, input->len, output,
+                                     input->len, &olen));
+    TEST_EQUAL(input->len, olen);
+    ASSERT_COMPARE(output, olen, expected_output->x, input->len);
+    mbedtls_free(output);
     output = NULL;
 
-    ASSERT_ALLOC( output, tag->len );
-    TEST_EQUAL( 0, mbedtls_gcm_finish( ctx, NULL, 0, &olen, output, tag->len ) );
-    TEST_EQUAL( 0, olen );
-    ASSERT_COMPARE( output, tag->len, tag->x, tag->len );
+    ASSERT_ALLOC(output, tag->len);
+    TEST_EQUAL(0, mbedtls_gcm_finish(ctx, NULL, 0, &olen, output, tag->len));
+    TEST_EQUAL(0, olen);
+    ASSERT_COMPARE(output, tag->len, tag->x, tag->len);
 
 exit:
-    mbedtls_free( output );
+    mbedtls_free(output);
 }
 
-static void check_empty_cipher_with_ad( mbedtls_gcm_context *ctx,
+static void check_empty_cipher_with_ad(mbedtls_gcm_context *ctx,
                                        int mode,
                                        const data_t *iv,
                                        const data_t *add,
@@ -114,45 +113,43 @@
 {
     size_t olen;
     size_t n;
-    uint8_t* output_tag = NULL;
+    uint8_t *output_tag = NULL;
 
-    TEST_EQUAL( 0, mbedtls_gcm_starts( ctx, mode, iv->x, iv->len ) );
-    TEST_EQUAL( 0, mbedtls_gcm_update_ad( ctx, add->x, add->len ) );
+    TEST_EQUAL(0, mbedtls_gcm_starts(ctx, mode, iv->x, iv->len));
+    TEST_EQUAL(0, mbedtls_gcm_update_ad(ctx, add->x, add->len));
 
-    for( n = 0; n < cipher_update_count; n++ )
-    {
+    for (n = 0; n < cipher_update_count; n++) {
         olen = 0xdeadbeef;
-        TEST_EQUAL( 0, mbedtls_gcm_update( ctx, NULL, 0, NULL, 0, &olen ) );
-        TEST_EQUAL( 0, olen );
+        TEST_EQUAL(0, mbedtls_gcm_update(ctx, NULL, 0, NULL, 0, &olen));
+        TEST_EQUAL(0, olen);
     }
 
-    ASSERT_ALLOC( output_tag, tag->len );
-    TEST_EQUAL( 0, mbedtls_gcm_finish( ctx, NULL, 0, &olen,
-                                       output_tag, tag->len ) );
-    TEST_EQUAL( 0, olen );
-    ASSERT_COMPARE( output_tag, tag->len, tag->x, tag->len );
+    ASSERT_ALLOC(output_tag, tag->len);
+    TEST_EQUAL(0,
+               mbedtls_gcm_finish(ctx, NULL, 0, &olen, output_tag, tag->len));
+    TEST_EQUAL(0, olen);
+    ASSERT_COMPARE(output_tag, tag->len, tag->x, tag->len);
 
 exit:
-    mbedtls_free( output_tag );
+    mbedtls_free(output_tag);
 }
 
-static void check_no_cipher_no_ad( mbedtls_gcm_context *ctx,
-                                   int mode,
-                                   const data_t *iv,
-                                   const data_t *tag )
+static void check_no_cipher_no_ad(mbedtls_gcm_context *ctx,
+                                  int mode,
+                                  const data_t *iv,
+                                  const data_t *tag)
 {
     uint8_t *output = NULL;
     size_t olen = 0;
 
-    TEST_EQUAL( 0, mbedtls_gcm_starts( ctx, mode,
-                                       iv->x, iv->len ) );
-    ASSERT_ALLOC( output, tag->len );
-    TEST_EQUAL( 0, mbedtls_gcm_finish( ctx, NULL, 0, &olen, output, tag->len ) );
-    TEST_EQUAL( 0, olen );
-    ASSERT_COMPARE( output, tag->len, tag->x, tag->len );
+    TEST_EQUAL(0, mbedtls_gcm_starts(ctx, mode, iv->x, iv->len));
+    ASSERT_ALLOC(output, tag->len);
+    TEST_EQUAL(0, mbedtls_gcm_finish(ctx, NULL, 0, &olen, output, tag->len));
+    TEST_EQUAL(0, olen);
+    ASSERT_COMPARE(output, tag->len, tag->x, tag->len);
 
 exit:
-    mbedtls_free( output );
+    mbedtls_free(output);
 }
 
 /* END_HEADER */
@@ -163,36 +160,47 @@
  */
 
 /* 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];
@@ -201,45 +209,48 @@
     size_t n1;
     size_t n1_add;
 
-    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 );
+        ASSERT_COMPARE(output, src_str->len, dst->x, dst->len);
+        ASSERT_COMPARE(tag_output, tag_len, tag->x, tag->len);
 
-        ASSERT_COMPARE( output, src_str->len, dst->x, dst->len );
-        ASSERT_COMPARE( tag_output, tag_len, tag->x, tag->len );
-
-        for( n1 = 0; n1 <= src_str->len; n1 += 1 )
-        {
-            for( n1_add = 0; n1_add <= add_str->len; n1_add += 1 )
-            {
-                mbedtls_test_set_step( n1 * 10000 + n1_add );
-                if( !check_multipart( &ctx, MBEDTLS_GCM_ENCRYPT,
-                                    iv_str, add_str, src_str,
-                                    dst, tag,
-                                    n1, n1_add ) )
+        for (n1 = 0; n1 <= src_str->len; n1 += 1) {
+            for (n1_add = 0; n1_add <= add_str->len; n1_add += 1) {
+                mbedtls_test_set_step(n1 * 10000 + n1_add);
+                if (!check_multipart(&ctx, MBEDTLS_GCM_ENCRYPT, iv_str, add_str,
+                                     src_str, dst, tag, n1, n1_add))
                     goto exit;
             }
         }
     }
 
 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;
@@ -248,34 +259,29 @@
     size_t n1;
     size_t n1_add;
 
-    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);
+            ASSERT_COMPARE(output, src_str->len, pt_result->x, pt_result->len);
 
-        if( strcmp( "FAIL", result ) == 0 )
-        {
-            TEST_ASSERT( ret == MBEDTLS_ERR_GCM_AUTH_FAILED );
-        }
-        else
-        {
-            TEST_ASSERT( ret == 0 );
-            ASSERT_COMPARE( output, src_str->len, pt_result->x, pt_result->len );
-
-            for( n1 = 0; n1 <= src_str->len; n1 += 1 )
-            {
-                for( n1_add = 0; n1_add <= add_str->len; n1_add += 1 )
-                {
-                    mbedtls_test_set_step( n1 * 10000 + n1_add );
-                    if( !check_multipart( &ctx, MBEDTLS_GCM_DECRYPT,
-                                        iv_str, add_str, src_str,
-                                        pt_result, tag_str,
-                                        n1, n1_add ) )
+            for (n1 = 0; n1 <= src_str->len; n1 += 1) {
+                for (n1_add = 0; n1_add <= add_str->len; n1_add += 1) {
+                    mbedtls_test_set_step(n1 * 10000 + n1_add);
+                    if (!check_multipart(&ctx, MBEDTLS_GCM_DECRYPT, iv_str,
+                                         add_str, src_str, pt_result, tag_str,
+                                         n1, n1_add))
                         goto exit;
                 }
             }
@@ -283,157 +289,157 @@
     }
 
 exit:
-    mbedtls_gcm_free( &ctx );
+    mbedtls_gcm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void gcm_decrypt_and_verify_empty_cipher( int cipher_id,
-                                          data_t * key_str,
-                                          data_t * iv_str,
-                                          data_t * add_str,
-                                          data_t * tag_str,
-                                          int cipher_update_calls )
+void gcm_decrypt_and_verify_empty_cipher(int cipher_id,
+                                         data_t *key_str,
+                                         data_t *iv_str,
+                                         data_t *add_str,
+                                         data_t *tag_str,
+                                         int cipher_update_calls)
 {
     mbedtls_gcm_context ctx;
 
-    mbedtls_gcm_init( &ctx );
+    mbedtls_gcm_init(&ctx);
 
-    TEST_ASSERT( mbedtls_gcm_setkey( &ctx, cipher_id, key_str->x, key_str->len * 8 ) == 0 );
-    check_empty_cipher_with_ad( &ctx, MBEDTLS_GCM_DECRYPT,
-                                iv_str, add_str, tag_str,
-                                cipher_update_calls );
+    TEST_ASSERT(
+        mbedtls_gcm_setkey(&ctx, cipher_id, key_str->x, key_str->len * 8) == 0);
+    check_empty_cipher_with_ad(&ctx, MBEDTLS_GCM_DECRYPT, iv_str, add_str,
+                               tag_str, cipher_update_calls);
 
-    mbedtls_gcm_free( &ctx );
+    mbedtls_gcm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void gcm_decrypt_and_verify_empty_ad( int cipher_id,
-                                      data_t * key_str,
-                                      data_t * iv_str,
-                                      data_t * src_str,
-                                      data_t * tag_str,
-                                      data_t * pt_result,
-                                      int ad_update_calls )
+void gcm_decrypt_and_verify_empty_ad(int cipher_id,
+                                     data_t *key_str,
+                                     data_t *iv_str,
+                                     data_t *src_str,
+                                     data_t *tag_str,
+                                     data_t *pt_result,
+                                     int ad_update_calls)
 {
     mbedtls_gcm_context ctx;
 
-    mbedtls_gcm_init( &ctx );
+    mbedtls_gcm_init(&ctx);
 
-    TEST_ASSERT( mbedtls_gcm_setkey( &ctx, cipher_id, key_str->x, key_str->len * 8 ) == 0 );
-    check_cipher_with_empty_ad( &ctx, MBEDTLS_GCM_DECRYPT,
-                                iv_str, src_str, pt_result, tag_str,
-                                ad_update_calls );
+    TEST_ASSERT(
+        mbedtls_gcm_setkey(&ctx, cipher_id, key_str->x, key_str->len * 8) == 0);
+    check_cipher_with_empty_ad(&ctx, MBEDTLS_GCM_DECRYPT, iv_str, src_str,
+                               pt_result, tag_str, ad_update_calls);
 
-    mbedtls_gcm_free( &ctx );
+    mbedtls_gcm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void gcm_decrypt_and_verify_no_ad_no_cipher( int cipher_id,
-                                             data_t * key_str,
-                                             data_t * iv_str,
-                                             data_t * tag_str )
+void gcm_decrypt_and_verify_no_ad_no_cipher(int cipher_id,
+                                            data_t *key_str,
+                                            data_t *iv_str,
+                                            data_t *tag_str)
 {
     mbedtls_gcm_context ctx;
 
-    mbedtls_gcm_init( &ctx );
+    mbedtls_gcm_init(&ctx);
 
-    TEST_ASSERT( mbedtls_gcm_setkey( &ctx, cipher_id, key_str->x, key_str->len * 8 ) == 0 );
-    check_no_cipher_no_ad( &ctx, MBEDTLS_GCM_DECRYPT,
-                           iv_str, tag_str );
+    TEST_ASSERT(
+        mbedtls_gcm_setkey(&ctx, cipher_id, key_str->x, key_str->len * 8) == 0);
+    check_no_cipher_no_ad(&ctx, MBEDTLS_GCM_DECRYPT, iv_str, tag_str);
 
-    mbedtls_gcm_free( &ctx );
+    mbedtls_gcm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void gcm_encrypt_and_tag_empty_cipher( int cipher_id,
-                                       data_t * key_str,
-                                       data_t * iv_str,
-                                       data_t * add_str,
-                                       data_t * tag_str,
-                                       int cipher_update_calls )
+void gcm_encrypt_and_tag_empty_cipher(int cipher_id,
+                                      data_t *key_str,
+                                      data_t *iv_str,
+                                      data_t *add_str,
+                                      data_t *tag_str,
+                                      int cipher_update_calls)
 {
     mbedtls_gcm_context ctx;
 
-    mbedtls_gcm_init( &ctx );
+    mbedtls_gcm_init(&ctx);
 
-    TEST_ASSERT( mbedtls_gcm_setkey( &ctx, cipher_id, key_str->x, key_str->len * 8 ) == 0 );
-    check_empty_cipher_with_ad( &ctx, MBEDTLS_GCM_ENCRYPT,
-                                iv_str, add_str, tag_str,
-                                cipher_update_calls );
+    TEST_ASSERT(
+        mbedtls_gcm_setkey(&ctx, cipher_id, key_str->x, key_str->len * 8) == 0);
+    check_empty_cipher_with_ad(&ctx, MBEDTLS_GCM_ENCRYPT, iv_str, add_str,
+                               tag_str, cipher_update_calls);
 
 exit:
-    mbedtls_gcm_free( &ctx );
+    mbedtls_gcm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void gcm_encrypt_and_tag_empty_ad( int cipher_id,
-                                   data_t * key_str,
-                                   data_t * iv_str,
-                                   data_t * src_str,
-                                   data_t * dst,
-                                   data_t * tag_str,
-                                   int ad_update_calls )
+void gcm_encrypt_and_tag_empty_ad(int cipher_id,
+                                  data_t *key_str,
+                                  data_t *iv_str,
+                                  data_t *src_str,
+                                  data_t *dst,
+                                  data_t *tag_str,
+                                  int ad_update_calls)
 {
     mbedtls_gcm_context ctx;
 
-    mbedtls_gcm_init( &ctx );
+    mbedtls_gcm_init(&ctx);
 
-    TEST_ASSERT( mbedtls_gcm_setkey( &ctx, cipher_id, key_str->x, key_str->len * 8 ) == 0 );
-    check_cipher_with_empty_ad( &ctx, MBEDTLS_GCM_ENCRYPT,
-                                iv_str, src_str, dst, tag_str,
-                                ad_update_calls );
+    TEST_ASSERT(
+        mbedtls_gcm_setkey(&ctx, cipher_id, key_str->x, key_str->len * 8) == 0);
+    check_cipher_with_empty_ad(&ctx, MBEDTLS_GCM_ENCRYPT, iv_str, src_str, dst,
+                               tag_str, ad_update_calls);
 
 exit:
-    mbedtls_gcm_free( &ctx );
+    mbedtls_gcm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void gcm_encrypt_and_verify_no_ad_no_cipher( int cipher_id,
-                                             data_t * key_str,
-                                             data_t * iv_str,
-                                             data_t * tag_str )
+void gcm_encrypt_and_verify_no_ad_no_cipher(int cipher_id,
+                                            data_t *key_str,
+                                            data_t *iv_str,
+                                            data_t *tag_str)
 {
     mbedtls_gcm_context ctx;
 
-    mbedtls_gcm_init( &ctx );
+    mbedtls_gcm_init(&ctx);
 
-    TEST_ASSERT( mbedtls_gcm_setkey( &ctx, cipher_id, key_str->x, key_str->len * 8 ) == 0 );
-    check_no_cipher_no_ad( &ctx, MBEDTLS_GCM_ENCRYPT,
-                           iv_str, tag_str );
+    TEST_ASSERT(
+        mbedtls_gcm_setkey(&ctx, cipher_id, key_str->x, key_str->len * 8) == 0);
+    check_no_cipher_no_ad(&ctx, MBEDTLS_GCM_ENCRYPT, iv_str, tag_str);
 
-    mbedtls_gcm_free( &ctx );
+    mbedtls_gcm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:NOT_DEFINED */
-void gcm_invalid_param( )
+void gcm_invalid_param()
 {
     mbedtls_gcm_context ctx;
     unsigned char valid_buffer[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
     mbedtls_cipher_id_t valid_cipher = MBEDTLS_CIPHER_ID_AES;
     int invalid_bitlen = 1;
 
-    mbedtls_gcm_init( &ctx );
+    mbedtls_gcm_init(&ctx);
 
     /* mbedtls_gcm_setkey */
-    TEST_EQUAL(
-        MBEDTLS_ERR_GCM_BAD_INPUT,
-        mbedtls_gcm_setkey( &ctx, valid_cipher, valid_buffer, invalid_bitlen ) );
+    TEST_EQUAL(MBEDTLS_ERR_GCM_BAD_INPUT,
+               mbedtls_gcm_setkey(&ctx, valid_cipher, valid_buffer,
+                                  invalid_bitlen));
 
 exit:
-    mbedtls_gcm_free( &ctx );
+    mbedtls_gcm_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
-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 6cb1118..4e77023 100644
--- a/tests/suites/test_suite_hkdf.function
+++ b/tests/suites/test_suite_hkdf.function
@@ -9,29 +9,33 @@
  */
 
 /* 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 +44,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,10 +68,15 @@
 /* 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 };
+    enum
+    {
+        OKM_LEN = 1024
+    };
     int ret;
     unsigned char *info = NULL;
     unsigned char *prk = NULL;
@@ -75,21 +84,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 +109,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 +118,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 +136,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 +145,21 @@
     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 );
+        prk = mbedtls_calloc(prk_len, 1);
 
     if (okm_len > 0)
-        okm = mbedtls_calloc( okm_len, 1 );
+        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 e678979..33ddcd9 100644
--- a/tests/suites/test_suite_hmac_drbg.function
+++ b/tests/suites/test_suite_hmac_drbg.function
@@ -2,25 +2,24 @@
 #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;
+    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 +29,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 +40,109 @@
     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
         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 +150,34 @@
     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,122 @@
     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 d918ce3..aeec4e2 100644
--- a/tests/suites/test_suite_md.function
+++ b/tests/suites/test_suite_md.function
@@ -8,14 +8,14 @@
  */
 
 /* 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 );
+    mbedtls_md_init(&ctx);
 
     /*
      * Very minimal testing of mbedtls_md_process, just make sure the various
@@ -25,158 +25,161 @@
      *
      * 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_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_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];
@@ -186,51 +189,52 @@
     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];
@@ -238,73 +242,80 @@
     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];
@@ -312,62 +323,63 @@
     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 5cdb1a5..7019388 100644
--- a/tests/suites/test_suite_mdx.function
+++ b/tests/suites/test_suite_mdx.function
@@ -4,27 +4,27 @@
 /* END_HEADER */
 
 /* 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( src_str, strlen( (char *) src_str ), output );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_md5(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];
@@ -33,26 +33,26 @@
     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( src_str, strlen( (char *) src_str ), output );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_ripemd160(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: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 f5e05e2..855dd75 100644
--- a/tests/suites/test_suite_memory_buffer_alloc.function
+++ b/tests/suites/test_suite_memory_buffer_alloc.function
@@ -10,34 +10,40 @@
  */
 
 /* 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 +51,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 +140,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;
@@ -208,69 +198,69 @@
 
     (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_mpi.function b/tests/suites/test_suite_mpi.function
index 5c184cb..25fcb6c 100644
--- a/tests/suites/test_suite_mpi.function
+++ b/tests/suites/test_suite_mpi.function
@@ -3,26 +3,25 @@
 #include "mbedtls/entropy.h"
 
 #if MBEDTLS_MPI_MAX_BITS > 792
-#define MPI_MAX_BITS_LARGER_THAN_792
+#    define MPI_MAX_BITS_LARGER_THAN_792
 #endif
 
 /* 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)
 {
-    if( X->s != 1 && X->s != -1 )
-        return 0 ; // invalid sign bit, e.g. 0
-    if( mbedtls_mpi_bitlen( X ) == 0 && X->s != 1 )
-        return 0 ; // negative zero
-    return 1 ;
+    if (X->s != 1 && X->s != -1)
+        return 0; // invalid sign bit, e.g. 0
+    if (mbedtls_mpi_bitlen(X) == 0 && X->s != 1)
+        return 0; // negative zero
+    return 1;
 }
 
-typedef struct mbedtls_test_mpi_random
-{
+typedef struct mbedtls_test_mpi_random {
     data_t *data;
-    size_t  pos;
-    size_t  chunk_len;
+    size_t pos;
+    size_t chunk_len;
 } mbedtls_test_mpi_random;
 
 /*
@@ -31,49 +30,47 @@
  * 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 == 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->pos + random->chunk_len > random->data->len ||
+        random->chunk_len > len) {
+        return -1;
     }
 
-    memset( buf, 0, len );
+    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
@@ -87,29 +84,28 @@
  * 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];
+        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;
 
@@ -117,7 +113,7 @@
      * 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 */
@@ -128,161 +124,166 @@
  */
 
 /* 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, int radix_A, char * input_A )
+void mbedtls_mpi_read_binary(data_t *buf, int radix_A, 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, radix_A, 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, radix_A, 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, int radix_A, char * input_A )
+void mbedtls_mpi_read_binary_le(data_t *buf, int radix_A, 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, radix_A, 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, radix_A, 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( int radix_X, char * input_X,
-                               data_t * input_A, int output_size,
-                               int result )
+void mbedtls_mpi_write_binary(int radix_X,
+                              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, radix_X, input_X ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, radix_X, input_X) == 0);
 
-    buflen = mbedtls_mpi_size( &X );
-    if( buflen > (size_t) output_size )
-        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_test_hexcmp( buf, input_A->x,
-                                          buflen, input_A->len ) == 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);
     }
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_write_binary_le( int radix_X, char * input_X,
-                                  data_t * input_A, int output_size,
-                                  int result )
+void mbedtls_mpi_write_binary_le(int radix_X,
+                                 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, radix_X, input_X ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, radix_X, input_X) == 0);
 
-    buflen = mbedtls_mpi_size( &X );
-    if( buflen > (size_t) output_size )
-        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_test_hexcmp( buf, input_A->x,
-                                          buflen, input_A->len ) == 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);
     }
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_FS_IO */
-void mbedtls_mpi_read_file( int radix_X, char * input_file,
-                            data_t * input_A, int result )
+void mbedtls_mpi_read_file(int radix_X,
+                           char *input_file,
+                           data_t *input_A,
+                           int result)
 {
     mbedtls_mpi X;
     unsigned char buf[1000];
@@ -290,975 +291,1156 @@
     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, radix_X, file );
+    file = fopen(input_file, "r");
+    TEST_ASSERT(file != NULL);
+    ret = mbedtls_mpi_read_file(&X, radix_X, 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( int radix_X, char * input_X, int output_radix,
-                             char * output_file )
+void mbedtls_mpi_write_file(int radix_X,
+                            char *input_X,
+                            int output_radix,
+                            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, radix_X, input_X ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, radix_X, input_X) == 0);
 
-    file_out = fopen( output_file, "w" );
-    TEST_ASSERT( file_out != NULL );
-    ret = mbedtls_mpi_write_file( NULL, &X, output_radix, file_out );
+    file_out = fopen(output_file, "w");
+    TEST_ASSERT(file_out != NULL);
+    ret = mbedtls_mpi_write_file(NULL, &X, output_radix, 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, output_radix, file_in );
+    file_in = fopen(output_file, "r");
+    TEST_ASSERT(file_in != NULL);
+    ret = mbedtls_mpi_read_file(&Y, output_radix, 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( int radix_X, char * input_X, int pos, int val )
+void mbedtls_mpi_get_bit(int radix_X, char *input_X, int pos, int val)
 {
     mbedtls_mpi X;
-    mbedtls_mpi_init( &X );
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_get_bit( &X, pos ) == val );
+    mbedtls_mpi_init(&X);
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, radix_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( int radix_X, char * input_X, int pos, int val,
-                          int radix_Y, char * output_Y, int result )
+void mbedtls_mpi_set_bit(int radix_X,
+                         char *input_X,
+                         int pos,
+                         int val,
+                         int radix_Y,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, radix_Y, output_Y ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_set_bit( &X, pos, val ) == result );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, radix_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( int radix_X, char * input_X, int nr_bits )
+void mbedtls_mpi_lsb(int radix_X, char *input_X, int nr_bits)
 {
     mbedtls_mpi X;
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_lsb( &X ) == (size_t) nr_bits );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, radix_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( int radix_X, char * input_X, int nr_bits )
+void mbedtls_mpi_bitlen(int radix_X, char *input_X, int nr_bits)
 {
     mbedtls_mpi X;
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_bitlen( &X ) == (size_t) nr_bits );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, radix_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( int radix_X, char * input_X, int radix_Y,
-                      char * input_Y, int radix_A, char * input_A )
+void mbedtls_mpi_gcd(int radix_X,
+                     char *input_X,
+                     int radix_Y,
+                     char *input_Y,
+                     int radix_A,
+                     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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, radix_Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_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, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, radix_Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_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( int radix_X, char * input_X, int radix_Y,
-                          char * input_Y, int input_A )
+void mbedtls_mpi_cmp_mpi(int radix_X,
+                         char *input_X,
+                         int radix_Y,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, radix_Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_mpi( &X, &Y ) == input_A );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, radix_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, 16, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, 16, input_Y ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, 16, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, 16, 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( int radix_X, char * input_X, int radix_Y,
-                          char * input_Y, int input_A )
+void mbedtls_mpi_cmp_abs(int radix_X,
+                         char *input_X,
+                         int radix_Y,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, radix_Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_cmp_abs( &X, &Y ) == input_A );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, radix_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, 16, src_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &ref, 16, dst_hex ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&src, 16, src_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&ref, 16, dst_hex) == 0);
 
     /* mbedtls_mpi_copy() */
-    TEST_ASSERT( mbedtls_test_read_mpi( &dst, 16, 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, 16, 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, 16, 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, 16, 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, 16, 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, 16, 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, 16, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_mpi_copy( &X, &X ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, 16, input_X) == 0);
+    TEST_ASSERT(mbedtls_mpi_copy(&X, &X) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, 16, 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, 16, 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, 16, X_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y0, 16, Y_hex ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X0, 16, X_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y0, 16, Y_hex) == 0);
 
     /* mbedtls_mpi_swap() */
-    TEST_ASSERT( mbedtls_test_read_mpi( &X,  16, X_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y,  16, 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, 16, X_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, 16, 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,  16, X_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y,  16, 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, 16, X_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, 16, 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,  16, X_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y,  16, 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, 16, X_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, 16, 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,  16, X_hex ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &X0, 16, X_hex ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, 16, X_hex) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&X0, 16, 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( int radix_X, char * input_X, int radix_Y,
-                          char * input_Y, int radix_A, char * input_A )
+void mbedtls_mpi_add_mpi(int radix_X,
+                         char *input_X,
+                         int radix_Y,
+                         char *input_Y,
+                         int radix_A,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, radix_Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_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, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, radix_Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_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, radix_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, radix_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( int radix_X, char * input_X, int radix_A,
-                                  char * input_A )
+void mbedtls_mpi_add_mpi_inplace(int radix_X,
+                                 char *input_X,
+                                 int radix_A,
+                                 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, radix_A, input_A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_A, input_A) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, radix_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, radix_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, radix_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, radix_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, radix_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, radix_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( int radix_X, char * input_X, int radix_Y,
-                          char * input_Y, int radix_A, char * input_A )
+void mbedtls_mpi_add_abs(int radix_X,
+                         char *input_X,
+                         int radix_Y,
+                         char *input_Y,
+                         int radix_A,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, radix_Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_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, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, radix_Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_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, radix_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, radix_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( int radix_X, char * input_X, int input_Y,
-                          int radix_A, char * input_A )
+void mbedtls_mpi_add_int(int radix_X,
+                         char *input_X,
+                         int input_Y,
+                         int radix_A,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_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, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_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( int radix_X, char * input_X, int radix_Y,
-                          char * input_Y, int radix_A, char * input_A )
+void mbedtls_mpi_sub_mpi(int radix_X,
+                         char *input_X,
+                         int radix_Y,
+                         char *input_Y,
+                         int radix_A,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, radix_Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_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, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, radix_Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_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, radix_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, radix_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( int radix_X, char * input_X, int radix_Y,
-                          char * input_Y, int radix_A, char * input_A,
-                          int sub_result )
+void mbedtls_mpi_sub_abs(int radix_X,
+                         char *input_X,
+                         int radix_Y,
+                         char *input_Y,
+                         int radix_A,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, radix_Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_A, input_A ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, radix_Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_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, radix_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, radix_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( int radix_X, char * input_X, int input_Y,
-                          int radix_A, char * input_A )
+void mbedtls_mpi_sub_int(int radix_X,
+                         char *input_X,
+                         int input_Y,
+                         int radix_A,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_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, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_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( int radix_X, char * input_X, int radix_Y,
-                          char * input_Y, int radix_A, char * input_A )
+void mbedtls_mpi_mul_mpi(int radix_X,
+                         char *input_X,
+                         int radix_Y,
+                         char *input_Y,
+                         int radix_A,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, radix_Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_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, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, radix_Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_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( int radix_X, char * input_X, int input_Y,
-                          int radix_A, char * input_A,
-                          char * result_comparison )
+void mbedtls_mpi_mul_int(int radix_X,
+                         char *input_X,
+                         int input_Y,
+                         int radix_A,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_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 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_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("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( int radix_X, char * input_X, int radix_Y,
-                          char * input_Y, int radix_A, char * input_A,
-                          int radix_B, char * input_B, int div_result )
+void mbedtls_mpi_div_mpi(int radix_X,
+                         char *input_X,
+                         int radix_Y,
+                         char *input_Y,
+                         int radix_A,
+                         char *input_A,
+                         int radix_B,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, radix_Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &B, radix_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, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, radix_Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_A, input_A) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&B, radix_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( int radix_X, char * input_X, int input_Y,
-                          int radix_A, char * input_A, int radix_B,
-                          char * input_B, int div_result )
+void mbedtls_mpi_div_int(int radix_X,
+                         char *input_X,
+                         int input_Y,
+                         int radix_A,
+                         char *input_A,
+                         int radix_B,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &B, radix_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, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_A, input_A) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&B, radix_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( int radix_X, char * input_X, int radix_Y,
-                          char * input_Y, int radix_A, char * input_A,
-                          int div_result )
+void mbedtls_mpi_mod_mpi(int radix_X,
+                         char *input_X,
+                         int radix_Y,
+                         char *input_Y,
+                         int radix_A,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, radix_Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_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, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, radix_Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_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( int radix_X, char * input_X, int input_Y,
-                          int input_A, int div_result )
+void mbedtls_mpi_mod_int(int radix_X,
+                         char *input_X,
+                         int input_Y,
+                         int input_A,
+                         int div_result)
 {
     mbedtls_mpi X;
     int res;
     mbedtls_mpi_uint r;
-    mbedtls_mpi_init( &X );
+    mbedtls_mpi_init(&X);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, radix_X, input_X ) == 0 );
-    res = mbedtls_mpi_mod_int( &r, &X, input_Y );
-    TEST_ASSERT( res == div_result );
-    if( res == 0 )
-    {
-        TEST_ASSERT( r == (mbedtls_mpi_uint) input_A );
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, radix_X, input_X) == 0);
+    res = mbedtls_mpi_mod_int(&r, &X, input_Y);
+    TEST_ASSERT(res == div_result);
+    if (res == 0) {
+        TEST_ASSERT(r == (mbedtls_mpi_uint)input_A);
     }
 
 exit:
-    mbedtls_mpi_free( &X );
+    mbedtls_mpi_free(&X);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_mpi_exp_mod( int radix_A, char * input_A, int radix_E,
-                          char * input_E, int radix_N, char * input_N,
-                          int radix_X, char * input_X, int exp_result )
+void mbedtls_mpi_exp_mod(int radix_A,
+                         char *input_A,
+                         int radix_E,
+                         char *input_E,
+                         int radix_N,
+                         char *input_N,
+                         int radix_X,
+                         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, radix_A, input_A ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &X, radix_X, input_X ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_A, input_A) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_E, input_E) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&X, radix_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 );
+    /* 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);
     }
 
 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,
-                               int radix_RR, char * input_RR, int exp_result )
+void mbedtls_mpi_exp_mod_size(int A_bytes,
+                              int E_bytes,
+                              int N_bytes,
+                              int radix_RR,
+                              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, radix_RR, input_RR ) == 0 );
+    if (strlen(input_RR))
+        TEST_ASSERT(mbedtls_test_read_mpi(&RR, radix_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( int radix_X, char * input_X, int radix_Y,
-                          char * input_Y, int radix_A, char * input_A,
-                          int div_result )
+void mbedtls_mpi_inv_mod(int radix_X,
+                         char *input_X,
+                         int radix_Y,
+                         char *input_Y,
+                         int radix_A,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Y, radix_Y, input_Y ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_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, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Y, radix_Y, input_Y) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_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( int radix_X, char * input_X, int div_result )
+void mbedtls_mpi_is_prime(int radix_X, 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, radix_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, radix_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( int radix_X, char * input_X, int shift_X,
-                          int radix_A, char * input_A )
+void mbedtls_mpi_shift_l(int radix_X,
+                         char *input_X,
+                         int shift_X,
+                         int radix_A,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_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, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_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( int radix_X, char * input_X, int shift_X,
-                          int radix_A, char * input_A )
+void mbedtls_mpi_shift_r(int radix_X,
+                         char *input_X,
+                         int shift_X,
+                         int radix_A,
+                         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, radix_X, input_X ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &A, radix_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, radix_X, input_X) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&A, radix_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
@@ -1278,71 +1460,59 @@
     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
@@ -1351,79 +1521,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 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_mps.function b/tests/suites/test_suite_mps.function
index 9df8a3c..29178ab 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,29 @@
     unsigned char *tmp;
     int paused;
     mbedtls_mps_reader rd;
-    for( size_t i=0; (unsigned) i < sizeof( bufA ); i++ )
-        bufA[i] = (unsigned char) 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 );
+    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 );
+        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 +89,37 @@
     unsigned char acc[10];
     unsigned char *tmp;
     mbedtls_mps_reader rd;
-    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(bufA); i++)
+        bufA[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 );
+    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 );
+        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 +144,31 @@
     unsigned char *tmp;
     mbedtls_mps_size_t tmp_len;
     mbedtls_mps_reader rd;
-    for( size_t i=0; (unsigned) i < sizeof( buf ); i++ )
-        buf[i] = (unsigned char) 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 );
+    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 );
+        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 +179,35 @@
     unsigned char *tmp;
     mbedtls_mps_size_t tmp_len;
     mbedtls_mps_reader rd;
-    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(bufA); i++)
+        bufA[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 );
+    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 );
+        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 +224,22 @@
     unsigned char buf[100];
     unsigned char *tmp;
     mbedtls_mps_reader rd;
-    for( size_t i=0; (unsigned) i < sizeof( buf ); i++ )
-        buf[i] = (unsigned char) 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 +264,28 @@
     mbedtls_mps_reader rd;
     mbedtls_mps_size_t tmp_len;
 
-    for( size_t i=0; (unsigned) i < sizeof( buf ); i++ )
-        buf[i] = (unsigned char) 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 +304,29 @@
     unsigned char *tmp;
     mbedtls_mps_reader rd;
 
-    for( size_t i=0; (unsigned) i < sizeof( buf ); i++ )
-        buf[i] = (unsigned char) 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 +350,106 @@
     unsigned char acc[40];
     int paused;
     mbedtls_mps_reader rd;
-    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(bufA); i++)
+        bufA[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 )
-    {
-        case 0:  /* Single uncommitted fetch at pausing */
+    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 +470,88 @@
     unsigned char acc[70];
     mbedtls_mps_reader rd;
     mbedtls_mps_size_t fetch_len;
-    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(bufA); i++)
+        bufA[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 +560,51 @@
     unsigned char buf[100];
     unsigned char *tmp;
     mbedtls_mps_reader rd;
-    for( size_t i=0; (unsigned) i < sizeof( buf ); i++ )
-        buf[i] = (unsigned char) 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 +618,33 @@
     unsigned char *tmp;
     mbedtls_mps_reader rd;
 
-    for( size_t i=0; (unsigned) i < sizeof( buf ); i++ )
-        buf[i] = (unsigned char) 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 +662,127 @@
     unsigned char acc[50];
     mbedtls_mps_size_t tmp_len;
     mbedtls_mps_reader rd;
-    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(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);
 
     /* 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
@@ -817,142 +810,121 @@
     unsigned char *outgoing = NULL, *incoming = NULL;
     unsigned char *cur_chunk = NULL;
     size_t cur_out_chunk, out_pos, in_commit, in_fetch;
-    int rand_op;  /* Lower layer:
-                   * - Reclaim (0)
-                   * - Feed (1)
-                   * Upper layer:
-                   * - Get, do tolerate smaller output (0)
-                   * - Get, don't tolerate smaller output (1)
-                   * - Commit (2) */
+    int rand_op; /* Lower layer:
+                  * - Reclaim (0)
+                  * - Feed (1)
+                  * Upper layer:
+                  * - Get, do tolerate smaller output (0)
+                  * - Get, don't tolerate smaller output (1)
+                  * - Commit (2) */
     int mode = 0; /* Lower layer (0) or Upper layer (1) */
     int reclaimed = 1; /* Have to call reclaim at least once before
                         * 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 */
+            } else if (rand_op == 2) /* Commit */
             {
-                ret = mbedtls_mps_reader_commit( &rd );
-                if( ret == 0 )
-                {
+                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 +932,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 +961,129 @@
     unsigned char acc[40];
     mbedtls_mps_reader rd;
     int success = 0;
-    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(bufA); i++)
+        bufA[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 +1095,25 @@
     unsigned char buf[100];
     unsigned char *tmp;
     mbedtls_mps_reader rd;
-    for( size_t i=0; (unsigned) i < sizeof( buf ); i++ )
-        buf[i] = (unsigned char) 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 fdf6b02..2db79c5 100644
--- a/tests/suites/test_suite_net.function
+++ b/tests/suites/test_suite_net.function
@@ -2,22 +2,21 @@
 
 #include "mbedtls/net_sockets.h"
 
-#if defined(unix) || defined(__unix__) || defined(__unix) || \
-    defined(__APPLE__) || defined(__QNXNTO__) || \
-    defined(__HAIKU__) || defined(__midipix__)
-#define MBEDTLS_PLATFORM_IS_UNIXLIKE
+#if defined(unix) || defined(__unix__) || defined(__unix) ||           \
+    defined(__APPLE__) || defined(__QNXNTO__) || defined(__HAIKU__) || \
+    defined(__midipix__)
+#    define MBEDTLS_PLATFORM_IS_UNIXLIKE
 #endif
 
 #if defined(MBEDTLS_PLATFORM_IS_UNIXLIKE)
-#include <sys/fcntl.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
+#    include <sys/fcntl.h>
+#    include <sys/resource.h>
+#    include <sys/stat.h>
+#    include <sys/time.h>
+#    include <sys/types.h>
+#    include <unistd.h>
 #endif
 
-
 #if defined(MBEDTLS_PLATFORM_IS_UNIXLIKE)
 /** Open a file on the given file descriptor.
  *
@@ -30,19 +29,18 @@
  *
  * \return              \c 0 on succes, 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 +52,16 @@
  */
 
 /* 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 +70,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 +83,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 +97,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 +119,16 @@
      * 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..92259d1 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,111 @@
     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 +136,43 @@
     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 );
+    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(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 +181,111 @@
     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 );
+    if (res == 0)
+        TEST_ASSERT(unwrap_ret == MBEDTLS_ERR_CIPHER_AUTH_FAILED);
     else
-        TEST_ASSERT( unwrap_ret == res );
+        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 5c56ef4..d5fb07f 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..f6cc083 100644
--- a/tests/suites/test_suite_pem.function
+++ b/tests/suites/test_suite_pem.function
@@ -6,48 +6,54 @@
 /* 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 454bfac..271d71e 100644
--- a/tests/suites/test_suite_pk.function
+++ b/tests/suites/test_suite_pk.function
@@ -16,7 +16,7 @@
 #include "psa/crypto.h"
 
 #define RSA_KEY_SIZE 512
-#define RSA_KEY_LEN   64
+#define RSA_KEY_LEN  64
 
 /** Generate a key of the desired type.
  *
@@ -29,59 +29,62 @@
  *                  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;
+    ((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 );
+    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 )
-    {
+    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 ;
+        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 );
+        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 ;
+    return -1;
 }
 
 #if defined(MBEDTLS_RSA_C)
-int mbedtls_rsa_decrypt_func( void *ctx, size_t *olen,
-                       const unsigned char *input, unsigned char *output,
-                       size_t output_max_len )
+int mbedtls_rsa_decrypt_func(void *ctx,
+                             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,
-                                       olen, input, output, output_max_len ) );
+    return (mbedtls_rsa_pkcs1_decrypt((mbedtls_rsa_context *)ctx,
+                                      mbedtls_test_rnd_std_rand, NULL, olen,
+                                      input, output, output_max_len));
 }
-int mbedtls_rsa_sign_func( void *ctx,
-                   int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
-                   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,
+                          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,
-                                    md_alg, hashlen, hash, sig ) );
+    ((void)f_rng);
+    ((void)p_rng);
+    return (mbedtls_rsa_pkcs1_sign((mbedtls_rsa_context *)ctx,
+                                   mbedtls_test_rnd_std_rand, NULL, 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 +95,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,13 +121,13 @@
  */
 
 /* 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;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
 
-    const char * const name = "Opaque";
+    const char *const name = "Opaque";
     const size_t bitlen = 256; /* harcoded in genkey() */
 
     mbedtls_md_type_t md_alg = MBEDTLS_MD_NONE;
@@ -132,255 +135,225 @@
     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_test_rnd_std_rand, NULL )
-                 == 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_test_rnd_std_rand,
+                                      NULL) == 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_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,
-                                              MBEDTLS_MD_NONE,
-                                              NULL, 0,
-                                              buf, sizeof( 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, sizeof(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, sizeof( 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, sizeof(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, sizeof( buf ), &len,
-                                  mbedtls_test_rnd_std_rand, NULL ) ==
-                 MBEDTLS_ERR_PK_BAD_INPUT_DATA );
+    TEST_ASSERT(mbedtls_pk_sign(&pk, MBEDTLS_MD_NONE, NULL, 0, buf, sizeof(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, sizeof( buf ),
-                                                NULL ) ==
-                 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( &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_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_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_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_test_rnd_std_rand, NULL ) ==
-                 MBEDTLS_ERR_PK_KEY_INVALID_FORMAT );
+    TEST_ASSERT(mbedtls_pk_parse_key(&pk, NULL, 0, NULL, 1,
+                                     mbedtls_test_rnd_std_rand, NULL) ==
+                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,
-                mbedtls_test_rnd_std_rand, NULL ) == 0 );
+    mbedtls_pk_init(&pk);
+    TEST_ASSERT(mbedtls_pk_parse_key(&pk, key_data->x, key_data->len, NULL, 0,
+                                     mbedtls_test_rnd_std_rand, NULL) == 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 */
-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,
-                                           mbedtls_test_rnd_std_rand, NULL )
-                 == 0 );
+    TEST_ASSERT(mbedtls_pk_parse_public_keyfile(&pub, pub_file) == 0);
+    TEST_ASSERT(mbedtls_pk_parse_keyfile(&prv, prv_file, NULL,
+                                         mbedtls_test_rnd_std_rand, NULL) == 0);
 
-    TEST_ASSERT( mbedtls_pk_check_pair( &pub, &prv,
-                                        mbedtls_test_rnd_std_rand, NULL )
-                 == ret );
+    TEST_ASSERT(mbedtls_pk_check_pair(&pub, &prv, mbedtls_test_rnd_std_rand,
+                                      NULL) == 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,
-                                            mbedtls_test_rnd_std_rand, NULL )
-                     == 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, mbedtls_test_rnd_std_rand,
+                                          NULL) == 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,
-                             int radix_N, char * input_N, int radix_E,
-                             char * input_E, data_t * result_str,
-                             int result )
+void pk_rsa_verify_test_vec(data_t *message_str,
+                            int digest,
+                            int mod,
+                            int radix_N,
+                            char *input_N,
+                            int radix_E,
+                            char *input_E,
+                            data_t *result_str,
+                            int result)
 {
     unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
     mbedtls_rsa_context *rsa;
@@ -390,46 +363,56 @@
     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, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &rsa->E, radix_E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&rsa->N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&rsa->E, radix_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, int radix_N, char * input_N,
-                                 int radix_E, 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,
+                                int radix_N,
+                                char *input_N,
+                                int radix_E,
+                                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;
@@ -438,86 +421,91 @@
     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, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &rsa->E, radix_E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&rsa->N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&rsa->E, radix_E, input_E) == 0);
 
-
-    if( digest != MBEDTLS_MD_NONE )
-    {
-        const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type( digest );
-        TEST_ASSERT( mbedtls_md( md_info, message_str->x, message_str->len,
-                                 hash_result ) == 0 );
-        hash_len = mbedtls_md_get_size( md_info );
-    }
-    else
-    {
-        memcpy( hash_result, message_str->x, message_str->len );
+    if (digest != MBEDTLS_MD_NONE) {
+        const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(digest);
+        TEST_ASSERT(mbedtls_md(md_info, message_str->x, message_str->len,
+                               hash_result) == 0);
+        hash_len = mbedtls_md_get_size(md_info);
+    } 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;
@@ -527,189 +515,194 @@
     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, 16, 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, 16, 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, sizeof( sig ), &slen,
-                                           mbedtls_test_rnd_std_rand, NULL,
-                                           &rs_ctx );
-    } while( ret == MBEDTLS_ERR_ECP_IN_PROGRESS && ++cnt_restart );
+        ret = mbedtls_pk_sign_restartable(&prv, md_alg, hash, hlen, sig,
+                                          sizeof(sig), &slen,
+                                          mbedtls_test_rnd_std_rand, 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, sizeof(sig), &slen,
-                                           mbedtls_test_rnd_std_rand, 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,
+                                          sizeof(sig), &slen,
+                                          mbedtls_test_rnd_std_rand, 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;
     unsigned char hash[32]; // Hard-coded for SHA256
-    size_t hash_len = sizeof( hash );
+    size_t hash_len = sizeof(hash);
     unsigned char sig[MBEDTLS_PK_SIGNATURE_MAX_SIZE];
     void *rs_ctx = NULL;
 #if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE)
     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
 
-    mbedtls_pk_init( &pk );
-    USE_PSA_INIT( );
+    mbedtls_pk_init(&pk);
+    USE_PSA_INIT();
 
-    memset( hash, 0x2a, sizeof(hash) );
-    memset( sig, 0, sizeof(sig) );
+    memset(hash, 0x2a, sizeof(hash));
+    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, MBEDTLS_MD_SHA256,
-                                              hash, hash_len,
-                                              sig, sizeof(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 );
+    TEST_ASSERT(mbedtls_pk_sign_restartable(&pk, MBEDTLS_MD_SHA256, hash,
+                                            hash_len, sig, sizeof(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, MBEDTLS_MD_SHA256,
-                            hash, hash_len, sig, sig_len ) == verify_ret );
+    TEST_ASSERT(mbedtls_pk_verify(&pk, MBEDTLS_MD_SHA256, hash, hash_len, sig,
+                                  sig_len) == verify_ret);
 
-    if( verify_ret == 0 )
-    {
+    if (verify_ret == 0) {
         hash[0]++;
-        TEST_ASSERT( mbedtls_pk_verify( &pk, MBEDTLS_MD_SHA256,
-                                hash, hash_len, sig, sig_len ) != 0 );
+        TEST_ASSERT(mbedtls_pk_verify(&pk, MBEDTLS_MD_SHA256, hash, hash_len,
+                                      sig, sig_len) != 0);
         hash[0]--;
 
         sig[0]++;
-        TEST_ASSERT( mbedtls_pk_verify( &pk, MBEDTLS_MD_SHA256,
-                                hash, hash_len, sig, sig_len ) != 0 );
+        TEST_ASSERT(mbedtls_pk_verify(&pk, MBEDTLS_MD_SHA256, hash, hash_len,
+                                      sig, sig_len) != 0);
         sig[0]--;
     }
 
-    TEST_ASSERT( mbedtls_pk_sign( &pk, MBEDTLS_MD_SHA256, hash, hash_len,
-                                  sig, sizeof(sig), &sig_len,
-                                  mbedtls_test_rnd_std_rand,
-                                  NULL ) == sign_ret );
-    if( sign_ret == 0 )
-        TEST_ASSERT( sig_len <= MBEDTLS_PK_SIGNATURE_MAX_SIZE );
+    TEST_ASSERT(mbedtls_pk_sign(&pk, MBEDTLS_MD_SHA256, hash, hash_len, sig,
+                                sizeof(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, MBEDTLS_MD_SHA256,
-                 hash, hash_len, sig, sig_len, rs_ctx ) == verify_ret );
+    TEST_ASSERT(mbedtls_pk_verify_restartable(&pk, MBEDTLS_MD_SHA256, 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, MBEDTLS_MD_SHA256,
-                     hash, sizeof(hash), sig, sig_len, rs_ctx ) != 0 );
+        TEST_ASSERT(mbedtls_pk_verify_restartable(&pk, MBEDTLS_MD_SHA256, hash,
+                                                  sizeof(hash), sig, sig_len,
+                                                  rs_ctx) != 0);
         hash[0]--;
 
         sig[0]++;
-        TEST_ASSERT( mbedtls_pk_verify_restartable( &pk, MBEDTLS_MD_SHA256,
-                     hash, sizeof(hash), sig, sig_len, rs_ctx ) != 0 );
+        TEST_ASSERT(mbedtls_pk_verify_restartable(&pk, MBEDTLS_MD_SHA256, hash,
+                                                  sizeof(hash), 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 );
-    USE_PSA_DONE( );
+    mbedtls_pk_free(&pk);
+    USE_PSA_DONE();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_RSA_C */
-void pk_rsa_encrypt_test_vec( data_t * message, int mod, int radix_N,
-                              char * input_N, int radix_E, char * input_E,
-                              data_t * result, int ret )
+void pk_rsa_encrypt_test_vec(data_t *message,
+                             int mod,
+                             int radix_N,
+                             char *input_N,
+                             int radix_E,
+                             char *input_E,
+                             data_t *result,
+                             int ret)
 {
     unsigned char output[300];
     mbedtls_test_rnd_pseudo_info rnd_info;
@@ -717,34 +710,42 @@
     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, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &rsa->E, radix_E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&rsa->N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&rsa->E, radix_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, int radix_P,
-                              char * input_P, int radix_Q, char * input_Q,
-                              int radix_N, char * input_N, int radix_E,
-                              char * input_E, data_t * clear, int ret )
+void pk_rsa_decrypt_test_vec(data_t *cipher,
+                             int mod,
+                             int radix_P,
+                             char *input_P,
+                             int radix_Q,
+                             char *input_Q,
+                             int radix_N,
+                             char *input_N,
+                             int radix_E,
+                             char *input_E,
+                             data_t *clear,
+                             int ret)
 {
     unsigned char output[256];
     mbedtls_test_rnd_pseudo_info rnd_info;
@@ -753,49 +754,52 @@
     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, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_E, input_E) == 0);
 
     /* load private key */
-    TEST_ASSERT( mbedtls_test_read_mpi( &P, radix_P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, radix_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, radix_P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, radix_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];
@@ -804,66 +808,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, sizeof(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,
+                                sizeof(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).
@@ -878,76 +882,77 @@
     size_t sig_len, ciph_len, test_len;
     int ret = MBEDTLS_ERR_PK_TYPE_MISMATCH;
 
-    mbedtls_rsa_init( &raw );
-    mbedtls_pk_init( &rsa ); mbedtls_pk_init( &alt );
+    mbedtls_rsa_init(&raw);
+    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));
 
     /* Initiliaze 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, sizeof(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,
+                                sizeof(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, sizeof(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,
+                                sizeof(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;
@@ -960,7 +965,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;
 
     /*
@@ -971,69 +976,63 @@
      * - 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 );
-    klen_legacy = (size_t) ret;
+    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, sizeof(sig), &sig_len,
-                 NULL, NULL ) == 0 );
+    TEST_ASSERT(mbedtls_pk_sign(&pk, MBEDTLS_MD_SHA256, hash, sizeof(hash), sig,
+                                sizeof(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 );
-    klen_psa = (size_t) ret;
+    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_pkcs1_v15.function b/tests/suites/test_suite_pkcs1_v15.function
index 6f859d5..cf0d5dc 100644
--- a/tests/suites/test_suite_pkcs1_v15.function
+++ b/tests/suites/test_suite_pkcs1_v15.function
@@ -9,10 +9,16 @@
  */
 
 /* BEGIN_CASE */
-void pkcs1_rsaes_v15_encrypt( int mod, int radix_N, char * input_N,
-                              int radix_E, 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,
+                             int radix_N,
+                             char *input_N,
+                             int radix_E,
+                             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,107 +30,107 @@
     info.buf = rnd_buf->x;
     info.length = rnd_buf->len;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx,
-                                          MBEDTLS_RSA_PKCS_V15, hash ) == 0 );
-    memset( output, 0x00, sizeof( output ) );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, MBEDTLS_RSA_PKCS_V15, hash) == 0);
+    memset(output, 0x00, sizeof(output));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_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, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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, message_str->len,
-                                            message_str->x,
-                                            output ) == result );
+    TEST_ASSERT(mbedtls_rsa_pkcs1_encrypt(&ctx, &mbedtls_test_rnd_buffer_rand,
+                                          &info, 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, int radix_P, char * input_P,
-                              int radix_Q, char * input_Q, int radix_N,
-                              char * input_N, int radix_E, char * input_E,
-                              int hash, data_t * result_str,
-                              char * seed, data_t * message_str,
-                              int result )
+void pkcs1_rsaes_v15_decrypt(int mod,
+                             int radix_P,
+                             char *input_P,
+                             int radix_Q,
+                             char *input_Q,
+                             int radix_N,
+                             char *input_N,
+                             int radix_E,
+                             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;
     size_t output_len;
     mbedtls_test_rnd_pseudo_info rnd_info;
     mbedtls_mpi N, P, Q, E;
-    ((void) seed);
+    ((void)seed);
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &P );
-    mbedtls_mpi_init( &Q ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx,
-                                          MBEDTLS_RSA_PKCS_V15, hash ) == 0 );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q);
+    mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, MBEDTLS_RSA_PKCS_V15, hash) == 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, radix_P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, radix_Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, radix_P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, radix_Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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,
-                                                &output_len, message_str->x,
-                                                NULL, 0 ) == result );
-    }
-    else
-    {
-        TEST_ASSERT( mbedtls_rsa_pkcs1_decrypt( &ctx,
-                                                &mbedtls_test_rnd_pseudo_rand,
-                                                &rnd_info,
-                                                &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,
+                        &output_len, message_str->x, NULL, 0) == result);
+    } else {
+        TEST_ASSERT(mbedtls_rsa_pkcs1_decrypt(
+                        &ctx, &mbedtls_test_rnd_pseudo_rand, &rnd_info,
+                        &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( data_t *input,
-                       int expected_plaintext_length_arg,
-                       int output_size_arg,
-                       int expected_result )
+void pkcs1_v15_decode(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;
@@ -132,105 +138,88 @@
     mbedtls_mpi Nmpi, Empi, Pmpi, Qmpi;
     mbedtls_rsa_context ctx;
     static unsigned char N[128] = {
-        0xc4, 0x79, 0x4c, 0x6d, 0xb2, 0xe9, 0xdf, 0xc5,
-        0xe5, 0xd7, 0x55, 0x4b, 0xfb, 0x6c, 0x2e, 0xec,
-        0x84, 0xd0, 0x88, 0x12, 0xaf, 0xbf, 0xb4, 0xf5,
-        0x47, 0x3c, 0x7e, 0x92, 0x4c, 0x58, 0xc8, 0x73,
-        0xfe, 0x8f, 0x2b, 0x8f, 0x8e, 0xc8, 0x5c, 0xf5,
-        0x05, 0xeb, 0xfb, 0x0d, 0x7b, 0x2a, 0x93, 0xde,
-        0x15, 0x0d, 0xc8, 0x13, 0xcf, 0xd2, 0x6f, 0x0d,
-        0x9d, 0xad, 0x30, 0xe5, 0x70, 0x20, 0x92, 0x9e,
-        0xb3, 0x6b, 0xba, 0x5c, 0x50, 0x0f, 0xc3, 0xb2,
-        0x7e, 0x64, 0x07, 0x94, 0x7e, 0xc9, 0x4e, 0xc1,
-        0x65, 0x04, 0xaf, 0xb3, 0x9f, 0xde, 0xa8, 0x46,
-        0xfa, 0x6c, 0xf3, 0x03, 0xaf, 0x1c, 0x1b, 0xec,
-        0x75, 0x44, 0x66, 0x77, 0xc9, 0xde, 0x51, 0x33,
-        0x64, 0x27, 0xb0, 0xd4, 0x8d, 0x31, 0x6a, 0x11,
-        0x27, 0x3c, 0x99, 0xd4, 0x22, 0xc0, 0x9d, 0x12,
+        0xc4, 0x79, 0x4c, 0x6d, 0xb2, 0xe9, 0xdf, 0xc5, 0xe5, 0xd7, 0x55, 0x4b,
+        0xfb, 0x6c, 0x2e, 0xec, 0x84, 0xd0, 0x88, 0x12, 0xaf, 0xbf, 0xb4, 0xf5,
+        0x47, 0x3c, 0x7e, 0x92, 0x4c, 0x58, 0xc8, 0x73, 0xfe, 0x8f, 0x2b, 0x8f,
+        0x8e, 0xc8, 0x5c, 0xf5, 0x05, 0xeb, 0xfb, 0x0d, 0x7b, 0x2a, 0x93, 0xde,
+        0x15, 0x0d, 0xc8, 0x13, 0xcf, 0xd2, 0x6f, 0x0d, 0x9d, 0xad, 0x30, 0xe5,
+        0x70, 0x20, 0x92, 0x9e, 0xb3, 0x6b, 0xba, 0x5c, 0x50, 0x0f, 0xc3, 0xb2,
+        0x7e, 0x64, 0x07, 0x94, 0x7e, 0xc9, 0x4e, 0xc1, 0x65, 0x04, 0xaf, 0xb3,
+        0x9f, 0xde, 0xa8, 0x46, 0xfa, 0x6c, 0xf3, 0x03, 0xaf, 0x1c, 0x1b, 0xec,
+        0x75, 0x44, 0x66, 0x77, 0xc9, 0xde, 0x51, 0x33, 0x64, 0x27, 0xb0, 0xd4,
+        0x8d, 0x31, 0x6a, 0x11, 0x27, 0x3c, 0x99, 0xd4, 0x22, 0xc0, 0x9d, 0x12,
         0x01, 0xc7, 0x4a, 0x73, 0xac, 0xbf, 0xc2, 0xbb
     };
     static unsigned char E[1] = { 0x03 };
     static unsigned char P[64] = {
-        0xe5, 0x53, 0x1f, 0x88, 0x51, 0xee, 0x59, 0xf8,
-        0xc1, 0xe4, 0xcc, 0x5b, 0xb3, 0x75, 0x8d, 0xc8,
-        0xe8, 0x95, 0x2f, 0xd0, 0xef, 0x37, 0xb4, 0xcd,
-        0xd3, 0x9e, 0x48, 0x8b, 0x81, 0x58, 0x60, 0xb9,
-        0x27, 0x1d, 0xb6, 0x28, 0x92, 0x64, 0xa3, 0xa5,
-        0x64, 0xbd, 0xcc, 0x53, 0x68, 0xdd, 0x3e, 0x55,
-        0xea, 0x9d, 0x5e, 0xcd, 0x1f, 0x96, 0x87, 0xf1,
-        0x29, 0x75, 0x92, 0x70, 0x8f, 0x28, 0xfb, 0x2b
+        0xe5, 0x53, 0x1f, 0x88, 0x51, 0xee, 0x59, 0xf8, 0xc1, 0xe4, 0xcc,
+        0x5b, 0xb3, 0x75, 0x8d, 0xc8, 0xe8, 0x95, 0x2f, 0xd0, 0xef, 0x37,
+        0xb4, 0xcd, 0xd3, 0x9e, 0x48, 0x8b, 0x81, 0x58, 0x60, 0xb9, 0x27,
+        0x1d, 0xb6, 0x28, 0x92, 0x64, 0xa3, 0xa5, 0x64, 0xbd, 0xcc, 0x53,
+        0x68, 0xdd, 0x3e, 0x55, 0xea, 0x9d, 0x5e, 0xcd, 0x1f, 0x96, 0x87,
+        0xf1, 0x29, 0x75, 0x92, 0x70, 0x8f, 0x28, 0xfb, 0x2b
     };
     static unsigned char Q[64] = {
-        0xdb, 0x53, 0xef, 0x74, 0x61, 0xb4, 0x20, 0x3b,
-        0x3b, 0x87, 0x76, 0x75, 0x81, 0x56, 0x11, 0x03,
-        0x59, 0x31, 0xe3, 0x38, 0x4b, 0x8c, 0x7a, 0x9c,
-        0x05, 0xd6, 0x7f, 0x1e, 0x5e, 0x60, 0xf0, 0x4e,
-        0x0b, 0xdc, 0x34, 0x54, 0x1c, 0x2e, 0x90, 0x83,
-        0x14, 0xef, 0xc0, 0x96, 0x5c, 0x30, 0x10, 0xcc,
-        0xc1, 0xba, 0xa0, 0x54, 0x3f, 0x96, 0x24, 0xca,
-        0xa3, 0xfb, 0x55, 0xbc, 0x71, 0x29, 0x4e, 0xb1
+        0xdb, 0x53, 0xef, 0x74, 0x61, 0xb4, 0x20, 0x3b, 0x3b, 0x87, 0x76,
+        0x75, 0x81, 0x56, 0x11, 0x03, 0x59, 0x31, 0xe3, 0x38, 0x4b, 0x8c,
+        0x7a, 0x9c, 0x05, 0xd6, 0x7f, 0x1e, 0x5e, 0x60, 0xf0, 0x4e, 0x0b,
+        0xdc, 0x34, 0x54, 0x1c, 0x2e, 0x90, 0x83, 0x14, 0xef, 0xc0, 0x96,
+        0x5c, 0x30, 0x10, 0xcc, 0xc1, 0xba, 0xa0, 0x54, 0x3f, 0x96, 0x24,
+        0xca, 0xa3, 0xfb, 0x55, 0xbc, 0x71, 0x29, 0x4e, 0xb1
     };
     unsigned char original[128];
     unsigned char intermediate[128];
     static unsigned char default_content[128] = {
         /* A randomly generated pattern. */
-        0x4c, 0x27, 0x54, 0xa0, 0xce, 0x0d, 0x09, 0x4a,
-        0x1c, 0x38, 0x8e, 0x2d, 0xa3, 0xc4, 0xe0, 0x19,
-        0x4c, 0x99, 0xb2, 0xbf, 0xe6, 0x65, 0x7e, 0x58,
-        0xd7, 0xb6, 0x8a, 0x05, 0x2f, 0xa5, 0xec, 0xa4,
-        0x35, 0xad, 0x10, 0x36, 0xff, 0x0d, 0x08, 0x50,
-        0x74, 0x47, 0xc9, 0x9c, 0x4a, 0xe7, 0xfd, 0xfa,
-        0x83, 0x5f, 0x14, 0x5a, 0x1e, 0xe7, 0x35, 0x08,
-        0xad, 0xf7, 0x0d, 0x86, 0xdf, 0xb8, 0xd4, 0xcf,
-        0x32, 0xb9, 0x5c, 0xbe, 0xa3, 0xd2, 0x89, 0x70,
-        0x7b, 0xc6, 0x48, 0x7e, 0x58, 0x4d, 0xf3, 0xef,
-        0x34, 0xb7, 0x57, 0x54, 0x79, 0xc5, 0x8e, 0x0a,
-        0xa3, 0xbf, 0x6d, 0x42, 0x83, 0x25, 0x13, 0xa2,
-        0x95, 0xc0, 0x0d, 0x32, 0xec, 0x77, 0x91, 0x2b,
-        0x68, 0xb6, 0x8c, 0x79, 0x15, 0xfb, 0x94, 0xde,
-        0xb9, 0x2b, 0x94, 0xb3, 0x28, 0x23, 0x86, 0x3d,
+        0x4c, 0x27, 0x54, 0xa0, 0xce, 0x0d, 0x09, 0x4a, 0x1c, 0x38, 0x8e, 0x2d,
+        0xa3, 0xc4, 0xe0, 0x19, 0x4c, 0x99, 0xb2, 0xbf, 0xe6, 0x65, 0x7e, 0x58,
+        0xd7, 0xb6, 0x8a, 0x05, 0x2f, 0xa5, 0xec, 0xa4, 0x35, 0xad, 0x10, 0x36,
+        0xff, 0x0d, 0x08, 0x50, 0x74, 0x47, 0xc9, 0x9c, 0x4a, 0xe7, 0xfd, 0xfa,
+        0x83, 0x5f, 0x14, 0x5a, 0x1e, 0xe7, 0x35, 0x08, 0xad, 0xf7, 0x0d, 0x86,
+        0xdf, 0xb8, 0xd4, 0xcf, 0x32, 0xb9, 0x5c, 0xbe, 0xa3, 0xd2, 0x89, 0x70,
+        0x7b, 0xc6, 0x48, 0x7e, 0x58, 0x4d, 0xf3, 0xef, 0x34, 0xb7, 0x57, 0x54,
+        0x79, 0xc5, 0x8e, 0x0a, 0xa3, 0xbf, 0x6d, 0x42, 0x83, 0x25, 0x13, 0xa2,
+        0x95, 0xc0, 0x0d, 0x32, 0xec, 0x77, 0x91, 0x2b, 0x68, 0xb6, 0x8c, 0x79,
+        0x15, 0xfb, 0x94, 0xde, 0xb9, 0x2b, 0x94, 0xb3, 0x28, 0x23, 0x86, 0x3d,
         0x37, 0x00, 0xe6, 0xf1, 0x1f, 0x4e, 0xd4, 0x42
     };
     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 );
+    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);
 
-    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 );
-    TEST_ASSERT( mbedtls_rsa_public( &ctx, original, intermediate ) == 0 );
+    TEST_ASSERT(input->len <= sizeof(N));
+    memcpy(original, input->x, input->len);
+    memset(original + input->len, 'd', sizeof(original) - input->len);
+    TEST_ASSERT(mbedtls_rsa_public(&ctx, original, intermediate) == 0);
 
-    memcpy( final, default_content, sizeof( final ) );
-    TEST_ASSERT( mbedtls_rsa_pkcs1_decrypt( &ctx,
-                                            &mbedtls_test_rnd_pseudo_rand,
-                                            &rnd_info, &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 )
-    {
+    memcpy(final, default_content, sizeof(final));
+    TEST_ASSERT(mbedtls_rsa_pkcs1_decrypt(&ctx, &mbedtls_test_rnd_pseudo_rand,
+                                          &rnd_info, &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;
 
@@ -239,37 +228,49 @@
          * 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, int radix_P, char * input_P, int radix_Q,
-                            char * input_Q, int radix_N, char * input_N,
-                            int radix_E, 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,
+                           int radix_P,
+                           char *input_P,
+                           int radix_Q,
+                           char *input_Q,
+                           int radix_N,
+                           char *input_N,
+                           int radix_E,
+                           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];
-    const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type( digest );
+    const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(digest);
     unsigned char output[128];
     mbedtls_rsa_context ctx;
     mbedtls_mpi N, P, Q, E;
@@ -280,78 +281,90 @@
     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 );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx,
-                                          MBEDTLS_RSA_PKCS_V15, hash ) == 0 );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q);
+    mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, MBEDTLS_RSA_PKCS_V15, hash) == 0);
 
-    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, radix_P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, radix_Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, radix_P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, radix_Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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( md_info != NULL )
-        TEST_ASSERT( mbedtls_md( md_info, message_str->x, message_str->len, hash_result ) == 0 );
+    if (md_info != NULL)
+        TEST_ASSERT(mbedtls_md(md_info, message_str->x, message_str->len,
+                               hash_result) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_sign(
-                     &ctx, &mbedtls_test_rnd_buffer_rand, &info,
-                     digest, mbedtls_md_get_size( md_info ), 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_rsa_pkcs1_sign(&ctx, &mbedtls_test_rnd_buffer_rand,
+                                       &info, digest,
+                                       mbedtls_md_get_size(md_info),
+                                       hash_result, output) == result);
+    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( &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, int radix_N, char * input_N,
-                              int radix_E, 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,
+                             int radix_N,
+                             char *input_N,
+                             int radix_E,
+                             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];
-    const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type( digest );
+    const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(digest);
     mbedtls_rsa_context ctx;
     mbedtls_mpi N, E;
-    ((void) salt);
+    ((void)salt);
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx,
-                                          MBEDTLS_RSA_PKCS_V15, hash ) == 0 );
-    memset( hash_result, 0x00, sizeof( hash_result ) );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, MBEDTLS_RSA_PKCS_V15, hash) == 0);
+    memset(hash_result, 0x00, sizeof(hash_result));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_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, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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 (md_info != NULL)
+        TEST_ASSERT(mbedtls_md(md_info, message_str->x, message_str->len,
+                               hash_result) == 0);
 
-    if( md_info != NULL )
-        TEST_ASSERT( mbedtls_md( md_info, message_str->x, message_str->len, hash_result ) == 0 );
-
-    TEST_ASSERT( mbedtls_rsa_pkcs1_verify( &ctx, digest, mbedtls_md_get_size( md_info ), hash_result, result_str->x ) == result );
+    TEST_ASSERT(mbedtls_rsa_pkcs1_verify(&ctx, digest,
+                                         mbedtls_md_get_size(md_info),
+                                         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 27b0990..8fd00cd 100644
--- a/tests/suites/test_suite_pkcs1_v21.function
+++ b/tests/suites/test_suite_pkcs1_v21.function
@@ -9,9 +9,14 @@
  */
 
 /* 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,107 +28,113 @@
     info.buf = rnd_buf->x;
     info.length = rnd_buf->len;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx,
-                                          MBEDTLS_RSA_PKCS_V21, hash ) == 0 );
-    memset( output, 0x00, sizeof( output ) );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, MBEDTLS_RSA_PKCS_V21, hash) == 0);
+    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, 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, 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;
     size_t output_len;
     mbedtls_test_rnd_pseudo_info rnd_info;
     mbedtls_mpi N, P, Q, E;
-    ((void) seed);
+    ((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 );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx,
-                                          MBEDTLS_RSA_PKCS_V21, hash ) == 0 );
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, MBEDTLS_RSA_PKCS_V21, hash) == 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_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,
-                                                &output_len, message_str->x,
-                                                NULL, 0 ) == result );
-    }
-    else
-    {
-        TEST_ASSERT( mbedtls_rsa_pkcs1_decrypt( &ctx,
-                                                &mbedtls_test_rnd_pseudo_rand,
-                                                &rnd_info,
-                                                &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,
+                        &output_len, message_str->x, NULL, 0) == result);
+    } else {
+        TEST_ASSERT(
+            mbedtls_rsa_pkcs1_decrypt(&ctx, &mbedtls_test_rnd_pseudo_rand,
+                                      &rnd_info, &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];
-    const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type( digest );
+    const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(digest);
     unsigned char output[512];
     mbedtls_rsa_context ctx;
     mbedtls_test_rnd_buf_info info;
@@ -134,147 +145,159 @@
     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 );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx,
-                                          MBEDTLS_RSA_PKCS_V21, hash ) == 0 );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q);
+    mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, MBEDTLS_RSA_PKCS_V21, hash) == 0);
 
-    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( md_info != NULL )
-        TEST_ASSERT( mbedtls_md( md_info, message_str->x, message_str->len, hash_result ) == 0 );
+    if (md_info != NULL)
+        TEST_ASSERT(mbedtls_md(md_info, 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,
-                         digest, mbedtls_md_get_size( md_info ), 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, digest,
+                                           mbedtls_md_get_size(md_info),
+                                           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, mbedtls_md_get_size( md_info ), 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,
+                    mbedtls_md_get_size(md_info), 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];
-    const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type( digest );
+    const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(digest);
     mbedtls_rsa_context ctx;
     mbedtls_mpi N, E;
-    ((void) salt);
+    ((void)salt);
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx,
-                                          MBEDTLS_RSA_PKCS_V21, hash ) == 0 );
-    memset( hash_result, 0x00, sizeof( hash_result ) );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, MBEDTLS_RSA_PKCS_V21, hash) == 0);
+    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 (md_info != NULL)
+        TEST_ASSERT(mbedtls_md(md_info, message_str->x, message_str->len,
+                               hash_result) == 0);
 
-    if( md_info != NULL )
-        TEST_ASSERT( mbedtls_md( md_info, message_str->x, message_str->len, hash_result ) == 0 );
-
-    TEST_ASSERT( mbedtls_rsa_pkcs1_verify( &ctx, digest, mbedtls_md_get_size( md_info ), hash_result, result_str->x ) == result );
+    TEST_ASSERT(mbedtls_rsa_pkcs1_verify(&ctx, digest,
+                                         mbedtls_md_get_size(md_info),
+                                         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 );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx,
-                                          MBEDTLS_RSA_PKCS_V21, ctx_hash ) == 0 );
-    memset( hash_result, 0x00, sizeof( hash_result ) );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, MBEDTLS_RSA_PKCS_V21, ctx_hash) ==
+                0);
+    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 )
-    {
+    if (msg_digest_id != MBEDTLS_MD_NONE) {
         const mbedtls_md_info_t *md_info =
-            mbedtls_md_info_from_type( msg_digest_id );
-        TEST_ASSERT( mbedtls_md( md_info,
-                                 message_str->x, message_str->len,
-                                 hash_result ) == 0 );
-        hash_len = mbedtls_md_get_size( md_info );
-    }
-    else
-    {
-        memcpy( hash_result, message_str->x, message_str->len );
+            mbedtls_md_info_from_type(msg_digest_id);
+        TEST_ASSERT(mbedtls_md(md_info, message_str->x, message_str->len,
+                               hash_result) == 0);
+        hash_len = mbedtls_md_get_size(md_info);
+    } else {
+        memcpy(hash_result, message_str->x, message_str->len);
         hash_len = message_str->len;
     }
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_verify( &ctx, msg_digest_id,
-                                           hash_len, hash_result,
-                                           result_str->x ) == result_simple );
+    TEST_ASSERT(mbedtls_rsa_pkcs1_verify(&ctx, msg_digest_id, hash_len,
+                                         hash_result,
+                                         result_str->x) == result_simple);
 
-    TEST_ASSERT( mbedtls_rsa_rsassa_pss_verify_ext( &ctx, 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, 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..990bfb2 100644
--- a/tests/suites/test_suite_pkcs5.function
+++ b/tests/suites/test_suite_pkcs5.function
@@ -8,33 +8,42 @@
  */
 
 /* 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 +53,23 @@
     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 4c7f3d2..ef1ad39 100644
--- a/tests/suites/test_suite_pkparse.function
+++ b/tests/suites/test_suite_pkparse.function
@@ -10,122 +10,119 @@
  */
 
 /* 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,
-            mbedtls_test_rnd_std_rand, NULL );
+    res = mbedtls_pk_parse_keyfile(&ctx, key_file, pwd,
+                                   mbedtls_test_rnd_std_rand, NULL);
 
-    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,
-            mbedtls_test_rnd_std_rand, NULL );
+    res = mbedtls_pk_parse_keyfile(&ctx, key_file, password,
+                                   mbedtls_test_rnd_std_rand, NULL);
 
-    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,
-                        mbedtls_test_rnd_std_rand, NULL ) == result );
+    TEST_ASSERT(mbedtls_pk_parse_key(&pk, buf->x, buf->len, NULL, 0,
+                                     mbedtls_test_rnd_std_rand,
+                                     NULL) == 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 d1e029a..f454007 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,33 +58,32 @@
     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,
-                        mbedtls_test_rnd_std_rand, NULL ) == 0 );
+    mbedtls_pk_init(&key);
+    TEST_ASSERT(mbedtls_pk_parse_keyfile(&key, key_file, NULL,
+                                         mbedtls_test_rnd_std_rand, 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 59e9277..a19e646 100644
--- a/tests/suites/test_suite_poly1305.function
+++ b/tests/suites/test_suite_poly1305.function
@@ -9,35 +9,33 @@
  */
 
 /* 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,43 +43,43 @@
 
     /* 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 */
 
 /* 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 a73b9a1..3a314fe 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -21,8 +21,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;
@@ -38,50 +38,49 @@
  * \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;
 }
 
 /* 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;
+    (*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)[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
@@ -102,133 +101,126 @@
      * 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 ) );
+        const unsigned char tag = MBEDTLS_ASN1_CONSTRUCTED |
+                                  MBEDTLS_ASN1_SEQUENCE;
+        MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_tag(p, buffer, tag));
     }
-    return len ;
+    return len;
 }
 
-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 );
-    TEST_EQUAL(
-        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 );
+    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);
+    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);
 
-    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;
 
@@ -237,36 +229,32 @@
      * 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 )                             \
-    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 );                       \
-    }                                                                   \
-    while( 0 )
+#    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);                         \
+        } 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 {
+typedef enum
+{
     IMPORT_KEY = 0,
     GENERATE_KEY = 1,
     DERIVE_KEY = 2
@@ -280,22 +268,23 @@
  */
 
 /* BEGIN_CASE */
-void static_checks( )
+void static_checks()
 {
-    size_t max_truncated_mac_size =
-        PSA_ALG_MAC_TRUNCATION_MASK >> PSA_MAC_TRUNCATION_OFFSET;
+    size_t max_truncated_mac_size = PSA_ALG_MAC_TRUNCATION_MASK >>
+                                    PSA_MAC_TRUNCATION_OFFSET;
 
     /* 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_ASSERT( PSA_MAC_MAX_SIZE <= 1 + max_truncated_mac_size );
+    TEST_ASSERT(PSA_MAC_MAX_SIZE <= 1 + max_truncated_mac_size);
 }
 /* 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;
@@ -304,48 +293,48 @@
     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;
@@ -355,40 +344,39 @@
     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 */
-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;
@@ -402,31 +390,29 @@
 
     /* Skip the test case if the target running the test cannot
      * accomodate 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:
@@ -434,23 +420,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);
 
-    psa_destroy_key( key );
-    PSA_DONE( );
-    mbedtls_free( buffer );
+    psa_destroy_key(key);
+    PSA_DONE();
+    mbedtls_free(buffer);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-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;
     psa_status_t expected_status = expected_status_arg;
     psa_status_t status;
-    psa_key_type_t type =
-        keypair ? PSA_KEY_TYPE_RSA_KEY_PAIR : PSA_KEY_TYPE_RSA_PUBLIC_KEY;
+    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;
     unsigned char *buffer = NULL;
@@ -459,35 +445,36 @@
     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,
-                    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,
+                   int canonical_input)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t type = type_arg;
@@ -502,40 +489,39 @@
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     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( ) );
+    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());
 
-    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_ASSERT( exported_length <= export_size );
+    TEST_ASSERT(exported_length != INVALID_EXPORT_LENGTH);
+    TEST_ASSERT(status == PSA_SUCCESS || exported_length == 0);
+    TEST_ASSERT(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;
     }
 
@@ -543,54 +529,51 @@
      * 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
-    {
+    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 ) );
+        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_ASSERT( exported_length <= PSA_EXPORT_KEY_PAIR_MAX_SIZE );
+    TEST_ASSERT(
+        exported_length <=
+        PSA_EXPORT_KEY_OUTPUT_SIZE(type, psa_get_key_bits(&got_attributes)));
+    TEST_ASSERT(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,
-                               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,
+                              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;
@@ -602,35 +585,32 @@
     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_ASSERT( expected_public_key->len <=
-                     PSA_EXPORT_KEY_OUTPUT_SIZE( public_type, bits ) );
-        TEST_ASSERT( expected_public_key->len <=
-                     PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE( public_type, bits ) );
-        TEST_ASSERT( 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_ASSERT(expected_public_key->len <=
+                    PSA_EXPORT_KEY_OUTPUT_SIZE(public_type, bits));
+        TEST_ASSERT(expected_public_key->len <=
+                    PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(public_type, bits));
+        TEST_ASSERT(expected_public_key->len <= PSA_EXPORT_PUBLIC_KEY_MAX_SIZE);
+        ASSERT_COMPARE(expected_public_key->x, expected_public_key->len,
+                       exported, exported_length);
     }
 
 exit:
@@ -638,67 +618,71 @@
      * 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;
@@ -711,88 +695,86 @@
     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 supress 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_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_arg)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
@@ -805,46 +787,45 @@
     psa_status_t expected_status = expected_status_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 );
-    if( ( policy_usage & PSA_KEY_USAGE_SIGN_HASH ) == 0 )
-        TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
+    status = psa_mac_sign_setup(&operation, key, exercise_alg);
+    if ((policy_usage & PSA_KEY_USAGE_SIGN_HASH) == 0)
+        TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
     else
-        TEST_EQUAL( status, expected_status );
+        TEST_EQUAL(status, expected_status);
 
-    psa_mac_abort( &operation );
+    psa_mac_abort(&operation);
 
-    memset( mac, 0, sizeof( mac ) );
-    status = psa_mac_verify_setup( &operation, key, exercise_alg );
-    if( ( policy_usage & PSA_KEY_USAGE_VERIFY_HASH ) == 0 )
-        TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
+    memset(mac, 0, sizeof(mac));
+    status = psa_mac_verify_setup(&operation, key, exercise_alg);
+    if ((policy_usage & PSA_KEY_USAGE_VERIFY_HASH) == 0)
+        TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
     else
-        TEST_EQUAL( status, expected_status );
+        TEST_EQUAL(status, expected_status);
 
 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;
@@ -852,115 +833,103 @@
     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 );
+    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 );
+        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 );
+    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 );
+        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_ASSERT( nonce_length <= sizeof( nonce ) );
-    TEST_ASSERT( tag_length <= sizeof( tag ) );
+    TEST_ASSERT(nonce_length <= sizeof(nonce));
+    TEST_ASSERT(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 );
+    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 );
+        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 );
+    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 );
+        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;
@@ -971,236 +940,223 @@
     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 );
+    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 );
+        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 );
+    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 );
+        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 );
+    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 );
+        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 );
+    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 );
+        TEST_EQUAL(status, PSA_ERROR_NOT_PERMITTED);
 
-    if( PSA_ALG_IS_HASH_AND_SIGN( 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 );
+    if (PSA_ALG_IS_HASH_AND_SIGN(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 );
+            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 );
+        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 );
+            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_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 );
+    if (policy_alg == exercise_alg &&
+        (policy_usage & PSA_KEY_USAGE_DERIVE) != 0)
+        PSA_ASSERT(status);
     else
-        TEST_EQUAL( status, PSA_ERROR_NOT_PERMITTED );
+        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;
     psa_key_type_t key_type = key_type_arg;
-    psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+    psa_key_derivation_operation_t operation =
+        PSA_KEY_DERIVATION_OPERATION_INIT;
     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;
@@ -1210,25 +1166,24 @@
     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:
@@ -1236,57 +1191,61 @@
      * 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;
     psa_key_type_t key_type = key_type_arg;
-    psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+    psa_key_derivation_operation_t operation =
+        PSA_KEY_DERIVATION_OPERATION_INIT;
     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;
@@ -1297,195 +1256,196 @@
     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 supress 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. */
+        /* 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;
@@ -1494,265 +1454,251 @@
     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_ASSERT( output_length <= output_size );
+    status = psa_hash_compute(alg, input->x, input->len, output, output_size,
+                              &output_length);
+    TEST_EQUAL(status, expected_status);
+    TEST_ASSERT(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[] = "";
     /* SHA-256 hash of an empty string */
     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 };
+        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
+    };
     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)
      * appended to it */
-    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 );
+    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);
     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];
@@ -1763,41 +1709,36 @@
     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];
@@ -1808,37 +1749,33 @@
     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 };
 
@@ -1846,35 +1783,32 @@
      * 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 supress 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;
@@ -1885,160 +1819,155 @@
     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;
     psa_algorithm_t alg = PSA_ALG_HMAC(PSA_ALG_SHA_256);
     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, 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 };
     size_t sign_mac_length = 0;
     const uint8_t input[] = { 0xbb, 0xbb, 0xbb, 0xbb };
-    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 };
+    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 };
 
-    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;
@@ -2047,86 +1976,75 @@
     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,
-        1,
-        expected_mac->len - 1,
-        expected_mac->len,
-        expected_mac->len + 1,
+        0, 1, expected_mac->len - 1, expected_mac->len, expected_mac->len + 1,
     };
 
-    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));
 
-    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 );
+        psa_status_t expected_status = (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;
@@ -2135,93 +2053,79 @@
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     uint8_t *perturbed_mac = NULL;
 
-    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));
 
     /* 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 };
@@ -2230,41 +2134,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 supress 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;
@@ -2275,32 +2173,30 @@
     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;
@@ -2309,174 +2205,151 @@
     psa_cipher_operation_t operation = PSA_CIPHER_OPERATION_INIT;
     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 };
-    const uint8_t text[] = {
-        0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb,
-        0xbb, 0xbb, 0xbb, 0xbb };
+        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 };
     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;
@@ -2488,40 +2361,39 @@
     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_encrypt_alg_without_iv( int alg_arg,
-                                    int key_type_arg,
-                                    data_t *key_data,
-                                    data_t *input,
-                                    data_t *expected_output )
+void cipher_encrypt_alg_without_iv(int alg_arg,
+                                   int key_type_arg,
+                                   data_t *key_data,
+                                   data_t *input,
+                                   data_t *expected_output)
 {
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_key_type_t key_type = key_type_arg;
@@ -2531,36 +2403,36 @@
     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_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));
 
-    PSA_ASSERT( psa_cipher_encrypt( key, alg, input->x, input->len, output,
-                                    output_buffer_size, &output_length ) );
-    TEST_ASSERT( output_length <=
-                 PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, input->len ) );
-    TEST_ASSERT( output_length <=
-                 PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE( input->len ) );
+    PSA_ASSERT(psa_cipher_encrypt(key, alg, input->x, input->len, output,
+                                  output_buffer_size, &output_length));
+    TEST_ASSERT(output_length <=
+                PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input->len));
+    TEST_ASSERT(output_length <=
+                PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(input->len));
 
-    ASSERT_COMPARE( expected_output->x, expected_output->len,
-                    output, output_length );
+    ASSERT_COMPARE(expected_output->x, expected_output->len, output,
+                   output_length);
 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_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;
@@ -2569,46 +2441,43 @@
     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;
@@ -2619,74 +2488,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_ASSERT( output1_length <=
-                 PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, input->len ) );
-    TEST_ASSERT( 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_ASSERT(output1_length <=
+                PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input->len));
+    TEST_ASSERT(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_ASSERT( function_output_length <=
-                 PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, input->len ) );
-    TEST_ASSERT( 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_ASSERT(function_output_length <=
+                PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, input->len));
+    TEST_ASSERT(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_ASSERT( function_output_length <=
-                 PSA_CIPHER_FINISH_OUTPUT_SIZE( key_type, alg ) );
-    TEST_ASSERT( 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_ASSERT(function_output_length <=
+                PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg));
+    TEST_ASSERT(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;
@@ -2703,92 +2572,86 @@
     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_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_ASSERT( function_output_length == output1_length );
-    TEST_ASSERT( function_output_length <=
-                 PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, first_part_size ) );
-    TEST_ASSERT( function_output_length <=
-                 PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE( first_part_size) );
+    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_ASSERT(function_output_length == output1_length);
+    TEST_ASSERT(function_output_length <=
+                PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, first_part_size));
+    TEST_ASSERT(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_ASSERT( function_output_length <=
-                     PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type,
-                                                    alg,
-                                                    input->len - first_part_size ) );
-        TEST_ASSERT( 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_ASSERT(function_output_length <=
+                    PSA_CIPHER_UPDATE_OUTPUT_SIZE(
+                        key_type, alg, input->len - first_part_size));
+        TEST_ASSERT(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_ASSERT( function_output_length <=
-                 PSA_CIPHER_FINISH_OUTPUT_SIZE( key_type, alg ) );
-    TEST_ASSERT( 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_ASSERT(function_output_length <=
+                PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg));
+    TEST_ASSERT(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;
@@ -2805,202 +2668,190 @@
     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_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_ASSERT( function_output_length == output1_length );
-    TEST_ASSERT( function_output_length <=
-                 PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, first_part_size ) );
-    TEST_ASSERT( function_output_length <=
-                 PSA_CIPHER_UPDATE_OUTPUT_MAX_SIZE( first_part_size ) );
+    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_ASSERT(function_output_length == output1_length);
+    TEST_ASSERT(function_output_length <=
+                PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, first_part_size));
+    TEST_ASSERT(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_ASSERT( function_output_length <=
-                     PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type,
-                                                    alg,
-                                                    input->len - first_part_size ) );
-        TEST_ASSERT( 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_ASSERT(function_output_length <=
+                    PSA_CIPHER_UPDATE_OUTPUT_SIZE(
+                        key_type, alg, input->len - first_part_size));
+        TEST_ASSERT(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_ASSERT( function_output_length <=
-                 PSA_CIPHER_FINISH_OUTPUT_SIZE( key_type, alg ) );
-    TEST_ASSERT( 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_ASSERT(function_output_length <=
+                PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg));
+    TEST_ASSERT(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_ASSERT(output_length <= PSA_CIPHER_DECRYPT_OUTPUT_SIZE(
+                                     key_type, alg, input_buffer_size));
+    TEST_ASSERT(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_ASSERT( output_length <=
-                 PSA_CIPHER_DECRYPT_OUTPUT_SIZE( key_type, alg, input_buffer_size ) );
-    TEST_ASSERT( 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;
@@ -3013,58 +2864,56 @@
     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_ASSERT( output1_length <=
-                 PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, input->len ) );
-    TEST_ASSERT( 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_ASSERT(output1_length <=
+                PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input->len));
+    TEST_ASSERT(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_ASSERT( output2_length <=
-                 PSA_CIPHER_DECRYPT_OUTPUT_SIZE( key_type, alg, output1_length ) );
-    TEST_ASSERT( 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_ASSERT(output2_length <=
+                PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, output1_length));
+    TEST_ASSERT(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;
@@ -3078,132 +2927,120 @@
     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_ASSERT( 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_ASSERT(output1_buffer_size <=
+                PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(input->len));
+    ASSERT_ALLOC(output1, output1_buffer_size);
 
-    TEST_ASSERT( first_part_size <= input->len );
+    TEST_ASSERT(first_part_size <= input->len);
 
-    PSA_ASSERT( psa_cipher_update( &operation1, input->x, first_part_size,
-                                   output1, output1_buffer_size,
-                                   &function_output_length ) );
-    TEST_ASSERT( function_output_length <=
-                 PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, first_part_size ) );
-    TEST_ASSERT( 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_ASSERT(function_output_length <=
+                PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, first_part_size));
+    TEST_ASSERT(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_ASSERT( function_output_length <=
-                 PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type,
-                                                alg,
-                                                input->len - first_part_size ) );
-    TEST_ASSERT( 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_ASSERT(function_output_length <=
+                PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg,
+                                              input->len - first_part_size));
+    TEST_ASSERT(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_ASSERT( function_output_length <=
-                 PSA_CIPHER_FINISH_OUTPUT_SIZE( key_type, alg ) );
-    TEST_ASSERT( 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_ASSERT(function_output_length <=
+                PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg));
+    TEST_ASSERT(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_ASSERT( output2_buffer_size <=
-                 PSA_CIPHER_DECRYPT_OUTPUT_SIZE( key_type, alg, output1_length ) );
-    TEST_ASSERT( output2_buffer_size <=
-                 PSA_CIPHER_DECRYPT_OUTPUT_MAX_SIZE( output1_length ) );
-    ASSERT_ALLOC( output2, output2_buffer_size );
+    TEST_ASSERT(output2_buffer_size <=
+                PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, output1_length));
+    TEST_ASSERT(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_ASSERT( function_output_length <=
-                 PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type, alg, first_part_size ) );
-    TEST_ASSERT( 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_ASSERT(function_output_length <=
+                PSA_CIPHER_UPDATE_OUTPUT_SIZE(key_type, alg, first_part_size));
+    TEST_ASSERT(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_ASSERT( function_output_length <=
-                 PSA_CIPHER_UPDATE_OUTPUT_SIZE( key_type,
-                                                alg,
-                                                output1_length - first_part_size ) );
-    TEST_ASSERT( 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_ASSERT(function_output_length <=
+                PSA_CIPHER_UPDATE_OUTPUT_SIZE(
+                    key_type, alg, output1_length - first_part_size));
+    TEST_ASSERT(
+        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_ASSERT( function_output_length <=
-                 PSA_CIPHER_FINISH_OUTPUT_SIZE( key_type, alg ) );
-    TEST_ASSERT( 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_ASSERT(function_output_length <=
+                PSA_CIPHER_FINISH_OUTPUT_SIZE(key_type, alg));
+    TEST_ASSERT(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;
@@ -3218,90 +3055,82 @@
     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;
@@ -3313,62 +3142,59 @@
     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;
@@ -3381,82 +3207,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);
 
-exit:
-    ;
+exit:;
 }
 /* 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;
@@ -3467,51 +3285,50 @@
     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 advertized by the
      * library. */
-    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 );
+    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);
 
     /* 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);
 
 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( 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;
@@ -3523,39 +3340,38 @@
     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_ASSERT( signature_length <= signature_size );
+    TEST_ASSERT(signature_length <= signature_size);
 
 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;
@@ -3566,49 +3382,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_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 advertized by the
      * library. */
-    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 );
+    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);
 
     /* 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_ASSERT( signature_length <= signature_size );
-    TEST_ASSERT( signature_length > 0 );
+    TEST_ASSERT(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:
@@ -3616,51 +3426,53 @@
      * 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_ASSERT( signature_data->len <= PSA_SIGNATURE_MAX_SIZE );
+    TEST_ASSERT(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));
 
 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;
@@ -3669,33 +3481,31 @@
     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);
 
 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;
@@ -3706,231 +3516,214 @@
     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_ASSERT( 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_ASSERT(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_ASSERT(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_ASSERT(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_ASSERT(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_ASSERT(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_ASSERT( 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_ASSERT( 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_ASSERT( 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_ASSERT( 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;
@@ -3944,46 +3737,42 @@
     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_ASSERT( 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_ASSERT(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:
@@ -3991,20 +3780,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;
@@ -4018,70 +3807,65 @@
     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_ASSERT( 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_ASSERT(output_size <= PSA_ASYMMETRIC_ENCRYPT_OUTPUT_MAX_SIZE);
+    ASSERT_ALLOC(output, output_size);
 
     output2_size = input_data->len;
-    TEST_ASSERT( output2_size <=
-                 PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE( key_type, key_bits, alg ) );
-    TEST_ASSERT( output2_size <= PSA_ASYMMETRIC_DECRYPT_OUTPUT_MAX_SIZE );
-    ASSERT_ALLOC( output2, output2_size );
+    TEST_ASSERT(output2_size <=
+                PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE(key_type, key_bits, alg));
+    TEST_ASSERT(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_ASSERT( output_length <= output_size );
+    TEST_ASSERT(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;
@@ -4092,65 +3876,56 @@
     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_ASSERT( 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_ASSERT(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;
@@ -4162,139 +3937,144 @@
     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_ASSERT( 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_ASSERT(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_ASSERT( 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_ASSERT(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 supress 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_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_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 };
-    psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+    psa_key_derivation_operation_t operation =
+        PSA_KEY_DERIVATION_OPERATION_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     size_t i;
     psa_key_type_t output_key_type = output_key_type_arg;
@@ -4302,179 +4082,164 @@
     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, PSA_KEY_TYPE_RAW_DATA );
-        psa_set_key_bits( &attributes, 8 );
+    if (output_key_type != PSA_KEY_TYPE_NONE) {
+        psa_reset_key_attributes(&attributes);
+        psa_set_key_type(&attributes, PSA_KEY_TYPE_RAW_DATA);
+        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;
+    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 );
-    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};
+    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 };
     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;
+    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};
-    size_t output_sizes[2] =
-        {expected_output1->len, expected_output2->len};
+    psa_key_derivation_operation_t operation =
+        PSA_KEY_DERIVATION_OPERATION_INIT;
+    uint8_t *expected_outputs[2] = { expected_output1->x, expected_output2->x };
+    size_t output_sizes[2] = { expected_output1->len, expected_output2->len };
     size_t output_buffer_size = 0;
     uint8_t *output_buffer = NULL;
     size_t expected_capacity;
@@ -4483,173 +4248,158 @@
     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;
     size_t requested_capacity = requested_capacity_arg;
-    psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+    psa_key_derivation_operation_t operation =
+        PSA_KEY_DERIVATION_OPERATION_INIT;
     unsigned char output_buffer[16];
     size_t expected_capacity = requested_capacity;
     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;
@@ -4658,40 +4408,40 @@
     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 );
-    psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+    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:
@@ -4699,22 +4449,22 @@
      * 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;
@@ -4722,81 +4472,78 @@
     size_t bytes1 = bytes1_arg;
     size_t bytes2 = bytes2_arg;
     size_t capacity = bytes1 + bytes2;
-    psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+    psa_key_derivation_operation_t operation =
+        PSA_KEY_DERIVATION_OPERATION_INIT;
     uint8_t *output_buffer = NULL;
     uint8_t *export_buffer = NULL;
     psa_key_attributes_t base_attributes = PSA_KEY_ATTRIBUTES_INIT;
     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;
@@ -4804,99 +4551,96 @@
     psa_key_type_t type = type_arg;
     size_t bits = bits_arg;
     psa_status_t expected_status = expected_status_arg;
-    psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+    psa_key_derivation_operation_t operation =
+        PSA_KEY_DERIVATION_OPERATION_INIT;
     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_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);
 
 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;
     psa_algorithm_t our_key_alg = our_key_alg_arg;
     psa_key_type_t our_key_type = our_key_type_arg;
-    psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+    psa_key_derivation_operation_t operation =
+        PSA_KEY_DERIVATION_OPERATION_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     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;
@@ -4906,159 +4650,148 @@
     size_t output_length = ~0;
     size_t key_bits;
 
-    ASSERT_ALLOC( output, expected_output->len );
-    PSA_ASSERT( psa_crypto_init( ) );
+    ASSERT_ALLOC(output, expected_output->len);
+    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);
 
-    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 );
-    TEST_ASSERT( output_length <=
-                 PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE( our_key_type, key_bits ) );
-    TEST_ASSERT( output_length <=
-                 PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE );
+    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);
+    TEST_ASSERT(output_length <=
+                PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE(our_key_type, key_bits));
+    TEST_ASSERT(output_length <= PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE);
 
 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;
     psa_key_type_t our_key_type = our_key_type_arg;
-    psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+    psa_key_derivation_operation_t operation =
+        PSA_KEY_DERIVATION_OPERATION_INIT;
     psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
     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 advertized 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;
     psa_key_type_t our_key_type = our_key_type_arg;
-    psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+    psa_key_derivation_operation_t operation =
+        PSA_KEY_DERIVATION_OPERATION_INIT;
     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;
@@ -5066,25 +4799,23 @@
     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];
         }
     }
@@ -5092,25 +4823,24 @@
     /* 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;
@@ -5121,29 +4851,29 @@
     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:
@@ -5151,17 +4881,15 @@
      * 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;
@@ -5172,56 +4900,52 @@
     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 );
+    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 );
+        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;
@@ -5230,26 +4954,23 @@
          *      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 );
-        }
-        else
-            ASSERT_COMPARE( p, len, e_arg->x, e_arg->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);
+        } else
+            ASSERT_COMPARE(p, len, e_arg->x, e_arg->len);
     }
 
 exit:
@@ -5257,22 +4978,24 @@
      * 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;
@@ -5280,119 +5003,106 @@
     size_t bits = bits_arg;
     psa_key_usage_t usage_flags = usage_flags_arg;
     psa_algorithm_t alg = alg_arg;
-    psa_key_derivation_operation_t operation = PSA_KEY_DERIVATION_OPERATION_INIT;
+    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_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 ) );
+                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 ) );
+                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:
@@ -5400,13 +5110,13 @@
      * 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..6be3b0c 100644
--- a/tests/suites/test_suite_psa_crypto_attributes.function
+++ b/tests/suites/test_suite_psa_crypto_attributes.function
@@ -8,122 +8,123 @@
  */
 
 /* 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;
     psa_key_type_t type = type_arg;
     size_t bits = bits_arg;
 
-    TEST_EQUAL(
-        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 );
+    TEST_EQUAL(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);
 
-    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 );
-    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 );
+    TEST_EQUAL(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);
 }
 /* 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_t id1 = 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_t id2 = 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 6d78ad5..b0dbdfa 100644
--- a/tests/suites/test_suite_psa_crypto_driver_wrappers.function
+++ b/tests/suites/test_suite_psa_crypto_driver_wrappers.function
@@ -8,315 +8,286 @@
  */
 
 /* BEGIN_CASE depends_on:PSA_WANT_ALG_DETERMINISTIC_ECDSA:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256 */
-void ecdsa_sign_hash( int force_status_arg,
-                      data_t *key_input,
-                      data_t *data_input,
-                      data_t *expected_output,
-                      int fake_output,
-                      int expected_status_arg )
+void ecdsa_sign_hash(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;
     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_DETERMINISTIC_ECDSA( PSA_ALG_SHA_256 );
+    psa_algorithm_t alg = PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256);
     uint8_t signature[64];
     size_t signature_length = 0xdeadbeef;
     psa_status_t actual_status;
     mbedtls_test_driver_signature_sign_hooks =
         mbedtls_test_driver_signature_hooks_init();
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    psa_set_key_type( &attributes,
-                      PSA_KEY_TYPE_ECC_KEY_PAIR( PSA_ECC_FAMILY_SECP_R1 ) );
-    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,
+                     PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1));
+    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 =
             expected_output->len;
     }
 
-    actual_status = psa_sign_hash( key, alg,
-                                   data_input->x, data_input->len,
-                                   signature, sizeof( signature ),
-                                   &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, sizeof(signature),
+                                  &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 );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    PSA_DONE();
     mbedtls_test_driver_signature_sign_hooks =
         mbedtls_test_driver_signature_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:PSA_WANT_ALG_ECDSA:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256 */
-void ecdsa_verify_hash( 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 ecdsa_verify_hash(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;
     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);
     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,
-                      PSA_KEY_TYPE_ECC_PUBLIC_KEY( PSA_ECC_FAMILY_SECP_R1 ) );
-        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,
-                      PSA_KEY_TYPE_ECC_KEY_PAIR( PSA_ECC_FAMILY_SECP_R1 ) );
-        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 );
+    PSA_ASSERT(psa_crypto_init());
+    if (register_public_key) {
+        psa_set_key_type(&attributes,
+                         PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_FAMILY_SECP_R1));
+        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,
+                         PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1));
+        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 );
+    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( );
+    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_DETERMINISTIC_ECDSA:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256 */
-void ecdsa_sign_message( int force_status_arg,
-                         data_t *key_input,
-                         data_t *data_input,
-                         data_t *expected_output,
-                         int fake_output,
-                         int expected_status_arg )
+void ecdsa_sign_message(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;
     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_DETERMINISTIC_ECDSA( PSA_ALG_SHA_256 );
+    psa_algorithm_t alg = PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256);
     uint8_t signature[64];
     size_t signature_length = 0xdeadbeef;
     psa_status_t actual_status;
     mbedtls_test_driver_signature_sign_hooks =
         mbedtls_test_driver_signature_hooks_init();
 
-    PSA_ASSERT( psa_crypto_init( ) );
-    psa_set_key_type( &attributes,
-                      PSA_KEY_TYPE_ECC_KEY_PAIR( PSA_ECC_FAMILY_SECP_R1 ) );
-    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,
+                     PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1));
+    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 =
             expected_output->len;
     }
 
-    actual_status = psa_sign_message( key, alg,
-                                      data_input->x, data_input->len,
-                                      signature, sizeof( signature ),
-                                      &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, sizeof(signature),
+                                     &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 );
-    PSA_DONE( );
+    psa_reset_key_attributes(&attributes);
+    psa_destroy_key(key);
+    PSA_DONE();
     mbedtls_test_driver_signature_sign_hooks =
         mbedtls_test_driver_signature_hooks_init();
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:PSA_WANT_ALG_ECDSA:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256 */
-void ecdsa_verify_message( 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 ecdsa_verify_message(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;
     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);
     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,
-                      PSA_KEY_TYPE_ECC_PUBLIC_KEY( PSA_ECC_FAMILY_SECP_R1 ) );
-        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,
-                      PSA_KEY_TYPE_ECC_KEY_PAIR( PSA_ECC_FAMILY_SECP_R1 ) );
-        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,
+                         PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_FAMILY_SECP_R1));
+        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,
+                         PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1));
+        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 depends_on:PSA_WANT_ALG_ECDSA:PSA_WANT_ECC_SECP_R1_256 */
-void validate_key( int force_status_arg,
-                   int key_type_arg,
-                   data_t *key_input,
-                   int expected_status_arg )
+void validate_key(int force_status_arg,
+                  int key_type_arg,
+                  data_t *key_input,
+                  int expected_status_arg)
 {
     psa_status_t force_status = force_status_arg;
     psa_status_t expected_status = expected_status_arg;
@@ -327,35 +298,35 @@
     mbedtls_test_driver_key_management_hooks =
         mbedtls_test_driver_key_management_hooks_init();
 
-    psa_set_key_type( &attributes,
-                      key_type );
-    psa_set_key_bits( &attributes, 0 );
-    psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_EXPORT );
+    psa_set_key_type(&attributes, key_type);
+    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 );
+    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);
 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 depends_on:PSA_WANT_ALG_ECDSA:PSA_WANT_ECC_SECP_R1_256 */
-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;
@@ -366,30 +337,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;
     }
@@ -397,40 +365,43 @@
     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 );
+    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 );
+        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;
@@ -442,81 +413,80 @@
     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 ) );
-    // 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 );
+    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);
 
 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;
@@ -538,117 +508,112 @@
 
     /* 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 tranparent_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 = tranparent_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;
+        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 );
+    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 ;
+    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_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_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;
@@ -670,115 +635,110 @@
 
     /* 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 tranparent_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 = tranparent_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_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 ) );
-    TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
+    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 ) );
+    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;
+        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, ( force_status == PSA_SUCCESS ? 1 : 0 ) );
+    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 );
+        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 );
+    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 ) );
+    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(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;
@@ -795,59 +755,59 @@
     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;
+        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;
@@ -860,168 +820,157 @@
     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 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;
-    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);
     /* 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;
@@ -1035,62 +984,60 @@
     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;
@@ -1104,56 +1051,52 @@
     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;
@@ -1162,125 +1105,111 @@
     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 );
-    }
-    else
-        TEST_EQUAL( forced_status, 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);
 
-    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 );
+    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 );
+    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 );
+        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 );
+    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 );
+        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);
+
+    PSA_ASSERT(psa_mac_abort(&operation));
+    if (forced_status == PSA_SUCCESS)
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 4);
     else
-        TEST_EQUAL( PSA_ERROR_BAD_STATE, status );
+        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 );
-
-    if( forced_status == PSA_SUCCESS )
-    {
-        ASSERT_COMPARE( expected_mac->x, expected_mac->len,
-                        actual_mac, mac_length );
+    if (forced_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);
     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;
@@ -1291,33 +1220,29 @@
     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 );
-    }
-    else
-        TEST_EQUAL( forced_status, 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);
 
     mbedtls_test_driver_mac_hooks = mbedtls_test_driver_mac_hooks_init();
     mbedtls_test_driver_mac_hooks.forced_status = forced_status;
@@ -1325,172 +1250,163 @@
     /*
      * 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);
+
+    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( forced_status, status );
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 1);
 
-    status = psa_mac_update( &operation,
-                             input->x, input->len );
-    if( forced_status == PSA_SUCCESS )
-        TEST_EQUAL( mbedtls_test_driver_mac_hooks.hits, 2 );
+    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_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 );
+        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);
+
+    PSA_ASSERT(psa_mac_abort(&operation));
+    if (forced_status == PSA_SUCCESS)
+        TEST_EQUAL(mbedtls_test_driver_mac_hooks.hits, 4);
     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 );
+        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;
-    psa_algorithm_t builtin_key_alg = (psa_algorithm_t) builtin_key_algorithm_arg;
-    size_t builtin_key_bits = (size_t) builtin_key_bits_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;
+    psa_algorithm_t builtin_key_alg =
+        (psa_algorithm_t)builtin_key_algorithm_arg;
+    size_t builtin_key_bits = (size_t)builtin_key_bits_arg;
     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;
-    psa_algorithm_t builtin_key_alg = (psa_algorithm_t) builtin_key_algorithm_arg;
-    size_t builtin_key_bits = (size_t) builtin_key_bits_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;
+    psa_algorithm_t builtin_key_alg =
+        (psa_algorithm_t)builtin_key_algorithm_arg;
+    size_t builtin_key_bits = (size_t)builtin_key_bits_arg;
     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;
@@ -1501,32 +1417,32 @@
     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,
-                           data_t *input, data_t *hash,
-                           int forced_status_arg,
-                           int expected_status_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;
@@ -1536,44 +1452,43 @@
     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());
 
     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 );
+    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 );
+    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 );
+        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 );
+        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_update( int alg_arg,
-                            data_t *input, data_t *hash,
-                            int forced_status_arg )
+void hash_multipart_update(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;
@@ -1582,54 +1497,54 @@
     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 );
-    /* 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(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);
 
-    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;
@@ -1638,50 +1553,47 @@
     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;
@@ -1691,50 +1603,47 @@
     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 d209c08..c37f8e8 100644
--- a/tests/suites/test_suite_psa_crypto_entropy.function
+++ b/tests/suites/test_suite_psa_crypto_entropy.function
@@ -8,30 +8,31 @@
 #include "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)
 
-#if defined(MBEDTLS_PSA_ITS_FILE_C)
-#include <stdio.h>
-#else
-#include <psa/internal_trusted_storage.h>
-#endif
+#    if defined(MBEDTLS_PSA_ITS_FILE_C)
+#        include <stdio.h>
+#    else
+#        include <psa/internal_trusted_storage.h>
+#    endif
 
 /* Remove the entropy seed file. Since the library does not expose a way
  * 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 ;
+#    if defined(MBEDTLS_PSA_ITS_FILE_C)
+    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 ) ;
-#endif
+        return PSA_ERROR_DOES_NOT_EXIST;
+#    else
+    return psa_its_remove(PSA_CRYPTO_ITS_RANDOM_SEED_UID);
+#    endif
 }
 
 #endif /* MBEDTLS_PSA_INJECT_ENTROPY */
@@ -39,44 +40,46 @@
 /* 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 +87,37 @@
     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 +125,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( );
-    /* 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 = 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);
 exit:
-    remove_seed_file( );
-    PSA_DONE( );
+    remove_seed_file();
+    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..97d264c 100644
--- a/tests/suites/test_suite_psa_crypto_hash.function
+++ b/tests/suites/test_suite_psa_crypto_hash.function
@@ -10,54 +10,49 @@
  */
 
 /* 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 +61,33 @@
     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 2ee3015..cc18523 100644
--- a/tests/suites/test_suite_psa_crypto_init.function
+++ b/tests/suites/test_suite_psa_crypto_init.function
@@ -7,7 +7,7 @@
 #include "mbedtls/entropy.h"
 #include "entropy_poll.h"
 
-#define ENTROPY_MIN_NV_SEED_SIZE                                        \
+#define ENTROPY_MIN_NV_SEED_SIZE \
     MAX(MBEDTLS_ENTROPY_MIN_PLATFORM, MBEDTLS_ENTROPY_BLOCK_SIZE)
 
 #include "psa_crypto_random_impl.h"
@@ -17,100 +17,97 @@
  * 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
  * and once for a nonce. */
-#include "mbedtls/ctr_drbg.h"
-#define ENTROPY_NONCE_LEN MBEDTLS_CTR_DRBG_ENTROPY_NONCE_LEN
+#    include "mbedtls/ctr_drbg.h"
+#    define ENTROPY_NONCE_LEN MBEDTLS_CTR_DRBG_ENTROPY_NONCE_LEN
 #endif
 
 #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
-#define ENTROPY_SOURCE_TIMING                   0x00000002
-#define ENTROPY_SOURCE_HARDWARE                 0x00000004
-#define ENTROPY_SOURCE_NV_SEED                  0x00000008
-#define ENTROPY_SOURCE_FAKE                     0x40000000
+#    define ENTROPY_SOURCE_PLATFORM 0x00000001
+#    define ENTROPY_SOURCE_TIMING   0x00000002
+#    define ENTROPY_SOURCE_HARDWARE 0x00000004
+#    define ENTROPY_SOURCE_NV_SEED  0x00000008
+#    define ENTROPY_SOURCE_FAKE     0x40000000
 
 static uint32_t custom_entropy_sources_mask;
 static fake_entropy_state_t fake_entropy_state;
 
 /* 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 );
-#endif
+#    if defined(MBEDTLS_THREADING_C)
+    mbedtls_mutex_init(&ctx->mutex);
+#    endif
 
     ctx->accumulator_started = 0;
-#if defined(MBEDTLS_ENTROPY_SHA512_ACCUMULATOR)
-    mbedtls_sha512_init( &ctx->accumulator );
-#else
-    mbedtls_sha256_init( &ctx->accumulator );
-#endif
+#    if defined(MBEDTLS_ENTROPY_SHA512_ACCUMULATOR)
+    mbedtls_sha512_init(&ctx->accumulator);
+#    else
+    mbedtls_sha256_init(&ctx->accumulator);
+#    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 );
-#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 );
-#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 !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);
+#    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);
+#    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);
         ctx->initial_entropy_run = 0;
-    }
-    else
-    {
+    } else {
         /* Skip the NV seed even though it's compiled in. */
         ctx->initial_entropy_run = 1;
     }
-#endif
+#    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) */
@@ -123,109 +120,105 @@
  */
 
 /* 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 };
@@ -234,55 +227,54 @@
     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 52c96a6..e754a0b 100644
--- a/tests/suites/test_suite_psa_crypto_metadata.function
+++ b/tests/suites/test_suite_psa_crypto_metadata.function
@@ -5,7 +5,7 @@
  * and using it. */
 
 #if defined(MBEDTLS_PSA_CRYPTO_SPM)
-#include "spm/psa_defs.h"
+#    include "spm/psa_defs.h"
 #endif
 
 #include "psa/crypto.h"
@@ -16,60 +16,58 @@
  * 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_DSA                      ( 1u << 6 )
-#define ALG_DSA_IS_DETERMINISTIC        ( 1u << 7 )
-#define ALG_IS_DETERMINISTIC_DSA        ( 1u << 8 )
-#define ALG_IS_RANDOMIZED_DSA           ( 1u << 9 )
-#define ALG_IS_ECDSA                    ( 1u << 10 )
-#define ALG_ECDSA_IS_DETERMINISTIC      ( 1u << 11 )
-#define ALG_IS_DETERMINISTIC_ECDSA      ( 1u << 12 )
-#define ALG_IS_RANDOMIZED_ECDSA         ( 1u << 13 )
-#define ALG_IS_HASH_EDDSA               ( 1u << 14 )
-#define ALG_IS_HASH_AND_SIGN            ( 1u << 15 )
-#define ALG_IS_RSA_OAEP                 ( 1u << 16 )
-#define ALG_IS_HKDF                     ( 1u << 17 )
-#define ALG_IS_FFDH                     ( 1u << 18 )
-#define ALG_IS_ECDH                     ( 1u << 19 )
-#define ALG_IS_WILDCARD                 ( 1u << 20 )
-#define ALG_IS_RAW_KEY_AGREEMENT        ( 1u << 21 )
-#define ALG_IS_AEAD_ON_BLOCK_CIPHER     ( 1u << 22 )
-#define ALG_IS_TLS12_PRF                ( 1u << 23 )
-#define ALG_IS_TLS12_PSK_TO_MS          ( 1u << 24 )
+#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_DSA                  (1u << 6)
+#define ALG_DSA_IS_DETERMINISTIC    (1u << 7)
+#define ALG_IS_DETERMINISTIC_DSA    (1u << 8)
+#define ALG_IS_RANDOMIZED_DSA       (1u << 9)
+#define ALG_IS_ECDSA                (1u << 10)
+#define ALG_ECDSA_IS_DETERMINISTIC  (1u << 11)
+#define ALG_IS_DETERMINISTIC_ECDSA  (1u << 12)
+#define ALG_IS_RANDOMIZED_ECDSA     (1u << 13)
+#define ALG_IS_HASH_EDDSA           (1u << 14)
+#define ALG_IS_HASH_AND_SIGN        (1u << 15)
+#define ALG_IS_RSA_OAEP             (1u << 16)
+#define ALG_IS_HKDF                 (1u << 17)
+#define ALG_IS_FFDH                 (1u << 18)
+#define ALG_IS_ECDH                 (1u << 19)
+#define ALG_IS_WILDCARD             (1u << 20)
+#define ALG_IS_RAW_KEY_AGREEMENT    (1u << 21)
+#define ALG_IS_AEAD_ON_BLOCK_CIPHER (1u << 22)
+#define ALG_IS_TLS12_PRF            (1u << 23)
+#define ALG_IS_TLS12_PSK_TO_MS      (1u << 24)
 
 /* 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_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)
 
 /* 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_IS_VOLATILE  (1u << 0)
+#define KEY_LIFETIME_IS_READ_ONLY (1u << 1)
 
-#define TEST_CLASSIFICATION_MACRO( flag, alg, flags ) \
-    do                                                \
-    {                                                 \
-        if( ( flags ) & ( flag ) )                    \
-            TEST_ASSERT( PSA_##flag( alg ) );         \
-        else                                          \
-            TEST_ASSERT( ! PSA_##flag( alg ) );       \
-    }                                                 \
-    while( 0 )
+#define TEST_CLASSIFICATION_MACRO(flag, alg, flags) \
+    do {                                            \
+        if ((flags) & (flag))                       \
+            TEST_ASSERT(PSA_##flag(alg));           \
+        else                                        \
+            TEST_ASSERT(!PSA_##flag(alg));          \
+    } while (0)
 
 /* Check the parity of value.
  *
@@ -83,125 +81,124 @@
  * 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)
 {
-    TEST_CLASSIFICATION_MACRO( ALG_IS_VENDOR_DEFINED, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_HMAC, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_BLOCK_CIPHER_MAC, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_STREAM_CIPHER, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_RSA_PKCS1V15_SIGN, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_RSA_PSS, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_DSA, alg, flags );
-    if ( PSA_ALG_IS_DSA( alg ) )
-        TEST_CLASSIFICATION_MACRO( ALG_DSA_IS_DETERMINISTIC, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_DETERMINISTIC_DSA, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_RANDOMIZED_DSA, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_ECDSA, alg, flags );
-    if ( PSA_ALG_IS_ECDSA( alg ) )
-        TEST_CLASSIFICATION_MACRO( ALG_ECDSA_IS_DETERMINISTIC, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_DETERMINISTIC_ECDSA, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_RANDOMIZED_ECDSA, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_HASH_EDDSA, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_HASH_AND_SIGN, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_RSA_OAEP, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_HKDF, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_WILDCARD, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_ECDH, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_FFDH, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_RAW_KEY_AGREEMENT, alg, flags );
-    TEST_CLASSIFICATION_MACRO( ALG_IS_AEAD_ON_BLOCK_CIPHER, alg, flags );
-exit: ;
+    TEST_CLASSIFICATION_MACRO(ALG_IS_VENDOR_DEFINED, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_HMAC, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_BLOCK_CIPHER_MAC, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_STREAM_CIPHER, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_RSA_PKCS1V15_SIGN, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_RSA_PSS, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_DSA, alg, flags);
+    if (PSA_ALG_IS_DSA(alg))
+        TEST_CLASSIFICATION_MACRO(ALG_DSA_IS_DETERMINISTIC, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_DETERMINISTIC_DSA, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_RANDOMIZED_DSA, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_ECDSA, alg, flags);
+    if (PSA_ALG_IS_ECDSA(alg))
+        TEST_CLASSIFICATION_MACRO(ALG_ECDSA_IS_DETERMINISTIC, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_DETERMINISTIC_ECDSA, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_RANDOMIZED_ECDSA, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_HASH_EDDSA, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_HASH_AND_SIGN, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_RSA_OAEP, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_HKDF, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_WILDCARD, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_ECDH, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_FFDH, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_RAW_KEY_AGREEMENT, alg, flags);
+    TEST_CLASSIFICATION_MACRO(ALG_IS_AEAD_ON_BLOCK_CIPHER, alg, flags);
+exit:;
 }
 
-void key_type_classification( psa_key_type_t type, unsigned flags )
+void key_type_classification(psa_key_type_t type, unsigned flags)
 {
     /* Macros tested based on the test case parameter */
-    TEST_CLASSIFICATION_MACRO( KEY_TYPE_IS_VENDOR_DEFINED, type, flags );
-    TEST_CLASSIFICATION_MACRO( KEY_TYPE_IS_UNSTRUCTURED, type, flags );
-    TEST_CLASSIFICATION_MACRO( KEY_TYPE_IS_PUBLIC_KEY, type, flags );
-    TEST_CLASSIFICATION_MACRO( KEY_TYPE_IS_KEY_PAIR, type, flags );
-    TEST_CLASSIFICATION_MACRO( KEY_TYPE_IS_RSA, type, flags );
-    TEST_CLASSIFICATION_MACRO( KEY_TYPE_IS_ECC, type, flags );
-    TEST_CLASSIFICATION_MACRO( KEY_TYPE_IS_DH, type, flags );
+    TEST_CLASSIFICATION_MACRO(KEY_TYPE_IS_VENDOR_DEFINED, type, flags);
+    TEST_CLASSIFICATION_MACRO(KEY_TYPE_IS_UNSTRUCTURED, type, flags);
+    TEST_CLASSIFICATION_MACRO(KEY_TYPE_IS_PUBLIC_KEY, type, flags);
+    TEST_CLASSIFICATION_MACRO(KEY_TYPE_IS_KEY_PAIR, type, flags);
+    TEST_CLASSIFICATION_MACRO(KEY_TYPE_IS_RSA, type, flags);
+    TEST_CLASSIFICATION_MACRO(KEY_TYPE_IS_ECC, type, flags);
+    TEST_CLASSIFICATION_MACRO(KEY_TYPE_IS_DH, type, flags);
 
     /* 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 ) );
-    TEST_ASSERT( ! PSA_ALG_IS_PAKE( 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));
+    TEST_ASSERT(!PSA_ALG_IS_PAKE(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 ) );
-    TEST_ASSERT( ! PSA_ALG_IS_PAKE( 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));
+    TEST_ASSERT(!PSA_ALG_IS_PAKE(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 */
@@ -212,53 +209,55 @@
  */
 
 /* 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 ) );
-    TEST_ASSERT( ! PSA_ALG_IS_PAKE( 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));
+    TEST_ASSERT(!PSA_ALG_IS_PAKE(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;
@@ -266,127 +265,125 @@
     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_HMAC_MAX_HASH_BLOCK_SIZE );
+    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 ) );
-    TEST_ASSERT( ! PSA_ALG_IS_PAKE( 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));
+    TEST_ASSERT(!PSA_ALG_IS_PAKE(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;
@@ -394,101 +391,110 @@
     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 ) );
-    TEST_ASSERT( ! PSA_ALG_IS_PAKE( 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));
+    TEST_ASSERT(!PSA_ALG_IS_PAKE(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_HASH_AND_SIGN | ALG_IS_WILDCARD;
-    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;
@@ -496,206 +502,206 @@
 /* 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 ) );
-    TEST_ASSERT( ! PSA_ALG_IS_PAKE( 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));
+    TEST_ASSERT(!PSA_ALG_IS_PAKE(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 ) );
-    TEST_ASSERT( ! PSA_ALG_IS_PAKE( 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));
+    TEST_ASSERT(!PSA_ALG_IS_PAKE(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 ) );
-    TEST_ASSERT( ! PSA_ALG_IS_PAKE( 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));
+    TEST_ASSERT(!PSA_ALG_IS_PAKE(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 pake_algorithm( int alg_arg )
+void pake_algorithm(int alg_arg)
 {
     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 ) );
-    TEST_ASSERT( PSA_ALG_IS_PAKE( alg ) );
+    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));
+    TEST_ASSERT(PSA_ALG_IS_PAKE(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 );
+    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;
     psa_key_location_t location = location_arg;
     unsigned flags = classification_flags;
 
-    TEST_CLASSIFICATION_MACRO( KEY_LIFETIME_IS_VOLATILE, lifetime, flags );
-    TEST_CLASSIFICATION_MACRO( KEY_LIFETIME_IS_READ_ONLY, lifetime, flags );
+    TEST_CLASSIFICATION_MACRO(KEY_LIFETIME_IS_VOLATILE, lifetime, flags);
+    TEST_CLASSIFICATION_MACRO(KEY_LIFETIME_IS_READ_ONLY, lifetime, flags);
 
-    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..c81f575 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,38 @@
  */
 
 /* 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_persistent_key.function b/tests/suites/test_suite_psa_crypto_persistent_key.function
index bd9b9c9..04c22f2 100644
--- a/tests/suites/test_suite_psa_crypto_persistent_key.function
+++ b/tests/suites/test_suite_psa_crypto_persistent_key.function
@@ -15,7 +15,8 @@
 #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
@@ -24,9 +25,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;
@@ -39,302 +40,304 @@
  */
 
 /* 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_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_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 );
-    psa_key_type_t type = (psa_key_type_t) type_arg;
+    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;
     size_t export_size = data->len;
     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 7212d15..100fbef 100644
--- a/tests/suites/test_suite_psa_crypto_se_driver_hal.function
+++ b/tests/suites/test_suite_psa_crypto_se_driver_hal.function
@@ -7,13 +7,12 @@
 
 /* Invasive peeking: check the persistent data */
 #if defined(MBEDTLS_PSA_ITS_FILE_C)
-#include "psa_crypto_its.h"
+#    include "psa_crypto_its.h"
 #else /* Native ITS implementation */
-#include "psa/error.h"
-#include "psa/internal_trusted_storage.h"
+#    include "psa/error.h"
+#    include "psa/internal_trusted_storage.h"
 #endif
 
-
 /****************************************************************/
 /* Test driver helpers */
 /****************************************************************/
@@ -23,17 +22,17 @@
 
 /** 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 ) )
+#define TEST_SE_PERSISTENT_LIFETIME                  \
+    (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 ) )
+#define TEST_SE_VOLATILE_LIFETIME                    \
+    (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 +40,13 @@
  *
  * Use this macro to assert on guarantees provided by the core.
  */
-#define DRIVER_ASSERT_RETURN( TEST )                        \
-    do {                                                    \
-       if( ! (TEST) )                                       \
-       {                                                    \
-          mbedtls_test_fail( #TEST, __LINE__, __FILE__ );   \
-          return PSA_ERROR_DETECTED_BY_DRIVER ;           \
-       }                                                    \
-    } while( 0 )
+#define DRIVER_ASSERT_RETURN(TEST)                        \
+    do {                                                  \
+        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 +55,14 @@
  *
  * Use this macro to assert on guarantees provided by the core.
  */
-#define DRIVER_ASSERT( TEST )                               \
-    do {                                                    \
-       if( ! (TEST) )                                       \
-       {                                                    \
-          mbedtls_test_fail( #TEST, __LINE__, __FILE__ );   \
-          status = PSA_ERROR_DETECTED_BY_DRIVER;            \
-          goto exit;                                        \
-       }                                                    \
-    } while( 0 )
+#define DRIVER_ASSERT(TEST)                               \
+    do {                                                  \
+        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,48 +75,42 @@
  * 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 )                  \
-    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 ) )       \
-        {                                                               \
-            mbedtls_test_fail( #expr, __LINE__, __FILE__ );                     \
-            goto exit;                                                  \
-        }                                                               \
-    } while( 0 )
-
-
+#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)) {          \
+            mbedtls_test_fail(#expr, __LINE__, __FILE__);                 \
+            goto exit;                                                    \
+        }                                                                 \
+    } while (0)
 
 /****************************************************************/
 /* Domain support functions */
 /****************************************************************/
 
 /* 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);
 }
 
-
 /****************************************************************/
 /* Miscellaneous driver methods */
 /****************************************************************/
 
-typedef struct
-{
+typedef struct {
     psa_key_slot_number_t slot_number;
     psa_key_creation_method_t method;
     psa_status_t status;
@@ -127,108 +118,103 @@
 static validate_slot_number_directions_t validate_slot_number_directions;
 
 /* Validate a choice of slot number as directed. */
-static psa_status_t validate_slot_number_as_directed(
-    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
+validate_slot_number_as_directed(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)
 {
-    (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 ;
+    (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;
 }
 
 /* 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 ;
+    (void)attributes;
+    (void)method;
+    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;
-    (void) attributes;
-    (void) data;
+    (void)context;
+    (void)slot_number;
+    (void)attributes;
+    (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;
+    (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 ;
+    (void)context;
+    (void)persistent_data;
+    (void)slot_number;
+    return PSA_SUCCESS;
 }
 
-
-
 /****************************************************************/
 /* RAM-based test driver */
 /****************************************************************/
 
 #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 +230,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,255 +245,240 @@
  * 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 ) );
+    (void)context;
+    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 ) );
+    size_t required_storage = 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 ;
+    (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;
     *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(
-        PSA_KEY_TYPE_IS_KEY_PAIR( ram_slots[slot_number].type ) );
+    (void)context;
+    DRIVER_ASSERT_RETURN(slot_number < ARRAY_LENGTH(ram_slots));
+    DRIVER_ASSERT_RETURN(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 ) )
-        {
+    (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)) {
             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(
-    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_validate_slot_number(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)
 {
-    (void) context;
-    (void) persistent_data;
-    (void) attributes;
-    (void) method;
-    if( slot_number >= ARRAY_LENGTH( ram_slots ) )
-        return PSA_ERROR_INVALID_ARGUMENT ;
-    return PSA_SUCCESS ;
+    (void)context;
+    (void)persistent_data;
+    (void)attributes;
+    (void)method;
+    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;
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_status_t status = PSA_ERROR_GENERIC_ERROR;
 
-    (void) context;
-    DRIVER_ASSERT_RETURN( slot_number < ARRAY_LENGTH( ram_slots ) );
+    (void)context;
+    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;
     mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
     psa_status_t status = PSA_ERROR_GENERIC_ERROR;
 
-    (void) context;
-    DRIVER_ASSERT_RETURN( slot_number < ARRAY_LENGTH( ram_slots ) );
+    (void)context;
+    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;
 }
 
-
 /****************************************************************/
 /* Other test helper functions */
 /****************************************************************/
@@ -521,56 +492,49 @@
 
 /* Check that the attributes of a key reported by psa_get_key_attributes()
  * 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 )
+static int
+check_key_attributes(mbedtls_svc_key_id_t key,
+                     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_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) {
             /* 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 +545,63 @@
      * 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 +609,18 @@
         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;
@@ -670,88 +632,71 @@
     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,
-                                 buffer, 32,
-                                 buffer, sizeof( buffer ), &length ) );
-    SMOKE_ASSERT( psa_verify_hash( key, PSA_ALG_ECDSA_ANY,
-                                   buffer, 32,
-                                   buffer, sizeof( buffer ) ) );
+    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)));
 
-    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 */
 
@@ -762,22 +707,22 @@
      * 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 */
@@ -788,205 +733,189 @@
  */
 
 /* 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_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);
     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 );
+        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;
@@ -994,200 +923,193 @@
     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;
@@ -1195,88 +1117,90 @@
     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;
@@ -1284,23 +1208,22 @@
     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
         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:
@@ -1311,208 +1234,191 @@
             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 )];
-            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 ) );
-            break;
-        }
+            {
+                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));
+                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_ASSERT_VIA_DRIVER(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_VIA_DRIVER(
-        psa_verify_hash( id, alg,
-                         input->x, input->len,
-                         signature, signature_length ),
-        PSA_SUCCESS );
+    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);
 
     /* 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 );
-    PSA_ASSERT_VIA_DRIVER(
-        psa_verify_hash( id, 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);
 
 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 )
-    {
-        key_management.p_validate_slot_number = validate_slot_number_as_directed;
+    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 5d3af02..d0acb16 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
@@ -6,19 +6,17 @@
 
 /** 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 ) )
+#define TEST_SE_PERSISTENT_LIFETIME                  \
+    (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,70 +85,70 @@
     /* 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;
+    (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;
-    (void) pubkey_length;
+    (void)drv_context;
+    (void)pubkey;
+    (void)pubkey_length;
 
     mock_generate_data.called++;
     mock_generate_data.key_slot = key_slot;
     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;
+    (void)drv_context;
+    (void)data;
 
     *bits = mock_import_data.bits;
 
@@ -166,56 +157,56 @@
     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;
-    (void) p_data_length;
+    (void)context;
+    (void)p_data;
+    (void)p_data_length;
 
     mock_export_data.called++;
     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;
-    (void) p_data_length;
+    (void)context;
+    (void)p_data;
+    (void)p_data_length;
 
     mock_export_public_data.called++;
     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;
-    (void) p_signature;
-    (void) p_signature_length;
+    (void)context;
+    (void)p_hash;
+    (void)p_signature;
+    (void)p_signature_length;
 
     mock_sign_data.called++;
     mock_sign_data.key_slot = key_slot;
@@ -226,17 +217,17 @@
     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;
-    (void) p_signature;
+    (void)context;
+    (void)p_hash;
+    (void)p_signature;
 
     mock_verify_data.called++;
     mock_verify_data.key_slot = key_slot;
@@ -247,35 +238,35 @@
     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;
-    (void) attributes;
-    (void) method;
-    (void) key_slot;
+    (void)drv_context;
+    (void)persistent_data;
+    (void)attributes;
+    (void)method;
+    (void)key_slot;
 
     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;
+    (void)context;
+    (void)persistent_data;
 
     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 +277,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 +295,109 @@
 
     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 +406,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 +522,51 @@
     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 +578,52 @@
     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 +635,27 @@
     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 ca54966..6c5969c 100644
--- a/tests/suites/test_suite_psa_crypto_slot_management.function
+++ b/tests/suites/test_suite_psa_crypto_slot_management.function
@@ -46,61 +46,60 @@
 /** 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 )
-    {
-        /* Closing the key invalidate only volatile keys, not persistent ones. */
+    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 +110,12 @@
  */
 
 /* 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 +124,37 @@
     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;
 #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_t key_with_invalid_owner = 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 +162,47 @@
      * 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,125 +217,118 @@
 
 #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:
         case INVALIDATE_BY_DESTROYING_WITH_SHUTDOWN:
             /*
-             * Test that the key handle and identifier are now not refering to an
-             * existing key.
+             * Test that the key handle and identifier are now not refering 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 +337,160 @@
      * 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_t returned_id = 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 +498,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 +509,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_t source_id = 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_t target_id = 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 +633,84 @@
     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 +719,18 @@
     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 +747,120 @@
              * 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;
+                key_id = MBEDTLS_SVC_KEY_ID_GET_KEY_ID(valid_handle) - 1;
 
-            invalid_handle =
-                mbedtls_svc_key_id_make( 0, key_id );
+            invalid_handle = 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;
     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 +870,17 @@
      * 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 ) );
+    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 ) ) );
+        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 +889,108 @@
      * 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 );
+    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 +998,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 76d8189..a4b918a 100644
--- a/tests/suites/test_suite_psa_crypto_storage_format.function
+++ b/tests/suites/test_suite_psa_crypto_storage_format.function
@@ -7,8 +7,8 @@
 
 #include <psa_crypto_its.h>
 
-#define TEST_FLAG_EXERCISE      0x00000001
-#define TEST_FLAG_READ_ONLY     0x00000002
+#define TEST_FLAG_EXERCISE  0x00000001
+#define TEST_FLAG_READ_ONLY 0x00000002
 
 /** Write a key with the given attributes and key material to storage.
  * Test that it has the expected representation.
@@ -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,36 +28,36 @@
     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 ;
+    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 ;
+        return 0;
 }
 
 /** Write a key with the given representation to storage, then check
@@ -66,78 +66,70 @@
  * 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 )
-    {
-        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) {
+        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 */
@@ -148,10 +140,14 @@
  */
 
 /* 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
@@ -163,40 +159,44 @@
     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. */
@@ -207,29 +207,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 79e5ccc..9b7207b 100644
--- a/tests/suites/test_suite_psa_its.function
+++ b/tests/suites/test_suite_psa_its.function
@@ -11,27 +11,25 @@
 
 /* Internal definitions of the implementation, copied for the sake of
  * some of the tests and of the cleanup code. */
-#define PSA_ITS_STORAGE_PREFIX ""
+#define PSA_ITS_STORAGE_PREFIX           ""
 #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*/ )
+#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*/)
 #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
@@ -39,7 +37,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
@@ -50,25 +48,24 @@
      * 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 */
@@ -79,7 +76,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;
@@ -87,28 +84,30 @@
     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;
@@ -117,33 +116,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;
@@ -151,58 +150,54 @@
     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;
@@ -212,31 +207,32 @@
     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;
@@ -247,41 +243,39 @@
     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 */
diff --git a/tests/suites/test_suite_random.function b/tests/suites/test_suite_random.function
index c532c8a..bbaa068 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_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,166 @@
     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_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_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_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 f5f5159..7e22d58 100644
--- a/tests/suites/test_suite_rsa.function
+++ b/tests/suites/test_suite_rsa.function
@@ -16,45 +16,40 @@
  */
 
 /* BEGIN_CASE */
-void rsa_invalid_param( )
+void rsa_invalid_param()
 {
     mbedtls_rsa_context ctx;
     const int invalid_padding = 42;
     const int invalid_hash_id = 0xff;
 
-    mbedtls_rsa_init( &ctx );
+    mbedtls_rsa_init(&ctx);
 
-    TEST_EQUAL( mbedtls_rsa_set_padding( &ctx,
-                                         invalid_padding,
-                                         MBEDTLS_MD_NONE ),
-                MBEDTLS_ERR_RSA_INVALID_PADDING );
+    TEST_EQUAL(mbedtls_rsa_set_padding(&ctx, invalid_padding, MBEDTLS_MD_NONE),
+               MBEDTLS_ERR_RSA_INVALID_PADDING);
 
-    TEST_EQUAL( mbedtls_rsa_set_padding( &ctx,
-                                         MBEDTLS_RSA_PKCS_V21,
-                                         invalid_hash_id ),
-                MBEDTLS_ERR_RSA_INVALID_PADDING );
+    TEST_EQUAL(mbedtls_rsa_set_padding(&ctx, MBEDTLS_RSA_PKCS_V21,
+                                       invalid_hash_id),
+               MBEDTLS_ERR_RSA_INVALID_PADDING);
 
 #if !defined(MBEDTLS_PKCS1_V15)
-    TEST_EQUAL( mbedtls_rsa_set_padding( &ctx,
-                                         MBEDTLS_RSA_PKCS_V15,
-                                         MBEDTLS_MD_NONE ),
-                MBEDTLS_ERR_RSA_INVALID_PADDING );
+    TEST_EQUAL(mbedtls_rsa_set_padding(&ctx, MBEDTLS_RSA_PKCS_V15,
+                                       MBEDTLS_MD_NONE),
+               MBEDTLS_ERR_RSA_INVALID_PADDING);
 #endif
 
 #if !defined(MBEDTLS_PKCS1_V21)
-    TEST_EQUAL( mbedtls_rsa_set_padding( &ctx,
-                                         MBEDTLS_RSA_PKCS_V21,
-                                         MBEDTLS_MD_NONE ),
-                MBEDTLS_ERR_RSA_INVALID_PADDING );
+    TEST_EQUAL(mbedtls_rsa_set_padding(&ctx, MBEDTLS_RSA_PKCS_V21,
+                                       MBEDTLS_MD_NONE),
+               MBEDTLS_ERR_RSA_INVALID_PADDING);
 #endif
 
 exit:
-    mbedtls_rsa_free( &ctx );
+    mbedtls_rsa_free(&ctx);
 }
 /* END_CASE */
 
 /* BEGIN_CASE */
-void rsa_init_free( int reinit )
+void rsa_init_free(int reinit)
 {
     mbedtls_rsa_context ctx;
 
@@ -63,12 +58,12 @@
      * unconditionally on an error path without checking whether it has
      * already been called in the success path. */
 
-    mbedtls_rsa_init( &ctx );
-    mbedtls_rsa_free( &ctx );
+    mbedtls_rsa_init(&ctx);
+    mbedtls_rsa_free(&ctx);
 
-    if( reinit )
-        mbedtls_rsa_init( &ctx );
-    mbedtls_rsa_free( &ctx );
+    if (reinit)
+        mbedtls_rsa_init(&ctx);
+    mbedtls_rsa_free(&ctx);
 
     /* This test case always succeeds, functionally speaking. A plausible
      * bug might trigger an invalid pointer dereference or a memory leak. */
@@ -77,273 +72,325 @@
 /* END_CASE */
 
 /* BEGIN_CASE */
-void mbedtls_rsa_pkcs1_sign( data_t * message_str, int padding_mode,
-                             int digest, int mod, int radix_P, char * input_P,
-                             int radix_Q, char * input_Q, int radix_N,
-                             char * input_N, int radix_E, 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,
+                            int radix_P,
+                            char *input_P,
+                            int radix_Q,
+                            char *input_Q,
+                            int radix_N,
+                            char *input_N,
+                            int radix_E,
+                            char *input_E,
+                            data_t *result_str,
+                            int result)
 {
     unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
-    const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type( digest );
+    const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(digest);
     unsigned char output[256];
     mbedtls_rsa_context ctx;
     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 );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx,padding_mode,
-                                          MBEDTLS_MD_NONE ) == 0 );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q);
+    mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, padding_mode, MBEDTLS_MD_NONE) ==
+                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, radix_P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, radix_Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, radix_P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, radix_Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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( md_info != NULL )
-        TEST_ASSERT( mbedtls_md( md_info, message_str->x, message_str->len, hash_result ) == 0 );
+    if (md_info != NULL)
+        TEST_ASSERT(mbedtls_md(md_info, message_str->x, message_str->len,
+                               hash_result) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_sign(
-                     &ctx, &mbedtls_test_rnd_pseudo_rand, &rnd_info,
-                     digest, mbedtls_md_get_size( md_info ), 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_rsa_pkcs1_sign(&ctx, &mbedtls_test_rnd_pseudo_rand,
+                                       &rnd_info, digest,
+                                       mbedtls_md_get_size(md_info),
+                                       hash_result, output) == result);
+    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( &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, int radix_N,
-                               char * input_N, int radix_E, 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,
+                              int radix_N,
+                              char *input_N,
+                              int radix_E,
+                              char *input_E,
+                              data_t *result_str,
+                              int result)
 {
     unsigned char hash_result[MBEDTLS_MD_MAX_SIZE];
-    const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type( digest );
+    const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(digest);
     mbedtls_rsa_context ctx;
     mbedtls_mpi N, E;
 
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &E );
-    mbedtls_rsa_init( &ctx );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx, padding_mode,
-                                          MBEDTLS_MD_NONE ) == 0 );
-    memset( hash_result, 0x00, sizeof( hash_result ) );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, padding_mode, MBEDTLS_MD_NONE) ==
+                0);
+    memset(hash_result, 0x00, sizeof(hash_result));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_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, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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( md_info != NULL )
-        TEST_ASSERT( mbedtls_md( md_info, message_str->x, message_str->len, hash_result ) == 0 );
+    if (md_info != NULL)
+        TEST_ASSERT(mbedtls_md(md_info, message_str->x, message_str->len,
+                               hash_result) == 0);
 
-    TEST_ASSERT( mbedtls_rsa_pkcs1_verify( &ctx, digest, mbedtls_md_get_size( md_info ), hash_result, result_str->x ) == result );
+    TEST_ASSERT(mbedtls_rsa_pkcs1_verify(&ctx, digest,
+                                         mbedtls_md_get_size(md_info),
+                                         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, int radix_P,
-                         char * input_P, int radix_Q, char * input_Q,
-                         int radix_N, char * input_N, int radix_E,
-                         char * input_E, data_t * result_str )
+void rsa_pkcs1_sign_raw(data_t *hash_result,
+                        int padding_mode,
+                        int mod,
+                        int radix_P,
+                        char *input_P,
+                        int radix_Q,
+                        char *input_Q,
+                        int radix_N,
+                        char *input_N,
+                        int radix_E,
+                        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 );
-    mbedtls_mpi_init( &N ); mbedtls_mpi_init( &P );
-    mbedtls_mpi_init( &Q ); mbedtls_mpi_init( &E );
+    mbedtls_rsa_init(&ctx);
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q);
+    mbedtls_mpi_init(&E);
 
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx, padding_mode,
-                                          MBEDTLS_MD_NONE ) == 0 );
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, padding_mode, MBEDTLS_MD_NONE) ==
+                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, radix_P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, radix_Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, radix_P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, radix_Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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_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_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);
 
 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, int radix_N,
-                           char * input_N, int radix_E, char * input_E,
-                           data_t * result_str, int correct )
+void rsa_pkcs1_verify_raw(data_t *hash_result,
+                          int padding_mode,
+                          int mod,
+                          int radix_N,
+                          char *input_N,
+                          int radix_E,
+                          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 );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx, padding_mode,
-                                          MBEDTLS_MD_NONE ) == 0 );
-    memset( output, 0x00, sizeof( output ) );
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, padding_mode, MBEDTLS_MD_NONE) ==
+                0);
+    memset(output, 0x00, sizeof(output));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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, MBEDTLS_MD_NONE, hash_result->len, hash_result->x, result_str->x ) == correct );
+    TEST_ASSERT(mbedtls_rsa_pkcs1_verify(&ctx, MBEDTLS_MD_NONE,
+                                         hash_result->len, hash_result->x,
+                                         result_str->x) == correct);
 
 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, int radix_N, char * input_N,
-                                int radix_E, char * input_E,
-                                data_t * result_str, int result )
+void mbedtls_rsa_pkcs1_encrypt(data_t *message_str,
+                               int padding_mode,
+                               int mod,
+                               int radix_N,
+                               char *input_N,
+                               int radix_E,
+                               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 );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx, padding_mode,
-                                          MBEDTLS_MD_NONE ) == 0 );
-    memset( output, 0x00, sizeof( output ) );
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, padding_mode, MBEDTLS_MD_NONE) ==
+                0);
+    memset(output, 0x00, sizeof(output));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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, 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_rsa_pkcs1_encrypt(&ctx, &mbedtls_test_rnd_pseudo_rand,
+                                          &rnd_info, 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);
     }
 
 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, int radix_N, char * input_N,
-                                int radix_E, char * input_E,
-                                data_t * result_str, int result )
+void rsa_pkcs1_encrypt_bad_rng(data_t *message_str,
+                               int padding_mode,
+                               int mod,
+                               int radix_N,
+                               char *input_N,
+                               int radix_E,
+                               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 );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx, padding_mode,
-                                          MBEDTLS_MD_NONE ) == 0 );
-    memset( output, 0x00, sizeof( output ) );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, padding_mode, MBEDTLS_MD_NONE) ==
+                0);
+    memset(output, 0x00, sizeof(output));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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, 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_rsa_pkcs1_encrypt(&ctx, &mbedtls_test_rnd_zero_rand,
+                                          NULL, 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);
     }
 
 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, int radix_P, char * input_P,
-                                int radix_Q, char * input_Q, int radix_N,
-                                char * input_N, int radix_E, 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,
+                               int radix_P,
+                               char *input_P,
+                               int radix_Q,
+                               char *input_Q,
+                               int radix_N,
+                               char *input_N,
+                               int radix_E,
+                               char *input_E,
+                               int max_output,
+                               data_t *result_str,
+                               int result)
 {
     unsigned char output[32];
     mbedtls_rsa_context ctx;
@@ -351,640 +398,686 @@
     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 );
-    TEST_ASSERT( mbedtls_rsa_set_padding( &ctx, padding_mode,
-                                          MBEDTLS_MD_NONE ) == 0 );
+    mbedtls_rsa_init(&ctx);
+    TEST_ASSERT(mbedtls_rsa_set_padding(&ctx, padding_mode, MBEDTLS_MD_NONE) ==
+                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, radix_P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, radix_Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_E, input_E) == 0);
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &P, radix_P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, radix_Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_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,
-                                            &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_rsa_pkcs1_decrypt(
+                    &ctx, mbedtls_test_rnd_pseudo_rand, &rnd_info, &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);
     }
 
 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, int radix_N,
-                         char * input_N, int radix_E, char * input_E,
-                         data_t * result_str, int result )
+void mbedtls_rsa_public(data_t *message_str,
+                        int mod,
+                        int radix_N,
+                        char *input_N,
+                        int radix_E,
+                        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_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_init( &ctx2 );
-    memset( output, 0x00, sizeof( output ) );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx);
+    mbedtls_rsa_init(&ctx2);
+    memset(output, 0x00, sizeof(output));
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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_test_hexcmp( output, result_str->x,
-                                          ctx.len, result_str->len ) == 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);
     }
 
     /* 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 )
-    {
-
-        TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                          ctx.len, result_str->len ) == 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);
     }
 
 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, int radix_P,
-                          char * input_P, int radix_Q, char * input_Q,
-                          int radix_N, char * input_N, int radix_E,
-                          char * input_E, data_t * result_str,
-                          int result )
+void mbedtls_rsa_private(data_t *message_str,
+                         int mod,
+                         int radix_P,
+                         char *input_P,
+                         int radix_Q,
+                         char *input_Q,
+                         int radix_N,
+                         char *input_N,
+                         int radix_E,
+                         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_rsa_context ctx, ctx2; /* Also test mbedtls_rsa_copy() while at it
+                                    */
     mbedtls_mpi N, P, Q, E;
     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_init( &ctx2 );
+    mbedtls_mpi_init(&N);
+    mbedtls_mpi_init(&P);
+    mbedtls_mpi_init(&Q);
+    mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx);
+    mbedtls_rsa_init(&ctx2);
 
-    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, radix_P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, radix_Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, radix_P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, radix_Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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 )
-        {
-
-            TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                              ctx.len,
-                                              result_str->len ) == 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);
         }
     }
 
     /* 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 )
-    {
-
-        TEST_ASSERT( mbedtls_test_hexcmp( output, result_str->x,
-                                          ctx2.len,
-                                          result_str->len ) == 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);
     }
 
 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( int radix_N, char * input_N, int radix_E,
-                               char * input_E, int result )
+void mbedtls_rsa_check_pubkey(int radix_N,
+                              char *input_N,
+                              int radix_E,
+                              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_mpi_init(&N);
+    mbedtls_mpi_init(&E);
+    mbedtls_rsa_init(&ctx);
 
-    if( strlen( input_N ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &N, radix_N, input_N ) == 0 );
+    if (strlen(input_N)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
     }
-    if( strlen( input_E ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
+    if (strlen(input_E)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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, int radix_P, char * input_P,
-                                int radix_Q, char * input_Q, int radix_N,
-                                char * input_N, int radix_E, char * input_E,
-                                int radix_D, char * input_D, int radix_DP,
-                                char * input_DP, int radix_DQ,
-                                char * input_DQ, int radix_QP,
-                                char * input_QP, int result )
+void mbedtls_rsa_check_privkey(int mod,
+                               int radix_P,
+                               char *input_P,
+                               int radix_Q,
+                               char *input_Q,
+                               int radix_N,
+                               char *input_N,
+                               int radix_E,
+                               char *input_E,
+                               int radix_D,
+                               char *input_D,
+                               int radix_DP,
+                               char *input_DP,
+                               int radix_DQ,
+                               char *input_DQ,
+                               int radix_QP,
+                               char *input_QP,
+                               int result)
 {
     mbedtls_rsa_context ctx;
 
-    mbedtls_rsa_init( &ctx );
+    mbedtls_rsa_init(&ctx);
 
     ctx.len = mod / 8;
-    if( strlen( input_P ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.P, radix_P, input_P ) == 0 );
+    if (strlen(input_P)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.P, radix_P, input_P) == 0);
     }
-    if( strlen( input_Q ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.Q, radix_Q, input_Q ) == 0 );
+    if (strlen(input_Q)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.Q, radix_Q, input_Q) == 0);
     }
-    if( strlen( input_N ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.N, radix_N, input_N ) == 0 );
+    if (strlen(input_N)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.N, radix_N, input_N) == 0);
     }
-    if( strlen( input_E ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.E, radix_E, input_E ) == 0 );
+    if (strlen(input_E)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.E, radix_E, input_E) == 0);
     }
-    if( strlen( input_D ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.D, radix_D, input_D ) == 0 );
+    if (strlen(input_D)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.D, radix_D, input_D) == 0);
     }
 #if !defined(MBEDTLS_RSA_NO_CRT)
-    if( strlen( input_DP ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.DP, radix_DP, input_DP ) == 0 );
+    if (strlen(input_DP)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.DP, radix_DP, input_DP) == 0);
     }
-    if( strlen( input_DQ ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.DQ, radix_DQ, input_DQ ) == 0 );
+    if (strlen(input_DQ)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.DQ, radix_DQ, input_DQ) == 0);
     }
-    if( strlen( input_QP ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &ctx.QP, radix_QP, input_QP ) == 0 );
+    if (strlen(input_QP)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&ctx.QP, radix_QP, input_QP) == 0);
     }
 #else
-    ((void) radix_DP); ((void) input_DP);
-    ((void) radix_DQ); ((void) input_DQ);
-    ((void) radix_QP); ((void) input_QP);
+    ((void)radix_DP);
+    ((void)input_DP);
+    ((void)radix_DQ);
+    ((void)input_DQ);
+    ((void)radix_QP);
+    ((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, int radix_Npub, char * input_Npub,
-                        int radix_Epub, char * input_Epub, int radix_P,
-                        char * input_P, int radix_Q, char * input_Q,
-                        int radix_N, char * input_N, int radix_E,
-                        char * input_E, int radix_D, char * input_D,
-                        int radix_DP, char * input_DP, int radix_DQ,
-                        char * input_DQ, int radix_QP, char * input_QP,
-                        int result )
+void rsa_check_pubpriv(int mod,
+                       int radix_Npub,
+                       char *input_Npub,
+                       int radix_Epub,
+                       char *input_Epub,
+                       int radix_P,
+                       char *input_P,
+                       int radix_Q,
+                       char *input_Q,
+                       int radix_N,
+                       char *input_N,
+                       int radix_E,
+                       char *input_E,
+                       int radix_D,
+                       char *input_D,
+                       int radix_DP,
+                       char *input_DP,
+                       int radix_DQ,
+                       char *input_DQ,
+                       int radix_QP,
+                       char *input_QP,
+                       int result)
 {
     mbedtls_rsa_context pub, prv;
 
-    mbedtls_rsa_init( &pub );
-    mbedtls_rsa_init( &prv );
+    mbedtls_rsa_init(&pub);
+    mbedtls_rsa_init(&prv);
 
     pub.len = mod / 8;
     prv.len = mod / 8;
 
-    if( strlen( input_Npub ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &pub.N, radix_Npub, input_Npub ) == 0 );
+    if (strlen(input_Npub)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&pub.N, radix_Npub, input_Npub) == 0);
     }
-    if( strlen( input_Epub ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &pub.E, radix_Epub, input_Epub ) == 0 );
+    if (strlen(input_Epub)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&pub.E, radix_Epub, input_Epub) == 0);
     }
 
-    if( strlen( input_P ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.P, radix_P, input_P ) == 0 );
+    if (strlen(input_P)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.P, radix_P, input_P) == 0);
     }
-    if( strlen( input_Q ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.Q, radix_Q, input_Q ) == 0 );
+    if (strlen(input_Q)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.Q, radix_Q, input_Q) == 0);
     }
-    if( strlen( input_N ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.N, radix_N, input_N ) == 0 );
+    if (strlen(input_N)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.N, radix_N, input_N) == 0);
     }
-    if( strlen( input_E ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.E, radix_E, input_E ) == 0 );
+    if (strlen(input_E)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.E, radix_E, input_E) == 0);
     }
-    if( strlen( input_D ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.D, radix_D, input_D ) == 0 );
+    if (strlen(input_D)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.D, radix_D, input_D) == 0);
     }
 #if !defined(MBEDTLS_RSA_NO_CRT)
-    if( strlen( input_DP ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.DP, radix_DP, input_DP ) == 0 );
+    if (strlen(input_DP)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.DP, radix_DP, input_DP) == 0);
     }
-    if( strlen( input_DQ ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.DQ, radix_DQ, input_DQ ) == 0 );
+    if (strlen(input_DQ)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.DQ, radix_DQ, input_DQ) == 0);
     }
-    if( strlen( input_QP ) )
-    {
-        TEST_ASSERT( mbedtls_test_read_mpi( &prv.QP, radix_QP, input_QP ) == 0 );
+    if (strlen(input_QP)) {
+        TEST_ASSERT(mbedtls_test_read_mpi(&prv.QP, radix_QP, input_QP) == 0);
     }
 #else
-    ((void) radix_DP); ((void) input_DP);
-    ((void) radix_DQ); ((void) input_DQ);
-    ((void) radix_QP); ((void) input_QP);
+    ((void)radix_DP);
+    ((void)input_DP);
+    ((void)radix_DQ);
+    ((void)input_DQ);
+    ((void)radix_QP);
+    ((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 );
+    mbedtls_ctr_drbg_init(&ctr_drbg);
+    mbedtls_entropy_init(&entropy);
+    mbedtls_rsa_init(&ctx);
 
-    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( int radix_N, char *input_N,
-                                int radix_D, char *input_D,
-                                int radix_E, char *input_E,
-                                int radix_P, char *output_P,
-                                int radix_Q, char *output_Q,
-                                int corrupt, int result )
+void mbedtls_rsa_deduce_primes(int radix_N,
+                               char *input_N,
+                               int radix_D,
+                               char *input_D,
+                               int radix_E,
+                               char *input_E,
+                               int radix_P,
+                               char *output_P,
+                               int radix_Q,
+                               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, radix_N, input_N ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &D, radix_D, input_D ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Qp, radix_P, output_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Pp, radix_Q, output_Q ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&D, radix_D, input_D) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_E, input_E) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Qp, radix_P, output_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Pp, radix_Q, 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( int radix_P, char *input_P,
-                                          int radix_Q, char *input_Q,
-                                          int radix_E, char *input_E,
-                                          int radix_D, char *output_D,
-                                          int corrupt, int result )
+void mbedtls_rsa_deduce_private_exponent(int radix_P,
+                                         char *input_P,
+                                         int radix_Q,
+                                         char *input_Q,
+                                         int radix_E,
+                                         char *input_E,
+                                         int radix_D,
+                                         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, radix_P, input_P ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Q, radix_Q, input_Q ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
-    TEST_ASSERT( mbedtls_test_read_mpi( &Dp, radix_D, output_D ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&P, radix_P, input_P) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Q, radix_Q, input_Q) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_E, input_E) == 0);
+    TEST_ASSERT(mbedtls_test_read_mpi(&Dp, radix_D, 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( int radix_N, char *input_N,
-                         int radix_P, char *input_P,
-                         int radix_Q, char *input_Q,
-                         int radix_D, char *input_D,
-                         int radix_E, char *input_E,
-                         int successive,
-                         int is_priv,
-                         int res_check,
-                         int res_complete )
+void mbedtls_rsa_import(int radix_N,
+                        char *input_N,
+                        int radix_P,
+                        char *input_P,
+                        int radix_Q,
+                        char *input_Q,
+                        int radix_D,
+                        char *input_D,
+                        int radix_E,
+                        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;
 
     /* Buffers used for encryption-decryption test */
     unsigned char *buf_orig = NULL;
-    unsigned char *buf_enc  = NULL;
-    unsigned char *buf_dec  = NULL;
+    unsigned char *buf_enc = NULL;
+    unsigned char *buf_dec = NULL;
 
     mbedtls_entropy_context entropy;
     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 );
+    mbedtls_ctr_drbg_init(&ctr_drbg);
+    mbedtls_entropy_init(&entropy);
+    mbedtls_rsa_init(&ctx);
 
-    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, radix_N, input_N ) == 0 );
+    if (have_N)
+        TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
 
-    if( have_P )
-        TEST_ASSERT( mbedtls_test_read_mpi( &P, radix_P, input_P ) == 0 );
+    if (have_P)
+        TEST_ASSERT(mbedtls_test_read_mpi(&P, radix_P, input_P) == 0);
 
-    if( have_Q )
-        TEST_ASSERT( mbedtls_test_read_mpi( &Q, radix_Q, input_Q ) == 0 );
+    if (have_Q)
+        TEST_ASSERT(mbedtls_test_read_mpi(&Q, radix_Q, input_Q) == 0);
 
-    if( have_D )
-        TEST_ASSERT( mbedtls_test_read_mpi( &D, radix_D, input_D ) == 0 );
+    if (have_D)
+        TEST_ASSERT(mbedtls_test_read_mpi(&D, radix_D, input_D) == 0);
 
-    if( have_E )
-        TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
+    if (have_E)
+        TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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
-    {
+    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 );
+    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 );
+            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( int radix_N, char *input_N,
-                         int radix_P, char *input_P,
-                         int radix_Q, char *input_Q,
-                         int radix_D, char *input_D,
-                         int radix_E, char *input_E,
-                         int is_priv,
-                         int successive )
+void mbedtls_rsa_export(int radix_N,
+                        char *input_N,
+                        int radix_P,
+                        char *input_P,
+                        int radix_Q,
+                        char *input_Q,
+                        int radix_D,
+                        char *input_D,
+                        int radix_E,
+                        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;
@@ -992,184 +1085,195 @@
     /* 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 );
+    mbedtls_rsa_init(&ctx);
 
-    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, radix_N, input_N ) == 0 );
+    if (have_N)
+        TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
 
-    if( have_P )
-        TEST_ASSERT( mbedtls_test_read_mpi( &P, radix_P, input_P ) == 0 );
+    if (have_P)
+        TEST_ASSERT(mbedtls_test_read_mpi(&P, radix_P, input_P) == 0);
 
-    if( have_Q )
-        TEST_ASSERT( mbedtls_test_read_mpi( &Q, radix_Q, input_Q ) == 0 );
+    if (have_Q)
+        TEST_ASSERT(mbedtls_test_read_mpi(&Q, radix_Q, input_Q) == 0);
 
-    if( have_D )
-        TEST_ASSERT( mbedtls_test_read_mpi( &D, radix_D, input_D ) == 0 );
+    if (have_D)
+        TEST_ASSERT(mbedtls_test_read_mpi(&D, radix_D, input_D) == 0);
 
-    if( have_E )
-        TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
+    if (have_E)
+        TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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 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( int radix_N, char *input_N,
-                                  int radix_P, char *input_P,
-                                  int radix_Q, char *input_Q,
-                                  int radix_D, char *input_D,
-                                  int radix_E, char *input_E,
-                                  int prng, int result )
+void mbedtls_rsa_validate_params(int radix_N,
+                                 char *input_N,
+                                 int radix_P,
+                                 char *input_P,
+                                 int radix_Q,
+                                 char *input_Q,
+                                 int radix_D,
+                                 char *input_D,
+                                 int radix_E,
+                                 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, radix_N, input_N ) == 0 );
+    if (have_N)
+        TEST_ASSERT(mbedtls_test_read_mpi(&N, radix_N, input_N) == 0);
 
-    if( have_P )
-        TEST_ASSERT( mbedtls_test_read_mpi( &P, radix_P, input_P ) == 0 );
+    if (have_P)
+        TEST_ASSERT(mbedtls_test_read_mpi(&P, radix_P, input_P) == 0);
 
-    if( have_Q )
-        TEST_ASSERT( mbedtls_test_read_mpi( &Q, radix_Q, input_Q ) == 0 );
+    if (have_Q)
+        TEST_ASSERT(mbedtls_test_read_mpi(&Q, radix_Q, input_Q) == 0);
 
-    if( have_D )
-        TEST_ASSERT( mbedtls_test_read_mpi( &D, radix_D, input_D ) == 0 );
+    if (have_D)
+        TEST_ASSERT(mbedtls_test_read_mpi(&D, radix_D, input_D) == 0);
 
-    if( have_E )
-        TEST_ASSERT( mbedtls_test_read_mpi( &E, radix_E, input_E ) == 0 );
+    if (have_E)
+        TEST_ASSERT(mbedtls_test_read_mpi(&E, radix_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];
@@ -1180,99 +1284,94 @@
 
     mbedtls_rsa_context ctx;
 
-    mbedtls_rsa_init( &ctx );
+    mbedtls_rsa_init(&ctx);
 
     /* 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 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;
-    unsigned char *buf_enc  = NULL;
-    unsigned char *buf_dec  = NULL;
+    unsigned char *buf_enc = NULL;
+    unsigned char *buf_dec = NULL;
 
     mbedtls_rsa_context ctx;
     mbedtls_entropy_context entropy;
@@ -1280,108 +1379,102 @@
 
     const char *pers = "test_suite_rsa";
 
-    mbedtls_ctr_drbg_init( &ctr_drbg );
-    mbedtls_entropy_init( &entropy );
-    mbedtls_rsa_init( &ctx );
+    mbedtls_ctr_drbg_init(&ctr_drbg);
+    mbedtls_entropy_init(&entropy);
+    mbedtls_rsa_init(&ctx);
 
-    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 );
+    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 );
+            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 95d45ba..86dc41b 100644
--- a/tests/suites/test_suite_shax.function
+++ b/tests/suites/test_suite_shax.function
@@ -5,34 +5,32 @@
 /* END_HEADER */
 
 /* 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(src_str->x, src_str->len, output) == 0);
 
-    TEST_ASSERT( mbedtls_sha1( 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:NOT_DEFINED */
-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_EQUAL( MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
-                            mbedtls_sha256_starts( &ctx, invalid_type ) );
+    TEST_EQUAL(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
+               mbedtls_sha256_starts(&ctx, invalid_type));
 
-    TEST_EQUAL( MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
-                            mbedtls_sha256( buf, buflen,
-                                                buf, invalid_type ) );
+    TEST_EQUAL(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA,
+               mbedtls_sha256(buf, buflen, buf, invalid_type));
 
 exit:
     return;
@@ -40,48 +38,45 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA224_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(src_str->x, src_str->len, output, 1) == 0);
 
-    TEST_ASSERT( mbedtls_sha256( 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(src_str->x, src_str->len, output, 0) == 0);
 
-    TEST_ASSERT( mbedtls_sha256( 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:NOT_DEFINED */
-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_EQUAL( MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
-                            mbedtls_sha512_starts( &ctx, invalid_type ) );
+    TEST_EQUAL(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
+               mbedtls_sha512_starts(&ctx, invalid_type));
 
-    TEST_EQUAL( MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
-                            mbedtls_sha512( buf, buflen,
-                                                buf, invalid_type ) );
+    TEST_EQUAL(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA,
+               mbedtls_sha512(buf, buflen, buf, invalid_type));
 
 exit:
     return;
@@ -89,50 +84,48 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SHA384_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(src_str->x, src_str->len, output, 1) == 0);
 
-    TEST_ASSERT( mbedtls_sha512( 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(src_str->x, src_str->len, output, 0) == 0);
 
-    TEST_ASSERT( mbedtls_sha512( 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 b24e131..2729a27 100644
--- a/tests/suites/test_suite_ssl.function
+++ b/tests/suites/test_suite_ssl.function
@@ -16,14 +16,12 @@
 
 enum
 {
-#define MBEDTLS_SSL_TLS1_3_LABEL( name, string )   \
-     tls1_3_label_ ## name,
-MBEDTLS_SSL_TLS1_3_LABEL_LIST
+#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;
@@ -33,29 +31,28 @@
  * 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;
+    log_pattern *p = (log_pattern *)ctx;
 
-    (void) level;
-    (void) line;
-    (void) file;
+    (void)level;
+    (void)line;
+    (void)file;
 
-    if( NULL != p &&
-        NULL != p->pattern &&
-        NULL != strstr( str, p->pattern ) )
-    {
+    if (NULL != p && NULL != p->pattern && NULL != strstr(str, p->pattern)) {
         p->counter++;
     }
 }
 
-/* Invalid minor version used when not specifying a min/max version or expecting a test to fail */
+/* 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;
@@ -81,38 +78,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;
@@ -123,32 +119,32 @@
  * 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));
 }
 
 /*
@@ -162,49 +158,42 @@
  * \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;
@@ -223,35 +212,34 @@
  * \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;
 }
@@ -259,14 +247,14 @@
 /*
  * Errors used in the message transport mock tests
  */
- #define MBEDTLS_TEST_ERROR_ARG_NULL -11
- #define MBEDTLS_TEST_ERROR_MESSAGE_TRUNCATED -44
+#define MBEDTLS_TEST_ERROR_ARG_NULL          -11
+#define MBEDTLS_TEST_ERROR_MESSAGE_TRUNCATED -44
 
 /*
- * Context for a message metadata queue (fifo) that is on top of the ring buffer.
+ * 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;
@@ -282,11 +270,11 @@
  * \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;
@@ -296,15 +284,15 @@
     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));
 }
 
 /*
@@ -315,17 +303,17 @@
  * \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;
@@ -341,13 +329,13 @@
  * \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];
@@ -355,10 +343,10 @@
     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;
 }
 
 /*
@@ -373,16 +361,17 @@
  *          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.
@@ -390,8 +379,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;
@@ -401,9 +389,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));
 }
 
 /*
@@ -419,27 +407,25 @@
  * 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->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->output != NULL) {
+        mbedtls_test_buffer_free(socket->output);
+        mbedtls_free(socket->output);
     }
 
-    if( socket->peer != NULL )
-        memset( socket->peer, 0, sizeof( *socket->peer ) );
+    if (socket->peer != NULL)
+        memset(socket->peer, 0, sizeof(*socket->peer));
 
-    memset( socket, 0, sizeof( *socket ) );
+    memset(socket, 0, sizeof(*socket));
 }
 
 /*
@@ -452,35 +438,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;
     }
 
@@ -494,10 +476,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;
@@ -507,65 +488,63 @@
  * 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 */
 
 #define MBEDTLS_TEST_ERROR_CONTEXT_ERROR -55
-#define MBEDTLS_TEST_ERROR_SEND_FAILED -66
-#define MBEDTLS_TEST_ERROR_RECV_FAILED -77
+#define MBEDTLS_TEST_ERROR_SEND_FAILED   -66
+#define MBEDTLS_TEST_ERROR_RECV_FAILED   -77
 
 /*
  * Structure used as an addon, or a wrapper, around the mocked sockets.
@@ -574,14 +553,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;
@@ -597,19 +575,19 @@
  * \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;
 }
@@ -618,14 +596,14 @@
  * 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));
 }
 
 /*
@@ -640,28 +618,28 @@
  * 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,20 +652,21 @@
  * \retval  MBEDTLS_TEST_ERROR_RECV_FAILED if mbedtls_mock_tcp_recv_b failed.
  *
  * This function will also return any error other than
- * MBEDTLS_TEST_ERROR_MESSAGE_TRUNCATED from mbedtls_test_message_queue_peek_info.
+ * 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;
     }
 
@@ -696,46 +675,40 @@
 
     /* 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;
 }
 
-#if defined(MBEDTLS_X509_CRT_PARSE_C) && \
-    defined(MBEDTLS_ENTROPY_C) && \
+#if defined(MBEDTLS_X509_CRT_PARSE_C) && defined(MBEDTLS_ENTROPY_C) && \
     defined(MBEDTLS_CTR_DRBG_C)
 
 /*
  * Structure with endpoint's certificates for SSL communication tests.
  */
-typedef struct mbedtls_endpoint_certificate
-{
+typedef struct mbedtls_endpoint_certificate {
     mbedtls_x509_crt ca_cert;
     mbedtls_x509_crt cert;
     mbedtls_pk_context pkey;
@@ -744,8 +717,7 @@
 /*
  * 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;
@@ -761,113 +733,108 @@
  *
  * \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;
 
-    if( ep == NULL )
-    {
+    if (ep == NULL) {
         return MBEDTLS_ERR_SSL_BAD_INPUT_DATA;
     }
 
-    cert = &( ep->cert );
-    mbedtls_x509_crt_init( &( cert->ca_cert ) );
-    mbedtls_x509_crt_init( &( cert->cert ) );
-    mbedtls_pk_init( &( cert->pkey ) );
+    cert = &(ep->cert);
+    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,
-                            mbedtls_test_rnd_std_rand, NULL );
-            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,
+                mbedtls_test_rnd_std_rand, NULL);
+            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,
+                mbedtls_test_rnd_std_rand, NULL);
+            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,
-                            mbedtls_test_rnd_std_rand, NULL );
-            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,
+                mbedtls_test_rnd_std_rand, NULL);
+            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,
-                          mbedtls_test_rnd_std_rand, NULL );
-            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,
-                          mbedtls_test_rnd_std_rand, NULL );
-            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,
+                mbedtls_test_rnd_std_rand, NULL);
+            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_x509_crt_free( &( cert->ca_cert ) );
-        mbedtls_x509_crt_free( &( cert->cert ) );
-        mbedtls_pk_free( &( cert->pkey ) );
+    if (ret != 0) {
+        mbedtls_x509_crt_free(&(cert->ca_cert));
+        mbedtls_x509_crt_free(&(cert->cert));
+        mbedtls_pk_free(&(cert->pkey));
     }
 
     return ret;
 }
 
 /*
- * Initializes \p ep structure. It is important to call `mbedtls_endpoint_free()`
- * after calling this function even if it fails.
+ * Initializes \p ep structure. It is important to call
+ * `mbedtls_endpoint_free()` after calling this function even if it fails.
  *
  * \p endpoint_type must be set as MBEDTLS_SSL_IS_SERVER or
  * MBEDTLS_SSL_IS_CLIENT.
@@ -879,79 +846,70 @@
  *
  * \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 )
+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)
 {
     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 )
+    if (ep == NULL)
         return MBEDTLS_ERR_SSL_BAD_INPUT_DATA;
 
-    memset( ep, 0, sizeof( *ep ) );
+    memset(ep, 0, sizeof(*ep));
 
-    ep->name = ( endpoint_type == MBEDTLS_SSL_IS_SERVER ) ? "Server" : "Client";
+    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 ) );
+    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 );
+    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);
 
-    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 );
-#endif
+#    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);
+#    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;
@@ -960,34 +918,31 @@
 /*
  * 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 );
-    mbedtls_x509_crt_free( &( cert->ca_cert ) );
-    mbedtls_x509_crt_free( &( cert->cert ) );
-    mbedtls_pk_free( &( cert->pkey ) );
+    mbedtls_endpoint_certificate *cert = &(ep->cert);
+    mbedtls_x509_crt_free(&(cert->ca_cert));
+    mbedtls_x509_crt_free(&(cert->cert));
+    mbedtls_pk_free(&(cert->pkey));
 }
 
 /*
  * 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));
     }
 }
 
@@ -998,84 +953,78 @@
  *
  * \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 };
+    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_X509_CRT_PARSE_C && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C */
+#endif /* MBEDTLS_X509_CRT_PARSE_C && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C \
+        */
 
 /*
  * 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;
@@ -1086,35 +1035,32 @@
 }
 
 /*
- * Read application data and increase read counter and fragments counter if necessary.
+ * 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;
@@ -1130,68 +1076,69 @@
  * and version.
  */
 
-#define CHK( x )                                \
-    do                                          \
-    {                                           \
-        if( !( x ) )                            \
-        {                                       \
-            ret = -1;                           \
-            goto cleanup;                       \
-        }                                       \
-    } while( 0 )
+#define CHK(x)            \
+    do {                  \
+        if (!(x)) {       \
+            ret = -1;     \
+            goto cleanup; \
+        }                 \
+    } 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] );
+    ciphersuite_info = 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;
+    (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
-#define SSL_CID_LEN_MIN MBEDTLS_SSL_CID_IN_LEN_MAX
+#    define SSL_CID_LEN_MIN MBEDTLS_SSL_CID_IN_LEN_MAX
 #else
-#define SSL_CID_LEN_MIN MBEDTLS_SSL_CID_OUT_LEN_MAX
+#    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;
@@ -1202,105 +1149,98 @@
     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);
+    ((void)cid0_len);
+    ((void)cid1_len);
 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
 
     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_SUITES_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);
 
-        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 );
+        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);
     }
 #else
-    ((void) hash_id);
+    ((void)hash_id);
 #endif /* MBEDTLS_SSL_SOME_SUITES_USE_MAC */
 
-
     /* 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
@@ -1311,7 +1251,7 @@
     t_out->encrypt_then_mac = etm;
     t_in->encrypt_then_mac = etm;
 #else
-    ((void) etm);
+    ((void)etm);
 #endif
 
     t_out->minor_ver = ver;
@@ -1319,17 +1259,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
+                t_in->fixed_ivlen = 12;
+            } else
 #endif /* MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
             {
                 t_out->fixed_ivlen = 4;
@@ -1337,8 +1274,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;
@@ -1358,8 +1294,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;
@@ -1377,11 +1312,10 @@
         case MBEDTLS_MODE_STREAM:
         case MBEDTLS_MODE_CBC:
             t_out->fixed_ivlen = 0; /* redundant, must be 0 */
-            t_in->fixed_ivlen = 0;  /* redundant, must be 0 */
+            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;
@@ -1403,107 +1337,102 @@
 
     /* 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_tls12( mbedtls_ssl_session *session,
-                                       int ticket_len,
-                                       const char *crt_file )
+static int ssl_populate_session_tls12(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->minor_ver = MBEDTLS_SSL_MINOR_VERSION_3;
     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_X509_CRT_PARSE_C) && defined(MBEDTLS_FS_IO)
-    if( crt_file != NULL && strlen( crt_file ) != 0 )
-    {
+    if (crt_file != NULL && 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)
+#    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 ) );
-#else /* MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
+        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 ;
-        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_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_X509_CRT_PARSE_C && MBEDTLS_FS_IO */
-    (void) crt_file;
+    (void)crt_file;
 #endif /* MBEDTLS_X509_CRT_PARSE_C && MBEDTLS_FS_IO */
     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;
 #else
-    (void) ticket_len;
+    (void)ticket_len;
 #endif
 
 #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
@@ -1513,7 +1442,7 @@
     session->encrypt_then_mac = 1;
 #endif
 
-    return 0 ;
+    return 0;
 }
 
 /*
@@ -1536,22 +1465,23 @@
  *
  * \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;
@@ -1559,99 +1489,81 @@
         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;
 }
@@ -1662,385 +1574,343 @@
  *
  * \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_X509_CRT_PARSE_C) && \
-    defined(MBEDTLS_ENTROPY_C) && \
+#if defined(MBEDTLS_X509_CRT_PARSE_C) && 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];
-    enum { BUFFSIZE = 17000 };
+    enum
+    {
+        BUFFSIZE = 17000
+    };
     mbedtls_endpoint client, server;
-#if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
+#    if defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
     const char *psk_identity = "foo";
-#endif
-#if defined(MBEDTLS_TIMING_C)
+#    endif
+#    if defined(MBEDTLS_TIMING_C)
     mbedtls_timing_delay_context timer_client, timer_server;
-#endif
-#if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION)
+#    endif
+#    if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION)
     unsigned char *context_buf = NULL;
     size_t context_buf_len;
-#endif
-#if defined(MBEDTLS_SSL_RENEGOTIATION)
+#    endif
+#    if defined(MBEDTLS_SSL_RENEGOTIATION)
     int ret = -1;
-#endif
+#    endif
     int expected_handshake_result = 0;
 
     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 ) == 0 );
-#if defined(MBEDTLS_TIMING_C)
-        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 ) == 0 );
+    if (options->dtls != 0) {
+        TEST_ASSERT(mbedtls_endpoint_init(&client, MBEDTLS_SSL_IS_CLIENT,
+                                          options->pk_alg, &client_context,
+                                          &client_queue, &server_queue) == 0);
+#    if defined(MBEDTLS_TIMING_C)
+        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) == 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
+#    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) == 0 );
-#if defined(MBEDTLS_TIMING_C)
-        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 ) == 0 );
+    if (options->dtls != 0) {
+        TEST_ASSERT(mbedtls_endpoint_init(&server, MBEDTLS_SSL_IS_SERVER,
+                                          options->pk_alg, &server_context,
+                                          &server_queue, &client_queue) == 0);
+#    if defined(MBEDTLS_TIMING_C)
+        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) == 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 );
-#else
-    TEST_ASSERT( MBEDTLS_SSL_MAX_FRAG_LEN_NONE == options->mfl );
-#endif /* MBEDTLS_SSL_MAX_FRAGMENT_LENGTH */
+#    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);
+#    else
+    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 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);
 
-        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 );
+#    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);
 
-        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 */
+#    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
+#    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 defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
+    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
+#    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_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 defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
+    if (options->resize_buffers != 0) {
         /* 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
+#    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 defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION)
+    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 );
-#endif
-#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
-        if( options->resize_buffers != 0 )
-        {
+#        if defined(MBEDTLS_TIMING_C)
+        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) {
             /* 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 );
+#        endif
+        TEST_ASSERT(mbedtls_ssl_context_load(&(server.ssl), context_buf,
+                                             context_buf_len) == 0);
 
-#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
+#        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
+#        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 */
+#    endif /* MBEDTLS_SSL_CONTEXT_SERIALIZATION */
 
-#if defined(MBEDTLS_SSL_RENEGOTIATION)
-    if( options->renegotiate )
-    {
+#    if defined(MBEDTLS_SSL_RENEGOTIATION)
+    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 betwen 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) );
-#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
-        if( options->resize_buffers != 0 )
-        {
+        /* After calling mbedtls_ssl_renegotiate for the client all
+         * renegotiation should happen inside this function. However in this
+         * test, we cannot perform simultaneous communication betwen 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));
+#        if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
+        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 );
+#        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( 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)
+        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_VARIABLE_BUFFER_LENGTH */
     }
-#endif /* MBEDTLS_SSL_RENEGOTIATION */
+#    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 );
-#endif
+#    endif
+#    if defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION)
+    if (context_buf != NULL)
+        mbedtls_free(context_buf);
+#    endif
 }
-#endif /* MBEDTLS_X509_CRT_PARSE_C && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C */
+#endif /* MBEDTLS_X509_CRT_PARSE_C && MBEDTLS_ENTROPY_C && MBEDTLS_CTR_DRBG_C \
+        */
 
 /* END_HEADER */
 
@@ -2052,61 +1922,59 @@
 /* BEGIN_CASE */
 void test_callback_buffer_sanity()
 {
-    enum { MSGLEN = 10 };
+    enum
+    {
+        MSGLEN = 10
+    };
     mbedtls_test_buffer buf;
     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 eror. */
-    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 */
 
@@ -2124,106 +1992,107 @@
  */
 
 /* 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 };
+    enum
+    {
+        ROUNDS = 2
+    };
     size_t put[ROUNDS];
     int put_ret[ROUNDS];
     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 */
 
@@ -2233,30 +2102,33 @@
  */
 
 /* BEGIN_CASE */
-void ssl_mock_sanity( )
+void ssl_mock_sanity()
 {
-    enum { MSGLEN = 105 };
+    enum
+    {
+        MSGLEN = 105
+    };
     unsigned char message[MSGLEN];
     unsigned char received[MSGLEN];
     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 */
 
@@ -2266,10 +2138,16 @@
  */
 
 /* BEGIN_CASE */
-void ssl_mock_tcp( int blocking )
+void ssl_mock_tcp(int blocking)
 {
-    enum { MSGLEN = 105 };
-    enum { BUFLEN = MSGLEN / 5 };
+    enum
+    {
+        MSGLEN = 105
+    };
+    enum
+    {
+        BUFLEN = MSGLEN / 5
+    };
     unsigned char message[MSGLEN];
     unsigned char received[MSGLEN];
     mbedtls_mock_socket client;
@@ -2280,94 +2158,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 */
 
@@ -2378,11 +2238,20 @@
  */
 
 /* BEGIN_CASE */
-void ssl_mock_tcp_interleaving( int blocking )
+void ssl_mock_tcp_interleaving(int blocking)
 {
-    enum { ROUNDS = 2 };
-    enum { MSGLEN = 105 };
-    enum { BUFLEN = MSGLEN / 5 };
+    enum
+    {
+        ROUNDS = 2
+    };
+    enum
+    {
+        MSGLEN = 105
+    };
+    enum
+    {
+        BUFLEN = MSGLEN / 5
+    };
     unsigned char message[ROUNDS][MSGLEN];
     unsigned char received[ROUNDS][MSGLEN];
     mbedtls_mock_socket client;
@@ -2395,773 +2264,739 @@
     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];
+    enum
+    {
+        MSGLEN = 10
+    };
+    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 };
+    enum
+    {
+        MSGLEN = 10
+    };
     unsigned char message[MSGLEN], received[MSGLEN];
     mbedtls_mock_socket client, server;
     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 };
+    enum
+    {
+        MSGLEN = 10
+    };
     unsigned char message[MSGLEN], received[MSGLEN];
     mbedtls_mock_socket client, server;
     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 };
+    enum
+    {
+        MSGLEN = 10
+    };
     unsigned char message[MSGLEN], received[MSGLEN];
     mbedtls_mock_socket client, server;
     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 };
+    enum
+    {
+        MSGLEN = 10
+    };
     unsigned char message[MSGLEN], received[MSGLEN];
     mbedtls_mock_socket client, server;
     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 );
+    /* 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);
     /* 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 };
+    enum
+    {
+        MSGLEN = 10
+    };
     unsigned char message[MSGLEN], received[MSGLEN];
     mbedtls_mock_socket client, server;
     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 };
+    enum
+    {
+        MSGLEN = 10
+    };
     unsigned char message[MSGLEN], received[MSGLEN];
     mbedtls_mock_socket client, server;
     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 };
+    enum
+    {
+        MSGLEN = 10
+    };
     unsigned char message[MSGLEN], received[MSGLEN];
     mbedtls_mock_socket client, server;
     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_X509_CRT_PARSE_C */
-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
@@ -3178,27 +3013,21 @@
     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;
         }
@@ -3215,86 +3044,87 @@
          * type is sensible.
          */
 
-        memset( rec.ctr, num_records, sizeof( rec.ctr ) );
-        rec.type    = 42;
-        rec.ver[0]  = num_records;
-        rec.ver[1]  = num_records;
+        memset(rec.ctr, num_records, sizeof(rec.ctr));
+        rec.type = 42;
+        rec.ver[0] = num_records;
+        rec.ver[1] = num_records;
 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
         rec.cid_len = 0;
 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
 
-        rec.buf     = buf;
+        rec.buf = buf;
         rec.buf_len = buflen;
         rec.data_offset = 16;
         /* Make sure to vary the length to exercise different
          * 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
@@ -3324,47 +3154,42 @@
     mbedtls_record rec, rec_backup;
 
     int ret;
-    int mode;              /* Mode 1, 2 or 3 as explained above     */
-    size_t offset;         /* Available space at beginning/end/both */
+    int mode; /* Mode 1, 2 or 3 as explained above     */
+    size_t offset; /* Available space at beginning/end/both */
     size_t threshold = 96; /* Maximum offset to test against        */
 
-    size_t default_pre_padding  = 64;  /* Pre-padding to use in mode 2  */
+    size_t default_pre_padding = 64; /* Pre-padding to use in mode 2  */
     size_t default_post_padding = 128; /* Post-padding to use in mode 1 */
 
     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 ) );
-            rec.type    = 42;
-            rec.ver[0]  = offset;
-            rec.ver[1]  = offset;
-            rec.buf     = buf;
+            memset(rec.ctr, offset, sizeof(rec.ctr));
+            rec.type = 42;
+            rec.ver[0] = offset;
+            rec.ver[1] = offset;
+            rec.buf = buf;
             rec.buf_len = buflen;
 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
             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;
@@ -3381,85 +3206,83 @@
                     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
@@ -3489,138 +3312,127 @@
     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 );
+    buflen = block_size + 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 ) );
-    rec.type    = MBEDTLS_SSL_MSG_APPLICATION_DATA;
-    rec.ver[0]  = MBEDTLS_SSL_MAJOR_VERSION_3;
-    rec.ver[1]  = MBEDTLS_SSL_MINOR_VERSION_3;
+    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;
 #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
     rec.cid_len = 0;
 #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
 
     /* Prepare dummy record content */
-    rec.buf     = buf;
+    rec.buf = buf;
     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;
+    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;
+        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));
     }
 
     /*
@@ -3635,364 +3447,336 @@
      * (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;
+        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 )                      \
-    {                                                                   \
-        lbl = mbedtls_ssl_tls1_3_labels.name;                           \
-        lbl_len = sizeof( mbedtls_ssl_tls1_3_labels.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); \
     }
-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 )                      \
-    {                                                                   \
-        lbl = mbedtls_ssl_tls1_3_labels.name;                           \
-        lbl_len = sizeof( mbedtls_ssl_tls1_3_labels.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); \
     }
-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_derive_early_secrets( int hash_alg,
-                                      data_t *secret,
-                                      data_t *transcript,
-                                      data_t *traffic_expected,
-                                      data_t *exporter_expected )
+void ssl_tls1_3_derive_early_secrets(int hash_alg,
+                                     data_t *secret,
+                                     data_t *transcript,
+                                     data_t *traffic_expected,
+                                     data_t *exporter_expected)
 {
     mbedtls_ssl_tls1_3_early_secrets secrets;
 
     /* Double-check that we've passed sane parameters. */
-    mbedtls_md_type_t md_type = (mbedtls_md_type_t) hash_alg;
-    mbedtls_md_info_t const * const md_info = mbedtls_md_info_from_type( md_type );
-    size_t const md_size = mbedtls_md_get_size( md_info );
-    TEST_ASSERT( md_info != 0                      &&
-                 secret->len == md_size            &&
-                 transcript->len == md_size        &&
-                 traffic_expected->len == md_size  &&
-                 exporter_expected->len == md_size );
+    mbedtls_md_type_t md_type = (mbedtls_md_type_t)hash_alg;
+    mbedtls_md_info_t const *const md_info = mbedtls_md_info_from_type(md_type);
+    size_t const md_size = mbedtls_md_get_size(md_info);
+    TEST_ASSERT(
+        md_info != 0 && secret->len == md_size && transcript->len == md_size &&
+        traffic_expected->len == md_size && exporter_expected->len == md_size);
 
-    TEST_ASSERT( mbedtls_ssl_tls1_3_derive_early_secrets(
-                     md_type, secret->x, transcript->x, transcript->len,
-                     &secrets ) == 0 );
+    TEST_ASSERT(
+        mbedtls_ssl_tls1_3_derive_early_secrets(
+            md_type, secret->x, transcript->x, transcript->len, &secrets) == 0);
 
-    ASSERT_COMPARE( secrets.client_early_traffic_secret, md_size,
-                    traffic_expected->x, traffic_expected->len );
-    ASSERT_COMPARE( secrets.early_exporter_master_secret, md_size,
-                    exporter_expected->x, exporter_expected->len );
+    ASSERT_COMPARE(secrets.client_early_traffic_secret, md_size,
+                   traffic_expected->x, traffic_expected->len);
+    ASSERT_COMPARE(secrets.early_exporter_master_secret, md_size,
+                   exporter_expected->x, exporter_expected->len);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
-void ssl_tls1_3_derive_handshake_secrets( int hash_alg,
-                                          data_t *secret,
-                                          data_t *transcript,
-                                          data_t *client_expected,
-                                          data_t *server_expected )
+void ssl_tls1_3_derive_handshake_secrets(int hash_alg,
+                                         data_t *secret,
+                                         data_t *transcript,
+                                         data_t *client_expected,
+                                         data_t *server_expected)
 {
     mbedtls_ssl_tls1_3_handshake_secrets secrets;
 
     /* Double-check that we've passed sane parameters. */
-    mbedtls_md_type_t md_type = (mbedtls_md_type_t) hash_alg;
-    mbedtls_md_info_t const * const md_info = mbedtls_md_info_from_type( md_type );
-    size_t const md_size = mbedtls_md_get_size( md_info );
-    TEST_ASSERT( md_info != 0                      &&
-                 secret->len == md_size            &&
-                 transcript->len == md_size        &&
-                 client_expected->len == md_size   &&
-                 server_expected->len == md_size );
+    mbedtls_md_type_t md_type = (mbedtls_md_type_t)hash_alg;
+    mbedtls_md_info_t const *const md_info = mbedtls_md_info_from_type(md_type);
+    size_t const md_size = mbedtls_md_get_size(md_info);
+    TEST_ASSERT(md_info != 0 && secret->len == md_size &&
+                transcript->len == md_size && client_expected->len == md_size &&
+                server_expected->len == md_size);
 
-    TEST_ASSERT( mbedtls_ssl_tls1_3_derive_handshake_secrets(
-                     md_type, secret->x, transcript->x, transcript->len,
-                     &secrets ) == 0 );
+    TEST_ASSERT(
+        mbedtls_ssl_tls1_3_derive_handshake_secrets(
+            md_type, secret->x, transcript->x, transcript->len, &secrets) == 0);
 
-    ASSERT_COMPARE( secrets.client_handshake_traffic_secret, md_size,
-                    client_expected->x, client_expected->len );
-    ASSERT_COMPARE( secrets.server_handshake_traffic_secret, md_size,
-                    server_expected->x, server_expected->len );
+    ASSERT_COMPARE(secrets.client_handshake_traffic_secret, md_size,
+                   client_expected->x, client_expected->len);
+    ASSERT_COMPARE(secrets.server_handshake_traffic_secret, md_size,
+                   server_expected->x, server_expected->len);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
-void ssl_tls1_3_derive_application_secrets( int hash_alg,
-                                          data_t *secret,
-                                          data_t *transcript,
-                                          data_t *client_expected,
-                                          data_t *server_expected,
-                                          data_t *exporter_expected )
-{
-    mbedtls_ssl_tls1_3_application_secrets secrets;
-
-    /* Double-check that we've passed sane parameters. */
-    mbedtls_md_type_t md_type = (mbedtls_md_type_t) hash_alg;
-    mbedtls_md_info_t const * const md_info = mbedtls_md_info_from_type( md_type );
-    size_t const md_size = mbedtls_md_get_size( md_info );
-    TEST_ASSERT( md_info != 0                      &&
-                 secret->len == md_size            &&
-                 transcript->len == md_size        &&
-                 client_expected->len == md_size   &&
-                 server_expected->len == md_size   &&
-                 exporter_expected->len == md_size );
-
-    TEST_ASSERT( mbedtls_ssl_tls1_3_derive_application_secrets(
-                     md_type, secret->x, transcript->x, transcript->len,
-                     &secrets ) == 0 );
-
-    ASSERT_COMPARE( secrets.client_application_traffic_secret_N, md_size,
-                    client_expected->x, client_expected->len );
-    ASSERT_COMPARE( secrets.server_application_traffic_secret_N, md_size,
-                    server_expected->x, server_expected->len );
-    ASSERT_COMPARE( secrets.exporter_master_secret, md_size,
-                    exporter_expected->x, exporter_expected->len );
-}
-/* END_CASE */
-
-/* BEGIN_CASE depends_on:MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
-void ssl_tls1_3_derive_resumption_secrets( int hash_alg,
+void ssl_tls1_3_derive_application_secrets(int hash_alg,
                                            data_t *secret,
                                            data_t *transcript,
-                                           data_t *resumption_expected )
+                                           data_t *client_expected,
+                                           data_t *server_expected,
+                                           data_t *exporter_expected)
 {
     mbedtls_ssl_tls1_3_application_secrets secrets;
 
     /* Double-check that we've passed sane parameters. */
-    mbedtls_md_type_t md_type = (mbedtls_md_type_t) hash_alg;
-    mbedtls_md_info_t const * const md_info = mbedtls_md_info_from_type( md_type );
-    size_t const md_size = mbedtls_md_get_size( md_info );
-    TEST_ASSERT( md_info != 0                        &&
-                 secret->len == md_size              &&
-                 transcript->len == md_size          &&
-                 resumption_expected->len == md_size );
+    mbedtls_md_type_t md_type = (mbedtls_md_type_t)hash_alg;
+    mbedtls_md_info_t const *const md_info = mbedtls_md_info_from_type(md_type);
+    size_t const md_size = mbedtls_md_get_size(md_info);
+    TEST_ASSERT(md_info != 0 && secret->len == md_size &&
+                transcript->len == md_size && client_expected->len == md_size &&
+                server_expected->len == md_size &&
+                exporter_expected->len == md_size);
 
-    TEST_ASSERT( mbedtls_ssl_tls1_3_derive_resumption_master_secret(
-                     md_type, secret->x, transcript->x, transcript->len,
-                     &secrets ) == 0 );
+    TEST_ASSERT(
+        mbedtls_ssl_tls1_3_derive_application_secrets(
+            md_type, secret->x, transcript->x, transcript->len, &secrets) == 0);
 
-    ASSERT_COMPARE( secrets.resumption_master_secret, md_size,
-                    resumption_expected->x, resumption_expected->len );
+    ASSERT_COMPARE(secrets.client_application_traffic_secret_N, md_size,
+                   client_expected->x, client_expected->len);
+    ASSERT_COMPARE(secrets.server_application_traffic_secret_N, md_size,
+                   server_expected->x, server_expected->len);
+    ASSERT_COMPARE(secrets.exporter_master_secret, md_size,
+                   exporter_expected->x, exporter_expected->len);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */
-void ssl_tls1_3_create_psk_binder( int hash_alg,
-                                   data_t *psk,
-                                   int psk_type,
-                                   data_t *transcript,
-                                   data_t *binder_expected )
+void ssl_tls1_3_derive_resumption_secrets(int hash_alg,
+                                          data_t *secret,
+                                          data_t *transcript,
+                                          data_t *resumption_expected)
 {
-    unsigned char binder[ MBEDTLS_MD_MAX_SIZE ];
+    mbedtls_ssl_tls1_3_application_secrets secrets;
 
     /* Double-check that we've passed sane parameters. */
-    mbedtls_md_type_t md_type = (mbedtls_md_type_t) hash_alg;
-    mbedtls_md_info_t const * const md_info = mbedtls_md_info_from_type( md_type );
-    size_t const md_size = mbedtls_md_get_size( md_info );
-    TEST_ASSERT( md_info != 0                    &&
-                 transcript->len == md_size      &&
-                 binder_expected->len == md_size );
+    mbedtls_md_type_t md_type = (mbedtls_md_type_t)hash_alg;
+    mbedtls_md_info_t const *const md_info = mbedtls_md_info_from_type(md_type);
+    size_t const md_size = mbedtls_md_get_size(md_info);
+    TEST_ASSERT(md_info != 0 && secret->len == md_size &&
+                transcript->len == md_size &&
+                resumption_expected->len == md_size);
 
-    TEST_ASSERT( mbedtls_ssl_tls1_3_create_psk_binder(
-                     NULL, /* SSL context for debugging only */
-                     md_type,
-                     psk->x, psk->len,
-                     psk_type,
-                     transcript->x,
-                     binder ) == 0 );
+    TEST_ASSERT(
+        mbedtls_ssl_tls1_3_derive_resumption_master_secret(
+            md_type, secret->x, transcript->x, transcript->len, &secrets) == 0);
 
-    ASSERT_COMPARE( binder, md_size,
-                    binder_expected->x, binder_expected->len );
+    ASSERT_COMPARE(secrets.resumption_master_secret, md_size,
+                   resumption_expected->x, resumption_expected->len);
 }
 /* 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_create_psk_binder(int hash_alg,
+                                  data_t *psk,
+                                  int psk_type,
+                                  data_t *transcript,
+                                  data_t *binder_expected)
 {
-    unsigned char secret_new[ MBEDTLS_MD_MAX_SIZE ];
+    unsigned char binder[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 );
+    /* Double-check that we've passed sane parameters. */
+    mbedtls_md_type_t md_type = (mbedtls_md_type_t)hash_alg;
+    mbedtls_md_info_t const *const md_info = mbedtls_md_info_from_type(md_type);
+    size_t const md_size = mbedtls_md_get_size(md_info);
+    TEST_ASSERT(md_info != 0 && transcript->len == md_size &&
+                binder_expected->len == md_size);
 
-    ASSERT_COMPARE( secret_new, (size_t) expected->len,
-                    expected->x, (size_t) expected->len );
+    TEST_ASSERT(mbedtls_ssl_tls1_3_create_psk_binder(NULL, /* SSL context for
+                                                              debugging only */
+                                                     md_type, psk->x, psk->len,
+                                                     psk_type, transcript->x,
+                                                     binder) == 0);
+
+    ASSERT_COMPARE(binder, md_size, binder_expected->x, binder_expected->len);
+}
+/* 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)
+{
+    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);
+
+    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;
@@ -4002,95 +3786,86 @@
      * 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_tls12( &original, ticket_len, crt_file ) == 0 );
+    TEST_ASSERT(ssl_populate_session_tls12(&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.minor_ver == restored.minor_ver );
-    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.minor_ver == restored.minor_ver);
+    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_X509_CRT_PARSE_C)
-#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 );
+#    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);
     }
-#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 );
+#    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);
     }
-#endif /* MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
+#    endif /* MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
 #endif /* MBEDTLS_X509_CRT_PARSE_C */
-    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_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;
@@ -4100,47 +3875,46 @@
      * 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_tls12( &session, ticket_len, crt_file ) == 0 );
+    TEST_ASSERT(ssl_populate_session_tls12(&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;
@@ -4150,33 +3924,33 @@
      * 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_tls12( &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_tls12(&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;
@@ -4186,173 +3960,170 @@
      * 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_tls12( &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_tls12(&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;
-    uint8_t should_corrupt_byte[] = { corrupt_major  == 1,
-                                      corrupt_minor  == 1,
-                                      corrupt_patch  == 1,
-                                      corrupt_config == 1,
+    uint8_t should_corrupt_byte[] = { corrupt_major == 1, corrupt_minor == 1,
+                                      corrupt_patch == 1, corrupt_config == 1,
                                       corrupt_config == 1 };
 
-    mbedtls_ssl_session_init( &session );
-    ssl_populate_session_tls12( &session, 0, NULL );
+    mbedtls_ssl_session_init(&session);
+    ssl_populate_session_tls12(&session, 0, NULL);
 
     /* 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;
         }
     }
-
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C: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 */
-void mbedtls_endpoint_sanity( int endpoint_type )
+void mbedtls_endpoint_sanity(int endpoint_type)
 {
-    enum { BUFFSIZE = 1024 };
+    enum
+    {
+        BUFFSIZE = 1024
+    };
     mbedtls_endpoint ep;
     int ret = -1;
 
-    ret = mbedtls_endpoint_init( NULL, endpoint_type, MBEDTLS_PK_RSA,
-                                 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);
+    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 );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_endpoint_init(&ep, endpoint_type, MBEDTLS_PK_RSA, NULL, NULL,
+                                NULL);
+    TEST_ASSERT(ret == 0);
 
 exit:
-    mbedtls_endpoint_free( &ep, NULL );
+    mbedtls_endpoint_free(&ep, NULL);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C: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 */
 void move_handshake_to_state(int endpoint_type, int state, int need_pass)
 {
-    enum { BUFFSIZE = 1024 };
+    enum
+    {
+        BUFFSIZE = 1024
+    };
     mbedtls_endpoint base_ep, second_ep;
     int ret = -1;
 
-    ret = mbedtls_endpoint_init( &base_ep, endpoint_type, MBEDTLS_PK_RSA,
-                                 NULL, NULL, NULL );
-    TEST_ASSERT( ret == 0 );
+    ret = mbedtls_endpoint_init(&base_ep, endpoint_type, MBEDTLS_PK_RSA, 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 );
-    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);
+    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_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_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;
@@ -4362,7 +4133,7 @@
     options.expected_negotiated_version = expected_negotiated_version;
 
     options.dtls = dtls;
-    perform_handshake( &options );
+    perform_handshake(&options);
 
     /* The goto below is used to avoid an "unused label" warning.*/
     goto exit;
@@ -4370,17 +4141,17 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_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;
@@ -4388,9 +4159,9 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_ENTROPY_C:MBEDTLS_CTR_DRBG_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;
@@ -4398,12 +4169,15 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!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 */
-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;
@@ -4412,61 +4186,68 @@
     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_X509_CRT_PARSE_C:!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 */
-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_X509_CRT_PARSE_C:!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 */
-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_X509_CRT_PARSE_C:!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 */
-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_X509_CRT_PARSE_C:!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 */
-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;
 
-    srv_pattern.pattern = cli_pattern.pattern = "found fragmented DTLS handshake";
+    srv_pattern.pattern = cli_pattern.pattern =
+        "found fragmented DTLS handshake";
     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 */
@@ -4477,43 +4258,45 @@
     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_X509_CRT_PARSE_C:!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 */
-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_X509_CRT_PARSE_C:!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 */
-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;
@@ -4523,17 +4306,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_X509_CRT_PARSE_C:!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 */
-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;
@@ -4541,10 +4324,11 @@
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!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 */
-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;
@@ -4552,7 +4336,7 @@
 /* END_CASE */
 
 /* 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_ssl_cf_hmac() against a reference
@@ -4569,112 +4353,108 @@
     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_ssl_cf_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_ssl_cf_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 */
 
 /* 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_ssl_cf_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_ssl_cf_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 */
 
@@ -4689,24 +4469,22 @@
 
     mbedtls_ssl_config conf;
 
-    mbedtls_ssl_config_init( &conf );
+    mbedtls_ssl_config_init(&conf);
 
-    TEST_ASSERT( mbedtls_ssl_conf_psk( &conf,
-                     psk0, sizeof( psk0 ),
-                     psk0_identity, sizeof( psk0_identity ) ) == 0 );
-    TEST_ASSERT( mbedtls_ssl_conf_psk( &conf,
-                     psk1, sizeof( psk1 ),
-                     psk1_identity, sizeof( psk1_identity ) ) ==
-                 MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
+    TEST_ASSERT(mbedtls_ssl_conf_psk(&conf, psk0, sizeof(psk0), psk0_identity,
+                                     sizeof(psk0_identity)) == 0);
+    TEST_ASSERT(mbedtls_ssl_conf_psk(&conf, psk1, sizeof(psk1), psk1_identity,
+                                     sizeof(psk1_identity)) ==
+                MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE);
 
 exit:
 
-    mbedtls_ssl_config_free( &conf );
+    mbedtls_ssl_config_free(&conf);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED:MBEDTLS_USE_PSA_CRYPTO */
-void test_multiple_psks_opaque( int mode )
+void test_multiple_psks_opaque(int mode)
 {
     /*
      * Mode 0: Raw PSK, then opaque PSK
@@ -4717,69 +4495,64 @@
     unsigned char psk0_raw[10] = { 0 };
     unsigned char psk0_raw_identity[] = { 'f', 'o', 'o' };
 
-    psa_key_id_t psk0_opaque = (psa_key_id_t) 1;
+    psa_key_id_t psk0_opaque = (psa_key_id_t)1;
     unsigned char psk0_opaque_identity[] = { 'f', 'o', 'o' };
 
     unsigned char psk1_raw[10] = { 0 };
     unsigned char psk1_raw_identity[] = { 'b', 'a', 'r' };
 
-    psa_key_id_t psk1_opaque = (psa_key_id_t) 2;
+    psa_key_id_t psk1_opaque = (psa_key_id_t)2;
     unsigned char psk1_opaque_identity[] = { 'b', 'a', 'r' };
 
     mbedtls_ssl_config conf;
 
-    USE_PSA_INIT( );
-    mbedtls_ssl_config_init( &conf );
+    USE_PSA_INIT();
+    mbedtls_ssl_config_init(&conf);
 
-    switch( mode )
-    {
+    switch (mode) {
         case 0:
 
-            TEST_ASSERT( mbedtls_ssl_conf_psk( &conf,
-                         psk0_raw, sizeof( psk0_raw ),
-                         psk0_raw_identity, sizeof( psk0_raw_identity ) )
-                   == 0 );
-            TEST_ASSERT( mbedtls_ssl_conf_psk_opaque( &conf,
-                         psk1_opaque,
-                         psk1_opaque_identity, sizeof( psk1_opaque_identity ) )
-                   == MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
+            TEST_ASSERT(mbedtls_ssl_conf_psk(&conf, psk0_raw, sizeof(psk0_raw),
+                                             psk0_raw_identity,
+                                             sizeof(psk0_raw_identity)) == 0);
+            TEST_ASSERT(mbedtls_ssl_conf_psk_opaque(
+                            &conf, psk1_opaque, psk1_opaque_identity,
+                            sizeof(psk1_opaque_identity)) ==
+                        MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE);
             break;
 
         case 1:
 
-            TEST_ASSERT( mbedtls_ssl_conf_psk_opaque( &conf,
-                         psk0_opaque,
-                         psk0_opaque_identity, sizeof( psk0_opaque_identity ) )
-                   == 0 );
-            TEST_ASSERT( mbedtls_ssl_conf_psk( &conf,
-                         psk1_raw, sizeof( psk1_raw ),
-                         psk1_raw_identity, sizeof( psk1_raw_identity ) )
-                   == MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
+            TEST_ASSERT(mbedtls_ssl_conf_psk_opaque(
+                            &conf, psk0_opaque, psk0_opaque_identity,
+                            sizeof(psk0_opaque_identity)) == 0);
+            TEST_ASSERT(mbedtls_ssl_conf_psk(&conf, psk1_raw, sizeof(psk1_raw),
+                                             psk1_raw_identity,
+                                             sizeof(psk1_raw_identity)) ==
+                        MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE);
 
             break;
 
         case 2:
 
-            TEST_ASSERT( mbedtls_ssl_conf_psk_opaque( &conf,
-                         psk0_opaque,
-                         psk0_opaque_identity, sizeof( psk0_opaque_identity ) )
-                   == 0 );
-            TEST_ASSERT( mbedtls_ssl_conf_psk_opaque( &conf,
-                         psk1_opaque,
-                         psk1_opaque_identity, sizeof( psk1_opaque_identity ) )
-                   == MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
+            TEST_ASSERT(mbedtls_ssl_conf_psk_opaque(
+                            &conf, psk0_opaque, psk0_opaque_identity,
+                            sizeof(psk0_opaque_identity)) == 0);
+            TEST_ASSERT(mbedtls_ssl_conf_psk_opaque(
+                            &conf, psk1_opaque, psk1_opaque_identity,
+                            sizeof(psk1_opaque_identity)) ==
+                        MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE);
 
             break;
 
         default:
-            TEST_ASSERT( 0 );
+            TEST_ASSERT(0);
             break;
     }
 
 exit:
 
-    mbedtls_ssl_config_free( &conf );
-    USE_PSA_DONE( );
-
+    mbedtls_ssl_config_free(&conf);
+    USE_PSA_DONE();
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_timing.function b/tests/suites/test_suite_timing.function
index 3483d85..3c682db 100644
--- a/tests/suites/test_suite_timing.function
+++ b/tests/suites/test_suite_timing.function
@@ -17,32 +17,29 @@
  */
 
 /* 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_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..53c7ca3 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;
+    build_int = MBEDTLS_VERSION_MAJOR << 24 | 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,29 @@
     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 912364c..77dd4d4 100644
--- a/tests/suites/test_suite_x509parse.function
+++ b/tests/suites/test_suite_x509parse.function
@@ -11,14 +11,13 @@
 #include "string.h"
 
 #if MBEDTLS_X509_MAX_INTERMEDIATE_CA > 19
-#error "The value of MBEDTLS_X509_MAX_INTERMEDIATE_C is larger \
+#    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."
 #endif
 
 /* Test-only profile allowing all digests, PK algorithms, and curves. */
-const mbedtls_x509_crt_profile profile_all =
-{
+const mbedtls_x509_crt_profile profile_all = {
     0xFFFFFFFF, /* Any MD        */
     0xFFFFFFFF, /* Any PK alg    */
     0xFFFFFFFF, /* Any curve     */
@@ -27,72 +26,78 @@
 
 /* Profile for backward compatibility. Allows SHA-1, unlike the default
    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 ),
+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),
     0xFFFFFFF, /* Any PK alg    */
     0xFFFFFFF, /* Any curve     */
     1024,
 };
 
-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 ),
+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),
     0,
     3072,
 };
 
-const mbedtls_x509_crt_profile profile_sha512 =
-{
-    MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA512 ),
+const mbedtls_x509_crt_profile profile_sha512 = {
+    MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA512),
     0xFFFFFFF, /* Any PK alg    */
     0xFFFFFFF, /* 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);
-    ((void) certificate_depth);
+    ((void)data);
+    ((void)crt);
+    ((void)certificate_depth);
     *flags |= MBEDTLS_X509_BADCERT_OTHER;
 
     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);
-    ((void) certificate_depth);
+    ((void)data);
+    ((void)crt);
+    ((void)certificate_depth);
     *flags = 0;
 
     return 0;
 }
 
 #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);
-    ((void) candidates);
+    ((void)data);
+    ((void)child);
+    ((void)candidates);
 
     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;
+    mbedtls_x509_crt *ca = (mbedtls_x509_crt *)data;
     mbedtls_x509_crt *first;
 
     /* This is a test-only implementation of the CA callback
@@ -103,27 +108,23 @@
      * return those trusted certificates which satisfy basic
      * parental checks, such as the matching of child `Issuer`
      * and parent `Subject` field. */
-    ((void) child);
+    ((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,33 +132,34 @@
 
 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;
+    int *levels = (int *)data;
 
-    ((void) crt);
-    ((void) certificate_depth);
+    ((void)crt);
+    ((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,20 +168,17 @@
     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;
@@ -187,7 +186,7 @@
     }
 
 done:
-    return ret ;
+    return ret;
 }
 
 #if defined(MBEDTLS_X509_CRT_PARSE_C)
@@ -196,201 +195,212 @@
     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;
+    verify_print_context *ctx = (verify_print_context *)data;
     char *p = ctx->p;
-    size_t n = ctx->buf + sizeof( ctx->buf ) - ctx->p;
-    ((void) flags);
+    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 :");
-           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 :" );
-               MBEDTLS_X509_SAFE_SNPRINTF;
-               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 );
-               MBEDTLS_X509_SAFE_SNPRINTF;
-
-               ret = mbedtls_snprintf( p, n, ", hardware serial number : " );
-               MBEDTLS_X509_SAFE_SNPRINTF;
-
-               if( san->san.other_name.value.hardware_module_name.val.len >= n )
-               {
-                   *p = '\0';
-                   return MBEDTLS_ERR_X509_BUFFER_TOO_SMALL ;
-               }
-
-               for( i=0; i < san->san.other_name.value.hardware_module_name.val.len; i++ )
-               {
-                   *p++ = san->san.other_name.value.hardware_module_name.val.p[i];
-               }
-               n -= san->san.other_name.value.hardware_module_name.val.len;
-            }
-        break;/* MBEDTLS_OID_ON_HW_MODULE_NAME */
-        case(  MBEDTLS_X509_SAN_DNS_NAME ):
-            ret = mbedtls_snprintf( p, n, "\ndNSName : " );
+    switch (san->type) {
+        case (MBEDTLS_X509_SAN_OTHER_NAME):
+            ret = mbedtls_snprintf(p, n, "\notherName :");
             MBEDTLS_X509_SAFE_SNPRINTF;
-            if( san->san.unstructured_name.len >= n )
-            {
+
+            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 : ");
+                MBEDTLS_X509_SAFE_SNPRINTF;
+
+                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 : ");
+                MBEDTLS_X509_SAFE_SNPRINTF;
+
+                if (san->san.other_name.value.hardware_module_name.val.len >=
+                    n) {
+                    *p = '\0';
+                    return MBEDTLS_ERR_X509_BUFFER_TOO_SMALL;
+                }
+
+                for (i = 0;
+                     i < san->san.other_name.value.hardware_module_name.val.len;
+                     i++) {
+                    *p++ =
+                        san->san.other_name.value.hardware_module_name.val.p[i];
+                }
+                n -= san->san.other_name.value.hardware_module_name.val.len;
+            }
+            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) {
                 *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;
+    (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 )
-    {
+    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;
 
         /* 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 ;
-    }
-    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 ;
+        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 ) );
+        return (MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_EXTENSIONS,
+                                  MBEDTLS_ERR_ASN1_UNEXPECTED_TAG));
 }
 #endif /* MBEDTLS_X509_CRT_PARSE_C */
 /* END_HEADER */
@@ -401,150 +411,153 @@
  */
 
 /* 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;
+    mbedtls_x509_crt crt;
     mbedtls_x509_subject_alternative_name san;
     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_REMOVE_INFO: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;
+    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:!MBEDTLS_X509_REMOVE_INFO */
-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;
+    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;
+    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:!MBEDTLS_X509_REMOVE_INFO */
-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;
+    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:!MBEDTLS_X509_REMOVE_INFO */
-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;
@@ -562,150 +575,160 @@
      * - 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;
-    mbedtls_x509_crl    crl;
-    uint32_t         flags = 0;
-    int         res;
+    mbedtls_x509_crt crt;
+    mbedtls_x509_crt ca;
+    mbedtls_x509_crl crl;
+    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 );
+        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 );
+        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;
@@ -713,331 +736,332 @@
     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:!MBEDTLS_X509_REMOVE_INFO */
-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;
+    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 );
+    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("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 */
-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 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 );
+    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 );
+        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 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 );
+    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 );
+        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;
+    mbedtls_x509_crt crt;
 #if !defined(MBEDTLS_X509_REMOVE_INFO)
     unsigned char output[2000] = { 0 };
     int res;
 #else
-    ((void) result_str);
+    ((void)result_str);
 #endif
 
-    mbedtls_x509_crt_init( &crt );
+    mbedtls_x509_crt_init(&crt);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_der( &crt, buf->x, buf->len ) == ( result ) );
+    TEST_ASSERT(mbedtls_x509_crt_parse_der(&crt, buf->x, buf->len) == (result));
 #if !defined(MBEDTLS_X509_REMOVE_INFO)
-    if( ( result ) == 0 )
-    {
-        res = mbedtls_x509_crt_info( (char *) output, 2000, "", &crt );
-        TEST_ASSERT( res != -1 );
-        TEST_ASSERT( res != -2 );
+    if ((result) == 0) {
+        res = mbedtls_x509_crt_info((char *)output, 2000, "", &crt);
+        TEST_ASSERT(res != -1);
+        TEST_ASSERT(res != -2);
 
-        TEST_ASSERT( strcmp( (char *) output, result_str ) == 0 );
+        TEST_ASSERT(strcmp((char *)output, result_str) == 0);
     }
-    memset( output, 0, 2000 );
+    memset(output, 0, 2000);
 #endif
 
-    mbedtls_x509_crt_free( &crt );
-    mbedtls_x509_crt_init( &crt );
+    mbedtls_x509_crt_free(&crt);
+    mbedtls_x509_crt_init(&crt);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_der_nocopy( &crt, buf->x, buf->len ) == ( result ) );
+    TEST_ASSERT(mbedtls_x509_crt_parse_der_nocopy(&crt, buf->x, buf->len) ==
+                (result));
 #if !defined(MBEDTLS_X509_REMOVE_INFO)
-    if( ( result ) == 0 )
-    {
-        memset( output, 0, 2000 );
+    if ((result) == 0) {
+        memset(output, 0, 2000);
 
-        res = mbedtls_x509_crt_info( (char *) output, 2000, "", &crt );
+        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);
     }
-    memset( output, 0, 2000 );
+    memset(output, 0, 2000);
 #endif /* !MBEDTLS_X509_REMOVE_INFO */
 
-    mbedtls_x509_crt_free( &crt );
-    mbedtls_x509_crt_init( &crt );
+    mbedtls_x509_crt_free(&crt);
+    mbedtls_x509_crt_init(&crt);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_der_with_ext_cb( &crt, buf->x, buf->len, 0, NULL, NULL ) == ( result ) );
+    TEST_ASSERT(mbedtls_x509_crt_parse_der_with_ext_cb(
+                    &crt, buf->x, buf->len, 0, NULL, NULL) == (result));
 #if !defined(MBEDTLS_X509_REMOVE_INFO)
-    if( ( result ) == 0 )
-    {
-        res = mbedtls_x509_crt_info( (char *) output, 2000, "", &crt );
+    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);
     }
-    memset( output, 0, 2000 );
+    memset(output, 0, 2000);
 #endif /* !MBEDTLS_X509_REMOVE_INFO */
 
-    mbedtls_x509_crt_free( &crt );
-    mbedtls_x509_crt_init( &crt );
+    mbedtls_x509_crt_free(&crt);
+    mbedtls_x509_crt_init(&crt);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_der_with_ext_cb( &crt, buf->x, buf->len, 1, NULL, NULL ) == ( result ) );
+    TEST_ASSERT(mbedtls_x509_crt_parse_der_with_ext_cb(
+                    &crt, buf->x, buf->len, 1, NULL, NULL) == (result));
 #if !defined(MBEDTLS_X509_REMOVE_INFO)
-    if( ( result ) == 0 )
-    {
-        res = mbedtls_x509_crt_info( (char *) output, 2000, "", &crt );
+    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);
     }
 #endif /* !MBEDTLS_X509_REMOVE_INFO */
 
 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;
+    mbedtls_x509_crt crt;
+    mbedtls_x509_buf oid;
 
 #if !defined(MBEDTLS_X509_REMOVE_INFO)
     unsigned char output[2000] = { 0 };
     int res;
 #else
-    ((void) result_str);
+    ((void)result_str);
 #endif
 
     oid.tag = MBEDTLS_ASN1_OID;
     oid.len = MBEDTLS_OID_SIZE(MBEDTLS_OID_PKIX "\x01\x1F");
     oid.p = (unsigned char *)MBEDTLS_OID_PKIX "\x01\x1F";
 
-    mbedtls_x509_crt_init( &crt );
+    mbedtls_x509_crt_init(&crt);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_der_with_ext_cb( &crt, buf->x, buf->len, 0, parse_crt_ext_cb, &oid ) == ( result ) );
+    TEST_ASSERT(mbedtls_x509_crt_parse_der_with_ext_cb(&crt, buf->x, buf->len,
+                                                       0, parse_crt_ext_cb,
+                                                       &oid) == (result));
 #if !defined(MBEDTLS_X509_REMOVE_INFO)
-    if( ( result ) == 0 )
-    {
-        res = mbedtls_x509_crt_info( (char *) output, 2000, "", &crt );
+    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);
     }
-    memset( output, 0, 2000 );
+    memset(output, 0, 2000);
 #endif /* !MBEDTLS_X509_REMOVE_INFO */
 
-    mbedtls_x509_crt_free( &crt );
-    mbedtls_x509_crt_init( &crt );
+    mbedtls_x509_crt_free(&crt);
+    mbedtls_x509_crt_init(&crt);
 
-    TEST_ASSERT( mbedtls_x509_crt_parse_der_with_ext_cb( &crt, buf->x, buf->len, 1, parse_crt_ext_cb, &oid ) == ( result ) );
+    TEST_ASSERT(mbedtls_x509_crt_parse_der_with_ext_cb(&crt, buf->x, buf->len,
+                                                       1, parse_crt_ext_cb,
+                                                       &oid) == (result));
 #if !defined(MBEDTLS_X509_REMOVE_INFO)
-    if( ( result ) == 0 )
-    {
-        res = mbedtls_x509_crt_info( (char *) output, 2000, "", &crt );
+    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);
     }
 #endif /* !MBEDTLS_X509_REMOVE_INFO */
 
 exit:
-    mbedtls_x509_crt_free( &crt );
+    mbedtls_x509_crt_free(&crt);
 }
 /* END_CASE */
 
 /* BEGIN_CASE depends_on:MBEDTLS_X509_CRL_PARSE_C:!MBEDTLS_X509_REMOVE_INFO */
-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;
+    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:!MBEDTLS_X509_REMOVE_INFO */
-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;
@@ -1049,198 +1073,206 @@
      * 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:!MBEDTLS_X509_REMOVE_INFO */
-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;
     int ret;
 
-
     oid.tag = MBEDTLS_ASN1_OID;
-    oid.p   = buf->x;
-    oid.len   = buf->len;
+    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;
+    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 */
-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 */
-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++;
-    memcpy( end, time_str, (size_t)*(end - 1) );
+    *end = strlen(time_str);
+    TEST_ASSERT(*end < 20);
+    end++;
+    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;
@@ -1251,19 +1283,18 @@
     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:
-    ;;
+exit:;
+    ;
 }
 /* END_CASE */
diff --git a/tests/suites/test_suite_x509write.function b/tests/suites/test_suite_x509write.function
index a545093..ce3fce3 100644
--- a/tests/suites/test_suite_x509write.function
+++ b/tests/suites/test_suite_x509write.function
@@ -7,66 +7,69 @@
 #include "mbedtls/rsa.h"
 
 #if defined(MBEDTLS_RSA_C)
-int mbedtls_rsa_decrypt_func( void *ctx, size_t *olen,
-                       const unsigned char *input, unsigned char *output,
-                       size_t output_max_len )
+int mbedtls_rsa_decrypt_func(void *ctx,
+                             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,
-                                        olen, input, output, output_max_len ) );
+    return (mbedtls_rsa_pkcs1_decrypt((mbedtls_rsa_context *)ctx, NULL, NULL,
+                                      olen, input, output, output_max_len));
 }
-int mbedtls_rsa_sign_func( void *ctx,
-                   int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
-                   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,
+                          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,
-                                    md_alg, hashlen, hash, sig ) );
+    return (mbedtls_rsa_pkcs1_sign((mbedtls_rsa_context *)ctx, f_rng, p_rng,
+                                   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 )
+#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)
 {
     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 */
+#endif /* MBEDTLS_USE_PSA_CRYPTO && MBEDTLS_PEM_WRITE_C && \
+          MBEDTLS_X509_CSR_WRITE_C */
 
 /* END_HEADER */
 
@@ -76,9 +79,13 @@
  */
 
 /* 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 )
+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)
 {
     mbedtls_pk_context key;
     mbedtls_x509write_csr req;
@@ -91,61 +98,63 @@
     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_pk_init( &key );
-    TEST_ASSERT( mbedtls_pk_parse_keyfile( &key, key_file, NULL,
-                        mbedtls_test_rnd_std_rand, NULL ) == 0 );
+    mbedtls_pk_init(&key);
+    TEST_ASSERT(mbedtls_pk_parse_keyfile(&key, key_file, NULL,
+                                         mbedtls_test_rnd_std_rand, NULL) == 0);
 
-    mbedtls_x509write_csr_init( &req );
-    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 );
+    mbedtls_x509write_csr_init(&req);
+    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);
 
-    ret = mbedtls_x509write_csr_pem( &req, buf, sizeof( buf ),
-                                     mbedtls_test_rnd_pseudo_rand, &rnd_info );
-    TEST_ASSERT( ret == 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 );
+    pem_len = strlen((char *)buf);
 
-    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( cert_req_check_file, "r" );
-    TEST_ASSERT( f != NULL );
-    olen = fread( check_buf, 1, sizeof( check_buf ), f );
-    fclose( f );
+    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 );
+    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 );
+    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 )
+    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;
@@ -157,52 +166,65 @@
     const char *subject_name = "C=NL,O=PolarSSL,CN=PolarSSL Server 1";
     mbedtls_test_rnd_pseudo_info rnd_info;
 
-    PSA_INIT( );
-    memset( &rnd_info, 0x2a, sizeof( mbedtls_test_rnd_pseudo_info ) );
+    PSA_INIT();
+    memset(&rnd_info, 0x2a, sizeof(mbedtls_test_rnd_pseudo_info));
 
-    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,
-                        mbedtls_test_rnd_std_rand, 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,
+                                         mbedtls_test_rnd_std_rand, NULL) == 0);
+    TEST_ASSERT(mbedtls_pk_wrap_as_opaque(&key, &key_id, md_alg_psa) == 0);
 
-    mbedtls_x509write_csr_init( &req );
-    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_init(&req);
+    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;
@@ -217,111 +239,112 @@
     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, mbedtls_test_rnd_std_rand, NULL ) == 0 );
+    TEST_ASSERT(mbedtls_pk_parse_keyfile(&subject_key, subject_key_file,
+                                         subject_pwd, mbedtls_test_rnd_std_rand,
+                                         NULL) == 0);
 
-    TEST_ASSERT( mbedtls_pk_parse_keyfile( &issuer_key, issuer_key_file,
-                    issuer_pwd, mbedtls_test_rnd_std_rand, NULL ) == 0 );
+    TEST_ASSERT(mbedtls_pk_parse_keyfile(&issuer_key, issuer_key_file,
+                                         issuer_pwd, mbedtls_test_rnd_std_rand,
+                                         NULL) == 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;
     }
 #else
-    (void) rsa_alt;
+    (void)rsa_alt;
 #endif
 
-    TEST_ASSERT( mbedtls_test_read_mpi( &serial, 10, serial_str ) == 0 );
+    TEST_ASSERT(mbedtls_test_read_mpi(&serial, 10, serial_str) == 0);
 
-    if( ver != -1 )
-        mbedtls_x509write_crt_set_version( &crt, ver );
+    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 );
+    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 );
+    mbedtls_x509write_crt_set_issuer_key(&crt, key);
 
-    if( crt.version >= MBEDTLS_X509_CRT_VERSION_3 )
-    {
+    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 );
+        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 );
+    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 );
+    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( 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 ) );
+    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 );
+    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;
 
-    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;
@@ -329,38 +352,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 */