diff options
author | Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com> | 2023-09-20 09:22:29 +0200 |
---|---|---|
committer | Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com> | 2023-09-20 09:22:29 +0200 |
commit | fbea9d2e7d004dfdd5f457d9a3f0d8d6581f4405 (patch) | |
tree | a4150bca66b4b0bb2b84442b2df8d727ea7ac757 /3rdparty | |
parent | 4f119b8f211abd6a8feba0e560281afd14092304 (diff) | |
download | mbedtls-fbea9d2e7d004dfdd5f457d9a3f0d8d6581f4405.zip mbedtls-fbea9d2e7d004dfdd5f457d9a3f0d8d6581f4405.tar.gz mbedtls-fbea9d2e7d004dfdd5f457d9a3f0d8d6581f4405.tar.bz2 |
Improve return code
CORRUPTION_DETECTED should be reserved for cases that are impossible,
short of physical corruption during execution or a major bug in the
code. We shouldn't use this for the kind of mistakes that can happen
during configuration or integration, such as calling a driver on a key
type that it doesn't support.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
Diffstat (limited to '3rdparty')
-rw-r--r-- | 3rdparty/p256-m/p256-m_driver_entrypoints.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/3rdparty/p256-m/p256-m_driver_entrypoints.c b/3rdparty/p256-m/p256-m_driver_entrypoints.c index 0ca5583..b75c06c 100644 --- a/3rdparty/p256-m/p256-m_driver_entrypoints.c +++ b/3rdparty/p256-m/p256-m_driver_entrypoints.c @@ -130,7 +130,7 @@ psa_status_t p256_transparent_export_public_key(const psa_key_attributes_t *attr /* Validate sizes, as p256-m expects fixed-size buffers */ if (key_buffer_size != PRIVKEY_SIZE) { - return PSA_ERROR_CORRUPTION_DETECTED; + return PSA_ERROR_INVALID_ARGUMENT; } if (data_size < PSA_PUBKEY_SIZE) { return PSA_ERROR_BUFFER_TOO_SMALL; @@ -231,7 +231,7 @@ psa_status_t p256_transparent_sign_hash( /* Validate sizes, as p256-m expects fixed-size buffers */ if (key_buffer_size != PRIVKEY_SIZE) { - return PSA_ERROR_CORRUPTION_DETECTED; + return PSA_ERROR_INVALID_ARGUMENT; } if (signature_size < SIGNATURE_SIZE) { return PSA_ERROR_BUFFER_TOO_SMALL; @@ -257,7 +257,7 @@ static psa_status_t p256_verify_hash_with_public_key( { /* Validate sizes, as p256-m expects fixed-size buffers */ if (key_buffer_size != PSA_PUBKEY_SIZE || *key_buffer != PSA_PUBKEY_HEADER_BYTE) { - return PSA_ERROR_CORRUPTION_DETECTED; + return PSA_ERROR_INVALID_ARGUMENT; } if (signature_length != SIGNATURE_SIZE) { return PSA_ERROR_INVALID_SIGNATURE; |