summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-05-07 17:44:26 +0200
committerTomas Mraz <tomas@openssl.org>2021-05-13 13:19:39 +0200
commite9fe0f7e9df7e0909ca52a024b889e48616a29d9 (patch)
tree0063dedfae3fa67b80e46e5572743298a3eb2037 /crypto
parent3c39bd9b89198c6b3834c369c7da6f582788f645 (diff)
Replace EVP_PKEY_supports_digest_nid
The EVP_PKEY_supports_digest_nid() is renamed to EVP_PKEY_digestsign_supports_digest() and implemented via EVP_DigestSignInit_ex(). Fixes #14343 Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15198)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/evp/p_lib.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index d997ae80e1..6a8dc9bbbb 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -1335,22 +1335,21 @@ int EVP_PKEY_get_group_name(const EVP_PKEY *pkey, char *gname, size_t gname_sz,
gname, gname_sz, gname_len);
}
-int EVP_PKEY_supports_digest_nid(EVP_PKEY *pkey, int nid)
+int EVP_PKEY_digestsign_supports_digest(EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,
+ const char *name, const char *propq)
{
- int rv = -2, default_nid;
+ int rv;
+ EVP_MD_CTX *ctx = NULL;
- if (rv == -2) {
- /*
- * If there is a mandatory default digest and this isn't it, then
- * the answer is 'no'.
- */
- rv = EVP_PKEY_get_default_digest_nid(pkey, &default_nid);
- if (rv == 2)
- return (nid == default_nid);
- /* zero is an error from EVP_PKEY_get_default_digest_nid() */
- if (rv == 0)
- return -1;
- }
+ if ((ctx = EVP_MD_CTX_new()) == NULL)
+ return -1;
+
+ ERR_set_mark();
+ rv = EVP_DigestSignInit_ex(ctx, NULL, name, libctx,
+ propq, pkey, NULL);
+ ERR_pop_to_mark();
+
+ EVP_MD_CTX_free(ctx);
return rv;
}