@@ -40,15 +40,15 @@ ZTEST(psa_crypto_test, test_cipher_aes_cbc_256_multipart)
4040 psa_set_key_algorithm (& attributes , alg );
4141 psa_set_key_type (& attributes , PSA_KEY_TYPE_AES );
4242 psa_set_key_bits (& attributes , 256 );
43- #if defined(CONFIG_TEST_WRAPPED_KEYS )
44- psa_set_key_lifetime (& attributes , PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION (
45- PSA_KEY_PERSISTENCE_VOLATILE , 0 ));
46- zassert_equal (psa_generate_key (& attributes , & key_id ), PSA_SUCCESS ,
47- "Failed to generate key" );
48- #else
49- zassert_equal (psa_import_key (& attributes , key_256 , sizeof (key_256 ), & key_id ),
50- PSA_SUCCESS , "Failed to import key" );
51- #endif
43+ #if defined(CONFIG_TEST_WRAPPED_KEYS )
44+ psa_set_key_lifetime (& attributes , PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION (
45+ PSA_KEY_PERSISTENCE_VOLATILE , 0 ));
46+ zassert_equal (psa_generate_key (& attributes , & key_id ), PSA_SUCCESS ,
47+ "Failed to generate key" );
48+ #else
49+ zassert_equal (psa_import_key (& attributes , key_256 , sizeof (key_256 ), & key_id ), PSA_SUCCESS ,
50+ "Failed to import key" );
51+ #endif
5252 psa_reset_key_attributes (& attributes );
5353 zassert_equal (psa_cipher_encrypt_setup (& operation , key_id , alg ), PSA_SUCCESS ,
5454 "Failed to begin encrypt operation" );
@@ -95,15 +95,15 @@ ZTEST(psa_crypto_test, test_cipher_aes_cbc_256_single)
9595 psa_set_key_algorithm (& attributes , alg );
9696 psa_set_key_type (& attributes , PSA_KEY_TYPE_AES );
9797 psa_set_key_bits (& attributes , 256 );
98- #if defined(CONFIG_TEST_WRAPPED_KEYS )
99- psa_set_key_lifetime (& attributes , PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION (
100- PSA_KEY_PERSISTENCE_VOLATILE , 1 ));
101- zassert_equal (psa_generate_key (& attributes , & key_id ), PSA_SUCCESS ,
102- "Failed to generate key" );
103- #else
104- zassert_equal (psa_import_key (& attributes , key_256 , sizeof (key_256 ), & key_id ),
105- PSA_SUCCESS , "Failed to import key" );
106- #endif
98+ #if defined(CONFIG_TEST_WRAPPED_KEYS )
99+ psa_set_key_lifetime (& attributes , PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION (
100+ PSA_KEY_PERSISTENCE_VOLATILE , 1 ));
101+ zassert_equal (psa_generate_key (& attributes , & key_id ), PSA_SUCCESS ,
102+ "Failed to generate key" );
103+ #else
104+ zassert_equal (psa_import_key (& attributes , key_256 , sizeof (key_256 ), & key_id ), PSA_SUCCESS ,
105+ "Failed to import key" );
106+ #endif
107107 psa_reset_key_attributes (& attributes );
108108
109109 zassert_equal (psa_cipher_encrypt (key_id , alg , plaintext , sizeof (plaintext ),
@@ -133,16 +133,16 @@ ZTEST(psa_crypto_test, test_cipher_aes_ecb_128_single)
133133 psa_set_key_algorithm (& attributes , alg );
134134 psa_set_key_type (& attributes , PSA_KEY_TYPE_AES );
135135 psa_set_key_bits (& attributes , 128 );
136- #if defined(CONFIG_TEST_WRAPPED_KEYS )
137- psa_set_key_lifetime (& attributes , PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION (
138- PSA_KEY_PERSISTENCE_VOLATILE , 1 ));
139-
140- zassert_equal (psa_generate_key (& attributes , & key_id ), PSA_SUCCESS ,
141- "Failed to generate key" );
142- #else
143- zassert_equal (psa_import_key (& attributes , key_128 , sizeof (key_128 ), & key_id ),
144- PSA_SUCCESS , "Failed to import key" );
145- #endif
136+ #if defined(CONFIG_TEST_WRAPPED_KEYS )
137+ psa_set_key_lifetime (& attributes , PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION (
138+ PSA_KEY_PERSISTENCE_VOLATILE , 1 ));
139+
140+ zassert_equal (psa_generate_key (& attributes , & key_id ), PSA_SUCCESS ,
141+ "Failed to generate key" );
142+ #else
143+ zassert_equal (psa_import_key (& attributes , key_128 , sizeof (key_128 ), & key_id ), PSA_SUCCESS ,
144+ "Failed to import key" );
145+ #endif
146146 psa_reset_key_attributes (& attributes );
147147
148148 zassert_equal (psa_cipher_encrypt (key_id , alg , plaintext , sizeof (plaintext ), ciphertext ,
@@ -188,4 +188,4 @@ ZTEST(psa_crypto_test, test_cipher_chacha20_single)
188188 PSA_SUCCESS , "Failed to decrypt" );
189189
190190 zassert_mem_equal (decrypted , plaintext , sizeof (plaintext ));
191- }
191+ }
0 commit comments