aboutsummaryrefslogtreecommitdiff
path: root/src/util/crypto_ksk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/crypto_ksk.c')
-rw-r--r--src/util/crypto_ksk.c46
1 files changed, 20 insertions, 26 deletions
diff --git a/src/util/crypto_ksk.c b/src/util/crypto_ksk.c
index 7c23fc1e0..bec87c803 100644
--- a/src/util/crypto_ksk.c
+++ b/src/util/crypto_ksk.c
@@ -397,8 +397,8 @@ gen_prime (gcry_mpi_t * ptest, unsigned int nbits, GNUNET_HashCode * hc)
397 * @param hc the HC to use for PRNG (modified!) 397 * @param hc the HC to use for PRNG (modified!)
398 */ 398 */
399static void 399static void
400generate_kblock_key (KBlock_secret_key *sk, 400generate_kblock_key (KBlock_secret_key *sk, unsigned int nbits,
401 unsigned int nbits, GNUNET_HashCode * hc) 401 GNUNET_HashCode * hc)
402{ 402{
403 gcry_mpi_t t1, t2; 403 gcry_mpi_t t1, t2;
404 gcry_mpi_t phi; /* helper: (p-1)(q-1) */ 404 gcry_mpi_t phi; /* helper: (p-1)(q-1) */
@@ -569,10 +569,9 @@ ksk_decode_key (const struct KskRsaPrivateKeyBinaryEncoded *encoding)
569 569
570 pos = 0; 570 pos = 0;
571 size = ntohs (encoding->sizen); 571 size = ntohs (encoding->sizen);
572 rc = gcry_mpi_scan (&n, 572 rc = gcry_mpi_scan (&n, GCRYMPI_FMT_USG,
573 GCRYMPI_FMT_USG, 573 &((const unsigned char *) (&encoding[1]))[pos], size,
574 &((const unsigned char *) (&encoding[1]))[pos], 574 &size);
575 size, &size);
576 pos += ntohs (encoding->sizen); 575 pos += ntohs (encoding->sizen);
577 if (rc) 576 if (rc)
578 { 577 {
@@ -580,10 +579,9 @@ ksk_decode_key (const struct KskRsaPrivateKeyBinaryEncoded *encoding)
580 return NULL; 579 return NULL;
581 } 580 }
582 size = ntohs (encoding->sizee); 581 size = ntohs (encoding->sizee);
583 rc = gcry_mpi_scan (&e, 582 rc = gcry_mpi_scan (&e, GCRYMPI_FMT_USG,
584 GCRYMPI_FMT_USG, 583 &((const unsigned char *) (&encoding[1]))[pos], size,
585 &((const unsigned char *) (&encoding[1]))[pos], 584 &size);
586 size, &size);
587 pos += ntohs (encoding->sizee); 585 pos += ntohs (encoding->sizee);
588 if (rc) 586 if (rc)
589 { 587 {
@@ -592,10 +590,9 @@ ksk_decode_key (const struct KskRsaPrivateKeyBinaryEncoded *encoding)
592 return NULL; 590 return NULL;
593 } 591 }
594 size = ntohs (encoding->sized); 592 size = ntohs (encoding->sized);
595 rc = gcry_mpi_scan (&d, 593 rc = gcry_mpi_scan (&d, GCRYMPI_FMT_USG,
596 GCRYMPI_FMT_USG, 594 &((const unsigned char *) (&encoding[1]))[pos], size,
597 &((const unsigned char *) (&encoding[1]))[pos], 595 &size);
598 size, &size);
599 pos += ntohs (encoding->sized); 596 pos += ntohs (encoding->sized);
600 if (rc) 597 if (rc)
601 { 598 {
@@ -608,10 +605,9 @@ ksk_decode_key (const struct KskRsaPrivateKeyBinaryEncoded *encoding)
608 size = ntohs (encoding->sizep); 605 size = ntohs (encoding->sizep);
609 if (size > 0) 606 if (size > 0)
610 { 607 {
611 rc = gcry_mpi_scan (&q, 608 rc = gcry_mpi_scan (&q, GCRYMPI_FMT_USG,
612 GCRYMPI_FMT_USG, 609 &((const unsigned char *) (&encoding[1]))[pos], size,
613 &((const unsigned char *) (&encoding[1]))[pos], 610 &size);
614 size, &size);
615 pos += ntohs (encoding->sizep); 611 pos += ntohs (encoding->sizep);
616 if (rc) 612 if (rc)
617 { 613 {
@@ -627,10 +623,9 @@ ksk_decode_key (const struct KskRsaPrivateKeyBinaryEncoded *encoding)
627 size = ntohs (encoding->sizeq); 623 size = ntohs (encoding->sizeq);
628 if (size > 0) 624 if (size > 0)
629 { 625 {
630 rc = gcry_mpi_scan (&p, 626 rc = gcry_mpi_scan (&p, GCRYMPI_FMT_USG,
631 GCRYMPI_FMT_USG, 627 &((const unsigned char *) (&encoding[1]))[pos], size,
632 &((const unsigned char *) (&encoding[1]))[pos], 628 &size);
633 size, &size);
634 pos += ntohs (encoding->sizeq); 629 pos += ntohs (encoding->sizeq);
635 if (rc) 630 if (rc)
636 { 631 {
@@ -652,10 +647,9 @@ ksk_decode_key (const struct KskRsaPrivateKeyBinaryEncoded *encoding)
652 pos; 647 pos;
653 if (size > 0) 648 if (size > 0)
654 { 649 {
655 rc = gcry_mpi_scan (&u, 650 rc = gcry_mpi_scan (&u, GCRYMPI_FMT_USG,
656 GCRYMPI_FMT_USG, 651 &((const unsigned char *) (&encoding[1]))[pos], size,
657 &((const unsigned char *) (&encoding[1]))[pos], 652 &size);
658 size, &size);
659 if (rc) 653 if (rc)
660 { 654 {
661 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc); 655 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_mpi_scan", rc);