Add flag for removing deprecated API
Add the compile time option PSA_PRE_1_0_KEY_DERIVATION. If this is not
turned on, then the function `psa_key_derivation()` is removed.
Most of the tests regarding key derivation haven't been adapted to the
new API yet and some of them have only been adapted partially. When this
new option is turned off, the tests using the old API and test cases
using the old API of partially adapted tests are skipped.
The sole purpose of this option is to make the transition to the new API
smoother. Once the transition is complete it can and should be removed
along with the old API and its implementation.
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
index 4441e9b..b21a8f1 100644
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -545,6 +545,7 @@
seed,
seed_length ) );
}
+#if defined(PSA_PRE_1_0_KEY_DERIVATION)
else
{
// legacy
@@ -554,6 +555,7 @@
seed, seed_length,
sizeof( output ) ) );
}
+#endif
PSA_ASSERT( psa_key_derivation_output_bytes( &operation,
output,
sizeof( output ) ) );
@@ -1776,7 +1778,7 @@
}
/* END_CASE */
-/* BEGIN_CASE */
+/* BEGIN_CASE depends_on:PSA_PRE_1_0_KEY_DERIVATION */
void derive_key_policy( int policy_usage,
int policy_alg,
int key_type,
@@ -4024,7 +4026,7 @@
}
/* END_CASE */
-/* BEGIN_CASE */
+/* BEGIN_CASE depends_on:PSA_PRE_1_0_KEY_DERIVATION */
void derive_setup( int key_type_arg,
data_t *key_data,
int alg_arg,
@@ -4063,7 +4065,7 @@
}
/* END_CASE */
-/* BEGIN_CASE */
+/* BEGIN_CASE depends_on:PSA_PRE_1_0_KEY_DERIVATION */
void test_derive_invalid_key_derivation_state( )
{
psa_key_handle_t handle = 0;
@@ -4199,6 +4201,7 @@
PSA_KEY_DERIVATION_INPUT_INFO,
label->x, label->len ) );
}
+#if defined(PSA_PRE_1_0_KEY_DERIVATION)
else
{
// legacy
@@ -4207,6 +4210,7 @@
label->x, label->len,
requested_capacity ) );
}
+#endif
PSA_ASSERT( psa_key_derivation_get_capacity( &operation,
¤t_capacity ) );
TEST_EQUAL( current_capacity, requested_capacity );
@@ -4295,6 +4299,8 @@
PSA_KEY_DERIVATION_INPUT_INFO,
label->x, label->len ) );
}
+
+#if defined(PSA_PRE_1_0_KEY_DERIVATION)
else
{
// legacy
@@ -4303,6 +4309,7 @@
label->x, label->len,
requested_capacity ) );
}
+#endif
PSA_ASSERT( psa_key_derivation_get_capacity( &operation,
¤t_capacity ) );
TEST_EQUAL( current_capacity, expected_capacity );
@@ -4335,7 +4342,7 @@
}
/* END_CASE */
-/* BEGIN_CASE */
+/* BEGIN_CASE depends_on:PSA_PRE_1_0_KEY_DERIVATION */
void derive_key_exercise( int alg_arg,
data_t *key_data,
data_t *salt,
@@ -4395,7 +4402,7 @@
}
/* END_CASE */
-/* BEGIN_CASE */
+/* BEGIN_CASE depends_on:PSA_PRE_1_0_KEY_DERIVATION */
void derive_key_export( int alg_arg,
data_t *key_data,
data_t *salt,