2019-03-13 20:02:55 +08:00
|
|
|
/*
|
2023-09-07 16:59:15 +08:00
|
|
|
* Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
|
2019-03-13 20:02:55 +08:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
2019-05-07 18:40:25 +08:00
|
|
|
#include <openssl/opensslconf.h>
|
2019-03-13 20:02:55 +08:00
|
|
|
#include <openssl/core.h>
|
2020-06-21 07:21:19 +08:00
|
|
|
#include <openssl/core_dispatch.h>
|
2019-03-13 20:02:55 +08:00
|
|
|
#include <openssl/core_names.h>
|
|
|
|
#include <openssl/params.h>
|
2019-11-18 08:50:18 +08:00
|
|
|
#include "prov/bio.h"
|
2020-05-09 16:11:14 +08:00
|
|
|
#include "prov/provider_ctx.h"
|
2020-01-06 11:02:16 +08:00
|
|
|
#include "prov/providercommon.h"
|
2019-10-04 21:20:48 +08:00
|
|
|
#include "prov/implementations.h"
|
2021-03-10 18:22:55 +08:00
|
|
|
#include "prov/names.h"
|
2020-01-06 11:02:16 +08:00
|
|
|
#include "prov/provider_util.h"
|
2020-10-30 13:54:03 +08:00
|
|
|
#include "prov/seeding.h"
|
2020-01-06 11:02:16 +08:00
|
|
|
#include "internal/nelem.h"
|
|
|
|
|
2020-05-09 16:11:14 +08:00
|
|
|
/*
|
|
|
|
* Forward declarations to ensure that interface functions are correctly
|
|
|
|
* defined.
|
|
|
|
*/
|
2020-06-21 07:19:16 +08:00
|
|
|
static OSSL_FUNC_provider_gettable_params_fn deflt_gettable_params;
|
|
|
|
static OSSL_FUNC_provider_get_params_fn deflt_get_params;
|
|
|
|
static OSSL_FUNC_provider_query_operation_fn deflt_query;
|
2020-05-09 16:11:14 +08:00
|
|
|
|
2020-02-15 06:49:26 +08:00
|
|
|
#define ALGC(NAMES, FUNC, CHECK) { { NAMES, "provider=default", FUNC }, CHECK }
|
2020-01-06 11:02:16 +08:00
|
|
|
#define ALG(NAMES, FUNC) ALGC(NAMES, FUNC, NULL)
|
2019-03-13 20:02:55 +08:00
|
|
|
|
|
|
|
/* Functions provided by the core */
|
2020-06-21 07:19:16 +08:00
|
|
|
static OSSL_FUNC_core_gettable_params_fn *c_gettable_params = NULL;
|
|
|
|
static OSSL_FUNC_core_get_params_fn *c_get_params = NULL;
|
2019-03-13 20:02:55 +08:00
|
|
|
|
|
|
|
/* Parameters we provide to the core */
|
2019-07-11 18:19:33 +08:00
|
|
|
static const OSSL_PARAM deflt_param_types[] = {
|
|
|
|
OSSL_PARAM_DEFN(OSSL_PROV_PARAM_NAME, OSSL_PARAM_UTF8_PTR, NULL, 0),
|
|
|
|
OSSL_PARAM_DEFN(OSSL_PROV_PARAM_VERSION, OSSL_PARAM_UTF8_PTR, NULL, 0),
|
|
|
|
OSSL_PARAM_DEFN(OSSL_PROV_PARAM_BUILDINFO, OSSL_PARAM_UTF8_PTR, NULL, 0),
|
2020-09-07 09:58:03 +08:00
|
|
|
OSSL_PARAM_DEFN(OSSL_PROV_PARAM_STATUS, OSSL_PARAM_INTEGER, NULL, 0),
|
2019-07-11 18:19:33 +08:00
|
|
|
OSSL_PARAM_END
|
2019-03-13 20:02:55 +08:00
|
|
|
};
|
|
|
|
|
2020-05-09 16:11:14 +08:00
|
|
|
static const OSSL_PARAM *deflt_gettable_params(void *provctx)
|
2019-03-13 20:02:55 +08:00
|
|
|
{
|
|
|
|
return deflt_param_types;
|
|
|
|
}
|
|
|
|
|
2020-05-09 16:11:14 +08:00
|
|
|
static int deflt_get_params(void *provctx, OSSL_PARAM params[])
|
2019-03-13 20:02:55 +08:00
|
|
|
{
|
2019-06-24 12:43:55 +08:00
|
|
|
OSSL_PARAM *p;
|
2019-03-13 20:02:55 +08:00
|
|
|
|
|
|
|
p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_NAME);
|
|
|
|
if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, "OpenSSL Default Provider"))
|
|
|
|
return 0;
|
|
|
|
p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_VERSION);
|
|
|
|
if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, OPENSSL_VERSION_STR))
|
|
|
|
return 0;
|
|
|
|
p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_BUILDINFO);
|
|
|
|
if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, OPENSSL_FULL_VERSION_STR))
|
|
|
|
return 0;
|
2020-08-09 16:06:52 +08:00
|
|
|
p = OSSL_PARAM_locate(params, OSSL_PROV_PARAM_STATUS);
|
2020-09-07 09:58:03 +08:00
|
|
|
if (p != NULL && !OSSL_PARAM_set_int(p, ossl_prov_is_running()))
|
2020-08-09 16:06:52 +08:00
|
|
|
return 0;
|
2019-03-13 20:02:55 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2019-05-23 09:39:15 +08:00
|
|
|
/*
|
|
|
|
* For the algorithm names, we use the following formula for our primary
|
|
|
|
* names:
|
|
|
|
*
|
|
|
|
* ALGNAME[VERSION?][-SUBNAME[VERSION?]?][-SIZE?][-MODE?]
|
|
|
|
*
|
|
|
|
* VERSION is only present if there are multiple versions of
|
|
|
|
* an alg (MD2, MD4, MD5). It may be omitted if there is only
|
|
|
|
* one version (if a subsequent version is released in the future,
|
|
|
|
* we can always change the canonical name, and add the old name
|
|
|
|
* as an alias).
|
|
|
|
*
|
|
|
|
* SUBNAME may be present where we are combining multiple
|
|
|
|
* algorithms together, e.g. MD5-SHA1.
|
|
|
|
*
|
|
|
|
* SIZE is only present if multiple versions of an algorithm exist
|
|
|
|
* with different sizes (e.g. AES-128-CBC, AES-256-CBC)
|
|
|
|
*
|
|
|
|
* MODE is only present where applicable.
|
|
|
|
*
|
|
|
|
* We add diverse other names where applicable, such as the names that
|
|
|
|
* NIST uses, or that are used for ASN.1 OBJECT IDENTIFIERs, or names
|
|
|
|
* we have used historically.
|
2019-10-04 18:50:49 +08:00
|
|
|
*
|
|
|
|
* Algorithm names are case insensitive, but we use all caps in our "canonical"
|
|
|
|
* names for consistency.
|
2019-05-23 09:39:15 +08:00
|
|
|
*/
|
2019-03-14 01:26:17 +08:00
|
|
|
static const OSSL_ALGORITHM deflt_digests[] = {
|
2019-05-23 09:39:15 +08:00
|
|
|
/* Our primary name:NIST name[:our older names] */
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_SHA1, "provider=default", ossl_sha1_functions },
|
|
|
|
{ PROV_NAMES_SHA2_224, "provider=default", ossl_sha224_functions },
|
|
|
|
{ PROV_NAMES_SHA2_256, "provider=default", ossl_sha256_functions },
|
2023-06-12 18:02:14 +08:00
|
|
|
{ PROV_NAMES_SHA2_256_192, "provider=default", ossl_sha256_192_functions },
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_SHA2_384, "provider=default", ossl_sha384_functions },
|
|
|
|
{ PROV_NAMES_SHA2_512, "provider=default", ossl_sha512_functions },
|
|
|
|
{ PROV_NAMES_SHA2_512_224, "provider=default", ossl_sha512_224_functions },
|
|
|
|
{ PROV_NAMES_SHA2_512_256, "provider=default", ossl_sha512_256_functions },
|
2019-04-11 18:27:59 +08:00
|
|
|
|
2019-05-23 09:39:15 +08:00
|
|
|
/* We agree with NIST here, so one name only */
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_SHA3_224, "provider=default", ossl_sha3_224_functions },
|
|
|
|
{ PROV_NAMES_SHA3_256, "provider=default", ossl_sha3_256_functions },
|
|
|
|
{ PROV_NAMES_SHA3_384, "provider=default", ossl_sha3_384_functions },
|
|
|
|
{ PROV_NAMES_SHA3_512, "provider=default", ossl_sha3_512_functions },
|
2019-04-11 18:27:59 +08:00
|
|
|
|
2021-09-13 18:59:42 +08:00
|
|
|
{ PROV_NAMES_KECCAK_224, "provider=default", ossl_keccak_224_functions },
|
|
|
|
{ PROV_NAMES_KECCAK_256, "provider=default", ossl_keccak_256_functions },
|
|
|
|
{ PROV_NAMES_KECCAK_384, "provider=default", ossl_keccak_384_functions },
|
|
|
|
{ PROV_NAMES_KECCAK_512, "provider=default", ossl_keccak_512_functions },
|
|
|
|
|
2019-06-02 14:46:35 +08:00
|
|
|
/*
|
2019-10-04 18:50:49 +08:00
|
|
|
* KECCAK-KMAC-128 and KECCAK-KMAC-256 as hashes are mostly useful for
|
|
|
|
* the KMAC-128 and KMAC-256.
|
2019-06-02 14:46:35 +08:00
|
|
|
*/
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_KECCAK_KMAC_128, "provider=default",
|
2020-09-28 10:28:29 +08:00
|
|
|
ossl_keccak_kmac_128_functions },
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_KECCAK_KMAC_256, "provider=default",
|
2020-09-28 10:28:29 +08:00
|
|
|
ossl_keccak_kmac_256_functions },
|
2019-04-11 18:27:59 +08:00
|
|
|
|
2019-05-23 09:39:15 +08:00
|
|
|
/* Our primary name:NIST name */
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_SHAKE_128, "provider=default", ossl_shake_128_functions },
|
|
|
|
{ PROV_NAMES_SHAKE_256, "provider=default", ossl_shake_256_functions },
|
2019-04-11 18:27:59 +08:00
|
|
|
|
|
|
|
#ifndef OPENSSL_NO_BLAKE2
|
2019-05-23 09:39:15 +08:00
|
|
|
/*
|
|
|
|
* https://blake2.net/ doesn't specify size variants,
|
|
|
|
* but mentions that Bouncy Castle uses the names
|
|
|
|
* BLAKE2b-160, BLAKE2b-256, BLAKE2b-384, and BLAKE2b-512
|
|
|
|
* If we assume that "2b" and "2s" are versions, that pattern
|
|
|
|
* fits with ours. We also add our historical names.
|
|
|
|
*/
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_BLAKE2S_256, "provider=default", ossl_blake2s256_functions },
|
|
|
|
{ PROV_NAMES_BLAKE2B_512, "provider=default", ossl_blake2b512_functions },
|
2019-04-11 18:27:59 +08:00
|
|
|
#endif /* OPENSSL_NO_BLAKE2 */
|
|
|
|
|
|
|
|
#ifndef OPENSSL_NO_SM3
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_SM3, "provider=default", ossl_sm3_functions },
|
2019-04-11 18:27:59 +08:00
|
|
|
#endif /* OPENSSL_NO_SM3 */
|
|
|
|
|
|
|
|
#ifndef OPENSSL_NO_MD5
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_MD5, "provider=default", ossl_md5_functions },
|
|
|
|
{ PROV_NAMES_MD5_SHA1, "provider=default", ossl_md5_sha1_functions },
|
2019-04-11 18:27:59 +08:00
|
|
|
#endif /* OPENSSL_NO_MD5 */
|
|
|
|
|
2022-10-11 08:23:57 +08:00
|
|
|
#ifndef OPENSSL_NO_RMD160
|
|
|
|
{ PROV_NAMES_RIPEMD_160, "provider=default", ossl_ripemd160_functions },
|
|
|
|
#endif /* OPENSSL_NO_RMD160 */
|
|
|
|
|
2021-11-12 23:31:35 +08:00
|
|
|
{ PROV_NAMES_NULL, "provider=default", ossl_nullmd_functions },
|
2019-03-14 01:26:17 +08:00
|
|
|
{ NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
2020-01-06 11:02:16 +08:00
|
|
|
static const OSSL_ALGORITHM_CAPABLE deflt_ciphers[] = {
|
2021-03-10 18:22:55 +08:00
|
|
|
ALG(PROV_NAMES_NULL, ossl_null_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_ECB, ossl_aes256ecb_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_ECB, ossl_aes192ecb_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_ECB, ossl_aes128ecb_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_CBC, ossl_aes256cbc_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_CBC, ossl_aes192cbc_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_CBC, ossl_aes128cbc_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_CBC_CTS, ossl_aes128cbc_cts_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_CBC_CTS, ossl_aes192cbc_cts_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_CBC_CTS, ossl_aes256cbc_cts_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_OFB, ossl_aes256ofb_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_OFB, ossl_aes192ofb_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_OFB, ossl_aes128ofb_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_CFB, ossl_aes256cfb_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_CFB, ossl_aes192cfb_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_CFB, ossl_aes128cfb_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_CFB1, ossl_aes256cfb1_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_CFB1, ossl_aes192cfb1_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_CFB1, ossl_aes128cfb1_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_CFB8, ossl_aes256cfb8_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_CFB8, ossl_aes192cfb8_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_CFB8, ossl_aes128cfb8_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_CTR, ossl_aes256ctr_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_CTR, ossl_aes192ctr_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_CTR, ossl_aes128ctr_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_XTS, ossl_aes256xts_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_XTS, ossl_aes128xts_functions),
|
2019-09-19 18:10:25 +08:00
|
|
|
#ifndef OPENSSL_NO_OCB
|
2021-03-10 18:22:55 +08:00
|
|
|
ALG(PROV_NAMES_AES_256_OCB, ossl_aes256ocb_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_OCB, ossl_aes192ocb_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_OCB, ossl_aes128ocb_functions),
|
2019-09-19 18:10:25 +08:00
|
|
|
#endif /* OPENSSL_NO_OCB */
|
2019-11-08 10:14:44 +08:00
|
|
|
#ifndef OPENSSL_NO_SIV
|
2021-03-10 18:22:55 +08:00
|
|
|
ALG(PROV_NAMES_AES_128_SIV, ossl_aes128siv_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_SIV, ossl_aes192siv_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_SIV, ossl_aes256siv_functions),
|
2022-04-29 02:56:11 +08:00
|
|
|
ALG(PROV_NAMES_AES_128_GCM_SIV, ossl_aes128gcm_siv_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_GCM_SIV, ossl_aes192gcm_siv_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_GCM_SIV, ossl_aes256gcm_siv_functions),
|
2019-11-08 10:14:44 +08:00
|
|
|
#endif /* OPENSSL_NO_SIV */
|
2021-03-10 18:22:55 +08:00
|
|
|
ALG(PROV_NAMES_AES_256_GCM, ossl_aes256gcm_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_GCM, ossl_aes192gcm_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_GCM, ossl_aes128gcm_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_CCM, ossl_aes256ccm_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_CCM, ossl_aes192ccm_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_CCM, ossl_aes128ccm_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_WRAP, ossl_aes256wrap_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_WRAP, ossl_aes192wrap_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_WRAP, ossl_aes128wrap_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_WRAP_PAD, ossl_aes256wrappad_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_WRAP_PAD, ossl_aes192wrappad_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_WRAP_PAD, ossl_aes128wrappad_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_WRAP_INV, ossl_aes256wrapinv_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_WRAP_INV, ossl_aes192wrapinv_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_WRAP_INV, ossl_aes128wrapinv_functions),
|
|
|
|
ALG(PROV_NAMES_AES_256_WRAP_PAD_INV, ossl_aes256wrappadinv_functions),
|
|
|
|
ALG(PROV_NAMES_AES_192_WRAP_PAD_INV, ossl_aes192wrappadinv_functions),
|
|
|
|
ALG(PROV_NAMES_AES_128_WRAP_PAD_INV, ossl_aes128wrappadinv_functions),
|
|
|
|
ALGC(PROV_NAMES_AES_128_CBC_HMAC_SHA1, ossl_aes128cbc_hmac_sha1_functions,
|
2020-09-29 15:40:26 +08:00
|
|
|
ossl_cipher_capable_aes_cbc_hmac_sha1),
|
2021-03-10 18:22:55 +08:00
|
|
|
ALGC(PROV_NAMES_AES_256_CBC_HMAC_SHA1, ossl_aes256cbc_hmac_sha1_functions,
|
2020-09-29 15:40:26 +08:00
|
|
|
ossl_cipher_capable_aes_cbc_hmac_sha1),
|
2021-03-10 18:22:55 +08:00
|
|
|
ALGC(PROV_NAMES_AES_128_CBC_HMAC_SHA256, ossl_aes128cbc_hmac_sha256_functions,
|
2020-09-29 15:40:26 +08:00
|
|
|
ossl_cipher_capable_aes_cbc_hmac_sha256),
|
2021-03-10 18:22:55 +08:00
|
|
|
ALGC(PROV_NAMES_AES_256_CBC_HMAC_SHA256, ossl_aes256cbc_hmac_sha256_functions,
|
2020-09-29 15:40:26 +08:00
|
|
|
ossl_cipher_capable_aes_cbc_hmac_sha256),
|
2019-07-31 19:55:16 +08:00
|
|
|
#ifndef OPENSSL_NO_ARIA
|
2021-03-10 18:22:55 +08:00
|
|
|
ALG(PROV_NAMES_ARIA_256_GCM, ossl_aria256gcm_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_192_GCM, ossl_aria192gcm_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_128_GCM, ossl_aria128gcm_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_256_CCM, ossl_aria256ccm_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_192_CCM, ossl_aria192ccm_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_128_CCM, ossl_aria128ccm_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_256_ECB, ossl_aria256ecb_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_192_ECB, ossl_aria192ecb_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_128_ECB, ossl_aria128ecb_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_256_CBC, ossl_aria256cbc_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_192_CBC, ossl_aria192cbc_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_128_CBC, ossl_aria128cbc_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_256_OFB, ossl_aria256ofb_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_192_OFB, ossl_aria192ofb_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_128_OFB, ossl_aria128ofb_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_256_CFB, ossl_aria256cfb_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_192_CFB, ossl_aria192cfb_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_128_CFB, ossl_aria128cfb_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_256_CFB1, ossl_aria256cfb1_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_192_CFB1, ossl_aria192cfb1_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_128_CFB1, ossl_aria128cfb1_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_256_CFB8, ossl_aria256cfb8_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_192_CFB8, ossl_aria192cfb8_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_128_CFB8, ossl_aria128cfb8_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_256_CTR, ossl_aria256ctr_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_192_CTR, ossl_aria192ctr_functions),
|
|
|
|
ALG(PROV_NAMES_ARIA_128_CTR, ossl_aria128ctr_functions),
|
2019-07-31 19:55:16 +08:00
|
|
|
#endif /* OPENSSL_NO_ARIA */
|
2019-08-22 09:42:54 +08:00
|
|
|
#ifndef OPENSSL_NO_CAMELLIA
|
2021-03-10 18:22:55 +08:00
|
|
|
ALG(PROV_NAMES_CAMELLIA_256_ECB, ossl_camellia256ecb_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_192_ECB, ossl_camellia192ecb_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_128_ECB, ossl_camellia128ecb_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_256_CBC, ossl_camellia256cbc_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_192_CBC, ossl_camellia192cbc_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_128_CBC, ossl_camellia128cbc_functions),
|
2021-08-12 16:22:50 +08:00
|
|
|
ALG(PROV_NAMES_CAMELLIA_128_CBC_CTS, ossl_camellia128cbc_cts_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_192_CBC_CTS, ossl_camellia192cbc_cts_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_256_CBC_CTS, ossl_camellia256cbc_cts_functions),
|
2021-03-10 18:22:55 +08:00
|
|
|
ALG(PROV_NAMES_CAMELLIA_256_OFB, ossl_camellia256ofb_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_192_OFB, ossl_camellia192ofb_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_128_OFB, ossl_camellia128ofb_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_256_CFB, ossl_camellia256cfb_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_192_CFB, ossl_camellia192cfb_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_128_CFB, ossl_camellia128cfb_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_256_CFB1, ossl_camellia256cfb1_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_192_CFB1, ossl_camellia192cfb1_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_128_CFB1, ossl_camellia128cfb1_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_256_CFB8, ossl_camellia256cfb8_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_192_CFB8, ossl_camellia192cfb8_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_128_CFB8, ossl_camellia128cfb8_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_256_CTR, ossl_camellia256ctr_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_192_CTR, ossl_camellia192ctr_functions),
|
|
|
|
ALG(PROV_NAMES_CAMELLIA_128_CTR, ossl_camellia128ctr_functions),
|
2019-08-22 09:42:54 +08:00
|
|
|
#endif /* OPENSSL_NO_CAMELLIA */
|
2019-08-28 23:00:01 +08:00
|
|
|
#ifndef OPENSSL_NO_DES
|
2021-03-10 18:22:55 +08:00
|
|
|
ALG(PROV_NAMES_DES_EDE3_ECB, ossl_tdes_ede3_ecb_functions),
|
|
|
|
ALG(PROV_NAMES_DES_EDE3_CBC, ossl_tdes_ede3_cbc_functions),
|
|
|
|
ALG(PROV_NAMES_DES_EDE3_OFB, ossl_tdes_ede3_ofb_functions),
|
|
|
|
ALG(PROV_NAMES_DES_EDE3_CFB, ossl_tdes_ede3_cfb_functions),
|
|
|
|
ALG(PROV_NAMES_DES_EDE3_CFB8, ossl_tdes_ede3_cfb8_functions),
|
|
|
|
ALG(PROV_NAMES_DES_EDE3_CFB1, ossl_tdes_ede3_cfb1_functions),
|
|
|
|
ALG(PROV_NAMES_DES3_WRAP, ossl_tdes_wrap_cbc_functions),
|
|
|
|
ALG(PROV_NAMES_DES_EDE_ECB, ossl_tdes_ede2_ecb_functions),
|
|
|
|
ALG(PROV_NAMES_DES_EDE_CBC, ossl_tdes_ede2_cbc_functions),
|
|
|
|
ALG(PROV_NAMES_DES_EDE_OFB, ossl_tdes_ede2_ofb_functions),
|
|
|
|
ALG(PROV_NAMES_DES_EDE_CFB, ossl_tdes_ede2_cfb_functions),
|
2019-08-28 23:00:01 +08:00
|
|
|
#endif /* OPENSSL_NO_DES */
|
2019-09-19 13:38:51 +08:00
|
|
|
#ifndef OPENSSL_NO_SM4
|
2021-09-01 16:54:15 +08:00
|
|
|
ALG(PROV_NAMES_SM4_GCM, ossl_sm4128gcm_functions),
|
|
|
|
ALG(PROV_NAMES_SM4_CCM, ossl_sm4128ccm_functions),
|
2021-03-10 18:22:55 +08:00
|
|
|
ALG(PROV_NAMES_SM4_ECB, ossl_sm4128ecb_functions),
|
|
|
|
ALG(PROV_NAMES_SM4_CBC, ossl_sm4128cbc_functions),
|
|
|
|
ALG(PROV_NAMES_SM4_CTR, ossl_sm4128ctr_functions),
|
|
|
|
ALG(PROV_NAMES_SM4_OFB, ossl_sm4128ofb128_functions),
|
|
|
|
ALG(PROV_NAMES_SM4_CFB, ossl_sm4128cfb128_functions),
|
2022-11-25 13:52:49 +08:00
|
|
|
ALG(PROV_NAMES_SM4_XTS, ossl_sm4128xts_functions),
|
2019-09-19 13:38:51 +08:00
|
|
|
#endif /* OPENSSL_NO_SM4 */
|
2019-10-16 14:18:42 +08:00
|
|
|
#ifndef OPENSSL_NO_CHACHA
|
2021-03-10 18:22:55 +08:00
|
|
|
ALG(PROV_NAMES_ChaCha20, ossl_chacha20_functions),
|
2019-10-16 14:18:42 +08:00
|
|
|
# ifndef OPENSSL_NO_POLY1305
|
2021-03-10 18:22:55 +08:00
|
|
|
ALG(PROV_NAMES_ChaCha20_Poly1305, ossl_chacha20_ossl_poly1305_functions),
|
2019-10-16 14:18:42 +08:00
|
|
|
# endif /* OPENSSL_NO_POLY1305 */
|
|
|
|
#endif /* OPENSSL_NO_CHACHA */
|
2020-01-06 11:02:16 +08:00
|
|
|
{ { NULL, NULL, NULL }, NULL }
|
2019-04-03 22:34:08 +08:00
|
|
|
};
|
2020-01-06 11:02:16 +08:00
|
|
|
static OSSL_ALGORITHM exported_ciphers[OSSL_NELEM(deflt_ciphers)];
|
2019-04-03 22:34:08 +08:00
|
|
|
|
2019-05-07 18:40:25 +08:00
|
|
|
static const OSSL_ALGORITHM deflt_macs[] = {
|
|
|
|
#ifndef OPENSSL_NO_BLAKE2
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_BLAKE2BMAC, "provider=default", ossl_blake2bmac_functions },
|
|
|
|
{ PROV_NAMES_BLAKE2SMAC, "provider=default", ossl_blake2smac_functions },
|
2019-06-01 17:18:15 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_CMAC
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_CMAC, "provider=default", ossl_cmac_functions },
|
2019-05-07 18:40:25 +08:00
|
|
|
#endif
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_GMAC, "provider=default", ossl_gmac_functions },
|
|
|
|
{ PROV_NAMES_HMAC, "provider=default", ossl_hmac_functions },
|
|
|
|
{ PROV_NAMES_KMAC_128, "provider=default", ossl_kmac128_functions },
|
|
|
|
{ PROV_NAMES_KMAC_256, "provider=default", ossl_kmac256_functions },
|
2019-06-02 14:51:58 +08:00
|
|
|
#ifndef OPENSSL_NO_SIPHASH
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_SIPHASH, "provider=default", ossl_siphash_functions },
|
2019-06-02 15:33:28 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_POLY1305
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_POLY1305, "provider=default", ossl_poly1305_functions },
|
2019-06-02 14:51:58 +08:00
|
|
|
#endif
|
2019-05-07 18:40:25 +08:00
|
|
|
{ NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
2019-08-21 11:09:10 +08:00
|
|
|
static const OSSL_ALGORITHM deflt_kdfs[] = {
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_HKDF, "provider=default", ossl_kdf_hkdf_functions },
|
2021-08-02 14:19:29 +08:00
|
|
|
{ PROV_NAMES_TLS1_3_KDF, "provider=default",
|
|
|
|
ossl_kdf_tls1_3_kdf_functions },
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_SSKDF, "provider=default", ossl_kdf_sskdf_functions },
|
|
|
|
{ PROV_NAMES_PBKDF2, "provider=default", ossl_kdf_pbkdf2_functions },
|
|
|
|
{ PROV_NAMES_PKCS12KDF, "provider=default", ossl_kdf_pkcs12_functions },
|
|
|
|
{ PROV_NAMES_SSHKDF, "provider=default", ossl_kdf_sshkdf_functions },
|
|
|
|
{ PROV_NAMES_X963KDF, "provider=default", ossl_kdf_x963_kdf_functions },
|
|
|
|
{ PROV_NAMES_TLS1_PRF, "provider=default", ossl_kdf_tls1_prf_functions },
|
|
|
|
{ PROV_NAMES_KBKDF, "provider=default", ossl_kdf_kbkdf_functions },
|
|
|
|
{ PROV_NAMES_X942KDF_ASN1, "provider=default", ossl_kdf_x942_kdf_functions },
|
2019-08-21 11:09:10 +08:00
|
|
|
#ifndef OPENSSL_NO_SCRYPT
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_SCRYPT, "provider=default", ossl_kdf_scrypt_functions },
|
2019-08-21 11:09:10 +08:00
|
|
|
#endif
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_KRB5KDF, "provider=default", ossl_kdf_krb5kdf_functions },
|
2022-07-15 19:22:01 +08:00
|
|
|
{ PROV_NAMES_HMAC_DRBG_KDF, "provider=default",
|
|
|
|
ossl_kdf_hmac_drbg_functions },
|
2021-09-28 04:45:38 +08:00
|
|
|
#ifndef OPENSSL_NO_ARGON2
|
|
|
|
{ PROV_NAMES_ARGON2I, "provider=default", ossl_kdf_argon2i_functions },
|
|
|
|
{ PROV_NAMES_ARGON2D, "provider=default", ossl_kdf_argon2d_functions },
|
|
|
|
{ PROV_NAMES_ARGON2ID, "provider=default", ossl_kdf_argon2id_functions },
|
|
|
|
#endif
|
2019-10-30 09:00:19 +08:00
|
|
|
{ NULL, NULL, NULL }
|
2019-08-21 11:09:10 +08:00
|
|
|
};
|
|
|
|
|
2019-06-27 19:36:30 +08:00
|
|
|
static const OSSL_ALGORITHM deflt_keyexch[] = {
|
2019-07-17 18:40:41 +08:00
|
|
|
#ifndef OPENSSL_NO_DH
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_DH, "provider=default", ossl_dh_keyexch_functions },
|
2020-01-25 01:13:40 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_EC
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_ECDH, "provider=default", ossl_ecdh_keyexch_functions },
|
2023-04-17 16:20:31 +08:00
|
|
|
# ifndef OPENSSL_NO_ECX
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_X25519, "provider=default", ossl_x25519_keyexch_functions },
|
|
|
|
{ PROV_NAMES_X448, "provider=default", ossl_x448_keyexch_functions },
|
2023-04-17 16:20:31 +08:00
|
|
|
# endif
|
2019-07-07 16:56:46 +08:00
|
|
|
#endif
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_TLS1_PRF, "provider=default", ossl_kdf_tls1_prf_keyexch_functions },
|
|
|
|
{ PROV_NAMES_HKDF, "provider=default", ossl_kdf_hkdf_keyexch_functions },
|
|
|
|
{ PROV_NAMES_SCRYPT, "provider=default",
|
2020-09-28 10:28:29 +08:00
|
|
|
ossl_kdf_scrypt_keyexch_functions },
|
2019-07-07 16:56:46 +08:00
|
|
|
{ NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
2020-05-08 08:24:12 +08:00
|
|
|
static const OSSL_ALGORITHM deflt_rands[] = {
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_CTR_DRBG, "provider=default", ossl_drbg_ctr_functions },
|
|
|
|
{ PROV_NAMES_HASH_DRBG, "provider=default", ossl_drbg_hash_functions },
|
|
|
|
{ PROV_NAMES_HMAC_DRBG, "provider=default", ossl_drbg_ossl_hmac_functions },
|
|
|
|
{ PROV_NAMES_SEED_SRC, "provider=default", ossl_seed_src_functions },
|
2024-07-10 22:39:01 +08:00
|
|
|
#ifndef OPENSSL_NO_JITTER
|
|
|
|
{ PROV_NAMES_JITTER, "provider=default", ossl_jitter_functions },
|
|
|
|
#endif
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_TEST_RAND, "provider=default", ossl_test_rng_functions },
|
2020-05-08 08:24:12 +08:00
|
|
|
{ NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
2019-08-30 20:33:37 +08:00
|
|
|
static const OSSL_ALGORITHM deflt_signature[] = {
|
|
|
|
#ifndef OPENSSL_NO_DSA
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_DSA, "provider=default", ossl_dsa_signature_functions },
|
2024-07-24 21:37:08 +08:00
|
|
|
{ PROV_NAMES_DSA_SHA1, "provider=default", ossl_dsa_sha1_signature_functions },
|
|
|
|
{ PROV_NAMES_DSA_SHA224, "provider=default", ossl_dsa_sha224_signature_functions },
|
|
|
|
{ PROV_NAMES_DSA_SHA256, "provider=default", ossl_dsa_sha256_signature_functions },
|
|
|
|
{ PROV_NAMES_DSA_SHA384, "provider=default", ossl_dsa_sha384_signature_functions },
|
|
|
|
{ PROV_NAMES_DSA_SHA512, "provider=default", ossl_dsa_sha512_signature_functions },
|
|
|
|
{ PROV_NAMES_DSA_SHA3_224, "provider=default", ossl_dsa_sha3_224_signature_functions },
|
|
|
|
{ PROV_NAMES_DSA_SHA3_256, "provider=default", ossl_dsa_sha3_256_signature_functions },
|
|
|
|
{ PROV_NAMES_DSA_SHA3_384, "provider=default", ossl_dsa_sha3_384_signature_functions },
|
|
|
|
{ PROV_NAMES_DSA_SHA3_512, "provider=default", ossl_dsa_sha3_512_signature_functions },
|
2019-08-30 20:33:37 +08:00
|
|
|
#endif
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_RSA, "provider=default", ossl_rsa_signature_functions },
|
2024-07-06 22:26:39 +08:00
|
|
|
#if !defined(OPENSSL_NO_RMD160) && !defined(FIPS_MODULE)
|
|
|
|
{ PROV_NAMES_RSA_RIPEMD160, "provider=default", ossl_rsa_ripemd160_signature_functions },
|
|
|
|
#endif
|
|
|
|
{ PROV_NAMES_RSA_SHA1, "provider=default", ossl_rsa_sha1_signature_functions },
|
|
|
|
{ PROV_NAMES_RSA_SHA224, "provider=default", ossl_rsa_sha224_signature_functions },
|
|
|
|
{ PROV_NAMES_RSA_SHA256, "provider=default", ossl_rsa_sha256_signature_functions },
|
|
|
|
{ PROV_NAMES_RSA_SHA384, "provider=default", ossl_rsa_sha384_signature_functions },
|
|
|
|
{ PROV_NAMES_RSA_SHA512, "provider=default", ossl_rsa_sha512_signature_functions },
|
|
|
|
{ PROV_NAMES_RSA_SHA512_224, "provider=default", ossl_rsa_sha512_224_signature_functions },
|
|
|
|
{ PROV_NAMES_RSA_SHA512_256, "provider=default", ossl_rsa_sha512_256_signature_functions },
|
|
|
|
{ PROV_NAMES_RSA_SHA3_224, "provider=default", ossl_rsa_sha3_224_signature_functions },
|
|
|
|
{ PROV_NAMES_RSA_SHA3_256, "provider=default", ossl_rsa_sha3_256_signature_functions },
|
|
|
|
{ PROV_NAMES_RSA_SHA3_384, "provider=default", ossl_rsa_sha3_384_signature_functions },
|
|
|
|
{ PROV_NAMES_RSA_SHA3_512, "provider=default", ossl_rsa_sha3_512_signature_functions },
|
|
|
|
#ifndef OPENSSL_NO_SM3
|
|
|
|
{ PROV_NAMES_RSA_SM3, "provider=default", ossl_rsa_sm3_signature_functions },
|
|
|
|
#endif
|
2020-03-05 23:42:13 +08:00
|
|
|
#ifndef OPENSSL_NO_EC
|
2023-04-17 16:20:31 +08:00
|
|
|
# ifndef OPENSSL_NO_ECX
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_ED25519, "provider=default", ossl_ed25519_signature_functions },
|
2024-02-02 15:20:06 +08:00
|
|
|
{ PROV_NAMES_ED25519ph, "provider=default", ossl_ed25519ph_signature_functions },
|
|
|
|
{ PROV_NAMES_ED25519ctx, "provider=default", ossl_ed25519ctx_signature_functions },
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_ED448, "provider=default", ossl_ed448_signature_functions },
|
2024-02-02 15:20:06 +08:00
|
|
|
{ PROV_NAMES_ED448ph, "provider=default", ossl_ed448ph_signature_functions },
|
2023-04-17 16:20:31 +08:00
|
|
|
# endif
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_ECDSA, "provider=default", ossl_ecdsa_signature_functions },
|
2024-07-25 04:07:32 +08:00
|
|
|
{ PROV_NAMES_ECDSA_SHA1, "provider=default", ossl_ecdsa_sha1_signature_functions },
|
|
|
|
{ PROV_NAMES_ECDSA_SHA224, "provider=default", ossl_ecdsa_sha224_signature_functions },
|
|
|
|
{ PROV_NAMES_ECDSA_SHA256, "provider=default", ossl_ecdsa_sha256_signature_functions },
|
|
|
|
{ PROV_NAMES_ECDSA_SHA384, "provider=default", ossl_ecdsa_sha384_signature_functions },
|
|
|
|
{ PROV_NAMES_ECDSA_SHA512, "provider=default", ossl_ecdsa_sha512_signature_functions },
|
|
|
|
{ PROV_NAMES_ECDSA_SHA3_224, "provider=default", ossl_ecdsa_sha3_224_signature_functions },
|
|
|
|
{ PROV_NAMES_ECDSA_SHA3_256, "provider=default", ossl_ecdsa_sha3_256_signature_functions },
|
|
|
|
{ PROV_NAMES_ECDSA_SHA3_384, "provider=default", ossl_ecdsa_sha3_384_signature_functions },
|
|
|
|
{ PROV_NAMES_ECDSA_SHA3_512, "provider=default", ossl_ecdsa_sha3_512_signature_functions },
|
2020-03-04 23:49:43 +08:00
|
|
|
# ifndef OPENSSL_NO_SM2
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_SM2, "provider=default", ossl_sm2_signature_functions },
|
2020-03-04 23:49:43 +08:00
|
|
|
# endif
|
2020-03-05 23:42:13 +08:00
|
|
|
#endif
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_HMAC, "provider=default", ossl_mac_legacy_hmac_signature_functions },
|
|
|
|
{ PROV_NAMES_SIPHASH, "provider=default",
|
2020-09-28 10:28:29 +08:00
|
|
|
ossl_mac_legacy_siphash_signature_functions },
|
2020-08-11 22:28:07 +08:00
|
|
|
#ifndef OPENSSL_NO_POLY1305
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_POLY1305, "provider=default",
|
2020-09-28 10:28:29 +08:00
|
|
|
ossl_mac_legacy_poly1305_signature_functions },
|
2020-08-11 23:17:00 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_CMAC
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_CMAC, "provider=default", ossl_mac_legacy_cmac_signature_functions },
|
2020-08-11 22:28:07 +08:00
|
|
|
#endif
|
2019-08-30 20:33:37 +08:00
|
|
|
{ NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
2019-10-28 21:40:39 +08:00
|
|
|
static const OSSL_ALGORITHM deflt_asym_cipher[] = {
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_RSA, "provider=default", ossl_rsa_asym_cipher_functions },
|
2020-09-18 16:55:16 +08:00
|
|
|
#ifndef OPENSSL_NO_SM2
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_SM2, "provider=default", ossl_sm2_asym_cipher_functions },
|
2020-09-18 16:55:16 +08:00
|
|
|
#endif
|
2019-10-28 21:40:39 +08:00
|
|
|
{ NULL, NULL, NULL }
|
|
|
|
};
|
2019-08-30 20:33:37 +08:00
|
|
|
|
2020-09-19 16:08:46 +08:00
|
|
|
static const OSSL_ALGORITHM deflt_asym_kem[] = {
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_RSA, "provider=default", ossl_rsa_asym_kem_functions },
|
2022-08-26 09:54:35 +08:00
|
|
|
#ifndef OPENSSL_NO_EC
|
2023-04-17 16:20:31 +08:00
|
|
|
# ifndef OPENSSL_NO_ECX
|
2022-08-26 09:54:35 +08:00
|
|
|
{ PROV_NAMES_X25519, "provider=default", ossl_ecx_asym_kem_functions },
|
|
|
|
{ PROV_NAMES_X448, "provider=default", ossl_ecx_asym_kem_functions },
|
2023-04-17 16:20:31 +08:00
|
|
|
# endif
|
2022-08-26 09:54:35 +08:00
|
|
|
{ PROV_NAMES_EC, "provider=default", ossl_ec_asym_kem_functions },
|
|
|
|
#endif
|
2020-09-19 16:08:46 +08:00
|
|
|
{ NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
2019-07-07 16:56:46 +08:00
|
|
|
static const OSSL_ALGORITHM deflt_keymgmt[] = {
|
|
|
|
#ifndef OPENSSL_NO_DH
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_DH, "provider=default", ossl_dh_keymgmt_functions,
|
|
|
|
PROV_DESCS_DH },
|
|
|
|
{ PROV_NAMES_DHX, "provider=default", ossl_dhx_keymgmt_functions,
|
|
|
|
PROV_DESCS_DHX },
|
2019-08-30 20:33:37 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_DSA
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_DSA, "provider=default", ossl_dsa_keymgmt_functions,
|
|
|
|
PROV_DESCS_DSA},
|
2019-07-17 18:40:41 +08:00
|
|
|
#endif
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_RSA, "provider=default", ossl_rsa_keymgmt_functions,
|
|
|
|
PROV_DESCS_RSA },
|
|
|
|
{ PROV_NAMES_RSA_PSS, "provider=default", ossl_rsapss_keymgmt_functions,
|
|
|
|
PROV_DESCS_RSA_PSS },
|
2020-01-28 00:57:03 +08:00
|
|
|
#ifndef OPENSSL_NO_EC
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_EC, "provider=default", ossl_ec_keymgmt_functions,
|
|
|
|
PROV_DESCS_EC },
|
2023-04-17 16:20:31 +08:00
|
|
|
# ifndef OPENSSL_NO_ECX
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_X25519, "provider=default", ossl_x25519_keymgmt_functions,
|
|
|
|
PROV_DESCS_X25519 },
|
|
|
|
{ PROV_NAMES_X448, "provider=default", ossl_x448_keymgmt_functions,
|
|
|
|
PROV_DESCS_X448 },
|
|
|
|
{ PROV_NAMES_ED25519, "provider=default", ossl_ed25519_keymgmt_functions,
|
|
|
|
PROV_DESCS_ED25519 },
|
|
|
|
{ PROV_NAMES_ED448, "provider=default", ossl_ed448_keymgmt_functions,
|
|
|
|
PROV_DESCS_ED448 },
|
2023-04-17 16:20:31 +08:00
|
|
|
# endif
|
2020-01-28 00:57:03 +08:00
|
|
|
#endif
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_TLS1_PRF, "provider=default", ossl_kdf_keymgmt_functions,
|
|
|
|
PROV_DESCS_TLS1_PRF_SIGN },
|
|
|
|
{ PROV_NAMES_HKDF, "provider=default", ossl_kdf_keymgmt_functions,
|
|
|
|
PROV_DESCS_HKDF_SIGN },
|
|
|
|
{ PROV_NAMES_SCRYPT, "provider=default", ossl_kdf_keymgmt_functions,
|
|
|
|
PROV_DESCS_SCRYPT_SIGN },
|
|
|
|
{ PROV_NAMES_HMAC, "provider=default", ossl_mac_legacy_keymgmt_functions,
|
|
|
|
PROV_DESCS_HMAC_SIGN },
|
|
|
|
{ PROV_NAMES_SIPHASH, "provider=default", ossl_mac_legacy_keymgmt_functions,
|
|
|
|
PROV_DESCS_SIPHASH_SIGN },
|
2020-08-11 22:28:07 +08:00
|
|
|
#ifndef OPENSSL_NO_POLY1305
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_POLY1305, "provider=default", ossl_mac_legacy_keymgmt_functions,
|
|
|
|
PROV_DESCS_POLY1305_SIGN },
|
2020-08-11 23:17:00 +08:00
|
|
|
#endif
|
|
|
|
#ifndef OPENSSL_NO_CMAC
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_CMAC, "provider=default", ossl_cmac_legacy_keymgmt_functions,
|
|
|
|
PROV_DESCS_CMAC_SIGN },
|
2020-03-04 23:49:43 +08:00
|
|
|
#endif
|
2020-07-26 23:25:49 +08:00
|
|
|
#ifndef OPENSSL_NO_SM2
|
2021-03-10 18:22:55 +08:00
|
|
|
{ PROV_NAMES_SM2, "provider=default", ossl_sm2_keymgmt_functions,
|
|
|
|
PROV_DESCS_SM2 },
|
2020-08-11 22:28:07 +08:00
|
|
|
#endif
|
2019-06-27 19:36:30 +08:00
|
|
|
{ NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
2020-08-17 03:25:08 +08:00
|
|
|
static const OSSL_ALGORITHM deflt_encoder[] = {
|
2020-10-17 14:34:47 +08:00
|
|
|
#define ENCODER_PROVIDER "default"
|
2020-08-17 03:25:08 +08:00
|
|
|
#include "encoders.inc"
|
2020-07-10 01:07:12 +08:00
|
|
|
{ NULL, NULL, NULL }
|
2020-10-17 14:34:47 +08:00
|
|
|
#undef ENCODER_PROVIDER
|
2020-07-10 01:07:12 +08:00
|
|
|
};
|
|
|
|
|
2020-08-17 03:25:08 +08:00
|
|
|
static const OSSL_ALGORITHM deflt_decoder[] = {
|
PROV: Re-implement all the keypair decoders
The base functionality to implement the keypair decoders doesn't
change much, but this results in a more massive amount of
OSSL_DISPATCH and OSSL_ALGORITHM arrays, to support a fine grained
selection of implementation based on what parts of the keypair
structure (combinations of key parameters, public key and private key)
should be expected as input, the input type ("DER", "PEM", ...) and the
outermost input structure ("pkcs8", "SubjectPublicKeyInfo", key
type specific structures, ...).
We add support for the generic structure name "type-specific", to
allow selecting that without knowing the exact name of that structure.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13248)
2020-10-26 20:22:54 +08:00
|
|
|
#define DECODER_PROVIDER "default"
|
2020-08-17 03:25:08 +08:00
|
|
|
#include "decoders.inc"
|
2019-11-18 08:56:22 +08:00
|
|
|
{ NULL, NULL, NULL }
|
PROV: Re-implement all the keypair decoders
The base functionality to implement the keypair decoders doesn't
change much, but this results in a more massive amount of
OSSL_DISPATCH and OSSL_ALGORITHM arrays, to support a fine grained
selection of implementation based on what parts of the keypair
structure (combinations of key parameters, public key and private key)
should be expected as input, the input type ("DER", "PEM", ...) and the
outermost input structure ("pkcs8", "SubjectPublicKeyInfo", key
type specific structures, ...).
We add support for the generic structure name "type-specific", to
allow selecting that without knowing the exact name of that structure.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13248)
2020-10-26 20:22:54 +08:00
|
|
|
#undef DECODER_PROVIDER
|
2019-11-18 08:56:22 +08:00
|
|
|
};
|
|
|
|
|
2020-08-02 18:46:00 +08:00
|
|
|
static const OSSL_ALGORITHM deflt_store[] = {
|
2020-09-08 08:33:28 +08:00
|
|
|
#define STORE(name, _fips, func_table) \
|
|
|
|
{ name, "provider=default,fips=" _fips, (func_table) },
|
2020-08-02 18:46:00 +08:00
|
|
|
|
|
|
|
#include "stores.inc"
|
|
|
|
{ NULL, NULL, NULL }
|
|
|
|
#undef STORE
|
|
|
|
};
|
|
|
|
|
2020-05-09 16:11:14 +08:00
|
|
|
static const OSSL_ALGORITHM *deflt_query(void *provctx, int operation_id,
|
2019-03-14 01:26:17 +08:00
|
|
|
int *no_cache)
|
|
|
|
{
|
|
|
|
*no_cache = 0;
|
|
|
|
switch (operation_id) {
|
|
|
|
case OSSL_OP_DIGEST:
|
|
|
|
return deflt_digests;
|
2019-04-03 22:34:08 +08:00
|
|
|
case OSSL_OP_CIPHER:
|
2020-01-06 11:02:16 +08:00
|
|
|
return exported_ciphers;
|
2019-05-07 18:40:25 +08:00
|
|
|
case OSSL_OP_MAC:
|
|
|
|
return deflt_macs;
|
2019-08-21 11:09:10 +08:00
|
|
|
case OSSL_OP_KDF:
|
|
|
|
return deflt_kdfs;
|
2020-05-08 08:24:12 +08:00
|
|
|
case OSSL_OP_RAND:
|
|
|
|
return deflt_rands;
|
2019-07-07 16:56:46 +08:00
|
|
|
case OSSL_OP_KEYMGMT:
|
|
|
|
return deflt_keymgmt;
|
2019-06-27 19:36:30 +08:00
|
|
|
case OSSL_OP_KEYEXCH:
|
|
|
|
return deflt_keyexch;
|
2019-08-30 20:33:37 +08:00
|
|
|
case OSSL_OP_SIGNATURE:
|
|
|
|
return deflt_signature;
|
2019-10-28 21:40:39 +08:00
|
|
|
case OSSL_OP_ASYM_CIPHER:
|
|
|
|
return deflt_asym_cipher;
|
2020-09-19 16:08:46 +08:00
|
|
|
case OSSL_OP_KEM:
|
|
|
|
return deflt_asym_kem;
|
2020-08-17 03:25:08 +08:00
|
|
|
case OSSL_OP_ENCODER:
|
|
|
|
return deflt_encoder;
|
|
|
|
case OSSL_OP_DECODER:
|
|
|
|
return deflt_decoder;
|
2020-08-02 18:46:00 +08:00
|
|
|
case OSSL_OP_STORE:
|
|
|
|
return deflt_store;
|
2019-03-14 01:26:17 +08:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-05-18 21:11:06 +08:00
|
|
|
|
2020-05-12 15:02:25 +08:00
|
|
|
static void deflt_teardown(void *provctx)
|
|
|
|
{
|
2020-09-28 10:47:04 +08:00
|
|
|
BIO_meth_free(ossl_prov_ctx_get0_core_bio_method(provctx));
|
|
|
|
ossl_prov_ctx_free(provctx);
|
2020-05-12 15:02:25 +08:00
|
|
|
}
|
|
|
|
|
2019-03-13 20:02:55 +08:00
|
|
|
/* Functions we provide to the core */
|
|
|
|
static const OSSL_DISPATCH deflt_dispatch_table[] = {
|
2020-05-12 15:02:25 +08:00
|
|
|
{ OSSL_FUNC_PROVIDER_TEARDOWN, (void (*)(void))deflt_teardown },
|
2019-08-15 02:17:39 +08:00
|
|
|
{ OSSL_FUNC_PROVIDER_GETTABLE_PARAMS, (void (*)(void))deflt_gettable_params },
|
2019-03-13 20:02:55 +08:00
|
|
|
{ OSSL_FUNC_PROVIDER_GET_PARAMS, (void (*)(void))deflt_get_params },
|
2019-03-14 01:26:17 +08:00
|
|
|
{ OSSL_FUNC_PROVIDER_QUERY_OPERATION, (void (*)(void))deflt_query },
|
2021-03-09 13:26:17 +08:00
|
|
|
{ OSSL_FUNC_PROVIDER_GET_CAPABILITIES,
|
|
|
|
(void (*)(void))ossl_prov_get_capabilities },
|
2023-04-19 22:08:22 +08:00
|
|
|
OSSL_DISPATCH_END
|
2019-03-13 20:02:55 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
OSSL_provider_init_fn ossl_default_provider_init;
|
|
|
|
|
2020-05-06 19:29:57 +08:00
|
|
|
int ossl_default_provider_init(const OSSL_CORE_HANDLE *handle,
|
2019-03-13 20:02:55 +08:00
|
|
|
const OSSL_DISPATCH *in,
|
2019-04-30 19:41:51 +08:00
|
|
|
const OSSL_DISPATCH **out,
|
|
|
|
void **provctx)
|
2019-03-13 20:02:55 +08:00
|
|
|
{
|
2020-10-15 17:55:50 +08:00
|
|
|
OSSL_FUNC_core_get_libctx_fn *c_get_libctx = NULL;
|
2020-05-06 19:29:57 +08:00
|
|
|
BIO_METHOD *corebiometh;
|
2019-06-14 17:41:32 +08:00
|
|
|
|
2020-10-30 13:54:03 +08:00
|
|
|
if (!ossl_prov_bio_from_dispatch(in)
|
|
|
|
|| !ossl_prov_seeding_from_dispatch(in))
|
2019-11-18 08:50:18 +08:00
|
|
|
return 0;
|
2019-03-13 20:02:55 +08:00
|
|
|
for (; in->function_id != 0; in++) {
|
|
|
|
switch (in->function_id) {
|
2019-08-15 02:17:39 +08:00
|
|
|
case OSSL_FUNC_CORE_GETTABLE_PARAMS:
|
2020-06-21 07:19:16 +08:00
|
|
|
c_gettable_params = OSSL_FUNC_core_gettable_params(in);
|
2019-03-13 20:02:55 +08:00
|
|
|
break;
|
|
|
|
case OSSL_FUNC_CORE_GET_PARAMS:
|
2020-06-21 07:19:16 +08:00
|
|
|
c_get_params = OSSL_FUNC_core_get_params(in);
|
2019-03-13 20:02:55 +08:00
|
|
|
break;
|
2020-10-15 17:55:50 +08:00
|
|
|
case OSSL_FUNC_CORE_GET_LIBCTX:
|
|
|
|
c_get_libctx = OSSL_FUNC_core_get_libctx(in);
|
2019-06-14 17:41:32 +08:00
|
|
|
break;
|
2019-03-13 20:02:55 +08:00
|
|
|
default:
|
|
|
|
/* Just ignore anything we don't understand */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-14 17:41:32 +08:00
|
|
|
if (c_get_libctx == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We want to make sure that all calls from this provider that requires
|
|
|
|
* a library context use the same context as the one used to call our
|
2020-05-06 19:29:57 +08:00
|
|
|
* functions. We do that by passing it along in the provider context.
|
2020-05-12 15:02:25 +08:00
|
|
|
*
|
2020-05-06 19:29:57 +08:00
|
|
|
* This only works for built-in providers. Most providers should
|
2020-05-12 15:02:25 +08:00
|
|
|
* create their own library context.
|
2019-06-14 17:41:32 +08:00
|
|
|
*/
|
2020-09-28 10:47:04 +08:00
|
|
|
if ((*provctx = ossl_prov_ctx_new()) == NULL
|
2021-02-25 07:08:54 +08:00
|
|
|
|| (corebiometh = ossl_bio_prov_init_bio_method()) == NULL) {
|
2020-09-28 10:47:04 +08:00
|
|
|
ossl_prov_ctx_free(*provctx);
|
2020-05-06 19:29:57 +08:00
|
|
|
*provctx = NULL;
|
2020-05-12 15:02:25 +08:00
|
|
|
return 0;
|
2020-05-06 19:29:57 +08:00
|
|
|
}
|
2020-10-15 17:55:50 +08:00
|
|
|
ossl_prov_ctx_set0_libctx(*provctx,
|
2020-10-15 17:55:50 +08:00
|
|
|
(OSSL_LIB_CTX *)c_get_libctx(handle));
|
2020-09-28 10:47:04 +08:00
|
|
|
ossl_prov_ctx_set0_handle(*provctx, handle);
|
|
|
|
ossl_prov_ctx_set0_core_bio_method(*provctx, corebiometh);
|
2020-05-12 15:02:25 +08:00
|
|
|
|
|
|
|
*out = deflt_dispatch_table;
|
2021-01-26 23:23:19 +08:00
|
|
|
ossl_prov_cache_exported_algorithms(deflt_ciphers, exported_ciphers);
|
2020-05-12 15:02:25 +08:00
|
|
|
|
2019-03-13 20:02:55 +08:00
|
|
|
return 1;
|
|
|
|
}
|