1 /* Copyright (c) 2024 Nordic Semiconductor
2  * SPDX-License-Identifier: Apache-2.0
3  */
4 #ifndef PSA_ERROR_H
5 #define PSA_ERROR_H
6 /**
7  * @file psa/error.h Return values of the PSA Secure Storage API.
8  * @ingroup psa_secure_storage
9  * @{
10  */
11 #include <stdint.h>
12 
13 /** Function return status. Either `PSA_SUCCESS` or one of the defined `PSA_ERROR_*` values. */
14 typedef int32_t psa_status_t;
15 
16 /** The operation completed successfully. */
17 #define PSA_SUCCESS ((psa_status_t)0)
18 
19 /** An unspecified internal failure happened. */
20 #define PSA_ERROR_GENERIC_ERROR        ((psa_status_t)-132)
21 
22 /** An entry associated with the provided `uid` already
23  *  exists and was created with `PSA_STORAGE_FLAG_WRITE_ONCE`.
24  */
25 #define PSA_ERROR_NOT_PERMITTED        ((psa_status_t)-133)
26 
27 /** The function is not supported or one or more of the flags
28  *  provided in `create_flags` are not supported or not valid.
29  */
30 #define PSA_ERROR_NOT_SUPPORTED        ((psa_status_t)-134)
31 
32 /** One or more arguments other than `create_flags` are invalid. */
33 #define PSA_ERROR_INVALID_ARGUMENT     ((psa_status_t)-135)
34 
35 /** An entry with the provided `uid` already exists. */
36 #define PSA_ERROR_ALREADY_EXISTS       ((psa_status_t)-139)
37 
38 /** The provided `uid` was not found in the storage. */
39 #define PSA_ERROR_DOES_NOT_EXIST       ((psa_status_t)-140)
40 
41 /** There is insufficient space on the storage medium. */
42 #define PSA_ERROR_INSUFFICIENT_STORAGE ((psa_status_t)-142)
43 
44 /** The physical storage has failed (fatal error). */
45 #define PSA_ERROR_STORAGE_FAILURE      ((psa_status_t)-146)
46 
47 /** The data associated with `uid` failed authentication. */
48 #define PSA_ERROR_INVALID_SIGNATURE    ((psa_status_t)-149)
49 
50 /** The data associated with `uid` is corrupt. */
51 #define PSA_ERROR_DATA_CORRUPT         ((psa_status_t)-152)
52 
53 /** @} */
54 #endif
55