summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2019-07-10 22:24:00 +0200
committerRichard Levitte <levitte@openssl.org>2019-07-23 06:34:09 +0200
commitc750bc08516f1273751ba03fa533e3eb2418b92d (patch)
tree8bd24cd14dd73d9443150ccd63bb954861245ed7 /crypto
parent6b9e37246d5fd8e701b825c71fa1a018916af33c (diff)
Re-implement EVP_MD_name() and EVP_CIPHER_name() as functions
They will do the same as usual for non-provider algorithms implementations, but can handle provider implementations as well. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9356)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/evp/evp_lib.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c
index 24441ef825..36a6aee690 100644
--- a/crypto/evp/evp_lib.c
+++ b/crypto/evp/evp_lib.c
@@ -415,6 +415,17 @@ int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx)
return ctx->cipher->nid;
}
+const char *EVP_CIPHER_name(const EVP_CIPHER *cipher)
+{
+ if (cipher->prov != NULL)
+ return cipher->name;
+#ifndef FIPS_MODE
+ return OBJ_nid2sn(EVP_CIPHER_nid(cipher));
+#else
+ return NULL;
+#endif
+}
+
int EVP_CIPHER_mode(const EVP_CIPHER *cipher)
{
int ok, v = EVP_CIPHER_flags(cipher) & EVP_CIPH_MODE;
@@ -426,6 +437,17 @@ int EVP_CIPHER_mode(const EVP_CIPHER *cipher)
return ok != 0 ? v : 0;
}
+const char *EVP_MD_name(const EVP_MD *md)
+{
+ if (md->prov != NULL)
+ return md->name;
+#ifndef FIPS_MODE
+ return OBJ_nid2sn(EVP_MD_nid(md));
+#else
+ return NULL;
+#endif
+}
+
int EVP_MD_block_size(const EVP_MD *md)
{
if (md == NULL) {