Move parse_binary_string function to psa_crypto_helpers
Add test code for pbkdf2 in psa_exercise_key
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
diff --git a/tests/src/psa_exercise_key.c b/tests/src/psa_exercise_key.c
index 9ff408c..8335977 100644
--- a/tests/src/psa_exercise_key.c
+++ b/tests/src/psa_exercise_key.c
@@ -437,6 +437,18 @@
PSA_ASSERT(psa_key_derivation_input_bytes(operation,
PSA_KEY_DERIVATION_INPUT_LABEL,
input2, input2_length));
+ } else if (PSA_ALG_IS_PBKDF2(alg)) {
+ data_t input_cost = { (unsigned char *) input1, (uint32_t) input1_length };
+ PSA_ASSERT(psa_key_derivation_input_integer(operation,
+ PSA_KEY_DERIVATION_INPUT_COST,
+ parse_binary_string(&input_cost)));
+ PSA_ASSERT(psa_key_derivation_input_bytes(operation,
+ PSA_KEY_DERIVATION_INPUT_SALT,
+ input2,
+ input2_length));
+ PSA_ASSERT(psa_key_derivation_input_key(operation,
+ PSA_KEY_DERIVATION_INPUT_PASSWORD,
+ key));
} else {
TEST_FAIL("Key derivation algorithm not supported");
}