summaryrefslogtreecommitdiff
path: root/dh.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-04-05 02:05:21 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-04-05 02:05:21 +0000
commit5ba23b39bf2d8d2c9c0747b9a66f356180306691 (patch)
tree402e41d5b01532ef4579ba5eaccd212433415510 /dh.c
parent8e312f3db05059499cf6655663ce31e73d508817 (diff)
- markus@cvs.openbsd.org 2001/04/04 23:09:18
[dh.c kex.c packet.c] clear+free keys,iv for rekeying. + fix DH mem leaks. ok niels@
Diffstat (limited to 'dh.c')
-rw-r--r--dh.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/dh.c b/dh.c
index 03b9fd1b8..982064f54 100644
--- a/dh.c
+++ b/dh.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: dh.c,v 1.12 2001/04/03 19:53:29 markus Exp $"); 26RCSID("$OpenBSD: dh.c,v 1.13 2001/04/04 23:09:17 markus Exp $");
27 27
28#include "xmalloc.h" 28#include "xmalloc.h"
29 29
@@ -151,11 +151,9 @@ choose_dh(int min, int wantbits, int max)
151 while (fgets(line, sizeof(line), f)) { 151 while (fgets(line, sizeof(line), f)) {
152 if (!parse_prime(linenum, line, &dhg)) 152 if (!parse_prime(linenum, line, &dhg))
153 continue; 153 continue;
154 if (dhg.size > max || dhg.size < min) 154 if ((dhg.size > max || dhg.size < min) ||
155 continue; 155 dhg.size != best ||
156 if (dhg.size != best) 156 linenum++ != which) {
157 continue;
158 if (linenum++ != which) {
159 BN_free(dhg.g); 157 BN_free(dhg.g);
160 BN_free(dhg.p); 158 BN_free(dhg.p);
161 continue; 159 continue;
@@ -163,6 +161,9 @@ choose_dh(int min, int wantbits, int max)
163 break; 161 break;
164 } 162 }
165 fclose(f); 163 fclose(f);
164 if (linenum != which+1)
165 fatal("WARNING: line %d disappeared in %s, giving up",
166 which, _PATH_DH_PRIMES);
166 167
167 return (dh_new_group(dhg.g, dhg.p)); 168 return (dh_new_group(dhg.g, dhg.p));
168} 169}