Skip to content

Commit

Permalink
dropbearkey: make rsa as a default value for -t
Browse files Browse the repository at this point in the history
The OpenSSH ssh-keygen allows to omit the -t and will use ed25519 by default.
Previously it used RSA by default.

For a better compatibility and simplification do the same.

Since any algorithm can be disabled we should make a default with a better enabled option.
  • Loading branch information
stokito authored and mkj committed Dec 31, 2023
1 parent 17657c3 commit 41a6abc
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/dropbearkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@
#include "dbrandom.h"
#include "gensignkey.h"

#if DROPBEAR_ED25519
#define DEFAULT_KEY_TYPE_NAME "ed25519"
#elif DROPBEAR_RSA
/* Different to the sigalgs list because negotiated hostkeys have fallbacks for compatibility,
* whereas a generated authkey doesn't, so RSA needs to be higher than ECDSA */
#define DEFAULT_KEY_TYPE_NAME "rsa"
#elif DROPBEAR_ECDSA
#define DEFAULT_KEY_TYPE_NAME "ecdsa"
#elif DROPBEAR_DSS
#define DEFAULT_KEY_TYPE_NAME "dss"
#endif

static void printhelp(char * progname);


Expand Down Expand Up @@ -157,7 +169,7 @@ int main(int argc, char ** argv) {
char ** next = NULL;
char * filename = NULL;
enum signkey_type keytype = DROPBEAR_SIGNKEY_NONE;
char * typetext = NULL;
char * typetext = DEFAULT_KEY_TYPE_NAME;
char * sizetext = NULL;
char * passphrase = NULL;
unsigned int bits = 0, genbits;
Expand Down Expand Up @@ -225,13 +237,6 @@ int main(int argc, char ** argv) {
exit(ret);
}

/* check/parse args */
if (!typetext) {
fprintf(stderr, "Must specify key type\n");
printhelp(argv[0]);
exit(EXIT_FAILURE);
}

#if DROPBEAR_RSA
if (strcmp(typetext, "rsa") == 0)
{
Expand Down

0 comments on commit 41a6abc

Please sign in to comment.