mirror of
https://github.com/QuasarApp/openssl.git
synced 2025-05-08 07:29:41 +00:00
EVP: Fix the returned value for ASN1_PKEY_CTRL_DEFAULT_MD_NID
Trust the returned value from EVP_PKEY_get_default_digest_name()! It mimics exactly the values that EVP_PKEY_get_default_digest_nid() is supposed to return, and that value should simply be passed unchanged. Callers depend on it. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12586)
This commit is contained in:
parent
a7922e208d
commit
90ef39f43a
@ -1202,19 +1202,18 @@ static int legacy_asn1_ctrl_to_param(EVP_PKEY *pkey, int op,
|
|||||||
case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
|
case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
|
||||||
{
|
{
|
||||||
char mdname[80] = "";
|
char mdname[80] = "";
|
||||||
int nid;
|
|
||||||
int rv = EVP_PKEY_get_default_digest_name(pkey, mdname,
|
int rv = EVP_PKEY_get_default_digest_name(pkey, mdname,
|
||||||
sizeof(mdname));
|
sizeof(mdname));
|
||||||
|
|
||||||
if (rv <= 0)
|
if (rv > 0) {
|
||||||
return rv;
|
int nid;
|
||||||
|
|
||||||
nid = OBJ_sn2nid(mdname);
|
nid = OBJ_sn2nid(mdname);
|
||||||
if (nid == NID_undef)
|
if (nid == NID_undef)
|
||||||
nid = OBJ_ln2nid(mdname);
|
nid = OBJ_ln2nid(mdname);
|
||||||
if (nid == NID_undef)
|
|
||||||
return 0;
|
|
||||||
*(int *)arg2 = nid;
|
*(int *)arg2 = nid;
|
||||||
return 1;
|
}
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return -2;
|
return -2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user