nrfxlib API 2.8.99
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
55/* ........... Error base numeric mapping definitions ................... */
56/* ----------------------------------------------------------------------- */
57
59#define CRYS_ERROR_BASE 0x00F00000UL
60
62#define CRYS_ERROR_LAYER_RANGE 0x00010000UL
63
65#define CRYS_ERROR_MODULE_RANGE 0x00000100UL
66
67/* Defines the layer index for the error mapping. */
69#define CRYS_LAYER_ERROR_IDX 0x00UL
71#define LLF_LAYER_ERROR_IDX 0x01UL
73#define GENERIC_ERROR_IDX 0x05UL
74
75/* Defines the module index for error mapping */
77#define AES_ERROR_IDX 0x00UL
79#define DES_ERROR_IDX 0x01UL
81#define HASH_ERROR_IDX 0x02UL
83#define HMAC_ERROR_IDX 0x03UL
85#define RSA_ERROR_IDX 0x04UL
87#define DH_ERROR_IDX 0x05UL
88
90#define ECPKI_ERROR_IDX 0x08UL
92#define RND_ERROR_IDX 0x0CUL
94#define COMMON_ERROR_IDX 0x0DUL
96#define KDF_ERROR_IDX 0x11UL
98#define HKDF_ERROR_IDX 0x12UL
100#define AESCCM_ERROR_IDX 0x15UL
102#define FIPS_ERROR_IDX 0x17UL
103
105#define PKA_MODULE_ERROR_IDX 0x21UL
107#define CHACHA_ERROR_IDX 0x22UL
109#define EC_MONT_EDW_ERROR_IDX 0x23UL
111#define CHACHA_POLY_ERROR_IDX 0x24UL
113#define POLY_ERROR_IDX 0x25UL
115#define SRP_ERROR_IDX 0x26UL
116
117
118
119/* .......... defining the error spaces for each module on each layer ........... */
120/* ------------------------------------------------------------------------------ */
121
123#define CRYS_AES_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
124 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
125 (CRYS_ERROR_MODULE_RANGE * AES_ERROR_IDX ) )
126
128#define CRYS_DES_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
129 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
130 (CRYS_ERROR_MODULE_RANGE * DES_ERROR_IDX ) )
131
133#define CRYS_HASH_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
134 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
135 (CRYS_ERROR_MODULE_RANGE * HASH_ERROR_IDX ) )
136
138#define CRYS_HMAC_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
139 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
140 (CRYS_ERROR_MODULE_RANGE * HMAC_ERROR_IDX ) )
141
143#define CRYS_RSA_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
144 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
145 (CRYS_ERROR_MODULE_RANGE * RSA_ERROR_IDX ) )
146
148#define CRYS_DH_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
149 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
150 (CRYS_ERROR_MODULE_RANGE * DH_ERROR_IDX ) )
151
153#define CRYS_ECPKI_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
154 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
155 (CRYS_ERROR_MODULE_RANGE * ECPKI_ERROR_IDX ) )
156
158#define LLF_ECPKI_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
159 (CRYS_ERROR_LAYER_RANGE * LLF_LAYER_ERROR_IDX) + \
160 (CRYS_ERROR_MODULE_RANGE * ECPKI_ERROR_IDX ) )
161
163#define CRYS_RND_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
164 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
165 (CRYS_ERROR_MODULE_RANGE * RND_ERROR_IDX ) )
166
168#define LLF_RND_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
169 (CRYS_ERROR_LAYER_RANGE * LLF_LAYER_ERROR_IDX) + \
170 (CRYS_ERROR_MODULE_RANGE * RND_ERROR_IDX ) )
171
173#define CRYS_COMMON_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
174 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
175 (CRYS_ERROR_MODULE_RANGE * COMMON_ERROR_IDX ) )
176
178#define CRYS_KDF_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
179 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
180 (CRYS_ERROR_MODULE_RANGE * KDF_ERROR_IDX ) )
181
183#define CRYS_HKDF_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
184 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
185 (CRYS_ERROR_MODULE_RANGE * HKDF_ERROR_IDX ) )
186
188#define CRYS_AESCCM_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
189 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
190 (CRYS_ERROR_MODULE_RANGE * AESCCM_ERROR_IDX ) )
191
193#define CRYS_FIPS_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
194 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
195 (CRYS_ERROR_MODULE_RANGE * FIPS_ERROR_IDX ) )
196
198#define PKA_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
199 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
200 (CRYS_ERROR_MODULE_RANGE * PKA_MODULE_ERROR_IDX ) )
201
203#define CRYS_CHACHA_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
204 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
205 (CRYS_ERROR_MODULE_RANGE * CHACHA_ERROR_IDX ) )
207#define CRYS_CHACHA_POLY_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
208 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
209 (CRYS_ERROR_MODULE_RANGE * CHACHA_POLY_ERROR_IDX ) )
211#define CRYS_POLY_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
212 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
213 (CRYS_ERROR_MODULE_RANGE * POLY_ERROR_IDX ) )
214
216#define CRYS_SRP_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
217 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
218 (CRYS_ERROR_MODULE_RANGE * SRP_ERROR_IDX ) )
219
220
222#define CRYS_EC_MONT_EDW_MODULE_ERROR_BASE (CRYS_ERROR_BASE + \
223 (CRYS_ERROR_LAYER_RANGE * CRYS_LAYER_ERROR_IDX) + \
224 (CRYS_ERROR_MODULE_RANGE * EC_MONT_EDW_ERROR_IDX ) )
225
226
228#define GENERIC_ERROR_BASE ( CRYS_ERROR_BASE + (CRYS_ERROR_LAYER_RANGE * GENERIC_ERROR_IDX) )
230#define CRYS_FATAL_ERROR (GENERIC_ERROR_BASE + 0x00UL)
232#define CRYS_OUT_OF_RESOURCE_ERROR (GENERIC_ERROR_BASE + 0x01UL)
234#define CRYS_ILLEGAL_RESOURCE_VAL_ERROR (GENERIC_ERROR_BASE + 0x02UL)
235
236
237
238/* ............ The OK (success) definition ....................... */
240#define CRYS_OK 0
241
243#define SASI_CRYS_RETURN_ERROR(retCode, retcodeInfo, funcHandler) \
244 ((retCode) == 0 ? CRYS_OK : funcHandler(retCode, retcodeInfo))
245
246/************************ Enums ********************************/
247
248
249/************************ Typedefs ****************************/
250
252typedef uint32_t CRYSError_t;
253
254/************************ Structs ******************************/
255
256
257/************************ Public Variables **********************/
258
259
260/************************ Public Functions **********************/
261
262#ifdef __cplusplus
263}
264#endif
268#endif
uint32_t CRYSError_t
Definition crys_error.h:252
This file contains the platform dependent definitions and types.