summaryrefslogtreecommitdiff
path: root/moduli.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2012-09-07 00:20:47 +0100
committerColin Watson <cjwatson@debian.org>2012-09-07 00:20:47 +0100
commiteab78da6a54225de06271d9c8da650f04a55ed88 (patch)
treeaa258ca77515939f6d89317ff67fbcb0bca08b24 /moduli.c
parenta26f5de49df59322fde07f7be91b3e3969c9c238 (diff)
parentc6a2c0334e45419875687d250aed9bea78480f2e (diff)
* New upstream release (http://www.openssh.com/txt/release-6.1).
- Enable pre-auth sandboxing by default for new installs. - Allow "PermitOpen none" to refuse all port-forwarding requests (closes: #543683).
Diffstat (limited to 'moduli.c')
-rw-r--r--moduli.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/moduli.c b/moduli.c
index 973ee6288..5267bb9ab 100644
--- a/moduli.c
+++ b/moduli.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: moduli.c,v 1.25 2011/10/19 00:06:10 djm Exp $ */ 1/* $OpenBSD: moduli.c,v 1.26 2012/07/06 00:41:59 dtucker 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>
@@ -140,7 +140,8 @@ static u_int32_t largebits, largememory; /* megabytes */
140static BIGNUM *largebase; 140static BIGNUM *largebase;
141 141
142int gen_candidates(FILE *, u_int32_t, u_int32_t, BIGNUM *); 142int gen_candidates(FILE *, u_int32_t, u_int32_t, BIGNUM *);
143int prime_test(FILE *, FILE *, u_int32_t, u_int32_t, char *); 143int prime_test(FILE *, FILE *, u_int32_t, u_int32_t, char *, unsigned long,
144 unsigned long);
144 145
145/* 146/*
146 * print moduli out in consistent form, 147 * print moduli out in consistent form,
@@ -495,14 +496,14 @@ read_checkpoint(char *cpfile)
495 */ 496 */
496int 497int
497prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted, 498prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted,
498 char *checkpoint_file) 499 char *checkpoint_file, unsigned long start_lineno, unsigned long num_lines)
499{ 500{
500 BIGNUM *q, *p, *a; 501 BIGNUM *q, *p, *a;
501 BN_CTX *ctx; 502 BN_CTX *ctx;
502 char *cp, *lp; 503 char *cp, *lp;
503 u_int32_t count_in = 0, count_out = 0, count_possible = 0; 504 u_int32_t count_in = 0, count_out = 0, count_possible = 0;
504 u_int32_t generator_known, in_tests, in_tries, in_type, in_size; 505 u_int32_t generator_known, in_tests, in_tries, in_type, in_size;
505 unsigned long last_processed = 0; 506 unsigned long last_processed = 0, end_lineno;
506 time_t time_start, time_stop; 507 time_t time_start, time_stop;
507 int res; 508 int res;
508 509
@@ -525,10 +526,17 @@ prime_test(FILE *in, FILE *out, u_int32_t trials, u_int32_t generator_wanted,
525 526
526 if (checkpoint_file != NULL) 527 if (checkpoint_file != NULL)
527 last_processed = read_checkpoint(checkpoint_file); 528 last_processed = read_checkpoint(checkpoint_file);
529 if (start_lineno > last_processed)
530 last_processed = start_lineno;
531 if (num_lines == 0)
532 end_lineno = ULONG_MAX;
533 else
534 end_lineno = last_processed + num_lines;
535 debug2("process line %lu to line %lu", last_processed, end_lineno);
528 536
529 res = 0; 537 res = 0;
530 lp = xmalloc(QLINESIZE + 1); 538 lp = xmalloc(QLINESIZE + 1);
531 while (fgets(lp, QLINESIZE + 1, in) != NULL) { 539 while (fgets(lp, QLINESIZE + 1, in) != NULL && count_in < end_lineno) {
532 count_in++; 540 count_in++;
533 if (checkpoint_file != NULL) { 541 if (checkpoint_file != NULL) {
534 if (count_in <= last_processed) { 542 if (count_in <= last_processed) {