diff options
author | Matt Johnston <matt@ucc.asn.au> | 2013-11-01 00:14:48 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2013-11-01 00:14:48 +0800 |
commit | f66fc01620f7a13d4763781059f4f01f8393809d (patch) | |
tree | dc6814959f974bfb516c392013d67f417f0b385a /dropbearkey.c | |
parent | 8eefb092c83f8f89f4d5574e4a05799eb9df3de8 (diff) | |
parent | 082a2dde354eb624b6fee33767e68e5b05dcde25 (diff) |
Merge
Diffstat (limited to 'dropbearkey.c')
-rw-r--r-- | dropbearkey.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/dropbearkey.c b/dropbearkey.c index eecfbcc..57db3af 100644 --- a/dropbearkey.c +++ b/dropbearkey.c @@ -57,7 +57,7 @@ static void printhelp(char * progname); -#define RSA_DEFAULT_SIZE 1024 +#define RSA_DEFAULT_SIZE 2048 #define DSS_DEFAULT_SIZE 1024 static void buf_writefile(buffer * buf, const char * filename); @@ -185,7 +185,24 @@ int main(int argc, char ** argv) { exit(EXIT_FAILURE); } - keytype = signkey_type_from_name(typetext, strlen(typetext)); +#ifdef DROPBEAR_RSA + if (strcmp(typetext, "rsa") == 0) + { + keytype = DROPBEAR_SIGNKEY_RSA; + } +#endif +#ifdef DROPBEAR_DSS + if (strcmp(typetext, "dss") == 0) + { + keytype = DROPBEAR_SIGNKEY_DSS; + } +#endif +#ifdef DROPBEAR_ECDSA + if (strcmp(typetext, "ecdsa") == 0) + { + keytype = DROPBEAR_SIGNKEY_ECDSA_KEYGEN; + } +#endif if (keytype == DROPBEAR_SIGNKEY_NONE) { fprintf(stderr, "Unknown key type '%s'\n", typetext); @@ -221,10 +238,13 @@ int main(int argc, char ** argv) { (void)0; /* quiet, compiler. ecdsa handles checks itself */ } + } else { + /* default key size */ + switch (keytype) { #ifdef DROPBEAR_RSA case DROPBEAR_SIGNKEY_RSA: - bits = RSA_DEFAULT_SIZE; + bits = RSA_DEFAULT_SIZE; break; #endif #ifdef DROPBEAR_DSS @@ -269,7 +289,7 @@ int main(int argc, char ** argv) { { ecc_key *ecckey = gen_ecdsa_priv_key(bits); keytype = ecdsa_signkey_type(ecckey); - *signkey_ecc_key_ptr(key, keytype) = ecckey; + *signkey_key_ptr(key, keytype) = ecckey; } break; #endif @@ -299,7 +319,7 @@ static void justprintpub(const char* filename) { buffer *buf = NULL; sign_key *key = NULL; - int keytype; + enum signkey_type keytype; int ret; int err = DROPBEAR_FAILURE; |