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