openssl-pkcs11/SOURCES/openssl-pkcs11-0.4.8-error-handling-evp-pkey-set1-engine-fixed.patch
2021-09-09 23:19:57 +00:00

20 lines
628 B
Diff

diff --git a/src/eng_front.c b/src/eng_front.c
index 5fe8f55..286aaa9 100644
--- a/src/eng_front.c
+++ b/src/eng_front.c
@@ -233,11 +233,9 @@ static EVP_PKEY *load_privkey(ENGINE *engine, const char *s_key_id,
#ifdef EVP_F_EVP_PKEY_SET1_ENGINE
/* EVP_PKEY_set1_engine() is required for OpenSSL 1.1.x,
* but otherwise setting pkey->engine breaks OpenSSL 1.0.2 */
- if (pkey) {
- if (!EVP_PKEY_set1_engine(pkey, engine)) {
- EVP_PKEY_free(pkey);
- return NULL;
- }
+ if (pkey && !EVP_PKEY_set1_engine(pkey, engine)) {
+ EVP_PKEY_free(pkey);
+ pkey = NULL;
}
#endif /* EVP_F_EVP_PKEY_SET1_ENGINE */
return pkey;