iPXE
config_crypto.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License as
4  * published by the Free Software Foundation; either version 2 of the
5  * License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful, but
8  * WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10  * General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  *
17  * You can also choose to distribute this program under the terms of
18  * the Unmodified Binary Distribution Licence (as given in the file
19  * COPYING.UBDL), provided that you have satisfied its requirements.
20  */
21 
22 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
23 FILE_SECBOOT ( PERMITTED );
24 
25 #include <config/crypto.h>
26 
27 /** @file
28  *
29  * Cryptographic configuration
30  *
31  * Cryptographic configuration is slightly messy since we need to drag
32  * in objects based on combinations of build options.
33  */
34 
36 
37 /* RSA */
38 #if defined ( CRYPTO_PUBKEY_RSA )
39 REQUIRE_OBJECT ( oid_rsa );
40 #endif
41 
42 /* MD4 */
43 #if defined ( CRYPTO_DIGEST_MD4 )
45 #endif
46 
47 /* MD5 */
48 #if defined ( CRYPTO_DIGEST_MD5 )
50 #endif
51 
52 /* SHA-1 */
53 #if defined ( CRYPTO_DIGEST_SHA1 )
55 #endif
56 
57 /* SHA-224 */
58 #if defined ( CRYPTO_DIGEST_SHA224 )
60 #endif
61 
62 /* SHA-256 */
63 #if defined ( CRYPTO_DIGEST_SHA256 )
65 #endif
66 
67 /* SHA-384 */
68 #if defined ( CRYPTO_DIGEST_SHA384 )
70 #endif
71 
72 /* SHA-512 */
73 #if defined ( CRYPTO_DIGEST_SHA512 )
75 #endif
76 
77 /* SHA-512/224 */
78 #if defined ( CRYPTO_DIGEST_SHA512_224 )
80 #endif
81 
82 /* SHA-512/256 */
83 #if defined ( CRYPTO_DIGEST_SHA512_256 )
85 #endif
86 
87 /* X25519 */
88 #if defined ( CRYPTO_CURVE_X25519 )
90 #endif
91 
92 /* P-256 */
93 #if defined ( CRYPTO_CURVE_P256 )
94 REQUIRE_OBJECT ( oid_p256 );
95 #endif
96 
97 /* P-384 */
98 #if defined ( CRYPTO_CURVE_P384 )
99 REQUIRE_OBJECT ( oid_p384 );
100 #endif
101 
102 /* AES-CBC */
103 #if defined ( CRYPTO_CIPHER_AES_CBC )
104 REQUIRE_OBJECT ( oid_aes_cbc );
105 #endif
106 
107 /* AES-GCM */
108 #if defined ( CRYPTO_CIPHER_AES_GCM )
109 REQUIRE_OBJECT ( oid_aes_gcm );
110 #endif
111 
112 /* RSA and MD5 */
113 #if defined ( CRYPTO_PUBKEY_RSA ) && defined ( CRYPTO_DIGEST_MD5 )
114 REQUIRE_OBJECT ( rsa_md5 );
115 #endif
116 
117 /* RSA and SHA-1 */
118 #if defined ( CRYPTO_PUBKEY_RSA ) && defined ( CRYPTO_DIGEST_SHA1 )
119 REQUIRE_OBJECT ( rsa_sha1 );
120 #endif
121 
122 /* RSA and SHA-224 */
123 #if defined ( CRYPTO_PUBKEY_RSA ) && defined ( CRYPTO_DIGEST_SHA224 )
124 REQUIRE_OBJECT ( rsa_sha224 );
125 #endif
126 
127 /* RSA and SHA-256 */
128 #if defined ( CRYPTO_PUBKEY_RSA ) && defined ( CRYPTO_DIGEST_SHA256 )
129 REQUIRE_OBJECT ( rsa_sha256 );
130 #endif
131 
132 /* RSA and SHA-384 */
133 #if defined ( CRYPTO_PUBKEY_RSA ) && defined ( CRYPTO_DIGEST_SHA384 )
134 REQUIRE_OBJECT ( rsa_sha384 );
135 #endif
136 
137 /* RSA and SHA-512 */
138 #if defined ( CRYPTO_PUBKEY_RSA ) && defined ( CRYPTO_DIGEST_SHA512 )
139 REQUIRE_OBJECT ( rsa_sha512 );
140 #endif
141 
142 /* RSA, AES-CBC, and SHA-1 */
143 #if defined ( CRYPTO_EXCHANGE_PUBKEY ) && defined ( CRYPTO_PUBKEY_RSA ) && \
144  defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA1 )
145 REQUIRE_OBJECT ( rsa_aes_cbc_sha1 );
146 #endif
147 
148 /* RSA, AES-CBC, and SHA-256 */
149 #if defined ( CRYPTO_EXCHANGE_PUBKEY ) && defined ( CRYPTO_PUBKEY_RSA ) && \
150  defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA256 )
151 REQUIRE_OBJECT ( rsa_aes_cbc_sha256 );
152 #endif
153 
154 /* RSA, AES-GCM, and SHA-256 */
155 #if defined ( CRYPTO_EXCHANGE_PUBKEY ) && defined ( CRYPTO_PUBKEY_RSA ) && \
156  defined ( CRYPTO_CIPHER_AES_GCM ) && defined ( CRYPTO_DIGEST_SHA256 )
157 REQUIRE_OBJECT ( rsa_aes_gcm_sha256 );
158 #endif
159 
160 /* RSA, AES-GCM, and SHA-384 */
161 #if defined ( CRYPTO_EXCHANGE_PUBKEY ) && defined ( CRYPTO_PUBKEY_RSA ) && \
162  defined ( CRYPTO_CIPHER_AES_GCM ) && defined ( CRYPTO_DIGEST_SHA384 )
163 REQUIRE_OBJECT ( rsa_aes_gcm_sha384 );
164 #endif
165 
166 /* DHE, RSA, AES-CBC, and SHA-1 */
167 #if defined ( CRYPTO_EXCHANGE_DHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
168  defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA1 )
169 REQUIRE_OBJECT ( dhe_rsa_aes_cbc_sha1 );
170 #endif
171 
172 /* DHE, RSA, AES-CBC, and SHA-256 */
173 #if defined ( CRYPTO_EXCHANGE_DHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
174  defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA256 )
175 REQUIRE_OBJECT ( dhe_rsa_aes_cbc_sha256 );
176 #endif
177 
178 /* DHE, RSA, AES-GCM, and SHA-256 */
179 #if defined ( CRYPTO_EXCHANGE_DHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
180  defined ( CRYPTO_CIPHER_AES_GCM ) && defined ( CRYPTO_DIGEST_SHA256 )
181 REQUIRE_OBJECT ( dhe_rsa_aes_gcm_sha256 );
182 #endif
183 
184 /* DHE, RSA, AES-GCM, and SHA-384 */
185 #if defined ( CRYPTO_EXCHANGE_DHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
186  defined ( CRYPTO_CIPHER_AES_GCM ) && defined ( CRYPTO_DIGEST_SHA384 )
187 REQUIRE_OBJECT ( dhe_rsa_aes_gcm_sha384 );
188 #endif
189 
190 /* ECDHE, RSA, AES-CBC, and SHA-1 */
191 #if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
192  defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA1 )
193 REQUIRE_OBJECT ( ecdhe_rsa_aes_cbc_sha1 );
194 #endif
195 
196 /* ECDHE, RSA, AES-CBC, and SHA-256 */
197 #if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
198  defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA256 )
199 REQUIRE_OBJECT ( ecdhe_rsa_aes_cbc_sha256 );
200 #endif
201 
202 /* ECDHE, RSA, AES-CBC, and SHA-384 */
203 #if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
204  defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA384 )
205 REQUIRE_OBJECT ( ecdhe_rsa_aes_cbc_sha384 );
206 #endif
207 
208 /* ECDHE, RSA, AES-GCM, and SHA-256 */
209 #if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
210  defined ( CRYPTO_CIPHER_AES_GCM ) && defined ( CRYPTO_DIGEST_SHA256 )
211 REQUIRE_OBJECT ( ecdhe_rsa_aes_gcm_sha256 );
212 #endif
213 
214 /* ECDHE, RSA, AES-GCM, and SHA-384 */
215 #if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_RSA ) && \
216  defined ( CRYPTO_CIPHER_AES_GCM ) && defined ( CRYPTO_DIGEST_SHA384 )
217 REQUIRE_OBJECT ( ecdhe_rsa_aes_gcm_sha384 );
218 #endif
219 
220 /* ECDSA and SHA-224 */
221 #if defined ( CRYPTO_PUBKEY_ECDSA ) && defined ( CRYPTO_DIGEST_SHA224 )
222 REQUIRE_OBJECT ( ecdsa_sha224 );
223 #endif
224 
225 /* ECDSA and SHA-256 */
226 #if defined ( CRYPTO_PUBKEY_ECDSA ) && defined ( CRYPTO_DIGEST_SHA256 )
227 REQUIRE_OBJECT ( ecdsa_sha256 );
228 #endif
229 
230 /* ECDSA and SHA-384 */
231 #if defined ( CRYPTO_PUBKEY_ECDSA ) && defined ( CRYPTO_DIGEST_SHA384 )
232 REQUIRE_OBJECT ( ecdsa_sha384 );
233 #endif
234 
235 /* ECDSA and SHA-512 */
236 #if defined ( CRYPTO_PUBKEY_ECDSA ) && defined ( CRYPTO_DIGEST_SHA512 )
237 REQUIRE_OBJECT ( ecdsa_sha512 );
238 #endif
239 
240 /* ECDHE, ECDSA, AES-CBC, and SHA-1 */
241 #if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_ECDSA ) && \
242  defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA1 )
243 REQUIRE_OBJECT ( ecdhe_ecdsa_aes_cbc_sha1 );
244 #endif
245 
246 /* ECDHE, ECDSA, AES-CBC, and SHA-256 */
247 #if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_ECDSA ) && \
248  defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA256 )
249 REQUIRE_OBJECT ( ecdhe_ecdsa_aes_cbc_sha256 );
250 #endif
251 
252 /* ECDHE, ECDSA, AES-CBC, and SHA-384 */
253 #if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_ECDSA ) && \
254  defined ( CRYPTO_CIPHER_AES_CBC ) && defined ( CRYPTO_DIGEST_SHA384 )
255 REQUIRE_OBJECT ( ecdhe_ecdsa_aes_cbc_sha384 );
256 #endif
257 
258 /* ECDHE, ECDSA, AES-GCM, and SHA-256 */
259 #if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_ECDSA ) && \
260  defined ( CRYPTO_CIPHER_AES_GCM ) && defined ( CRYPTO_DIGEST_SHA256 )
261 REQUIRE_OBJECT ( ecdhe_ecdsa_aes_gcm_sha256 );
262 #endif
263 
264 /* ECDHE, ECDSA, AES-GCM, and SHA-384 */
265 #if defined ( CRYPTO_EXCHANGE_ECDHE ) && defined ( CRYPTO_PUBKEY_ECDSA ) && \
266  defined ( CRYPTO_CIPHER_AES_GCM ) && defined ( CRYPTO_DIGEST_SHA384 )
267 REQUIRE_OBJECT ( ecdhe_ecdsa_aes_gcm_sha384 );
268 #endif
static uint8_t oid_sha1[]
"sha1" object identifier
Definition: oid_sha1.c:31
static uint8_t oid_md4[]
"md4" object identifier
Definition: oid_md4.c:31
static uint8_t oid_sha512[]
"sha512" object identifier
Definition: oid_sha512.c:31
#define REQUIRE_OBJECT(object)
Require an object.
Definition: compiler.h:202
FILE_SECBOOT(PERMITTED)
PROVIDE_REQUIRING_SYMBOL()
static uint8_t oid_x25519[]
"x25519" object identifier
Definition: oid_x25519.c:33
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static uint8_t oid_sha224[]
"sha224" object identifier
Definition: oid_sha224.c:31
static uint8_t oid_sha384[]
"sha384" object identifier
Definition: oid_sha384.c:31
static uint8_t oid_sha512_224[]
"sha512_224" object identifier
Cryptographic configuration.
static uint8_t oid_sha256[]
"sha256" object identifier
Definition: oid_sha256.c:31
static uint8_t oid_md5[]
"md5" object identifier
Definition: oid_md5.c:31
static uint8_t oid_sha512_256[]
"sha512_256" object identifier