Add function prototypes for psa_crypto_output fns

Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
David Horstmann 2023-11-08 14:33:05 +00:00
parent e6042ffc49
commit dfa14cbbcd

View File

@ -911,4 +911,43 @@ psa_status_t psa_crypto_input_copy_alloc(const uint8_t *input, size_t input_len,
*/
void psa_crypto_input_copy_free(psa_crypto_input_copy_t *input_copy);
typedef struct psa_crypto_output_copy_s {
uint8_t *original;
uint8_t *buffer;
size_t len;
} psa_crypto_output_copy_t;
/** Allocate a local copy of an output buffer.
*
* \note This does not copy any data from the original
* output buffer but only allocates a buffer
* whose contents will be copied back to the
* original in a future call to
* psa_crypto_output_copy_free().
*
* \param[in] output Pointer to output buffer.
* \param[in] output_len Length of the output buffer.
* \param[out] output_copy Pointer to a psa_crypto_output_copy_t struct to
* populate with the output copy.
* \return #PSA_SUCCESS, if the buffer was successfully
* copied.
* \return #PSA_ERROR_INSUFFICIENT_MEMORY, if a copy of
* the buffer cannot be allocated.
*/
psa_status_t psa_crypto_output_copy_alloc(uint8_t *output, size_t output_len,
psa_crypto_output_copy_t *output_copy);
/** Copy from a local copy of an output buffer back to the original, then
* free the local copy.
*
* \param[in] output_copy Pointer to a psa_crypto_output_copy_t struct
* populated by a previous call to
* psa_crypto_output_copy_alloc().
* \return #PSA_SUCCESS, if the output copy was
* successfully copied back to the original.
* \return #PSA_ERROR_CORRUPTION_DETECTED, if the output
* could not be copied back to the original.
*/
psa_status_t psa_crypto_output_copy_free(psa_crypto_output_copy_t *output_copy);
#endif /* PSA_CRYPTO_CORE_H */