comparison gensignkey.c @ 1659:d32bcb5c557d

Add Ed25519 support (#91) * Add support for Ed25519 as a public key type Ed25519 is a elliptic curve signature scheme that offers better security than ECDSA and DSA and good performance. It may be used for both user and host keys. OpenSSH key import and fuzzer are not supported yet. Initially inspired by Peter Szabo. * Add curve25519 and ed25519 fuzzers * Add import and export of Ed25519 keys
author Vladislav Grishenko <themiron@users.noreply.github.com>
date Wed, 11 Mar 2020 21:09:45 +0500
parents 7402218141d4
children c795520269f9
comparison
equal deleted inserted replaced
1658:7402218141d4 1659:d32bcb5c557d
2 #include "dbutil.h" 2 #include "dbutil.h"
3 #include "buffer.h" 3 #include "buffer.h"
4 #include "ecdsa.h" 4 #include "ecdsa.h"
5 #include "genrsa.h" 5 #include "genrsa.h"
6 #include "gendss.h" 6 #include "gendss.h"
7 #include "gened25519.h"
7 #include "signkey.h" 8 #include "signkey.h"
8 #include "dbrandom.h" 9 #include "dbrandom.h"
9 10
10 /* Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ 11 /* Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
11 static int buf_writefile(buffer * buf, const char * filename) { 12 static int buf_writefile(buffer * buf, const char * filename) {
67 case DROPBEAR_SIGNKEY_ECDSA_NISTP384: 68 case DROPBEAR_SIGNKEY_ECDSA_NISTP384:
68 return 384; 69 return 384;
69 case DROPBEAR_SIGNKEY_ECDSA_NISTP256: 70 case DROPBEAR_SIGNKEY_ECDSA_NISTP256:
70 return 256; 71 return 256;
71 #endif 72 #endif
73 #if DROPBEAR_ED25519
74 case DROPBEAR_SIGNKEY_ED25519:
75 return 256;
76 #endif
72 default: 77 default:
73 return 0; 78 return 0;
74 } 79 }
75 } 80 }
76 81
115 { 120 {
116 ecc_key *ecckey = gen_ecdsa_priv_key(bits); 121 ecc_key *ecckey = gen_ecdsa_priv_key(bits);
117 keytype = ecdsa_signkey_type(ecckey); 122 keytype = ecdsa_signkey_type(ecckey);
118 *signkey_key_ptr(key, keytype) = ecckey; 123 *signkey_key_ptr(key, keytype) = ecckey;
119 } 124 }
125 break;
126 #endif
127 #if DROPBEAR_ED25519
128 case DROPBEAR_SIGNKEY_ED25519:
129 key->ed25519key = gen_ed25519_priv_key(bits);
120 break; 130 break;
121 #endif 131 #endif
122 default: 132 default:
123 dropbear_exit("Internal error"); 133 dropbear_exit("Internal error");
124 } 134 }