summaryrefslogtreecommitdiffhomepage
path: root/dropbearkey.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2020-10-15 19:55:15 +0800
committerMatt Johnston <matt@ucc.asn.au>2020-10-15 19:55:15 +0800
commit0e3e8db5bfca0c579be55e7580a46c593c1384be (patch)
tree2b1a718f633fb95c1f2d689a591cf9e8642697f3 /dropbearkey.c
parent78e17f6ee9a944430da3e517ee1fe384fd6b275b (diff)
parent17873e8c922eded2cec86184673a6d110df6403f (diff)
merge from main
--HG-- branch : fuzz
Diffstat (limited to 'dropbearkey.c')
-rw-r--r--dropbearkey.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/dropbearkey.c b/dropbearkey.c
index dd0e697..8d8c7c2 100644
--- a/dropbearkey.c
+++ b/dropbearkey.c
@@ -43,6 +43,10 @@
* mp_int y
* mp_int x
*
+ * Ed25519:
+ * string "ssh-ed25519"
+ * string k (32 bytes) + A (32 bytes)
+ *
*/
#include "includes.h"
#include "signkey.h"
@@ -51,6 +55,7 @@
#include "genrsa.h"
#include "gendss.h"
+#include "gened25519.h"
#include "ecdsa.h"
#include "crypto_desc.h"
#include "dbrandom.h"
@@ -76,6 +81,9 @@ static void printhelp(char * progname) {
#if DROPBEAR_ECDSA
" ecdsa\n"
#endif
+#if DROPBEAR_ED25519
+ " ed25519\n"
+#endif
"-f filename Use filename for the secret key.\n"
" ~/.ssh/id_dropbear is recommended for client keys.\n"
"-s bits Key size in bits, should be a multiple of 8 (optional)\n"
@@ -95,6 +103,9 @@ static void printhelp(char * progname) {
#endif
"\n"
#endif
+#if DROPBEAR_ED25519
+ " Ed25519 has a fixed size of 256 bits\n"
+#endif
"-y Just print the publickey and fingerprint for the\n private key in <filename>.\n"
#if DEBUG_TRACE
"-v verbose\n"
@@ -106,6 +117,14 @@ static void printhelp(char * progname) {
static void check_signkey_bits(enum signkey_type type, int bits)
{
switch (type) {
+#if DROPBEAR_ED25519
+ case DROPBEAR_SIGNKEY_ED25519:
+ if (bits != 256) {
+ dropbear_exit("Ed25519 keys have a fixed size of 256 bits\n");
+ exit(EXIT_FAILURE);
+ }
+ break;
+#endif
#if DROPBEAR_RSA
case DROPBEAR_SIGNKEY_RSA:
if (bits < 512 || bits > 4096 || (bits % 8 != 0)) {
@@ -114,7 +133,7 @@ static void check_signkey_bits(enum signkey_type type, int bits)
}
break;
#endif
-#ifdef DROPEAR_DSS
+#if DROPEAR_DSS
case DROPBEAR_SIGNKEY_DSS:
if (bits != 1024) {
dropbear_exit("DSS keys have a fixed size of 1024 bits\n");
@@ -224,6 +243,12 @@ int main(int argc, char ** argv) {
keytype = DROPBEAR_SIGNKEY_ECDSA_KEYGEN;
}
#endif
+#if DROPBEAR_ED25519
+ if (strcmp(typetext, "ed25519") == 0)
+ {
+ keytype = DROPBEAR_SIGNKEY_ED25519;
+ }
+#endif
if (keytype == DROPBEAR_SIGNKEY_NONE) {
fprintf(stderr, "Unknown key type '%s'\n", typetext);