summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp')
-rw-r--r--src/lib/libcrypto/evp/digest.c5
-rw-r--r--src/lib/libcrypto/evp/evp_pkey.c4
-rw-r--r--src/lib/libcrypto/evp/pmeth_fn.c5
-rw-r--r--src/lib/libcrypto/evp/pmeth_gn.c5
-rw-r--r--src/lib/libcrypto/evp/pmeth_lib.c8
5 files changed, 11 insertions, 16 deletions
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c
index 9a4b1a6293..d582d7954e 100644
--- a/src/lib/libcrypto/evp/digest.c
+++ b/src/lib/libcrypto/evp/digest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: digest.c,v 1.21 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: digest.c,v 1.22 2014/07/12 16:03:37 miod 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 *
@@ -358,8 +358,7 @@ EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx)
358 OPENSSL_cleanse(ctx->md_data, ctx->digest->ctx_size); 358 OPENSSL_cleanse(ctx->md_data, ctx->digest->ctx_size);
359 free(ctx->md_data); 359 free(ctx->md_data);
360 } 360 }
361 if (ctx->pctx) 361 EVP_PKEY_CTX_free(ctx->pctx);
362 EVP_PKEY_CTX_free(ctx->pctx);
363#ifndef OPENSSL_NO_ENGINE 362#ifndef OPENSSL_NO_ENGINE
364 if (ctx->engine) 363 if (ctx->engine)
365 /* The EVP_MD we used belongs to an ENGINE, release the 364 /* The EVP_MD we used belongs to an ENGINE, release the
diff --git a/src/lib/libcrypto/evp/evp_pkey.c b/src/lib/libcrypto/evp/evp_pkey.c
index cf7a39be7b..38a324558f 100644
--- a/src/lib/libcrypto/evp/evp_pkey.c
+++ b/src/lib/libcrypto/evp/evp_pkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_pkey.c,v 1.16 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: evp_pkey.c,v 1.17 2014/07/12 16:03:37 miod Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -104,7 +104,7 @@ EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8)
104 return pkey; 104 return pkey;
105 105
106error: 106error:
107 EVP_PKEY_free (pkey); 107 EVP_PKEY_free(pkey);
108 return NULL; 108 return NULL;
109} 109}
110 110
diff --git a/src/lib/libcrypto/evp/pmeth_fn.c b/src/lib/libcrypto/evp/pmeth_fn.c
index c4a53b0d5f..4cf18a0be1 100644
--- a/src/lib/libcrypto/evp/pmeth_fn.c
+++ b/src/lib/libcrypto/evp/pmeth_fn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pmeth_fn.c,v 1.4 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: pmeth_fn.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -331,8 +331,7 @@ EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer)
331 return -1; 331 return -1;
332 } 332 }
333 333
334 if (ctx->peerkey) 334 EVP_PKEY_free(ctx->peerkey);
335 EVP_PKEY_free(ctx->peerkey);
336 ctx->peerkey = peer; 335 ctx->peerkey = peer;
337 336
338 ret = ctx->pmeth->ctrl(ctx, EVP_PKEY_CTRL_PEER_KEY, 1, peer); 337 ret = ctx->pmeth->ctrl(ctx, EVP_PKEY_CTRL_PEER_KEY, 1, peer);
diff --git a/src/lib/libcrypto/evp/pmeth_gn.c b/src/lib/libcrypto/evp/pmeth_gn.c
index 9eb10d4874..29f533625a 100644
--- a/src/lib/libcrypto/evp/pmeth_gn.c
+++ b/src/lib/libcrypto/evp/pmeth_gn.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pmeth_gn.c,v 1.4 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: pmeth_gn.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -222,7 +222,6 @@ EVP_PKEY_new_mac_key(int type, ENGINE *e, const unsigned char *key, int keylen)
222 goto merr; 222 goto merr;
223 223
224merr: 224merr:
225 if (mac_ctx) 225 EVP_PKEY_CTX_free(mac_ctx);
226 EVP_PKEY_CTX_free(mac_ctx);
227 return mac_key; 226 return mac_key;
228} 227}
diff --git a/src/lib/libcrypto/evp/pmeth_lib.c b/src/lib/libcrypto/evp/pmeth_lib.c
index c9c3444a13..12267a6d93 100644
--- a/src/lib/libcrypto/evp/pmeth_lib.c
+++ b/src/lib/libcrypto/evp/pmeth_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pmeth_lib.c,v 1.8 2014/07/11 08:44:48 jsing Exp $ */ 1/* $OpenBSD: pmeth_lib.c,v 1.9 2014/07/12 16:03:37 miod Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -371,10 +371,8 @@ EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx)
371 return; 371 return;
372 if (ctx->pmeth && ctx->pmeth->cleanup) 372 if (ctx->pmeth && ctx->pmeth->cleanup)
373 ctx->pmeth->cleanup(ctx); 373 ctx->pmeth->cleanup(ctx);
374 if (ctx->pkey) 374 EVP_PKEY_free(ctx->pkey);
375 EVP_PKEY_free(ctx->pkey); 375 EVP_PKEY_free(ctx->peerkey);
376 if (ctx->peerkey)
377 EVP_PKEY_free(ctx->peerkey);
378#ifndef OPENSSL_NO_ENGINE 376#ifndef OPENSSL_NO_ENGINE
379 if (ctx->engine) 377 if (ctx->engine)
380 /* The EVP_PKEY_CTX we used belongs to an ENGINE, release the 378 /* The EVP_PKEY_CTX we used belongs to an ENGINE, release the