Switch error code to more appropriate value
Since we are internal rather than user-facing,
PSA_ERROR_CORRUPTION_DETECTED makes more sense than
PSA_ERROR_BUFFER_TOO_SMALL. Whilst it really is a buffer that is too
small, this error code is intended to indicate that a user-supplied
buffer is too small, not an internal one.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index b498a1a..359f8da 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -5527,7 +5527,7 @@
uint8_t *input_copy, size_t input_copy_len)
{
if (input_len > input_copy_len) {
- return PSA_ERROR_BUFFER_TOO_SMALL;
+ return PSA_ERROR_CORRUPTION_DETECTED;
}
memcpy(input_copy, input, input_len);
@@ -5539,7 +5539,7 @@
uint8_t *output, size_t output_len)
{
if (output_len < output_copy_len) {
- return PSA_ERROR_BUFFER_TOO_SMALL;
+ return PSA_ERROR_CORRUPTION_DETECTED;
}
memcpy(output, output_copy, output_copy_len);
return PSA_SUCCESS;