From 569874ebda151dbc51a676cf14a5d8177a2e3f09 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 18 Jul 2019 13:52:30 +0200 Subject: [PATCH] Document more error codes --- include/psa/crypto.h | 16 +++++++++++++++- include/psa/crypto_values.h | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/psa/crypto.h b/include/psa/crypto.h index 4226587a8..d24bfaf24 100644 --- a/include/psa/crypto.h +++ b/include/psa/crypto.h @@ -1012,8 +1012,10 @@ static psa_hash_operation_t psa_hash_operation_init(void); * * \retval #PSA_SUCCESS * Success. + * \retval #PSA_ERROR_INVALID_ARGUMENT + * \p alg is not a hash algorithm. * \retval #PSA_ERROR_NOT_SUPPORTED - * \p alg is not supported or is not a hash algorithm. + * \p alg is not a supported hash algorithm. * \retval #PSA_ERROR_BAD_STATE * The operation state is not valid (already set up and not * subsequently completed). @@ -1951,6 +1953,14 @@ psa_status_t psa_cipher_update(psa_cipher_operation_t *operation, * * \retval #PSA_SUCCESS * Success. + * \retval #PSA_ERROR_INVALID_ARGUMENT + * The total input size passed to this operation is not valid for + * this particular algorithm. For example, the algorithm is a based + * on block cipher and requires a whole number of blocks, but the + * total input size is not a multiple of the block size. + * \retval #PSA_ERROR_INVALID_PADDING + * This is a decryption operation for an algorithm that includes + * padding, and the ciphertext does not contain valid padding. * \retval #PSA_ERROR_BAD_STATE * The operation state is not valid (not set up, IV required but * not set, or already completed). @@ -2695,6 +2705,7 @@ psa_status_t psa_aead_abort(psa_aead_operation_t *operation); * that make up the returned signature value. * * \retval #PSA_SUCCESS + * \retval #PSA_ERROR_NOT_PERMITTED * \retval #PSA_ERROR_BUFFER_TOO_SMALL * The size of the \p signature buffer is too small. You can * determine a sufficient buffer size by calling @@ -2745,6 +2756,7 @@ psa_status_t psa_asymmetric_sign(psa_key_handle_t handle, * \retval #PSA_ERROR_INVALID_SIGNATURE * The calculation was perfomed successfully, but the passed * signature is not a valid signature. + * \retval #PSA_ERROR_NOT_PERMITTED * \retval #PSA_ERROR_NOT_SUPPORTED * \retval #PSA_ERROR_INVALID_ARGUMENT * \retval #PSA_ERROR_INSUFFICIENT_MEMORY @@ -2792,6 +2804,7 @@ psa_status_t psa_asymmetric_verify(psa_key_handle_t handle, * that make up the returned output. * * \retval #PSA_SUCCESS + * \retval #PSA_ERROR_NOT_PERMITTED * \retval #PSA_ERROR_BUFFER_TOO_SMALL * The size of the \p output buffer is too small. You can * determine a sufficient buffer size by calling @@ -2848,6 +2861,7 @@ psa_status_t psa_asymmetric_encrypt(psa_key_handle_t handle, * that make up the returned output. * * \retval #PSA_SUCCESS + * \retval #PSA_ERROR_NOT_PERMITTED * \retval #PSA_ERROR_BUFFER_TOO_SMALL * The size of the \p output buffer is too small. You can * determine a sufficient buffer size by calling diff --git a/include/psa/crypto_values.h b/include/psa/crypto_values.h index 2c0acf326..ba867980a 100644 --- a/include/psa/crypto_values.h +++ b/include/psa/crypto_values.h @@ -149,7 +149,7 @@ * * \warning If a function returns this error, it is undetermined * whether the requested action has completed or not. Implementations - * should return #PSA_SUCCESS on successful completion whenver + * should return #PSA_SUCCESS on successful completion whenever * possible, however functions may return #PSA_ERROR_COMMUNICATION_FAILURE * if the requested action was completed successfully in an external * cryptoprocessor but there was a breakdown of communication before