xref: /netbsd-src/crypto/external/bsd/openssl/dist/crypto/evp/c_allc.c (revision b0d1725196a7921d003d2c66a14f186abda4176b)
1c7da899bSchristos /*
2*b0d17251Schristos  * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
3a89c9211Schristos  *
4*b0d17251Schristos  * Licensed under the Apache License 2.0 (the "License").  You may not use
5c7da899bSchristos  * this file except in compliance with the License.  You can obtain a copy
6c7da899bSchristos  * in the file LICENSE in the source distribution or at
7c7da899bSchristos  * https://www.openssl.org/source/license.html
8a89c9211Schristos  */
9a89c9211Schristos 
10a89c9211Schristos #include <stdio.h>
11c7da899bSchristos #include "internal/cryptlib.h"
12a89c9211Schristos #include <openssl/evp.h>
137d004720Schristos #include "crypto/evp.h"
14a89c9211Schristos #include <openssl/pkcs12.h>
15a89c9211Schristos #include <openssl/objects.h>
16a89c9211Schristos 
openssl_add_all_ciphers_int(void)17c7da899bSchristos void openssl_add_all_ciphers_int(void)
18a89c9211Schristos {
19a89c9211Schristos 
20a89c9211Schristos #ifndef OPENSSL_NO_DES
21a89c9211Schristos     EVP_add_cipher(EVP_des_cfb());
22a89c9211Schristos     EVP_add_cipher(EVP_des_cfb1());
23a89c9211Schristos     EVP_add_cipher(EVP_des_cfb8());
24a89c9211Schristos     EVP_add_cipher(EVP_des_ede_cfb());
25a89c9211Schristos     EVP_add_cipher(EVP_des_ede3_cfb());
26cef2ee70Schristos     EVP_add_cipher(EVP_des_ede3_cfb1());
27cef2ee70Schristos     EVP_add_cipher(EVP_des_ede3_cfb8());
28a89c9211Schristos 
29a89c9211Schristos     EVP_add_cipher(EVP_des_ofb());
30a89c9211Schristos     EVP_add_cipher(EVP_des_ede_ofb());
31a89c9211Schristos     EVP_add_cipher(EVP_des_ede3_ofb());
32a89c9211Schristos 
33a89c9211Schristos     EVP_add_cipher(EVP_desx_cbc());
34a89c9211Schristos     EVP_add_cipher_alias(SN_desx_cbc, "DESX");
35a89c9211Schristos     EVP_add_cipher_alias(SN_desx_cbc, "desx");
36a89c9211Schristos 
37a89c9211Schristos     EVP_add_cipher(EVP_des_cbc());
38a89c9211Schristos     EVP_add_cipher_alias(SN_des_cbc, "DES");
39a89c9211Schristos     EVP_add_cipher_alias(SN_des_cbc, "des");
40a89c9211Schristos     EVP_add_cipher(EVP_des_ede_cbc());
41a89c9211Schristos     EVP_add_cipher(EVP_des_ede3_cbc());
42a89c9211Schristos     EVP_add_cipher_alias(SN_des_ede3_cbc, "DES3");
43a89c9211Schristos     EVP_add_cipher_alias(SN_des_ede3_cbc, "des3");
44a89c9211Schristos 
45a89c9211Schristos     EVP_add_cipher(EVP_des_ecb());
46a89c9211Schristos     EVP_add_cipher(EVP_des_ede());
47c7da899bSchristos     EVP_add_cipher_alias(SN_des_ede_ecb, "DES-EDE-ECB");
48c7da899bSchristos     EVP_add_cipher_alias(SN_des_ede_ecb, "des-ede-ecb");
49a89c9211Schristos     EVP_add_cipher(EVP_des_ede3());
50c7da899bSchristos     EVP_add_cipher_alias(SN_des_ede3_ecb, "DES-EDE3-ECB");
51c7da899bSchristos     EVP_add_cipher_alias(SN_des_ede3_ecb, "des-ede3-ecb");
52a6054fbfSspz     EVP_add_cipher(EVP_des_ede3_wrap());
53c7da899bSchristos     EVP_add_cipher_alias(SN_id_smime_alg_CMS3DESwrap, "des3-wrap");
54a89c9211Schristos #endif
55a89c9211Schristos 
56a89c9211Schristos #ifndef OPENSSL_NO_RC4
57a89c9211Schristos     EVP_add_cipher(EVP_rc4());
58a89c9211Schristos     EVP_add_cipher(EVP_rc4_40());
5932daad53Schristos # ifndef OPENSSL_NO_MD5
6032daad53Schristos     EVP_add_cipher(EVP_rc4_hmac_md5());
6132daad53Schristos # endif
62a89c9211Schristos #endif
63a89c9211Schristos 
64a89c9211Schristos #ifndef OPENSSL_NO_IDEA
65a89c9211Schristos     EVP_add_cipher(EVP_idea_ecb());
66a89c9211Schristos     EVP_add_cipher(EVP_idea_cfb());
67a89c9211Schristos     EVP_add_cipher(EVP_idea_ofb());
68a89c9211Schristos     EVP_add_cipher(EVP_idea_cbc());
69a89c9211Schristos     EVP_add_cipher_alias(SN_idea_cbc, "IDEA");
70a89c9211Schristos     EVP_add_cipher_alias(SN_idea_cbc, "idea");
71a89c9211Schristos #endif
72a89c9211Schristos 
73a89c9211Schristos #ifndef OPENSSL_NO_SEED
74a89c9211Schristos     EVP_add_cipher(EVP_seed_ecb());
75a89c9211Schristos     EVP_add_cipher(EVP_seed_cfb());
76a89c9211Schristos     EVP_add_cipher(EVP_seed_ofb());
77a89c9211Schristos     EVP_add_cipher(EVP_seed_cbc());
78a89c9211Schristos     EVP_add_cipher_alias(SN_seed_cbc, "SEED");
79a89c9211Schristos     EVP_add_cipher_alias(SN_seed_cbc, "seed");
80a89c9211Schristos #endif
81a89c9211Schristos 
8213d40330Schristos #ifndef OPENSSL_NO_SM4
8313d40330Schristos     EVP_add_cipher(EVP_sm4_ecb());
8413d40330Schristos     EVP_add_cipher(EVP_sm4_cbc());
8513d40330Schristos     EVP_add_cipher(EVP_sm4_cfb());
8613d40330Schristos     EVP_add_cipher(EVP_sm4_ofb());
8713d40330Schristos     EVP_add_cipher(EVP_sm4_ctr());
8813d40330Schristos     EVP_add_cipher_alias(SN_sm4_cbc, "SM4");
8913d40330Schristos     EVP_add_cipher_alias(SN_sm4_cbc, "sm4");
9013d40330Schristos #endif
9113d40330Schristos 
92a89c9211Schristos #ifndef OPENSSL_NO_RC2
93a89c9211Schristos     EVP_add_cipher(EVP_rc2_ecb());
94a89c9211Schristos     EVP_add_cipher(EVP_rc2_cfb());
95a89c9211Schristos     EVP_add_cipher(EVP_rc2_ofb());
96a89c9211Schristos     EVP_add_cipher(EVP_rc2_cbc());
97a89c9211Schristos     EVP_add_cipher(EVP_rc2_40_cbc());
98a89c9211Schristos     EVP_add_cipher(EVP_rc2_64_cbc());
99a89c9211Schristos     EVP_add_cipher_alias(SN_rc2_cbc, "RC2");
100a89c9211Schristos     EVP_add_cipher_alias(SN_rc2_cbc, "rc2");
101c7da899bSchristos     EVP_add_cipher_alias(SN_rc2_cbc, "rc2-128");
102c7da899bSchristos     EVP_add_cipher_alias(SN_rc2_64_cbc, "rc2-64");
103c7da899bSchristos     EVP_add_cipher_alias(SN_rc2_40_cbc, "rc2-40");
104a89c9211Schristos #endif
105a89c9211Schristos 
106a89c9211Schristos #ifndef OPENSSL_NO_BF
107a89c9211Schristos     EVP_add_cipher(EVP_bf_ecb());
108a89c9211Schristos     EVP_add_cipher(EVP_bf_cfb());
109a89c9211Schristos     EVP_add_cipher(EVP_bf_ofb());
110a89c9211Schristos     EVP_add_cipher(EVP_bf_cbc());
111a89c9211Schristos     EVP_add_cipher_alias(SN_bf_cbc, "BF");
112a89c9211Schristos     EVP_add_cipher_alias(SN_bf_cbc, "bf");
113a89c9211Schristos     EVP_add_cipher_alias(SN_bf_cbc, "blowfish");
114a89c9211Schristos #endif
115a89c9211Schristos 
116a89c9211Schristos #ifndef OPENSSL_NO_CAST
117a89c9211Schristos     EVP_add_cipher(EVP_cast5_ecb());
118a89c9211Schristos     EVP_add_cipher(EVP_cast5_cfb());
119a89c9211Schristos     EVP_add_cipher(EVP_cast5_ofb());
120a89c9211Schristos     EVP_add_cipher(EVP_cast5_cbc());
121a89c9211Schristos     EVP_add_cipher_alias(SN_cast5_cbc, "CAST");
122a89c9211Schristos     EVP_add_cipher_alias(SN_cast5_cbc, "cast");
123a89c9211Schristos     EVP_add_cipher_alias(SN_cast5_cbc, "CAST-cbc");
124a89c9211Schristos     EVP_add_cipher_alias(SN_cast5_cbc, "cast-cbc");
125a89c9211Schristos #endif
126a89c9211Schristos 
127a89c9211Schristos #ifndef OPENSSL_NO_RC5
128a89c9211Schristos     EVP_add_cipher(EVP_rc5_32_12_16_ecb());
129a89c9211Schristos     EVP_add_cipher(EVP_rc5_32_12_16_cfb());
130a89c9211Schristos     EVP_add_cipher(EVP_rc5_32_12_16_ofb());
131a89c9211Schristos     EVP_add_cipher(EVP_rc5_32_12_16_cbc());
132a89c9211Schristos     EVP_add_cipher_alias(SN_rc5_cbc, "rc5");
133a89c9211Schristos     EVP_add_cipher_alias(SN_rc5_cbc, "RC5");
134a89c9211Schristos #endif
135a89c9211Schristos 
136a89c9211Schristos     EVP_add_cipher(EVP_aes_128_ecb());
137a89c9211Schristos     EVP_add_cipher(EVP_aes_128_cbc());
138a89c9211Schristos     EVP_add_cipher(EVP_aes_128_cfb());
139a89c9211Schristos     EVP_add_cipher(EVP_aes_128_cfb1());
140a89c9211Schristos     EVP_add_cipher(EVP_aes_128_cfb8());
141a89c9211Schristos     EVP_add_cipher(EVP_aes_128_ofb());
142a89c9211Schristos     EVP_add_cipher(EVP_aes_128_ctr());
14332daad53Schristos     EVP_add_cipher(EVP_aes_128_gcm());
144c7da899bSchristos #ifndef OPENSSL_NO_OCB
145c7da899bSchristos     EVP_add_cipher(EVP_aes_128_ocb());
146c7da899bSchristos #endif
14732daad53Schristos     EVP_add_cipher(EVP_aes_128_xts());
148a6054fbfSspz     EVP_add_cipher(EVP_aes_128_ccm());
149a6054fbfSspz     EVP_add_cipher(EVP_aes_128_wrap());
150c7da899bSchristos     EVP_add_cipher_alias(SN_id_aes128_wrap, "aes128-wrap");
151c7da899bSchristos     EVP_add_cipher(EVP_aes_128_wrap_pad());
152a89c9211Schristos     EVP_add_cipher_alias(SN_aes_128_cbc, "AES128");
153a89c9211Schristos     EVP_add_cipher_alias(SN_aes_128_cbc, "aes128");
154a89c9211Schristos     EVP_add_cipher(EVP_aes_192_ecb());
155a89c9211Schristos     EVP_add_cipher(EVP_aes_192_cbc());
156a89c9211Schristos     EVP_add_cipher(EVP_aes_192_cfb());
157a89c9211Schristos     EVP_add_cipher(EVP_aes_192_cfb1());
158a89c9211Schristos     EVP_add_cipher(EVP_aes_192_cfb8());
159a89c9211Schristos     EVP_add_cipher(EVP_aes_192_ofb());
160a89c9211Schristos     EVP_add_cipher(EVP_aes_192_ctr());
16132daad53Schristos     EVP_add_cipher(EVP_aes_192_gcm());
162c7da899bSchristos #ifndef OPENSSL_NO_OCB
163c7da899bSchristos     EVP_add_cipher(EVP_aes_192_ocb());
164c7da899bSchristos #endif
165a6054fbfSspz     EVP_add_cipher(EVP_aes_192_ccm());
166a6054fbfSspz     EVP_add_cipher(EVP_aes_192_wrap());
167c7da899bSchristos     EVP_add_cipher_alias(SN_id_aes192_wrap, "aes192-wrap");
168c7da899bSchristos     EVP_add_cipher(EVP_aes_192_wrap_pad());
169a89c9211Schristos     EVP_add_cipher_alias(SN_aes_192_cbc, "AES192");
170a89c9211Schristos     EVP_add_cipher_alias(SN_aes_192_cbc, "aes192");
171a89c9211Schristos     EVP_add_cipher(EVP_aes_256_ecb());
172a89c9211Schristos     EVP_add_cipher(EVP_aes_256_cbc());
173a89c9211Schristos     EVP_add_cipher(EVP_aes_256_cfb());
174a89c9211Schristos     EVP_add_cipher(EVP_aes_256_cfb1());
175a89c9211Schristos     EVP_add_cipher(EVP_aes_256_cfb8());
176a89c9211Schristos     EVP_add_cipher(EVP_aes_256_ofb());
177a89c9211Schristos     EVP_add_cipher(EVP_aes_256_ctr());
17832daad53Schristos     EVP_add_cipher(EVP_aes_256_gcm());
179c7da899bSchristos #ifndef OPENSSL_NO_OCB
180c7da899bSchristos     EVP_add_cipher(EVP_aes_256_ocb());
181c7da899bSchristos #endif
18232daad53Schristos     EVP_add_cipher(EVP_aes_256_xts());
183a6054fbfSspz     EVP_add_cipher(EVP_aes_256_ccm());
184a6054fbfSspz     EVP_add_cipher(EVP_aes_256_wrap());
185c7da899bSchristos     EVP_add_cipher_alias(SN_id_aes256_wrap, "aes256-wrap");
186c7da899bSchristos     EVP_add_cipher(EVP_aes_256_wrap_pad());
187a89c9211Schristos     EVP_add_cipher_alias(SN_aes_256_cbc, "AES256");
188a89c9211Schristos     EVP_add_cipher_alias(SN_aes_256_cbc, "aes256");
18932daad53Schristos     EVP_add_cipher(EVP_aes_128_cbc_hmac_sha1());
19032daad53Schristos     EVP_add_cipher(EVP_aes_256_cbc_hmac_sha1());
191a6054fbfSspz     EVP_add_cipher(EVP_aes_128_cbc_hmac_sha256());
192a6054fbfSspz     EVP_add_cipher(EVP_aes_256_cbc_hmac_sha256());
19313d40330Schristos #ifndef OPENSSL_NO_ARIA
19413d40330Schristos     EVP_add_cipher(EVP_aria_128_ecb());
19513d40330Schristos     EVP_add_cipher(EVP_aria_128_cbc());
19613d40330Schristos     EVP_add_cipher(EVP_aria_128_cfb());
19713d40330Schristos     EVP_add_cipher(EVP_aria_128_cfb1());
19813d40330Schristos     EVP_add_cipher(EVP_aria_128_cfb8());
19913d40330Schristos     EVP_add_cipher(EVP_aria_128_ctr());
20013d40330Schristos     EVP_add_cipher(EVP_aria_128_ofb());
20113d40330Schristos     EVP_add_cipher(EVP_aria_128_gcm());
20213d40330Schristos     EVP_add_cipher(EVP_aria_128_ccm());
20313d40330Schristos     EVP_add_cipher_alias(SN_aria_128_cbc, "ARIA128");
20413d40330Schristos     EVP_add_cipher_alias(SN_aria_128_cbc, "aria128");
20513d40330Schristos     EVP_add_cipher(EVP_aria_192_ecb());
20613d40330Schristos     EVP_add_cipher(EVP_aria_192_cbc());
20713d40330Schristos     EVP_add_cipher(EVP_aria_192_cfb());
20813d40330Schristos     EVP_add_cipher(EVP_aria_192_cfb1());
20913d40330Schristos     EVP_add_cipher(EVP_aria_192_cfb8());
21013d40330Schristos     EVP_add_cipher(EVP_aria_192_ctr());
21113d40330Schristos     EVP_add_cipher(EVP_aria_192_ofb());
21213d40330Schristos     EVP_add_cipher(EVP_aria_192_gcm());
21313d40330Schristos     EVP_add_cipher(EVP_aria_192_ccm());
21413d40330Schristos     EVP_add_cipher_alias(SN_aria_192_cbc, "ARIA192");
21513d40330Schristos     EVP_add_cipher_alias(SN_aria_192_cbc, "aria192");
21613d40330Schristos     EVP_add_cipher(EVP_aria_256_ecb());
21713d40330Schristos     EVP_add_cipher(EVP_aria_256_cbc());
21813d40330Schristos     EVP_add_cipher(EVP_aria_256_cfb());
21913d40330Schristos     EVP_add_cipher(EVP_aria_256_cfb1());
22013d40330Schristos     EVP_add_cipher(EVP_aria_256_cfb8());
22113d40330Schristos     EVP_add_cipher(EVP_aria_256_ctr());
22213d40330Schristos     EVP_add_cipher(EVP_aria_256_ofb());
22313d40330Schristos     EVP_add_cipher(EVP_aria_256_gcm());
22413d40330Schristos     EVP_add_cipher(EVP_aria_256_ccm());
22513d40330Schristos     EVP_add_cipher_alias(SN_aria_256_cbc, "ARIA256");
22613d40330Schristos     EVP_add_cipher_alias(SN_aria_256_cbc, "aria256");
22713d40330Schristos #endif
22813d40330Schristos 
229a89c9211Schristos #ifndef OPENSSL_NO_CAMELLIA
230a89c9211Schristos     EVP_add_cipher(EVP_camellia_128_ecb());
231a89c9211Schristos     EVP_add_cipher(EVP_camellia_128_cbc());
232a89c9211Schristos     EVP_add_cipher(EVP_camellia_128_cfb());
233a89c9211Schristos     EVP_add_cipher(EVP_camellia_128_cfb1());
234a89c9211Schristos     EVP_add_cipher(EVP_camellia_128_cfb8());
235a89c9211Schristos     EVP_add_cipher(EVP_camellia_128_ofb());
236a89c9211Schristos     EVP_add_cipher_alias(SN_camellia_128_cbc, "CAMELLIA128");
237a89c9211Schristos     EVP_add_cipher_alias(SN_camellia_128_cbc, "camellia128");
238a89c9211Schristos     EVP_add_cipher(EVP_camellia_192_ecb());
239a89c9211Schristos     EVP_add_cipher(EVP_camellia_192_cbc());
240a89c9211Schristos     EVP_add_cipher(EVP_camellia_192_cfb());
241a89c9211Schristos     EVP_add_cipher(EVP_camellia_192_cfb1());
242a89c9211Schristos     EVP_add_cipher(EVP_camellia_192_cfb8());
243a89c9211Schristos     EVP_add_cipher(EVP_camellia_192_ofb());
244a89c9211Schristos     EVP_add_cipher_alias(SN_camellia_192_cbc, "CAMELLIA192");
245a89c9211Schristos     EVP_add_cipher_alias(SN_camellia_192_cbc, "camellia192");
246a89c9211Schristos     EVP_add_cipher(EVP_camellia_256_ecb());
247a89c9211Schristos     EVP_add_cipher(EVP_camellia_256_cbc());
248a89c9211Schristos     EVP_add_cipher(EVP_camellia_256_cfb());
249a89c9211Schristos     EVP_add_cipher(EVP_camellia_256_cfb1());
250a89c9211Schristos     EVP_add_cipher(EVP_camellia_256_cfb8());
251a89c9211Schristos     EVP_add_cipher(EVP_camellia_256_ofb());
252a89c9211Schristos     EVP_add_cipher_alias(SN_camellia_256_cbc, "CAMELLIA256");
253a89c9211Schristos     EVP_add_cipher_alias(SN_camellia_256_cbc, "camellia256");
254c7da899bSchristos     EVP_add_cipher(EVP_camellia_128_ctr());
255c7da899bSchristos     EVP_add_cipher(EVP_camellia_192_ctr());
256c7da899bSchristos     EVP_add_cipher(EVP_camellia_256_ctr());
257c7da899bSchristos #endif
258c7da899bSchristos 
259c7da899bSchristos #ifndef OPENSSL_NO_CHACHA
260c7da899bSchristos     EVP_add_cipher(EVP_chacha20());
261c7da899bSchristos # ifndef OPENSSL_NO_POLY1305
262c7da899bSchristos     EVP_add_cipher(EVP_chacha20_poly1305());
263c7da899bSchristos # endif
264a89c9211Schristos #endif
265a89c9211Schristos }
266