summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rsa')
-rw-r--r--src/lib/libcrypto/rsa/rsa_lib.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c
index 544846f825..84e1dc7eaf 100644
--- a/src/lib/libcrypto/rsa/rsa_lib.c
+++ b/src/lib/libcrypto/rsa/rsa_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_lib.c,v 1.36 2018/02/20 17:42:32 tb Exp $ */ 1/* $OpenBSD: rsa_lib.c,v 1.37 2018/04/14 07:09:21 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -114,10 +114,8 @@ RSA_set_method(RSA *rsa, const RSA_METHOD *meth)
114 if (mtmp->finish) 114 if (mtmp->finish)
115 mtmp->finish(rsa); 115 mtmp->finish(rsa);
116#ifndef OPENSSL_NO_ENGINE 116#ifndef OPENSSL_NO_ENGINE
117 if (rsa->engine) { 117 ENGINE_finish(rsa->engine);
118 ENGINE_finish(rsa->engine); 118 rsa->engine = NULL;
119 rsa->engine = NULL;
120 }
121#endif 119#endif
122 rsa->meth = meth; 120 rsa->meth = meth;
123 if (meth->init) 121 if (meth->init)
@@ -149,7 +147,7 @@ RSA_new_method(ENGINE *engine)
149 ret->engine = ENGINE_get_default_RSA(); 147 ret->engine = ENGINE_get_default_RSA();
150 if (ret->engine) { 148 if (ret->engine) {
151 ret->meth = ENGINE_get_RSA(ret->engine); 149 ret->meth = ENGINE_get_RSA(ret->engine);
152 if (!ret->meth) { 150 if (ret->meth == NULL) {
153 RSAerror(ERR_R_ENGINE_LIB); 151 RSAerror(ERR_R_ENGINE_LIB);
154 ENGINE_finish(ret->engine); 152 ENGINE_finish(ret->engine);
155 free(ret); 153 free(ret);
@@ -177,8 +175,7 @@ RSA_new_method(ENGINE *engine)
177 ret->flags = ret->meth->flags & ~RSA_FLAG_NON_FIPS_ALLOW; 175 ret->flags = ret->meth->flags & ~RSA_FLAG_NON_FIPS_ALLOW;
178 if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data)) { 176 if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data)) {
179#ifndef OPENSSL_NO_ENGINE 177#ifndef OPENSSL_NO_ENGINE
180 if (ret->engine) 178 ENGINE_finish(ret->engine);
181 ENGINE_finish(ret->engine);
182#endif 179#endif
183 free(ret); 180 free(ret);
184 return NULL; 181 return NULL;
@@ -186,8 +183,7 @@ RSA_new_method(ENGINE *engine)
186 183
187 if (ret->meth->init != NULL && !ret->meth->init(ret)) { 184 if (ret->meth->init != NULL && !ret->meth->init(ret)) {
188#ifndef OPENSSL_NO_ENGINE 185#ifndef OPENSSL_NO_ENGINE
189 if (ret->engine) 186 ENGINE_finish(ret->engine);
190 ENGINE_finish(ret->engine);
191#endif 187#endif
192 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data); 188 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data);
193 free(ret); 189 free(ret);
@@ -211,8 +207,7 @@ RSA_free(RSA *r)
211 if (r->meth->finish) 207 if (r->meth->finish)
212 r->meth->finish(r); 208 r->meth->finish(r);
213#ifndef OPENSSL_NO_ENGINE 209#ifndef OPENSSL_NO_ENGINE
214 if (r->engine) 210 ENGINE_finish(r->engine);
215 ENGINE_finish(r->engine);
216#endif 211#endif
217 212
218 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, r, &r->ex_data); 213 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, r, &r->ex_data);