comparison signkey.c @ 846:b298bb438625 keyondemand

refactor key generation, make it generate as required. Needs UI in server command line options
author Matt Johnston <matt@ucc.asn.au>
date Thu, 07 Nov 2013 00:18:52 +0800
parents d4ce5269a439
children f4bb964c8678
comparison
equal deleted inserted replaced
845:774ad9b112ef 846:b298bb438625
179 m_free(key->rsakey); 179 m_free(key->rsakey);
180 } 180 }
181 } 181 }
182 #endif 182 #endif
183 #ifdef DROPBEAR_ECDSA 183 #ifdef DROPBEAR_ECDSA
184 { 184 if (signkey_is_ecdsa(keytype)) {
185 ecc_key **eck = (ecc_key**)signkey_key_ptr(key, keytype); 185 ecc_key **eck = (ecc_key**)signkey_key_ptr(key, keytype);
186 if (eck) { 186 if (eck) {
187 if (*eck) { 187 if (*eck) {
188 ecc_free(*eck); 188 ecc_free(*eck);
189 *eck = NULL; 189 *eck = NULL;
247 m_free(key->rsakey); 247 m_free(key->rsakey);
248 } 248 }
249 } 249 }
250 #endif 250 #endif
251 #ifdef DROPBEAR_ECDSA 251 #ifdef DROPBEAR_ECDSA
252 { 252 if (signkey_is_ecdsa(keytype)) {
253 ecc_key **eck = (ecc_key**)signkey_key_ptr(key, keytype); 253 ecc_key **eck = (ecc_key**)signkey_key_ptr(key, keytype);
254 if (eck) { 254 if (eck) {
255 if (*eck) { 255 if (*eck) {
256 ecc_free(*eck); 256 ecc_free(*eck);
257 *eck = NULL; 257 *eck = NULL;
287 if (type == DROPBEAR_SIGNKEY_RSA) { 287 if (type == DROPBEAR_SIGNKEY_RSA) {
288 buf_put_rsa_pub_key(pubkeys, key->rsakey); 288 buf_put_rsa_pub_key(pubkeys, key->rsakey);
289 } 289 }
290 #endif 290 #endif
291 #ifdef DROPBEAR_ECDSA 291 #ifdef DROPBEAR_ECDSA
292 if (type == DROPBEAR_SIGNKEY_ECDSA_NISTP256 292 if (signkey_is_ecdsa(type)) {
293 || type == DROPBEAR_SIGNKEY_ECDSA_NISTP384
294 || type == DROPBEAR_SIGNKEY_ECDSA_NISTP521)
295 {
296 ecc_key **eck = (ecc_key**)signkey_key_ptr(key, type); 293 ecc_key **eck = (ecc_key**)signkey_key_ptr(key, type);
297 if (eck) { 294 if (eck) {
298 buf_put_ecdsa_pub_key(pubkeys, *eck); 295 buf_put_ecdsa_pub_key(pubkeys, *eck);
299 } 296 }
300 } 297 }
327 TRACE(("leave buf_put_priv_key: rsa done")) 324 TRACE(("leave buf_put_priv_key: rsa done"))
328 return; 325 return;
329 } 326 }
330 #endif 327 #endif
331 #ifdef DROPBEAR_ECDSA 328 #ifdef DROPBEAR_ECDSA
332 { 329 if (signkey_is_ecdsa(type)) {
333 ecc_key **eck = (ecc_key**)signkey_key_ptr(key, type); 330 ecc_key **eck = (ecc_key**)signkey_key_ptr(key, type);
334 if (eck) { 331 if (eck) {
335 buf_put_ecdsa_priv_key(buf, *eck); 332 buf_put_ecdsa_priv_key(buf, *eck);
336 TRACE(("leave buf_put_priv_key: ecdsa done")) 333 TRACE(("leave buf_put_priv_key: ecdsa done"))
337 return; 334 return;
482 if (type == DROPBEAR_SIGNKEY_RSA) { 479 if (type == DROPBEAR_SIGNKEY_RSA) {
483 buf_put_rsa_sign(sigblob, key->rsakey, data_buf); 480 buf_put_rsa_sign(sigblob, key->rsakey, data_buf);
484 } 481 }
485 #endif 482 #endif
486 #ifdef DROPBEAR_ECDSA 483 #ifdef DROPBEAR_ECDSA
487 { 484 if (signkey_is_ecdsa(type)) {
488 ecc_key **eck = (ecc_key**)signkey_key_ptr(key, type); 485 ecc_key **eck = (ecc_key**)signkey_key_ptr(key, type);
489 if (eck) { 486 if (eck) {
490 buf_put_ecdsa_sign(sigblob, *eck, data_buf); 487 buf_put_ecdsa_sign(sigblob, *eck, data_buf);
491 } 488 }
492 } 489 }
533 } 530 }
534 return buf_rsa_verify(buf, key->rsakey, data_buf); 531 return buf_rsa_verify(buf, key->rsakey, data_buf);
535 } 532 }
536 #endif 533 #endif
537 #ifdef DROPBEAR_ECDSA 534 #ifdef DROPBEAR_ECDSA
538 { 535 if (signkey_is_ecdsa(type)) {
539 ecc_key **eck = (ecc_key**)signkey_key_ptr(key, type); 536 ecc_key **eck = (ecc_key**)signkey_key_ptr(key, type);
540 if (eck) { 537 if (eck) {
541 return buf_ecdsa_verify(buf, *eck, data_buf); 538 return buf_ecdsa_verify(buf, *eck, data_buf);
542 } 539 }
543 } 540 }