Put handle parameter last: psa_import_key
In psa_import_key, change the order of parameters to pass
the pointer where the newly created handle will be stored last.
This is consistent with most other library functions that put inputs
before outputs.
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index 740cb11..f1fea38 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -216,7 +216,7 @@
psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_SIGN );
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle, key_bytes, key_length ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_bytes, key_length, &handle ) );
*status = psa_mac_sign_setup( operation, handle, alg );
/* Whether setup succeeded or failed, abort must succeed. */
@@ -250,7 +250,7 @@
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, &handle, key_bytes, key_length ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_bytes, key_length, &handle ) );
*status = psa_cipher_encrypt_setup( operation, handle, alg );
/* Whether setup succeeded or failed, abort must succeed. */
@@ -1220,7 +1220,7 @@
psa_set_key_type( &attributes, type );
psa_set_key_bits( &attributes, attr_bits );
- status = psa_import_key( &attributes, &handle, data->x, data->len );
+ status = psa_import_key( &attributes, data->x, data->len, &handle );
TEST_EQUAL( status, expected_status );
if( status != PSA_SUCCESS )
goto exit;
@@ -1266,7 +1266,7 @@
/* Try importing the key */
psa_set_key_type( &attributes, type );
- status = psa_import_key( &attributes, &handle, p, length );
+ status = psa_import_key( &attributes, p, length, &handle );
TEST_EQUAL( status, expected_status );
if( status == PSA_SUCCESS )
PSA_ASSERT( psa_destroy_key( handle ) );
@@ -1311,7 +1311,7 @@
psa_set_key_type( &attributes, type );
/* Import the key */
- PSA_ASSERT( psa_import_key( &attributes, &handle, data->x, data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, data->x, data->len, &handle ) );
/* Test the key information */
PSA_ASSERT( psa_get_key_attributes( handle, &got_attributes ) );
@@ -1346,8 +1346,7 @@
else
{
psa_key_handle_t handle2;
- PSA_ASSERT( psa_import_key( &attributes, &handle2,
- exported, exported_length ) );
+ PSA_ASSERT( psa_import_key( &attributes, exported, exported_length, &handle2 ) );
PSA_ASSERT( psa_export_key( handle2,
reexported,
export_size,
@@ -1407,7 +1406,7 @@
psa_set_key_type( &attributes, type );
/* Import the key */
- PSA_ASSERT( psa_import_key( &attributes, &handle, data->x, data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, data->x, data->len, &handle ) );
/* Export the public key */
ASSERT_ALLOC( exported, export_size );
@@ -1456,7 +1455,7 @@
psa_set_key_type( &attributes, type );
/* Import the key */
- PSA_ASSERT( psa_import_key( &attributes, &handle, data->x, data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, data->x, data->len, &handle ) );
/* Test the key information */
PSA_ASSERT( psa_get_key_attributes( handle, &got_attributes ) );
@@ -1495,7 +1494,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle, key, sizeof( key ) ) );
+ PSA_ASSERT( psa_import_key( &attributes, key, sizeof( key ), &handle ) );
PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
TEST_EQUAL( psa_get_key_type( &attributes ), key_type );
@@ -1563,8 +1562,7 @@
psa_set_key_algorithm( &attributes, policy_alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
status = psa_mac_sign_setup( &operation, handle, exercise_alg );
if( policy_alg == exercise_alg &&
@@ -1607,8 +1605,7 @@
psa_set_key_algorithm( &attributes, policy_alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
status = psa_cipher_encrypt_setup( &operation, handle, exercise_alg );
if( policy_alg == exercise_alg &&
@@ -1659,8 +1656,7 @@
psa_set_key_algorithm( &attributes, policy_alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
status = psa_aead_encrypt( handle, exercise_alg,
nonce, nonce_length,
@@ -1714,8 +1710,7 @@
psa_set_key_algorithm( &attributes, policy_alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
key_bits = psa_get_key_bits( &attributes );
@@ -1782,8 +1777,7 @@
psa_set_key_algorithm( &attributes, policy_alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
status = psa_asymmetric_sign( handle, exercise_alg,
payload, payload_length,
@@ -1827,8 +1821,7 @@
psa_set_key_algorithm( &attributes, policy_alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
status = psa_key_derivation( &generator, handle,
exercise_alg,
@@ -1867,8 +1860,7 @@
psa_set_key_algorithm( &attributes, policy_alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
PSA_ASSERT( psa_key_derivation_setup( &generator, exercise_alg ) );
status = key_agreement_with_self( &generator, handle );
@@ -1905,8 +1897,7 @@
psa_set_key_algorithm( &attributes, policy_alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
status = raw_key_agreement_with_self( exercise_alg, handle );
@@ -1944,8 +1935,7 @@
psa_set_key_usage_flags( &source_attributes, source_usage_arg );
psa_set_key_algorithm( &source_attributes, source_alg_arg );
psa_set_key_type( &source_attributes, type_arg );
- PSA_ASSERT( psa_import_key( &source_attributes, &source_handle,
- material->x, material->len ) );
+ PSA_ASSERT( psa_import_key( &source_attributes, material->x, material->len, &source_handle ) );
PSA_ASSERT( psa_get_key_attributes( source_handle, &source_attributes ) );
/* Prepare the target attributes. */
@@ -2011,8 +2001,7 @@
psa_set_key_usage_flags( &source_attributes, source_usage_arg );
psa_set_key_algorithm( &source_attributes, source_alg_arg );
psa_set_key_type( &source_attributes, type_arg );
- PSA_ASSERT( psa_import_key( &source_attributes, &source_handle,
- material->x, material->len ) );
+ PSA_ASSERT( psa_import_key( &source_attributes, material->x, material->len, &source_handle ) );
/* Prepare the target attributes. */
psa_set_key_type( &target_attributes, target_type_arg );
@@ -2420,8 +2409,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key, sizeof(key) ) );
+ PSA_ASSERT( psa_import_key( &attributes, key, sizeof( key ), &handle ) );
/* Call update without calling setup beforehand. */
TEST_EQUAL( psa_mac_update( &operation, input, sizeof( input ) ),
@@ -2547,8 +2535,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key->x, key->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key->x, key->len, &handle ) );
/* Calculate the MAC. */
PSA_ASSERT( psa_mac_sign_setup( &operation,
@@ -2594,8 +2581,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key->x, key->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key->x, key->len, &handle ) );
PSA_ASSERT( psa_mac_verify_setup( &operation,
handle, alg ) );
@@ -2712,8 +2698,7 @@
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, &handle,
- key, sizeof(key) ) );
+ PSA_ASSERT( psa_import_key( &attributes, key, sizeof( key ), &handle ) );
/* Call encrypt setup twice in a row. */
@@ -2870,8 +2855,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key->x, key->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key->x, key->len, &handle ) );
PSA_ASSERT( psa_cipher_encrypt_setup( &operation,
handle, alg ) );
@@ -2940,8 +2924,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key->x, key->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key->x, key->len, &handle ) );
PSA_ASSERT( psa_cipher_encrypt_setup( &operation,
handle, alg ) );
@@ -3016,8 +2999,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key->x, key->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key->x, key->len, &handle ) );
PSA_ASSERT( psa_cipher_decrypt_setup( &operation,
handle, alg ) );
@@ -3090,8 +3072,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key->x, key->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key->x, key->len, &handle ) );
PSA_ASSERT( psa_cipher_decrypt_setup( &operation,
handle, alg ) );
@@ -3157,8 +3138,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key->x, key->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key->x, key->len, &handle ) );
PSA_ASSERT( psa_cipher_encrypt_setup( &operation1,
handle, alg ) );
@@ -3243,8 +3223,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key->x, key->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key->x, key->len, &handle ) );
PSA_ASSERT( psa_cipher_encrypt_setup( &operation1,
handle, alg ) );
@@ -3345,8 +3324,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
TEST_EQUAL( psa_aead_encrypt( handle, alg,
nonce->x, nonce->len,
@@ -3408,8 +3386,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
PSA_ASSERT( psa_aead_encrypt( handle, alg,
nonce->x, nonce->len,
@@ -3456,8 +3433,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
TEST_EQUAL( psa_aead_decrypt( handle, alg,
nonce->x, nonce->len,
@@ -3514,8 +3490,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
key_bits = psa_get_key_bits( &attributes );
@@ -3567,8 +3542,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
actual_status = psa_asymmetric_sign( handle, alg,
input_data->x, input_data->len,
@@ -3608,8 +3582,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
key_bits = psa_get_key_bits( &attributes );
@@ -3674,8 +3647,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
PSA_ASSERT( psa_asymmetric_verify( handle, alg,
hash_data->x, hash_data->len,
@@ -3707,8 +3679,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
actual_status = psa_asymmetric_verify( handle, alg,
hash_data->x, hash_data->len,
@@ -3751,8 +3722,7 @@
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, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
/* Determine the maximum output length */
PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
@@ -3818,8 +3788,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
/* Determine the maximum ciphertext length */
PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
@@ -3883,8 +3852,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
PSA_ASSERT( psa_asymmetric_decrypt( handle, alg,
input_data->x, input_data->len,
@@ -3947,8 +3915,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
actual_status = psa_asymmetric_decrypt( handle, alg,
input_data->x, input_data->len,
@@ -4034,8 +4001,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
TEST_EQUAL( psa_key_derivation( &generator, handle, alg,
salt->x, salt->len,
@@ -4070,8 +4036,9 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, key_type );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data, sizeof( key_data ) ) );
+ PSA_ASSERT( psa_import_key( &attributes,
+ key_data, sizeof( key_data ),
+ &handle ) );
/* valid key derivation */
PSA_ASSERT( psa_key_derivation( &generator, handle, alg,
@@ -4164,8 +4131,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, PSA_KEY_TYPE_DERIVE );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
/* Extraction phase. */
if( PSA_ALG_IS_HKDF( alg ) )
@@ -4260,8 +4226,7 @@
psa_set_key_algorithm( &attributes, alg );
psa_set_key_type( &attributes, PSA_KEY_TYPE_DERIVE );
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &handle ) );
/* Extraction phase. */
if( PSA_ALG_IS_HKDF( alg ) )
@@ -4346,8 +4311,7 @@
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, &base_handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len, &base_handle ) );
/* Derive a key. */
PSA_ASSERT( psa_key_derivation( &generator, base_handle, alg,
@@ -4407,8 +4371,7 @@
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, &base_handle,
- key_data->x, key_data->len ) );
+ PSA_ASSERT( psa_import_key( &base_attributes, key_data->x, key_data->len, &base_handle ) );
/* Derive some material and output it. */
PSA_ASSERT( psa_key_derivation( &generator, base_handle, alg,
@@ -4477,8 +4440,7 @@
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,
- our_key_data->x, our_key_data->len ) );
+ 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
@@ -4523,8 +4485,7 @@
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,
- our_key_data->x, our_key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, our_key_data->x, our_key_data->len, &our_key ) );
PSA_ASSERT( psa_key_agreement_raw_shared_secret(
alg, our_key,
@@ -4559,8 +4520,7 @@
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,
- our_key_data->x, our_key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, our_key_data->x, our_key_data->len, &our_key ) );
PSA_ASSERT( psa_key_derivation_setup( &generator, alg ) );
PSA_ASSERT( psa_key_agreement( &generator, PSA_KDF_STEP_SECRET,
@@ -4619,8 +4579,7 @@
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,
- our_key_data->x, our_key_data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, our_key_data->x, our_key_data->len, &our_key ) );
PSA_ASSERT( psa_key_derivation_setup( &generator, alg ) );
PSA_ASSERT( psa_key_agreement( &generator, PSA_KDF_STEP_SECRET,
@@ -4893,8 +4852,7 @@
{
case IMPORT_KEY:
/* Import the key */
- PSA_ASSERT( psa_import_key( &attributes, &handle,
- data->x, data->len ) );
+ PSA_ASSERT( psa_import_key( &attributes, data->x, data->len, &handle ) );
break;
case GENERATE_KEY:
@@ -4911,8 +4869,7 @@
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, &base_key,
- data->x, data->len ) );
+ PSA_ASSERT( psa_import_key( &base_attributes, data->x, data->len, &base_key ) );
/* Derive a key. */
PSA_ASSERT( psa_key_derivation_setup( &generator, derive_alg ) );
PSA_ASSERT( psa_key_derivation_input_key( &generator,