From 9ef95ddcaf41b2c66bc3c1efc1d71b2fe568e01a Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 22 Jan 2002 23:10:33 +1100 Subject: [PATCH] - markus@cvs.openbsd.org 2001/12/27 19:37:23 [dh.c kexdh.c kexgex.c] always use BN_clear_free instead of BN_free --- ChangeLog | 5 ++++- dh.c | 16 ++++++++-------- kexdh.c | 6 +++--- kexgex.c | 6 +++--- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 894ad539d..635f4c23b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -45,6 +45,9 @@ - markus@cvs.openbsd.org 2001/12/27 18:26:13 [authfile.c] missing include + - markus@cvs.openbsd.org 2001/12/27 19:37:23 + [dh.c kexdh.c kexgex.c] + always use BN_clear_free instead of BN_free 20020121 - (djm) Rework ssh-rand-helper: @@ -7192,4 +7195,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1735 2002/01/22 12:10:04 djm Exp $ +$Id: ChangeLog,v 1.1736 2002/01/22 12:10:33 djm Exp $ diff --git a/dh.c b/dh.c index a5d6f379c..3e1594eae 100644 --- a/dh.c +++ b/dh.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: dh.c,v 1.18 2001/12/27 18:22:16 markus Exp $"); +RCSID("$OpenBSD: dh.c,v 1.19 2001/12/27 19:37:22 markus Exp $"); #include "xmalloc.h" @@ -94,8 +94,8 @@ parse_prime(int linenum, char *line, struct dhgroup *dhg) return (1); failclean: - BN_free(dhg->g); - BN_free(dhg->p); + BN_clear_free(dhg->g); + BN_clear_free(dhg->p); fail: error("Bad prime description in line %d", linenum); return (0); @@ -122,8 +122,8 @@ choose_dh(int min, int wantbits, int max) linenum++; if (!parse_prime(linenum, line, &dhg)) continue; - BN_free(dhg.g); - BN_free(dhg.p); + BN_clear_free(dhg.g); + BN_clear_free(dhg.p); if (dhg.size > max || dhg.size < min) continue; @@ -152,8 +152,8 @@ choose_dh(int min, int wantbits, int max) if ((dhg.size > max || dhg.size < min) || dhg.size != best || linenum++ != which) { - BN_free(dhg.g); - BN_free(dhg.p); + BN_clear_free(dhg.g); + BN_clear_free(dhg.p); continue; } break; @@ -203,7 +203,7 @@ dh_gen_key(DH *dh, int need) BN_num_bits(dh->p), 2*need); do { if (dh->priv_key != NULL) - BN_free(dh->priv_key); + BN_clear_free(dh->priv_key); if ((dh->priv_key = BN_new()) == NULL) fatal("dh_gen_key: BN_new failed"); /* generate a 2*need bits random private exponent */ diff --git a/kexdh.c b/kexdh.c index 1e9f35835..059b41c41 100644 --- a/kexdh.c +++ b/kexdh.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: kexdh.c,v 1.8 2001/12/27 18:22:16 markus Exp $"); +RCSID("$OpenBSD: kexdh.c,v 1.9 2001/12/27 19:37:22 markus Exp $"); #include #include @@ -171,7 +171,7 @@ kexdh_client(Kex *kex) shared_secret ); xfree(server_host_key_blob); - BN_free(dh_server_pub); + BN_clear_free(dh_server_pub); DH_free(dh); if (key_verify(server_host_key, signature, slen, hash, 20) != 1) @@ -262,7 +262,7 @@ kexdh_server(Kex *kex) dh->pub_key, shared_secret ); - BN_free(dh_client_pub); + BN_clear_free(dh_client_pub); /* save session id := H */ /* XXX hashlen depends on KEX */ diff --git a/kexgex.c b/kexgex.c index b4fdac695..8822c8dcd 100644 --- a/kexgex.c +++ b/kexgex.c @@ -24,7 +24,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: kexgex.c,v 1.11 2001/12/27 18:22:16 markus Exp $"); +RCSID("$OpenBSD: kexgex.c,v 1.12 2001/12/27 19:37:23 markus Exp $"); #include @@ -232,7 +232,7 @@ kexgex_client(Kex *kex) /* have keys, free DH */ DH_free(dh); xfree(server_host_key_blob); - BN_free(dh_server_pub); + BN_clear_free(dh_server_pub); if (key_verify(server_host_key, signature, slen, hash, 20) != 1) fatal("key_verify failed for server_host_key"); @@ -365,7 +365,7 @@ kexgex_server(Kex *kex) dh->pub_key, shared_secret ); - BN_free(dh_client_pub); + BN_clear_free(dh_client_pub); /* save session id := H */ /* XXX hashlen depends on KEX */