@@ -216,7 +216,8 @@ int exercise_mac_setup( psa_key_type_t key_type,
216216 psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN );
217217 psa_set_key_algorithm( &attributes, alg );
218218 psa_set_key_type( &attributes, key_type );
219- PSA_ASSERT( psa_import_key( &attributes, key_bytes, key_length, &handle ) );
219+ PSA_ASSERT( psa_import_key( &attributes, key_bytes, key_length,
220+ &handle ) );
220221
221222 *status = psa_mac_sign_setup( operation, handle, alg );
222223 /* Whether setup succeeded or failed, abort must succeed. */
@@ -250,7 +251,8 @@ int exercise_cipher_setup( psa_key_type_t key_type,
250251 psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
251252 psa_set_key_algorithm( &attributes, alg );
252253 psa_set_key_type( &attributes, key_type );
253- PSA_ASSERT( psa_import_key( &attributes, key_bytes, key_length, &handle ) );
254+ PSA_ASSERT( psa_import_key( &attributes, key_bytes, key_length,
255+ &handle ) );
254256
255257 *status = psa_cipher_encrypt_setup( operation, handle, alg );
256258 /* Whether setup succeeded or failed, abort must succeed. */
@@ -1346,7 +1348,8 @@ void import_export( data_t *data,
13461348 else
13471349 {
13481350 psa_key_handle_t handle2;
1349- PSA_ASSERT( psa_import_key( &attributes, exported, exported_length, &handle2 ) );
1351+ PSA_ASSERT( psa_import_key( &attributes, exported, exported_length,
1352+ &handle2 ) );
13501353 PSA_ASSERT( psa_export_key( handle2,
13511354 reexported,
13521355 export_size,
@@ -1562,7 +1565,8 @@ void mac_key_policy( int policy_usage,
15621565 psa_set_key_algorithm( &attributes, policy_alg );
15631566 psa_set_key_type( &attributes, key_type );
15641567
1565- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
1568+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
1569+ &handle ) );
15661570
15671571 status = psa_mac_sign_setup( &operation, handle, exercise_alg );
15681572 if( policy_alg == exercise_alg &&
@@ -1605,7 +1609,8 @@ void cipher_key_policy( int policy_usage,
16051609 psa_set_key_algorithm( &attributes, policy_alg );
16061610 psa_set_key_type( &attributes, key_type );
16071611
1608- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
1612+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
1613+ &handle ) );
16091614
16101615 status = psa_cipher_encrypt_setup( &operation, handle, exercise_alg );
16111616 if( policy_alg == exercise_alg &&
@@ -1656,7 +1661,8 @@ void aead_key_policy( int policy_usage,
16561661 psa_set_key_algorithm( &attributes, policy_alg );
16571662 psa_set_key_type( &attributes, key_type );
16581663
1659- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
1664+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
1665+ &handle ) );
16601666
16611667 status = psa_aead_encrypt( handle, exercise_alg,
16621668 nonce, nonce_length,
@@ -1710,7 +1716,8 @@ void asymmetric_encryption_key_policy( int policy_usage,
17101716 psa_set_key_algorithm( &attributes, policy_alg );
17111717 psa_set_key_type( &attributes, key_type );
17121718
1713- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
1719+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
1720+ &handle ) );
17141721
17151722 PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
17161723 key_bits = psa_get_key_bits( &attributes );
@@ -1777,7 +1784,8 @@ void asymmetric_signature_key_policy( int policy_usage,
17771784 psa_set_key_algorithm( &attributes, policy_alg );
17781785 psa_set_key_type( &attributes, key_type );
17791786
1780- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
1787+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
1788+ &handle ) );
17811789
17821790 status = psa_asymmetric_sign( handle, exercise_alg,
17831791 payload, payload_length,
@@ -1821,7 +1829,8 @@ void derive_key_policy( int policy_usage,
18211829 psa_set_key_algorithm( &attributes, policy_alg );
18221830 psa_set_key_type( &attributes, key_type );
18231831
1824- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
1832+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
1833+ &handle ) );
18251834
18261835 status = psa_key_derivation( &generator, handle,
18271836 exercise_alg,
@@ -1860,7 +1869,8 @@ void agreement_key_policy( int policy_usage,
18601869 psa_set_key_algorithm( &attributes, policy_alg );
18611870 psa_set_key_type( &attributes, key_type );
18621871
1863- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
1872+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
1873+ &handle ) );
18641874
18651875 PSA_ASSERT( psa_key_derivation_setup( &generator, exercise_alg ) );
18661876 status = key_agreement_with_self( &generator, handle );
@@ -1897,7 +1907,8 @@ void raw_agreement_key_policy( int policy_usage,
18971907 psa_set_key_algorithm( &attributes, policy_alg );
18981908 psa_set_key_type( &attributes, key_type );
18991909
1900- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
1910+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
1911+ &handle ) );
19011912
19021913 status = raw_key_agreement_with_self( exercise_alg, handle );
19031914
@@ -1935,7 +1946,9 @@ void copy_success( int source_usage_arg, int source_alg_arg,
19351946 psa_set_key_usage_flags( &source_attributes, source_usage_arg );
19361947 psa_set_key_algorithm( &source_attributes, source_alg_arg );
19371948 psa_set_key_type( &source_attributes, type_arg );
1938- PSA_ASSERT( psa_import_key( &source_attributes, material->x, material->len, &source_handle ) );
1949+ PSA_ASSERT( psa_import_key( &source_attributes,
1950+ material->x, material->len,
1951+ &source_handle ) );
19391952 PSA_ASSERT( psa_get_key_attributes( source_handle, &source_attributes ) );
19401953
19411954 /* Prepare the target attributes. */
@@ -2001,7 +2014,9 @@ void copy_fail( int source_usage_arg, int source_alg_arg,
20012014 psa_set_key_usage_flags( &source_attributes, source_usage_arg );
20022015 psa_set_key_algorithm( &source_attributes, source_alg_arg );
20032016 psa_set_key_type( &source_attributes, type_arg );
2004- PSA_ASSERT( psa_import_key( &source_attributes, material->x, material->len, &source_handle ) );
2017+ PSA_ASSERT( psa_import_key( &source_attributes,
2018+ material->x, material->len,
2019+ &source_handle ) );
20052020
20062021 /* Prepare the target attributes. */
20072022 psa_set_key_type( &target_attributes, target_type_arg );
@@ -3324,7 +3339,8 @@ void aead_encrypt_decrypt( int key_type_arg, data_t *key_data,
33243339 psa_set_key_algorithm( &attributes, alg );
33253340 psa_set_key_type( &attributes, key_type );
33263341
3327- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
3342+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
3343+ &handle ) );
33283344
33293345 TEST_EQUAL( psa_aead_encrypt( handle, alg,
33303346 nonce->x, nonce->len,
@@ -3386,7 +3402,8 @@ void aead_encrypt( int key_type_arg, data_t *key_data,
33863402 psa_set_key_algorithm( &attributes, alg );
33873403 psa_set_key_type( &attributes, key_type );
33883404
3389- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
3405+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
3406+ &handle ) );
33903407
33913408 PSA_ASSERT( psa_aead_encrypt( handle, alg,
33923409 nonce->x, nonce->len,
@@ -3433,7 +3450,8 @@ void aead_decrypt( int key_type_arg, data_t *key_data,
34333450 psa_set_key_algorithm( &attributes, alg );
34343451 psa_set_key_type( &attributes, key_type );
34353452
3436- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
3453+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
3454+ &handle ) );
34373455
34383456 TEST_EQUAL( psa_aead_decrypt( handle, alg,
34393457 nonce->x, nonce->len,
@@ -3490,7 +3508,8 @@ void sign_deterministic( int key_type_arg, data_t *key_data,
34903508 psa_set_key_algorithm( &attributes, alg );
34913509 psa_set_key_type( &attributes, key_type );
34923510
3493- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
3511+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
3512+ &handle ) );
34943513 PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
34953514 key_bits = psa_get_key_bits( &attributes );
34963515
@@ -3542,7 +3561,8 @@ void sign_fail( int key_type_arg, data_t *key_data,
35423561 psa_set_key_algorithm( &attributes, alg );
35433562 psa_set_key_type( &attributes, key_type );
35443563
3545- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
3564+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
3565+ &handle ) );
35463566
35473567 actual_status = psa_asymmetric_sign( handle, alg,
35483568 input_data->x, input_data->len,
@@ -3582,7 +3602,8 @@ void sign_verify( int key_type_arg, data_t *key_data,
35823602 psa_set_key_algorithm( &attributes, alg );
35833603 psa_set_key_type( &attributes, key_type );
35843604
3585- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
3605+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
3606+ &handle ) );
35863607 PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
35873608 key_bits = psa_get_key_bits( &attributes );
35883609
@@ -3647,7 +3668,8 @@ void asymmetric_verify( int key_type_arg, data_t *key_data,
36473668 psa_set_key_algorithm( &attributes, alg );
36483669 psa_set_key_type( &attributes, key_type );
36493670
3650- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
3671+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
3672+ &handle ) );
36513673
36523674 PSA_ASSERT( psa_asymmetric_verify( handle, alg,
36533675 hash_data->x, hash_data->len,
@@ -3679,7 +3701,8 @@ void asymmetric_verify_fail( int key_type_arg, data_t *key_data,
36793701 psa_set_key_algorithm( &attributes, alg );
36803702 psa_set_key_type( &attributes, key_type );
36813703
3682- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
3704+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
3705+ &handle ) );
36833706
36843707 actual_status = psa_asymmetric_verify( handle, alg,
36853708 hash_data->x, hash_data->len,
@@ -3722,7 +3745,8 @@ void asymmetric_encrypt( int key_type_arg,
37223745 psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
37233746 psa_set_key_algorithm( &attributes, alg );
37243747 psa_set_key_type( &attributes, key_type );
3725- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
3748+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
3749+ &handle ) );
37263750
37273751 /* Determine the maximum output length */
37283752 PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
@@ -3788,7 +3812,8 @@ void asymmetric_encrypt_decrypt( int key_type_arg,
37883812 psa_set_key_algorithm( &attributes, alg );
37893813 psa_set_key_type( &attributes, key_type );
37903814
3791- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
3815+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
3816+ &handle ) );
37923817
37933818 /* Determine the maximum ciphertext length */
37943819 PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
@@ -3852,7 +3877,8 @@ void asymmetric_decrypt( int key_type_arg,
38523877 psa_set_key_algorithm( &attributes, alg );
38533878 psa_set_key_type( &attributes, key_type );
38543879
3855- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
3880+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
3881+ &handle ) );
38563882
38573883 PSA_ASSERT( psa_asymmetric_decrypt( handle, alg,
38583884 input_data->x, input_data->len,
@@ -3915,7 +3941,8 @@ void asymmetric_decrypt_fail( int key_type_arg,
39153941 psa_set_key_algorithm( &attributes, alg );
39163942 psa_set_key_type( &attributes, key_type );
39173943
3918- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
3944+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
3945+ &handle ) );
39193946
39203947 actual_status = psa_asymmetric_decrypt( handle, alg,
39213948 input_data->x, input_data->len,
@@ -4001,7 +4028,8 @@ void derive_setup( int key_type_arg,
40014028 psa_set_key_algorithm( &attributes, alg );
40024029 psa_set_key_type( &attributes, key_type );
40034030
4004- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
4031+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
4032+ &handle ) );
40054033
40064034 TEST_EQUAL( psa_key_derivation( &generator, handle, alg,
40074035 salt->x, salt->len,
@@ -4131,7 +4159,8 @@ void derive_output( int alg_arg,
41314159 psa_set_key_algorithm( &attributes, alg );
41324160 psa_set_key_type( &attributes, PSA_KEY_TYPE_DERIVE );
41334161
4134- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
4162+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
4163+ &handle ) );
41354164
41364165 /* Extraction phase. */
41374166 if( PSA_ALG_IS_HKDF( alg ) )
@@ -4226,7 +4255,8 @@ void derive_full( int alg_arg,
42264255 psa_set_key_algorithm( &attributes, alg );
42274256 psa_set_key_type( &attributes, PSA_KEY_TYPE_DERIVE );
42284257
4229- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
4258+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
4259+ &handle ) );
42304260
42314261 /* Extraction phase. */
42324262 if( PSA_ALG_IS_HKDF( alg ) )
@@ -4311,7 +4341,8 @@ void derive_key_exercise( int alg_arg,
43114341 psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DERIVE );
43124342 psa_set_key_algorithm( &attributes, alg );
43134343 psa_set_key_type( &attributes, PSA_KEY_TYPE_DERIVE );
4314- PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &base_handle ) );
4344+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
4345+ &base_handle ) );
43154346
43164347 /* Derive a key. */
43174348 PSA_ASSERT( psa_key_derivation( &generator, base_handle, alg,
@@ -4371,7 +4402,8 @@ void derive_key_export( int alg_arg,
43714402 psa_set_key_usage_flags( &base_attributes, PSA_KEY_USAGE_DERIVE );
43724403 psa_set_key_algorithm( &base_attributes, alg );
43734404 psa_set_key_type( &base_attributes, PSA_KEY_TYPE_DERIVE );
4374- PSA_ASSERT( psa_import_key( &base_attributes, key_data->x, key_data->len, &base_handle ) );
4405+ PSA_ASSERT( psa_import_key( &base_attributes, key_data->x, key_data->len,
4406+ &base_handle ) );
43754407
43764408 /* Derive some material and output it. */
43774409 PSA_ASSERT( psa_key_derivation( &generator, base_handle, alg,
@@ -4440,7 +4472,9 @@ void key_agreement_setup( int alg_arg,
44404472 psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DERIVE );
44414473 psa_set_key_algorithm( &attributes, alg );
44424474 psa_set_key_type( &attributes, our_key_type );
4443- PSA_ASSERT( psa_import_key( &attributes, our_key_data->x, our_key_data->len, &our_key ) );
4475+ PSA_ASSERT( psa_import_key( &attributes,
4476+ our_key_data->x, our_key_data->len,
4477+ &our_key ) );
44444478
44454479 /* The tests currently include inputs that should fail at either step.
44464480 * Test cases that fail at the setup step should be changed to call
@@ -4485,7 +4519,9 @@ void raw_key_agreement( int alg_arg,
44854519 psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DERIVE );
44864520 psa_set_key_algorithm( &attributes, alg );
44874521 psa_set_key_type( &attributes, our_key_type );
4488- PSA_ASSERT( psa_import_key( &attributes, our_key_data->x, our_key_data->len, &our_key ) );
4522+ PSA_ASSERT( psa_import_key( &attributes,
4523+ our_key_data->x, our_key_data->len,
4524+ &our_key ) );
44894525
44904526 PSA_ASSERT( psa_key_agreement_raw_shared_secret(
44914527 alg, our_key,
@@ -4520,7 +4556,9 @@ void key_agreement_capacity( int alg_arg,
45204556 psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DERIVE );
45214557 psa_set_key_algorithm( &attributes, alg );
45224558 psa_set_key_type( &attributes, our_key_type );
4523- PSA_ASSERT( psa_import_key( &attributes, our_key_data->x, our_key_data->len, &our_key ) );
4559+ PSA_ASSERT( psa_import_key( &attributes,
4560+ our_key_data->x, our_key_data->len,
4561+ &our_key ) );
45244562
45254563 PSA_ASSERT( psa_key_derivation_setup( &generator, alg ) );
45264564 PSA_ASSERT( psa_key_agreement( &generator, PSA_KDF_STEP_SECRET,
@@ -4579,7 +4617,9 @@ void key_agreement_output( int alg_arg,
45794617 psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DERIVE );
45804618 psa_set_key_algorithm( &attributes, alg );
45814619 psa_set_key_type( &attributes, our_key_type );
4582- PSA_ASSERT( psa_import_key( &attributes, our_key_data->x, our_key_data->len, &our_key ) );
4620+ PSA_ASSERT( psa_import_key( &attributes,
4621+ our_key_data->x, our_key_data->len,
4622+ &our_key ) );
45834623
45844624 PSA_ASSERT( psa_key_derivation_setup( &generator, alg ) );
45854625 PSA_ASSERT( psa_key_agreement( &generator, PSA_KDF_STEP_SECRET,
@@ -4852,7 +4892,8 @@ void persistent_key_load_key_from_storage( data_t *data,
48524892 {
48534893 case IMPORT_KEY:
48544894 /* Import the key */
4855- PSA_ASSERT( psa_import_key( &attributes, data->x, data->len, &handle ) );
4895+ PSA_ASSERT( psa_import_key( &attributes, data->x, data->len,
4896+ &handle ) );
48564897 break;
48574898
48584899 case GENERATE_KEY:
@@ -4869,7 +4910,9 @@ void persistent_key_load_key_from_storage( data_t *data,
48694910 PSA_KEY_USAGE_DERIVE );
48704911 psa_set_key_algorithm( &base_attributes, derive_alg );
48714912 psa_set_key_type( &base_attributes, PSA_KEY_TYPE_DERIVE );
4872- PSA_ASSERT( psa_import_key( &base_attributes, data->x, data->len, &base_key ) );
4913+ PSA_ASSERT( psa_import_key( &base_attributes,
4914+ data->x, data->len,
4915+ &base_key ) );
48734916 /* Derive a key. */
48744917 PSA_ASSERT( psa_key_derivation_setup( &generator, derive_alg ) );
48754918 PSA_ASSERT( psa_key_derivation_input_key( &generator,
0 commit comments