psa: zeroize static key buffer content when key slot is freed

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 8c2c543..f0ccf3d 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -1183,7 +1183,11 @@
 
 psa_status_t psa_remove_key_data_from_memory(psa_key_slot_t *slot)
 {
-#if !defined(MBEDTLS_PSA_STATIC_KEY_SLOTS)
+#if defined(MBEDTLS_PSA_STATIC_KEY_SLOTS)
+    if (slot->key.bytes > 0) {
+        mbedtls_platform_zeroize(slot->key.data, MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE);
+    }
+#else
     if (slot->key.data != NULL) {
         mbedtls_zeroize_and_free(slot->key.data, slot->key.bytes);
     }