Add pbkdf2 to psa_key_derivation_abort
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 849bb95..a289895 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -5094,6 +5094,25 @@
sizeof(operation->ctx.tls12_ecjpake_to_pms.data));
} else
#endif /* defined(MBEDTLS_PSA_BUILTIN_ALG_TLS12_ECJPAKE_TO_PMS) */
+#if defined(MBEDTLS_PSA_BUILTIN_ALG_PBKDF2_HMAC)
+ if (PSA_ALG_IS_PBKDF2_HMAC(kdf_alg)) {
+ if (operation->ctx.pbkdf2.input_cost != 0U) {
+ operation->ctx.pbkdf2.input_cost = 0U;
+ }
+ if (operation->ctx.pbkdf2.salt != NULL) {
+ mbedtls_platform_zeroize(operation->ctx.pbkdf2.salt,
+ operation->ctx.pbkdf2.salt_length);
+ mbedtls_free(operation->ctx.pbkdf2.salt);
+ }
+ if (operation->ctx.pbkdf2.password != NULL) {
+ mbedtls_platform_zeroize(operation->ctx.pbkdf2.password,
+ operation->ctx.pbkdf2.password_length);
+ mbedtls_free(operation->ctx.pbkdf2.password);
+ }
+
+ status = PSA_SUCCESS;
+ } else
+#endif /* defined(MBEDTLS_PSA_BUILTIN_ALG_PBKDF2_HMAC) */
{
status = PSA_ERROR_BAD_STATE;
}