1 /*
2  * Copyright (c) 2017-2020 ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef _BSV_ERROR_H
8 #define _BSV_ERROR_H
9 
10 #ifdef __cplusplus
11 extern "C"
12 {
13 #endif
14 
15 /*!
16 @file
17 @brief This file defines the error code types that are returned from the Boot Services APIs.
18 
19 @defgroup cc_bsv_error CryptoCell Boot Services error codes
20 @{
21 @ingroup cc_bsv
22 */
23 
24 /*! Defines the base address for Boot Services errors. */
25 #define CC_BSV_BASE_ERROR                             0x0B000000
26 /*! Defines the base address for Boot Services cryptographic errors. */
27 #define CC_BSV_CRYPTO_ERROR                           0x0C000000
28 
29 /*! Illegal input parameter. */
30 #define CC_BSV_ILLEGAL_INPUT_PARAM_ERR                (CC_BSV_BASE_ERROR + 0x00000001)
31 /*! Illegal HUK value. */
32 #define CC_BSV_ILLEGAL_HUK_VALUE_ERR                  (CC_BSV_BASE_ERROR + 0x00000002)
33 /*! Illegal Kcp value. */
34 #define CC_BSV_ILLEGAL_KCP_VALUE_ERR                  (CC_BSV_BASE_ERROR + 0x00000003)
35 /*! Illegal Kce value. */
36 #define CC_BSV_ILLEGAL_KCE_VALUE_ERR                  (CC_BSV_BASE_ERROR + 0x00000004)
37 /*! Illegal Kpicv value. */
38 #define CC_BSV_ILLEGAL_KPICV_VALUE_ERR                (CC_BSV_BASE_ERROR + 0x00000005)
39 /*! Illegal Kceicv value. */
40 #define CC_BSV_ILLEGAL_KCEICV_VALUE_ERR               (CC_BSV_BASE_ERROR + 0x00000006)
41 /*! Illegal EKcst value. */
42 #define CC_BSV_ILLEGAL_EKCST_VALUE_ERR                (CC_BSV_BASE_ERROR + 0x00000007)
43 /*! Hash boot key not programmed in the OTP. */
44 #define CC_BSV_HASH_NOT_PROGRAMMED_ERR                (CC_BSV_BASE_ERROR + 0x00000008)
45 /*! Illegal Hash boot key zero count in the OTP. */
46 #define CC_BSV_HBK_ZERO_COUNT_ERR                     (CC_BSV_BASE_ERROR + 0x00000009)
47 /*! Illegal LCS. */
48 #define CC_BSV_ILLEGAL_LCS_ERR                        (CC_BSV_BASE_ERROR + 0x0000000A)
49 /*! OTP write compare failure. */
50 #define CC_BSV_OTP_WRITE_CMP_FAIL_ERR                 (CC_BSV_BASE_ERROR + 0x0000000B)
51 /*! OTP access error */
52 #define CC_BSV_OTP_ACCESS_ERR                         (CC_BSV_BASE_ERROR + 0x0000000C)
53 /*! Erase key in OTP failed. */
54 #define CC_BSV_ERASE_KEY_FAILED_ERR                   (CC_BSV_BASE_ERROR + 0x0000000D)
55 /*! Illegal PIDR. */
56 #define CC_BSV_ILLEGAL_PIDR_ERR                       (CC_BSV_BASE_ERROR + 0x0000000E)
57 /*! Illegal CIDR. */
58 #define CC_BSV_ILLEGAL_CIDR_ERR                       (CC_BSV_BASE_ERROR + 0x0000000F)
59 /*! Device failed to move to fatal error state. */
60 #define CC_BSV_FAILED_TO_SET_FATAL_ERR                (CC_BSV_BASE_ERROR + 0x00000010)
61 /*! Failed to set RMA LCS. */
62 #define CC_BSV_FAILED_TO_SET_RMA_ERR                  (CC_BSV_BASE_ERROR + 0x00000011)
63 /*! Illegal RMA indication. */
64 #define CC_BSV_ILLEGAL_RMA_INDICATION_ERR             (CC_BSV_BASE_ERROR + 0x00000012)
65 /*! Boot Services version is not initialized. */
66 #define CC_BSV_VER_IS_NOT_INITIALIZED_ERR             (CC_BSV_BASE_ERROR + 0x00000013)
67 /*! APB secure mode is locked. */
68 #define CC_BSV_APB_SECURE_IS_LOCKED_ERR               (CC_BSV_BASE_ERROR + 0x00000014)
69 /*! APB privilege mode is locked. */
70 #define CC_BSV_APB_PRIVILEG_IS_LOCKED_ERR             (CC_BSV_BASE_ERROR + 0x00000015)
71 /*! Illegal operation. */
72 #define CC_BSV_ILLEGAL_OPERATION_ERR                  (CC_BSV_BASE_ERROR + 0x00000016)
73 /*! Illegal asset size. */
74 #define CC_BSV_ILLEGAL_ASSET_SIZE_ERR                 (CC_BSV_BASE_ERROR + 0x00000017)
75 /*! Illegal asset value. */
76 #define CC_BSV_ILLEGAL_ASSET_VAL_ERR                  (CC_BSV_BASE_ERROR + 0x00000018)
77 /*! Kpicv is locked. */
78 #define CC_BSV_KPICV_IS_LOCKED_ERR                    (CC_BSV_BASE_ERROR + 0x00000019)
79 /*! Illegal SW version. */
80 #define CC_BSV_ILLEGAL_SW_VERSION_ERR                 (CC_BSV_BASE_ERROR + 0x0000001A)
81 /*! AO write operation. */
82 #define CC_BSV_AO_WRITE_FAILED_ERR                    (CC_BSV_BASE_ERROR + 0x0000001B)
83 /*! Chip state is already initialized. */
84 #define CC_BSV_CHIP_INITIALIZED_ERR                   (CC_BSV_BASE_ERROR + 0x0000001C)
85 /*! SP is not enabled. */
86 #define CC_BSV_SP_NOT_ENABLED_ERR                     (CC_BSV_BASE_ERROR + 0x0000001D)
87 /*! Production secure provisioning - header fields. */
88 #define CC_BSV_PROD_PKG_HEADER_ERR                    (CC_BSV_BASE_ERROR + 0x0000001E)
89 /*! Production secure provisioning - header MAC. */
90 #define CC_BSV_PROD_PKG_HEADER_MAC_ERR                (CC_BSV_BASE_ERROR + 0x0000001F)
91 /*! Overrun buffer or size. */
92 #define CC_BSV_OVERRUN_ERR                            (CC_BSV_BASE_ERROR + 0x00000020)
93 /*! Kceicv is locked. */
94 #define CC_BSV_KCEICV_IS_LOCKED_ERR                   (CC_BSV_BASE_ERROR + 0x00000021)
95 /*! Chip indication is CHIP_STATE_ERROR. */
96 #define CC_BSV_CHIP_INDICATION_ERR                    (CC_BSV_BASE_ERROR + 0x00000022)
97 /*! Device is locked in fatal error state. */
98 #define CC_BSV_FATAL_ERR_IS_LOCKED_ERR                (CC_BSV_BASE_ERROR + 0x00000023)
99 /*! Device has security disable feature enabled. */
100 #define CC_BSV_SECURE_DISABLE_ERROR                   (CC_BSV_BASE_ERROR + 0x00000024)
101 /*! Device has Kcst in disabled state */
102 #define CC_BSV_KCST_DISABLE_ERROR                     (CC_BSV_BASE_ERROR + 0x00000025)
103 
104 
105 /*! Illegal data-in pointer. */
106 #define CC_BSV_CRYPTO_INVALID_DATA_IN_POINTER_ERROR         (CC_BSV_CRYPTO_ERROR + 0x00000001)
107 /*! Illegal data-out pointer. */
108 #define CC_BSV_CRYPTO_INVALID_DATA_OUT_POINTER_ERROR        (CC_BSV_CRYPTO_ERROR + 0x00000002)
109 /*! Illegal data size. */
110 #define CC_BSV_CRYPTO_INVALID_DATA_SIZE_ERROR               (CC_BSV_CRYPTO_ERROR + 0x00000003)
111 /*! Illegal key type. */
112 #define CC_BSV_CRYPTO_INVALID_KEY_TYPE_ERROR                (CC_BSV_CRYPTO_ERROR + 0x00000004)
113 /*! Illegal key size. */
114 #define CC_BSV_CRYPTO_INVALID_KEY_SIZE_ERROR                (CC_BSV_CRYPTO_ERROR + 0x00000005)
115 /*! Invalid key pointer. */
116 #define CC_BSV_CRYPTO_INVALID_KEY_POINTER_ERROR             (CC_BSV_CRYPTO_ERROR + 0x00000006)
117 /*! Illegal key DMA type. */
118 #define CC_BSV_CRYPTO_INVALID_KEY_DMA_TYPE_ERROR            (CC_BSV_CRYPTO_ERROR + 0x00000007)
119 /*! Illegal IV pointer. */
120 #define CC_BSV_CRYPTO_INVALID_IV_POINTER_ERROR              (CC_BSV_CRYPTO_ERROR + 0x00000008)
121 /*! Illegal cipher mode. */
122 #define CC_BSV_CRYPTO_INVALID_CIPHER_MODE_ERROR             (CC_BSV_CRYPTO_ERROR + 0x00000009)
123 /*! Illegal result buffer pointer. */
124 #define CC_BSV_CRYPTO_INVALID_RESULT_BUFFER_POINTER_ERROR   (CC_BSV_CRYPTO_ERROR + 0x0000000A)
125 /*! Invalid DMA type. */
126 #define CC_BSV_CRYPTO_INVALID_DMA_TYPE_ERROR                (CC_BSV_CRYPTO_ERROR + 0x0000000B)
127 /*! Invalid in/out buffers overlapping. */
128 #define CC_BSV_CRYPTO_DATA_OUT_DATA_IN_OVERLAP_ERROR        (CC_BSV_CRYPTO_ERROR + 0x0000000C)
129 /*! Invalid KDF label size. */
130 #define CC_BSV_CRYPTO_ILLEGAL_KDF_LABEL_ERROR               (CC_BSV_CRYPTO_ERROR + 0x0000000D)
131 /*! Invalid KDF Context size. */
132 #define CC_BSV_CRYPTO_ILLEGAL_KDF_CONTEXT_ERROR             (CC_BSV_CRYPTO_ERROR + 0x0000000E)
133 /*! Invalid CCM key. */
134 #define CC_BSV_CCM_INVALID_KEY_ERROR                        (CC_BSV_CRYPTO_ERROR + 0x0000000f)
135 /*! Invalid CCM Nonce. */
136 #define CC_BSV_CCM_INVALID_NONCE_ERROR                      (CC_BSV_CRYPTO_ERROR + 0x00000010)
137 /*! Invalid CCM associated data. */
138 #define CC_BSV_CCM_INVALID_ASSOC_DATA_ERROR                 (CC_BSV_CRYPTO_ERROR + 0x00000011)
139 /*! Invalid CCM text data. */
140 #define CC_BSV_CCM_INVALID_TEXT_DATA_ERROR                  (CC_BSV_CRYPTO_ERROR + 0x00000012)
141 /*! Invalid CCM-MAC buffer. */
142 #define CC_BSV_CCM_INVALID_MAC_BUF_ERROR                    (CC_BSV_CRYPTO_ERROR + 0x00000013)
143 /*! CCM-MAC comparison failed. */
144 #define CC_BSV_CCM_TAG_LENGTH_ERROR                         (CC_BSV_CRYPTO_ERROR + 0x00000014)
145 /*! CCM-MAC comparison failed. */
146 #define CC_BSV_CCM_MAC_INVALID_ERROR                        (CC_BSV_CRYPTO_ERROR + 0x00000015)
147 /*! Illegal flow mode. */
148 #define CC_BSV_CRYPTO_INVALID_FLOW_MODE_ERROR               (CC_BSV_CRYPTO_ERROR + 0x00000016)
149 
150 #ifdef __cplusplus
151 }
152 #endif
153 
154 #endif
155 
156 /**
157 @}
158  */
159 
160 
161 
162