Replace __attribute__((nonstring)) with macro MBEDTLS_ATTRIBUTE_UNTERMINATED_STRING

This macro applies __attribute__((nonstring)) when the compiler supports it

Signed-off-by: Felix Conway <[email protected]>
This commit is contained in:
Felix Conway
2025-06-12 11:14:33 +01:00
parent e811994bab
commit 37d32e6b46
+2 -1
View File
@@ -185,7 +185,8 @@ static int exercise_cipher_key(mbedtls_svc_key_id_t key,
psa_key_type_t key_type;
const unsigned char plaintext[16] = "Hello, world...";
/* We need to tell the compiler that we meant to leave out the null character. */
unsigned char ciphertext[32] __attribute__ ((nonstring)) = "(wabblewebblewibblewobblewubble)";
unsigned char ciphertext[32] MBEDTLS_ATTRIBUTE_UNTERMINATED_STRING =
"(wabblewebblewibblewobblewubble)";
size_t ciphertext_length = sizeof(ciphertext);
unsigned char decrypted[sizeof(ciphertext)];
size_t part_length;