Fix psa_key_derivation_input_integer() not detecting bad state
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index ec5934e..69d037b 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -4751,6 +4751,12 @@
psa_status_t status;
psa_algorithm_t kdf_alg = psa_key_derivation_get_kdf_alg(operation);
+ if (kdf_alg == 0) {
+ /* This is a blank or aborted operation. */
+ status = PSA_ERROR_BAD_STATE;
+ goto exit;
+ }
+
status = psa_key_derivation_check_input_type(step, key_type);
if (status != PSA_SUCCESS) {
goto exit;