Added fn for vendor key creation
diff --git a/include/psa/crypto_accel_driver.h b/include/psa/crypto_accel_driver.h
index 803bb70..53ddc5c 100644
--- a/include/psa/crypto_accel_driver.h
+++ b/include/psa/crypto_accel_driver.h
@@ -114,6 +114,20 @@
*/
psa_status_t psa_generate_symmetric_vendor(psa_key_type_t type, size_t bits, uint8_t * output, size_t output_size);
+/** Finalize the creation of a vendor defined key once its key material has been set.
+ *
+ * This entails writing the key to persistent storage.
+ *
+ * This function is to be called only by psa_finish_key_creation().
+ *
+ * \param[in,out] slot Pointer to the slot with key material.
+ *
+ * \retval #PSA_SUCCESS
+ * The key was successfully created. The handle is now valid.
+ * \return If this function fails, the key slot is an invalid state.
+ */
+psa_status_t psa_finish_key_creation_vendor(psa_key_slot_t *slot);
+
/**
* \brief Perform vendor specific setup for cipher operations.
*
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 850a6dc..c4dd36f 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -1321,7 +1321,7 @@
}
#endif /* defined(MBEDTLS_RSA_C) || defined(MBEDTLS_ECP_C) */
-static psa_status_t psa_internal_export_key( const psa_key_slot_t *slot,
+psa_status_t psa_internal_export_key( const psa_key_slot_t *slot,
uint8_t *data,
size_t data_size,
size_t *data_length,
@@ -1732,6 +1732,13 @@
}
else
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
+#if defined (MBEDTLS_PSA_CRYPTO_ACCEL_DRV_C)
+ if (PSA_KEY_LIFETIME_IS_VENDOR_DEFINED(slot->attr.lifetime))
+ {
+ status = psa_finish_key_creation_vendor( slot );
+ }
+ else
+#endif /* MBEDTLS_PSA_CRYPTO_ACCEL_DRV_C */
{
size_t buffer_size =
PSA_KEY_EXPORT_MAX_SIZE( slot->attr.type,