Browse Source

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)
master
Shane Lontis 2 years ago
parent
commit
4244504635
5 changed files with 1 additions and 157 deletions
  1. +0
    -35
      doc/internal/man3/ossl_prov_util_nid_to_name.pod
  2. +1
    -1
      providers/common/build.info
  3. +0
    -2
      providers/common/include/prov/providercommon.h
  4. +0
    -21
      providers/common/nid_to_name.c
  5. +0
    -98
      providers/fips/fipsprov.c

+ 0
- 35
doc/internal/man3/ossl_prov_util_nid_to_name.pod View File

@ -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

+ 1
- 1
providers/common/build.info View File

@ -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

+ 0
- 2
providers/common/include/prov/providercommon.h View File

@ -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);


+ 0
- 21
providers/common/nid_to_name.c View File

@ -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);
}

+ 0
- 98
providers/fips/fipsprov.c View File

@ -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:


Loading…
Cancel
Save