summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-03-30 10:47:43 +1000
committerDamien Miller <djm@mindrot.org>2001-03-30 10:47:43 +1000
commit23e526e27199f3ae079ee302581221b49d3e6772 (patch)
tree87e24bd2f05cde74cba6db2765f4aa67921bc88d
parent2557bfc5d712cd3422921253be60be2fbb88a4f7 (diff)
- OpenBSD CVS Sync
- provos@cvs.openbsd.org 2001/03/28 22:04:57 [dh.c] more sanity checking on primes file
-rw-r--r--ChangeLog5
-rw-r--r--dh.c23
2 files changed, 17 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index ddddadf5a..c7266684e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
820010329 1120010329
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 $
diff --git a/dh.c b/dh.c
index 5f441ee1c..636758fa8 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.9 2001/03/27 17:46:49 provos Exp $"); 26RCSID("$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);