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 03b9fd1b..982064f5 100644
--- a/dh.c
+++ b/dh.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: dh.c,v 1.12 2001/04/03 19:53:29 markus Exp $");
+RCSID("$OpenBSD: dh.c,v 1.13 2001/04/04 23:09:17 markus Exp $");
#include "xmalloc.h"
@@ -151,11 +151,9 @@ choose_dh(int min, int wantbits, int max)
while (fgets(line, sizeof(line), f)) {
if (!parse_prime(linenum, line, &dhg))
continue;
- if (dhg.size > max || dhg.size < min)
- continue;
- if (dhg.size != best)
- continue;
- if (linenum++ != which) {
+ if ((dhg.size > max || dhg.size < min) ||
+ dhg.size != best ||
+ linenum++ != which) {
BN_free(dhg.g);
BN_free(dhg.p);
continue;
@@ -163,6 +161,9 @@ choose_dh(int min, int wantbits, int max)
break;
}
fclose(f);
+ if (linenum != which+1)
+ fatal("WARNING: line %d disappeared in %s, giving up",
+ which, _PATH_DH_PRIMES);
return (dh_new_group(dhg.g, dhg.p));
}