mirror of
https://github.com/openssl/openssl.git
synced 2024-12-03 05:41:46 +08:00
ENGINE_pkey_asn1_find_str(): don't assume an engine implements ASN1 method
Just because an engine implements algorithm methods, that doesn't mean
it also implements the ASN1 method. Therefore, be careful when looking
for an ASN1 method among all engines, don't try to use one that doesn't
exist.
Fixes #6381
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6383)
(cherry picked from commit 1ac3cd6277
)
This commit is contained in:
parent
7e2e10aaec
commit
13b578ada3
@ -170,7 +170,8 @@ static void look_str_cb(int nid, STACK_OF(ENGINE) *sk, ENGINE *def, void *arg)
|
||||
ENGINE *e = sk_ENGINE_value(sk, i);
|
||||
EVP_PKEY_ASN1_METHOD *ameth;
|
||||
e->pkey_asn1_meths(e, &ameth, NULL, nid);
|
||||
if (((int)strlen(ameth->pem_str) == lk->len)
|
||||
if (ameth != NULL
|
||||
&& ((int)strlen(ameth->pem_str) == lk->len)
|
||||
&& strncasecmp(ameth->pem_str, lk->str, lk->len) == 0) {
|
||||
lk->e = e;
|
||||
lk->ameth = ameth;
|
||||
|
Loading…
Reference in New Issue
Block a user