/src/openssl36/providers/defltprov.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2019-2026 The OpenSSL Project Authors. All Rights Reserved. |
3 | | * |
4 | | * Licensed under the Apache License 2.0 (the "License"). You may not use |
5 | | * this file except in compliance with the License. You can obtain a copy |
6 | | * in the file LICENSE in the source distribution or at |
7 | | * https://www.openssl.org/source/license.html |
8 | | */ |
9 | | |
10 | | #include <string.h> |
11 | | #include <stdio.h> |
12 | | #include <openssl/opensslconf.h> |
13 | | #include <openssl/core.h> |
14 | | #include <openssl/core_dispatch.h> |
15 | | #include <openssl/core_names.h> |
16 | | #include <openssl/params.h> |
17 | | #include "prov/bio.h" |
18 | | #include "prov/provider_ctx.h" |
19 | | #include "prov/providercommon.h" |
20 | | #include "prov/implementations.h" |
21 | | #include "prov/names.h" |
22 | | #include "prov/provider_util.h" |
23 | | #include "prov/seeding.h" |
24 | | #include "internal/nelem.h" |
25 | | |
26 | | /* |
27 | | * Forward declarations to ensure that interface functions are correctly |
28 | | * defined. |
29 | | */ |
30 | | static OSSL_FUNC_provider_gettable_params_fn deflt_gettable_params; |
31 | | static OSSL_FUNC_provider_get_params_fn deflt_get_params; |
32 | | static OSSL_FUNC_provider_query_operation_fn deflt_query; |
33 | | |
34 | | #define ALGC(NAMES, FUNC, CHECK) { { NAMES, "provider=default", FUNC }, CHECK } |
35 | | #define ALG(NAMES, FUNC) ALGC(NAMES, FUNC, NULL) |
36 | | |
37 | | /* Parameters we provide to the core */ |
38 | | static const OSSL_PARAM deflt_param_types[] = { |
39 | | OSSL_PARAM_DEFN(OSSL_PROV_PARAM_NAME, OSSL_PARAM_UTF8_PTR, NULL, 0), |
40 | | OSSL_PARAM_DEFN(OSSL_PROV_PARAM_VERSION, OSSL_PARAM_UTF8_PTR, NULL, 0), |
41 | | OSSL_PARAM_DEFN(OSSL_PROV_PARAM_BUILDINFO, OSSL_PARAM_UTF8_PTR, NULL, 0), |
42 | | OSSL_PARAM_DEFN(OSSL_PROV_PARAM_STATUS, OSSL_PARAM_INTEGER, NULL, 0), |
43 | | OSSL_PARAM_END |
44 | | }; |
45 | | |
46 | | static const OSSL_PARAM *deflt_gettable_params(void *provctx) |
47 | 0 | { |
48 | 0 | return deflt_param_types; |
49 | 0 | } |
50 | | |
51 | | static int deflt_get_params(void *provctx, OSSL_PARAM params[]) |
52 | 0 | { |
53 | 0 | OSSL_PARAM *p; |
54 | |
|
55 | 0 | p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_NAME); |
56 | 0 | if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, "OpenSSL Default Provider")) |
57 | 0 | return 0; |
58 | 0 | p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_VERSION); |
59 | 0 | if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, OPENSSL_VERSION_STR)) |
60 | 0 | return 0; |
61 | 0 | p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_BUILDINFO); |
62 | 0 | if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, OPENSSL_FULL_VERSION_STR)) |
63 | 0 | return 0; |
64 | 0 | p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_STATUS); |
65 | 0 | if (p != NULL && !OSSL_PARAM_set_int(p, ossl_prov_is_running())) |
66 | 0 | return 0; |
67 | 0 | return 1; |
68 | 0 | } |
69 | | |
70 | | /* |
71 | | * For the algorithm names, we use the following formula for our primary |
72 | | * names: |
73 | | * |
74 | | * ALGNAME[VERSION?][-SUBNAME[VERSION?]?][-SIZE?][-MODE?] |
75 | | * |
76 | | * VERSION is only present if there are multiple versions of |
77 | | * an alg (MD2, MD4, MD5). It may be omitted if there is only |
78 | | * one version (if a subsequent version is released in the future, |
79 | | * we can always change the canonical name, and add the old name |
80 | | * as an alias). |
81 | | * |
82 | | * SUBNAME may be present where we are combining multiple |
83 | | * algorithms together, e.g. MD5-SHA1. |
84 | | * |
85 | | * SIZE is only present if multiple versions of an algorithm exist |
86 | | * with different sizes (e.g. AES-128-CBC, AES-256-CBC) |
87 | | * |
88 | | * MODE is only present where applicable. |
89 | | * |
90 | | * We add diverse other names where applicable, such as the names that |
91 | | * NIST uses, or that are used for ASN.1 OBJECT IDENTIFIERs, or names |
92 | | * we have used historically. |
93 | | * |
94 | | * Algorithm names are case insensitive, but we use all caps in our "canonical" |
95 | | * names for consistency. |
96 | | */ |
97 | | static const OSSL_ALGORITHM deflt_digests[] = { |
98 | | /* Our primary name:NIST name[:our older names] */ |
99 | | { PROV_NAMES_SHA1, "provider=default", ossl_sha1_functions }, |
100 | | { PROV_NAMES_SHA2_224, "provider=default", ossl_sha224_functions }, |
101 | | { PROV_NAMES_SHA2_256, "provider=default", ossl_sha256_functions }, |
102 | | { PROV_NAMES_SHA2_256_192, "provider=default", ossl_sha256_192_internal_functions }, |
103 | | { PROV_NAMES_SHA2_384, "provider=default", ossl_sha384_functions }, |
104 | | { PROV_NAMES_SHA2_512, "provider=default", ossl_sha512_functions }, |
105 | | { PROV_NAMES_SHA2_512_224, "provider=default", ossl_sha512_224_functions }, |
106 | | { PROV_NAMES_SHA2_512_256, "provider=default", ossl_sha512_256_functions }, |
107 | | |
108 | | /* We agree with NIST here, so one name only */ |
109 | | { PROV_NAMES_SHA3_224, "provider=default", ossl_sha3_224_functions }, |
110 | | { PROV_NAMES_SHA3_256, "provider=default", ossl_sha3_256_functions }, |
111 | | { PROV_NAMES_SHA3_384, "provider=default", ossl_sha3_384_functions }, |
112 | | { PROV_NAMES_SHA3_512, "provider=default", ossl_sha3_512_functions }, |
113 | | |
114 | | { PROV_NAMES_KECCAK_224, "provider=default", ossl_keccak_224_functions }, |
115 | | { PROV_NAMES_KECCAK_256, "provider=default", ossl_keccak_256_functions }, |
116 | | { PROV_NAMES_KECCAK_384, "provider=default", ossl_keccak_384_functions }, |
117 | | { PROV_NAMES_KECCAK_512, "provider=default", ossl_keccak_512_functions }, |
118 | | |
119 | | /* |
120 | | * KECCAK-KMAC-128 and KECCAK-KMAC-256 as hashes are mostly useful for |
121 | | * the KMAC-128 and KMAC-256. |
122 | | */ |
123 | | { PROV_NAMES_KECCAK_KMAC_128, "provider=default", |
124 | | ossl_keccak_kmac_128_functions }, |
125 | | { PROV_NAMES_KECCAK_KMAC_256, "provider=default", |
126 | | ossl_keccak_kmac_256_functions }, |
127 | | |
128 | | /* Our primary name:NIST name */ |
129 | | { PROV_NAMES_SHAKE_128, "provider=default", ossl_shake_128_functions }, |
130 | | { PROV_NAMES_SHAKE_256, "provider=default", ossl_shake_256_functions }, |
131 | | |
132 | | #ifndef OPENSSL_NO_BLAKE2 |
133 | | /* |
134 | | * https://blake2.net/ doesn't specify size variants, |
135 | | * but mentions that Bouncy Castle uses the names |
136 | | * BLAKE2b-160, BLAKE2b-256, BLAKE2b-384, and BLAKE2b-512 |
137 | | * If we assume that "2b" and "2s" are versions, that pattern |
138 | | * fits with ours. We also add our historical names. |
139 | | */ |
140 | | { PROV_NAMES_BLAKE2S_256, "provider=default", ossl_blake2s256_functions }, |
141 | | { PROV_NAMES_BLAKE2B_512, "provider=default", ossl_blake2b512_functions }, |
142 | | #endif /* OPENSSL_NO_BLAKE2 */ |
143 | | |
144 | | #ifndef OPENSSL_NO_SM3 |
145 | | { PROV_NAMES_SM3, "provider=default", ossl_sm3_functions }, |
146 | | #endif /* OPENSSL_NO_SM3 */ |
147 | | |
148 | | #ifndef OPENSSL_NO_MD5 |
149 | | { PROV_NAMES_MD5, "provider=default", ossl_md5_functions }, |
150 | | { PROV_NAMES_MD5_SHA1, "provider=default", ossl_md5_sha1_functions }, |
151 | | #endif /* OPENSSL_NO_MD5 */ |
152 | | |
153 | | #ifndef OPENSSL_NO_RMD160 |
154 | | { PROV_NAMES_RIPEMD_160, "provider=default", ossl_ripemd160_functions }, |
155 | | #endif /* OPENSSL_NO_RMD160 */ |
156 | | |
157 | | { PROV_NAMES_NULL, "provider=default", ossl_nullmd_functions }, |
158 | | { NULL, NULL, NULL } |
159 | | }; |
160 | | |
161 | | static const OSSL_ALGORITHM_CAPABLE deflt_ciphers[] = { |
162 | | ALG(PROV_NAMES_NULL, ossl_null_functions), |
163 | | ALG(PROV_NAMES_AES_256_ECB, ossl_aes256ecb_functions), |
164 | | ALG(PROV_NAMES_AES_192_ECB, ossl_aes192ecb_functions), |
165 | | ALG(PROV_NAMES_AES_128_ECB, ossl_aes128ecb_functions), |
166 | | ALG(PROV_NAMES_AES_256_CBC, ossl_aes256cbc_functions), |
167 | | ALG(PROV_NAMES_AES_192_CBC, ossl_aes192cbc_functions), |
168 | | ALG(PROV_NAMES_AES_128_CBC, ossl_aes128cbc_functions), |
169 | | ALG(PROV_NAMES_AES_128_CBC_CTS, ossl_aes128cbc_cts_functions), |
170 | | ALG(PROV_NAMES_AES_192_CBC_CTS, ossl_aes192cbc_cts_functions), |
171 | | ALG(PROV_NAMES_AES_256_CBC_CTS, ossl_aes256cbc_cts_functions), |
172 | | ALG(PROV_NAMES_AES_256_OFB, ossl_aes256ofb_functions), |
173 | | ALG(PROV_NAMES_AES_192_OFB, ossl_aes192ofb_functions), |
174 | | ALG(PROV_NAMES_AES_128_OFB, ossl_aes128ofb_functions), |
175 | | ALG(PROV_NAMES_AES_256_CFB, ossl_aes256cfb_functions), |
176 | | ALG(PROV_NAMES_AES_192_CFB, ossl_aes192cfb_functions), |
177 | | ALG(PROV_NAMES_AES_128_CFB, ossl_aes128cfb_functions), |
178 | | ALG(PROV_NAMES_AES_256_CFB1, ossl_aes256cfb1_functions), |
179 | | ALG(PROV_NAMES_AES_192_CFB1, ossl_aes192cfb1_functions), |
180 | | ALG(PROV_NAMES_AES_128_CFB1, ossl_aes128cfb1_functions), |
181 | | ALG(PROV_NAMES_AES_256_CFB8, ossl_aes256cfb8_functions), |
182 | | ALG(PROV_NAMES_AES_192_CFB8, ossl_aes192cfb8_functions), |
183 | | ALG(PROV_NAMES_AES_128_CFB8, ossl_aes128cfb8_functions), |
184 | | ALG(PROV_NAMES_AES_256_CTR, ossl_aes256ctr_functions), |
185 | | ALG(PROV_NAMES_AES_192_CTR, ossl_aes192ctr_functions), |
186 | | ALG(PROV_NAMES_AES_128_CTR, ossl_aes128ctr_functions), |
187 | | ALG(PROV_NAMES_AES_256_XTS, ossl_aes256xts_functions), |
188 | | ALG(PROV_NAMES_AES_128_XTS, ossl_aes128xts_functions), |
189 | | #ifndef OPENSSL_NO_OCB |
190 | | ALG(PROV_NAMES_AES_256_OCB, ossl_aes256ocb_functions), |
191 | | ALG(PROV_NAMES_AES_192_OCB, ossl_aes192ocb_functions), |
192 | | ALG(PROV_NAMES_AES_128_OCB, ossl_aes128ocb_functions), |
193 | | #endif /* OPENSSL_NO_OCB */ |
194 | | #ifndef OPENSSL_NO_SIV |
195 | | ALG(PROV_NAMES_AES_128_SIV, ossl_aes128siv_functions), |
196 | | ALG(PROV_NAMES_AES_192_SIV, ossl_aes192siv_functions), |
197 | | ALG(PROV_NAMES_AES_256_SIV, ossl_aes256siv_functions), |
198 | | ALG(PROV_NAMES_AES_128_GCM_SIV, ossl_aes128gcm_siv_functions), |
199 | | ALG(PROV_NAMES_AES_192_GCM_SIV, ossl_aes192gcm_siv_functions), |
200 | | ALG(PROV_NAMES_AES_256_GCM_SIV, ossl_aes256gcm_siv_functions), |
201 | | #endif /* OPENSSL_NO_SIV */ |
202 | | ALG(PROV_NAMES_AES_256_GCM, ossl_aes256gcm_functions), |
203 | | ALG(PROV_NAMES_AES_192_GCM, ossl_aes192gcm_functions), |
204 | | ALG(PROV_NAMES_AES_128_GCM, ossl_aes128gcm_functions), |
205 | | ALG(PROV_NAMES_AES_256_CCM, ossl_aes256ccm_functions), |
206 | | ALG(PROV_NAMES_AES_192_CCM, ossl_aes192ccm_functions), |
207 | | ALG(PROV_NAMES_AES_128_CCM, ossl_aes128ccm_functions), |
208 | | ALG(PROV_NAMES_AES_256_WRAP, ossl_aes256wrap_functions), |
209 | | ALG(PROV_NAMES_AES_192_WRAP, ossl_aes192wrap_functions), |
210 | | ALG(PROV_NAMES_AES_128_WRAP, ossl_aes128wrap_functions), |
211 | | ALG(PROV_NAMES_AES_256_WRAP_PAD, ossl_aes256wrappad_functions), |
212 | | ALG(PROV_NAMES_AES_192_WRAP_PAD, ossl_aes192wrappad_functions), |
213 | | ALG(PROV_NAMES_AES_128_WRAP_PAD, ossl_aes128wrappad_functions), |
214 | | ALG(PROV_NAMES_AES_256_WRAP_INV, ossl_aes256wrapinv_functions), |
215 | | ALG(PROV_NAMES_AES_192_WRAP_INV, ossl_aes192wrapinv_functions), |
216 | | ALG(PROV_NAMES_AES_128_WRAP_INV, ossl_aes128wrapinv_functions), |
217 | | ALG(PROV_NAMES_AES_256_WRAP_PAD_INV, ossl_aes256wrappadinv_functions), |
218 | | ALG(PROV_NAMES_AES_192_WRAP_PAD_INV, ossl_aes192wrappadinv_functions), |
219 | | ALG(PROV_NAMES_AES_128_WRAP_PAD_INV, ossl_aes128wrappadinv_functions), |
220 | | ALGC(PROV_NAMES_AES_128_CBC_HMAC_SHA1, ossl_aes128cbc_hmac_sha1_functions, |
221 | | ossl_cipher_capable_aes_cbc_hmac_sha1), |
222 | | ALGC(PROV_NAMES_AES_256_CBC_HMAC_SHA1, ossl_aes256cbc_hmac_sha1_functions, |
223 | | ossl_cipher_capable_aes_cbc_hmac_sha1), |
224 | | ALGC(PROV_NAMES_AES_128_CBC_HMAC_SHA256, ossl_aes128cbc_hmac_sha256_functions, |
225 | | ossl_cipher_capable_aes_cbc_hmac_sha256), |
226 | | ALGC(PROV_NAMES_AES_256_CBC_HMAC_SHA256, ossl_aes256cbc_hmac_sha256_functions, |
227 | | ossl_cipher_capable_aes_cbc_hmac_sha256), |
228 | | ALGC(PROV_NAMES_AES_128_CBC_HMAC_SHA1_ETM, ossl_aes128cbc_hmac_sha1_etm_functions, |
229 | | ossl_cipher_capable_aes_cbc_hmac_sha1_etm), |
230 | | ALGC(PROV_NAMES_AES_192_CBC_HMAC_SHA1_ETM, ossl_aes192cbc_hmac_sha1_etm_functions, |
231 | | ossl_cipher_capable_aes_cbc_hmac_sha1_etm), |
232 | | ALGC(PROV_NAMES_AES_256_CBC_HMAC_SHA1_ETM, ossl_aes256cbc_hmac_sha1_etm_functions, |
233 | | ossl_cipher_capable_aes_cbc_hmac_sha1_etm), |
234 | | ALGC(PROV_NAMES_AES_128_CBC_HMAC_SHA256_ETM, ossl_aes128cbc_hmac_sha256_etm_functions, |
235 | | ossl_cipher_capable_aes_cbc_hmac_sha256_etm), |
236 | | ALGC(PROV_NAMES_AES_192_CBC_HMAC_SHA256_ETM, ossl_aes192cbc_hmac_sha256_etm_functions, |
237 | | ossl_cipher_capable_aes_cbc_hmac_sha256_etm), |
238 | | ALGC(PROV_NAMES_AES_256_CBC_HMAC_SHA256_ETM, ossl_aes256cbc_hmac_sha256_etm_functions, |
239 | | ossl_cipher_capable_aes_cbc_hmac_sha256_etm), |
240 | | ALGC(PROV_NAMES_AES_128_CBC_HMAC_SHA512_ETM, ossl_aes128cbc_hmac_sha512_etm_functions, |
241 | | ossl_cipher_capable_aes_cbc_hmac_sha512_etm), |
242 | | ALGC(PROV_NAMES_AES_192_CBC_HMAC_SHA512_ETM, ossl_aes192cbc_hmac_sha512_etm_functions, |
243 | | ossl_cipher_capable_aes_cbc_hmac_sha512_etm), |
244 | | ALGC(PROV_NAMES_AES_256_CBC_HMAC_SHA512_ETM, ossl_aes256cbc_hmac_sha512_etm_functions, |
245 | | ossl_cipher_capable_aes_cbc_hmac_sha512_etm), |
246 | | #ifndef OPENSSL_NO_ARIA |
247 | | ALG(PROV_NAMES_ARIA_256_GCM, ossl_aria256gcm_functions), |
248 | | ALG(PROV_NAMES_ARIA_192_GCM, ossl_aria192gcm_functions), |
249 | | ALG(PROV_NAMES_ARIA_128_GCM, ossl_aria128gcm_functions), |
250 | | ALG(PROV_NAMES_ARIA_256_CCM, ossl_aria256ccm_functions), |
251 | | ALG(PROV_NAMES_ARIA_192_CCM, ossl_aria192ccm_functions), |
252 | | ALG(PROV_NAMES_ARIA_128_CCM, ossl_aria128ccm_functions), |
253 | | ALG(PROV_NAMES_ARIA_256_ECB, ossl_aria256ecb_functions), |
254 | | ALG(PROV_NAMES_ARIA_192_ECB, ossl_aria192ecb_functions), |
255 | | ALG(PROV_NAMES_ARIA_128_ECB, ossl_aria128ecb_functions), |
256 | | ALG(PROV_NAMES_ARIA_256_CBC, ossl_aria256cbc_functions), |
257 | | ALG(PROV_NAMES_ARIA_192_CBC, ossl_aria192cbc_functions), |
258 | | ALG(PROV_NAMES_ARIA_128_CBC, ossl_aria128cbc_functions), |
259 | | ALG(PROV_NAMES_ARIA_256_OFB, ossl_aria256ofb_functions), |
260 | | ALG(PROV_NAMES_ARIA_192_OFB, ossl_aria192ofb_functions), |
261 | | ALG(PROV_NAMES_ARIA_128_OFB, ossl_aria128ofb_functions), |
262 | | ALG(PROV_NAMES_ARIA_256_CFB, ossl_aria256cfb_functions), |
263 | | ALG(PROV_NAMES_ARIA_192_CFB, ossl_aria192cfb_functions), |
264 | | ALG(PROV_NAMES_ARIA_128_CFB, ossl_aria128cfb_functions), |
265 | | ALG(PROV_NAMES_ARIA_256_CFB1, ossl_aria256cfb1_functions), |
266 | | ALG(PROV_NAMES_ARIA_192_CFB1, ossl_aria192cfb1_functions), |
267 | | ALG(PROV_NAMES_ARIA_128_CFB1, ossl_aria128cfb1_functions), |
268 | | ALG(PROV_NAMES_ARIA_256_CFB8, ossl_aria256cfb8_functions), |
269 | | ALG(PROV_NAMES_ARIA_192_CFB8, ossl_aria192cfb8_functions), |
270 | | ALG(PROV_NAMES_ARIA_128_CFB8, ossl_aria128cfb8_functions), |
271 | | ALG(PROV_NAMES_ARIA_256_CTR, ossl_aria256ctr_functions), |
272 | | ALG(PROV_NAMES_ARIA_192_CTR, ossl_aria192ctr_functions), |
273 | | ALG(PROV_NAMES_ARIA_128_CTR, ossl_aria128ctr_functions), |
274 | | #endif /* OPENSSL_NO_ARIA */ |
275 | | #ifndef OPENSSL_NO_CAMELLIA |
276 | | ALG(PROV_NAMES_CAMELLIA_256_ECB, ossl_camellia256ecb_functions), |
277 | | ALG(PROV_NAMES_CAMELLIA_192_ECB, ossl_camellia192ecb_functions), |
278 | | ALG(PROV_NAMES_CAMELLIA_128_ECB, ossl_camellia128ecb_functions), |
279 | | ALG(PROV_NAMES_CAMELLIA_256_CBC, ossl_camellia256cbc_functions), |
280 | | ALG(PROV_NAMES_CAMELLIA_192_CBC, ossl_camellia192cbc_functions), |
281 | | ALG(PROV_NAMES_CAMELLIA_128_CBC, ossl_camellia128cbc_functions), |
282 | | ALG(PROV_NAMES_CAMELLIA_128_CBC_CTS, ossl_camellia128cbc_cts_functions), |
283 | | ALG(PROV_NAMES_CAMELLIA_192_CBC_CTS, ossl_camellia192cbc_cts_functions), |
284 | | ALG(PROV_NAMES_CAMELLIA_256_CBC_CTS, ossl_camellia256cbc_cts_functions), |
285 | | ALG(PROV_NAMES_CAMELLIA_256_OFB, ossl_camellia256ofb_functions), |
286 | | ALG(PROV_NAMES_CAMELLIA_192_OFB, ossl_camellia192ofb_functions), |
287 | | ALG(PROV_NAMES_CAMELLIA_128_OFB, ossl_camellia128ofb_functions), |
288 | | ALG(PROV_NAMES_CAMELLIA_256_CFB, ossl_camellia256cfb_functions), |
289 | | ALG(PROV_NAMES_CAMELLIA_192_CFB, ossl_camellia192cfb_functions), |
290 | | ALG(PROV_NAMES_CAMELLIA_128_CFB, ossl_camellia128cfb_functions), |
291 | | ALG(PROV_NAMES_CAMELLIA_256_CFB1, ossl_camellia256cfb1_functions), |
292 | | ALG(PROV_NAMES_CAMELLIA_192_CFB1, ossl_camellia192cfb1_functions), |
293 | | ALG(PROV_NAMES_CAMELLIA_128_CFB1, ossl_camellia128cfb1_functions), |
294 | | ALG(PROV_NAMES_CAMELLIA_256_CFB8, ossl_camellia256cfb8_functions), |
295 | | ALG(PROV_NAMES_CAMELLIA_192_CFB8, ossl_camellia192cfb8_functions), |
296 | | ALG(PROV_NAMES_CAMELLIA_128_CFB8, ossl_camellia128cfb8_functions), |
297 | | ALG(PROV_NAMES_CAMELLIA_256_CTR, ossl_camellia256ctr_functions), |
298 | | ALG(PROV_NAMES_CAMELLIA_192_CTR, ossl_camellia192ctr_functions), |
299 | | ALG(PROV_NAMES_CAMELLIA_128_CTR, ossl_camellia128ctr_functions), |
300 | | #endif /* OPENSSL_NO_CAMELLIA */ |
301 | | #ifndef OPENSSL_NO_DES |
302 | | ALG(PROV_NAMES_DES_EDE3_ECB, ossl_tdes_ede3_ecb_functions), |
303 | | ALG(PROV_NAMES_DES_EDE3_CBC, ossl_tdes_ede3_cbc_functions), |
304 | | ALG(PROV_NAMES_DES_EDE3_OFB, ossl_tdes_ede3_ofb_functions), |
305 | | ALG(PROV_NAMES_DES_EDE3_CFB, ossl_tdes_ede3_cfb_functions), |
306 | | ALG(PROV_NAMES_DES_EDE3_CFB8, ossl_tdes_ede3_cfb8_functions), |
307 | | ALG(PROV_NAMES_DES_EDE3_CFB1, ossl_tdes_ede3_cfb1_functions), |
308 | | ALG(PROV_NAMES_DES3_WRAP, ossl_tdes_wrap_cbc_functions), |
309 | | ALG(PROV_NAMES_DES_EDE_ECB, ossl_tdes_ede2_ecb_functions), |
310 | | ALG(PROV_NAMES_DES_EDE_CBC, ossl_tdes_ede2_cbc_functions), |
311 | | ALG(PROV_NAMES_DES_EDE_OFB, ossl_tdes_ede2_ofb_functions), |
312 | | ALG(PROV_NAMES_DES_EDE_CFB, ossl_tdes_ede2_cfb_functions), |
313 | | #endif /* OPENSSL_NO_DES */ |
314 | | #ifndef OPENSSL_NO_SM4 |
315 | | ALG(PROV_NAMES_SM4_GCM, ossl_sm4128gcm_functions), |
316 | | ALG(PROV_NAMES_SM4_CCM, ossl_sm4128ccm_functions), |
317 | | ALG(PROV_NAMES_SM4_ECB, ossl_sm4128ecb_functions), |
318 | | ALG(PROV_NAMES_SM4_CBC, ossl_sm4128cbc_functions), |
319 | | ALG(PROV_NAMES_SM4_CTR, ossl_sm4128ctr_functions), |
320 | | ALG(PROV_NAMES_SM4_OFB, ossl_sm4128ofb128_functions), |
321 | | ALG(PROV_NAMES_SM4_CFB, ossl_sm4128cfb128_functions), |
322 | | ALG(PROV_NAMES_SM4_XTS, ossl_sm4128xts_functions), |
323 | | #endif /* OPENSSL_NO_SM4 */ |
324 | | #ifndef OPENSSL_NO_CHACHA |
325 | | ALG(PROV_NAMES_ChaCha20, ossl_chacha20_functions), |
326 | | #ifndef OPENSSL_NO_POLY1305 |
327 | | ALG(PROV_NAMES_ChaCha20_Poly1305, ossl_chacha20_ossl_poly1305_functions), |
328 | | #endif /* OPENSSL_NO_POLY1305 */ |
329 | | #endif /* OPENSSL_NO_CHACHA */ |
330 | | { { NULL, NULL, NULL }, NULL } |
331 | | }; |
332 | | static OSSL_ALGORITHM exported_ciphers[OSSL_NELEM(deflt_ciphers)]; |
333 | | |
334 | | static const OSSL_ALGORITHM deflt_macs[] = { |
335 | | #ifndef OPENSSL_NO_BLAKE2 |
336 | | { PROV_NAMES_BLAKE2BMAC, "provider=default", ossl_blake2bmac_functions }, |
337 | | { PROV_NAMES_BLAKE2SMAC, "provider=default", ossl_blake2smac_functions }, |
338 | | #endif |
339 | | #ifndef OPENSSL_NO_CMAC |
340 | | { PROV_NAMES_CMAC, "provider=default", ossl_cmac_functions }, |
341 | | #endif |
342 | | { PROV_NAMES_GMAC, "provider=default", ossl_gmac_functions }, |
343 | | { PROV_NAMES_HMAC, "provider=default", ossl_hmac_functions }, |
344 | | { PROV_NAMES_KMAC_128, "provider=default", ossl_kmac128_functions }, |
345 | | { PROV_NAMES_KMAC_256, "provider=default", ossl_kmac256_functions }, |
346 | | #ifndef OPENSSL_NO_SIPHASH |
347 | | { PROV_NAMES_SIPHASH, "provider=default", ossl_siphash_functions }, |
348 | | #endif |
349 | | #ifndef OPENSSL_NO_POLY1305 |
350 | | { PROV_NAMES_POLY1305, "provider=default", ossl_poly1305_functions }, |
351 | | #endif |
352 | | { NULL, NULL, NULL } |
353 | | }; |
354 | | |
355 | | static const OSSL_ALGORITHM deflt_kdfs[] = { |
356 | | { PROV_NAMES_HKDF, "provider=default", ossl_kdf_hkdf_functions }, |
357 | | { PROV_NAMES_HKDF_SHA256, "provider=default", ossl_kdf_hkdf_sha256_functions }, |
358 | | { PROV_NAMES_HKDF_SHA384, "provider=default", ossl_kdf_hkdf_sha384_functions }, |
359 | | { PROV_NAMES_HKDF_SHA512, "provider=default", ossl_kdf_hkdf_sha512_functions }, |
360 | | { PROV_NAMES_TLS1_3_KDF, "provider=default", |
361 | | ossl_kdf_tls1_3_kdf_functions }, |
362 | | { PROV_NAMES_SSKDF, "provider=default", ossl_kdf_sskdf_functions }, |
363 | | { PROV_NAMES_PBKDF2, "provider=default", ossl_kdf_pbkdf2_functions }, |
364 | | { PROV_NAMES_PKCS12KDF, "provider=default", ossl_kdf_pkcs12_functions }, |
365 | | { PROV_NAMES_SSHKDF, "provider=default", ossl_kdf_sshkdf_functions }, |
366 | | { PROV_NAMES_X963KDF, "provider=default", ossl_kdf_x963_kdf_functions }, |
367 | | { PROV_NAMES_TLS1_PRF, "provider=default", ossl_kdf_tls1_prf_functions }, |
368 | | { PROV_NAMES_KBKDF, "provider=default", ossl_kdf_kbkdf_functions }, |
369 | | { PROV_NAMES_X942KDF_ASN1, "provider=default", ossl_kdf_x942_kdf_functions }, |
370 | | #ifndef OPENSSL_NO_SCRYPT |
371 | | { PROV_NAMES_SCRYPT, "provider=default", ossl_kdf_scrypt_functions }, |
372 | | #endif |
373 | | { PROV_NAMES_KRB5KDF, "provider=default", ossl_kdf_krb5kdf_functions }, |
374 | | { PROV_NAMES_HMAC_DRBG_KDF, "provider=default", |
375 | | ossl_kdf_hmac_drbg_functions }, |
376 | | #ifndef OPENSSL_NO_ARGON2 |
377 | | { PROV_NAMES_ARGON2I, "provider=default", ossl_kdf_argon2i_functions }, |
378 | | { PROV_NAMES_ARGON2D, "provider=default", ossl_kdf_argon2d_functions }, |
379 | | { PROV_NAMES_ARGON2ID, "provider=default", ossl_kdf_argon2id_functions }, |
380 | | #endif |
381 | | { NULL, NULL, NULL } |
382 | | }; |
383 | | |
384 | | static const OSSL_ALGORITHM deflt_keyexch[] = { |
385 | | #ifndef OPENSSL_NO_DH |
386 | | { PROV_NAMES_DH, "provider=default", ossl_dh_keyexch_functions }, |
387 | | #endif |
388 | | #ifndef OPENSSL_NO_EC |
389 | | { PROV_NAMES_ECDH, "provider=default", ossl_ecdh_keyexch_functions }, |
390 | | #ifndef OPENSSL_NO_ECX |
391 | | { PROV_NAMES_X25519, "provider=default", ossl_x25519_keyexch_functions }, |
392 | | { PROV_NAMES_X448, "provider=default", ossl_x448_keyexch_functions }, |
393 | | #endif |
394 | | #endif |
395 | | { PROV_NAMES_TLS1_PRF, "provider=default", ossl_kdf_tls1_prf_keyexch_functions }, |
396 | | { PROV_NAMES_HKDF, "provider=default", ossl_kdf_hkdf_keyexch_functions }, |
397 | | #ifndef OPENSSL_NO_SCRYPT |
398 | | { PROV_NAMES_SCRYPT, "provider=default", |
399 | | ossl_kdf_scrypt_keyexch_functions }, |
400 | | #endif |
401 | | { NULL, NULL, NULL } |
402 | | }; |
403 | | |
404 | | static const OSSL_ALGORITHM deflt_rands[] = { |
405 | | { PROV_NAMES_CTR_DRBG, "provider=default", ossl_drbg_ctr_functions }, |
406 | | { PROV_NAMES_HASH_DRBG, "provider=default", ossl_drbg_hash_functions }, |
407 | | { PROV_NAMES_HMAC_DRBG, "provider=default", ossl_drbg_ossl_hmac_functions }, |
408 | | { PROV_NAMES_SEED_SRC, "provider=default", ossl_seed_src_functions }, |
409 | | #ifndef OPENSSL_NO_JITTER |
410 | | { PROV_NAMES_JITTER, "provider=default", ossl_jitter_functions }, |
411 | | #endif |
412 | | { PROV_NAMES_TEST_RAND, "provider=default", ossl_test_rng_functions }, |
413 | | { NULL, NULL, NULL } |
414 | | }; |
415 | | |
416 | | static const OSSL_ALGORITHM deflt_signature[] = { |
417 | | #ifndef OPENSSL_NO_DSA |
418 | | { PROV_NAMES_DSA, "provider=default", ossl_dsa_signature_functions }, |
419 | | { PROV_NAMES_DSA_SHA1, "provider=default", ossl_dsa_sha1_signature_functions }, |
420 | | { PROV_NAMES_DSA_SHA224, "provider=default", ossl_dsa_sha224_signature_functions }, |
421 | | { PROV_NAMES_DSA_SHA256, "provider=default", ossl_dsa_sha256_signature_functions }, |
422 | | { PROV_NAMES_DSA_SHA384, "provider=default", ossl_dsa_sha384_signature_functions }, |
423 | | { PROV_NAMES_DSA_SHA512, "provider=default", ossl_dsa_sha512_signature_functions }, |
424 | | { PROV_NAMES_DSA_SHA3_224, "provider=default", ossl_dsa_sha3_224_signature_functions }, |
425 | | { PROV_NAMES_DSA_SHA3_256, "provider=default", ossl_dsa_sha3_256_signature_functions }, |
426 | | { PROV_NAMES_DSA_SHA3_384, "provider=default", ossl_dsa_sha3_384_signature_functions }, |
427 | | { PROV_NAMES_DSA_SHA3_512, "provider=default", ossl_dsa_sha3_512_signature_functions }, |
428 | | #endif |
429 | | { PROV_NAMES_RSA, "provider=default", ossl_rsa_signature_functions }, |
430 | | #if !defined(OPENSSL_NO_RMD160) && !defined(FIPS_MODULE) |
431 | | { PROV_NAMES_RSA_RIPEMD160, "provider=default", ossl_rsa_ripemd160_signature_functions }, |
432 | | #endif |
433 | | { PROV_NAMES_RSA_SHA1, "provider=default", ossl_rsa_sha1_signature_functions }, |
434 | | { PROV_NAMES_RSA_SHA224, "provider=default", ossl_rsa_sha224_signature_functions }, |
435 | | { PROV_NAMES_RSA_SHA256, "provider=default", ossl_rsa_sha256_signature_functions }, |
436 | | { PROV_NAMES_RSA_SHA384, "provider=default", ossl_rsa_sha384_signature_functions }, |
437 | | { PROV_NAMES_RSA_SHA512, "provider=default", ossl_rsa_sha512_signature_functions }, |
438 | | { PROV_NAMES_RSA_SHA512_224, "provider=default", ossl_rsa_sha512_224_signature_functions }, |
439 | | { PROV_NAMES_RSA_SHA512_256, "provider=default", ossl_rsa_sha512_256_signature_functions }, |
440 | | { PROV_NAMES_RSA_SHA3_224, "provider=default", ossl_rsa_sha3_224_signature_functions }, |
441 | | { PROV_NAMES_RSA_SHA3_256, "provider=default", ossl_rsa_sha3_256_signature_functions }, |
442 | | { PROV_NAMES_RSA_SHA3_384, "provider=default", ossl_rsa_sha3_384_signature_functions }, |
443 | | { PROV_NAMES_RSA_SHA3_512, "provider=default", ossl_rsa_sha3_512_signature_functions }, |
444 | | #ifndef OPENSSL_NO_SM3 |
445 | | { PROV_NAMES_RSA_SM3, "provider=default", ossl_rsa_sm3_signature_functions }, |
446 | | #endif |
447 | | #ifndef OPENSSL_NO_EC |
448 | | #ifndef OPENSSL_NO_ECX |
449 | | { PROV_NAMES_ED25519, "provider=default", ossl_ed25519_signature_functions }, |
450 | | { PROV_NAMES_ED25519ph, "provider=default", ossl_ed25519ph_signature_functions }, |
451 | | { PROV_NAMES_ED25519ctx, "provider=default", ossl_ed25519ctx_signature_functions }, |
452 | | { PROV_NAMES_ED448, "provider=default", ossl_ed448_signature_functions }, |
453 | | { PROV_NAMES_ED448ph, "provider=default", ossl_ed448ph_signature_functions }, |
454 | | #endif |
455 | | { PROV_NAMES_ECDSA, "provider=default", ossl_ecdsa_signature_functions }, |
456 | | { PROV_NAMES_ECDSA_SHA1, "provider=default", ossl_ecdsa_sha1_signature_functions }, |
457 | | { PROV_NAMES_ECDSA_SHA224, "provider=default", ossl_ecdsa_sha224_signature_functions }, |
458 | | { PROV_NAMES_ECDSA_SHA256, "provider=default", ossl_ecdsa_sha256_signature_functions }, |
459 | | { PROV_NAMES_ECDSA_SHA384, "provider=default", ossl_ecdsa_sha384_signature_functions }, |
460 | | { PROV_NAMES_ECDSA_SHA512, "provider=default", ossl_ecdsa_sha512_signature_functions }, |
461 | | { PROV_NAMES_ECDSA_SHA3_224, "provider=default", ossl_ecdsa_sha3_224_signature_functions }, |
462 | | { PROV_NAMES_ECDSA_SHA3_256, "provider=default", ossl_ecdsa_sha3_256_signature_functions }, |
463 | | { PROV_NAMES_ECDSA_SHA3_384, "provider=default", ossl_ecdsa_sha3_384_signature_functions }, |
464 | | { PROV_NAMES_ECDSA_SHA3_512, "provider=default", ossl_ecdsa_sha3_512_signature_functions }, |
465 | | #ifndef OPENSSL_NO_SM2 |
466 | | { PROV_NAMES_SM2, "provider=default", ossl_sm2_signature_functions }, |
467 | | #endif |
468 | | #endif |
469 | | #ifndef OPENSSL_NO_ML_DSA |
470 | | { PROV_NAMES_ML_DSA_44, "provider=default", ossl_ml_dsa_44_signature_functions }, |
471 | | { PROV_NAMES_ML_DSA_65, "provider=default", ossl_ml_dsa_65_signature_functions }, |
472 | | { PROV_NAMES_ML_DSA_87, "provider=default", ossl_ml_dsa_87_signature_functions }, |
473 | | #endif |
474 | | { PROV_NAMES_HMAC, "provider=default", ossl_mac_legacy_hmac_signature_functions }, |
475 | | #ifndef OPENSSL_NO_SIPHASH |
476 | | { PROV_NAMES_SIPHASH, "provider=default", |
477 | | ossl_mac_legacy_siphash_signature_functions }, |
478 | | #endif |
479 | | #ifndef OPENSSL_NO_POLY1305 |
480 | | { PROV_NAMES_POLY1305, "provider=default", |
481 | | ossl_mac_legacy_poly1305_signature_functions }, |
482 | | #endif |
483 | | #ifndef OPENSSL_NO_CMAC |
484 | | { PROV_NAMES_CMAC, "provider=default", ossl_mac_legacy_cmac_signature_functions }, |
485 | | #endif |
486 | | #ifndef OPENSSL_NO_LMS |
487 | | { PROV_NAMES_LMS, "provider=default", ossl_lms_signature_functions }, |
488 | | #endif |
489 | | #ifndef OPENSSL_NO_SLH_DSA |
490 | | { PROV_NAMES_SLH_DSA_SHA2_128S, "provider=default", |
491 | | ossl_slh_dsa_sha2_128s_signature_functions, PROV_DESCS_SLH_DSA_SHA2_128S }, |
492 | | { PROV_NAMES_SLH_DSA_SHA2_128F, "provider=default", |
493 | | ossl_slh_dsa_sha2_128f_signature_functions, PROV_DESCS_SLH_DSA_SHA2_128F }, |
494 | | { PROV_NAMES_SLH_DSA_SHA2_192S, "provider=default", |
495 | | ossl_slh_dsa_sha2_192s_signature_functions, PROV_DESCS_SLH_DSA_SHA2_192S }, |
496 | | { PROV_NAMES_SLH_DSA_SHA2_192F, "provider=default", |
497 | | ossl_slh_dsa_sha2_192f_signature_functions, PROV_DESCS_SLH_DSA_SHA2_192F }, |
498 | | { PROV_NAMES_SLH_DSA_SHA2_256S, "provider=default", |
499 | | ossl_slh_dsa_sha2_256s_signature_functions, PROV_DESCS_SLH_DSA_SHA2_256S }, |
500 | | { PROV_NAMES_SLH_DSA_SHA2_256F, "provider=default", |
501 | | ossl_slh_dsa_sha2_256f_signature_functions, PROV_DESCS_SLH_DSA_SHA2_256F }, |
502 | | { PROV_NAMES_SLH_DSA_SHAKE_128S, "provider=default", |
503 | | ossl_slh_dsa_shake_128s_signature_functions, PROV_DESCS_SLH_DSA_SHAKE_128S }, |
504 | | { PROV_NAMES_SLH_DSA_SHAKE_128F, "provider=default", |
505 | | ossl_slh_dsa_shake_128f_signature_functions, PROV_DESCS_SLH_DSA_SHAKE_128F }, |
506 | | { PROV_NAMES_SLH_DSA_SHAKE_192S, "provider=default", |
507 | | ossl_slh_dsa_shake_192s_signature_functions, PROV_DESCS_SLH_DSA_SHAKE_192S }, |
508 | | { PROV_NAMES_SLH_DSA_SHAKE_192F, "provider=default", |
509 | | ossl_slh_dsa_shake_192f_signature_functions, PROV_DESCS_SLH_DSA_SHAKE_192F }, |
510 | | { PROV_NAMES_SLH_DSA_SHAKE_256S, "provider=default", |
511 | | ossl_slh_dsa_shake_256s_signature_functions, PROV_DESCS_SLH_DSA_SHAKE_256S }, |
512 | | { PROV_NAMES_SLH_DSA_SHAKE_256F, "provider=default", |
513 | | ossl_slh_dsa_shake_256f_signature_functions, PROV_DESCS_SLH_DSA_SHAKE_256F }, |
514 | | #endif /* OPENSSL_NO_SLH_DSA */ |
515 | | { NULL, NULL, NULL } |
516 | | }; |
517 | | |
518 | | static const OSSL_ALGORITHM deflt_asym_cipher[] = { |
519 | | { PROV_NAMES_RSA, "provider=default", ossl_rsa_asym_cipher_functions }, |
520 | | #ifndef OPENSSL_NO_SM2 |
521 | | { PROV_NAMES_SM2, "provider=default", ossl_sm2_asym_cipher_functions }, |
522 | | #endif |
523 | | { NULL, NULL, NULL } |
524 | | }; |
525 | | |
526 | | static const OSSL_ALGORITHM deflt_asym_kem[] = { |
527 | | { PROV_NAMES_RSA, "provider=default", ossl_rsa_asym_kem_functions }, |
528 | | #ifndef OPENSSL_NO_EC |
529 | | #ifndef OPENSSL_NO_ECX |
530 | | { PROV_NAMES_X25519, "provider=default", ossl_ecx_asym_kem_functions }, |
531 | | { PROV_NAMES_X448, "provider=default", ossl_ecx_asym_kem_functions }, |
532 | | #endif |
533 | | { PROV_NAMES_EC, "provider=default", ossl_ec_asym_kem_functions }, |
534 | | #endif |
535 | | #ifndef OPENSSL_NO_ML_KEM |
536 | | { PROV_NAMES_ML_KEM_512, "provider=default", ossl_ml_kem_asym_kem_functions }, |
537 | | { PROV_NAMES_ML_KEM_768, "provider=default", ossl_ml_kem_asym_kem_functions }, |
538 | | { PROV_NAMES_ML_KEM_1024, "provider=default", ossl_ml_kem_asym_kem_functions }, |
539 | | #if !defined(OPENSSL_NO_ECX) |
540 | | { "X25519MLKEM768", "provider=default", ossl_mlx_kem_asym_kem_functions }, |
541 | | { "X448MLKEM1024", "provider=default", ossl_mlx_kem_asym_kem_functions }, |
542 | | #endif |
543 | | #if !defined(OPENSSL_NO_EC) |
544 | | { "SecP256r1MLKEM768", "provider=default", ossl_mlx_kem_asym_kem_functions }, |
545 | | { "SecP384r1MLKEM1024", "provider=default", ossl_mlx_kem_asym_kem_functions }, |
546 | | #endif |
547 | | #endif |
548 | | { NULL, NULL, NULL } |
549 | | }; |
550 | | |
551 | | static const OSSL_ALGORITHM deflt_keymgmt[] = { |
552 | | #ifndef OPENSSL_NO_DH |
553 | | { PROV_NAMES_DH, "provider=default", ossl_dh_keymgmt_functions, |
554 | | PROV_DESCS_DH }, |
555 | | { PROV_NAMES_DHX, "provider=default", ossl_dhx_keymgmt_functions, |
556 | | PROV_DESCS_DHX }, |
557 | | #endif |
558 | | #ifndef OPENSSL_NO_DSA |
559 | | { PROV_NAMES_DSA, "provider=default", ossl_dsa_keymgmt_functions, |
560 | | PROV_DESCS_DSA }, |
561 | | #endif |
562 | | { PROV_NAMES_RSA, "provider=default", ossl_rsa_keymgmt_functions, |
563 | | PROV_DESCS_RSA }, |
564 | | { PROV_NAMES_RSA_PSS, "provider=default", ossl_rsapss_keymgmt_functions, |
565 | | PROV_DESCS_RSA_PSS }, |
566 | | #ifndef OPENSSL_NO_EC |
567 | | { PROV_NAMES_EC, "provider=default", ossl_ec_keymgmt_functions, |
568 | | PROV_DESCS_EC }, |
569 | | #ifndef OPENSSL_NO_ECX |
570 | | { PROV_NAMES_X25519, "provider=default", ossl_x25519_keymgmt_functions, |
571 | | PROV_DESCS_X25519 }, |
572 | | { PROV_NAMES_X448, "provider=default", ossl_x448_keymgmt_functions, |
573 | | PROV_DESCS_X448 }, |
574 | | { PROV_NAMES_ED25519, "provider=default", ossl_ed25519_keymgmt_functions, |
575 | | PROV_DESCS_ED25519 }, |
576 | | { PROV_NAMES_ED448, "provider=default", ossl_ed448_keymgmt_functions, |
577 | | PROV_DESCS_ED448 }, |
578 | | #endif |
579 | | #endif |
580 | | #ifndef OPENSSL_NO_ML_DSA |
581 | | { PROV_NAMES_ML_DSA_44, "provider=default", ossl_ml_dsa_44_keymgmt_functions, |
582 | | PROV_DESCS_ML_DSA_44 }, |
583 | | { PROV_NAMES_ML_DSA_65, "provider=default", ossl_ml_dsa_65_keymgmt_functions, |
584 | | PROV_DESCS_ML_DSA_65 }, |
585 | | { PROV_NAMES_ML_DSA_87, "provider=default", ossl_ml_dsa_87_keymgmt_functions, |
586 | | PROV_DESCS_ML_DSA_87 }, |
587 | | #endif /* OPENSSL_NO_ML_DSA */ |
588 | | { PROV_NAMES_TLS1_PRF, "provider=default", ossl_kdf_keymgmt_functions, |
589 | | PROV_DESCS_TLS1_PRF_SIGN }, |
590 | | { PROV_NAMES_HKDF, "provider=default", ossl_kdf_keymgmt_functions, |
591 | | PROV_DESCS_HKDF_SIGN }, |
592 | | #ifndef OPENSSL_NO_SCRYPT |
593 | | { PROV_NAMES_SCRYPT, "provider=default", ossl_kdf_keymgmt_functions, |
594 | | PROV_DESCS_SCRYPT_SIGN }, |
595 | | #endif |
596 | | { PROV_NAMES_HMAC, "provider=default", ossl_mac_legacy_keymgmt_functions, |
597 | | PROV_DESCS_HMAC_SIGN }, |
598 | | #ifndef OPENSSL_NO_SIPHASH |
599 | | { PROV_NAMES_SIPHASH, "provider=default", ossl_mac_legacy_keymgmt_functions, |
600 | | PROV_DESCS_SIPHASH_SIGN }, |
601 | | #endif |
602 | | #ifndef OPENSSL_NO_POLY1305 |
603 | | { PROV_NAMES_POLY1305, "provider=default", ossl_mac_legacy_keymgmt_functions, |
604 | | PROV_DESCS_POLY1305_SIGN }, |
605 | | #endif |
606 | | #ifndef OPENSSL_NO_CMAC |
607 | | { PROV_NAMES_CMAC, "provider=default", ossl_cmac_legacy_keymgmt_functions, |
608 | | PROV_DESCS_CMAC_SIGN }, |
609 | | #endif |
610 | | #ifndef OPENSSL_NO_SM2 |
611 | | { PROV_NAMES_SM2, "provider=default", ossl_sm2_keymgmt_functions, |
612 | | PROV_DESCS_SM2 }, |
613 | | #endif |
614 | | #ifndef OPENSSL_NO_LMS |
615 | | { PROV_NAMES_LMS, "provider=default", ossl_lms_keymgmt_functions, |
616 | | PROV_DESCS_LMS }, |
617 | | #endif |
618 | | #ifndef OPENSSL_NO_ML_KEM |
619 | | { PROV_NAMES_ML_KEM_512, "provider=default", ossl_ml_kem_512_keymgmt_functions, |
620 | | PROV_DESCS_ML_KEM_512 }, |
621 | | { PROV_NAMES_ML_KEM_768, "provider=default", ossl_ml_kem_768_keymgmt_functions, |
622 | | PROV_DESCS_ML_KEM_768 }, |
623 | | { PROV_NAMES_ML_KEM_1024, "provider=default", ossl_ml_kem_1024_keymgmt_functions, |
624 | | PROV_DESCS_ML_KEM_1024 }, |
625 | | #if !defined(OPENSSL_NO_ECX) |
626 | | { PROV_NAMES_X25519MLKEM768, "provider=default", ossl_mlx_x25519_kem_kmgmt_functions, |
627 | | PROV_DESCS_X25519MLKEM768 }, |
628 | | { PROV_NAMES_X448MLKEM1024, "provider=default", ossl_mlx_x448_kem_kmgmt_functions, |
629 | | PROV_DESCS_X448MLKEM1024 }, |
630 | | #endif |
631 | | #if !defined(OPENSSL_NO_EC) |
632 | | { PROV_NAMES_SecP256r1MLKEM768, "provider=default", ossl_mlx_p256_kem_kmgmt_functions, |
633 | | PROV_DESCS_SecP256r1MLKEM768 }, |
634 | | { PROV_NAMES_SecP384r1MLKEM1024, "provider=default", ossl_mlx_p384_kem_kmgmt_functions, |
635 | | PROV_DESCS_SecP384r1MLKEM1024 }, |
636 | | #endif |
637 | | #endif |
638 | | #ifndef OPENSSL_NO_SLH_DSA |
639 | | { PROV_NAMES_SLH_DSA_SHA2_128S, "provider=default", ossl_slh_dsa_sha2_128s_keymgmt_functions, |
640 | | PROV_DESCS_SLH_DSA_SHA2_128S }, |
641 | | { PROV_NAMES_SLH_DSA_SHA2_128F, "provider=default", ossl_slh_dsa_sha2_128f_keymgmt_functions, |
642 | | PROV_DESCS_SLH_DSA_SHA2_128F }, |
643 | | { PROV_NAMES_SLH_DSA_SHA2_192S, "provider=default", ossl_slh_dsa_sha2_192s_keymgmt_functions, |
644 | | PROV_DESCS_SLH_DSA_SHA2_192S }, |
645 | | { PROV_NAMES_SLH_DSA_SHA2_192F, "provider=default", ossl_slh_dsa_sha2_192f_keymgmt_functions, |
646 | | PROV_DESCS_SLH_DSA_SHA2_192F }, |
647 | | { PROV_NAMES_SLH_DSA_SHA2_256S, "provider=default", ossl_slh_dsa_sha2_256s_keymgmt_functions, |
648 | | PROV_DESCS_SLH_DSA_SHA2_256S }, |
649 | | { PROV_NAMES_SLH_DSA_SHA2_256F, "provider=default", ossl_slh_dsa_sha2_256f_keymgmt_functions, |
650 | | PROV_DESCS_SLH_DSA_SHA2_256F }, |
651 | | { PROV_NAMES_SLH_DSA_SHAKE_128S, "provider=default", ossl_slh_dsa_shake_128s_keymgmt_functions, |
652 | | PROV_DESCS_SLH_DSA_SHAKE_128S }, |
653 | | { PROV_NAMES_SLH_DSA_SHAKE_128F, "provider=default", ossl_slh_dsa_shake_128f_keymgmt_functions, |
654 | | PROV_DESCS_SLH_DSA_SHAKE_128F }, |
655 | | { PROV_NAMES_SLH_DSA_SHAKE_192S, "provider=default", ossl_slh_dsa_shake_192s_keymgmt_functions, |
656 | | PROV_DESCS_SLH_DSA_SHAKE_192S }, |
657 | | { PROV_NAMES_SLH_DSA_SHAKE_192F, "provider=default", ossl_slh_dsa_shake_192f_keymgmt_functions, |
658 | | PROV_DESCS_SLH_DSA_SHAKE_192F }, |
659 | | { PROV_NAMES_SLH_DSA_SHAKE_256S, "provider=default", ossl_slh_dsa_shake_256s_keymgmt_functions, |
660 | | PROV_DESCS_SLH_DSA_SHAKE_256S }, |
661 | | { PROV_NAMES_SLH_DSA_SHAKE_256F, "provider=default", ossl_slh_dsa_shake_256f_keymgmt_functions, |
662 | | PROV_DESCS_SLH_DSA_SHAKE_256F }, |
663 | | #endif /* OPENSSL_NO_SLH_DSA */ |
664 | | { NULL, NULL, NULL } |
665 | | }; |
666 | | |
667 | | static const OSSL_ALGORITHM deflt_skeymgmt[] = { |
668 | | { PROV_NAMES_AES, "provider=default", ossl_aes_skeymgmt_functions, |
669 | | PROV_DESCS_AES }, |
670 | | { PROV_NAMES_GENERIC, "provider=default", ossl_generic_skeymgmt_functions, |
671 | | PROV_DESCS_GENERIC }, |
672 | | { NULL, NULL, NULL } |
673 | | }; |
674 | | |
675 | | static const OSSL_ALGORITHM deflt_encoder[] = { |
676 | | #define ENCODER_PROVIDER "default" |
677 | | #include "encoders.inc" |
678 | | { NULL, NULL, NULL } |
679 | | #undef ENCODER_PROVIDER |
680 | | }; |
681 | | |
682 | | static const OSSL_ALGORITHM deflt_decoder[] = { |
683 | | #define DECODER_PROVIDER "default" |
684 | | #include "decoders.inc" |
685 | | { NULL, NULL, NULL } |
686 | | #undef DECODER_PROVIDER |
687 | | }; |
688 | | |
689 | | static const OSSL_ALGORITHM deflt_store[] = { |
690 | | #define STORE(name, _fips, func_table) \ |
691 | | { name, "provider=default,fips=" _fips, (func_table) }, |
692 | | |
693 | | #include "stores.inc" |
694 | | { NULL, NULL, NULL } |
695 | | #undef STORE |
696 | | }; |
697 | | |
698 | | static const OSSL_ALGORITHM *deflt_query(void *provctx, int operation_id, |
699 | | int *no_cache) |
700 | 1.56M | { |
701 | 1.56M | *no_cache = 0; |
702 | 1.56M | switch (operation_id) { |
703 | 638k | case OSSL_OP_DIGEST: |
704 | 638k | return deflt_digests; |
705 | 812k | case OSSL_OP_CIPHER: |
706 | 812k | return exported_ciphers; |
707 | 2.27k | case OSSL_OP_MAC: |
708 | 2.27k | return deflt_macs; |
709 | 48 | case OSSL_OP_KDF: |
710 | 48 | return deflt_kdfs; |
711 | 104 | case OSSL_OP_RAND: |
712 | 104 | return deflt_rands; |
713 | 12.4k | case OSSL_OP_KEYMGMT: |
714 | 12.4k | return deflt_keymgmt; |
715 | 262 | case OSSL_OP_KEYEXCH: |
716 | 262 | return deflt_keyexch; |
717 | 118 | case OSSL_OP_SIGNATURE: |
718 | 118 | return deflt_signature; |
719 | 17 | case OSSL_OP_ASYM_CIPHER: |
720 | 17 | return deflt_asym_cipher; |
721 | 18 | case OSSL_OP_KEM: |
722 | 18 | return deflt_asym_kem; |
723 | 89.5k | case OSSL_OP_ENCODER: |
724 | 89.5k | return deflt_encoder; |
725 | 12.6k | case OSSL_OP_DECODER: |
726 | 12.6k | return deflt_decoder; |
727 | 0 | case OSSL_OP_STORE: |
728 | 0 | return deflt_store; |
729 | 0 | case OSSL_OP_SKEYMGMT: |
730 | 0 | return deflt_skeymgmt; |
731 | 1.56M | } |
732 | 0 | return NULL; |
733 | 1.56M | } |
734 | | |
735 | | static void deflt_teardown(void *provctx) |
736 | 72 | { |
737 | 72 | BIO_meth_free(ossl_prov_ctx_get0_core_bio_method(provctx)); |
738 | 72 | ossl_prov_ctx_free(provctx); |
739 | 72 | } |
740 | | |
741 | | /* Functions we provide to the core */ |
742 | | static const OSSL_DISPATCH deflt_dispatch_table[] = { |
743 | | { OSSL_FUNC_PROVIDER_TEARDOWN, (void (*)(void))deflt_teardown }, |
744 | | { OSSL_FUNC_PROVIDER_GETTABLE_PARAMS, (void (*)(void))deflt_gettable_params }, |
745 | | { OSSL_FUNC_PROVIDER_GET_PARAMS, (void (*)(void))deflt_get_params }, |
746 | | { OSSL_FUNC_PROVIDER_QUERY_OPERATION, (void (*)(void))deflt_query }, |
747 | | { OSSL_FUNC_PROVIDER_GET_CAPABILITIES, |
748 | | (void (*)(void))ossl_prov_get_capabilities }, |
749 | | OSSL_DISPATCH_END |
750 | | }; |
751 | | |
752 | | OSSL_provider_init_fn ossl_default_provider_init; |
753 | | |
754 | | int ossl_default_provider_init(const OSSL_CORE_HANDLE *handle, |
755 | | const OSSL_DISPATCH *in, |
756 | | const OSSL_DISPATCH **out, |
757 | | void **provctx) |
758 | 62 | { |
759 | 62 | OSSL_FUNC_core_get_libctx_fn *c_get_libctx = NULL; |
760 | 62 | OSSL_FUNC_core_get_params_fn *c_get_params = NULL; |
761 | 62 | BIO_METHOD *corebiometh; |
762 | | |
763 | 62 | if (!ossl_prov_bio_from_dispatch(in) |
764 | 62 | || !ossl_prov_seeding_from_dispatch(in)) |
765 | 0 | return 0; |
766 | 3.34k | for (; in->function_id != 0; in++) { |
767 | 3.28k | switch (in->function_id) { |
768 | 62 | case OSSL_FUNC_CORE_GET_PARAMS: |
769 | 62 | c_get_params = OSSL_FUNC_core_get_params(in); |
770 | 62 | break; |
771 | 62 | case OSSL_FUNC_CORE_GET_LIBCTX: |
772 | 62 | c_get_libctx = OSSL_FUNC_core_get_libctx(in); |
773 | 62 | break; |
774 | 3.16k | default: |
775 | | /* Just ignore anything we don't understand */ |
776 | 3.16k | break; |
777 | 3.28k | } |
778 | 3.28k | } |
779 | | |
780 | 62 | if (c_get_libctx == NULL) |
781 | 0 | return 0; |
782 | | |
783 | | /* |
784 | | * We want to make sure that all calls from this provider that requires |
785 | | * a library context use the same context as the one used to call our |
786 | | * functions. We do that by passing it along in the provider context. |
787 | | * |
788 | | * This only works for built-in providers. Most providers should |
789 | | * create their own library context. |
790 | | */ |
791 | 62 | if ((*provctx = ossl_prov_ctx_new()) == NULL |
792 | 62 | || (corebiometh = ossl_bio_prov_init_bio_method()) == NULL) { |
793 | 0 | ossl_prov_ctx_free(*provctx); |
794 | 0 | *provctx = NULL; |
795 | 0 | return 0; |
796 | 0 | } |
797 | 62 | ossl_prov_ctx_set0_libctx(*provctx, |
798 | 62 | (OSSL_LIB_CTX *)c_get_libctx(handle)); |
799 | 62 | ossl_prov_ctx_set0_handle(*provctx, handle); |
800 | 62 | ossl_prov_ctx_set0_core_bio_method(*provctx, corebiometh); |
801 | 62 | ossl_prov_ctx_set0_core_get_params(*provctx, c_get_params); |
802 | | |
803 | 62 | *out = deflt_dispatch_table; |
804 | 62 | ossl_prov_cache_exported_algorithms(deflt_ciphers, exported_ciphers); |
805 | | |
806 | 62 | return 1; |
807 | 62 | } |