comparison common-algo.c @ 848:6c69e7df3621 ecc

curve25519
author Matt Johnston <matt@ucc.asn.au>
date Fri, 08 Nov 2013 23:11:43 +0800
parents 5128e525c8fa
children 7540c0822374
comparison
equal deleted inserted replaced
845:774ad9b112ef 848:6c69e7df3621
226 {"ssh-dss", DROPBEAR_SIGNKEY_DSS, NULL, 1, NULL}, 226 {"ssh-dss", DROPBEAR_SIGNKEY_DSS, NULL, 1, NULL},
227 #endif 227 #endif
228 {NULL, 0, NULL, 0, NULL} 228 {NULL, 0, NULL, 0, NULL}
229 }; 229 };
230 230
231 static struct dropbear_kex kex_dh_group1 = {dh_p_1, DH_P_1_LEN, NULL, &sha1_desc }; 231 static const struct dropbear_kex kex_dh_group1 = {DROPBEAR_KEX_NORMAL_DH, dh_p_1, DH_P_1_LEN, NULL, &sha1_desc };
232 static struct dropbear_kex kex_dh_group14 = {dh_p_14, DH_P_14_LEN, NULL, &sha1_desc }; 232 static const struct dropbear_kex kex_dh_group14 = {DROPBEAR_KEX_NORMAL_DH, dh_p_14, DH_P_14_LEN, NULL, &sha1_desc };
233 233
234 #ifdef DROPBEAR_ECDH 234 #ifdef DROPBEAR_ECDH
235 #ifdef DROPBEAR_ECC_256 235 #ifdef DROPBEAR_ECC_256
236 static struct dropbear_kex kex_ecdh_nistp256 = {NULL, 0, &ecc_curve_nistp256, &sha256_desc }; 236 static struct dropbear_kex kex_ecdh_nistp256 = {DROPBEAR_KEX_ECDH, NULL, 0, &ecc_curve_nistp256, &sha256_desc };
237 #endif 237 #endif
238 #ifdef DROPBEAR_ECC_384 238 #ifdef DROPBEAR_ECC_384
239 static struct dropbear_kex kex_ecdh_nistp384 = {NULL, 0, &ecc_curve_nistp384, &sha384_desc }; 239 static struct dropbear_kex kex_ecdh_nistp384 = {DROPBEAR_KEX_ECDH, NULL, 0, &ecc_curve_nistp384, &sha384_desc };
240 #endif 240 #endif
241 #ifdef DROPBEAR_ECC_521 241 #ifdef DROPBEAR_ECC_521
242 static struct dropbear_kex kex_ecdh_nistp521 = {NULL, 0, &ecc_curve_nistp521, &sha512_desc }; 242 static struct dropbear_kex kex_ecdh_nistp521 = {DROPBEAR_KEX_ECDH, NULL, 0, &ecc_curve_nistp521, &sha512_desc };
243 #endif 243 #endif
244 #endif // DROPBEAR_ECDH 244 #endif /* DROPBEAR_ECDH */
245 245
246 #ifdef DROPBEAR_CURVE25519
247 /* Referred to directly */
248 const struct dropbear_kex kex_curve25519 = {DROPBEAR_KEX_CURVE25519, NULL, 0, NULL, &sha256_desc };
249 #endif
246 250
247 algo_type sshkex[] = { 251 algo_type sshkex[] = {
252 #ifdef DROPBEAR_CURVE25519
253 {"[email protected]", 0, &kex_curve25519, 1, NULL},
254 #endif
248 #ifdef DROPBEAR_ECDH 255 #ifdef DROPBEAR_ECDH
249 #ifdef DROPBEAR_ECC_521 256 #ifdef DROPBEAR_ECC_521
250 {"ecdh-sha2-nistp521", 0, &kex_ecdh_nistp521, 1, NULL}, 257 {"ecdh-sha2-nistp521", 0, &kex_ecdh_nistp521, 1, NULL},
251 #endif 258 #endif
252 #ifdef DROPBEAR_ECC_384 259 #ifdef DROPBEAR_ECC_384
287 294
288 unsigned int i, len; 295 unsigned int i, len;
289 unsigned int donefirst = 0; 296 unsigned int donefirst = 0;
290 buffer *algolist = NULL; 297 buffer *algolist = NULL;
291 298
292 algolist = buf_new(160); 299 algolist = buf_new(200);
293 for (i = 0; localalgos[i].name != NULL; i++) { 300 for (i = 0; localalgos[i].name != NULL; i++) {
294 if (localalgos[i].usable) { 301 if (localalgos[i].usable) {
295 if (donefirst) 302 if (donefirst)
296 buf_putbyte(algolist, ','); 303 buf_putbyte(algolist, ',');
297 donefirst = 1; 304 donefirst = 1;