version 1.210, 2011/04/18 00:46:05 |
version 1.211, 2011/10/16 11:02:46 |
|
|
|
|
/* moduli.c */ |
/* moduli.c */ |
int gen_candidates(FILE *, u_int32_t, u_int32_t, BIGNUM *); |
int gen_candidates(FILE *, u_int32_t, u_int32_t, BIGNUM *); |
int prime_test(FILE *, FILE *, u_int32_t, u_int32_t); |
int prime_test(FILE *, FILE *, u_int32_t, u_int32_t, char *); |
|
|
static void |
static void |
type_bits_valid(int type, u_int32_t *bitsp) |
type_bits_valid(int type, u_int32_t *bitsp) |
|
|
fprintf(stderr, " -G file Generate candidates for DH-GEX moduli.\n"); |
fprintf(stderr, " -G file Generate candidates for DH-GEX moduli.\n"); |
fprintf(stderr, " -g Use generic DNS resource record format.\n"); |
fprintf(stderr, " -g Use generic DNS resource record format.\n"); |
fprintf(stderr, " -H Hash names in known_hosts file.\n"); |
fprintf(stderr, " -H Hash names in known_hosts file.\n"); |
|
fprintf(stderr, " -K checkpt Write checkpoints to this file.\n"); |
fprintf(stderr, " -h Generate host certificate instead of a user certificate.\n"); |
fprintf(stderr, " -h Generate host certificate instead of a user certificate.\n"); |
fprintf(stderr, " -I key_id Key identifier to include in certificate.\n"); |
fprintf(stderr, " -I key_id Key identifier to include in certificate.\n"); |
fprintf(stderr, " -i Import foreign format to OpenSSH key file.\n"); |
fprintf(stderr, " -i Import foreign format to OpenSSH key file.\n"); |
|
|
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
char dotsshdir[MAXPATHLEN], comment[1024], *passphrase1, *passphrase2; |
char dotsshdir[MAXPATHLEN], comment[1024], *passphrase1, *passphrase2; |
|
char *checkpoint = NULL; |
char out_file[MAXPATHLEN], *rr_hostname = NULL; |
char out_file[MAXPATHLEN], *rr_hostname = NULL; |
Key *private, *public; |
Key *private, *public; |
struct passwd *pw; |
struct passwd *pw; |
|
|
exit(1); |
exit(1); |
} |
} |
|
|
while ((opt = getopt(argc, argv, "AegiqpclBHLhvxXyF:b:f:t:D:I:P:m:N:n:" |
while ((opt = getopt(argc, argv, "AegiqpclBHLhvxXyF:b:f:t:D:I:K:P:m:N:n:" |
"O:C:r:g:R:T:G:M:S:s:a:V:W:z:")) != -1) { |
"O:C:r:g:R:T:G:M:S:s:a:V:W:z:")) != -1) { |
switch (opt) { |
switch (opt) { |
case 'A': |
case 'A': |
|
|
sizeof(out_file)) |
sizeof(out_file)) |
fatal("Output filename too long"); |
fatal("Output filename too long"); |
break; |
break; |
|
case 'K': |
|
if (strlen(optarg) >= MAXPATHLEN) |
|
fatal("Checkpoint filename too long"); |
|
checkpoint = xstrdup(optarg); |
|
break; |
case 'S': |
case 'S': |
/* XXX - also compare length against bits */ |
/* XXX - also compare length against bits */ |
if (BN_hex2bn(&start, optarg) == 0) |
if (BN_hex2bn(&start, optarg) == 0) |
|
|
fatal("Couldn't open moduli file \"%s\": %s", |
fatal("Couldn't open moduli file \"%s\": %s", |
out_file, strerror(errno)); |
out_file, strerror(errno)); |
} |
} |
if (prime_test(in, out, trials, generator_wanted) != 0) |
if (prime_test(in, out, trials, generator_wanted, checkpoint) |
|
!= 0) |
fatal("modulus screening failed"); |
fatal("modulus screening failed"); |
return (0); |
return (0); |
} |
} |