diff options
Diffstat (limited to 'src/lib/libcrypto/dh')
-rw-r--r-- | src/lib/libcrypto/dh/dh_lib.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/lib/libcrypto/dh/dh_lib.c b/src/lib/libcrypto/dh/dh_lib.c index e02ce7455a..8a7f9386c7 100644 --- a/src/lib/libcrypto/dh/dh_lib.c +++ b/src/lib/libcrypto/dh/dh_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dh_lib.c,v 1.30 2018/02/22 16:41:04 jsing Exp $ */ | 1 | /* $OpenBSD: dh_lib.c,v 1.31 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 | * |
@@ -98,10 +98,8 @@ DH_set_method(DH *dh, const DH_METHOD *meth) | |||
98 | if (mtmp->finish) | 98 | if (mtmp->finish) |
99 | mtmp->finish(dh); | 99 | mtmp->finish(dh); |
100 | #ifndef OPENSSL_NO_ENGINE | 100 | #ifndef OPENSSL_NO_ENGINE |
101 | if (dh->engine) { | 101 | ENGINE_finish(dh->engine); |
102 | ENGINE_finish(dh->engine); | 102 | dh->engine = NULL; |
103 | dh->engine = NULL; | ||
104 | } | ||
105 | #endif | 103 | #endif |
106 | dh->meth = meth; | 104 | dh->meth = meth; |
107 | if (meth->init) | 105 | if (meth->init) |
@@ -139,7 +137,7 @@ DH_new_method(ENGINE *engine) | |||
139 | ret->engine = ENGINE_get_default_DH(); | 137 | ret->engine = ENGINE_get_default_DH(); |
140 | if(ret->engine) { | 138 | if(ret->engine) { |
141 | ret->meth = ENGINE_get_DH(ret->engine); | 139 | ret->meth = ENGINE_get_DH(ret->engine); |
142 | if (!ret->meth) { | 140 | if (ret->meth == NULL) { |
143 | DHerror(ERR_R_ENGINE_LIB); | 141 | DHerror(ERR_R_ENGINE_LIB); |
144 | ENGINE_finish(ret->engine); | 142 | ENGINE_finish(ret->engine); |
145 | free(ret); | 143 | free(ret); |
@@ -166,8 +164,7 @@ DH_new_method(ENGINE *engine) | |||
166 | CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data); | 164 | CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data); |
167 | if (ret->meth->init != NULL && !ret->meth->init(ret)) { | 165 | if (ret->meth->init != NULL && !ret->meth->init(ret)) { |
168 | #ifndef OPENSSL_NO_ENGINE | 166 | #ifndef OPENSSL_NO_ENGINE |
169 | if (ret->engine) | 167 | ENGINE_finish(ret->engine); |
170 | ENGINE_finish(ret->engine); | ||
171 | #endif | 168 | #endif |
172 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data); | 169 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data); |
173 | free(ret); | 170 | free(ret); |
@@ -190,8 +187,7 @@ DH_free(DH *r) | |||
190 | if (r->meth->finish) | 187 | if (r->meth->finish) |
191 | r->meth->finish(r); | 188 | r->meth->finish(r); |
192 | #ifndef OPENSSL_NO_ENGINE | 189 | #ifndef OPENSSL_NO_ENGINE |
193 | if (r->engine) | 190 | ENGINE_finish(r->engine); |
194 | ENGINE_finish(r->engine); | ||
195 | #endif | 191 | #endif |
196 | 192 | ||
197 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, r, &r->ex_data); | 193 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, r, &r->ex_data); |