summaryrefslogtreecommitdiff
path: root/moduli.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2005-07-17 17:22:45 +1000
committerDamien Miller <djm@mindrot.org>2005-07-17 17:22:45 +1000
commit0dc1bef12d30162ba09bfcc0b1cd6a5535ebdaab (patch)
treed891954deae6fe6f8574d2a7bbfe6b754a2e70dc /moduli.c
parent2b9b045d930b8d724f768fafdd9a46fa453b9a3e (diff)
- djm@cvs.openbsd.org 2005/07/17 07:17:55
[auth-rh-rsa.c auth-rhosts.c auth2-chall.c auth2-gss.c channels.c] [cipher-ctr.c gss-genr.c gss-serv.c kex.c moduli.c readconf.c] [serverloop.c session.c sftp-client.c sftp.c ssh-add.c ssh-keygen.c] [sshconnect.c sshconnect2.c] knf says that a 2nd level indent is four (not three or five) spaces
Diffstat (limited to 'moduli.c')
-rw-r--r--moduli.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/moduli.c b/moduli.c
index c13c535d6..d53806ea6 100644
--- a/moduli.c
+++ b/moduli.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: moduli.c,v 1.11 2005/05/23 22:44:01 avsm Exp $ */ 1/* $OpenBSD: moduli.c,v 1.12 2005/07/17 07:17:55 djm Exp $ */
2/* 2/*
3 * Copyright 1994 Phil Karn <karn@qualcomm.com> 3 * Copyright 1994 Phil Karn <karn@qualcomm.com>
4 * Copyright 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com> 4 * Copyright 1996-1998, 2003 William Allen Simpson <wsimpson@greendragon.com>
@@ -112,22 +112,22 @@
112#define TINY_NUMBER (1UL<<16) 112#define TINY_NUMBER (1UL<<16)
113 113
114/* Ensure enough bit space for testing 2*q. */ 114/* Ensure enough bit space for testing 2*q. */
115#define TEST_MAXIMUM (1UL<<16) 115#define TEST_MAXIMUM (1UL<<16)
116#define TEST_MINIMUM (QSIZE_MINIMUM + 1) 116#define TEST_MINIMUM (QSIZE_MINIMUM + 1)
117/* real TEST_MINIMUM (1UL << (SHIFT_WORD - TEST_POWER)) */ 117/* real TEST_MINIMUM (1UL << (SHIFT_WORD - TEST_POWER)) */
118#define TEST_POWER (3) /* 2**n, n < SHIFT_WORD */ 118#define TEST_POWER (3) /* 2**n, n < SHIFT_WORD */
119 119
120/* bit operations on 32-bit words */ 120/* bit operations on 32-bit words */
121#define BIT_CLEAR(a,n) ((a)[(n)>>SHIFT_WORD] &= ~(1L << ((n) & 31))) 121#define BIT_CLEAR(a,n) ((a)[(n)>>SHIFT_WORD] &= ~(1L << ((n) & 31)))
122#define BIT_SET(a,n) ((a)[(n)>>SHIFT_WORD] |= (1L << ((n) & 31))) 122#define BIT_SET(a,n) ((a)[(n)>>SHIFT_WORD] |= (1L << ((n) & 31)))
123#define BIT_TEST(a,n) ((a)[(n)>>SHIFT_WORD] & (1L << ((n) & 31))) 123#define BIT_TEST(a,n) ((a)[(n)>>SHIFT_WORD] & (1L << ((n) & 31)))
124 124
125/* 125/*
126 * Prime testing defines 126 * Prime testing defines
127 */ 127 */
128 128
129/* Minimum number of primality tests to perform */ 129/* Minimum number of primality tests to perform */
130#define TRIAL_MINIMUM (4) 130#define TRIAL_MINIMUM (4)
131 131
132/* 132/*
133 * Sieving data (XXX - move to struct) 133 * Sieving data (XXX - move to struct)
@@ -254,7 +254,7 @@ gen_candidates(FILE *out, u_int32_t memory, u_int32_t power, BIGNUM *start)
254 largememory = memory; 254 largememory = memory;
255 255
256 if (memory != 0 && 256 if (memory != 0 &&
257 (memory < LARGE_MINIMUM || memory > LARGE_MAXIMUM)) { 257 (memory < LARGE_MINIMUM || memory > LARGE_MAXIMUM)) {
258 error("Invalid memory amount (min %ld, max %ld)", 258 error("Invalid memory amount (min %ld, max %ld)",
259 LARGE_MINIMUM, LARGE_MAXIMUM); 259 LARGE_MINIMUM, LARGE_MAXIMUM);
260 return (-1); 260 return (-1);
@@ -372,8 +372,8 @@ gen_candidates(FILE *out, u_int32_t memory, u_int32_t power, BIGNUM *start)
372 * fencepost errors, the last pass is skipped. 372 * fencepost errors, the last pass is skipped.
373 */ 373 */
374 for (smallbase = TINY_NUMBER + 3; 374 for (smallbase = TINY_NUMBER + 3;
375 smallbase < (SMALL_MAXIMUM - TINY_NUMBER); 375 smallbase < (SMALL_MAXIMUM - TINY_NUMBER);
376 smallbase += TINY_NUMBER) { 376 smallbase += TINY_NUMBER) {
377 for (i = 0; i < tinybits; i++) { 377 for (i = 0; i < tinybits; i++) {
378 if (BIT_TEST(TinySieve, i)) 378 if (BIT_TEST(TinySieve, i))
379 continue; /* 2*i+3 is composite */ 379 continue; /* 2*i+3 is composite */