summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/moduli.c
diff options
context:
space:
mode:
authorAnil Madhavapeddy <avsm@cvs.openbsd.org>2005-05-23 22:44:02 +0000
committerAnil Madhavapeddy <avsm@cvs.openbsd.org>2005-05-23 22:44:02 +0000
commitd271a729d5c3db995ecffe07f81a5bd8771aec60 (patch)
treee406c1270e7fbbfe86729b8c011f4c3996586dcf /usr.bin/ssh/moduli.c
parentf736ce212564e5be4bceab90237f93ee3aeee8e6 (diff)
- removes signed/unsigned comparisons in moduli generation
- use strtonum instead of atoi where its easier - check some strlcpy overflow and fatal instead of truncate
Diffstat (limited to 'usr.bin/ssh/moduli.c')
-rw-r--r--usr.bin/ssh/moduli.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/ssh/moduli.c b/usr.bin/ssh/moduli.c
index 8b05248e234..c13c535d6c9 100644
--- a/usr.bin/ssh/moduli.c
+++ b/usr.bin/ssh/moduli.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: moduli.c,v 1.10 2005/01/17 03:25:46 dtucker Exp $ */
+/* $OpenBSD: moduli.c,v 1.11 2005/05/23 22:44:01 avsm Exp $ */
/*
* Copyright 1994 Phil Karn <karn@qualcomm.com>
* Copyright 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com>
@@ -144,7 +144,7 @@ static u_int32_t *LargeSieve, largewords, largetries, largenumbers;
static u_int32_t largebits, largememory; /* megabytes */
static BIGNUM *largebase;
-int gen_candidates(FILE *, int, int, BIGNUM *);
+int gen_candidates(FILE *, u_int32_t, u_int32_t, BIGNUM *);
int prime_test(FILE *, FILE *, u_int32_t, u_int32_t);
/*
@@ -241,14 +241,15 @@ sieve_large(u_int32_t s)
* The list is checked against small known primes (less than 2**30).
*/
int
-gen_candidates(FILE *out, int memory, int power, BIGNUM *start)
+gen_candidates(FILE *out, u_int32_t memory, u_int32_t power, BIGNUM *start)
{
BIGNUM *q;
u_int32_t j, r, s, t;
u_int32_t smallwords = TINY_NUMBER >> 6;
u_int32_t tinywords = TINY_NUMBER >> 6;
time_t time_start, time_stop;
- int i, ret = 0;
+ u_int32_t i;
+ int ret = 0;
largememory = memory;
@@ -548,7 +549,7 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted)
* due to earlier inconsistencies in interpretation, check
* the proposed bit size.
*/
- if (BN_num_bits(p) != (in_size + 1)) {
+ if ((u_int32_t)BN_num_bits(p) != (in_size + 1)) {
debug2("%10u: bit size %u mismatch", count_in, in_size);
continue;
}