Skip to content

Commit cbe31ee

Browse files
author
David Saada
committed
Replace PSA error code definitions with the ones defined in PSA spec
1 parent 2d7e5fe commit cbe31ee

15 files changed

+107
-115
lines changed

include/psa/crypto.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ psa_algorithm_t psa_key_policy_get_algorithm(const psa_key_policy_t *policy);
193193
* the policy has been saved to persistent storage. Implementations
194194
* may defer saving the policy until the key material is created.
195195
* \retval #PSA_ERROR_INVALID_HANDLE
196-
* \retval #PSA_ERROR_OCCUPIED_SLOT
196+
* \retval #PSA_ERROR_ALREADY_EXISTS
197197
* \retval #PSA_ERROR_NOT_SUPPORTED
198198
* \retval #PSA_ERROR_INVALID_ARGUMENT
199199
* \retval #PSA_ERROR_COMMUNICATION_FAILURE
@@ -285,7 +285,7 @@ psa_status_t psa_allocate_key(psa_key_handle_t *handle);
285285
* Success. The application can now use the value of `*handle`
286286
* to access the newly allocated key slot.
287287
* \retval #PSA_ERROR_INSUFFICIENT_MEMORY
288-
* \retval #PSA_ERROR_EMPTY_SLOT
288+
* \retval #PSA_ERROR_DOES_NOT_EXIST
289289
* \retval #PSA_ERROR_INVALID_ARGUMENT
290290
* \p lifetime is invalid, for example #PSA_KEY_LIFETIME_VOLATILE.
291291
* \retval #PSA_ERROR_INVALID_ARGUMENT
@@ -322,7 +322,7 @@ psa_status_t psa_open_key(psa_key_lifetime_t lifetime,
322322
* to access the newly allocated key slot.
323323
* \retval #PSA_ERROR_INSUFFICIENT_MEMORY
324324
* \retval #PSA_ERROR_INSUFFICIENT_STORAGE
325-
* \retval #PSA_ERROR_OCCUPIED_SLOT
325+
* \retval #PSA_ERROR_ALREADY_EXISTS
326326
* There is already a key with the identifier \p id in the storage
327327
* area designated by \p lifetime.
328328
* \retval #PSA_ERROR_INVALID_ARGUMENT
@@ -401,7 +401,7 @@ psa_status_t psa_close_key(psa_key_handle_t handle);
401401
* \retval #PSA_ERROR_INVALID_ARGUMENT
402402
* The key slot is invalid,
403403
* or the key data is not correctly formatted.
404-
* \retval #PSA_ERROR_OCCUPIED_SLOT
404+
* \retval #PSA_ERROR_ALREADY_EXISTS
405405
* There is already a key in the specified slot.
406406
* \retval #PSA_ERROR_INSUFFICIENT_MEMORY
407407
* \retval #PSA_ERROR_INSUFFICIENT_STORAGE
@@ -470,7 +470,7 @@ psa_status_t psa_destroy_key(psa_key_handle_t handle);
470470
*
471471
* \retval #PSA_SUCCESS
472472
* \retval #PSA_ERROR_INVALID_HANDLE
473-
* \retval #PSA_ERROR_EMPTY_SLOT
473+
* \retval #PSA_ERROR_DOES_NOT_EXIST
474474
* The handle is to a key slot which does not contain key material yet.
475475
* \retval #PSA_ERROR_COMMUNICATION_FAILURE
476476
* \retval #PSA_ERROR_HARDWARE_FAILURE
@@ -554,7 +554,7 @@ psa_status_t psa_get_key_information(psa_key_handle_t handle,
554554
*
555555
* \retval #PSA_SUCCESS
556556
* \retval #PSA_ERROR_INVALID_HANDLE
557-
* \retval #PSA_ERROR_EMPTY_SLOT
557+
* \retval #PSA_ERROR_DOES_NOT_EXIST
558558
* \retval #PSA_ERROR_NOT_PERMITTED
559559
* \retval #PSA_ERROR_NOT_SUPPORTED
560560
* \retval #PSA_ERROR_BUFFER_TOO_SMALL
@@ -641,7 +641,7 @@ psa_status_t psa_export_key(psa_key_handle_t handle,
641641
*
642642
* \retval #PSA_SUCCESS
643643
* \retval #PSA_ERROR_INVALID_HANDLE
644-
* \retval #PSA_ERROR_EMPTY_SLOT
644+
* \retval #PSA_ERROR_DOES_NOT_EXIST
645645
* \retval #PSA_ERROR_INVALID_ARGUMENT
646646
* The key is neither a public key nor a key pair.
647647
* \retval #PSA_ERROR_NOT_SUPPORTED
@@ -710,9 +710,9 @@ psa_status_t psa_export_public_key(psa_key_handle_t handle,
710710
*
711711
* \retval #PSA_SUCCESS
712712
* \retval #PSA_ERROR_INVALID_HANDLE
713-
* \retval #PSA_ERROR_OCCUPIED_SLOT
713+
* \retval #PSA_ERROR_ALREADY_EXISTS
714714
* \p target already contains key material.
715-
* \retval #PSA_ERROR_EMPTY_SLOT
715+
* \retval #PSA_ERROR_DOES_NOT_EXIST
716716
* \p source does not contain key material.
717717
* \retval #PSA_ERROR_INVALID_ARGUMENT
718718
* The policy constraints on the source, on the target and
@@ -1071,7 +1071,7 @@ static psa_mac_operation_t psa_mac_operation_init(void);
10711071
* \retval #PSA_SUCCESS
10721072
* Success.
10731073
* \retval #PSA_ERROR_INVALID_HANDLE
1074-
* \retval #PSA_ERROR_EMPTY_SLOT
1074+
* \retval #PSA_ERROR_DOES_NOT_EXIST
10751075
* \retval #PSA_ERROR_NOT_PERMITTED
10761076
* \retval #PSA_ERROR_INVALID_ARGUMENT
10771077
* \p key is not compatible with \p alg.
@@ -1128,7 +1128,7 @@ psa_status_t psa_mac_sign_setup(psa_mac_operation_t *operation,
11281128
* \retval #PSA_SUCCESS
11291129
* Success.
11301130
* \retval #PSA_ERROR_INVALID_HANDLE
1131-
* \retval #PSA_ERROR_EMPTY_SLOT
1131+
* \retval #PSA_ERROR_DOES_NOT_EXIST
11321132
* \retval #PSA_ERROR_NOT_PERMITTED
11331133
* \retval #PSA_ERROR_INVALID_ARGUMENT
11341134
* \c key is not compatible with \c alg.
@@ -1373,7 +1373,7 @@ static psa_cipher_operation_t psa_cipher_operation_init(void);
13731373
* \retval #PSA_SUCCESS
13741374
* Success.
13751375
* \retval #PSA_ERROR_INVALID_HANDLE
1376-
* \retval #PSA_ERROR_EMPTY_SLOT
1376+
* \retval #PSA_ERROR_DOES_NOT_EXIST
13771377
* \retval #PSA_ERROR_NOT_PERMITTED
13781378
* \retval #PSA_ERROR_INVALID_ARGUMENT
13791379
* \p key is not compatible with \p alg.
@@ -1432,7 +1432,7 @@ psa_status_t psa_cipher_encrypt_setup(psa_cipher_operation_t *operation,
14321432
* \retval #PSA_SUCCESS
14331433
* Success.
14341434
* \retval #PSA_ERROR_INVALID_HANDLE
1435-
* \retval #PSA_ERROR_EMPTY_SLOT
1435+
* \retval #PSA_ERROR_DOES_NOT_EXIST
14361436
* \retval #PSA_ERROR_NOT_PERMITTED
14371437
* \retval #PSA_ERROR_INVALID_ARGUMENT
14381438
* \p key is not compatible with \p alg.
@@ -1660,7 +1660,7 @@ psa_status_t psa_cipher_abort(psa_cipher_operation_t *operation);
16601660
* \retval #PSA_SUCCESS
16611661
* Success.
16621662
* \retval #PSA_ERROR_INVALID_HANDLE
1663-
* \retval #PSA_ERROR_EMPTY_SLOT
1663+
* \retval #PSA_ERROR_DOES_NOT_EXIST
16641664
* \retval #PSA_ERROR_NOT_PERMITTED
16651665
* \retval #PSA_ERROR_INVALID_ARGUMENT
16661666
* \p key is not compatible with \p alg.
@@ -1716,7 +1716,7 @@ psa_status_t psa_aead_encrypt(psa_key_handle_t handle,
17161716
* \retval #PSA_SUCCESS
17171717
* Success.
17181718
* \retval #PSA_ERROR_INVALID_HANDLE
1719-
* \retval #PSA_ERROR_EMPTY_SLOT
1719+
* \retval #PSA_ERROR_DOES_NOT_EXIST
17201720
* \retval #PSA_ERROR_INVALID_SIGNATURE
17211721
* The ciphertext is not authentic.
17221722
* \retval #PSA_ERROR_NOT_PERMITTED
@@ -2034,7 +2034,7 @@ psa_status_t psa_get_generator_capacity(const psa_crypto_generator_t *generator,
20342034
* \param output_length Number of bytes to output.
20352035
*
20362036
* \retval #PSA_SUCCESS
2037-
* \retval #PSA_ERROR_INSUFFICIENT_CAPACITY
2037+
* \retval #PSA_ERROR_INSUFFICIENT_DATA
20382038
* There were fewer than \p output_length bytes
20392039
* in the generator. Note that in this case, no
20402040
* output is written to the output buffer.
@@ -2076,7 +2076,7 @@ psa_status_t psa_generator_read(psa_crypto_generator_t *generator,
20762076
* Success.
20772077
* If the key is persistent, the key material and the key's metadata
20782078
* have been saved to persistent storage.
2079-
* \retval #PSA_ERROR_INSUFFICIENT_CAPACITY
2079+
* \retval #PSA_ERROR_INSUFFICIENT_DATA
20802080
* There were fewer than \p output_length bytes
20812081
* in the generator. Note that in this case, no
20822082
* output is written to the output buffer.
@@ -2088,7 +2088,7 @@ psa_status_t psa_generator_read(psa_crypto_generator_t *generator,
20882088
* implementation in general or in this particular slot.
20892089
* \retval #PSA_ERROR_BAD_STATE
20902090
* \retval #PSA_ERROR_INVALID_HANDLE
2091-
* \retval #PSA_ERROR_OCCUPIED_SLOT
2091+
* \retval #PSA_ERROR_ALREADY_EXISTS
20922092
* There is already a key in the specified slot.
20932093
* \retval #PSA_ERROR_INSUFFICIENT_MEMORY
20942094
* \retval #PSA_ERROR_INSUFFICIENT_STORAGE
@@ -2172,7 +2172,7 @@ psa_status_t psa_generator_abort(psa_crypto_generator_t *generator);
21722172
* \retval #PSA_SUCCESS
21732173
* Success.
21742174
* \retval #PSA_ERROR_INVALID_HANDLE
2175-
* \retval #PSA_ERROR_EMPTY_SLOT
2175+
* \retval #PSA_ERROR_DOES_NOT_EXIST
21762176
* \retval #PSA_ERROR_NOT_PERMITTED
21772177
* \retval #PSA_ERROR_INVALID_ARGUMENT
21782178
* \c key is not compatible with \c alg,
@@ -2233,7 +2233,7 @@ psa_status_t psa_key_derivation(psa_crypto_generator_t *generator,
22332233
* \retval #PSA_SUCCESS
22342234
* Success.
22352235
* \retval #PSA_ERROR_INVALID_HANDLE
2236-
* \retval #PSA_ERROR_EMPTY_SLOT
2236+
* \retval #PSA_ERROR_DOES_NOT_EXIST
22372237
* \retval #PSA_ERROR_NOT_PERMITTED
22382238
* \retval #PSA_ERROR_INVALID_ARGUMENT
22392239
* \c private_key is not compatible with \c alg,
@@ -2332,7 +2332,7 @@ typedef struct {
23322332
* If the key is persistent, the key material and the key's metadata
23332333
* have been saved to persistent storage.
23342334
* \retval #PSA_ERROR_INVALID_HANDLE
2335-
* \retval #PSA_ERROR_OCCUPIED_SLOT
2335+
* \retval #PSA_ERROR_ALREADY_EXISTS
23362336
* There is already a key in the specified slot.
23372337
* \retval #PSA_ERROR_NOT_SUPPORTED
23382338
* \retval #PSA_ERROR_INVALID_ARGUMENT

include/psa/crypto_se_driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ typedef psa_status_t (*psa_drv_destroy_key_t)(psa_key_slot_t key);
754754
* that make up the key data.
755755
*
756756
* \retval #PSA_SUCCESS
757-
* \retval #PSA_ERROR_EMPTY_SLOT
757+
* \retval #PSA_ERROR_DOES_NOT_EXIST
758758
* \retval #PSA_ERROR_NOT_PERMITTED
759759
* \retval #PSA_ERROR_NOT_SUPPORTED
760760
* \retval #PSA_ERROR_COMMUNICATION_FAILURE

include/psa/crypto_types.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,13 @@
4747
* This is either #PSA_SUCCESS (which is zero), indicating success,
4848
* or a nonzero value indicating that an error occurred. Errors are
4949
* encoded as one of the \c PSA_ERROR_xxx values defined here.
50+
* If #PSA_SUCCESS is already defined, it means that #psa_status_t
51+
* is also defined in an external header, so prevent its multiple
52+
* definition.
5053
*/
54+
#ifndef PSA_SUCCESS
5155
typedef int32_t psa_status_t;
56+
#endif
5257

5358
/**@}*/
5459

0 commit comments

Comments
 (0)