Add implementation of psa_crypto_copy_and_free()
Signed-off-by: David Horstmann <david.horstmann@arm.com>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 9def0a7..f0599d7 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -5600,4 +5600,18 @@
return ret;
}
+psa_status_t psa_crypto_copy_and_free(psa_crypto_buffer_copy_t *buffers)
+{
+ if (buffers->output != NULL) {
+ memcpy(buffers->output_original, buffers->output, buffers->output_len);
+ }
+
+ mbedtls_free(buffers->input);
+ buffers->input = NULL;
+ mbedtls_free(buffers->output);
+ buffers->output = NULL;
+
+ return PSA_SUCCESS;
+}
+
#endif /* MBEDTLS_PSA_CRYPTO_C */