Embedded SDK
Embedded SDK
cx_ram.h
Go to the documentation of this file.
1 
2 /*******************************************************************************
3  * Ledger Nano S - Secure firmware
4  * (c) 2022 Ledger
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  ********************************************************************************/
18 
19 #ifndef CX_RAM_H
20 #define CX_RAM_H
21 
22 #include "cx_hash.h"
23 #include "cx_pbkdf2.h"
24 #include "cx_ecfp.h"
25 #include "cx_rng.h"
26 #include "cx_rng_rfc6979.h"
27 #include "cx_hmac.h"
28 #include "cx_blake2b.h"
29 #include "cx_groestl.h"
30 #include "cx_rsa.h"
31 #include "cx_sha3.h"
32 #include "cx_sha256.h"
33 #include "cx_sha512.h"
34 #include "cx_ripemd160.h"
35 #include "cx_blake3.h"
36 #include "cx_poly1305.h"
37 #include "lcx_chacha.h"
38 #include "cx_cipher.h"
39 #include "cx_cmac.h"
40 
42 union cx_u {
43 /* PBKDF internal hash */
44 #ifdef HAVE_PBKDF2
45  cx_pbkdf2_t pbkdf2;
46 #endif
47 
48  /* RSA internal PKCS1 */
49 #ifdef HAVE_RSA
50  cx_pkcs1_t pkcs1;
51 #endif
52 
53 /* hash & hmac */
54 #ifdef HAVE_HASH
55  cx_hash_t hash_ctx;
56 
57 #if defined(HAVE_SHA256) || defined(HAVE_SHA224)
58  cx_sha256_t sha256;
59 #endif
60 
61 #if defined(HAVE_SHA512) || defined(HAVE_SHA384)
62  cx_sha512_t sha512;
63 #endif
64 
65 #if defined(HAVE_SHA3)
66  cx_sha3_t sha3;
67 #endif
68 
69 #if defined(HAVE_BLAKE2)
70  cx_xblake_t blake;
71 #endif
72 
73 #if defined(HAVE_GROESTL)
74  cx_xgroestl_t groestl;
75 #endif
76 
77 #if defined(HAVE_RIPEMD160)
78  cx_ripemd160_t ripemd160;
79 #endif // HAVE_RIPEMD160
80 #endif
81 
82 #if defined(HAVE_BLAKE3)
83  cx_blake3_t blake3;
84 #endif // HAVE_BLAKE3
85 
86 #ifdef HAVE_HMAC
87  cx_hmac_t hmac;
88 
89 #if defined(HAVE_HMAC) && (defined(HAVE_SHA512) || defined(HAVE_SHA384))
90  cx_hmac_sha512_t hmac_sha512;
91 #endif
92 
93 #if defined(HAVE_HMAC) && (defined(HAVE_SHA256) || defined(HAVE_SHA224))
94  cx_hmac_sha256_t hmac_sha256;
95 #endif
96 #endif
97 
98 #ifdef HAVE_RNG_RFC6979
99  cx_rnd_rfc6979_ctx_t rfc6979;
100 #endif
101 
102 #ifdef HAVE_POLY1305
103  cx_poly1305_context_t poly1305;
104 #endif // HAVE_POLY1305
105 
106 #ifdef HAVE_CHACHA
107  cx_chacha_context_t chacha;
108 #endif // HAVE_CHACHA
110 
111 #ifdef HAVE_CMAC
112  cx_cmac_context_t cmac;
113 #endif // HAVE_CMAC
114 };
115 extern union cx_u G_cx;
116 
117 #endif
union cx_u G_cx
Definition: cx_ram.c:21
Chacha cipher.
Definition: cx_ram.h:42
cx_cipher_context_t cipher
Definition: cx_ram.h:109