Skip to content

Commit 7eaa219

Browse files
committed
psa: Add backwards compatible error codes
Add deprecated error codes to help transition between the previous version of the PSA Crypto specification and the current one.
1 parent 1ac5e6a commit 7eaa219

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

include/psa/crypto_values.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
* Implementations may use this error code if none of the other standard
5252
* error codes are applicable. */
5353
#define PSA_ERROR_GENERIC_ERROR ((psa_status_t)-132)
54+
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
55+
#define PSA_ERROR_UNKNOWN_ERROR \
56+
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_GENERIC_ERROR )
57+
#endif
5458

5559
/** The requested operation or a parameter is not supported
5660
* by this implementation.
@@ -91,12 +95,20 @@
9195
* Implementations should return this error, when attempting
9296
* to write an item (like a key) that already exists. */
9397
#define PSA_ERROR_ALREADY_EXISTS ((psa_status_t)-139)
98+
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
99+
#define PSA_ERROR_OCCUPIED_SLOT \
100+
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_ALREADY_EXISTS )
101+
#endif
94102

95103
/** Asking for an item that doesn't exist
96104
*
97105
* Implementations should return this error, if a requested item (like
98106
* a key) does not exist. */
99107
#define PSA_ERROR_DOES_NOT_EXIST ((psa_status_t)-140)
108+
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
109+
#define PSA_ERROR_EMPTY_SLOT \
110+
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_DOES_NOT_EXIST )
111+
#endif
100112

101113
/** The requested action cannot be performed in the current state.
102114
*
@@ -268,6 +280,10 @@
268280
/** Return this error when there's insufficient data when attempting
269281
* to read from a resource. */
270282
#define PSA_ERROR_INSUFFICIENT_DATA ((psa_status_t)-143)
283+
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
284+
#define PSA_ERROR_INSUFFICIENT_CAPACITY \
285+
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_INSUFFICIENT_DATA )
286+
#endif
271287

272288
/** The key handle is not valid.
273289
*/

0 commit comments

Comments
 (0)