summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-10-21 10:57:52 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-10-22 20:42:42 +1000
commit42445046354a4ac7671143600e888c6b230e56ff (patch)
tree5b911261f6fe7607ba06a1035f5a1ab01cdc67b4
parent3d914185b7830a5530b31d3430c9cc16835aeb02 (diff)
Remove ossl_prov_util_nid_to_name()
This removes a TODO. This function is not needed since any place that needs to do the conversion normally has a special case name2nid table. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13202)
-rw-r--r--doc/internal/man3/ossl_prov_util_nid_to_name.pod35
-rw-r--r--providers/common/build.info2
-rw-r--r--providers/common/include/prov/providercommon.h2
-rw-r--r--providers/common/nid_to_name.c21
-rw-r--r--providers/fips/fipsprov.c98
5 files changed, 1 insertions, 157 deletions
diff --git a/doc/internal/man3/ossl_prov_util_nid_to_name.pod b/doc/internal/man3/ossl_prov_util_nid_to_name.pod
deleted file mode 100644
index 31eec076c5..0000000000
--- a/doc/internal/man3/ossl_prov_util_nid_to_name.pod
+++ /dev/null
@@ -1,35 +0,0 @@
-=pod
-
-=head1 NAME
-
-ossl_prov_util_nid_to_name
-- provider utility functions
-
-=head1 SYNOPSIS
-
- #include "prov/providercommon.h"
-
- const char *ossl_prov_util_nid_to_name(int nid);
-
-=head1 DESCRIPTION
-
-The ossl_prov_util_nid_to_name() returns the name of an algorithm given a NID
-in the I<nid> parameter. For the default and legacy providers it is equivalent
-to calling OBJ_nid2sn(). The FIPS provider does not have the object database
-code available to it (because that code relies on the ASN.1 code), so this
-function is a static lookup of all known FIPS algorithm NIDs.
-
-=head1 RETURN VALUES
-
-Returns a pointer to the algorithm name, or NULL on error.
-
-=head1 COPYRIGHT
-
-Copyright 2019 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
-L<https://www.openssl.org/source/license.html>.
-
-=cut
diff --git a/providers/common/build.info b/providers/common/build.info
index 2179b2a0f8..b6d56682a9 100644
--- a/providers/common/build.info
+++ b/providers/common/build.info
@@ -3,5 +3,5 @@ SUBDIRS=der
SOURCE[../libcommon.a]=provider_err.c provider_ctx.c
$FIPSCOMMON=provider_util.c capabilities.c bio_prov.c digest_to_nid.c\
securitycheck.c
-SOURCE[../libnonfips.a]=$FIPSCOMMON nid_to_name.c securitycheck_default.c
+SOURCE[../libnonfips.a]=$FIPSCOMMON securitycheck_default.c
SOURCE[../libfips.a]=$FIPSCOMMON securitycheck_fips.c
diff --git a/providers/common/include/prov/providercommon.h b/providers/common/include/prov/providercommon.h
index 622fe1977e..33bd8bd732 100644
--- a/providers/common/include/prov/providercommon.h
+++ b/providers/common/include/prov/providercommon.h
@@ -12,8 +12,6 @@
const OSSL_CORE_HANDLE *FIPS_get_core_handle(OSSL_LIB_CTX *ctx);
-const char *ossl_prov_util_nid_to_name(int nid);
-
int ossl_cipher_capable_aes_cbc_hmac_sha1(void);
int ossl_cipher_capable_aes_cbc_hmac_sha256(void);
diff --git a/providers/common/nid_to_name.c b/providers/common/nid_to_name.c
deleted file mode 100644
index af2a7cbc6a..0000000000
--- a/providers/common/nid_to_name.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2019 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
- */
-
-#include <openssl/objects.h>
-#include "prov/providercommon.h"
-
-/*
- * The FIPS provider has its own version of this in fipsprov.c because it does
- * not have OBJ_nid2sn();
- */
-const char *ossl_prov_util_nid_to_name(int nid)
-{
- return OBJ_nid2sn(nid);
-}
-
diff --git a/providers/fips/fipsprov.c b/providers/fips/fipsprov.c
index 93b5dede67..a4e6601071 100644
--- a/providers/fips/fipsprov.c
+++ b/providers/fips/fipsprov.c
@@ -10,7 +10,6 @@
#include <openssl/core_dispatch.h>
#include <openssl/core_names.h>
#include <openssl/params.h>
-#include <openssl/obj_mac.h> /* NIDs used by ossl_prov_util_nid_to_name() */
#include <openssl/fips_names.h>
#include <openssl/rand.h> /* RAND_get0_public() */
#include "internal/cryptlib.h"
@@ -184,103 +183,6 @@ static int fips_self_test(void *provctx)
return SELF_TEST_post(&selftest_params, 1) ? 1 : 0;
}
-/* FIPS specific version of the function of the same name in provlib.c */
-/* TODO(3.0) - Is this function needed ? */
-const char *ossl_prov_util_nid_to_name(int nid)
-{
- /* We don't have OBJ_nid2n() in FIPS_MODULE so we have an explicit list */
-
- switch (nid) {
- /* Digests */
- case NID_sha1:
- return "SHA1";
- case NID_sha224:
- return "SHA-224";
- case NID_sha256:
- return "SHA-256";
- case NID_sha384:
- return "SHA-384";
- case NID_sha512:
- return "SHA-512";
- case NID_sha512_224:
- return "SHA-512/224";
- case NID_sha512_256:
- return "SHA-512/256";
- case NID_sha3_224:
- return "SHA3-224";
- case NID_sha3_256:
- return "SHA3-256";
- case NID_sha3_384:
- return "SHA3-384";
- case NID_sha3_512:
- return "SHA3-512";
-
- /* Ciphers */
- case NID_aes_256_ecb:
- return "AES-256-ECB";
- case NID_aes_192_ecb:
- return "AES-192-ECB";
- case NID_aes_128_ecb:
- return "AES-128-ECB";
- case NID_aes_256_cbc:
- return "AES-256-CBC";
- case NID_aes_192_cbc:
- return "AES-192-CBC";
- case NID_aes_128_cbc:
- return "AES-128-CBC";
- case NID_aes_256_ctr:
- return "AES-256-CTR";
- case NID_aes_192_ctr:
- return "AES-192-CTR";
- case NID_aes_128_ctr:
- return "AES-128-CTR";
- case NID_aes_256_xts:
- return "AES-256-XTS";
- case NID_aes_128_xts:
- return "AES-128-XTS";
- case NID_aes_256_gcm:
- return "AES-256-GCM";
- case NID_aes_192_gcm:
- return "AES-192-GCM";
- case NID_aes_128_gcm:
- return "AES-128-GCM";
- case NID_aes_256_ccm:
- return "AES-256-CCM";
- case NID_aes_192_ccm:
- return "AES-192-CCM";
- case NID_aes_128_ccm:
- return "AES-128-CCM";
- case NID_id_aes256_wrap:
- return "AES-256-WRAP";
- case NID_id_aes192_wrap:
- return "AES-192-WRAP";
- case NID_id_aes128_wrap:
- return "AES-128-WRAP";
- case NID_id_aes256_wrap_pad:
- return "AES-256-WRAP-PAD";
- case NID_id_aes192_wrap_pad:
- return "AES-192-WRAP-PAD";
- case NID_id_aes128_wrap_pad:
- return "AES-128-WRAP-PAD";
- case NID_des_ede3_ecb:
- return "DES-EDE3";
- case NID_des_ede3_cbc:
- return "DES-EDE3-CBC";
- case NID_aes_256_cbc_hmac_sha256:
- return "AES-256-CBC-HMAC-SHA256";
- case NID_aes_128_cbc_hmac_sha256:
- return "AES-128-CBC-HMAC-SHA256";
- case NID_aes_256_cbc_hmac_sha1:
- return "AES-256-CBC-HMAC-SHA1";
- case NID_aes_128_cbc_hmac_sha1:
- return "AES-128-CBC-HMAC-SHA1";
- default:
- break;
- }
-
- return NULL;
-}
-
/*
* For the algorithm names, we use the following formula for our primary
* names: