2 * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
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
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>
18 #include "prov/provider_ctx.h"
19 #include "prov/providercommon.h"
20 #include "prov/implementations.h"
21 #include "prov/provider_util.h"
22 #include "internal/nelem.h"
25 * Forward declarations to ensure that interface functions are correctly
28 static OSSL_FUNC_provider_gettable_params_fn deflt_gettable_params
;
29 static OSSL_FUNC_provider_get_params_fn deflt_get_params
;
30 static OSSL_FUNC_provider_query_operation_fn deflt_query
;
32 #define ALGC(NAMES, FUNC, CHECK) { { NAMES, "provider=default", FUNC }, CHECK }
33 #define ALG(NAMES, FUNC) ALGC(NAMES, FUNC, NULL)
35 /* Functions provided by the core */
36 static OSSL_FUNC_core_gettable_params_fn
*c_gettable_params
= NULL
;
37 static OSSL_FUNC_core_get_params_fn
*c_get_params
= NULL
;
39 /* Parameters we provide to the core */
40 static const OSSL_PARAM deflt_param_types
[] = {
41 OSSL_PARAM_DEFN(OSSL_PROV_PARAM_NAME
, OSSL_PARAM_UTF8_PTR
, NULL
, 0),
42 OSSL_PARAM_DEFN(OSSL_PROV_PARAM_VERSION
, OSSL_PARAM_UTF8_PTR
, NULL
, 0),
43 OSSL_PARAM_DEFN(OSSL_PROV_PARAM_BUILDINFO
, OSSL_PARAM_UTF8_PTR
, NULL
, 0),
47 static const OSSL_PARAM
*deflt_gettable_params(void *provctx
)
49 return deflt_param_types
;
52 static int deflt_get_params(void *provctx
, OSSL_PARAM params
[])
56 p
= OSSL_PARAM_locate(params
, OSSL_PROV_PARAM_NAME
);
57 if (p
!= NULL
&& !OSSL_PARAM_set_utf8_ptr(p
, "OpenSSL Default Provider"))
59 p
= OSSL_PARAM_locate(params
, OSSL_PROV_PARAM_VERSION
);
60 if (p
!= NULL
&& !OSSL_PARAM_set_utf8_ptr(p
, OPENSSL_VERSION_STR
))
62 p
= OSSL_PARAM_locate(params
, OSSL_PROV_PARAM_BUILDINFO
);
63 if (p
!= NULL
&& !OSSL_PARAM_set_utf8_ptr(p
, OPENSSL_FULL_VERSION_STR
))
65 p
= OSSL_PARAM_locate(params
, OSSL_PROV_PARAM_STATUS
);
66 if (p
!= NULL
&& !OSSL_PARAM_set_uint(p
, 1))
72 * For the algorithm names, we use the following formula for our primary
75 * ALGNAME[VERSION?][-SUBNAME[VERSION?]?][-SIZE?][-MODE?]
77 * VERSION is only present if there are multiple versions of
78 * an alg (MD2, MD4, MD5). It may be omitted if there is only
79 * one version (if a subsequent version is released in the future,
80 * we can always change the canonical name, and add the old name
83 * SUBNAME may be present where we are combining multiple
84 * algorithms together, e.g. MD5-SHA1.
86 * SIZE is only present if multiple versions of an algorithm exist
87 * with different sizes (e.g. AES-128-CBC, AES-256-CBC)
89 * MODE is only present where applicable.
91 * We add diverse other names where applicable, such as the names that
92 * NIST uses, or that are used for ASN.1 OBJECT IDENTIFIERs, or names
93 * we have used historically.
95 * Algorithm names are case insensitive, but we use all caps in our "canonical"
96 * names for consistency.
98 static const OSSL_ALGORITHM deflt_digests
[] = {
99 /* Our primary name:NIST name[:our older names] */
100 { "SHA1:SHA-1:SSL3-SHA1", "provider=default", sha1_functions
},
101 { "SHA2-224:SHA-224:SHA224", "provider=default", sha224_functions
},
102 { "SHA2-256:SHA-256:SHA256", "provider=default", sha256_functions
},
103 { "SHA2-384:SHA-384:SHA384", "provider=default", sha384_functions
},
104 { "SHA2-512:SHA-512:SHA512", "provider=default", sha512_functions
},
105 { "SHA2-512/224:SHA-512/224:SHA512-224", "provider=default",
106 sha512_224_functions
},
107 { "SHA2-512/256:SHA-512/256:SHA512-256", "provider=default",
108 sha512_256_functions
},
110 /* We agree with NIST here, so one name only */
111 { "SHA3-224", "provider=default", sha3_224_functions
},
112 { "SHA3-256", "provider=default", sha3_256_functions
},
113 { "SHA3-384", "provider=default", sha3_384_functions
},
114 { "SHA3-512", "provider=default", sha3_512_functions
},
117 * KECCAK-KMAC-128 and KECCAK-KMAC-256 as hashes are mostly useful for
118 * the KMAC-128 and KMAC-256.
120 { "KECCAK-KMAC-128:KECCAK-KMAC128", "provider=default", keccak_kmac_128_functions
},
121 { "KECCAK-KMAC-256:KECCAK-KMAC256", "provider=default", keccak_kmac_256_functions
},
123 /* Our primary name:NIST name */
124 { "SHAKE-128:SHAKE128", "provider=default", shake_128_functions
},
125 { "SHAKE-256:SHAKE256", "provider=default", shake_256_functions
},
127 #ifndef OPENSSL_NO_BLAKE2
129 * https://blake2.net/ doesn't specify size variants,
130 * but mentions that Bouncy Castle uses the names
131 * BLAKE2b-160, BLAKE2b-256, BLAKE2b-384, and BLAKE2b-512
132 * If we assume that "2b" and "2s" are versions, that pattern
133 * fits with ours. We also add our historical names.
135 { "BLAKE2S-256:BLAKE2s256", "provider=default", blake2s256_functions
},
136 { "BLAKE2B-512:BLAKE2b512", "provider=default", blake2b512_functions
},
137 #endif /* OPENSSL_NO_BLAKE2 */
139 #ifndef OPENSSL_NO_SM3
140 { "SM3", "provider=default", sm3_functions
},
141 #endif /* OPENSSL_NO_SM3 */
143 #ifndef OPENSSL_NO_MD5
144 { "MD5:SSL3-MD5", "provider=default", md5_functions
},
145 { "MD5-SHA1", "provider=default", md5_sha1_functions
},
146 #endif /* OPENSSL_NO_MD5 */
151 static const OSSL_ALGORITHM_CAPABLE deflt_ciphers
[] = {
152 ALG("NULL", null_functions
),
153 ALG("AES-256-ECB", aes256ecb_functions
),
154 ALG("AES-192-ECB", aes192ecb_functions
),
155 ALG("AES-128-ECB", aes128ecb_functions
),
156 ALG("AES-256-CBC:AES256", aes256cbc_functions
),
157 ALG("AES-192-CBC:AES192", aes192cbc_functions
),
158 ALG("AES-128-CBC:AES128", aes128cbc_functions
),
159 ALG("AES-128-CBC-CTS", aes128cbc_cts_functions
),
160 ALG("AES-192-CBC-CTS", aes192cbc_cts_functions
),
161 ALG("AES-256-CBC-CTS", aes256cbc_cts_functions
),
162 ALG("AES-256-OFB", aes256ofb_functions
),
163 ALG("AES-192-OFB", aes192ofb_functions
),
164 ALG("AES-128-OFB", aes128ofb_functions
),
165 ALG("AES-256-CFB", aes256cfb_functions
),
166 ALG("AES-192-CFB", aes192cfb_functions
),
167 ALG("AES-128-CFB", aes128cfb_functions
),
168 ALG("AES-256-CFB1", aes256cfb1_functions
),
169 ALG("AES-192-CFB1", aes192cfb1_functions
),
170 ALG("AES-128-CFB1", aes128cfb1_functions
),
171 ALG("AES-256-CFB8", aes256cfb8_functions
),
172 ALG("AES-192-CFB8", aes192cfb8_functions
),
173 ALG("AES-128-CFB8", aes128cfb8_functions
),
174 ALG("AES-256-CTR", aes256ctr_functions
),
175 ALG("AES-192-CTR", aes192ctr_functions
),
176 ALG("AES-128-CTR", aes128ctr_functions
),
177 ALG("AES-256-XTS", aes256xts_functions
),
178 ALG("AES-128-XTS", aes128xts_functions
),
179 #ifndef OPENSSL_NO_OCB
180 ALG("AES-256-OCB", aes256ocb_functions
),
181 ALG("AES-192-OCB", aes192ocb_functions
),
182 ALG("AES-128-OCB", aes128ocb_functions
),
183 #endif /* OPENSSL_NO_OCB */
184 #ifndef OPENSSL_NO_SIV
185 ALG("AES-128-SIV", aes128siv_functions
),
186 ALG("AES-192-SIV", aes192siv_functions
),
187 ALG("AES-256-SIV", aes256siv_functions
),
188 #endif /* OPENSSL_NO_SIV */
189 ALG("AES-256-GCM:id-aes256-GCM", aes256gcm_functions
),
190 ALG("AES-192-GCM:id-aes192-GCM", aes192gcm_functions
),
191 ALG("AES-128-GCM:id-aes128-GCM", aes128gcm_functions
),
192 ALG("AES-256-CCM:id-aes256-CCM", aes256ccm_functions
),
193 ALG("AES-192-CCM:id-aes192-CCM", aes192ccm_functions
),
194 ALG("AES-128-CCM:id-aes128-CCM", aes128ccm_functions
),
195 ALG("AES-256-WRAP:id-aes256-wrap:AES256-WRAP", aes256wrap_functions
),
196 ALG("AES-192-WRAP:id-aes192-wrap:AES192-WRAP", aes192wrap_functions
),
197 ALG("AES-128-WRAP:id-aes128-wrap:AES128-WRAP", aes128wrap_functions
),
198 ALG("AES-256-WRAP-PAD:id-aes256-wrap-pad:AES256-WRAP-PAD",
199 aes256wrappad_functions
),
200 ALG("AES-192-WRAP-PAD:id-aes192-wrap-pad:AES192-WRAP-PAD",
201 aes192wrappad_functions
),
202 ALG("AES-128-WRAP-PAD:id-aes128-wrap-pad:AES128-WRAP-PAD",
203 aes128wrappad_functions
),
204 ALGC("AES-128-CBC-HMAC-SHA1", aes128cbc_hmac_sha1_functions
,
205 cipher_capable_aes_cbc_hmac_sha1
),
206 ALGC("AES-256-CBC-HMAC-SHA1", aes256cbc_hmac_sha1_functions
,
207 cipher_capable_aes_cbc_hmac_sha1
),
208 ALGC("AES-128-CBC-HMAC-SHA256", aes128cbc_hmac_sha256_functions
,
209 cipher_capable_aes_cbc_hmac_sha256
),
210 ALGC("AES-256-CBC-HMAC-SHA256", aes256cbc_hmac_sha256_functions
,
211 cipher_capable_aes_cbc_hmac_sha256
),
212 #ifndef OPENSSL_NO_ARIA
213 ALG("ARIA-256-GCM", aria256gcm_functions
),
214 ALG("ARIA-192-GCM", aria192gcm_functions
),
215 ALG("ARIA-128-GCM", aria128gcm_functions
),
216 ALG("ARIA-256-CCM", aria256ccm_functions
),
217 ALG("ARIA-192-CCM", aria192ccm_functions
),
218 ALG("ARIA-128-CCM", aria128ccm_functions
),
219 ALG("ARIA-256-ECB", aria256ecb_functions
),
220 ALG("ARIA-192-ECB", aria192ecb_functions
),
221 ALG("ARIA-128-ECB", aria128ecb_functions
),
222 ALG("ARIA-256-CBC:ARIA256", aria256cbc_functions
),
223 ALG("ARIA-192-CBC:ARIA192", aria192cbc_functions
),
224 ALG("ARIA-128-CBC:ARIA128", aria128cbc_functions
),
225 ALG("ARIA-256-OFB", aria256ofb_functions
),
226 ALG("ARIA-192-OFB", aria192ofb_functions
),
227 ALG("ARIA-128-OFB", aria128ofb_functions
),
228 ALG("ARIA-256-CFB", aria256cfb_functions
),
229 ALG("ARIA-192-CFB", aria192cfb_functions
),
230 ALG("ARIA-128-CFB", aria128cfb_functions
),
231 ALG("ARIA-256-CFB1", aria256cfb1_functions
),
232 ALG("ARIA-192-CFB1", aria192cfb1_functions
),
233 ALG("ARIA-128-CFB1", aria128cfb1_functions
),
234 ALG("ARIA-256-CFB8", aria256cfb8_functions
),
235 ALG("ARIA-192-CFB8", aria192cfb8_functions
),
236 ALG("ARIA-128-CFB8", aria128cfb8_functions
),
237 ALG("ARIA-256-CTR", aria256ctr_functions
),
238 ALG("ARIA-192-CTR", aria192ctr_functions
),
239 ALG("ARIA-128-CTR", aria128ctr_functions
),
240 #endif /* OPENSSL_NO_ARIA */
241 #ifndef OPENSSL_NO_CAMELLIA
242 ALG("CAMELLIA-256-ECB", camellia256ecb_functions
),
243 ALG("CAMELLIA-192-ECB", camellia192ecb_functions
),
244 ALG("CAMELLIA-128-ECB", camellia128ecb_functions
),
245 ALG("CAMELLIA-256-CBC:CAMELLIA256", camellia256cbc_functions
),
246 ALG("CAMELLIA-192-CBC:CAMELLIA192", camellia192cbc_functions
),
247 ALG("CAMELLIA-128-CBC:CAMELLIA128", camellia128cbc_functions
),
248 ALG("CAMELLIA-256-OFB", camellia256ofb_functions
),
249 ALG("CAMELLIA-192-OFB", camellia192ofb_functions
),
250 ALG("CAMELLIA-128-OFB", camellia128ofb_functions
),
251 ALG("CAMELLIA-256-CFB", camellia256cfb_functions
),
252 ALG("CAMELLIA-192-CFB", camellia192cfb_functions
),
253 ALG("CAMELLIA-128-CFB", camellia128cfb_functions
),
254 ALG("CAMELLIA-256-CFB1", camellia256cfb1_functions
),
255 ALG("CAMELLIA-192-CFB1", camellia192cfb1_functions
),
256 ALG("CAMELLIA-128-CFB1", camellia128cfb1_functions
),
257 ALG("CAMELLIA-256-CFB8", camellia256cfb8_functions
),
258 ALG("CAMELLIA-192-CFB8", camellia192cfb8_functions
),
259 ALG("CAMELLIA-128-CFB8", camellia128cfb8_functions
),
260 ALG("CAMELLIA-256-CTR", camellia256ctr_functions
),
261 ALG("CAMELLIA-192-CTR", camellia192ctr_functions
),
262 ALG("CAMELLIA-128-CTR", camellia128ctr_functions
),
263 #endif /* OPENSSL_NO_CAMELLIA */
264 #ifndef OPENSSL_NO_DES
265 ALG("DES-EDE3-ECB:DES-EDE3", tdes_ede3_ecb_functions
),
266 ALG("DES-EDE3-CBC:DES3", tdes_ede3_cbc_functions
),
267 ALG("DES-EDE3-OFB", tdes_ede3_ofb_functions
),
268 ALG("DES-EDE3-CFB", tdes_ede3_cfb_functions
),
269 ALG("DES-EDE3-CFB8", tdes_ede3_cfb8_functions
),
270 ALG("DES-EDE3-CFB1", tdes_ede3_cfb1_functions
),
271 ALG("DES3-WRAP:id-smime-alg-CMS3DESwrap", tdes_wrap_cbc_functions
),
272 ALG("DES-EDE-ECB:DES-EDE", tdes_ede2_ecb_functions
),
273 ALG("DES-EDE-CBC", tdes_ede2_cbc_functions
),
274 ALG("DES-EDE-OFB", tdes_ede2_ofb_functions
),
275 ALG("DES-EDE-CFB", tdes_ede2_cfb_functions
),
276 #endif /* OPENSSL_NO_DES */
277 #ifndef OPENSSL_NO_SM4
278 ALG("SM4-ECB", sm4128ecb_functions
),
279 ALG("SM4-CBC:SM4", sm4128cbc_functions
),
280 ALG("SM4-CTR", sm4128ctr_functions
),
281 ALG("SM4-OFB:SM4-OFB128", sm4128ofb128_functions
),
282 ALG("SM4-CFB:SM4-CFB128", sm4128cfb128_functions
),
283 #endif /* OPENSSL_NO_SM4 */
284 #ifndef OPENSSL_NO_CHACHA
285 ALG("ChaCha20", chacha20_functions
),
286 # ifndef OPENSSL_NO_POLY1305
287 ALG("ChaCha20-Poly1305", chacha20_poly1305_functions
),
288 # endif /* OPENSSL_NO_POLY1305 */
289 #endif /* OPENSSL_NO_CHACHA */
290 { { NULL
, NULL
, NULL
}, NULL
}
292 static OSSL_ALGORITHM exported_ciphers
[OSSL_NELEM(deflt_ciphers
)];
294 static const OSSL_ALGORITHM deflt_macs
[] = {
295 #ifndef OPENSSL_NO_BLAKE2
296 { "BLAKE2BMAC", "provider=default", blake2bmac_functions
},
297 { "BLAKE2SMAC", "provider=default", blake2smac_functions
},
299 #ifndef OPENSSL_NO_CMAC
300 { "CMAC", "provider=default", cmac_functions
},
302 { "GMAC", "provider=default", gmac_functions
},
303 { "HMAC", "provider=default", hmac_functions
},
304 { "KMAC-128:KMAC128", "provider=default", kmac128_functions
},
305 { "KMAC-256:KMAC256", "provider=default", kmac256_functions
},
306 #ifndef OPENSSL_NO_SIPHASH
307 { "SIPHASH", "provider=default", siphash_functions
},
309 #ifndef OPENSSL_NO_POLY1305
310 { "POLY1305", "provider=default", poly1305_functions
},
315 static const OSSL_ALGORITHM deflt_kdfs
[] = {
316 { "HKDF", "provider=default", kdf_hkdf_functions
},
317 { "SSKDF", "provider=default", kdf_sskdf_functions
},
318 { "PBKDF2", "provider=default", kdf_pbkdf2_functions
},
319 { "SSHKDF", "provider=default", kdf_sshkdf_functions
},
320 { "X963KDF", "provider=default", kdf_x963_kdf_functions
},
321 { "TLS1-PRF", "provider=default", kdf_tls1_prf_functions
},
322 { "KBKDF", "provider=default", kdf_kbkdf_functions
},
323 #ifndef OPENSSL_NO_CMS
324 { "X942KDF", "provider=default", kdf_x942_kdf_functions
},
326 #ifndef OPENSSL_NO_SCRYPT
327 { "SCRYPT:id-scrypt", "provider=default", kdf_scrypt_functions
},
329 { "KRB5KDF", "provider=default", kdf_krb5kdf_functions
},
333 static const OSSL_ALGORITHM deflt_keyexch
[] = {
334 #ifndef OPENSSL_NO_DH
335 { "DH:dhKeyAgreement", "provider=default", dh_keyexch_functions
},
337 #ifndef OPENSSL_NO_EC
338 { "ECDH", "provider=default", ecdh_keyexch_functions
},
339 { "X25519", "provider=default", x25519_keyexch_functions
},
340 { "X448", "provider=default", x448_keyexch_functions
},
342 { "TLS1-PRF", "provider=default", kdf_keyexch_functions
},
346 static const OSSL_ALGORITHM deflt_rands
[] = {
347 { "CTR-DRBG", "provider=default", drbg_ctr_functions
},
348 { "HASH-DRBG", "provider=default", drbg_hash_functions
},
349 { "HMAC-DRBG", "provider=default", drbg_hmac_functions
},
350 { "TEST-RAND", "provider=default", test_rng_functions
},
354 static const OSSL_ALGORITHM deflt_signature
[] = {
355 #ifndef OPENSSL_NO_DSA
356 { "DSA:dsaEncryption", "provider=default", dsa_signature_functions
},
358 { "RSA:rsaEncryption", "provider=default", rsa_signature_functions
},
359 #ifndef OPENSSL_NO_EC
360 { "ED25519:Ed25519", "provider=default", ed25519_signature_functions
},
361 { "ED448:Ed448", "provider=default", ed448_signature_functions
},
362 { "ECDSA", "provider=default", ecdsa_signature_functions
},
367 static const OSSL_ALGORITHM deflt_asym_cipher
[] = {
368 { "RSA:rsaEncryption", "provider=default", rsa_asym_cipher_functions
},
372 static const OSSL_ALGORITHM deflt_keymgmt
[] = {
373 #ifndef OPENSSL_NO_DH
374 { "DH:dhKeyAgreement", "provider=default", dh_keymgmt_functions
},
376 #ifndef OPENSSL_NO_DSA
377 { "DSA:dsaEncryption", "provider=default", dsa_keymgmt_functions
},
379 { "RSA:rsaEncryption", "provider=default", rsa_keymgmt_functions
},
380 { "RSA-PSS:RSASSA-PSS", "provider=default", rsapss_keymgmt_functions
},
381 #ifndef OPENSSL_NO_EC
382 { "EC:id-ecPublicKey", "provider=default", ec_keymgmt_functions
},
383 { "X25519", "provider=default", x25519_keymgmt_functions
},
384 { "X448", "provider=default", x448_keymgmt_functions
},
385 { "ED25519", "provider=default", ed25519_keymgmt_functions
},
386 { "ED448", "provider=default", ed448_keymgmt_functions
},
388 { "TLS1-PRF", "provider=default", kdf_keymgmt_functions
},
392 static const OSSL_ALGORITHM deflt_serializer
[] = {
393 #define SER(name, fips, format, type, func_table) \
395 "provider=default,fips=" fips ",format=" format ",type=" type, \
398 #include "serializers.inc"
403 static const OSSL_ALGORITHM deflt_deserializer
[] = {
404 #define DESER(name, fips, input, func_table) \
406 "provider=default,fips=" fips ",input=" input, \
409 #include "deserializers.inc"
414 static const OSSL_ALGORITHM
*deflt_query(void *provctx
, int operation_id
,
418 switch (operation_id
) {
420 return deflt_digests
;
422 ossl_prov_cache_exported_algorithms(deflt_ciphers
, exported_ciphers
);
423 return exported_ciphers
;
430 case OSSL_OP_KEYMGMT
:
431 return deflt_keymgmt
;
432 case OSSL_OP_KEYEXCH
:
433 return deflt_keyexch
;
434 case OSSL_OP_SIGNATURE
:
435 return deflt_signature
;
436 case OSSL_OP_ASYM_CIPHER
:
437 return deflt_asym_cipher
;
438 case OSSL_OP_SERIALIZER
:
439 return deflt_serializer
;
440 case OSSL_OP_DESERIALIZER
:
441 return deflt_deserializer
;
447 static void deflt_teardown(void *provctx
)
449 BIO_meth_free(PROV_CTX_get0_core_bio_method(provctx
));
450 PROV_CTX_free(provctx
);
453 /* Functions we provide to the core */
454 static const OSSL_DISPATCH deflt_dispatch_table
[] = {
455 { OSSL_FUNC_PROVIDER_TEARDOWN
, (void (*)(void))deflt_teardown
},
456 { OSSL_FUNC_PROVIDER_GETTABLE_PARAMS
, (void (*)(void))deflt_gettable_params
},
457 { OSSL_FUNC_PROVIDER_GET_PARAMS
, (void (*)(void))deflt_get_params
},
458 { OSSL_FUNC_PROVIDER_QUERY_OPERATION
, (void (*)(void))deflt_query
},
459 { OSSL_FUNC_PROVIDER_GET_CAPABILITIES
, (void (*)(void))provider_get_capabilities
},
463 OSSL_provider_init_fn ossl_default_provider_init
;
465 int ossl_default_provider_init(const OSSL_CORE_HANDLE
*handle
,
466 const OSSL_DISPATCH
*in
,
467 const OSSL_DISPATCH
**out
,
470 OSSL_FUNC_core_get_library_context_fn
*c_get_libctx
= NULL
;
471 BIO_METHOD
*corebiometh
;
473 if (!ossl_prov_bio_from_dispatch(in
))
475 for (; in
->function_id
!= 0; in
++) {
476 switch (in
->function_id
) {
477 case OSSL_FUNC_CORE_GETTABLE_PARAMS
:
478 c_gettable_params
= OSSL_FUNC_core_gettable_params(in
);
480 case OSSL_FUNC_CORE_GET_PARAMS
:
481 c_get_params
= OSSL_FUNC_core_get_params(in
);
483 case OSSL_FUNC_CORE_GET_LIBRARY_CONTEXT
:
484 c_get_libctx
= OSSL_FUNC_core_get_library_context(in
);
487 /* Just ignore anything we don't understand */
492 if (c_get_libctx
== NULL
)
496 * We want to make sure that all calls from this provider that requires
497 * a library context use the same context as the one used to call our
498 * functions. We do that by passing it along in the provider context.
500 * This only works for built-in providers. Most providers should
501 * create their own library context.
503 if ((*provctx
= PROV_CTX_new()) == NULL
504 || (corebiometh
= bio_prov_init_bio_method()) == NULL
) {
505 PROV_CTX_free(*provctx
);
509 PROV_CTX_set0_library_context(*provctx
, (OPENSSL_CTX
*)c_get_libctx(handle
));
510 PROV_CTX_set0_handle(*provctx
, handle
);
511 PROV_CTX_set0_core_bio_method(*provctx
, corebiometh
);
513 *out
= deflt_dispatch_table
;