Skip to content

Commit

Permalink
Don't ignore passed ENGINE.
Browse files Browse the repository at this point in the history
If we are passed an ENGINE to use in int_ctx_new e.g. via EVP_PKEY_CTX_new()
use it instead of the default.

Reviewed-by: Matt Caswell <[email protected]>
(Merged from openssl#4503)
  • Loading branch information
snhenson committed Oct 11, 2017
1 parent e913d11 commit c2976ed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crypto/evp/pmeth_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,17 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
id = pkey->ameth->pkey_id;
}
#ifndef OPENSSL_NO_ENGINE
if (pkey && pkey->engine)
if (e == NULL && pkey != NULL)
e = pkey->engine;
/* Try to find an ENGINE which implements this method */
if (e) {
if (!ENGINE_init(e)) {
EVPerr(EVP_F_INT_CTX_NEW, ERR_R_ENGINE_LIB);
return NULL;
}
} else
} else {
e = ENGINE_get_pkey_meth_engine(id);
}

/*
* If an ENGINE handled this method look it up. Otherwise use internal
Expand Down

0 comments on commit c2976ed

Please sign in to comment.