summaryrefslogtreecommitdiff
path: root/moduli.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2005-05-26 12:16:18 +1000
committerDamien Miller <djm@mindrot.org>2005-05-26 12:16:18 +1000
commitb089fb5fe15a6b1936262a33417265f8cb9b0afb (patch)
tree9a6ae5b4cdf37720c128fe981ea6d9c3a12a7da9 /moduli.c
parentdfec2941acfdcadb81adb149f452f0eece26625d (diff)
downloadopenssh-git-b089fb5fe15a6b1936262a33417265f8cb9b0afb.tar.gz
- avsm@cvs.openbsd.org 2005/05/23 22:44:01
[moduli.c ssh-keygen.c] - 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 'moduli.c')
-rw-r--r--moduli.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/moduli.c b/moduli.c
index 8b05248e..c13c535d 100644
--- a/moduli.c
+++ b/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;
}