[openssl] master update
Richard Levitte
levitte at openssl.org
Sun Apr 18 08:11:58 UTC 2021
The branch master has been updated
via 05aed12f54de44df586d8912172b4ec05a8af855 (commit)
via a0fff549e6635000a545ac7d1e7a8102c1e614f1 (commit)
via 01ba6c8e438ea2d31c92fe2f386e6ce5809f29f0 (commit)
via ad57a13bb86949a9e9adc7a2960e3f39e3e5b284 (commit)
via 42423ac9611e0cbb02c93b3c5661328f324f9d08 (commit)
via 6ee1ae32933e299a6a0a5a0e8b4a1c1a64da3492 (commit)
via ebb3c82b9c7afc89986d56f794ec9d3ca3b6793f (commit)
via e2f5df36138a8888bcc1f989c6739b23bf7e23fe (commit)
from f6c95e46c03025b2694241e1ad785d8bd3ac083b (commit)
- Log -----------------------------------------------------------------
commit 05aed12f54de44df586d8912172b4ec05a8af855
Author: Richard Levitte <levitte at openssl.org>
Date: Tue Mar 16 05:40:50 2021 +0100
CORE: pre-populate the namemap with legacy OIDs too
This also pre-populates the namemap with names derived from the
internal EVP_PKEY_ASN1_METHODs. This requires attention, as they
contain aliases that we may want (RSA == rsaEncryption), as well as
aliases that we absolutely do not want (SM2 == EC).
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14498)
commit a0fff549e6635000a545ac7d1e7a8102c1e614f1
Author: Richard Levitte <levitte at openssl.org>
Date: Thu Mar 11 16:04:16 2021 +0100
TEST: Use OSSL_MAX_NAME_SIZE instead of arbitrary number of mdname
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14498)
commit 01ba6c8e438ea2d31c92fe2f386e6ce5809f29f0
Author: Richard Levitte <levitte at openssl.org>
Date: Thu Mar 11 13:36:06 2021 +0100
CORE: Register all legacy "names" when generating the initial namemap
When generating the initial namemap from EVP cipher and digest names,
we din't do it quite as thoroughly as necessary, which meant that so
called "long names" weren't necessarily registered, and if anyone ever
tried to check the algorithm of an EVP_CIPHER or EVP_MD using a so
called "long name" would fail.
This doesn't deal with the fact that "long names" have a distinct role
as human readable descriptors, useful for printouts. Further changes
are necessary to deal with this.
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14498)
commit ad57a13bb86949a9e9adc7a2960e3f39e3e5b284
Author: Richard Levitte <levitte at openssl.org>
Date: Wed Mar 10 12:58:53 2021 +0100
Modify OBJ_nid2sn(OBJ_obj2nid(...)) occurences to use OBJ_obj2txt()
The intention is to allow for OIDs for which libcrypto has no
information, but are still fetchable for OSSL_ALGORITHM
implementations that specify an OID amongst their names.
Fixes #14278
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14498)
commit 42423ac9611e0cbb02c93b3c5661328f324f9d08
Author: Richard Levitte <levitte at openssl.org>
Date: Wed Mar 10 12:53:51 2021 +0100
TEST: Modify how the retrieved digest name for SM2 digestsign is checked
Because of aliases, retrieved names won't always match one specific
string. A safer way to check is to fetch the digest from the
retrieved name and check it's the expected one with the help of
EVP_MD_is_a().
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14498)
commit 6ee1ae32933e299a6a0a5a0e8b4a1c1a64da3492
Author: Richard Levitte <levitte at openssl.org>
Date: Wed Mar 10 11:32:45 2021 +0100
TEST: Modify testutil's run_tests to display NOSUBTEST cases individually
When test cases were added with ADD_ALL_TESTS_NOSUBTEST(), all those
iteration verdicts were summarized as if it was one single case. This
modification gets each iteration verdict displayed separately instead.
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14498)
commit ebb3c82b9c7afc89986d56f794ec9d3ca3b6793f
Author: Richard Levitte <levitte at openssl.org>
Date: Wed Mar 10 11:31:49 2021 +0100
TEST: Modify test/evp_fetch_prov_test.c to also fetch by OID
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14498)
commit e2f5df36138a8888bcc1f989c6739b23bf7e23fe
Author: Richard Levitte <levitte at openssl.org>
Date: Wed Mar 10 11:22:55 2021 +0100
PROV: Add OIDs we know to all provider applicable algorithms
The OIDs were extracted with the help of libcrypto's ASN1 OID database.
While doing this, we move all the names strings to macro definitions,
to avoid duplication and conflicting names declarations. Those macros
are all in providers/implementations/include/prov/names.h
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14498)
-----------------------------------------------------------------------
Summary of changes:
crypto/cms/cms_dh.c | 8 +-
crypto/cms/cms_ec.c | 12 +-
crypto/cms/cms_env.c | 5 +-
crypto/cms/cms_lib.c | 5 +-
crypto/cms/cms_pwri.c | 7 +-
crypto/cms/cms_sd.c | 17 +-
crypto/core_namemap.c | 91 ++++-
crypto/crmf/crmf_lib.c | 7 +-
crypto/crmf/crmf_pbm.c | 16 +-
crypto/dh/dh_kdf.c | 9 +-
crypto/evp/ctrl_params_translate.c | 3 +-
crypto/pkcs7/pk7_doit.c | 15 +-
crypto/pkcs7/pk7_lib.c | 21 +-
crypto/ts/ts_rsp_sign.c | 11 +-
providers/defltprov.c | 453 ++++++++++-----------
providers/fips/fipsprov.c | 265 ++++++------
.../implementations/include/prov/implementations.h | 2 +-
providers/implementations/include/prov/names.h | 322 +++++++++++++++
.../implementations/keymgmt/mac_legacy_kmgmt.c | 2 +-
providers/legacyprov.c | 83 ++--
test/evp_extra_test.c | 55 ++-
test/evp_fetch_prov_test.c | 232 ++++++++---
test/testutil/driver.c | 59 +--
23 files changed, 1115 insertions(+), 585 deletions(-)
create mode 100644 providers/implementations/include/prov/names.h
diff --git a/crypto/cms/cms_dh.c b/crypto/cms/cms_dh.c
index 95ce8e8351..36714766d2 100644
--- a/crypto/cms/cms_dh.c
+++ b/crypto/cms/cms_dh.c
@@ -12,8 +12,9 @@
#include <openssl/dh.h>
#include <openssl/err.h>
#include <openssl/core_names.h>
-#include "cms_local.h"
+#include "internal/sizes.h"
#include "crypto/evp.h"
+#include "cms_local.h"
static int dh_cms_set_peerkey(EVP_PKEY_CTX *pctx,
X509_ALGOR *alg, ASN1_BIT_STRING *pubkey)
@@ -87,7 +88,7 @@ static int dh_cms_set_shared_info(EVP_PKEY_CTX *pctx, CMS_RecipientInfo *ri)
int keylen, plen;
EVP_CIPHER *kekcipher = NULL;
EVP_CIPHER_CTX *kekctx;
- const char *name;
+ char name[OSSL_MAX_NAME_SIZE];
if (!CMS_RecipientInfo_kari_get0_alg(ri, &alg, &ukm))
goto err;
@@ -117,8 +118,7 @@ static int dh_cms_set_shared_info(EVP_PKEY_CTX *pctx, CMS_RecipientInfo *ri)
if (kekctx == NULL)
goto err;
- name = OBJ_nid2sn(OBJ_obj2nid(kekalg->algorithm));
- if (name == NULL)
+ if (!OBJ_obj2txt(name, sizeof(name), kekalg->algorithm, 0))
goto err;
kekcipher = EVP_CIPHER_fetch(pctx->libctx, name, pctx->propquery);
diff --git a/crypto/cms/cms_ec.c b/crypto/cms/cms_ec.c
index 096eafd815..4994260af8 100644
--- a/crypto/cms/cms_ec.c
+++ b/crypto/cms/cms_ec.c
@@ -11,8 +11,9 @@
#include <openssl/cms.h>
#include <openssl/err.h>
#include <openssl/decoder.h>
-#include "cms_local.h"
+#include "internal/sizes.h"
#include "crypto/evp.h"
+#include "cms_local.h"
static EVP_PKEY *pkey_type2param(int ptype, const void *pval,
OSSL_LIB_CTX *libctx, const char *propq)
@@ -36,14 +37,13 @@ static EVP_PKEY *pkey_type2param(int ptype, const void *pval,
OSSL_DECODER_CTX_free(ctx);
} else if (ptype == V_ASN1_OBJECT) {
const ASN1_OBJECT *poid = pval;
- const char *groupname;
+ char groupname[OSSL_MAX_NAME_SIZE];
/* type == V_ASN1_OBJECT => the parameters are given by an asn1 OID */
pctx = EVP_PKEY_CTX_new_from_name(libctx, "EC", propq);
if (pctx == NULL || EVP_PKEY_paramgen_init(pctx) <= 0)
goto err;
- groupname = OBJ_nid2sn(OBJ_obj2nid(poid));
- if (groupname == NULL
+ if (!OBJ_obj2txt(groupname, sizeof(groupname), poid, 0)
|| !EVP_PKEY_CTX_set_group_name(pctx, groupname)) {
ERR_raise(ERR_LIB_CMS, CMS_R_DECODE_ERROR);
goto err;
@@ -159,7 +159,7 @@ static int ecdh_cms_set_shared_info(EVP_PKEY_CTX *pctx, CMS_RecipientInfo *ri)
int plen, keylen;
EVP_CIPHER *kekcipher = NULL;
EVP_CIPHER_CTX *kekctx;
- const char *name;
+ char name[OSSL_MAX_NAME_SIZE];
if (!CMS_RecipientInfo_kari_get0_alg(ri, &alg, &ukm))
return 0;
@@ -180,7 +180,7 @@ static int ecdh_cms_set_shared_info(EVP_PKEY_CTX *pctx, CMS_RecipientInfo *ri)
kekctx = CMS_RecipientInfo_kari_get0_ctx(ri);
if (kekctx == NULL)
goto err;
- name = OBJ_nid2sn(OBJ_obj2nid(kekalg->algorithm));
+ OBJ_obj2txt(name, sizeof(name), kekalg->algorithm, 0);
kekcipher = EVP_CIPHER_fetch(pctx->libctx, name, pctx->propquery);
if (kekcipher == NULL || EVP_CIPHER_mode(kekcipher) != EVP_CIPH_WRAP_MODE)
goto err;
diff --git a/crypto/cms/cms_env.c b/crypto/cms/cms_env.c
index 79efd67ba3..29bbd0c36d 100644
--- a/crypto/cms/cms_env.c
+++ b/crypto/cms/cms_env.c
@@ -14,6 +14,7 @@
#include <openssl/err.h>
#include <openssl/cms.h>
#include <openssl/evp.h>
+#include "internal/sizes.h"
#include "crypto/asn1.h"
#include "crypto/evp.h"
#include "crypto/x509.h"
@@ -538,7 +539,9 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms,
if (cms->d.envelopedData->encryptedContentInfo->havenocert
&& !cms->d.envelopedData->encryptedContentInfo->debug) {
X509_ALGOR *calg = ec->contentEncryptionAlgorithm;
- const char *name = OBJ_nid2sn(OBJ_obj2nid(calg->algorithm));
+ char name[OSSL_MAX_NAME_SIZE];
+
+ OBJ_obj2txt(name, sizeof(name), calg->algorithm, 0);
(void)ERR_set_mark();
fetched_cipher = EVP_CIPHER_fetch(libctx, name, propq);
diff --git a/crypto/cms/cms_lib.c b/crypto/cms/cms_lib.c
index 33127cc88c..cfde2215bd 100644
--- a/crypto/cms/cms_lib.c
+++ b/crypto/cms/cms_lib.c
@@ -15,6 +15,7 @@
#include <openssl/asn1.h>
#include <openssl/cms.h>
#include <openssl/cms.h>
+#include "internal/sizes.h"
#include "crypto/x509.h"
#include "cms_local.h"
@@ -403,10 +404,10 @@ BIO *ossl_cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm,
const ASN1_OBJECT *digestoid;
const EVP_MD *digest = NULL;
EVP_MD *fetched_digest = NULL;
- const char *alg;
+ char alg[OSSL_MAX_NAME_SIZE];
X509_ALGOR_get0(&digestoid, NULL, NULL, digestAlgorithm);
- alg = OBJ_nid2sn(OBJ_obj2nid(digestoid));
+ OBJ_obj2txt(alg, sizeof(alg), digestoid, 0);
(void)ERR_set_mark();
fetched_digest = EVP_MD_fetch(ossl_cms_ctx_get0_libctx(ctx), alg,
diff --git a/crypto/cms/cms_pwri.c b/crypto/cms/cms_pwri.c
index cea1e404c0..a278280563 100644
--- a/crypto/cms/cms_pwri.c
+++ b/crypto/cms/cms_pwri.c
@@ -15,8 +15,9 @@
#include <openssl/cms.h>
#include <openssl/rand.h>
#include <openssl/aes.h>
-#include "cms_local.h"
+#include "internal/sizes.h"
#include "crypto/asn1.h"
+#include "cms_local.h"
int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri,
unsigned char *pass, ossl_ssize_t passlen)
@@ -286,7 +287,7 @@ int ossl_cms_RecipientInfo_pwri_crypt(const CMS_ContentInfo *cms,
int r = 0;
X509_ALGOR *algtmp, *kekalg = NULL;
EVP_CIPHER_CTX *kekctx = NULL;
- const char *name;
+ char name[OSSL_MAX_NAME_SIZE];
EVP_CIPHER *kekcipher;
unsigned char *key = NULL;
size_t keylen;
@@ -315,7 +316,7 @@ int ossl_cms_RecipientInfo_pwri_crypt(const CMS_ContentInfo *cms,
return 0;
}
- name = OBJ_nid2sn(OBJ_obj2nid(kekalg->algorithm));
+ OBJ_obj2txt(name, sizeof(name), kekalg->algorithm, 0);
kekcipher = EVP_CIPHER_fetch(ossl_cms_ctx_get0_libctx(cms_ctx), name,
ossl_cms_ctx_get0_propq(cms_ctx));
diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c
index 2b232aa700..898916d548 100644
--- a/crypto/cms/cms_sd.c
+++ b/crypto/cms/cms_sd.c
@@ -15,12 +15,13 @@
#include <openssl/err.h>
#include <openssl/cms.h>
#include <openssl/ess.h>
-#include "cms_local.h"
+#include "internal/sizes.h"
#include "crypto/asn1.h"
#include "crypto/evp.h"
#include "crypto/cms.h"
#include "crypto/ess.h"
#include "crypto/x509.h" /* for ossl_x509_add_cert_new() */
+#include "cms_local.h"
/* CMS SignedData Utilities */
@@ -328,9 +329,12 @@ CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
/* See if digest is present in digestAlgorithms */
for (i = 0; i < sk_X509_ALGOR_num(sd->digestAlgorithms); i++) {
const ASN1_OBJECT *aoid;
+ char name[OSSL_MAX_NAME_SIZE];
+
alg = sk_X509_ALGOR_value(sd->digestAlgorithms, i);
X509_ALGOR_get0(&aoid, NULL, NULL, alg);
- if (OBJ_obj2nid(aoid) == EVP_MD_type(md))
+ OBJ_obj2txt(name, sizeof(name), aoid, 0);
+ if (EVP_MD_is_a(md, name))
break;
}
@@ -724,9 +728,10 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si)
int alen;
size_t siglen;
const CMS_CTX *ctx = si->cms_ctx;
- const char *md_name = OBJ_nid2sn(OBJ_obj2nid(si->digestAlgorithm->algorithm));
+ char md_name[OSSL_MAX_NAME_SIZE];
- if (md_name == NULL)
+ if (!OBJ_obj2txt(md_name, sizeof(md_name),
+ si->digestAlgorithm->algorithm, 0))
return 0;
if (CMS_signed_get_attr_by_NID(si, NID_pkcs9_signingTime, -1) < 0) {
@@ -781,7 +786,7 @@ int CMS_SignerInfo_verify(CMS_SignerInfo *si)
EVP_MD_CTX *mctx = NULL;
unsigned char *abuf = NULL;
int alen, r = -1;
- const char *name;
+ char name[OSSL_MAX_NAME_SIZE];
const EVP_MD *md;
EVP_MD *fetched_md = NULL;
const CMS_CTX *ctx = si->cms_ctx;
@@ -796,7 +801,7 @@ int CMS_SignerInfo_verify(CMS_SignerInfo *si)
if (!ossl_cms_si_check_attributes(si))
return -1;
- name = OBJ_nid2sn(OBJ_obj2nid(si->digestAlgorithm->algorithm));
+ OBJ_obj2txt(name, sizeof(name), si->digestAlgorithm->algorithm, 0);
(void)ERR_set_mark();
fetched_md = EVP_MD_fetch(libctx, name, propq);
diff --git a/crypto/core_namemap.c b/crypto/core_namemap.c
index ae9aa19c3f..daf22c3af2 100644
--- a/crypto/core_namemap.c
+++ b/crypto/core_namemap.c
@@ -12,6 +12,7 @@
#include <openssl/lhash.h>
#include "crypto/lhash.h" /* ossl_lh_strcasehash */
#include "internal/tsan_assist.h"
+#include "internal/sizes.h"
/*-
* The namenum entry
@@ -378,45 +379,91 @@ int ossl_namemap_add_names(OSSL_NAMEMAP *namemap, int number,
#include <openssl/evp.h>
/* Creates an initial namemap with names found in the legacy method db */
-static void get_legacy_evp_names(const char *main_name, const char *alias,
- void *arg)
+static void get_legacy_evp_names(const char *name, const char *desc,
+ const ASN1_OBJECT *obj, void *arg)
{
- int main_id = ossl_namemap_add_name(arg, 0, main_name);
+ int num = ossl_namemap_add_name(arg, 0, name);
/*
- * We could check that the returned value is the same as main_id,
- * but since this is a void function, there's no sane way to report
- * the error. The best we can do is trust ourselve to keep the legacy
- * method database conflict free.
+ * We currently treat the description ("long name" in OBJ speak) as an
+ * alias.
+ */
+
+ /*
+ * We could check that the returned value is the same as id, but since
+ * this is a void function, there's no sane way to report the error.
+ * The best we can do is trust ourselve to keep the legacy method
+ * database conflict free.
*
* This registers any alias with the same number as the main name.
* Should it be that the current |on| *has* the main name, this is
* simply a no-op.
*/
- if (alias != NULL) {
- (void)ossl_namemap_add_name(arg, main_id, alias);
+ if (desc != NULL) {
+ (void)ossl_namemap_add_name(arg, num, desc);
+ }
+
+ if (obj != NULL) {
+ char txtoid[OSSL_MAX_NAME_SIZE];
+
+ if (OBJ_obj2txt(txtoid, sizeof(txtoid), obj, 1))
+ (void)ossl_namemap_add_name(arg, num, txtoid);
}
}
static void get_legacy_cipher_names(const OBJ_NAME *on, void *arg)
{
const EVP_CIPHER *cipher = (void *)OBJ_NAME_get(on->name, on->type);
+ int nid = EVP_CIPHER_type(cipher);
- get_legacy_evp_names(EVP_CIPHER_name(cipher), on->name, arg);
+ get_legacy_evp_names(OBJ_nid2sn(nid), OBJ_nid2ln(nid), OBJ_nid2obj(nid),
+ arg);
}
static void get_legacy_md_names(const OBJ_NAME *on, void *arg)
{
const EVP_MD *md = (void *)OBJ_NAME_get(on->name, on->type);
- /* We don't want the pkey_type names, so we need some extra care */
- int snid, lnid;
-
- snid = OBJ_sn2nid(on->name);
- lnid = OBJ_ln2nid(on->name);
- if (snid != EVP_MD_pkey_type(md) && lnid != EVP_MD_pkey_type(md))
- get_legacy_evp_names(EVP_MD_name(md), on->name, arg);
- else
- get_legacy_evp_names(EVP_MD_name(md), NULL, arg);
+ int nid = EVP_MD_type(md);
+
+ get_legacy_evp_names(OBJ_nid2sn(nid), OBJ_nid2ln(nid), OBJ_nid2obj(nid),
+ arg);
+}
+
+static void get_legacy_pkey_meth_names(const EVP_PKEY_ASN1_METHOD *ameth,
+ void *arg)
+{
+ int nid = 0, base_nid = 0, flags = 0;
+
+ EVP_PKEY_asn1_get0_info(&nid, &base_nid, &flags, NULL, NULL, ameth);
+ if (nid != NID_undef) {
+ if ((flags & ASN1_PKEY_ALIAS) == 0) {
+ get_legacy_evp_names(OBJ_nid2sn(nid), OBJ_nid2ln(nid),
+ OBJ_nid2obj(nid), arg);
+ } else {
+ /*
+ * Treat aliases carefully, some of them are undesirable, or
+ * should not be treated as such for providers.
+ */
+
+ switch (nid) {
+ case EVP_PKEY_SM2:
+ case EVP_PKEY_DHX:
+ /*
+ * SM2 is a separate keytype with providers, not an alias for
+ * EC.
+ * DHX is a separate keytype with providers, not an alias for
+ * DH.
+ */
+ get_legacy_evp_names(OBJ_nid2sn(nid), OBJ_nid2ln(nid),
+ OBJ_nid2obj(nid), arg);
+ break;
+ default:
+ /* Use the short name of the base nid as the common reference */
+ get_legacy_evp_names(OBJ_nid2sn(base_nid), OBJ_nid2ln(nid),
+ OBJ_nid2obj(nid), arg);
+ }
+ }
+ }
}
#endif
@@ -447,6 +494,8 @@ OSSL_NAMEMAP *ossl_namemap_stored(OSSL_LIB_CTX *libctx)
return NULL;
}
if (nms == 1) {
+ int i, end;
+
/* Before pilfering, we make sure the legacy database is populated */
OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS
| OPENSSL_INIT_ADD_ALL_DIGESTS, NULL);
@@ -455,6 +504,10 @@ OSSL_NAMEMAP *ossl_namemap_stored(OSSL_LIB_CTX *libctx)
get_legacy_cipher_names, namemap);
OBJ_NAME_do_all(OBJ_NAME_TYPE_MD_METH,
get_legacy_md_names, namemap);
+
+ /* We also pilfer data from the legacy EVP_PKEY_ASN1_METHODs */
+ for (i = 0, end = EVP_PKEY_asn1_get_count(); i < end; i++)
+ get_legacy_pkey_meth_names(EVP_PKEY_asn1_get0(i), namemap);
}
#endif
diff --git a/crypto/crmf/crmf_lib.c b/crypto/crmf/crmf_lib.c
index cb443ff850..4a4c30c386 100644
--- a/crypto/crmf/crmf_lib.c
+++ b/crypto/crmf/crmf_lib.c
@@ -594,7 +594,6 @@ X509
unsigned char *iv = NULL; /* initial vector for symmetric encryption */
unsigned char *outbuf = NULL; /* decryption output buffer */
const unsigned char *p = NULL; /* needed for decoding ASN1 */
- int symmAlg = 0; /* NIDs for symmetric algorithm */
int n, outlen = 0;
EVP_PKEY_CTX *pkctx = NULL; /* private key context */
@@ -603,12 +602,8 @@ X509
ERR_raise(ERR_LIB_CRMF, CRMF_R_NULL_ARGUMENT);
return NULL;
}
- if ((symmAlg = OBJ_obj2nid(ecert->symmAlg->algorithm)) == 0) {
- ERR_raise(ERR_LIB_CRMF, CRMF_R_UNSUPPORTED_CIPHER);
- return NULL;
- }
/* select symmetric cipher based on algorithm given in message */
- if ((cipher = EVP_get_cipherbynid(symmAlg)) == NULL) {
+ if ((cipher = EVP_get_cipherbyobj(ecert->symmAlg->algorithm)) == NULL) {
ERR_raise(ERR_LIB_CRMF, CRMF_R_UNSUPPORTED_CIPHER);
goto end;
}
diff --git a/crypto/crmf/crmf_pbm.c b/crypto/crmf/crmf_pbm.c
index 78ab486e2d..40a41c28b2 100644
--- a/crypto/crmf/crmf_pbm.c
+++ b/crypto/crmf/crmf_pbm.c
@@ -17,8 +17,6 @@
#include <openssl/rand.h>
#include <openssl/evp.h>
-#include "crmf_local.h"
-
/* explicit #includes not strictly needed since implied by the above: */
#include <openssl/asn1t.h>
#include <openssl/crmf.h>
@@ -27,6 +25,10 @@
#include <openssl/params.h>
#include <openssl/core_names.h>
+#include "internal/sizes.h"
+
+#include "crmf_local.h"
+
/*-
* creates and initializes OSSL_CRMF_PBMPARAMETER (section 4.4)
* |slen| SHOULD be at least 8 (16 is common)
@@ -130,7 +132,8 @@ int OSSL_CRMF_pbm_new(OSSL_LIB_CTX *libctx, const char *propq,
unsigned char **out, size_t *outlen)
{
int mac_nid, hmac_md_nid = NID_undef;
- const char *mdname;
+ char mdname[OSSL_MAX_NAME_SIZE];
+ char hmac_mdname[OSSL_MAX_NAME_SIZE];
EVP_MD *owf = NULL;
EVP_MD_CTX *ctx = NULL;
unsigned char basekey[EVP_MAX_MD_SIZE];
@@ -155,7 +158,7 @@ int OSSL_CRMF_pbm_new(OSSL_LIB_CTX *libctx, const char *propq,
* compute the key used in the MAC process. All implementations MUST
* support SHA-1.
*/
- mdname = OBJ_nid2sn(OBJ_obj2nid(pbmp->owf->algorithm));
+ OBJ_obj2txt(mdname, sizeof(mdname), pbmp->owf->algorithm, 0);
if ((owf = EVP_MD_fetch(libctx, mdname, propq)) == NULL) {
ERR_raise(ERR_LIB_CRMF, CRMF_R_UNSUPPORTED_ALGORITHM);
goto err;
@@ -200,13 +203,14 @@ int OSSL_CRMF_pbm_new(OSSL_LIB_CTX *libctx, const char *propq,
mac_nid = OBJ_obj2nid(pbmp->mac->algorithm);
if (!EVP_PBE_find(EVP_PBE_TYPE_PRF, mac_nid, NULL, &hmac_md_nid, NULL)
- || (mdname = OBJ_nid2sn(hmac_md_nid)) == NULL) {
+ || !OBJ_obj2txt(hmac_mdname, sizeof(hmac_mdname),
+ OBJ_nid2obj(hmac_md_nid), 0)) {
ERR_raise(ERR_LIB_CRMF, CRMF_R_UNSUPPORTED_ALGORITHM);
goto err;
}
macparams[0] = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,
- (char *)mdname, 0);
+ (char *)hmac_mdname, 0);
if ((mac = EVP_MAC_fetch(libctx, "HMAC", propq)) == NULL
|| (mctx = EVP_MAC_CTX_new(mac)) == NULL
|| !EVP_MAC_CTX_set_params(mctx, macparams)
diff --git a/crypto/dh/dh_kdf.c b/crypto/dh/dh_kdf.c
index d18e24eccb..619571537a 100644
--- a/crypto/dh/dh_kdf.c
+++ b/crypto/dh/dh_kdf.c
@@ -66,16 +66,11 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
ASN1_OBJECT *key_oid,
const unsigned char *ukm, size_t ukmlen, const EVP_MD *md)
{
- int nid;
- const char *key_alg = NULL;
+ char key_alg[OSSL_MAX_NAME_SIZE];
const OSSL_PROVIDER *prov = EVP_MD_provider(md);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
- nid = OBJ_obj2nid(key_oid);
- if (nid == NID_undef)
- return 0;
- key_alg = OBJ_nid2sn(nid);
- if (key_alg == NULL)
+ if (!OBJ_obj2txt(key_alg, sizeof(key_alg), key_oid, 0))
return 0;
return ossl_dh_kdf_X9_42_asn1(out, outlen, Z, Zlen, key_alg,
diff --git a/crypto/evp/ctrl_params_translate.c b/crypto/evp/ctrl_params_translate.c
index 65414f6ede..8f4ffd3bc4 100644
--- a/crypto/evp/ctrl_params_translate.c
+++ b/crypto/evp/ctrl_params_translate.c
@@ -954,7 +954,8 @@ static int fix_oid(enum state state,
* default_fixup_args() will then be able to convert that to the
* corresponding OSSL_PARAM.
*/
- ctx->p2 = (char *)OBJ_nid2sn(OBJ_obj2nid(ctx->p2));
+ OBJ_obj2txt(ctx->name_buf, sizeof(ctx->name_buf), ctx->p2, 0);
+ ctx->p2 = (char *)ctx->name_buf;
ctx->p1 = 0; /* let default_fixup_args() figure out the length */
}
diff --git a/crypto/pkcs7/pk7_doit.c b/crypto/pkcs7/pk7_doit.c
index 832b4a39b3..c8e6c798b4 100644
--- a/crypto/pkcs7/pk7_doit.c
+++ b/crypto/pkcs7/pk7_doit.c
@@ -8,12 +8,13 @@
*/
#include <stdio.h>
-#include "internal/cryptlib.h"
#include <openssl/rand.h>
#include <openssl/objects.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/err.h>
+#include "internal/cryptlib.h"
+#include "internal/sizes.h"
#include "pk7_local.h"
static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype,
@@ -57,7 +58,7 @@ static int pkcs7_bio_add_digest(BIO **pbio, X509_ALGOR *alg,
const PKCS7_CTX *ctx)
{
BIO *btmp;
- const char *name;
+ char name[OSSL_MAX_NAME_SIZE];
EVP_MD *fetched = NULL;
const EVP_MD *md;
@@ -66,7 +67,7 @@ static int pkcs7_bio_add_digest(BIO **pbio, X509_ALGOR *alg,
goto err;
}
- name = OBJ_nid2sn(OBJ_obj2nid(alg->algorithm));
+ OBJ_obj2txt(name, sizeof(name), alg->algorithm, 0);
(void)ERR_set_mark();
fetched = EVP_MD_fetch(ossl_pkcs7_ctx_get0_libctx(ctx), name,
@@ -404,7 +405,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
PKCS7_RECIP_INFO *ri = NULL;
unsigned char *ek = NULL, *tkey = NULL;
int eklen = 0, tkeylen = 0;
- const char *name;
+ char name[OSSL_MAX_NAME_SIZE];
const PKCS7_CTX *p7_ctx;
OSSL_LIB_CTX *libctx;
const char *propq;
@@ -448,7 +449,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
data_body = p7->d.signed_and_enveloped->enc_data->enc_data;
enc_alg = p7->d.signed_and_enveloped->enc_data->algorithm;
- name = OBJ_nid2sn(OBJ_obj2nid(enc_alg->algorithm));
+ OBJ_obj2txt(name, sizeof(name), enc_alg->algorithm, 0);
(void)ERR_set_mark();
evp_cipher = EVP_CIPHER_fetch(libctx, name, propq);
@@ -469,7 +470,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
enc_alg = p7->d.enveloped->enc_data->algorithm;
/* data_body is NULL if the optional EncryptedContent is missing. */
data_body = p7->d.enveloped->enc_data->enc_data;
- name = OBJ_nid2sn(OBJ_obj2nid(enc_alg->algorithm));
+ OBJ_obj2txt(name, sizeof(name), enc_alg->algorithm, 0);
(void)ERR_set_mark();
evp_cipher = EVP_CIPHER_fetch(libctx, name, propq);
@@ -505,7 +506,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
goto err;
}
- name = OBJ_nid2sn(OBJ_obj2nid(xa->algorithm));
+ OBJ_obj2txt(name, sizeof(name), xa->algorithm, 0);
(void)ERR_set_mark();
evp_md = EVP_MD_fetch(libctx, name, propq);
diff --git a/crypto/pkcs7/pk7_lib.c b/crypto/pkcs7/pk7_lib.c
index 6b941c53c4..bf959a28d2 100644
--- a/crypto/pkcs7/pk7_lib.c
+++ b/crypto/pkcs7/pk7_lib.c
@@ -187,7 +187,8 @@ int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other)
int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *psi)
{
- int i, j, nid;
+ int i, j;
+ ASN1_OBJECT *obj;
X509_ALGOR *alg;
STACK_OF(PKCS7_SIGNER_INFO) *signer_sk;
STACK_OF(X509_ALGOR) *md_sk;
@@ -207,27 +208,35 @@ int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *psi)
return 0;
}
- nid = OBJ_obj2nid(psi->digest_alg->algorithm);
-
+ obj = psi->digest_alg->algorithm;
/* If the digest is not currently listed, add it */
j = 0;
for (i = 0; i < sk_X509_ALGOR_num(md_sk); i++) {
alg = sk_X509_ALGOR_value(md_sk, i);
- if (OBJ_obj2nid(alg->algorithm) == nid) {
+ if (OBJ_cmp(obj, alg->algorithm) == 0) {
j = 1;
break;
}
}
if (!j) { /* we need to add another algorithm */
+ int nid;
+
if ((alg = X509_ALGOR_new()) == NULL
|| (alg->parameter = ASN1_TYPE_new()) == NULL) {
X509_ALGOR_free(alg);
ERR_raise(ERR_LIB_PKCS7, ERR_R_MALLOC_FAILURE);
return 0;
}
- alg->algorithm = OBJ_nid2obj(nid);
+ /*
+ * If there is a constant copy of the ASN1 OBJECT in libcrypto, then
+ * use that. Otherwise, use a dynamically duplicated copy
+ */
+ if ((nid = OBJ_obj2nid(obj)) != NID_undef)
+ alg->algorithm = OBJ_nid2obj(nid);
+ else
+ alg->algorithm = OBJ_dup(obj);
alg->parameter->type = V_ASN1_NULL;
- if (!sk_X509_ALGOR_push(md_sk, alg)) {
+ if (alg->algorithm == NULL || !sk_X509_ALGOR_push(md_sk, alg)) {
X509_ALGOR_free(alg);
return 0;
}
diff --git a/crypto/ts/ts_rsp_sign.c b/crypto/ts/ts_rsp_sign.c
index e29420232f..6d00a471a2 100644
--- a/crypto/ts/ts_rsp_sign.c
+++ b/crypto/ts/ts_rsp_sign.c
@@ -8,14 +8,15 @@
*/
#include "e_os.h"
-#include "internal/cryptlib.h"
#include <openssl/objects.h>
#include <openssl/ts.h>
#include <openssl/pkcs7.h>
#include <openssl/crypto.h>
-#include "ts_local.h"
+#include "internal/cryptlib.h"
+#include "internal/sizes.h"
#include "crypto/ess.h"
+#include "ts_local.h"
DEFINE_STACK_OF_CONST(EVP_MD)
@@ -447,7 +448,7 @@ static int ts_RESP_check_request(TS_RESP_CTX *ctx)
TS_REQ *request = ctx->request;
TS_MSG_IMPRINT *msg_imprint;
X509_ALGOR *md_alg;
- int md_alg_id;
+ char md_alg_name[OSSL_MAX_NAME_SIZE];
const ASN1_OCTET_STRING *digest;
const EVP_MD *md = NULL;
int i;
@@ -461,10 +462,10 @@ static int ts_RESP_check_request(TS_RESP_CTX *ctx)
msg_imprint = request->msg_imprint;
md_alg = msg_imprint->hash_algo;
- md_alg_id = OBJ_obj2nid(md_alg->algorithm);
+ OBJ_obj2txt(md_alg_name, sizeof(md_alg_name), md_alg->algorithm, 0);
for (i = 0; !md && i < sk_EVP_MD_num(ctx->mds); ++i) {
const EVP_MD *current_md = sk_EVP_MD_value(ctx->mds, i);
- if (md_alg_id == EVP_MD_type(current_md))
+ if (EVP_MD_is_a(current_md, md_alg_name))
md = current_md;
}
if (!md) {
diff --git a/providers/defltprov.c b/providers/defltprov.c
index 0e076dd019..cb8a90f1cd 100644
--- a/providers/defltprov.c
+++ b/providers/defltprov.c
@@ -18,6 +18,7 @@
#include "prov/provider_ctx.h"
#include "prov/providercommon.h"
#include "prov/implementations.h"
+#include "prov/names.h"
#include "prov/provider_util.h"
#include "prov/seeding.h"
#include "internal/nelem.h"
@@ -99,34 +100,32 @@ static int deflt_get_params(void *provctx, OSSL_PARAM params[])
*/
static const OSSL_ALGORITHM deflt_digests[] = {
/* Our primary name:NIST name[:our older names] */
- { "SHA1:SHA-1:SSL3-SHA1", "provider=default", ossl_sha1_functions },
- { "SHA2-224:SHA-224:SHA224", "provider=default", ossl_sha224_functions },
- { "SHA2-256:SHA-256:SHA256", "provider=default", ossl_sha256_functions },
- { "SHA2-384:SHA-384:SHA384", "provider=default", ossl_sha384_functions },
- { "SHA2-512:SHA-512:SHA512", "provider=default", ossl_sha512_functions },
- { "SHA2-512/224:SHA-512/224:SHA512-224", "provider=default",
- ossl_sha512_224_functions },
- { "SHA2-512/256:SHA-512/256:SHA512-256", "provider=default",
- ossl_sha512_256_functions },
+ { 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 },
+ { 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 },
/* We agree with NIST here, so one name only */
- { "SHA3-224", "provider=default", ossl_sha3_224_functions },
- { "SHA3-256", "provider=default", ossl_sha3_256_functions },
- { "SHA3-384", "provider=default", ossl_sha3_384_functions },
- { "SHA3-512", "provider=default", ossl_sha3_512_functions },
+ { 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 },
/*
* KECCAK-KMAC-128 and KECCAK-KMAC-256 as hashes are mostly useful for
* the KMAC-128 and KMAC-256.
*/
- { "KECCAK-KMAC-128:KECCAK-KMAC128", "provider=default",
+ { PROV_NAMES_KECCAK_KMAC_128, "provider=default",
ossl_keccak_kmac_128_functions },
- { "KECCAK-KMAC-256:KECCAK-KMAC256", "provider=default",
+ { PROV_NAMES_KECCAK_KMAC_256, "provider=default",
ossl_keccak_kmac_256_functions },
/* Our primary name:NIST name */
- { "SHAKE-128:SHAKE128", "provider=default", ossl_shake_128_functions },
- { "SHAKE-256:SHAKE256", "provider=default", ossl_shake_256_functions },
+ { PROV_NAMES_SHAKE_128, "provider=default", ossl_shake_128_functions },
+ { PROV_NAMES_SHAKE_256, "provider=default", ossl_shake_256_functions },
#ifndef OPENSSL_NO_BLAKE2
/*
@@ -136,168 +135,162 @@ static const OSSL_ALGORITHM deflt_digests[] = {
* If we assume that "2b" and "2s" are versions, that pattern
* fits with ours. We also add our historical names.
*/
- { "BLAKE2S-256:BLAKE2s256", "provider=default", ossl_blake2s256_functions },
- { "BLAKE2B-512:BLAKE2b512", "provider=default", ossl_blake2b512_functions },
+ { PROV_NAMES_BLAKE2S_256, "provider=default", ossl_blake2s256_functions },
+ { PROV_NAMES_BLAKE2B_512, "provider=default", ossl_blake2b512_functions },
#endif /* OPENSSL_NO_BLAKE2 */
#ifndef OPENSSL_NO_SM3
- { "SM3", "provider=default", ossl_sm3_functions },
+ { PROV_NAMES_SM3, "provider=default", ossl_sm3_functions },
#endif /* OPENSSL_NO_SM3 */
#ifndef OPENSSL_NO_MD5
- { "MD5:SSL3-MD5", "provider=default", ossl_md5_functions },
- { "MD5-SHA1", "provider=default", ossl_md5_sha1_functions },
+ { PROV_NAMES_MD5, "provider=default", ossl_md5_functions },
+ { PROV_NAMES_MD5_SHA1, "provider=default", ossl_md5_sha1_functions },
#endif /* OPENSSL_NO_MD5 */
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM_CAPABLE deflt_ciphers[] = {
- ALG("NULL", ossl_null_functions),
- ALG("AES-256-ECB", ossl_aes256ecb_functions),
- ALG("AES-192-ECB", ossl_aes192ecb_functions),
- ALG("AES-128-ECB", ossl_aes128ecb_functions),
- ALG("AES-256-CBC:AES256", ossl_aes256cbc_functions),
- ALG("AES-192-CBC:AES192", ossl_aes192cbc_functions),
- ALG("AES-128-CBC:AES128", ossl_aes128cbc_functions),
- ALG("AES-128-CBC-CTS", ossl_aes128cbc_cts_functions),
- ALG("AES-192-CBC-CTS", ossl_aes192cbc_cts_functions),
- ALG("AES-256-CBC-CTS", ossl_aes256cbc_cts_functions),
- ALG("AES-256-OFB", ossl_aes256ofb_functions),
- ALG("AES-192-OFB", ossl_aes192ofb_functions),
- ALG("AES-128-OFB", ossl_aes128ofb_functions),
- ALG("AES-256-CFB", ossl_aes256cfb_functions),
- ALG("AES-192-CFB", ossl_aes192cfb_functions),
- ALG("AES-128-CFB", ossl_aes128cfb_functions),
- ALG("AES-256-CFB1", ossl_aes256cfb1_functions),
- ALG("AES-192-CFB1", ossl_aes192cfb1_functions),
- ALG("AES-128-CFB1", ossl_aes128cfb1_functions),
- ALG("AES-256-CFB8", ossl_aes256cfb8_functions),
- ALG("AES-192-CFB8", ossl_aes192cfb8_functions),
- ALG("AES-128-CFB8", ossl_aes128cfb8_functions),
- ALG("AES-256-CTR", ossl_aes256ctr_functions),
- ALG("AES-192-CTR", ossl_aes192ctr_functions),
- ALG("AES-128-CTR", ossl_aes128ctr_functions),
- ALG("AES-256-XTS", ossl_aes256xts_functions),
- ALG("AES-128-XTS", ossl_aes128xts_functions),
+ 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),
#ifndef OPENSSL_NO_OCB
- ALG("AES-256-OCB", ossl_aes256ocb_functions),
- ALG("AES-192-OCB", ossl_aes192ocb_functions),
- ALG("AES-128-OCB", ossl_aes128ocb_functions),
+ 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),
#endif /* OPENSSL_NO_OCB */
#ifndef OPENSSL_NO_SIV
- ALG("AES-128-SIV", ossl_aes128siv_functions),
- ALG("AES-192-SIV", ossl_aes192siv_functions),
- ALG("AES-256-SIV", ossl_aes256siv_functions),
+ 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),
#endif /* OPENSSL_NO_SIV */
- ALG("AES-256-GCM:id-aes256-GCM", ossl_aes256gcm_functions),
- ALG("AES-192-GCM:id-aes192-GCM", ossl_aes192gcm_functions),
- ALG("AES-128-GCM:id-aes128-GCM", ossl_aes128gcm_functions),
- ALG("AES-256-CCM:id-aes256-CCM", ossl_aes256ccm_functions),
- ALG("AES-192-CCM:id-aes192-CCM", ossl_aes192ccm_functions),
- ALG("AES-128-CCM:id-aes128-CCM", ossl_aes128ccm_functions),
- ALG("AES-256-WRAP:id-aes256-wrap:AES256-WRAP", ossl_aes256wrap_functions),
- ALG("AES-192-WRAP:id-aes192-wrap:AES192-WRAP", ossl_aes192wrap_functions),
- ALG("AES-128-WRAP:id-aes128-wrap:AES128-WRAP", ossl_aes128wrap_functions),
- ALG("AES-256-WRAP-PAD:id-aes256-wrap-pad:AES256-WRAP-PAD",
- ossl_aes256wrappad_functions),
- ALG("AES-192-WRAP-PAD:id-aes192-wrap-pad:AES192-WRAP-PAD",
- ossl_aes192wrappad_functions),
- ALG("AES-128-WRAP-PAD:id-aes128-wrap-pad:AES128-WRAP-PAD",
- ossl_aes128wrappad_functions),
- ALG("AES-256-WRAP-INV:AES256-WRAP-INV", ossl_aes256wrapinv_functions),
- ALG("AES-192-WRAP-INV:AES192-WRAP-INV", ossl_aes192wrapinv_functions),
- ALG("AES-128-WRAP-INV:AES128-WRAP-INV", ossl_aes128wrapinv_functions),
- ALG("AES-256-WRAP-PAD-INV:AES256-WRAP-PAD-INV",
- ossl_aes256wrappadinv_functions),
- ALG("AES-192-WRAP-PAD-INV:AES192-WRAP-PAD-INV",
- ossl_aes192wrappadinv_functions),
- ALG("AES-128-WRAP-PAD-INV:AES128-WRAP-PAD-INV",
- ossl_aes128wrappadinv_functions),
- ALGC("AES-128-CBC-HMAC-SHA1", ossl_aes128cbc_hmac_sha1_functions,
+ 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,
ossl_cipher_capable_aes_cbc_hmac_sha1),
- ALGC("AES-256-CBC-HMAC-SHA1", ossl_aes256cbc_hmac_sha1_functions,
+ ALGC(PROV_NAMES_AES_256_CBC_HMAC_SHA1, ossl_aes256cbc_hmac_sha1_functions,
ossl_cipher_capable_aes_cbc_hmac_sha1),
- ALGC("AES-128-CBC-HMAC-SHA256", ossl_aes128cbc_hmac_sha256_functions,
+ ALGC(PROV_NAMES_AES_128_CBC_HMAC_SHA256, ossl_aes128cbc_hmac_sha256_functions,
ossl_cipher_capable_aes_cbc_hmac_sha256),
- ALGC("AES-256-CBC-HMAC-SHA256", ossl_aes256cbc_hmac_sha256_functions,
+ ALGC(PROV_NAMES_AES_256_CBC_HMAC_SHA256, ossl_aes256cbc_hmac_sha256_functions,
ossl_cipher_capable_aes_cbc_hmac_sha256),
#ifndef OPENSSL_NO_ARIA
- ALG("ARIA-256-GCM", ossl_aria256gcm_functions),
- ALG("ARIA-192-GCM", ossl_aria192gcm_functions),
- ALG("ARIA-128-GCM", ossl_aria128gcm_functions),
- ALG("ARIA-256-CCM", ossl_aria256ccm_functions),
- ALG("ARIA-192-CCM", ossl_aria192ccm_functions),
- ALG("ARIA-128-CCM", ossl_aria128ccm_functions),
- ALG("ARIA-256-ECB", ossl_aria256ecb_functions),
- ALG("ARIA-192-ECB", ossl_aria192ecb_functions),
- ALG("ARIA-128-ECB", ossl_aria128ecb_functions),
- ALG("ARIA-256-CBC:ARIA256", ossl_aria256cbc_functions),
- ALG("ARIA-192-CBC:ARIA192", ossl_aria192cbc_functions),
- ALG("ARIA-128-CBC:ARIA128", ossl_aria128cbc_functions),
- ALG("ARIA-256-OFB", ossl_aria256ofb_functions),
- ALG("ARIA-192-OFB", ossl_aria192ofb_functions),
- ALG("ARIA-128-OFB", ossl_aria128ofb_functions),
- ALG("ARIA-256-CFB", ossl_aria256cfb_functions),
- ALG("ARIA-192-CFB", ossl_aria192cfb_functions),
- ALG("ARIA-128-CFB", ossl_aria128cfb_functions),
- ALG("ARIA-256-CFB1", ossl_aria256cfb1_functions),
- ALG("ARIA-192-CFB1", ossl_aria192cfb1_functions),
- ALG("ARIA-128-CFB1", ossl_aria128cfb1_functions),
- ALG("ARIA-256-CFB8", ossl_aria256cfb8_functions),
- ALG("ARIA-192-CFB8", ossl_aria192cfb8_functions),
- ALG("ARIA-128-CFB8", ossl_aria128cfb8_functions),
- ALG("ARIA-256-CTR", ossl_aria256ctr_functions),
- ALG("ARIA-192-CTR", ossl_aria192ctr_functions),
- ALG("ARIA-128-CTR", ossl_aria128ctr_functions),
+ 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),
#endif /* OPENSSL_NO_ARIA */
#ifndef OPENSSL_NO_CAMELLIA
- ALG("CAMELLIA-256-ECB", ossl_camellia256ecb_functions),
- ALG("CAMELLIA-192-ECB", ossl_camellia192ecb_functions),
- ALG("CAMELLIA-128-ECB", ossl_camellia128ecb_functions),
- ALG("CAMELLIA-256-CBC:CAMELLIA256", ossl_camellia256cbc_functions),
- ALG("CAMELLIA-192-CBC:CAMELLIA192", ossl_camellia192cbc_functions),
- ALG("CAMELLIA-128-CBC:CAMELLIA128", ossl_camellia128cbc_functions),
- ALG("CAMELLIA-256-OFB", ossl_camellia256ofb_functions),
- ALG("CAMELLIA-192-OFB", ossl_camellia192ofb_functions),
- ALG("CAMELLIA-128-OFB", ossl_camellia128ofb_functions),
- ALG("CAMELLIA-256-CFB", ossl_camellia256cfb_functions),
- ALG("CAMELLIA-192-CFB", ossl_camellia192cfb_functions),
- ALG("CAMELLIA-128-CFB", ossl_camellia128cfb_functions),
- ALG("CAMELLIA-256-CFB1", ossl_camellia256cfb1_functions),
- ALG("CAMELLIA-192-CFB1", ossl_camellia192cfb1_functions),
- ALG("CAMELLIA-128-CFB1", ossl_camellia128cfb1_functions),
- ALG("CAMELLIA-256-CFB8", ossl_camellia256cfb8_functions),
- ALG("CAMELLIA-192-CFB8", ossl_camellia192cfb8_functions),
- ALG("CAMELLIA-128-CFB8", ossl_camellia128cfb8_functions),
- ALG("CAMELLIA-256-CTR", ossl_camellia256ctr_functions),
- ALG("CAMELLIA-192-CTR", ossl_camellia192ctr_functions),
- ALG("CAMELLIA-128-CTR", ossl_camellia128ctr_functions),
+ 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),
+ 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),
#endif /* OPENSSL_NO_CAMELLIA */
#ifndef OPENSSL_NO_DES
- ALG("DES-EDE3-ECB:DES-EDE3", ossl_tdes_ede3_ecb_functions),
- ALG("DES-EDE3-CBC:DES3", ossl_tdes_ede3_cbc_functions),
- ALG("DES-EDE3-OFB", ossl_tdes_ede3_ofb_functions),
- ALG("DES-EDE3-CFB", ossl_tdes_ede3_cfb_functions),
- ALG("DES-EDE3-CFB8", ossl_tdes_ede3_cfb8_functions),
- ALG("DES-EDE3-CFB1", ossl_tdes_ede3_cfb1_functions),
- ALG("DES3-WRAP:id-smime-alg-CMS3DESwrap", ossl_tdes_wrap_cbc_functions),
- ALG("DES-EDE-ECB:DES-EDE", ossl_tdes_ede2_ecb_functions),
- ALG("DES-EDE-CBC", ossl_tdes_ede2_cbc_functions),
- ALG("DES-EDE-OFB", ossl_tdes_ede2_ofb_functions),
- ALG("DES-EDE-CFB", ossl_tdes_ede2_cfb_functions),
+ 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),
#endif /* OPENSSL_NO_DES */
#ifndef OPENSSL_NO_SM4
- ALG("SM4-ECB", ossl_sm4128ecb_functions),
- ALG("SM4-CBC:SM4", ossl_sm4128cbc_functions),
- ALG("SM4-CTR", ossl_sm4128ctr_functions),
- ALG("SM4-OFB:SM4-OFB128", ossl_sm4128ofb128_functions),
- ALG("SM4-CFB:SM4-CFB128", ossl_sm4128cfb128_functions),
+ 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),
#endif /* OPENSSL_NO_SM4 */
#ifndef OPENSSL_NO_CHACHA
- ALG("ChaCha20", ossl_chacha20_functions),
+ ALG(PROV_NAMES_ChaCha20, ossl_chacha20_functions),
# ifndef OPENSSL_NO_POLY1305
- ALG("ChaCha20-Poly1305", ossl_chacha20_ossl_poly1305_functions),
+ ALG(PROV_NAMES_ChaCha20_Poly1305, ossl_chacha20_ossl_poly1305_functions),
# endif /* OPENSSL_NO_POLY1305 */
#endif /* OPENSSL_NO_CHACHA */
{ { NULL, NULL, NULL }, NULL }
@@ -306,154 +299,154 @@ static OSSL_ALGORITHM exported_ciphers[OSSL_NELEM(deflt_ciphers)];
static const OSSL_ALGORITHM deflt_macs[] = {
#ifndef OPENSSL_NO_BLAKE2
- { "BLAKE2BMAC", "provider=default", ossl_blake2bmac_functions },
- { "BLAKE2SMAC", "provider=default", ossl_blake2smac_functions },
+ { PROV_NAMES_BLAKE2BMAC, "provider=default", ossl_blake2bmac_functions },
+ { PROV_NAMES_BLAKE2SMAC, "provider=default", ossl_blake2smac_functions },
#endif
#ifndef OPENSSL_NO_CMAC
- { "CMAC", "provider=default", ossl_cmac_functions },
+ { PROV_NAMES_CMAC, "provider=default", ossl_cmac_functions },
#endif
- { "GMAC", "provider=default", ossl_gmac_functions },
- { "HMAC", "provider=default", ossl_hmac_functions },
- { "KMAC-128:KMAC128", "provider=default", ossl_kmac128_functions },
- { "KMAC-256:KMAC256", "provider=default", ossl_kmac256_functions },
+ { 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 },
#ifndef OPENSSL_NO_SIPHASH
- { "SIPHASH", "provider=default", ossl_siphash_functions },
+ { PROV_NAMES_SIPHASH, "provider=default", ossl_siphash_functions },
#endif
#ifndef OPENSSL_NO_POLY1305
- { "POLY1305", "provider=default", ossl_poly1305_functions },
+ { PROV_NAMES_POLY1305, "provider=default", ossl_poly1305_functions },
#endif
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM deflt_kdfs[] = {
- { "HKDF", "provider=default", ossl_kdf_hkdf_functions },
- { "SSKDF", "provider=default", ossl_kdf_sskdf_functions },
- { "PBKDF2", "provider=default", ossl_kdf_pbkdf2_functions },
- { "PKCS12KDF", "provider=default", ossl_kdf_pkcs12_functions },
- { "SSHKDF", "provider=default", ossl_kdf_sshkdf_functions },
- { "X963KDF:X942KDF-CONCAT", "provider=default", ossl_kdf_x963_kdf_functions },
- { "TLS1-PRF", "provider=default", ossl_kdf_tls1_prf_functions },
- { "KBKDF", "provider=default", ossl_kdf_kbkdf_functions },
- { "X942KDF-ASN1:X942KDF", "provider=default", ossl_kdf_x942_kdf_functions },
+ { PROV_NAMES_HKDF, "provider=default", ossl_kdf_hkdf_functions },
+ { 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 },
#ifndef OPENSSL_NO_SCRYPT
- { "SCRYPT:id-scrypt", "provider=default", ossl_kdf_scrypt_functions },
+ { PROV_NAMES_SCRYPT, "provider=default", ossl_kdf_scrypt_functions },
#endif
- { "KRB5KDF", "provider=default", ossl_kdf_krb5kdf_functions },
+ { PROV_NAMES_KRB5KDF, "provider=default", ossl_kdf_krb5kdf_functions },
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM deflt_keyexch[] = {
#ifndef OPENSSL_NO_DH
- { "DH:dhKeyAgreement", "provider=default", ossl_dh_keyexch_functions },
+ { PROV_NAMES_DH, "provider=default", ossl_dh_keyexch_functions },
#endif
#ifndef OPENSSL_NO_EC
- { "ECDH", "provider=default", ossl_ecdh_keyexch_functions },
- { "X25519", "provider=default", ossl_x25519_keyexch_functions },
- { "X448", "provider=default", ossl_x448_keyexch_functions },
+ { PROV_NAMES_ECDH, "provider=default", ossl_ecdh_keyexch_functions },
+ { PROV_NAMES_X25519, "provider=default", ossl_x25519_keyexch_functions },
+ { PROV_NAMES_X448, "provider=default", ossl_x448_keyexch_functions },
#endif
- { "TLS1-PRF", "provider=default", ossl_kdf_tls1_prf_keyexch_functions },
- { "HKDF", "provider=default", ossl_kdf_hkdf_keyexch_functions },
- { "SCRYPT:id-scrypt", "provider=default",
+ { 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",
ossl_kdf_scrypt_keyexch_functions },
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM deflt_rands[] = {
- { "CTR-DRBG", "provider=default", ossl_drbg_ctr_functions },
- { "HASH-DRBG", "provider=default", ossl_drbg_hash_functions },
- { "HMAC-DRBG", "provider=default", ossl_drbg_ossl_hmac_functions },
- { "SEED-SRC", "provider=default", ossl_seed_src_functions },
- { "TEST-RAND", "provider=default", ossl_test_rng_functions },
+ { 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 },
+ { PROV_NAMES_TEST_RAND, "provider=default", ossl_test_rng_functions },
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM deflt_signature[] = {
#ifndef OPENSSL_NO_DSA
- { "DSA:dsaEncryption", "provider=default", ossl_dsa_signature_functions },
+ { PROV_NAMES_DSA, "provider=default", ossl_dsa_signature_functions },
#endif
- { "RSA:rsaEncryption", "provider=default", ossl_rsa_signature_functions },
+ { PROV_NAMES_RSA, "provider=default", ossl_rsa_signature_functions },
#ifndef OPENSSL_NO_EC
- { "ED25519", "provider=default", ossl_ed25519_signature_functions },
- { "ED448", "provider=default", ossl_ed448_signature_functions },
- { "ECDSA", "provider=default", ossl_ecdsa_signature_functions },
+ { PROV_NAMES_ED25519, "provider=default", ossl_ed25519_signature_functions },
+ { PROV_NAMES_ED448, "provider=default", ossl_ed448_signature_functions },
+ { PROV_NAMES_ECDSA, "provider=default", ossl_ecdsa_signature_functions },
# ifndef OPENSSL_NO_SM2
- { "SM2", "provider=default", ossl_sm2_signature_functions },
+ { PROV_NAMES_SM2, "provider=default", ossl_sm2_signature_functions },
# endif
#endif
- { "HMAC", "provider=default", ossl_mac_legacy_hmac_signature_functions },
- { "SIPHASH", "provider=default",
+ { PROV_NAMES_HMAC, "provider=default", ossl_mac_legacy_hmac_signature_functions },
+ { PROV_NAMES_SIPHASH, "provider=default",
ossl_mac_legacy_siphash_signature_functions },
#ifndef OPENSSL_NO_POLY1305
- { "POLY1305", "provider=default",
+ { PROV_NAMES_POLY1305, "provider=default",
ossl_mac_legacy_poly1305_signature_functions },
#endif
#ifndef OPENSSL_NO_CMAC
- { "CMAC", "provider=default", ossl_mac_legacy_cmac_signature_functions },
+ { PROV_NAMES_CMAC, "provider=default", ossl_mac_legacy_cmac_signature_functions },
#endif
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM deflt_asym_cipher[] = {
- { "RSA:rsaEncryption", "provider=default", ossl_rsa_asym_cipher_functions },
+ { PROV_NAMES_RSA, "provider=default", ossl_rsa_asym_cipher_functions },
#ifndef OPENSSL_NO_SM2
- { "SM2", "provider=default", ossl_sm2_asym_cipher_functions },
+ { PROV_NAMES_SM2, "provider=default", ossl_sm2_asym_cipher_functions },
#endif
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM deflt_asym_kem[] = {
- { "RSA", "provider=default", ossl_rsa_asym_kem_functions },
+ { PROV_NAMES_RSA, "provider=default", ossl_rsa_asym_kem_functions },
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM deflt_keymgmt[] = {
#ifndef OPENSSL_NO_DH
- { "DH:dhKeyAgreement", "provider=default", ossl_dh_keymgmt_functions,
- "OpenSSL PKCS#3 DH implementation" },
- { "DHX:X9.42 DH:dhpublicnumber", "provider=default",
- ossl_dhx_keymgmt_functions, "OpenSSL X9.42 DH implementation" },
+ { PROV_NAMES_DH, "provider=default", ossl_dh_keymgmt_functions,
+ PROV_DESCS_DH },
+ { PROV_NAMES_DHX, "provider=default", ossl_dhx_keymgmt_functions,
+ PROV_DESCS_DHX },
#endif
#ifndef OPENSSL_NO_DSA
- { "DSA:dsaEncryption", "provider=default", ossl_dsa_keymgmt_functions,
- "OpenSSL DSA implementation" },
+ { PROV_NAMES_DSA, "provider=default", ossl_dsa_keymgmt_functions,
+ PROV_DESCS_DSA},
#endif
- { "RSA:rsaEncryption", "provider=default", ossl_rsa_keymgmt_functions,
- "OpenSSL RSA implementation" },
- { "RSA-PSS:RSASSA-PSS", "provider=default", ossl_rsapss_keymgmt_functions,
- "OpenSSL RSA-PSS implementation" },
+ { 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 },
#ifndef OPENSSL_NO_EC
- { "EC:id-ecPublicKey", "provider=default", ossl_ec_keymgmt_functions,
- "OpenSSL EC implementation" },
- { "X25519", "provider=default", ossl_x25519_keymgmt_functions,
- "OpenSSL X25519 implementation" },
- { "X448", "provider=default", ossl_x448_keymgmt_functions,
- "OpenSSL X448 implementation" },
- { "ED25519", "provider=default", ossl_ed25519_keymgmt_functions,
- "OpenSSL ED25519 implementation" },
- { "ED448", "provider=default", ossl_ed448_keymgmt_functions,
- "OpenSSL ED448 implementation" },
+ { PROV_NAMES_EC, "provider=default", ossl_ec_keymgmt_functions,
+ PROV_DESCS_EC },
+ { 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 },
#endif
- { "TLS1-PRF", "provider=default", ossl_kdf_keymgmt_functions,
- "OpenSSL TLS1-PRF via EVP_PKEY implementation" },
- { "HKDF", "provider=default", ossl_kdf_keymgmt_functions,
- "OpenSSL HKDF via EVP_PKEY implementation" },
- { "SCRYPT:id-scrypt", "provider=default", ossl_kdf_keymgmt_functions,
- "OpenSSL SCRYPT via EVP_PKEY implementation" },
- { "HMAC", "provider=default", ossl_mac_legacy_keymgmt_functions,
- "OpenSSL HMAC via EVP_PKEY implementation" },
- { "SIPHASH", "provider=default", ossl_mac_legacy_keymgmt_functions,
- "OpenSSL SIPHASH via EVP_PKEY implementation" },
+ { 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 },
#ifndef OPENSSL_NO_POLY1305
- { "POLY1305", "provider=default", ossl_mac_legacy_keymgmt_functions,
- "OpenSSL POLY1305 via EVP_PKEY implementation" },
+ { PROV_NAMES_POLY1305, "provider=default", ossl_mac_legacy_keymgmt_functions,
+ PROV_DESCS_POLY1305_SIGN },
#endif
#ifndef OPENSSL_NO_CMAC
- { "CMAC", "provider=default", ossl_cossl_mac_legacy_keymgmt_functions,
- "OpenSSL CMAC via EVP_PKEY implementation" },
+ { PROV_NAMES_CMAC, "provider=default", ossl_cmac_legacy_keymgmt_functions,
+ PROV_DESCS_CMAC_SIGN },
#endif
#ifndef OPENSSL_NO_SM2
- { "SM2", "provider=default", ossl_sm2_keymgmt_functions,
- "OpenSSL SM2 implementation" },
+ { PROV_NAMES_SM2, "provider=default", ossl_sm2_keymgmt_functions,
+ PROV_DESCS_SM2 },
#endif
{ NULL, NULL, NULL }
};
diff --git a/providers/fips/fipsprov.c b/providers/fips/fipsprov.c
index aeea8f296f..a7d335b78a 100644
--- a/providers/fips/fipsprov.c
+++ b/providers/fips/fipsprov.c
@@ -16,6 +16,7 @@
#include <openssl/proverr.h>
#include "internal/cryptlib.h"
#include "prov/implementations.h"
+#include "prov/names.h"
#include "prov/provider_ctx.h"
#include "prov/providercommon.h"
#include "prov/provider_util.h"
@@ -239,103 +240,93 @@ static int fips_self_test(void *provctx)
*/
static const OSSL_ALGORITHM fips_digests[] = {
/* Our primary name:NiST name[:our older names] */
- { "SHA1:SHA-1:SSL3-SHA1", FIPS_DEFAULT_PROPERTIES, ossl_sha1_functions },
- { "SHA2-224:SHA-224:SHA224", FIPS_DEFAULT_PROPERTIES,
- ossl_sha224_functions },
- { "SHA2-256:SHA-256:SHA256", FIPS_DEFAULT_PROPERTIES,
- ossl_sha256_functions },
- { "SHA2-384:SHA-384:SHA384", FIPS_DEFAULT_PROPERTIES,
- ossl_sha384_functions },
- { "SHA2-512:SHA-512:SHA512", FIPS_DEFAULT_PROPERTIES,
- ossl_sha512_functions },
- { "SHA2-512/224:SHA-512/224:SHA512-224", FIPS_DEFAULT_PROPERTIES,
+ { PROV_NAMES_SHA1, FIPS_DEFAULT_PROPERTIES, ossl_sha1_functions },
+ { PROV_NAMES_SHA2_224, FIPS_DEFAULT_PROPERTIES, ossl_sha224_functions },
+ { PROV_NAMES_SHA2_256, FIPS_DEFAULT_PROPERTIES, ossl_sha256_functions },
+ { PROV_NAMES_SHA2_384, FIPS_DEFAULT_PROPERTIES, ossl_sha384_functions },
+ { PROV_NAMES_SHA2_512, FIPS_DEFAULT_PROPERTIES, ossl_sha512_functions },
+ { PROV_NAMES_SHA2_512_224, FIPS_DEFAULT_PROPERTIES,
ossl_sha512_224_functions },
- { "SHA2-512/256:SHA-512/256:SHA512-256", FIPS_DEFAULT_PROPERTIES,
+ { PROV_NAMES_SHA2_512_256, FIPS_DEFAULT_PROPERTIES,
ossl_sha512_256_functions },
/* We agree with NIST here, so one name only */
- { "SHA3-224", FIPS_DEFAULT_PROPERTIES, ossl_sha3_224_functions },
- { "SHA3-256", FIPS_DEFAULT_PROPERTIES, ossl_sha3_256_functions },
- { "SHA3-384", FIPS_DEFAULT_PROPERTIES, ossl_sha3_384_functions },
- { "SHA3-512", FIPS_DEFAULT_PROPERTIES, ossl_sha3_512_functions },
+ { PROV_NAMES_SHA3_224, FIPS_DEFAULT_PROPERTIES, ossl_sha3_224_functions },
+ { PROV_NAMES_SHA3_256, FIPS_DEFAULT_PROPERTIES, ossl_sha3_256_functions },
+ { PROV_NAMES_SHA3_384, FIPS_DEFAULT_PROPERTIES, ossl_sha3_384_functions },
+ { PROV_NAMES_SHA3_512, FIPS_DEFAULT_PROPERTIES, ossl_sha3_512_functions },
- { "SHAKE-128:SHAKE128", FIPS_DEFAULT_PROPERTIES, ossl_shake_128_functions },
- { "SHAKE-256:SHAKE256", FIPS_DEFAULT_PROPERTIES, ossl_shake_256_functions },
+ { PROV_NAMES_SHAKE_128, FIPS_DEFAULT_PROPERTIES, ossl_shake_128_functions },
+ { PROV_NAMES_SHAKE_256, FIPS_DEFAULT_PROPERTIES, ossl_shake_256_functions },
/*
* KECCAK-KMAC-128 and KECCAK-KMAC-256 as hashes are mostly useful for
* KMAC128 and KMAC256.
*/
- { "KECCAK-KMAC-128:KECCAK-KMAC128", FIPS_DEFAULT_PROPERTIES,
+ { PROV_NAMES_KECCAK_KMAC_128, FIPS_DEFAULT_PROPERTIES,
ossl_keccak_kmac_128_functions },
- { "KECCAK-KMAC-256:KECCAK-KMAC256", FIPS_DEFAULT_PROPERTIES,
+ { PROV_NAMES_KECCAK_KMAC_256, FIPS_DEFAULT_PROPERTIES,
ossl_keccak_kmac_256_functions },
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM_CAPABLE fips_ciphers[] = {
/* Our primary name[:ASN.1 OID name][:our older names] */
- ALG("AES-256-ECB", ossl_aes256ecb_functions),
- ALG("AES-192-ECB", ossl_aes192ecb_functions),
- ALG("AES-128-ECB", ossl_aes128ecb_functions),
- ALG("AES-256-CBC:AES256", ossl_aes256cbc_functions),
- ALG("AES-192-CBC:AES192", ossl_aes192cbc_functions),
- ALG("AES-128-CBC:AES128", ossl_aes128cbc_functions),
- ALG("AES-256-CBC-CTS", ossl_aes256cbc_cts_functions),
- ALG("AES-192-CBC-CTS", ossl_aes192cbc_cts_functions),
- ALG("AES-128-CBC-CTS", ossl_aes128cbc_cts_functions),
- ALG("AES-256-OFB", ossl_aes256ofb_functions),
- ALG("AES-192-OFB", ossl_aes192ofb_functions),
- ALG("AES-128-OFB", ossl_aes128ofb_functions),
- ALG("AES-256-CFB", ossl_aes256cfb_functions),
- ALG("AES-192-CFB", ossl_aes192cfb_functions),
- ALG("AES-128-CFB", ossl_aes128cfb_functions),
- ALG("AES-256-CFB1", ossl_aes256cfb1_functions),
- ALG("AES-192-CFB1", ossl_aes192cfb1_functions),
- ALG("AES-128-CFB1", ossl_aes128cfb1_functions),
- ALG("AES-256-CFB8", ossl_aes256cfb8_functions),
- ALG("AES-192-CFB8", ossl_aes192cfb8_functions),
- ALG("AES-128-CFB8", ossl_aes128cfb8_functions),
- ALG("AES-256-CTR", ossl_aes256ctr_functions),
- ALG("AES-192-CTR", ossl_aes192ctr_functions),
- ALG("AES-128-CTR", ossl_aes128ctr_functions),
- ALG("AES-256-XTS", ossl_aes256xts_functions),
- ALG("AES-128-XTS", ossl_aes128xts_functions),
- ALG("AES-256-GCM:id-aes256-GCM", ossl_aes256gcm_functions),
- ALG("AES-192-GCM:id-aes192-GCM", ossl_aes192gcm_functions),
- ALG("AES-128-GCM:id-aes128-GCM", ossl_aes128gcm_functions),
- ALG("AES-256-CCM:id-aes256-CCM", ossl_aes256ccm_functions),
- ALG("AES-192-CCM:id-aes192-CCM", ossl_aes192ccm_functions),
- ALG("AES-128-CCM:id-aes128-CCM", ossl_aes128ccm_functions),
- ALG("AES-256-WRAP:id-aes256-wrap:AES256-WRAP", ossl_aes256wrap_functions),
- ALG("AES-192-WRAP:id-aes192-wrap:AES192-WRAP", ossl_aes192wrap_functions),
- ALG("AES-128-WRAP:id-aes128-wrap:AES128-WRAP", ossl_aes128wrap_functions),
- ALG("AES-256-WRAP-PAD:id-aes256-wrap-pad:AES256-WRAP-PAD",
- ossl_aes256wrappad_functions),
- ALG("AES-192-WRAP-PAD:id-aes192-wrap-pad:AES192-WRAP-PAD",
- ossl_aes192wrappad_functions),
- ALG("AES-128-WRAP-PAD:id-aes128-wrap-pad:AES128-WRAP-PAD",
- ossl_aes128wrappad_functions),
- ALG("AES-256-WRAP-INV:AES256-WRAP-INV", ossl_aes256wrapinv_functions),
- ALG("AES-192-WRAP-INV:AES192-WRAP-INV", ossl_aes192wrapinv_functions),
- ALG("AES-128-WRAP-INV:AES128-WRAP-INV", ossl_aes128wrapinv_functions),
- ALG("AES-256-WRAP-PAD-INV:AES256-WRAP-PAD-INV",
- ossl_aes256wrappadinv_functions),
- ALG("AES-192-WRAP-PAD-INV:AES192-WRAP-PAD-INV",
- ossl_aes192wrappadinv_functions),
- ALG("AES-128-WRAP-PAD-INV:AES128-WRAP-PAD-INV",
- ossl_aes128wrappadinv_functions),
- ALGC("AES-128-CBC-HMAC-SHA1", ossl_aes128cbc_hmac_sha1_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_256_CBC_CTS, ossl_aes256cbc_cts_functions),
+ ALG(PROV_NAMES_AES_192_CBC_CTS, ossl_aes192cbc_cts_functions),
+ ALG(PROV_NAMES_AES_128_CBC_CTS, ossl_aes128cbc_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),
+ 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,
ossl_cipher_capable_aes_cbc_hmac_sha1),
- ALGC("AES-256-CBC-HMAC-SHA1", ossl_aes256cbc_hmac_sha1_functions,
+ ALGC(PROV_NAMES_AES_256_CBC_HMAC_SHA1, ossl_aes256cbc_hmac_sha1_functions,
ossl_cipher_capable_aes_cbc_hmac_sha1),
- ALGC("AES-128-CBC-HMAC-SHA256", ossl_aes128cbc_hmac_sha256_functions,
+ ALGC(PROV_NAMES_AES_128_CBC_HMAC_SHA256, ossl_aes128cbc_hmac_sha256_functions,
ossl_cipher_capable_aes_cbc_hmac_sha256),
- ALGC("AES-256-CBC-HMAC-SHA256", ossl_aes256cbc_hmac_sha256_functions,
+ ALGC(PROV_NAMES_AES_256_CBC_HMAC_SHA256, ossl_aes256cbc_hmac_sha256_functions,
ossl_cipher_capable_aes_cbc_hmac_sha256),
#ifndef OPENSSL_NO_DES
- ALG("DES-EDE3-ECB:DES-EDE3", ossl_tdes_ede3_ecb_functions),
- ALG("DES-EDE3-CBC:DES3", ossl_tdes_ede3_cbc_functions),
+ ALG(PROV_NAMES_DES_EDE3_ECB, ossl_tdes_ede3_ecb_functions),
+ ALG(PROV_NAMES_DES_EDE3_CBC, ossl_tdes_ede3_cbc_functions),
#endif /* OPENSSL_NO_DES */
{ { NULL, NULL, NULL }, NULL }
};
@@ -343,120 +334,118 @@ static OSSL_ALGORITHM exported_fips_ciphers[OSSL_NELEM(fips_ciphers)];
static const OSSL_ALGORITHM fips_macs[] = {
#ifndef OPENSSL_NO_CMAC
- { "CMAC", FIPS_DEFAULT_PROPERTIES, ossl_cmac_functions },
+ { PROV_NAMES_CMAC, FIPS_DEFAULT_PROPERTIES, ossl_cmac_functions },
#endif
- { "GMAC", FIPS_DEFAULT_PROPERTIES, ossl_gmac_functions },
- { "HMAC", FIPS_DEFAULT_PROPERTIES, ossl_hmac_functions },
- { "KMAC-128:KMAC128", FIPS_DEFAULT_PROPERTIES, ossl_kmac128_functions },
- { "KMAC-256:KMAC256", FIPS_DEFAULT_PROPERTIES, ossl_kmac256_functions },
+ { PROV_NAMES_GMAC, FIPS_DEFAULT_PROPERTIES, ossl_gmac_functions },
+ { PROV_NAMES_HMAC, FIPS_DEFAULT_PROPERTIES, ossl_hmac_functions },
+ { PROV_NAMES_KMAC_128, FIPS_DEFAULT_PROPERTIES, ossl_kmac128_functions },
+ { PROV_NAMES_KMAC_256, FIPS_DEFAULT_PROPERTIES, ossl_kmac256_functions },
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM fips_kdfs[] = {
- { "HKDF", FIPS_DEFAULT_PROPERTIES, ossl_kdf_hkdf_functions },
- { "SSKDF", FIPS_DEFAULT_PROPERTIES, ossl_kdf_sskdf_functions },
- { "PBKDF2", FIPS_DEFAULT_PROPERTIES, ossl_kdf_pbkdf2_functions },
- { "SSHKDF", FIPS_DEFAULT_PROPERTIES, ossl_kdf_sshkdf_functions },
- { "X963KDF:X942KDF-CONCAT", FIPS_DEFAULT_PROPERTIES,
+ { PROV_NAMES_HKDF, FIPS_DEFAULT_PROPERTIES, ossl_kdf_hkdf_functions },
+ { PROV_NAMES_SSKDF, FIPS_DEFAULT_PROPERTIES, ossl_kdf_sskdf_functions },
+ { PROV_NAMES_PBKDF2, FIPS_DEFAULT_PROPERTIES, ossl_kdf_pbkdf2_functions },
+ { PROV_NAMES_SSHKDF, FIPS_DEFAULT_PROPERTIES, ossl_kdf_sshkdf_functions },
+ { PROV_NAMES_X963KDF, FIPS_DEFAULT_PROPERTIES,
ossl_kdf_x963_kdf_functions },
- { "X942KDF-ASN1:X942KDF", FIPS_DEFAULT_PROPERTIES,
+ { PROV_NAMES_X942KDF_ASN1, FIPS_DEFAULT_PROPERTIES,
ossl_kdf_x942_kdf_functions },
- { "TLS1-PRF", FIPS_DEFAULT_PROPERTIES, ossl_kdf_tls1_prf_functions },
- { "KBKDF", FIPS_DEFAULT_PROPERTIES, ossl_kdf_kbkdf_functions },
+ { PROV_NAMES_TLS1_PRF, FIPS_DEFAULT_PROPERTIES,
+ ossl_kdf_tls1_prf_functions },
+ { PROV_NAMES_KBKDF, FIPS_DEFAULT_PROPERTIES, ossl_kdf_kbkdf_functions },
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM fips_rands[] = {
- { "CTR-DRBG", FIPS_DEFAULT_PROPERTIES, ossl_drbg_ctr_functions },
- { "HASH-DRBG", FIPS_DEFAULT_PROPERTIES, ossl_drbg_hash_functions },
- { "HMAC-DRBG", FIPS_DEFAULT_PROPERTIES, ossl_drbg_ossl_hmac_functions },
- { "TEST-RAND", FIPS_UNAPPROVED_PROPERTIES, ossl_test_rng_functions },
+ { PROV_NAMES_CTR_DRBG, FIPS_DEFAULT_PROPERTIES, ossl_drbg_ctr_functions },
+ { PROV_NAMES_HASH_DRBG, FIPS_DEFAULT_PROPERTIES, ossl_drbg_hash_functions },
+ { PROV_NAMES_HMAC_DRBG, FIPS_DEFAULT_PROPERTIES, ossl_drbg_ossl_hmac_functions },
+ { PROV_NAMES_TEST_RAND, FIPS_UNAPPROVED_PROPERTIES, ossl_test_rng_functions },
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM fips_keyexch[] = {
#ifndef OPENSSL_NO_DH
- { "DH:dhKeyAgreement", FIPS_DEFAULT_PROPERTIES, ossl_dh_keyexch_functions },
+ { PROV_NAMES_DH, FIPS_DEFAULT_PROPERTIES, ossl_dh_keyexch_functions },
#endif
#ifndef OPENSSL_NO_EC
- { "ECDH", FIPS_DEFAULT_PROPERTIES, ossl_ecdh_keyexch_functions },
- { "X25519", FIPS_DEFAULT_PROPERTIES, ossl_x25519_keyexch_functions },
- { "X448", FIPS_DEFAULT_PROPERTIES, ossl_x448_keyexch_functions },
+ { PROV_NAMES_ECDH, FIPS_DEFAULT_PROPERTIES, ossl_ecdh_keyexch_functions },
+ { PROV_NAMES_X25519, FIPS_DEFAULT_PROPERTIES, ossl_x25519_keyexch_functions },
+ { PROV_NAMES_X448, FIPS_DEFAULT_PROPERTIES, ossl_x448_keyexch_functions },
#endif
- { "TLS1-PRF", FIPS_DEFAULT_PROPERTIES,
+ { PROV_NAMES_TLS1_PRF, FIPS_DEFAULT_PROPERTIES,
ossl_kdf_tls1_prf_keyexch_functions },
- { "HKDF", FIPS_DEFAULT_PROPERTIES, ossl_kdf_hkdf_keyexch_functions },
+ { PROV_NAMES_HKDF, FIPS_DEFAULT_PROPERTIES, ossl_kdf_hkdf_keyexch_functions },
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM fips_signature[] = {
#ifndef OPENSSL_NO_DSA
- { "DSA:dsaEncryption", FIPS_DEFAULT_PROPERTIES,
- ossl_dsa_signature_functions },
+ { PROV_NAMES_DSA, FIPS_DEFAULT_PROPERTIES, ossl_dsa_signature_functions },
#endif
- { "RSA:rsaEncryption", FIPS_DEFAULT_PROPERTIES,
- ossl_rsa_signature_functions },
+ { PROV_NAMES_RSA, FIPS_DEFAULT_PROPERTIES, ossl_rsa_signature_functions },
#ifndef OPENSSL_NO_EC
- { "ED25519", FIPS_DEFAULT_PROPERTIES, ossl_ed25519_signature_functions },
- { "ED448", FIPS_DEFAULT_PROPERTIES, ossl_ed448_signature_functions },
- { "ECDSA", FIPS_DEFAULT_PROPERTIES, ossl_ecdsa_signature_functions },
+ { PROV_NAMES_ED25519, FIPS_DEFAULT_PROPERTIES, ossl_ed25519_signature_functions },
+ { PROV_NAMES_ED448, FIPS_DEFAULT_PROPERTIES, ossl_ed448_signature_functions },
+ { PROV_NAMES_ECDSA, FIPS_DEFAULT_PROPERTIES, ossl_ecdsa_signature_functions },
#endif
- { "HMAC", FIPS_DEFAULT_PROPERTIES,
+ { PROV_NAMES_HMAC, FIPS_DEFAULT_PROPERTIES,
ossl_mac_legacy_hmac_signature_functions },
#ifndef OPENSSL_NO_CMAC
- { "CMAC", FIPS_DEFAULT_PROPERTIES,
+ { PROV_NAMES_CMAC, FIPS_DEFAULT_PROPERTIES,
ossl_mac_legacy_cmac_signature_functions },
#endif
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM fips_asym_cipher[] = {
- { "RSA:rsaEncryption", FIPS_DEFAULT_PROPERTIES,
- ossl_rsa_asym_cipher_functions },
+ { PROV_NAMES_RSA, FIPS_DEFAULT_PROPERTIES, ossl_rsa_asym_cipher_functions },
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM fips_asym_kem[] = {
- { "RSA", FIPS_DEFAULT_PROPERTIES, ossl_rsa_asym_kem_functions },
+ { PROV_NAMES_RSA, FIPS_DEFAULT_PROPERTIES, ossl_rsa_asym_kem_functions },
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM fips_keymgmt[] = {
#ifndef OPENSSL_NO_DH
- { "DH:dhKeyAgreement", FIPS_DEFAULT_PROPERTIES, ossl_dh_keymgmt_functions,
- "OpenSSL PKCS#3 DH FIPS implementation" },
- { "DHX:X9.42 DH:dhpublicnumber", FIPS_DEFAULT_PROPERTIES,
- ossl_dhx_keymgmt_functions, "OpenSSL X9.42 DH FIPS implementation" },
+ { PROV_NAMES_DH, FIPS_DEFAULT_PROPERTIES, ossl_dh_keymgmt_functions,
+ PROV_DESCS_DH },
+ { PROV_NAMES_DHX, FIPS_DEFAULT_PROPERTIES, ossl_dhx_keymgmt_functions,
+ PROV_DESCS_DHX },
#endif
#ifndef OPENSSL_NO_DSA
- { "DSA", FIPS_DEFAULT_PROPERTIES, ossl_dsa_keymgmt_functions,
- "OpenSSL DSA FIPS implementation" },
+ { PROV_NAMES_DSA, FIPS_DEFAULT_PROPERTIES, ossl_dsa_keymgmt_functions,
+ PROV_DESCS_DSA },
#endif
- { "RSA:rsaEncryption", FIPS_DEFAULT_PROPERTIES,
- ossl_rsa_keymgmt_functions, "OpenSSL RSA FIPS implementation" },
- { "RSA-PSS:RSASSA-PSS", FIPS_DEFAULT_PROPERTIES,
- ossl_rsapss_keymgmt_functions, "OpenSSL RSA-PSS FIPS implementation" },
+ { PROV_NAMES_RSA, FIPS_DEFAULT_PROPERTIES, ossl_rsa_keymgmt_functions,
+ PROV_DESCS_RSA },
+ { PROV_NAMES_RSA_PSS, FIPS_DEFAULT_PROPERTIES,
+ ossl_rsapss_keymgmt_functions, PROV_DESCS_RSA_PSS },
#ifndef OPENSSL_NO_EC
- { "EC:id-ecPublicKey", FIPS_DEFAULT_PROPERTIES, ossl_ec_keymgmt_functions,
- "OpenSSL EC FIPS implementation" },
- { "X25519", FIPS_DEFAULT_PROPERTIES, ossl_x25519_keymgmt_functions,
- "OpenSSL X25519 FIPS implementation" },
- { "X448", FIPS_DEFAULT_PROPERTIES, ossl_x448_keymgmt_functions,
- "OpenSSL X448 FIPS implementation" },
- { "ED25519", FIPS_DEFAULT_PROPERTIES, ossl_ed25519_keymgmt_functions,
- "OpenSSL ED25519 FIPS implementation" },
- { "ED448", FIPS_DEFAULT_PROPERTIES, ossl_ed448_keymgmt_functions,
- "OpenSSL ED448 FIPS implementation" },
+ { PROV_NAMES_EC, FIPS_DEFAULT_PROPERTIES, ossl_ec_keymgmt_functions,
+ PROV_DESCS_EC },
+ { PROV_NAMES_X25519, FIPS_DEFAULT_PROPERTIES, ossl_x25519_keymgmt_functions,
+ PROV_DESCS_X25519 },
+ { PROV_NAMES_X448, FIPS_DEFAULT_PROPERTIES, ossl_x448_keymgmt_functions,
+ PROV_DESCS_X448 },
+ { PROV_NAMES_ED25519, FIPS_DEFAULT_PROPERTIES, ossl_ed25519_keymgmt_functions,
+ PROV_DESCS_ED25519 },
+ { PROV_NAMES_ED448, FIPS_DEFAULT_PROPERTIES, ossl_ed448_keymgmt_functions,
+ PROV_DESCS_ED448 },
#endif
- { "TLS1-PRF", FIPS_DEFAULT_PROPERTIES, ossl_kdf_keymgmt_functions,
- "OpenSSL TLS1-PRF via EVP_PKEY FIPS implementation" },
- { "HKDF", FIPS_DEFAULT_PROPERTIES, ossl_kdf_keymgmt_functions,
- "OpenSSL HKDF via EVP_PKEY FIPS implementation" },
- { "HMAC", FIPS_DEFAULT_PROPERTIES, ossl_mac_legacy_keymgmt_functions,
- "OpenSSL HMAC via EVP_PKEY FIPS implementation" },
+ { PROV_NAMES_TLS1_PRF, FIPS_DEFAULT_PROPERTIES, ossl_kdf_keymgmt_functions,
+ PROV_DESCS_TLS1_PRF_SIGN },
+ { PROV_NAMES_HKDF, FIPS_DEFAULT_PROPERTIES, ossl_kdf_keymgmt_functions,
+ PROV_DESCS_HKDF_SIGN },
+ { PROV_NAMES_HMAC, FIPS_DEFAULT_PROPERTIES, ossl_mac_legacy_keymgmt_functions,
+ PROV_DESCS_HMAC_SIGN },
#ifndef OPENSSL_NO_CMAC
- { "CMAC", FIPS_DEFAULT_PROPERTIES, ossl_cossl_mac_legacy_keymgmt_functions,
- "OpenSSL CMAC via EVP_PKEY FIPS implementation" },
+ { PROV_NAMES_CMAC, FIPS_DEFAULT_PROPERTIES,
+ ossl_cmac_legacy_keymgmt_functions, PROV_DESCS_CMAC_SIGN },
#endif
{ NULL, NULL, NULL }
};
diff --git a/providers/implementations/include/prov/implementations.h b/providers/implementations/include/prov/implementations.h
index 20d6b84021..6afea01df0 100644
--- a/providers/implementations/include/prov/implementations.h
+++ b/providers/implementations/include/prov/implementations.h
@@ -284,7 +284,7 @@ extern const OSSL_DISPATCH ossl_ed448_keymgmt_functions[];
extern const OSSL_DISPATCH ossl_ec_keymgmt_functions[];
extern const OSSL_DISPATCH ossl_kdf_keymgmt_functions[];
extern const OSSL_DISPATCH ossl_mac_legacy_keymgmt_functions[];
-extern const OSSL_DISPATCH ossl_cossl_mac_legacy_keymgmt_functions[];
+extern const OSSL_DISPATCH ossl_cmac_legacy_keymgmt_functions[];
#ifndef OPENSSL_NO_SM2
extern const OSSL_DISPATCH ossl_sm2_keymgmt_functions[];
#endif
diff --git a/providers/implementations/include/prov/names.h b/providers/implementations/include/prov/names.h
new file mode 100644
index 0000000000..fd39c0229e
--- /dev/null
+++ b/providers/implementations/include/prov/names.h
@@ -0,0 +1,322 @@
+/*
+ * Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * 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
+ */
+
+/*
+ * Macros for use as names and descriptions in our providers' OSSL_ALGORITHM.
+ *
+ * All the strings are formatted the same way:
+ *
+ * Our primary name[:other names][:numeric OID]
+ *
+ * 'other names' include historical OpenSSL names, NIST names, ASN.1 OBJECT
+ * IDENTIFIER names, and commonly known aliases.
+ *
+ * Where it matters, our primary names follow this format:
+ *
+ * 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.
+ */
+
+/*-
+ * Symmetric ciphers
+ * -----------------
+ */
+#define PROV_NAMES_AES_256_ECB "AES-256-ECB:2.16.840.1.101.3.4.1.41"
+#define PROV_NAMES_AES_192_ECB "AES-192-ECB:2.16.840.1.101.3.4.1.21"
+#define PROV_NAMES_AES_128_ECB "AES-128-ECB:2.16.840.1.101.3.4.1.1"
+#define PROV_NAMES_AES_256_CBC "AES-256-CBC:AES256:2.16.840.1.101.3.4.1.42"
+#define PROV_NAMES_AES_192_CBC "AES-192-CBC:AES192:2.16.840.1.101.3.4.1.22"
+#define PROV_NAMES_AES_128_CBC "AES-128-CBC:AES128:2.16.840.1.101.3.4.1.2"
+#define PROV_NAMES_AES_256_CBC_CTS "AES-256-CBC-CTS"
+#define PROV_NAMES_AES_192_CBC_CTS "AES-192-CBC-CTS"
+#define PROV_NAMES_AES_128_CBC_CTS "AES-128-CBC-CTS"
+#define PROV_NAMES_AES_256_OFB "AES-256-OFB:2.16.840.1.101.3.4.1.43"
+#define PROV_NAMES_AES_192_OFB "AES-192-OFB:2.16.840.1.101.3.4.1.23"
+#define PROV_NAMES_AES_128_OFB "AES-128-OFB:2.16.840.1.101.3.4.1.3"
+#define PROV_NAMES_AES_256_CFB "AES-256-CFB:2.16.840.1.101.3.4.1.44"
+#define PROV_NAMES_AES_192_CFB "AES-192-CFB:2.16.840.1.101.3.4.1.24"
+#define PROV_NAMES_AES_128_CFB "AES-128-CFB:2.16.840.1.101.3.4.1.4"
+#define PROV_NAMES_AES_256_CFB1 "AES-256-CFB1"
+#define PROV_NAMES_AES_192_CFB1 "AES-192-CFB1"
+#define PROV_NAMES_AES_128_CFB1 "AES-128-CFB1"
+#define PROV_NAMES_AES_256_CFB8 "AES-256-CFB8"
+#define PROV_NAMES_AES_192_CFB8 "AES-192-CFB8"
+#define PROV_NAMES_AES_128_CFB8 "AES-128-CFB8"
+#define PROV_NAMES_AES_256_CTR "AES-256-CTR"
+#define PROV_NAMES_AES_192_CTR "AES-192-CTR"
+#define PROV_NAMES_AES_128_CTR "AES-128-CTR"
+#define PROV_NAMES_AES_256_XTS "AES-256-XTS:1.3.111.2.1619.0.1.2"
+#define PROV_NAMES_AES_128_XTS "AES-128-XTS:1.3.111.2.1619.0.1.1"
+#define PROV_NAMES_AES_256_GCM "AES-256-GCM:id-aes256-GCM:2.16.840.1.101.3.4.1.46"
+#define PROV_NAMES_AES_192_GCM "AES-192-GCM:id-aes192-GCM:2.16.840.1.101.3.4.1.26"
+#define PROV_NAMES_AES_128_GCM "AES-128-GCM:id-aes128-GCM:2.16.840.1.101.3.4.1.6"
+#define PROV_NAMES_AES_256_CCM "AES-256-CCM:id-aes256-CCM:2.16.840.1.101.3.4.1.47"
+#define PROV_NAMES_AES_192_CCM "AES-192-CCM:id-aes192-CCM:2.16.840.1.101.3.4.1.27"
+#define PROV_NAMES_AES_128_CCM "AES-128-CCM:id-aes128-CCM:2.16.840.1.101.3.4.1.7"
+#define PROV_NAMES_AES_256_WRAP "AES-256-WRAP:id-aes256-wrap:AES256-WRAP:2.16.840.1.101.3.4.1.45"
+#define PROV_NAMES_AES_192_WRAP "AES-192-WRAP:id-aes192-wrap:AES192-WRAP:2.16.840.1.101.3.4.1.25"
+#define PROV_NAMES_AES_128_WRAP "AES-128-WRAP:id-aes128-wrap:AES128-WRAP:2.16.840.1.101.3.4.1.5"
+#define PROV_NAMES_AES_256_WRAP_PAD "AES-256-WRAP-PAD:id-aes256-wrap-pad:AES256-WRAP-PAD:2.16.840.1.101.3.4.1.48"
+#define PROV_NAMES_AES_192_WRAP_PAD "AES-192-WRAP-PAD:id-aes192-wrap-pad:AES192-WRAP-PAD:2.16.840.1.101.3.4.1.28"
+#define PROV_NAMES_AES_128_WRAP_PAD "AES-128-WRAP-PAD:id-aes128-wrap-pad:AES128-WRAP-PAD:2.16.840.1.101.3.4.1.8"
+#define PROV_NAMES_AES_256_WRAP_INV "AES-256-WRAP-INV:AES256-WRAP-INV"
+#define PROV_NAMES_AES_192_WRAP_INV "AES-192-WRAP-INV:AES192-WRAP-INV"
+#define PROV_NAMES_AES_128_WRAP_INV "AES-128-WRAP-INV:AES128-WRAP-INV"
+#define PROV_NAMES_AES_256_WRAP_PAD_INV "AES-256-WRAP-PAD-INV:AES256-WRAP-PAD-INV"
+#define PROV_NAMES_AES_192_WRAP_PAD_INV "AES-192-WRAP-PAD-INV:AES192-WRAP-PAD-INV"
+#define PROV_NAMES_AES_128_WRAP_PAD_INV "AES-128-WRAP-PAD-INV:AES128-WRAP-PAD-INV"
+#define PROV_NAMES_AES_128_CBC_HMAC_SHA1 "AES-128-CBC-HMAC-SHA1"
+#define PROV_NAMES_AES_256_CBC_HMAC_SHA1 "AES-256-CBC-HMAC-SHA1"
+#define PROV_NAMES_AES_128_CBC_HMAC_SHA256 "AES-128-CBC-HMAC-SHA256"
+#define PROV_NAMES_AES_256_CBC_HMAC_SHA256 "AES-256-CBC-HMAC-SHA256"
+#define PROV_NAMES_DES_EDE3_ECB "DES-EDE3-ECB:DES-EDE3"
+#define PROV_NAMES_DES_EDE3_CBC "DES-EDE3-CBC:DES3:1.2.840.113549.3.7"
+#define PROV_NAMES_NULL "NULL"
+#define PROV_NAMES_AES_256_OCB "AES-256-OCB"
+#define PROV_NAMES_AES_192_OCB "AES-192-OCB"
+#define PROV_NAMES_AES_128_OCB "AES-128-OCB"
+#define PROV_NAMES_AES_128_SIV "AES-128-SIV"
+#define PROV_NAMES_AES_192_SIV "AES-192-SIV"
+#define PROV_NAMES_AES_256_SIV "AES-256-SIV"
+#define PROV_NAMES_ARIA_256_GCM "ARIA-256-GCM:1.2.410.200046.1.1.36"
+#define PROV_NAMES_ARIA_192_GCM "ARIA-192-GCM:1.2.410.200046.1.1.35"
+#define PROV_NAMES_ARIA_128_GCM "ARIA-128-GCM:1.2.410.200046.1.1.34"
+#define PROV_NAMES_ARIA_256_CCM "ARIA-256-CCM:1.2.410.200046.1.1.39"
+#define PROV_NAMES_ARIA_192_CCM "ARIA-192-CCM:1.2.410.200046.1.1.38"
+#define PROV_NAMES_ARIA_128_CCM "ARIA-128-CCM:1.2.410.200046.1.1.37"
+#define PROV_NAMES_ARIA_256_ECB "ARIA-256-ECB:1.2.410.200046.1.1.11"
+#define PROV_NAMES_ARIA_192_ECB "ARIA-192-ECB:1.2.410.200046.1.1.6"
+#define PROV_NAMES_ARIA_128_ECB "ARIA-128-ECB:1.2.410.200046.1.1.1"
+#define PROV_NAMES_ARIA_256_CBC "ARIA-256-CBC:ARIA256:1.2.410.200046.1.1.12"
+#define PROV_NAMES_ARIA_192_CBC "ARIA-192-CBC:ARIA192:1.2.410.200046.1.1.7"
+#define PROV_NAMES_ARIA_128_CBC "ARIA-128-CBC:ARIA128:1.2.410.200046.1.1.2"
+#define PROV_NAMES_ARIA_256_OFB "ARIA-256-OFB:1.2.410.200046.1.1.14"
+#define PROV_NAMES_ARIA_192_OFB "ARIA-192-OFB:1.2.410.200046.1.1.9"
+#define PROV_NAMES_ARIA_128_OFB "ARIA-128-OFB:1.2.410.200046.1.1.4"
+#define PROV_NAMES_ARIA_256_CFB "ARIA-256-CFB:1.2.410.200046.1.1.13"
+#define PROV_NAMES_ARIA_192_CFB "ARIA-192-CFB:1.2.410.200046.1.1.8"
+#define PROV_NAMES_ARIA_128_CFB "ARIA-128-CFB:1.2.410.200046.1.1.3"
+#define PROV_NAMES_ARIA_256_CFB1 "ARIA-256-CFB1"
+#define PROV_NAMES_ARIA_192_CFB1 "ARIA-192-CFB1"
+#define PROV_NAMES_ARIA_128_CFB1 "ARIA-128-CFB1"
+#define PROV_NAMES_ARIA_256_CFB8 "ARIA-256-CFB8"
+#define PROV_NAMES_ARIA_192_CFB8 "ARIA-192-CFB8"
+#define PROV_NAMES_ARIA_128_CFB8 "ARIA-128-CFB8"
+#define PROV_NAMES_ARIA_256_CTR "ARIA-256-CTR:1.2.410.200046.1.1.15"
+#define PROV_NAMES_ARIA_192_CTR "ARIA-192-CTR:1.2.410.200046.1.1.10"
+#define PROV_NAMES_ARIA_128_CTR "ARIA-128-CTR:1.2.410.200046.1.1.5"
+#define PROV_NAMES_CAMELLIA_256_ECB "CAMELLIA-256-ECB:0.3.4401.5.3.1.9.41"
+#define PROV_NAMES_CAMELLIA_192_ECB "CAMELLIA-192-ECB:0.3.4401.5.3.1.9.21"
+#define PROV_NAMES_CAMELLIA_128_ECB "CAMELLIA-128-ECB:0.3.4401.5.3.1.9.1"
+#define PROV_NAMES_CAMELLIA_256_CBC "CAMELLIA-256-CBC:CAMELLIA256:1.2.392.200011.61.1.1.1.4"
+#define PROV_NAMES_CAMELLIA_192_CBC "CAMELLIA-192-CBC:CAMELLIA192:1.2.392.200011.61.1.1.1.3"
+#define PROV_NAMES_CAMELLIA_128_CBC "CAMELLIA-128-CBC:CAMELLIA128:1.2.392.200011.61.1.1.1.2"
+#define PROV_NAMES_CAMELLIA_256_OFB "CAMELLIA-256-OFB:0.3.4401.5.3.1.9.43"
+#define PROV_NAMES_CAMELLIA_192_OFB "CAMELLIA-192-OFB:0.3.4401.5.3.1.9.23"
+#define PROV_NAMES_CAMELLIA_128_OFB "CAMELLIA-128-OFB:0.3.4401.5.3.1.9.3"
+#define PROV_NAMES_CAMELLIA_256_CFB "CAMELLIA-256-CFB:0.3.4401.5.3.1.9.44"
+#define PROV_NAMES_CAMELLIA_192_CFB "CAMELLIA-192-CFB:0.3.4401.5.3.1.9.24"
+#define PROV_NAMES_CAMELLIA_128_CFB "CAMELLIA-128-CFB:0.3.4401.5.3.1.9.4"
+#define PROV_NAMES_CAMELLIA_256_CFB1 "CAMELLIA-256-CFB1"
+#define PROV_NAMES_CAMELLIA_192_CFB1 "CAMELLIA-192-CFB1"
+#define PROV_NAMES_CAMELLIA_128_CFB1 "CAMELLIA-128-CFB1"
+#define PROV_NAMES_CAMELLIA_256_CFB8 "CAMELLIA-256-CFB8"
+#define PROV_NAMES_CAMELLIA_192_CFB8 "CAMELLIA-192-CFB8"
+#define PROV_NAMES_CAMELLIA_128_CFB8 "CAMELLIA-128-CFB8"
+#define PROV_NAMES_CAMELLIA_256_CTR "CAMELLIA-256-CTR:0.3.4401.5.3.1.9.49"
+#define PROV_NAMES_CAMELLIA_192_CTR "CAMELLIA-192-CTR:0.3.4401.5.3.1.9.29"
+#define PROV_NAMES_CAMELLIA_128_CTR "CAMELLIA-128-CTR:0.3.4401.5.3.1.9.9"
+#define PROV_NAMES_DES_EDE3_OFB "DES-EDE3-OFB"
+#define PROV_NAMES_DES_EDE3_CFB "DES-EDE3-CFB"
+#define PROV_NAMES_DES_EDE3_CFB8 "DES-EDE3-CFB8"
+#define PROV_NAMES_DES_EDE3_CFB1 "DES-EDE3-CFB1"
+#define PROV_NAMES_DES3_WRAP "DES3-WRAP:id-smime-alg-CMS3DESwrap:1.2.840.113549.1.9.16.3.6"
+#define PROV_NAMES_DES_EDE_ECB "DES-EDE-ECB:DES-EDE:1.3.14.3.2.17"
+#define PROV_NAMES_DES_EDE_CBC "DES-EDE-CBC"
+#define PROV_NAMES_DES_EDE_OFB "DES-EDE-OFB"
+#define PROV_NAMES_DES_EDE_CFB "DES-EDE-CFB"
+#define PROV_NAMES_SM4_ECB "SM4-ECB:1.2.156.10197.1.104.1"
+#define PROV_NAMES_SM4_CBC "SM4-CBC:SM4:1.2.156.10197.1.104.2"
+#define PROV_NAMES_SM4_CTR "SM4-CTR:1.2.156.10197.1.104.7"
+#define PROV_NAMES_SM4_OFB "SM4-OFB:SM4-OFB128:1.2.156.10197.1.104.3"
+#define PROV_NAMES_SM4_CFB "SM4-CFB:SM4-CFB128:1.2.156.10197.1.104.4"
+#define PROV_NAMES_ChaCha20 "ChaCha20"
+#define PROV_NAMES_ChaCha20_Poly1305 "ChaCha20-Poly1305"
+#define PROV_NAMES_CAST5_ECB "CAST5-ECB"
+#define PROV_NAMES_CAST5_CBC "CAST5-CBC:CAST-CBC:CAST:1.2.840.113533.7.66.10"
+#define PROV_NAMES_CAST5_OFB "CAST5-OFB"
+#define PROV_NAMES_CAST5_CFB "CAST5-CFB"
+#define PROV_NAMES_BF_ECB "BF-ECB"
+#define PROV_NAMES_BF_CBC "BF-CBC:BF:BLOWFISH:1.3.6.1.4.1.3029.1.2"
+#define PROV_NAMES_BF_OFB "BF-OFB"
+#define PROV_NAMES_BF_CFB "BF-CFB"
+#define PROV_NAMES_IDEA_ECB "IDEA-ECB"
+#define PROV_NAMES_IDEA_CBC "IDEA-CBC:IDEA:1.3.6.1.4.1.188.7.1.1.2"
+#define PROV_NAMES_IDEA_OFB "IDEA-OFB:IDEA-OFB64"
+#define PROV_NAMES_IDEA_CFB "IDEA-CFB:IDEA-CFB64"
+#define PROV_NAMES_SEED_ECB "SEED-ECB:1.2.410.200004.1.3"
+#define PROV_NAMES_SEED_CBC "SEED-CBC:SEED:1.2.410.200004.1.4"
+#define PROV_NAMES_SEED_OFB "SEED-OFB:SEED-OFB128:1.2.410.200004.1.6"
+#define PROV_NAMES_SEED_CFB "SEED-CFB:SEED-CFB128:1.2.410.200004.1.5"
+#define PROV_NAMES_RC2_ECB "RC2-ECB"
+#define PROV_NAMES_RC2_CBC "RC2-CBC:RC2:RC2-128:1.2.840.113549.3.2"
+#define PROV_NAMES_RC2_40_CBC "RC2-40-CBC:RC2-40"
+#define PROV_NAMES_RC2_64_CBC "RC2-64-CBC:RC2-64"
+#define PROV_NAMES_RC2_CFB "RC2-CFB"
+#define PROV_NAMES_RC2_OFB "RC2-OFB"
+#define PROV_NAMES_RC4 "RC4:1.2.840.113549.3.4"
+#define PROV_NAMES_RC4_40 "RC4-40"
+#define PROV_NAMES_RC4_HMAC_MD5 "RC4-HMAC-MD5"
+#define PROV_NAMES_RC5_ECB "RC5-ECB"
+#define PROV_NAMES_RC5_CBC "RC5-CBC:RC5:1.2.840.113549.3.8"
+#define PROV_NAMES_RC5_OFB "RC5-OFB"
+#define PROV_NAMES_RC5_CFB "RC5-CFB"
+#define PROV_NAMES_DESX_CBC "DESX-CBC:DESX"
+#define PROV_NAMES_DES_ECB "DES-ECB:1.3.14.3.2.6"
+#define PROV_NAMES_DES_CBC "DES-CBC:DES:1.3.14.3.2.7"
+#define PROV_NAMES_DES_OFB "DES-OFB:1.3.14.3.2.8"
+#define PROV_NAMES_DES_CFB "DES-CFB:1.3.14.3.2.9"
+#define PROV_NAMES_DES_CFB1 "DES-CFB1"
+#define PROV_NAMES_DES_CFB8 "DES-CFB8"
+
+/*-
+ * Digests
+ * -------
+ */
+#define PROV_NAMES_SHA1 "SHA1:SHA-1:SSL3-SHA1:1.3.14.3.2.26"
+#define PROV_NAMES_SHA2_224 "SHA2-224:SHA-224:SHA224:2.16.840.1.101.3.4.2.4"
+#define PROV_NAMES_SHA2_256 "SHA2-256:SHA-256:SHA256:2.16.840.1.101.3.4.2.1"
+#define PROV_NAMES_SHA2_384 "SHA2-384:SHA-384:SHA384:2.16.840.1.101.3.4.2.2"
+#define PROV_NAMES_SHA2_512 "SHA2-512:SHA-512:SHA512:2.16.840.1.101.3.4.2.3"
+#define PROV_NAMES_SHA2_512_224 "SHA2-512/224:SHA-512/224:SHA512-224:2.16.840.1.101.3.4.2.5"
+#define PROV_NAMES_SHA2_512_256 "SHA2-512/256:SHA-512/256:SHA512-256:2.16.840.1.101.3.4.2.6"
+
+/* We agree with NIST here, so one name only */
+#define PROV_NAMES_SHA3_224 "SHA3-224:2.16.840.1.101.3.4.2.7"
+#define PROV_NAMES_SHA3_256 "SHA3-256:2.16.840.1.101.3.4.2.8"
+#define PROV_NAMES_SHA3_384 "SHA3-384:2.16.840.1.101.3.4.2.9"
+#define PROV_NAMES_SHA3_512 "SHA3-512:2.16.840.1.101.3.4.2.10"
+
+#define PROV_NAMES_SHAKE_128 "SHAKE-128:SHAKE128:2.16.840.1.101.3.4.2.11"
+#define PROV_NAMES_SHAKE_256 "SHAKE-256:SHAKE256:2.16.840.1.101.3.4.2.12"
+
+/*
+ * KECCAK-KMAC-128 and KECCAK-KMAC-256 as hashes are mostly useful for
+ * KMAC128 and KMAC256.
+ */
+#define PROV_NAMES_KECCAK_KMAC_128 "KECCAK-KMAC-128:KECCAK-KMAC128"
+#define PROV_NAMES_KECCAK_KMAC_256 "KECCAK-KMAC-256:KECCAK-KMAC256"
+/*
+ * 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.
+ */
+#define PROV_NAMES_BLAKE2S_256 "BLAKE2S-256:BLAKE2s256:1.3.6.1.4.1.1722.12.2.2.8"
+#define PROV_NAMES_BLAKE2B_512 "BLAKE2B-512:BLAKE2b512:1.3.6.1.4.1.1722.12.2.1.16"
+#define PROV_NAMES_SM3 "SM3:1.2.156.10197.1.401"
+#define PROV_NAMES_MD5 "MD5:SSL3-MD5:1.2.840.113549.2.5"
+#define PROV_NAMES_MD5_SHA1 "MD5-SHA1"
+#define PROV_NAMES_MD2 "MD2:1.2.840.113549.2.2"
+#define PROV_NAMES_MD4 "MD4:1.2.840.113549.2.4"
+#define PROV_NAMES_MDC2 "MDC2:2.5.8.3.101"
+#define PROV_NAMES_WHIRLPOOL "WHIRLPOOL:1.0.10118.3.0.55"
+#define PROV_NAMES_RIPEMD_160 "RIPEMD-160:RIPEMD160:RIPEMD:RMD160:1.3.36.3.2.1"
+
+/*-
+ * KDFs / PRFs
+ * -----------
+ */
+#define PROV_NAMES_HKDF "HKDF"
+#define PROV_DESCS_HKDF_SIGN "OpenSSL HKDF via EVP_PKEY implementation"
+#define PROV_NAMES_SSKDF "SSKDF"
+#define PROV_NAMES_PBKDF2 "PBKDF2:1.2.840.113549.1.5.12"
+#define PROV_NAMES_SSHKDF "SSHKDF"
+#define PROV_NAMES_X963KDF "X963KDF:X942KDF-CONCAT"
+#define PROV_NAMES_X942KDF_ASN1 "X942KDF-ASN1:X942KDF"
+#define PROV_NAMES_TLS1_PRF "TLS1-PRF"
+#define PROV_DESCS_TLS1_PRF_SIGN "OpenSSL TLS1_PRF via EVP_PKEY implementation"
+#define PROV_NAMES_KBKDF "KBKDF"
+#define PROV_NAMES_PKCS12KDF "PKCS12KDF"
+#define PROV_NAMES_SCRYPT "SCRYPT:id-scrypt:1.3.6.1.4.1.11591.4.11"
+#define PROV_DESCS_SCRYPT_SIGN "OpenSSL SCRYPT via EVP_PKEY implementation"
+#define PROV_NAMES_KRB5KDF "KRB5KDF"
+
+/*-
+ * MACs
+ * ----
+ */
+#define PROV_NAMES_HMAC "HMAC"
+#define PROV_DESCS_HMAC_SIGN "OpenSSL HMAC via EVP_PKEY implementation"
+#define PROV_NAMES_CMAC "CMAC"
+#define PROV_DESCS_CMAC_SIGN "OpenSSL CMAC via EVP_PKEY implementation"
+#define PROV_NAMES_SIPHASH "SIPHASH"
+#define PROV_DESCS_SIPHASH_SIGN "OpenSSL SIPHASH via EVP_PKEY implementation"
+#define PROV_NAMES_POLY1305 "POLY1305"
+#define PROV_DESCS_POLY1305_SIGN "OpenSSL POLY1305 via EVP_PKEY implementation"
+#define PROV_NAMES_GMAC "GMAC:1.0.9797.3.4"
+#define PROV_NAMES_KMAC_128 "KMAC-128:KMAC128:2.16.840.1.101.3.4.2.19"
+#define PROV_NAMES_KMAC_256 "KMAC-256:KMAC256:2.16.840.1.101.3.4.2.20"
+#define PROV_NAMES_BLAKE2BMAC "BLAKE2BMAC:1.3.6.1.4.1.1722.12.2.1"
+#define PROV_NAMES_BLAKE2SMAC "BLAKE2SMAC:1.3.6.1.4.1.1722.12.2.2"
+
+/*-
+ * RANDs
+ * -----
+ */
+#define PROV_NAMES_CTR_DRBG "CTR-DRBG"
+#define PROV_NAMES_HASH_DRBG "HASH-DRBG"
+#define PROV_NAMES_HMAC_DRBG "HMAC-DRBG"
+#define PROV_NAMES_TEST_RAND "TEST-RAND"
+#define PROV_NAMES_SEED_SRC "SEED-SRC"
+
+/*-
+ * Asymmetric algos
+ * ----------------
+ */
+#define PROV_NAMES_EC "EC:id-ecPublicKey:1.2.840.10045.2.1"
+#define PROV_DESCS_EC "OpenSSL EC implementation"
+#define PROV_NAMES_ECDH "ECDH"
+#define PROV_DESCS_ECDH "OpenSSL ECDH implementation"
+#define PROV_NAMES_ECDSA "ECDSA"
+#define PROV_DESCS_ECDSA "OpenSSL ECDSA implementation"
+#define PROV_NAMES_X25519 "X25519:1.3.101.110"
+#define PROV_DESCS_X25519 "OpenSSL X25519 implementation"
+#define PROV_NAMES_X448 "X448:1.3.101.111"
+#define PROV_DESCS_X448 "OpenSSL X448 implementation"
+#define PROV_NAMES_ED25519 "ED25519:1.3.101.112"
+#define PROV_DESCS_ED25519 "OpenSSL ED25519 implementation"
+#define PROV_NAMES_ED448 "ED448:1.3.101.113"
+#define PROV_DESCS_ED448 "OpenSSL ED448 implementation"
+#define PROV_NAMES_DH "DH:dhKeyAgreement:1.2.840.113549.1.3.1"
+#define PROV_DESCS_DH "OpenSSL PKCS#3 DH implementation"
+#define PROV_NAMES_DHX "DHX:X9.42 DH:dhpublicnumber:1.2.840.10046.2.1"
+#define PROV_DESCS_DHX "OpenSSL X9.42 DH implementation"
+#define PROV_NAMES_DSA "DSA:dsaEncryption:1.2.840.10040.4.1"
+#define PROV_DESCS_DSA "OpenSSL DSA implementation"
+#define PROV_NAMES_RSA "RSA:rsaEncryption:1.2.840.113549.1.1.1"
+#define PROV_DESCS_RSA "OpenSSL RSA implementation"
+#define PROV_NAMES_RSA_PSS "RSA-PSS:RSASSA-PSS:1.2.840.113549.1.1.10"
+#define PROV_DESCS_RSA_PSS "OpenSSL RSA-PSS implementation"
+#define PROV_NAMES_SM2 "SM2:1.2.156.10197.1.301"
+#define PROV_DESCS_SM2 "OpenSSL SM2 implementation"
diff --git a/providers/implementations/keymgmt/mac_legacy_kmgmt.c b/providers/implementations/keymgmt/mac_legacy_kmgmt.c
index 06e0bfb521..c33ed3e2c2 100644
--- a/providers/implementations/keymgmt/mac_legacy_kmgmt.c
+++ b/providers/implementations/keymgmt/mac_legacy_kmgmt.c
@@ -547,7 +547,7 @@ const OSSL_DISPATCH ossl_mac_legacy_keymgmt_functions[] = {
{ 0, NULL }
};
-const OSSL_DISPATCH ossl_cossl_mac_legacy_keymgmt_functions[] = {
+const OSSL_DISPATCH ossl_cmac_legacy_keymgmt_functions[] = {
{ OSSL_FUNC_KEYMGMT_NEW, (void (*)(void))mac_new_cmac },
{ OSSL_FUNC_KEYMGMT_FREE, (void (*)(void))mac_free },
{ OSSL_FUNC_KEYMGMT_GET_PARAMS, (void (*) (void))mac_get_params },
diff --git a/providers/legacyprov.c b/providers/legacyprov.c
index e3690e0559..ddb2158d5a 100644
--- a/providers/legacyprov.c
+++ b/providers/legacyprov.c
@@ -15,6 +15,7 @@
#include <openssl/params.h>
#include "prov/provider_ctx.h"
#include "prov/implementations.h"
+#include "prov/names.h"
#include "prov/providercommon.h"
/*
@@ -67,77 +68,77 @@ static int legacy_get_params(void *provctx, OSSL_PARAM params[])
static const OSSL_ALGORITHM legacy_digests[] = {
#ifndef OPENSSL_NO_MD2
- ALG("MD2", ossl_md2_functions),
+ ALG(PROV_NAMES_MD2, ossl_md2_functions),
#endif
#ifndef OPENSSL_NO_MD4
- ALG("MD4", ossl_md4_functions),
+ ALG(PROV_NAMES_MD4, ossl_md4_functions),
#endif
#ifndef OPENSSL_NO_MDC2
- ALG("MDC2", ossl_mdc2_functions),
+ ALG(PROV_NAMES_MDC2, ossl_mdc2_functions),
#endif /* OPENSSL_NO_MDC2 */
#ifndef OPENSSL_NO_WHIRLPOOL
- ALG("WHIRLPOOL", ossl_wp_functions),
+ ALG(PROV_NAMES_WHIRLPOOL, ossl_wp_functions),
#endif /* OPENSSL_NO_WHIRLPOOL */
#ifndef OPENSSL_NO_RMD160
- ALG("RIPEMD-160:RIPEMD160:RIPEMD:RMD160", ossl_ripemd160_functions),
+ ALG(PROV_NAMES_RIPEMD_160, ossl_ripemd160_functions),
#endif /* OPENSSL_NO_RMD160 */
{ NULL, NULL, NULL }
};
static const OSSL_ALGORITHM legacy_ciphers[] = {
#ifndef OPENSSL_NO_CAST
- ALG("CAST5-ECB", ossl_cast5128ecb_functions),
- ALG("CAST5-CBC:CAST-CBC:CAST", ossl_cast5128cbc_functions),
- ALG("CAST5-OFB", ossl_cast5128ofb64_functions),
- ALG("CAST5-CFB", ossl_cast5128cfb64_functions),
+ ALG(PROV_NAMES_CAST5_ECB, ossl_cast5128ecb_functions),
+ ALG(PROV_NAMES_CAST5_CBC, ossl_cast5128cbc_functions),
+ ALG(PROV_NAMES_CAST5_OFB, ossl_cast5128ofb64_functions),
+ ALG(PROV_NAMES_CAST5_CFB, ossl_cast5128cfb64_functions),
#endif /* OPENSSL_NO_CAST */
#ifndef OPENSSL_NO_BF
- ALG("BF-ECB", ossl_blowfish128ecb_functions),
- ALG("BF-CBC:BF:BLOWFISH", ossl_blowfish128cbc_functions),
- ALG("BF-OFB", ossl_blowfish64ofb64_functions),
- ALG("BF-CFB", ossl_blowfish64cfb64_functions),
+ ALG(PROV_NAMES_BF_ECB, ossl_blowfish128ecb_functions),
+ ALG(PROV_NAMES_BF_CBC, ossl_blowfish128cbc_functions),
+ ALG(PROV_NAMES_BF_OFB, ossl_blowfish64ofb64_functions),
+ ALG(PROV_NAMES_BF_CFB, ossl_blowfish64cfb64_functions),
#endif /* OPENSSL_NO_BF */
#ifndef OPENSSL_NO_IDEA
- ALG("IDEA-ECB", ossl_idea128ecb_functions),
- ALG("IDEA-CBC:IDEA", ossl_idea128cbc_functions),
- ALG("IDEA-OFB:IDEA-OFB64", ossl_idea128ofb64_functions),
- ALG("IDEA-CFB:IDEA-CFB64", ossl_idea128cfb64_functions),
+ ALG(PROV_NAMES_IDEA_ECB, ossl_idea128ecb_functions),
+ ALG(PROV_NAMES_IDEA_CBC, ossl_idea128cbc_functions),
+ ALG(PROV_NAMES_IDEA_OFB, ossl_idea128ofb64_functions),
+ ALG(PROV_NAMES_IDEA_CFB, ossl_idea128cfb64_functions),
#endif /* OPENSSL_NO_IDEA */
#ifndef OPENSSL_NO_SEED
- ALG("SEED-ECB", ossl_seed128ecb_functions),
- ALG("SEED-CBC:SEED", ossl_seed128cbc_functions),
- ALG("SEED-OFB:SEED-OFB128", ossl_seed128ofb128_functions),
- ALG("SEED-CFB:SEED-CFB128", ossl_seed128cfb128_functions),
+ ALG(PROV_NAMES_SEED_ECB, ossl_seed128ecb_functions),
+ ALG(PROV_NAMES_SEED_CBC, ossl_seed128cbc_functions),
+ ALG(PROV_NAMES_SEED_OFB, ossl_seed128ofb128_functions),
+ ALG(PROV_NAMES_SEED_CFB, ossl_seed128cfb128_functions),
#endif /* OPENSSL_NO_SEED */
#ifndef OPENSSL_NO_RC2
- ALG("RC2-ECB", ossl_rc2128ecb_functions),
- ALG("RC2-CBC:RC2:RC2-128", ossl_rc2128cbc_functions),
- ALG("RC2-40-CBC:RC2-40", ossl_rc240cbc_functions),
- ALG("RC2-64-CBC:RC2-64", ossl_rc264cbc_functions),
- ALG("RC2-CFB", ossl_rc2128cfb128_functions),
- ALG("RC2-OFB", ossl_rc2128ofb128_functions),
+ ALG(PROV_NAMES_RC2_ECB, ossl_rc2128ecb_functions),
+ ALG(PROV_NAMES_RC2_CBC, ossl_rc2128cbc_functions),
+ ALG(PROV_NAMES_RC2_40_CBC, ossl_rc240cbc_functions),
+ ALG(PROV_NAMES_RC2_64_CBC, ossl_rc264cbc_functions),
+ ALG(PROV_NAMES_RC2_CFB, ossl_rc2128cfb128_functions),
+ ALG(PROV_NAMES_RC2_OFB, ossl_rc2128ofb128_functions),
#endif /* OPENSSL_NO_RC2 */
#ifndef OPENSSL_NO_RC4
- ALG("RC4", ossl_rc4128_functions),
- ALG("RC4-40", ossl_rc440_functions),
+ ALG(PROV_NAMES_RC4, ossl_rc4128_functions),
+ ALG(PROV_NAMES_RC4_40, ossl_rc440_functions),
# ifndef OPENSSL_NO_MD5
- ALG("RC4-HMAC-MD5", ossl_rc4_hmac_ossl_md5_functions),
+ ALG(PROV_NAMES_RC4_HMAC_MD5, ossl_rc4_hmac_ossl_md5_functions),
# endif /* OPENSSL_NO_MD5 */
#endif /* OPENSSL_NO_RC4 */
#ifndef OPENSSL_NO_RC5
- ALG("RC5-ECB", ossl_rc5128ecb_functions),
- ALG("RC5-CBC:RC5", ossl_rc5128cbc_functions),
- ALG("RC5-OFB", ossl_rc5128ofb64_functions),
- ALG("RC5-CFB", ossl_rc5128cfb64_functions),
+ ALG(PROV_NAMES_RC5_ECB, ossl_rc5128ecb_functions),
+ ALG(PROV_NAMES_RC5_CBC, ossl_rc5128cbc_functions),
+ ALG(PROV_NAMES_RC5_OFB, ossl_rc5128ofb64_functions),
+ ALG(PROV_NAMES_RC5_CFB, ossl_rc5128cfb64_functions),
#endif /* OPENSSL_NO_RC5 */
#ifndef OPENSSL_NO_DES
- ALG("DESX-CBC:DESX", ossl_tdes_desx_cbc_functions),
- ALG("DES-ECB", ossl_des_ecb_functions),
- ALG("DES-CBC:DES", ossl_des_cbc_functions),
- ALG("DES-OFB", ossl_des_ofb64_functions),
- ALG("DES-CFB", ossl_des_cfb64_functions),
- ALG("DES-CFB1", ossl_des_cfb1_functions),
- ALG("DES-CFB8", ossl_des_cfb8_functions),
+ ALG(PROV_NAMES_DESX_CBC, ossl_tdes_desx_cbc_functions),
+ ALG(PROV_NAMES_DES_ECB, ossl_des_ecb_functions),
+ ALG(PROV_NAMES_DES_CBC, ossl_des_cbc_functions),
+ ALG(PROV_NAMES_DES_OFB, ossl_des_ofb64_functions),
+ ALG(PROV_NAMES_DES_CFB, ossl_des_cfb64_functions),
+ ALG(PROV_NAMES_DES_CFB1, ossl_des_cfb1_functions),
+ ALG(PROV_NAMES_DES_CFB8, ossl_des_cfb8_functions),
#endif /* OPENSSL_NO_DES */
{ NULL, NULL, NULL }
};
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c
index 2e061e3dd3..a9eec323a0 100644
--- a/test/evp_extra_test.c
+++ b/test/evp_extra_test.c
@@ -1362,7 +1362,7 @@ static int test_EVP_SM2(void)
EVP_MD_CTX *md_ctx = NULL;
EVP_MD_CTX *md_ctx_verify = NULL;
EVP_PKEY_CTX *cctx = NULL;
- EVP_MD *sm3 = NULL;
+ EVP_MD *check_md = NULL;
uint8_t ciphertext[128];
size_t ctext_len = sizeof(ciphertext);
@@ -1375,10 +1375,10 @@ static int test_EVP_SM2(void)
OSSL_PARAM sparams[2] = {OSSL_PARAM_END, OSSL_PARAM_END};
OSSL_PARAM gparams[2] = {OSSL_PARAM_END, OSSL_PARAM_END};
int i;
- char mdname[20];
+ char mdname[OSSL_MAX_NAME_SIZE];
- pctx = EVP_PKEY_CTX_new_from_name(testctx, "SM2", testpropq);
- if (!TEST_ptr(pctx))
+ if (!TEST_ptr(pctx = EVP_PKEY_CTX_new_from_name(testctx,
+ "SM2", testpropq)))
goto done;
if (!TEST_true(EVP_PKEY_paramgen_init(pctx) == 1))
@@ -1390,8 +1390,8 @@ static int test_EVP_SM2(void)
if (!TEST_true(EVP_PKEY_paramgen(pctx, &pkeyparams)))
goto done;
- kctx = EVP_PKEY_CTX_new_from_pkey(testctx, pkeyparams, testpropq);
- if (!TEST_ptr(kctx))
+ if (!TEST_ptr(kctx = EVP_PKEY_CTX_new_from_pkey(testctx,
+ pkeyparams, testpropq)))
goto done;
if (!TEST_true(EVP_PKEY_keygen_init(kctx)))
@@ -1412,16 +1412,16 @@ static int test_EVP_SM2(void)
EVP_MD_CTX_set_pkey_ctx(md_ctx, sctx);
EVP_MD_CTX_set_pkey_ctx(md_ctx_verify, sctx);
- if (!TEST_ptr(sm3 = EVP_MD_fetch(testctx, "sm3", testpropq)))
+ if (!TEST_ptr(check_md = EVP_MD_fetch(testctx, "sm3", testpropq)))
goto done;
- if (!TEST_true(EVP_DigestSignInit(md_ctx, NULL, sm3, NULL, pkey)))
+ if (!TEST_true(EVP_DigestSignInit(md_ctx, NULL, check_md, NULL, pkey)))
goto done;
if (!TEST_int_gt(EVP_PKEY_CTX_set1_id(sctx, sm2_id, sizeof(sm2_id)), 0))
goto done;
- if(!TEST_true(EVP_DigestSignUpdate(md_ctx, kMsg, sizeof(kMsg))))
+ if (!TEST_true(EVP_DigestSignUpdate(md_ctx, kMsg, sizeof(kMsg))))
goto done;
/* Determine the size of the signature. */
@@ -1436,7 +1436,8 @@ static int test_EVP_SM2(void)
/* Ensure that the signature round-trips. */
- if (!TEST_true(EVP_DigestVerifyInit(md_ctx_verify, NULL, sm3, NULL, pkey)))
+ if (!TEST_true(EVP_DigestVerifyInit(md_ctx_verify, NULL, check_md, NULL,
+ pkey)))
goto done;
if (!TEST_int_gt(EVP_PKEY_CTX_set1_id(sctx, sm2_id, sizeof(sm2_id)), 0))
@@ -1453,13 +1454,24 @@ static int test_EVP_SM2(void)
gparams[0] = OSSL_PARAM_construct_utf8_string(OSSL_ASYM_CIPHER_PARAM_DIGEST,
mdname, sizeof(mdname));
for (i = 0; i < 2; i++) {
+ const char *mdnames[] = {
+#ifndef OPENSSL_NO_SM3
+ "SM3",
+#else
+ NULL,
+#endif
+ "SHA2-256" };
EVP_PKEY_CTX_free(cctx);
- sparams[0] = OSSL_PARAM_construct_utf8_string(OSSL_ASYM_CIPHER_PARAM_DIGEST,
- i == 0 ? "SM3" : "SHA2-256",
- 0);
+ if (mdnames[i] == NULL)
+ continue;
- if (!TEST_ptr(cctx = EVP_PKEY_CTX_new_from_pkey(testctx, pkey, testpropq)))
+ sparams[0] =
+ OSSL_PARAM_construct_utf8_string(OSSL_ASYM_CIPHER_PARAM_DIGEST,
+ (char *)mdnames[i], 0);
+
+ if (!TEST_ptr(cctx = EVP_PKEY_CTX_new_from_pkey(testctx,
+ pkey, testpropq)))
goto done;
if (!TEST_true(EVP_PKEY_encrypt_init(cctx)))
@@ -1485,11 +1497,18 @@ static int test_EVP_SM2(void)
if (!TEST_true(EVP_PKEY_CTX_get_params(cctx, gparams)))
goto done;
- /* Test we're still using the digest we think we are */
- if (i == 0 && !TEST_int_eq(strcmp(mdname, "SM3"), 0))
+ /*
+ * Test we're still using the digest we think we are.
+ * Because of aliases, the easiest is to fetch the digest and
+ * check the name with EVP_MD_is_a().
+ */
+ EVP_MD_free(check_md);
+ if (!TEST_ptr(check_md = EVP_MD_fetch(testctx, mdname, testpropq)))
goto done;
- if (i == 1 && !TEST_int_eq(strcmp(mdname, "SHA2-256"), 0))
+ if (!TEST_true(EVP_MD_is_a(check_md, mdnames[i]))) {
+ TEST_info("Fetched md %s isn't %s", mdname, mdnames[i]);
goto done;
+ }
if (!TEST_true(ptext_len == sizeof(kMsg)))
goto done;
@@ -1508,7 +1527,7 @@ done:
EVP_PKEY_free(pkeyparams);
EVP_MD_CTX_free(md_ctx);
EVP_MD_CTX_free(md_ctx_verify);
- EVP_MD_free(sm3);
+ EVP_MD_free(check_md);
OPENSSL_free(sig);
return ret;
}
diff --git a/test/evp_fetch_prov_test.c b/test/evp_fetch_prov_test.c
index a644390917..9cb4c4d4c7 100644
--- a/test/evp_fetch_prov_test.c
+++ b/test/evp_fetch_prov_test.c
@@ -18,6 +18,7 @@
#include <openssl/sha.h>
#include <openssl/evp.h>
#include <openssl/provider.h>
+#include "internal/sizes.h"
#include "testutil.h"
static char *config_file = NULL;
@@ -105,15 +106,39 @@ err:
return ret;
}
+static void unload_providers(OSSL_LIB_CTX **libctx, OSSL_PROVIDER *prov[])
+{
+ if (prov[0] != NULL)
+ OSSL_PROVIDER_unload(prov[0]);
+ if (prov[1] != NULL)
+ OSSL_PROVIDER_unload(prov[1]);
+ /* Not normally needed, but we would like to test that
+ * OPENSSL_thread_stop_ex() behaves as expected.
+ */
+ if (libctx != NULL && *libctx != NULL) {
+ OPENSSL_thread_stop_ex(*libctx);
+ OSSL_LIB_CTX_free(*libctx);
+ }
+}
+
+static X509_ALGOR *make_algor(int nid)
+{
+ X509_ALGOR *algor;
+
+ if (!TEST_ptr(algor = X509_ALGOR_new())
+ || !TEST_true(X509_ALGOR_set0(algor, OBJ_nid2obj(nid),
+ V_ASN1_UNDEF, NULL))) {
+ X509_ALGOR_free(algor);
+ return NULL;
+ }
+ return algor;
+}
+
/*
* Test EVP_MD_fetch()
*/
-static int test_EVP_MD_fetch(void)
+static int test_md(const EVP_MD *md)
{
- OSSL_LIB_CTX *ctx = NULL;
- EVP_MD *md = NULL;
- OSSL_PROVIDER *prov[2] = {NULL, NULL};
- int ret = 0;
const char testmsg[] = "Hello world";
const unsigned char exptd[] = {
0x27, 0x51, 0x8b, 0xa9, 0x68, 0x30, 0x11, 0xf6, 0xb3, 0x96, 0x07, 0x2c,
@@ -121,25 +146,40 @@ static int test_EVP_MD_fetch(void)
0x90, 0xec, 0x60, 0x6e, 0x50, 0x92, 0xe3, 0x26
};
- if (use_default_ctx == 0 && !load_providers(&ctx, prov))
- goto err;
+ return TEST_ptr(md)
+ && TEST_true(EVP_MD_is_a(md, "SHA256"))
+ && TEST_true(calculate_digest(md, testmsg, sizeof(testmsg), exptd))
+ && TEST_int_eq(EVP_MD_size(md), SHA256_DIGEST_LENGTH)
+ && TEST_int_eq(EVP_MD_block_size(md), SHA256_CBLOCK);
+}
+
+static int test_implicit_EVP_MD_fetch(void)
+{
+ OSSL_LIB_CTX *ctx = NULL;
+ OSSL_PROVIDER *prov[2] = {NULL, NULL};
+ int ret = 0;
+
+ ret = (use_default_ctx == 0 || load_providers(&ctx, prov))
+ && test_md(EVP_sha256());
- /* Implicit fetching of the MD should produce the expected result */
- if (!TEST_true(calculate_digest(EVP_sha256(), testmsg, sizeof(testmsg),
- exptd))
- || !TEST_int_eq(EVP_MD_size(EVP_sha256()), SHA256_DIGEST_LENGTH)
- || !TEST_int_eq(EVP_MD_block_size(EVP_sha256()), SHA256_CBLOCK))
+ unload_providers(&ctx, prov);
+ return ret;
+}
+
+static int test_explicit_EVP_MD_fetch(const char *id)
+{
+ OSSL_LIB_CTX *ctx = NULL;
+ EVP_MD *md = NULL;
+ OSSL_PROVIDER *prov[2] = {NULL, NULL};
+ int ret = 0;
+
+ if (use_default_ctx == 0 && !load_providers(&ctx, prov))
goto err;
- /* Fetch the digest from a provider using properties. */
- md = EVP_MD_fetch(ctx, "SHA256", fetch_property);
+ md = EVP_MD_fetch(ctx, id, fetch_property);
if (expected_fetch_result != 0) {
- if (!TEST_ptr(md)
- || !TEST_int_eq(EVP_MD_nid(md), NID_sha256)
- || !TEST_true(calculate_digest(md, testmsg, sizeof(testmsg), exptd))
- || !TEST_int_eq(EVP_MD_size(md), SHA256_DIGEST_LENGTH)
- || !TEST_int_eq(EVP_MD_block_size(md), SHA256_CBLOCK))
- goto err;
+ if (!test_md(md))
+ goto err;
/* Also test EVP_MD_up_ref() while we're doing this */
if (!TEST_true(EVP_MD_up_ref(md)))
@@ -152,20 +192,52 @@ static int test_EVP_MD_fetch(void)
}
ret = 1;
-err:
+ err:
EVP_MD_free(md);
- OSSL_PROVIDER_unload(prov[0]);
- OSSL_PROVIDER_unload(prov[1]);
- /* Not normally needed, but we would like to test that
- * OPENSSL_thread_stop_ex() behaves as expected.
- */
- if (ctx != NULL) {
- OPENSSL_thread_stop_ex(ctx);
- OSSL_LIB_CTX_free(ctx);
+ unload_providers(&ctx, prov);
+ return ret;
+}
+
+static int test_explicit_EVP_MD_fetch_by_name(void)
+{
+ return test_explicit_EVP_MD_fetch("SHA256");
+}
+
+/*
+ * idx 0: Allow names from OBJ_obj2txt()
+ * idx 1: Force an OID in text form from OBJ_obj2txt()
+ */
+static int test_explicit_EVP_MD_fetch_by_X509_ALGOR(int idx)
+{
+ int ret = 0;
+ X509_ALGOR *algor = make_algor(NID_sha256);
+ const ASN1_OBJECT *obj;
+ char id[OSSL_MAX_NAME_SIZE];
+
+ if (algor == NULL)
+ return 0;
+
+ X509_ALGOR_get0(&obj, NULL, NULL, algor);
+ switch (idx) {
+ case 0:
+ if (!TEST_true(OBJ_obj2txt(id, sizeof(id), obj, 0)))
+ goto end;
+ break;
+ case 1:
+ if (!TEST_true(OBJ_obj2txt(id, sizeof(id), obj, 1)))
+ goto end;
+ break;
}
+
+ ret = test_explicit_EVP_MD_fetch(id);
+ end:
+ X509_ALGOR_free(algor);
return ret;
}
+/*
+ * Test EVP_CIPHER_fetch()
+ */
static int encrypt_decrypt(const EVP_CIPHER *cipher, const unsigned char *msg,
size_t len)
{
@@ -191,34 +263,46 @@ err:
return ret;
}
-/*
- * Test EVP_CIPHER_fetch()
- */
-static int test_EVP_CIPHER_fetch(void)
+static int test_cipher(const EVP_CIPHER *cipher)
+{
+ const unsigned char testmsg[] = "Hello world";
+
+ return TEST_ptr(cipher)
+ && TEST_true(encrypt_decrypt(cipher, testmsg, sizeof(testmsg)));
+}
+
+static int test_implicit_EVP_CIPHER_fetch(void)
+{
+ OSSL_LIB_CTX *ctx = NULL;
+ OSSL_PROVIDER *prov[2] = {NULL, NULL};
+ int ret = 0;
+
+ ret = (use_default_ctx == 0 || load_providers(&ctx, prov))
+ && test_cipher(EVP_aes_128_cbc());
+
+ unload_providers(&ctx, prov);
+ return ret;
+}
+
+static int test_explicit_EVP_CIPHER_fetch(const char *id)
{
OSSL_LIB_CTX *ctx = NULL;
EVP_CIPHER *cipher = NULL;
OSSL_PROVIDER *prov[2] = {NULL, NULL};
int ret = 0;
- const unsigned char testmsg[] = "Hello world";
if (use_default_ctx == 0 && !load_providers(&ctx, prov))
goto err;
- /* Implicit fetching of the cipher should produce the expected result */
- if (!TEST_true(encrypt_decrypt(EVP_aes_128_cbc(), testmsg, sizeof(testmsg))))
- goto err;
-
- /* Fetch the cipher from a provider using properties. */
- cipher = EVP_CIPHER_fetch(ctx, "AES-128-CBC", fetch_property);
+ cipher = EVP_CIPHER_fetch(ctx, id, fetch_property);
if (expected_fetch_result != 0) {
- if (!TEST_ptr(cipher)
- || !TEST_true(encrypt_decrypt(cipher, testmsg, sizeof(testmsg)))) {
- if (!TEST_true(EVP_CIPHER_up_ref(cipher)))
- goto err;
- /* Ref count should now be 2. Release first one here */
- EVP_CIPHER_free(cipher);
- }
+ if (!test_cipher(cipher))
+ goto err;
+
+ if (!TEST_true(EVP_CIPHER_up_ref(cipher)))
+ goto err;
+ /* Ref count should now be 2. Release first one here */
+ EVP_CIPHER_free(cipher);
} else {
if (!TEST_ptr_null(cipher))
goto err;
@@ -226,9 +310,44 @@ static int test_EVP_CIPHER_fetch(void)
ret = 1;
err:
EVP_CIPHER_free(cipher);
- OSSL_PROVIDER_unload(prov[0]);
- OSSL_PROVIDER_unload(prov[1]);
- OSSL_LIB_CTX_free(ctx);
+ unload_providers(&ctx, prov);
+ return ret;
+}
+
+static int test_explicit_EVP_CIPHER_fetch_by_name(void)
+{
+ return test_explicit_EVP_CIPHER_fetch("AES-128-CBC");
+}
+
+/*
+ * idx 0: Allow names from OBJ_obj2txt()
+ * idx 1: Force an OID in text form from OBJ_obj2txt()
+ */
+static int test_explicit_EVP_CIPHER_fetch_by_X509_ALGOR(int idx)
+{
+ int ret = 0;
+ X509_ALGOR *algor = make_algor(NID_aes_128_cbc);
+ const ASN1_OBJECT *obj;
+ char id[OSSL_MAX_NAME_SIZE];
+
+ if (algor == NULL)
+ return 0;
+
+ X509_ALGOR_get0(&obj, NULL, NULL, algor);
+ switch (idx) {
+ case 0:
+ if (!TEST_true(OBJ_obj2txt(id, sizeof(id), obj, 0)))
+ goto end;
+ break;
+ case 1:
+ if (!TEST_true(OBJ_obj2txt(id, sizeof(id), obj, 1)))
+ goto end;
+ break;
+ }
+
+ ret = test_explicit_EVP_CIPHER_fetch(id);
+ end:
+ X509_ALGOR_free(algor);
return ret;
}
@@ -260,9 +379,14 @@ int setup_tests(void)
return 0;
}
}
- if (strcmp(alg, "digest") == 0)
- ADD_TEST(test_EVP_MD_fetch);
- else
- ADD_TEST(test_EVP_CIPHER_fetch);
+ if (strcmp(alg, "digest") == 0) {
+ ADD_TEST(test_implicit_EVP_MD_fetch);
+ ADD_TEST(test_explicit_EVP_MD_fetch_by_name);
+ ADD_ALL_TESTS_NOSUBTEST(test_explicit_EVP_MD_fetch_by_X509_ALGOR, 2);
+ } else {
+ ADD_TEST(test_implicit_EVP_CIPHER_fetch);
+ ADD_TEST(test_explicit_EVP_CIPHER_fetch_by_name);
+ ADD_ALL_TESTS_NOSUBTEST(test_explicit_EVP_CIPHER_fetch_by_X509_ALGOR, 2);
+ }
return 1;
}
diff --git a/test/testutil/driver.c b/test/testutil/driver.c
index 700f77fd6b..0b50e2ae16 100644
--- a/test/testutil/driver.c
+++ b/test/testutil/driver.c
@@ -48,7 +48,7 @@ static int rand_order = 0;
/*
* A parameterised test runs a loop of test cases.
- * |num_test_cases| counts the total number of test cases
+ * |num_test_cases| counts the total number of non-subtest test cases
* across all tests.
*/
static int num_test_cases = 0;
@@ -75,7 +75,10 @@ void add_all_tests(const char *test_case_name, int(*test_fn)(int idx),
all_tests[num_tests].num = num;
all_tests[num_tests].subtest = subtest;
++num_tests;
- num_test_cases += num;
+ if (subtest)
+ ++num_test_cases;
+ else
+ num_test_cases += num;
}
static int gcd(int a, int b)
@@ -278,6 +281,8 @@ int run_tests(const char *test_prog_name)
int num_failed = 0;
int verdict = 1;
int ii, i, jj, j, jstep;
+ int test_case_count = 0;
+ int subtest_case_count = 0;
int permute[OSSL_NELEM(all_tests)];
i = process_shared_options();
@@ -293,7 +298,7 @@ int run_tests(const char *test_prog_name)
test_printf_stdout("Subtest: %s\n", test_prog_name);
test_flush_stdout();
}
- test_printf_tapout("1..%d\n", num_tests);
+ test_printf_tapout("1..%d\n", num_test_cases);
}
test_flush_tapout();
@@ -328,21 +333,24 @@ int run_tests(const char *test_prog_name)
set_test_title(all_tests[i].test_case_name);
verdict = all_tests[i].test_fn();
finalize(verdict != 0);
- test_verdict(verdict, "%d - %s", ii + 1, test_title);
+ test_verdict(verdict, "%d - %s", test_case_count + 1, test_title);
if (verdict == 0)
num_failed++;
+ test_case_count++;
} else {
int num_failed_inner = 0;
verdict = TEST_SKIP_CODE;
- level += 4;
- test_adjust_streams_tap_level(level);
- if (all_tests[i].subtest && single_iter == -1) {
- test_printf_stdout("Subtest: %s\n",
- all_tests[i].test_case_name);
- test_printf_tapout("%d..%d\n", 1, all_tests[i].num);
- test_flush_stdout();
- test_flush_tapout();
+ set_test_title(all_tests[i].test_case_name);
+ if (all_tests[i].subtest) {
+ level += 4;
+ test_adjust_streams_tap_level(level);
+ if (single_iter == -1) {
+ test_printf_stdout("Subtest: %s\n", test_title);
+ test_printf_tapout("%d..%d\n", 1, all_tests[i].num);
+ test_flush_stdout();
+ test_flush_tapout();
+ }
}
j = -1;
@@ -359,7 +367,6 @@ int run_tests(const char *test_prog_name)
j = (j + jstep) % all_tests[i].num;
if (single_iter != -1 && ((jj + 1) != single_iter))
continue;
- set_test_title(NULL);
v = all_tests[i].param_test_fn(j);
if (v == 0) {
@@ -371,20 +378,26 @@ int run_tests(const char *test_prog_name)
finalize(v != 0);
- if (all_tests[i].subtest) {
- if (test_title != NULL)
- test_verdict(v, "%d - %s", jj + 1, test_title);
- else
- test_verdict(v, "%d - iteration %d", jj + 1, j + 1);
- }
+ if (all_tests[i].subtest)
+ test_verdict(v, "%d - iteration %d",
+ subtest_case_count + 1, j + 1);
+ else
+ test_verdict(v, "%d - %s - iteration %d",
+ test_case_count + subtest_case_count + 1,
+ test_title, j + 1);
+ subtest_case_count++;
}
- level -= 4;
- test_adjust_streams_tap_level(level);
+ if (all_tests[i].subtest) {
+ level -= 4;
+ test_adjust_streams_tap_level(level);
+ }
if (verdict == 0)
++num_failed;
- test_verdict(verdict, "%d - %s", ii + 1,
- all_tests[i].test_case_name);
+ if (all_tests[i].num == -1 || all_tests[i].subtest)
+ test_verdict(verdict, "%d - %s", test_case_count + 1,
+ all_tests[i].test_case_name);
+ test_case_count++;
}
}
if (num_failed != 0)
More information about the openssl-commits
mailing list