X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=crypto%2Fevp%2Fp_lib.c;fp=crypto%2Fevp%2Fp_lib.c;h=6a8dc9bbbbfd4be16f918c52e3377b2c650311fe;hb=e9fe0f7e9df7e0909ca52a024b889e48616a29d9;hp=d997ae80e1a6386753931d2a9c4c946a9a0daa67;hpb=3c39bd9b89198c6b3834c369c7da6f582788f645;p=openssl.git 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; }