1 /*
2  * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 
8 #ifndef _CC_ECPKI_ERROR_H
9 #define _CC_ECPKI_ERROR_H
10 
11 
12 /*!
13 @file
14 @brief This file contains the definitions of the CryptoCell ECPKI errors.
15 @defgroup cc_ecpki_error CryptoCell ECC specific errors
16 @{
17 @ingroup cryptocell_ecpki
18 
19 */
20 
21 #include "cc_error.h"
22 
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #endif
27 
28 
29 /************************ Defines ******************************/
30 
31 /* CC_ECPKI_MODULE_ERROR_BASE = 0x00F00800  */
32 
33 /*********************************************************************************************
34  * CryptoCell ECPKI MODULE ERRORS                                                                  *
35  *********************************************************************************************/
36 /*! Illegal domain ID. */
37 #define CC_ECPKI_ILLEGAL_DOMAIN_ID_ERROR                    (CC_ECPKI_MODULE_ERROR_BASE + 0x1UL)
38 /*! Illegal domain pointer. */
39 #define CC_ECPKI_DOMAIN_PTR_ERROR               (CC_ECPKI_MODULE_ERROR_BASE + 0x2UL)
40 /* The CryptoCell ECPKI GEN KEY PAIR module errors */
41 /*! Illegal private key pointer. */
42 #define CC_ECPKI_GEN_KEY_INVALID_PRIVATE_KEY_PTR_ERROR          (CC_ECPKI_MODULE_ERROR_BASE + 0x3UL)
43 /*! Illegal public key pointer. */
44 #define CC_ECPKI_GEN_KEY_INVALID_PUBLIC_KEY_PTR_ERROR           (CC_ECPKI_MODULE_ERROR_BASE + 0x4UL)
45 /*! Illegal temporary buffer pointer. */
46 #define CC_ECPKI_GEN_KEY_INVALID_TEMP_DATA_PTR_ERROR            (CC_ECPKI_MODULE_ERROR_BASE + 0x5UL)
47 /*! Illegal RND context pointer. */
48 #define CC_ECPKI_RND_CONTEXT_PTR_ERROR              (CC_ECPKI_MODULE_ERROR_BASE + 0x6UL)
49 
50 /************************************************************************************************************
51 * The CryptoCell ECPKI BUILD KEYS MODULE ERRORS                                                                   *
52 *************************************************************************************************************/
53 /*! Illegal compression mode. */
54 #define CC_ECPKI_BUILD_KEY_INVALID_COMPRESSION_MODE_ERROR     (CC_ECPKI_MODULE_ERROR_BASE + 0x07UL)
55 /*! Illegal domain ID. */
56 #define CC_ECPKI_BUILD_KEY_ILLEGAL_DOMAIN_ID_ERROR            (CC_ECPKI_MODULE_ERROR_BASE + 0x08UL)
57 /*! Illegal private key pointer. */
58 #define CC_ECPKI_BUILD_KEY_INVALID_PRIV_KEY_IN_PTR_ERROR      (CC_ECPKI_MODULE_ERROR_BASE + 0x09UL)
59 /*! Illegal private key structure pointer. */
60 #define CC_ECPKI_BUILD_KEY_INVALID_USER_PRIV_KEY_PTR_ERROR    (CC_ECPKI_MODULE_ERROR_BASE + 0x0AUL)
61 /*! Illegal private key size. */
62 #define CC_ECPKI_BUILD_KEY_INVALID_PRIV_KEY_SIZE_ERROR        (CC_ECPKI_MODULE_ERROR_BASE + 0x0BUL)
63 /*! Illegal private key data. */
64 #define CC_ECPKI_BUILD_KEY_INVALID_PRIV_KEY_DATA_ERROR        (CC_ECPKI_MODULE_ERROR_BASE + 0x0CUL)
65 /*! Illegal public key pointer. */
66 #define CC_ECPKI_BUILD_KEY_INVALID_PUBL_KEY_IN_PTR_ERROR      (CC_ECPKI_MODULE_ERROR_BASE + 0x0DUL)
67 /*! Illegal public key structure pointer. */
68 #define CC_ECPKI_BUILD_KEY_INVALID_USER_PUBL_KEY_PTR_ERROR    (CC_ECPKI_MODULE_ERROR_BASE + 0x0EUL)
69 /*! Illegal public key size. */
70 #define CC_ECPKI_BUILD_KEY_INVALID_PUBL_KEY_SIZE_ERROR        (CC_ECPKI_MODULE_ERROR_BASE + 0x0FUL)
71 /*! Illegal public key data. */
72 #define CC_ECPKI_BUILD_KEY_INVALID_PUBL_KEY_DATA_ERROR        (CC_ECPKI_MODULE_ERROR_BASE + 0x10UL)
73 /*! Illegal EC build check mode option. */
74 #define CC_ECPKI_BUILD_KEY_INVALID_CHECK_MODE_ERROR           (CC_ECPKI_MODULE_ERROR_BASE + 0x11UL)
75 /*! Illegal temporary buffer pointer. */
76 #define CC_ECPKI_BUILD_KEY_INVALID_TEMP_BUFF_PTR_ERROR        (CC_ECPKI_MODULE_ERROR_BASE + 0x12UL)
77 
78 
79 
80 /* The CryptoCell ECPKI EXPORT PUBLIC KEY MODULE ERRORS */
81 /*! Illegal public key structure pointer. */
82 #define CC_ECPKI_EXPORT_PUBL_KEY_INVALID_USER_PUBL_KEY_PTR_ERROR      (CC_ECPKI_MODULE_ERROR_BASE + 0x14UL)
83 /*! Illegal public key compression mode. */
84 #define CC_ECPKI_EXPORT_PUBL_KEY_ILLEGAL_COMPRESSION_MODE_ERROR       (CC_ECPKI_MODULE_ERROR_BASE + 0x15UL)
85 /*! Illegal output public key pointer. */
86 #define CC_ECPKI_EXPORT_PUBL_KEY_INVALID_EXTERN_PUBL_KEY_PTR_ERROR    (CC_ECPKI_MODULE_ERROR_BASE + 0x16UL)
87 /*! Illegal output public key size pointer. */
88 #define CC_ECPKI_EXPORT_PUBL_KEY_INVALID_PUBL_KEY_SIZE_PTR_ERROR      (CC_ECPKI_MODULE_ERROR_BASE + 0x17UL)
89 /*! Illegal output public key size. */
90 #define CC_ECPKI_EXPORT_PUBL_KEY_INVALID_PUBL_KEY_SIZE_ERROR          (CC_ECPKI_MODULE_ERROR_BASE + 0x18UL)
91 /*! Illegal domain ID. */
92 #define CC_ECPKI_EXPORT_PUBL_KEY_ILLEGAL_DOMAIN_ID_ERROR              (CC_ECPKI_MODULE_ERROR_BASE + 0x19UL)
93 /*! Validation of public key failed. */
94 #define CC_ECPKI_EXPORT_PUBL_KEY_ILLEGAL_VALIDATION_TAG_ERROR         (CC_ECPKI_MODULE_ERROR_BASE + 0x1AUL)
95 /*! Validation of public key failed. */
96 #define CC_ECPKI_EXPORT_PUBL_KEY_INVALID_PUBL_KEY_DATA_ERROR          (CC_ECPKI_MODULE_ERROR_BASE + 0x1BUL)
97 
98 /* The CryptoCell ECPKI BUILD ECC DOMAIN ERRORS */
99 /*! Illegal domain ID. */
100 #define CC_ECPKI_BUILD_DOMAIN_ID_IS_NOT_VALID_ERROR               (CC_ECPKI_MODULE_ERROR_BASE + 0x20UL)
101 /*! Illegal domain ID pointer. */
102 #define CC_ECPKI_BUILD_DOMAIN_DOMAIN_PTR_ERROR                        (CC_ECPKI_MODULE_ERROR_BASE + 0x21UL)
103 /*! Illegal domain parameter pointer. */
104 #define CC_ECPKI_BUILD_DOMAIN_EC_PARAMETR_PTR_ERROR                   (CC_ECPKI_MODULE_ERROR_BASE + 0x22UL)
105 /*! Illegal domain parameter size. */
106 #define CC_ECPKI_BUILD_DOMAIN_EC_PARAMETR_SIZE_ERROR                  (CC_ECPKI_MODULE_ERROR_BASE + 0x23UL)
107 /*! Illegal domain cofactor parameters. */
108 #define CC_ECPKI_BUILD_DOMAIN_COFACTOR_PARAMS_ERROR                   (CC_ECPKI_MODULE_ERROR_BASE + 0x24UL)
109 /*! Insufficient strength. */
110 #define CC_ECPKI_BUILD_DOMAIN_SECURITY_STRENGTH_ERROR                 (CC_ECPKI_MODULE_ERROR_BASE + 0x25UL)
111 /*! SCA resistance error. */
112 #define CC_ECPKI_BUILD_SCA_RESIST_ILLEGAL_MODE_ERROR                  (CC_ECPKI_MODULE_ERROR_BASE + 0x26UL)
113 
114 
115 /*! Internal error */
116 #define CC_ECPKI_INTERNAL_ERROR                                       (CC_ECPKI_MODULE_ERROR_BASE + 0x30UL)
117 /************************************************************************************************************
118  * CryptoCell EC DIFFIE-HELLMAN MODULE ERRORS
119 *************************************************************************************************************/
120 /* The CryptoCell EC SVDP_DH Function errors */
121 /*! Illegal partner's public key pointer. */
122 #define CC_ECDH_SVDP_DH_INVALID_PARTNER_PUBL_KEY_PTR_ERROR                (CC_ECPKI_MODULE_ERROR_BASE + 0x31UL)
123 /*! Partner's public key validation failed. */
124 #define CC_ECDH_SVDP_DH_PARTNER_PUBL_KEY_VALID_TAG_ERROR                  (CC_ECPKI_MODULE_ERROR_BASE + 0x32UL)
125 /*! Illegal user private key pointer. */
126 #define CC_ECDH_SVDP_DH_INVALID_USER_PRIV_KEY_PTR_ERROR                   (CC_ECPKI_MODULE_ERROR_BASE + 0x33UL)
127 /*! Private key validation failed. */
128 #define CC_ECDH_SVDP_DH_USER_PRIV_KEY_VALID_TAG_ERROR                     (CC_ECPKI_MODULE_ERROR_BASE + 0x34UL)
129 /*! Illegal shared secret pointer. */
130 #define CC_ECDH_SVDP_DH_INVALID_SHARED_SECRET_VALUE_PTR_ERROR                 (CC_ECPKI_MODULE_ERROR_BASE + 0x35UL)
131 /*! Illegal temporary buffer pointer. */
132 #define CC_ECDH_SVDP_DH_INVALID_TEMP_DATA_PTR_ERROR                           (CC_ECPKI_MODULE_ERROR_BASE + 0x36UL)
133 /*! Illegal shared secret size pointer. */
134 #define CC_ECDH_SVDP_DH_INVALID_SHARED_SECRET_VALUE_SIZE_PTR_ERROR            (CC_ECPKI_MODULE_ERROR_BASE + 0x37UL)
135 /*! Illegal shared secret size. */
136 #define CC_ECDH_SVDP_DH_INVALID_SHARED_SECRET_VALUE_SIZE_ERROR                (CC_ECPKI_MODULE_ERROR_BASE + 0x38UL)
137 /*! Illegal domain ID. */
138 #define CC_ECDH_SVDP_DH_ILLEGAL_DOMAIN_ID_ERROR                               (CC_ECPKI_MODULE_ERROR_BASE + 0x39UL)
139 /*! Illegal private and public domain ID are different. */
140 #define CC_ECDH_SVDP_DH_NOT_CONCENT_PUBL_AND_PRIV_DOMAIN_ID_ERROR             (CC_ECPKI_MODULE_ERROR_BASE + 0x3AUL)
141 
142 
143 /************************************************************************************************************
144  * CryptoCell ECDSA  MODULE ERRORS
145  ************************************************************************************************************/
146 /* The CryptoCell ECDSA Signing  errors */
147 /*! Illegal domain ID. */
148 #define CC_ECDSA_SIGN_INVALID_DOMAIN_ID_ERROR           (CC_ECPKI_MODULE_ERROR_BASE + 0x50UL)
149 /*! Illegal context pointer. */
150 #define CC_ECDSA_SIGN_INVALID_USER_CONTEXT_PTR_ERROR            (CC_ECPKI_MODULE_ERROR_BASE + 0x51UL)
151 /*! Illegal private key pointer. */
152 #define CC_ECDSA_SIGN_INVALID_USER_PRIV_KEY_PTR_ERROR           (CC_ECPKI_MODULE_ERROR_BASE + 0x52UL)
153 /*! Illegal hash operation mode. */
154 #define CC_ECDSA_SIGN_ILLEGAL_HASH_OP_MODE_ERROR                (CC_ECPKI_MODULE_ERROR_BASE + 0x53UL)
155 /*! Illegal data in pointer. */
156 #define CC_ECDSA_SIGN_INVALID_MESSAGE_DATA_IN_PTR_ERROR         (CC_ECPKI_MODULE_ERROR_BASE + 0x54UL)
157 /*! Illegal data in size. */
158 #define CC_ECDSA_SIGN_INVALID_MESSAGE_DATA_IN_SIZE_ERROR        (CC_ECPKI_MODULE_ERROR_BASE + 0x55UL)
159 /*! Context validation failed. */
160 #define CC_ECDSA_SIGN_USER_CONTEXT_VALIDATION_TAG_ERROR         (CC_ECPKI_MODULE_ERROR_BASE + 0x57UL)
161 /*! User's private key validation failed. */
162 #define CC_ECDSA_SIGN_USER_PRIV_KEY_VALIDATION_TAG_ERROR        (CC_ECPKI_MODULE_ERROR_BASE + 0x58UL)
163 /*! Illegal signature pointer. */
164 #define CC_ECDSA_SIGN_INVALID_SIGNATURE_OUT_PTR_ERROR           (CC_ECPKI_MODULE_ERROR_BASE + 0x60UL)
165 /*! Illegal signature size pointer. */
166 #define CC_ECDSA_SIGN_INVALID_SIGNATURE_OUT_SIZE_PTR_ERROR      (CC_ECPKI_MODULE_ERROR_BASE + 0x61UL)
167 /*! Illegal signature size. */
168 #define CC_ECDSA_SIGN_INVALID_SIGNATURE_OUT_SIZE_ERROR          (CC_ECPKI_MODULE_ERROR_BASE + 0x62UL)
169 /*! Ephemeral key error. */
170 #define CC_ECDSA_SIGN_INVALID_IS_EPHEMER_KEY_INTERNAL_ERROR     (CC_ECPKI_MODULE_ERROR_BASE + 0x63UL)
171 /*! Illegal ephemeral key pointer. */
172 #define CC_ECDSA_SIGN_INVALID_EPHEMERAL_KEY_PTR_ERROR           (CC_ECPKI_MODULE_ERROR_BASE + 0x64UL)
173 /*! Illegal RND context pointer. */
174 #define CC_ECDSA_SIGN_INVALID_RND_CONTEXT_PTR_ERROR             (CC_ECPKI_MODULE_ERROR_BASE + 0x65UL)
175 /*! Illegal RND function pointer. */
176 #define CC_ECDSA_SIGN_INVALID_RND_FUNCTION_PTR_ERROR            (CC_ECPKI_MODULE_ERROR_BASE + 0x66UL)
177 /*! Signature calculation failed. */
178 #define CC_ECDSA_SIGN_SIGNING_ERROR                             (CC_ECPKI_MODULE_ERROR_BASE + 0x67UL)
179 
180 /* The CryptoCell ECDSA Verifying  errors */
181 /*! Illegal domain ID. */
182 #define CC_ECDSA_VERIFY_INVALID_DOMAIN_ID_ERROR         (CC_ECPKI_MODULE_ERROR_BASE + 0x70UL)
183 /*! Illegal user's context pointer. */
184 #define CC_ECDSA_VERIFY_INVALID_USER_CONTEXT_PTR_ERROR      (CC_ECPKI_MODULE_ERROR_BASE + 0x71UL)
185 /*! Illegal public key pointer. */
186 #define CC_ECDSA_VERIFY_INVALID_SIGNER_PUBL_KEY_PTR_ERROR       (CC_ECPKI_MODULE_ERROR_BASE + 0x72UL)
187 /*! Illegal hash operation mode. */
188 #define CC_ECDSA_VERIFY_ILLEGAL_HASH_OP_MODE_ERROR              (CC_ECPKI_MODULE_ERROR_BASE + 0x73UL)
189 /*! Illegal signature pointer. */
190 #define CC_ECDSA_VERIFY_INVALID_SIGNATURE_IN_PTR_ERROR          (CC_ECPKI_MODULE_ERROR_BASE + 0x76UL)
191 /*! Illegal signature size. */
192 #define CC_ECDSA_VERIFY_INVALID_SIGNATURE_SIZE_ERROR        (CC_ECPKI_MODULE_ERROR_BASE + 0x77UL)
193 /*! Illegal data in pointer. */
194 #define CC_ECDSA_VERIFY_INVALID_MESSAGE_DATA_IN_PTR_ERROR       (CC_ECPKI_MODULE_ERROR_BASE + 0x80UL)
195 /*! Illegal data in size. */
196 #define CC_ECDSA_VERIFY_INVALID_MESSAGE_DATA_IN_SIZE_ERROR      (CC_ECPKI_MODULE_ERROR_BASE + 0x81UL)
197 /*! Context validation failed. */
198 #define CC_ECDSA_VERIFY_USER_CONTEXT_VALIDATION_TAG_ERROR       (CC_ECPKI_MODULE_ERROR_BASE + 0x82UL)
199 /*! public key validation failed. */
200 #define CC_ECDSA_VERIFY_SIGNER_PUBL_KEY_VALIDATION_TAG_ERROR    (CC_ECPKI_MODULE_ERROR_BASE + 0x83UL)
201 /*! Verification failed. */
202 #define CC_ECDSA_VERIFY_INCONSISTENT_VERIFY_ERROR               (CC_ECPKI_MODULE_ERROR_BASE + 0x84UL)
203 
204 
205 
206 /*! Illegal hash mode. */
207 #define CC_ECC_ILLEGAL_HASH_MODE_ERROR                         (CC_ECPKI_MODULE_ERROR_BASE + 0x85UL)
208 
209 
210 /************************************************************************************************************
211  * CryptoCell ECPKI MODULE  COMMON ERRORS
212 *************************************************************************************************************/
213 /*! Illegal RND function pointer. */
214 #define CC_ECPKI_INVALID_RND_FUNC_PTR_ERROR                   (CC_ECPKI_MODULE_ERROR_BASE + 0x90UL)
215 /*! Illegal RND context pointer. */
216 #define CC_ECPKI_INVALID_RND_CTX_PTR_ERROR                    (CC_ECPKI_MODULE_ERROR_BASE + 0x91UL)
217 /*! Illegal domain ID. */
218 #define CC_ECPKI_INVALID_DOMAIN_ID_ERROR                      (CC_ECPKI_MODULE_ERROR_BASE + 0x92UL)
219 /*! Private key validation failed. */
220 #define CC_ECPKI_INVALID_PRIV_KEY_TAG_ERROR                   (CC_ECPKI_MODULE_ERROR_BASE + 0x93UL)
221 /*! Public key validation failed. */
222 #define CC_ECPKI_INVALID_PUBL_KEY_TAG_ERROR                   (CC_ECPKI_MODULE_ERROR_BASE + 0x94UL)
223 /*! Illegal data in. */
224 #define CC_ECPKI_INVALID_DATA_IN_PASSED_STRUCT_ERROR          (CC_ECPKI_MODULE_ERROR_BASE + 0x95UL)
225 /*! Illegal Base point pointer. */
226 #define CC_ECPKI_INVALID_BASE_POINT_PTR_ERROR          (CC_ECPKI_MODULE_ERROR_BASE + 0x96UL)
227 
228 /************************************************************************************************************
229  * CryptoCell ECIES MODULE ERRORS
230 *************************************************************************************************************/
231 /*! Illegal public key pointer. */
232 #define CC_ECIES_INVALID_PUBL_KEY_PTR_ERROR                     (CC_ECPKI_MODULE_ERROR_BASE + 0xE0UL)
233 /*! Public key validation failed. */
234 #define CC_ECIES_INVALID_PUBL_KEY_TAG_ERROR         (CC_ECPKI_MODULE_ERROR_BASE + 0xE1UL)
235 /*! Illegal private key pointer. */
236 #define CC_ECIES_INVALID_PRIV_KEY_PTR_ERROR                     (CC_ECPKI_MODULE_ERROR_BASE + 0xE2UL)
237 /*! Private key validation failed. */
238 #define CC_ECIES_INVALID_PRIV_KEY_TAG_ERROR         (CC_ECPKI_MODULE_ERROR_BASE + 0xE3UL)
239 /*! Illegal private key value. */
240 #define CC_ECIES_INVALID_PRIV_KEY_VALUE_ERROR           (CC_ECPKI_MODULE_ERROR_BASE + 0xE4UL)
241 /*! Illegal KDF derivation mode. */
242 #define CC_ECIES_INVALID_KDF_DERIV_MODE_ERROR               (CC_ECPKI_MODULE_ERROR_BASE + 0xE5UL)
243 /*! Illegal KDF hash mode. */
244 #define CC_ECIES_INVALID_KDF_HASH_MODE_ERROR            (CC_ECPKI_MODULE_ERROR_BASE + 0xE6UL)
245 /*! Illegal secret key pointer. */
246 #define CC_ECIES_INVALID_SECRET_KEY_PTR_ERROR           (CC_ECPKI_MODULE_ERROR_BASE + 0xE7UL)
247 /*! Illegal secret key size. */
248 #define CC_ECIES_INVALID_SECRET_KEY_SIZE_ERROR          (CC_ECPKI_MODULE_ERROR_BASE + 0xE8UL)
249 /*! Illegal cipher data pointer. */
250 #define CC_ECIES_INVALID_CIPHER_DATA_PTR_ERROR          (CC_ECPKI_MODULE_ERROR_BASE + 0xE9UL)
251 /*! Illegal cipher data size pointer. */
252 #define CC_ECIES_INVALID_CIPHER_DATA_SIZE_PTR_ERROR         (CC_ECPKI_MODULE_ERROR_BASE + 0xEAUL)
253 /*! Illegal cipher data size. */
254 #define CC_ECIES_INVALID_CIPHER_DATA_SIZE_ERROR         (CC_ECPKI_MODULE_ERROR_BASE + 0xEBUL)
255 /*! Illegal temporary buffer pointer. */
256 #define CC_ECIES_INVALID_TEMP_DATA_PTR_ERROR            (CC_ECPKI_MODULE_ERROR_BASE + 0xECUL)
257 /*! Illegal temporary buffe size */
258 #define CC_ECIES_INVALID_TEMP_DATA_SIZE_ERROR           (CC_ECPKI_MODULE_ERROR_BASE + 0xEDUL)
259 /*! Illegal ephemeral key pointer */
260 #define CC_ECIES_INVALID_EPHEM_KEY_PAIR_PTR_ERROR               (CC_ECPKI_MODULE_ERROR_BASE + 0xEEUL)
261 /*! NULL ptr */
262 #define CC_ECIES_INVALID_PTR                                   (CC_ECPKI_MODULE_ERROR_BASE + 0xEFUL)
263 
264 /************************ Enums ********************************/
265 
266 /************************ Typedefs  ****************************/
267 
268 /************************ Structs  ******************************/
269 
270 /************************ Public Variables **********************/
271 
272 /************************ Public Functions **********************/
273 
274 #ifdef __cplusplus
275 }
276 #endif
277 /**
278 @}
279  */
280 
281 #endif
282 
283 
284