1 /*
2  * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef PSA_ERROR_H
8 #define PSA_ERROR_H
9 
10 #include <stdint.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /*
17   * Standard PSA error codes for the SPM and RoT Services
18  * As defined in PSA Firmware Framework v1.0
19  */
20 
21 typedef int32_t psa_status_t;
22 
23 #define PSA_SUCCESS			            ((psa_status_t)0)
24 #define PSA_ERROR_PROGRAMMER_ERROR	    ((psa_status_t)-129)
25 #define PSA_ERROR_CONNECTION_REFUSED	((psa_status_t)-130)
26 #define PSA_ERROR_CONNECTION_BUSY	    ((psa_status_t)-131)
27 #define PSA_ERROR_GENERIC_ERROR		    ((psa_status_t)-132)
28 #define PSA_ERROR_NOT_PERMITTED		    ((psa_status_t)-133)
29 #define PSA_ERROR_NOT_SUPPORTED		    ((psa_status_t)-134)
30 #define PSA_ERROR_INVALID_ARGUMENT	    ((psa_status_t)-135)
31 #define PSA_ERROR_INVALID_HANDLE	    ((psa_status_t)-136)
32 #define PSA_ERROR_BAD_STATE		        ((psa_status_t)-137)
33 #define PSA_ERROR_BUFFER_TOO_SMALL	    ((psa_status_t)-138)
34 #define PSA_ERROR_ALREADY_EXISTS	    ((psa_status_t)-139)
35 #define PSA_ERROR_DOES_NOT_EXIST	    ((psa_status_t)-140)
36 #define PSA_ERROR_INSUFFICIENT_MEMORY	((psa_status_t)-141)
37 #define PSA_ERROR_INSUFFICIENT_STORAGE	((psa_status_t)-142)
38 #define PSA_ERROR_INSUFFICIENT_DATA	    ((psa_status_t)-143)
39 #define PSA_ERROR_SERVICE_FAILURE	    ((psa_status_t)-144)
40 #define PSA_ERROR_COMMUNICATION_FAILURE	((psa_status_t)-145)
41 #define PSA_ERROR_STORAGE_FAILURE	    ((psa_status_t)-146)
42 #define PSA_STATUS_HARDWARE_FAILURE	    ((psa_status_t)-147)
43 #define PSA_ERROR_INVALID_SIGNATURE	    ((psa_status_t)-149)
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif /* PSA_ERROR_H */
50