Commit 04423adf authored by Niels Möller's avatar Niels Möller
Browse files

* src/lsh-keygen.c (do_lsh_keygen_handler): Deleted obsolete

function.

* src/lsh-keygen.c (main): New option --server, that uses the
server's seed-file.

Rev: src/lsh-keygen.c:1.12
parent ce1673a2
...@@ -57,11 +57,14 @@ const char *argp_program_version ...@@ -57,11 +57,14 @@ const char *argp_program_version
const char *argp_program_bug_address = BUG_ADDRESS; const char *argp_program_bug_address = BUG_ADDRESS;
#define OPT_SERVER 0x200
/* GABA: /* GABA:
(class (class
(name lsh_keygen_options) (name lsh_keygen_options)
(vars (vars
(style . sexp_argp_state) (style . sexp_argp_state)
(server . int)
; 'd' means dsa, 'r' rsa ; 'd' means dsa, 'r' rsa
(algorithm . int) (algorithm . int)
(level . int))) (level . int)))
...@@ -72,6 +75,7 @@ make_lsh_keygen_options(void) ...@@ -72,6 +75,7 @@ make_lsh_keygen_options(void)
{ {
NEW(lsh_keygen_options, self); NEW(lsh_keygen_options, self);
self->style = SEXP_TRANSPORT; self->style = SEXP_TRANSPORT;
self->server = 0;
self->level = -1; self->level = -1;
self->algorithm = 'd'; self->algorithm = 'd';
return self; return self;
...@@ -83,6 +87,7 @@ main_options[] = ...@@ -83,6 +87,7 @@ main_options[] =
/* Name, key, arg-name, flags, doc, group */ /* Name, key, arg-name, flags, doc, group */
{ "algorithm", 'a', "Algorithm", 0, "DSA or RSA. " { "algorithm", 'a', "Algorithm", 0, "DSA or RSA. "
"Default is to generate DSA keys", 0 }, "Default is to generate DSA keys", 0 },
{ "server", OPT_SERVER, NULL, 0, "Use the server's seed-file", 0 },
{ "nist-level", 'l', "Security level", 0, "For DSA keys, this is the " { "nist-level", 'l', "Security level", 0, "For DSA keys, this is the "
"NIST security level: Level 0 uses 512-bit primes, level 8 uses " "NIST security level: Level 0 uses 512-bit primes, level 8 uses "
"1024 bit primes, and the default is 8. For RSA keys, it's the " "1024 bit primes, and the default is 8. For RSA keys, it's the "
...@@ -162,7 +167,9 @@ main_argp_parser(int key, char *arg, struct argp_state *state) ...@@ -162,7 +167,9 @@ main_argp_parser(int key, char *arg, struct argp_state *state)
"RSA and DSA."); "RSA and DSA.");
break; break;
case OPT_SERVER:
self->server = 1;
break;
} }
return 0; return 0;
} }
...@@ -179,20 +186,6 @@ main_argp = ...@@ -179,20 +186,6 @@ main_argp =
NULL, NULL NULL, NULL
}; };
#if 0
static void
do_lsh_keygen_handler(struct exception_handler *s UNUSED,
const struct exception *e)
{
werror("lsh-keygen: %z\n", e->msg);
exit(EXIT_FAILURE);
}
static struct exception_handler handler =
STATIC_EXCEPTION_HANDLER(do_lsh_keygen_handler, NULL);
#endif
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
...@@ -207,7 +200,10 @@ main(int argc, char **argv) ...@@ -207,7 +200,10 @@ main(int argc, char **argv)
argp_parse(&main_argp, argc, argv, 0, NULL, options); argp_parse(&main_argp, argc, argv, 0, NULL, options);
r = make_user_random(getenv("HOME")); r = (options->server
? make_system_random()
: make_user_random(getenv("HOME")));
if (!r) if (!r)
{ {
werror("Failed to initialize randomness generator.\n"); werror("Failed to initialize randomness generator.\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment