diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | dh.c | 23 |
2 files changed, 17 insertions, 11 deletions
@@ -4,6 +4,9 @@ | |||
4 | - provos@cvs.openbsd.org 2001/03/28 21:59:41 | 4 | - provos@cvs.openbsd.org 2001/03/28 21:59:41 |
5 | [kex.c kex.h sshconnect2.c sshd.c] | 5 | [kex.c kex.h sshconnect2.c sshd.c] |
6 | forgot to include min and max params in hash, okay markus@ | 6 | forgot to include min and max params in hash, okay markus@ |
7 | - provos@cvs.openbsd.org 2001/03/28 22:04:57 | ||
8 | [dh.c] | ||
9 | more sanity checking on primes file | ||
7 | 10 | ||
8 | 20010329 | 11 | 20010329 |
9 | - OpenBSD CVS Sync | 12 | - OpenBSD CVS Sync |
@@ -4774,4 +4777,4 @@ | |||
4774 | - Wrote replacements for strlcpy and mkdtemp | 4777 | - Wrote replacements for strlcpy and mkdtemp |
4775 | - Released 1.0pre1 | 4778 | - Released 1.0pre1 |
4776 | 4779 | ||
4777 | $Id: ChangeLog,v 1.1036 2001/03/30 00:47:14 djm Exp $ | 4780 | $Id: ChangeLog,v 1.1037 2001/03/30 00:47:43 djm Exp $ |
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: dh.c,v 1.9 2001/03/27 17:46:49 provos Exp $"); | 26 | RCSID("$OpenBSD: dh.c,v 1.10 2001/03/28 22:04:57 provos Exp $"); |
27 | 27 | ||
28 | #include "xmalloc.h" | 28 | #include "xmalloc.h" |
29 | 29 | ||
@@ -79,18 +79,21 @@ parse_prime(int linenum, char *line, struct dhgroup *dhg) | |||
79 | goto fail; | 79 | goto fail; |
80 | 80 | ||
81 | dhg->g = BN_new(); | 81 | dhg->g = BN_new(); |
82 | if (BN_hex2bn(&dhg->g, gen) < 0) { | ||
83 | BN_free(dhg->g); | ||
84 | goto fail; | ||
85 | } | ||
86 | dhg->p = BN_new(); | 82 | dhg->p = BN_new(); |
87 | if (BN_hex2bn(&dhg->p, prime) < 0) { | 83 | if (BN_hex2bn(&dhg->g, gen) < 0) |
88 | BN_free(dhg->g); | 84 | goto failclean; |
89 | BN_free(dhg->p); | 85 | |
90 | goto fail; | 86 | if (BN_hex2bn(&dhg->p, prime) < 0) |
91 | } | 87 | goto failclean; |
88 | |||
89 | if (BN_num_bits(dhg->p) != dhg->size) | ||
90 | goto failclean; | ||
92 | 91 | ||
93 | return (1); | 92 | return (1); |
93 | |||
94 | failclean: | ||
95 | BN_free(dhg->g); | ||
96 | BN_free(dhg->p); | ||
94 | fail: | 97 | fail: |
95 | error("Bad prime description in line %d", linenum); | 98 | error("Bad prime description in line %d", linenum); |
96 | return (0); | 99 | return (0); |