Convert derive_key_export to the new KDF API
diff --git a/tests/suites/test_suite_psa_crypto.data b/tests/suites/test_suite_psa_crypto.data
index 11d61d4..cf1911f 100644
--- a/tests/suites/test_suite_psa_crypto.data
+++ b/tests/suites/test_suite_psa_crypto.data
@@ -2055,12 +2055,12 @@
depends_on:MBEDTLS_MD_C:MBEDTLS_SHA256_C:!PSA_PRE_1_0_KEY_DERIVATION
derive_key_exercise:PSA_ALG_TLS12_PRF(PSA_ALG_SHA_256):"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b":"000102030405060708090a0b0c":"f0f1f2f3f4f5f6f7f8f9":PSA_KEY_TYPE_DERIVE:400:PSA_KEY_USAGE_DERIVE:PSA_ALG_HKDF(PSA_ALG_SHA_256)
-PSA key derivation: HKDF SHA-256, derive key, 16+32
-depends_on:MBEDTLS_MD_C:MBEDTLS_SHA256_C
+PSA key derivation: HKDF SHA-256, derive key export, 16+32
+depends_on:MBEDTLS_MD_C:MBEDTLS_SHA256_C:!PSA_PRE_1_0_KEY_DERIVATION
derive_key_export:PSA_ALG_HKDF(PSA_ALG_SHA_256):"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b":"000102030405060708090a0b0c":"f0f1f2f3f4f5f6f7f8f9":16:32
-PSA key derivation: HKDF SHA-256, derive key, 1+41
-depends_on:MBEDTLS_MD_C:MBEDTLS_SHA256_C
+PSA key derivation: HKDF SHA-256, derive key export, 1+41
+depends_on:MBEDTLS_MD_C:MBEDTLS_SHA256_C:!PSA_PRE_1_0_KEY_DERIVATION
derive_key_export:PSA_ALG_HKDF(PSA_ALG_SHA_256):"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b":"000102030405060708090a0b0c":"f0f1f2f3f4f5f6f7f8f9":1:41
PSA key agreement setup: ECDH + HKDF-SHA-256: good
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index a36a8af..a6fcdb5 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -4480,11 +4480,11 @@
}
/* END_CASE */
-/* BEGIN_CASE depends_on:PSA_PRE_1_0_KEY_DERIVATION */
+/* BEGIN_CASE */
void derive_key_export( int alg_arg,
data_t *key_data,
- data_t *salt,
- data_t *label,
+ data_t *input1,
+ data_t *input2,
int bytes1_arg,
int bytes2_arg )
{
@@ -4512,20 +4512,22 @@
&base_handle ) );
/* Derive some material and output it. */
- PSA_ASSERT( psa_key_derivation( &operation, base_handle, alg,
- salt->x, salt->len,
- label->x, label->len,
- capacity ) );
+ if( !setup_key_derivation_wrap( &operation, base_handle, 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 ) );
/* Derive the same output again, but this time store it in key objects. */
- PSA_ASSERT( psa_key_derivation( &operation, base_handle, alg,
- salt->x, salt->len,
- label->x, label->len,
- capacity ) );
+ if( !setup_key_derivation_wrap( &operation, base_handle, 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 );