diff options
author | Jeff Burdges <burdges@gnunet.org> | 2016-03-21 14:40:06 +0000 |
---|---|---|
committer | Jeff Burdges <burdges@gnunet.org> | 2016-03-21 14:40:06 +0000 |
commit | 0ed9622f1a7adf7b7e429b29c1245f0fa6420004 (patch) | |
tree | a0bc80067a59c802a1c2548f9c723fee875f828a /src/util/crypto_rsa.c | |
parent | ac6fdcd25f70f3c1758baf333ad5c583fce57151 (diff) | |
download | gnunet-0ed9622f1a7adf7b7e429b29c1245f0fa6420004.tar.gz gnunet-0ed9622f1a7adf7b7e429b29c1245f0fa6420004.zip |
Authors, (C), and C++ comments
Diffstat (limited to 'src/util/crypto_rsa.c')
-rw-r--r-- | src/util/crypto_rsa.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c index d57a5ae35..71d769848 100644 --- a/src/util/crypto_rsa.c +++ b/src/util/crypto_rsa.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2014 GNUnet e.V. | 3 | Copyright (C) 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify it under the | 5 | GNUnet is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU General Public License as published by the Free Software | 6 | terms of the GNU General Public License as published by the Free Software |
@@ -19,6 +19,7 @@ | |||
19 | * @brief Chaum-style Blind signatures based on RSA | 19 | * @brief Chaum-style Blind signatures based on RSA |
20 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> | 20 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> |
21 | * @author Christian Grothoff | 21 | * @author Christian Grothoff |
22 | * @author Jeffrey Burdges <burdges@gnunet.org> | ||
22 | */ | 23 | */ |
23 | #include "platform.h" | 24 | #include "platform.h" |
24 | #include <gcrypt.h> | 25 | #include <gcrypt.h> |
@@ -692,10 +693,10 @@ rsa_full_domain_hash (gcry_mpi_t *r, | |||
692 | if (0 != rc) | 693 | if (0 != rc) |
693 | return rc; | 694 | return rc; |
694 | 695 | ||
695 | // We seed with the public denomination key as a homage to RSA-PSS by | 696 | /* We seed with the public denomination key as a homage to RSA-PSS by * |
696 | // Mihir Bellare and Phillip Rogaway. Doing this lowers the degree | 697 | * Mihir Bellare and Phillip Rogaway. Doing this lowers the degree * |
697 | // of the hypothetical polyomial-time attack on RSA-KTI created by a | 698 | * of the hypothetical polyomial-time attack on RSA-KTI created by a * |
698 | // polynomial-time one-more forgary attack. Yey seeding! | 699 | * polynomial-time one-more forgary attack. Yey seeding! */ |
699 | buf_len = GNUNET_CRYPTO_rsa_public_key_encode (pkey, &buf); | 700 | buf_len = GNUNET_CRYPTO_rsa_public_key_encode (pkey, &buf); |
700 | gcry_md_write (h, buf, buf_len); | 701 | gcry_md_write (h, buf, buf_len); |
701 | GNUNET_free (buf); | 702 | GNUNET_free (buf); |
@@ -734,9 +735,9 @@ rsa_full_domain_hash (gcry_mpi_t *r, | |||
734 | if (0 != rc) | 735 | if (0 != rc) |
735 | return rc; | 736 | return rc; |
736 | 737 | ||
737 | // Do not allow *r to exceed n or signatures fail to verify unpredictably. | 738 | /* Do not allow *r to exceed n or signatures fail to verify unpredictably. * |
738 | // This happening with gcry_mpi_clear_highbit (*r, nbits-1) so maybe | 739 | * This happening with gcry_mpi_clear_highbit (*r, nbits-1) so maybe * |
739 | // gcry_mpi_clear_highbit is broken, but setting the highbit sounds good. | 740 | * gcry_mpi_clear_highbit is broken, but setting the highbit sounds good. */ |
740 | gcry_mpi_set_highbit (*r, nbits-2); | 741 | gcry_mpi_set_highbit (*r, nbits-2); |
741 | return rc; | 742 | return rc; |
742 | } | 743 | } |
@@ -777,7 +778,7 @@ GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, | |||
777 | } | 778 | } |
778 | 779 | ||
779 | rc = rsa_full_domain_hash (&data, hash, pkey, &rsize); | 780 | rc = rsa_full_domain_hash (&data, hash, pkey, &rsize); |
780 | if (0 != rc) // Allocation error in libgcrypt | 781 | if (0 != rc) /* Allocation error in libgcrypt */ |
781 | { | 782 | { |
782 | GNUNET_break (0); | 783 | GNUNET_break (0); |
783 | gcry_mpi_release (ne[0]); | 784 | gcry_mpi_release (ne[0]); |
@@ -1131,7 +1132,7 @@ GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, | |||
1131 | int rc; | 1132 | int rc; |
1132 | 1133 | ||
1133 | rc = rsa_full_domain_hash (&r, hash, pkey, NULL); | 1134 | rc = rsa_full_domain_hash (&r, hash, pkey, NULL); |
1134 | GNUNET_assert (0 == rc); // Allocation error in libgcrypt | 1135 | GNUNET_assert (0 == rc); /* Allocation error in libgcrypt */ |
1135 | data = mpi_to_sexp(r); | 1136 | data = mpi_to_sexp(r); |
1136 | gcry_mpi_release (r); | 1137 | gcry_mpi_release (r); |
1137 | 1138 | ||