mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-10 07:36:28 -04:00
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>
This commit is contained in:
parent
89b4caab53
commit
8684ad548f
@ -5527,7 +5527,7 @@ psa_status_t psa_crypto_copy_input(const uint8_t *input, size_t input_len,
|
|||||||
uint8_t *input_copy, size_t input_copy_len)
|
uint8_t *input_copy, size_t input_copy_len)
|
||||||
{
|
{
|
||||||
if (input_len > 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);
|
memcpy(input_copy, input, input_len);
|
||||||
@ -5539,7 +5539,7 @@ psa_status_t psa_crypto_copy_output(const uint8_t *output_copy, size_t output_co
|
|||||||
uint8_t *output, size_t output_len)
|
uint8_t *output, size_t output_len)
|
||||||
{
|
{
|
||||||
if (output_len < output_copy_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);
|
memcpy(output, output_copy, output_copy_len);
|
||||||
return PSA_SUCCESS;
|
return PSA_SUCCESS;
|
||||||
|
@ -523,8 +523,8 @@ psa_status_t psa_verify_hash_builtin(
|
|||||||
* \param[out] input_copy_len Length of the local copy buffer.
|
* \param[out] input_copy_len Length of the local copy buffer.
|
||||||
* \return #PSA_SUCCESS, if the buffer was successfully
|
* \return #PSA_SUCCESS, if the buffer was successfully
|
||||||
* copied.
|
* copied.
|
||||||
* \return #PSA_ERROR_BUFFER_TOO_SMALL, if the local copy
|
* \return #PSA_ERROR_CORRUPTION_DETECTED, if the local
|
||||||
* is too small to hold contents of the
|
* copy is too small to hold contents of the
|
||||||
* input buffer.
|
* input buffer.
|
||||||
*/
|
*/
|
||||||
psa_status_t psa_crypto_copy_input(const uint8_t *input, size_t input_len,
|
psa_status_t psa_crypto_copy_input(const uint8_t *input, size_t input_len,
|
||||||
@ -538,7 +538,7 @@ psa_status_t psa_crypto_copy_input(const uint8_t *input, size_t input_len,
|
|||||||
* \param[out] output_len Length of the user-supplied output buffer.
|
* \param[out] output_len Length of the user-supplied output buffer.
|
||||||
* \return #PSA_SUCCESS, if the buffer was successfully
|
* \return #PSA_SUCCESS, if the buffer was successfully
|
||||||
* copied.
|
* copied.
|
||||||
* \return #PSA_ERROR_BUFFER_TOO_SMALL, if the
|
* \return #PSA_ERROR_CORRUPTION_DETECTED, if the
|
||||||
* user-supplied output buffer is too small to
|
* user-supplied output buffer is too small to
|
||||||
* hold the contents of the local buffer.
|
* hold the contents of the local buffer.
|
||||||
*/
|
*/
|
||||||
|
@ -4028,7 +4028,7 @@ PSA input buffer copy: copy buffer larger than required
|
|||||||
copy_input:10:20:PSA_SUCCESS
|
copy_input:10:20:PSA_SUCCESS
|
||||||
|
|
||||||
PSA input buffer copy: copy buffer too small
|
PSA input buffer copy: copy buffer too small
|
||||||
copy_input:20:10:PSA_ERROR_BUFFER_TOO_SMALL
|
copy_input:20:10:PSA_ERROR_CORRUPTION_DETECTED
|
||||||
|
|
||||||
PSA input buffer copy: zero-length source buffer
|
PSA input buffer copy: zero-length source buffer
|
||||||
copy_input:0:10:PSA_SUCCESS
|
copy_input:0:10:PSA_SUCCESS
|
||||||
@ -4043,7 +4043,7 @@ PSA output buffer copy: output buffer larger than required
|
|||||||
copy_output:10:20:PSA_SUCCESS
|
copy_output:10:20:PSA_SUCCESS
|
||||||
|
|
||||||
PSA output buffer copy: output buffer too small
|
PSA output buffer copy: output buffer too small
|
||||||
copy_output:20:10:PSA_ERROR_BUFFER_TOO_SMALL
|
copy_output:20:10:PSA_ERROR_CORRUPTION_DETECTED
|
||||||
|
|
||||||
PSA output buffer copy: zero-length source buffer
|
PSA output buffer copy: zero-length source buffer
|
||||||
copy_output:0:10:PSA_SUCCESS
|
copy_output:0:10:PSA_SUCCESS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user