openssl-pkcs11/openssl-pkcs11-0.4.8-error-handling-evp-pkey-set1-engine-fixed.patch
Anderson Toshiyuki Sasaki 889aab18fc openssl-pkcs11-0.4.8-2
- Require OpenSSL >= 1.0.2
- Fixed missing declaration of ERR_get_CKR_code()
- Add support to use EC keys and tests (#1619184)
- Exposed check_fork() API
- Fixed memory leak of RSA objects in pkcs11_store_key()
- Updated OpenSSL license in eng_front.c
- Fixed build for old C dialects
- Allow engine to use private key without PIN
- Require DEBUG to be defined to print debug messages
- Changed package description (#1614699)
2018-09-18 10:02:33 +02: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;