nrfxlib API 0.1.0
Loading...
Searching...
No Matches
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
42extern "C"
43{
44#endif
45
56/* ........... Error base numeric mapping definitions ................... */
57/* ----------------------------------------------------------------------- */
58
60#define CRYS_ERROR_BASE 0x00F00000UL
61
63#define CRYS_ERROR_LAYER_RANGE 0x00010000UL
64
66#define CRYS_ERROR_MODULE_RANGE 0x00000100UL
67
68/* Defines the layer index for the error mapping. */
70#define CRYS_LAYER_ERROR_IDX 0x00UL
72#define LLF_LAYER_ERROR_IDX 0x01UL
74#define GENERIC_ERROR_IDX 0x05UL
75
76/* Defines the module index for error mapping */
78#define AES_ERROR_IDX 0x00UL
80#define DES_ERROR_IDX 0x01UL
82#define HASH_ERROR_IDX 0x02UL
84#define HMAC_ERROR_IDX 0x03UL
86#define RSA_ERROR_IDX 0x04UL
88#define DH_ERROR_IDX 0x05UL
89
91#define ECPKI_ERROR_IDX 0x08UL
93#define RND_ERROR_IDX 0x0CUL
95#define COMMON_ERROR_IDX 0x0DUL
97#define KDF_ERROR_IDX 0x11UL
99#define HKDF_ERROR_IDX 0x12UL
101#define AESCCM_ERROR_IDX 0x15UL
103#define FIPS_ERROR_IDX 0x17UL
104
106#define PKA_MODULE_ERROR_IDX 0x21UL
108#define CHACHA_ERROR_IDX 0x22UL
110#define EC_MONT_EDW_ERROR_IDX 0x23UL
112#define CHACHA_POLY_ERROR_IDX 0x24UL
114#define POLY_ERROR_IDX 0x25UL
116#define SRP_ERROR_IDX 0x26UL
117
118
119
120/* .......... defining the error spaces for each module on each layer ........... */
121/* ------------------------------------------------------------------------------ */
122
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 ) )
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 ) )
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
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
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
229#define GENERIC_ERROR_BASE ( CRYS_ERROR_BASE + (CRYS_ERROR_LAYER_RANGE * GENERIC_ERROR_IDX) )
231#define CRYS_FATAL_ERROR (GENERIC_ERROR_BASE + 0x00UL)
233#define CRYS_OUT_OF_RESOURCE_ERROR (GENERIC_ERROR_BASE + 0x01UL)
235#define CRYS_ILLEGAL_RESOURCE_VAL_ERROR (GENERIC_ERROR_BASE + 0x02UL)
236
237
238
239/* ............ The OK (success) definition ....................... */
241#define CRYS_OK 0
242
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
253typedef uint32_t CRYSError_t;
254
255/************************ Structs ******************************/
256
257
258/************************ Public Variables **********************/
259
260
261/************************ Public Functions **********************/
262
263#ifdef __cplusplus
264}
265#endif
269#endif
270
271
272
273
uint32_t CRYSError_t
Definition: crys_error.h:253
This file contains the platform dependent definitions and types.