Mistake on this page?
Report an issue in GitHub or email us
crys_error.h
Go to the documentation of this file.
1 /**************************************************************************************
2 * Copyright (c) 2016-2017, ARM Limited or its affiliates. All rights reserved *
3 * *
4 * This file and the related binary are licensed under the following license: *
5 * *
6 * ARM Object Code and Header Files License, v1.0 Redistribution. *
7 * *
8 * Redistribution and use of object code, header files, and documentation, without *
9 * modification, are permitted provided that the following conditions are met: *
10 * *
11 * 1) Redistributions must reproduce the above copyright notice and the *
12 * following disclaimer in the documentation and/or other materials *
13 * provided with the distribution. *
14 * *
15 * 2) Unless to the extent explicitly permitted by law, no reverse *
16 * engineering, decompilation, or disassembly of is permitted. *
17 * *
18 * 3) Redistribution and use is permitted solely for the purpose of *
19 * developing or executing applications that are targeted for use *
20 * on an ARM-based product. *
21 * *
22 * DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
23 * CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT *
24 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, *
25 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
26 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED *
28 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
29 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
30 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
31 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
33 **************************************************************************************/
34 
35 
36 #ifndef CRYS_ERROR_H
37 #define CRYS_ERROR_H
38 
39 #include "ssi_pal_types.h"
40 
41 #ifdef __cplusplus
42 extern "C"
43 {
44 #endif
45 
46 /*! @file
47 @brief This module defines the error return code types and the numbering spaces of the error codes
48 for each module of the layers listed below.
49 @defgroup crys_error CryptoCell general base error codes
50 @{
51 @ingroup cryptocell_api
52 */
53 
54 /*! The definitions of the error number space used for the different modules */
55 
56 /* ........... Error base numeric mapping definitions ................... */
57 /* ----------------------------------------------------------------------- */
58 
59  /*! CRYS error base number. */
60 #define CRYS_ERROR_BASE 0x00F00000UL
61 
62 /*! Error range number assigned for each layer. */
63 #define CRYS_ERROR_LAYER_RANGE 0x00010000UL
64 
65 /*! Error range number assigned to each module on its specified layer. */
66 #define CRYS_ERROR_MODULE_RANGE 0x00000100UL
67 
68 /* Defines the layer index for the error mapping. */
69 /*! CRYS error layer index. */
70 #define CRYS_LAYER_ERROR_IDX 0x00UL
71 /*! Low level functions error layer index. */
72 #define LLF_LAYER_ERROR_IDX 0x01UL
73 /*! Generic error layer index. */
74 #define GENERIC_ERROR_IDX 0x05UL
75 
76 /* Defines the module index for error mapping */
77 /*! AES error index.*/
78 #define AES_ERROR_IDX 0x00UL
79 /*! DES error index.*/
80 #define DES_ERROR_IDX 0x01UL
81 /*! HASH error index.*/
82 #define HASH_ERROR_IDX 0x02UL
83 /*! HMAC error index.*/
84 #define HMAC_ERROR_IDX 0x03UL
85 /*! RSA error index.*/
86 #define RSA_ERROR_IDX 0x04UL
87 /*! DH error index.*/
88 #define DH_ERROR_IDX 0x05UL
89 
90 /*! ECPKI error index.*/
91 #define ECPKI_ERROR_IDX 0x08UL
92 /*! RND error index.*/
93 #define RND_ERROR_IDX 0x0CUL
94 /*! Common error index.*/
95 #define COMMON_ERROR_IDX 0x0DUL
96 /*! KDF error index.*/
97 #define KDF_ERROR_IDX 0x11UL
98 /*! HKDF error index.*/
99 #define HKDF_ERROR_IDX 0x12UL
100 /*! AESCCM error index.*/
101 #define AESCCM_ERROR_IDX 0x15UL
102 /*! FIPS error index.*/
103 #define FIPS_ERROR_IDX 0x17UL
104 
105 /*! PKA error index.*/
106 #define PKA_MODULE_ERROR_IDX 0x21UL
107 /*! CHACHA error index.*/
108 #define CHACHA_ERROR_IDX 0x22UL
109 /*! EC montgomery and edwards error index.*/
110 #define EC_MONT_EDW_ERROR_IDX 0x23UL
111 /*! CHACHA POLY error index.*/
112 #define CHACHA_POLY_ERROR_IDX 0x24UL
113 /*! POLY error index.*/
114 #define POLY_ERROR_IDX 0x25UL
115 /*! SRP error index.*/
116 #define SRP_ERROR_IDX 0x26UL
117 
118 
119 
120 /* .......... defining the error spaces for each module on each layer ........... */
121 /* ------------------------------------------------------------------------------ */
122 
123 /*! AES module error base address - 0x00F00000. */
124 #define CRYS_AES_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
125  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
126  (CRYS_ERROR_MODULE_RANGE * AES_ERROR_IDX ) )
127 
128 /*! DES module error base address - 0x00F00100. */
129 #define CRYS_DES_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
130  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
131  (CRYS_ERROR_MODULE_RANGE * DES_ERROR_IDX ) )
132 
133 /*! HASH module error base address - 0x00F00200. */
134 #define CRYS_HASH_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
135  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
136  (CRYS_ERROR_MODULE_RANGE * HASH_ERROR_IDX ) )
137 
138 /*! HMAC module error base address - 0x00F00300. */
139 #define CRYS_HMAC_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
140  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
141  (CRYS_ERROR_MODULE_RANGE * HMAC_ERROR_IDX ) )
142 
143 /*! RSA module error base address - 0x00F00400. */
144 #define CRYS_RSA_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
145  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
146  (CRYS_ERROR_MODULE_RANGE * RSA_ERROR_IDX ) )
147 
148 /*! DH module error base address - 0x00F00500. */
149 #define CRYS_DH_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
150  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
151  (CRYS_ERROR_MODULE_RANGE * DH_ERROR_IDX ) )
152 
153 /*! ECPKI module error base address - 0x00F00800. */
154 #define CRYS_ECPKI_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
155  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
156  (CRYS_ERROR_MODULE_RANGE * ECPKI_ERROR_IDX ) )
157 
158 /*! Low level ECPKI module error base address - 0x00F10800. */
159 #define LLF_ECPKI_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
160  (CRYS_ERROR_LAYER_RANGE * LLF_LAYER_ERROR_IDX) + \
161  (CRYS_ERROR_MODULE_RANGE * ECPKI_ERROR_IDX ) )
162 
163 /*! RND module error base address - 0x00F00C00. */
164 #define CRYS_RND_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
165  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
166  (CRYS_ERROR_MODULE_RANGE * RND_ERROR_IDX ) )
167 
168 /*! Low level RND module error base address - 0x00F10C00. */
169 #define LLF_RND_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
170  (CRYS_ERROR_LAYER_RANGE * LLF_LAYER_ERROR_IDX) + \
171  (CRYS_ERROR_MODULE_RANGE * RND_ERROR_IDX ) )
172 
173 /*! COMMMON module error base address - 0x00F00D00. */
174 #define CRYS_COMMON_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
175  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
176  (CRYS_ERROR_MODULE_RANGE * COMMON_ERROR_IDX ) )
177 
178 /*! KDF module error base address - 0x00F01100. */
179 #define CRYS_KDF_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
180  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
181  (CRYS_ERROR_MODULE_RANGE * KDF_ERROR_IDX ) )
182 
183 /*! HKDF module error base address - 0x00F01100. */
184 #define CRYS_HKDF_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
185  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
186  (CRYS_ERROR_MODULE_RANGE * HKDF_ERROR_IDX ) )
187 
188 /*! AESCCM module error base address - 0x00F01500. */
189 #define CRYS_AESCCM_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
190  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
191  (CRYS_ERROR_MODULE_RANGE * AESCCM_ERROR_IDX ) )
192 
193 /*! FIPS module error base address - 0x00F01700. */
194 #define CRYS_FIPS_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
195  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
196  (CRYS_ERROR_MODULE_RANGE * FIPS_ERROR_IDX ) )
197 
198 /*! PKA module error base address - 0x00F02100. */
199 #define PKA_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
200  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
201  (CRYS_ERROR_MODULE_RANGE * PKA_MODULE_ERROR_IDX ) )
202 
203 /*! CHACHA module error base address - 0x00F02200. */
204 #define CRYS_CHACHA_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
205  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
206  (CRYS_ERROR_MODULE_RANGE * CHACHA_ERROR_IDX ) )
207 /*! CHACHA POLY module error base address - 0x00F02400. */
208 #define CRYS_CHACHA_POLY_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
209  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
210  (CRYS_ERROR_MODULE_RANGE * CHACHA_POLY_ERROR_IDX ) )
211 /*! POLY module error base address - 0x00F02500. */
212 #define CRYS_POLY_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
213  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
214  (CRYS_ERROR_MODULE_RANGE * POLY_ERROR_IDX ) )
215 
216 /*! SRP module error base address - 0x00F02600. */
217 #define CRYS_SRP_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
218  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
219  (CRYS_ERROR_MODULE_RANGE * SRP_ERROR_IDX ) )
220 
221 
222 /*! EC MONT_EDW module error base address - 0x00F02300. */
223 #define CRYS_EC_MONT_EDW_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
224  (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
225  (CRYS_ERROR_MODULE_RANGE * EC_MONT_EDW_ERROR_IDX ) )
226 
227 
228 /*! User generic error base address - 0x00F50000 */
229 #define GENERIC_ERROR_BASE ( CRYS_ERROR_BASE + (CRYS_ERROR_LAYER_RANGE * GENERIC_ERROR_IDX) )
230 /*! CRYS fatal error. */
231 #define CRYS_FATAL_ERROR (GENERIC_ERROR_BASE + 0x00UL)
232 /*! CRYS out of resources error. */
233 #define CRYS_OUT_OF_RESOURCE_ERROR (GENERIC_ERROR_BASE + 0x01UL)
234 /*! CRYS illegal resource value error. */
235 #define CRYS_ILLEGAL_RESOURCE_VAL_ERROR (GENERIC_ERROR_BASE + 0x02UL)
236 
237 
238 
239 /* ............ The OK (success) definition ....................... */
240 /*! Success defintion. */
241 #define CRYS_OK 0
242 
243 /*! MACRO that defines crys return value. */
244 #define SASI_CRYS_RETURN_ERROR(retCode, retcodeInfo, funcHandler) \
245  ((retCode) == 0 ? CRYS_OK : funcHandler(retCode, retcodeInfo))
246 
247 /************************ Enums ********************************/
248 
249 
250 /************************ Typedefs ****************************/
251 
252 /*! The typedef definition of all of the error codes that are returned from the CRYS functions */
253 typedef uint32_t CRYSError_t;
254 
255 /************************ Structs ******************************/
256 
257 
258 /************************ Public Variables **********************/
259 
260 
261 /************************ Public Functions **********************/
262 
263 #ifdef __cplusplus
264 }
265 #endif
266 /**
267 @}
268  */
269 #endif
270 
271 
272 
273 
uint32_t CRYSError_t
Definition: crys_error.h:253
This file contains the platform dependent definitions and types.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.