Rename "output_copy" -> "local_output"
This helps to prevent confusion as it avoids overloading the word
"copy" as both an action and an object.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 2beef5f..3be67fc 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -5621,50 +5621,50 @@
local_input->length = 0;
}
-psa_status_t psa_crypto_output_copy_alloc(uint8_t *output, size_t output_len,
- psa_crypto_output_copy_t *output_copy)
+psa_status_t psa_crypto_local_output_alloc(uint8_t *output, size_t output_len,
+ psa_crypto_local_output_t *local_output)
{
- output_copy->original = NULL;
- output_copy->buffer = NULL;
- output_copy->length = 0;
+ local_output->original = NULL;
+ local_output->buffer = NULL;
+ local_output->length = 0;
if (output_len == 0) {
return PSA_SUCCESS;
}
- output_copy->buffer = mbedtls_calloc(output_len, 1);
- if (output_copy->buffer == NULL) {
+ local_output->buffer = mbedtls_calloc(output_len, 1);
+ if (local_output->buffer == NULL) {
/* Since we dealt with the zero-length case above, we know that
* a NULL return value means a failure of allocation. */
return PSA_ERROR_INSUFFICIENT_MEMORY;
}
- output_copy->length = output_len;
- output_copy->original = output;
+ local_output->length = output_len;
+ local_output->original = output;
return PSA_SUCCESS;
}
-psa_status_t psa_crypto_output_copy_free(psa_crypto_output_copy_t *output_copy)
+psa_status_t psa_crypto_local_output_free(psa_crypto_local_output_t *local_output)
{
psa_status_t status;
- if (output_copy->buffer == NULL) {
- output_copy->length = 0;
+ if (local_output->buffer == NULL) {
+ local_output->length = 0;
return PSA_SUCCESS;
}
- if (output_copy->original == NULL) {
+ if (local_output->original == NULL) {
/* We have an internal copy but nothing to copy back to. */
return PSA_ERROR_CORRUPTION_DETECTED;
}
- status = psa_crypto_copy_output(output_copy->buffer, output_copy->length,
- output_copy->original, output_copy->length);
+ status = psa_crypto_copy_output(local_output->buffer, local_output->length,
+ local_output->original, local_output->length);
if (status != PSA_SUCCESS) {
return status;
}
- mbedtls_free(output_copy->buffer);
- output_copy->buffer = NULL;
- output_copy->length = 0;
+ mbedtls_free(local_output->buffer);
+ local_output->buffer = NULL;
+ local_output->length = 0;
return PSA_SUCCESS;
}
diff --git a/library/psa_crypto_core.h b/library/psa_crypto_core.h
index a830d30..215b227 100644
--- a/library/psa_crypto_core.h
+++ b/library/psa_crypto_core.h
@@ -544,13 +544,13 @@
*/
void psa_crypto_local_input_free(psa_crypto_local_input_t *local_input);
-typedef struct psa_crypto_output_copy_s {
+typedef struct psa_crypto_local_output_s {
uint8_t *original;
uint8_t *buffer;
size_t length;
-} psa_crypto_output_copy_t;
+} psa_crypto_local_output_t;
-#define PSA_CRYPTO_OUTPUT_COPY_INIT { NULL, NULL, 0 }
+#define PSA_CRYPTO_LOCAL_OUTPUT_INIT { NULL, NULL, 0 }
/** Allocate a local copy of an output buffer.
*
@@ -558,31 +558,31 @@
* 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().
+ * psa_crypto_local_output_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.
+ * \param[out] local_output Pointer to a psa_crypto_local_output_t struct to
+ * populate with the local 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);
+psa_status_t psa_crypto_local_output_alloc(uint8_t *output, size_t output_len,
+ psa_crypto_local_output_t *local_output);
/** 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
+ * \param[in] local_output Pointer to a psa_crypto_local_output_t struct
* populated by a previous call to
- * psa_crypto_output_copy_alloc().
- * \return #PSA_SUCCESS, if the output copy was
+ * psa_crypto_local_output_alloc().
+ * \return #PSA_SUCCESS, if the local output 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);
+psa_status_t psa_crypto_local_output_free(psa_crypto_local_output_t *local_output);
#endif /* PSA_CRYPTO_CORE_H */