if (keytype != NOKEYGEN) {
char *entropy;
char default_comment[80];
- time_t t;
- struct tm *tm;
+ struct tm tm;
struct progress prog;
prog.phase = -1;
prog.current = -1;
- time(&t);
- tm = localtime(&t);
+ tm = ltime();
if (keytype == DSA)
- strftime(default_comment, 30, "dsa-key-%Y%m%d", tm);
+ strftime(default_comment, 30, "dsa-key-%Y%m%d", &tm);
else
- strftime(default_comment, 30, "rsa-key-%Y%m%d", tm);
+ strftime(default_comment, 30, "rsa-key-%Y%m%d", &tm);
- random_init();
+ random_ref();
entropy = get_random_data(bits / 8);
random_add_heavynoise(entropy, bits / 8);
memset(entropy, 0, bits/8);
case SSH_KEYTYPE_OPENSSH:
case SSH_KEYTYPE_SSHCOM:
- ssh2key = import_ssh2(&infilename, intype, passphrase);
- if (ssh2key && ssh2key != SSH2_WRONG_PASSPHRASE)
- error = NULL;
- else if (!error) {
- if (ssh2key == SSH2_WRONG_PASSPHRASE)
- error = "wrong passphrase";
+ ssh2key = import_ssh2(&infilename, intype, passphrase, &error);
+ if (ssh2key) {
+ if (ssh2key != SSH2_WRONG_PASSPHRASE)
+ error = NULL;
else
- error = "unknown error";
- }
+ error = "wrong passphrase";
+ } else if (!error)
+ error = "unknown error";
break;
default: