summaryrefslogtreecommitdiff
path: root/key.c
diff options
context:
space:
mode:
Diffstat (limited to 'key.c')
-rw-r--r--key.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/key.c b/key.c
index 8cecce017..d11b3817a 100644
--- a/key.c
+++ b/key.c
@@ -452,11 +452,11 @@ key_size(Key *k){
452RSA * 452RSA *
453rsa_generate_private_key(u_int bits) 453rsa_generate_private_key(u_int bits)
454{ 454{
455 RSA *private; 455 RSA *private;
456 private = RSA_generate_key(bits, 35, NULL, NULL); 456 private = RSA_generate_key(bits, 35, NULL, NULL);
457 if (private == NULL) 457 if (private == NULL)
458 fatal("rsa_generate_private_key: key generation failed."); 458 fatal("rsa_generate_private_key: key generation failed.");
459 return private; 459 return private;
460} 460}
461 461
462DSA* 462DSA*
@@ -466,9 +466,9 @@ dsa_generate_private_key(u_int bits)
466 if (private == NULL) 466 if (private == NULL)
467 fatal("dsa_generate_private_key: DSA_generate_parameters failed"); 467 fatal("dsa_generate_private_key: DSA_generate_parameters failed");
468 if (!DSA_generate_key(private)) 468 if (!DSA_generate_key(private))
469 fatal("dsa_generate_private_key: DSA_generate_key failed."); 469 fatal("dsa_generate_private_key: DSA_generate_key failed.");
470 if (private == NULL) 470 if (private == NULL)
471 fatal("dsa_generate_private_key: NULL."); 471 fatal("dsa_generate_private_key: NULL.");
472 return private; 472 return private;
473} 473}
474 474
@@ -477,7 +477,7 @@ key_generate(int type, u_int bits)
477{ 477{
478 Key *k = key_new(KEY_UNSPEC); 478 Key *k = key_new(KEY_UNSPEC);
479 switch (type) { 479 switch (type) {
480 case KEY_DSA: 480 case KEY_DSA:
481 k->dsa = dsa_generate_private_key(bits); 481 k->dsa = dsa_generate_private_key(bits);
482 break; 482 break;
483 case KEY_RSA: 483 case KEY_RSA:
@@ -485,9 +485,9 @@ key_generate(int type, u_int bits)
485 k->rsa = rsa_generate_private_key(bits); 485 k->rsa = rsa_generate_private_key(bits);
486 break; 486 break;
487 default: 487 default:
488 fatal("key_generate: unknown type %d", type); 488 fatal("key_generate: unknown type %d", type);
489 } 489 }
490 k->type = type; 490 k->type = type;
491 return k; 491 return k;
492} 492}
493 493
@@ -496,7 +496,7 @@ key_from_private(Key *k)
496{ 496{
497 Key *n = NULL; 497 Key *n = NULL;
498 switch (k->type) { 498 switch (k->type) {
499 case KEY_DSA: 499 case KEY_DSA:
500 n = key_new(k->type); 500 n = key_new(k->type);
501 BN_copy(n->dsa->p, k->dsa->p); 501 BN_copy(n->dsa->p, k->dsa->p);
502 BN_copy(n->dsa->q, k->dsa->q); 502 BN_copy(n->dsa->q, k->dsa->q);
@@ -510,7 +510,7 @@ key_from_private(Key *k)
510 BN_copy(n->rsa->e, k->rsa->e); 510 BN_copy(n->rsa->e, k->rsa->e);
511 break; 511 break;
512 default: 512 default:
513 fatal("key_from_private: unknown type %d", k->type); 513 fatal("key_from_private: unknown type %d", k->type);
514 break; 514 break;
515 } 515 }
516 return n; 516 return n;