WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
}
-/**
- * Compare two Peer Identities.
- *
- * @param first first peer identity
- * @param second second peer identity
- * @return bigger than 0 if first > second,
- * 0 if they are the same
- * smaller than 0 if second > first
- */
-int
-GNUNET_CRYPTO_cmp_peer_identity (const struct GNUNET_PeerIdentity *first,
- const struct GNUNET_PeerIdentity *second)
-{
- return memcmp (first, second, sizeof (struct GNUNET_PeerIdentity));
-}
-
-
/**
* Convert the data specified in the given purpose argument to an
* S-expression suitable for signature operations.
static gcry_sexp_t
data_to_eddsa_value (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose)
{
- struct GNUNET_HashCode hc;
gcry_sexp_t data;
int rc;
+/* SEE #5398 */
+#if 1
+ struct GNUNET_HashCode hc;
+
+ GNUNET_CRYPTO_hash (purpose,
+ ntohl (purpose->size),
+ &hc);
+ if (0 != (rc = gcry_sexp_build (&data, NULL,
+ "(data(flags eddsa)(hash-algo %s)(value %b))",
+ "sha512",
+ (int)sizeof (hc),
+ &hc)))
+ {
+ LOG_GCRY (GNUNET_ERROR_TYPE_ERROR,
+ "gcry_sexp_build",
+ rc);
+ return NULL;
+ }
+#else
GNUNET_CRYPTO_hash (purpose, ntohl (purpose->size), &hc);
if (0 != (rc = gcry_sexp_build (&data, NULL,
"(data(flags eddsa)(hash-algo %s)(value %b))",
"sha512",
- (int)sizeof (hc), &hc)))
+ ntohl (purpose->size),
+ purpose)))
{
- LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc);
+ LOG_GCRY (GNUNET_ERROR_TYPE_ERROR,
+ "gcry_sexp_build",
+ rc);
return NULL;
}
+#endif
return data;
}
static gcry_sexp_t
data_to_ecdsa_value (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose)
{
- struct GNUNET_HashCode hc;
gcry_sexp_t data;
int rc;
- GNUNET_CRYPTO_hash (purpose, ntohl (purpose->size), &hc);
+/* See #5398 */
+#if 1
+ struct GNUNET_HashCode hc;
+
+ GNUNET_CRYPTO_hash (purpose,
+ ntohl (purpose->size),
+ &hc);
if (0 != (rc = gcry_sexp_build (&data, NULL,
"(data(flags rfc6979)(hash %s %b))",
"sha512",
(int)sizeof (hc), &hc)))
{
- LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc);
+ LOG_GCRY (GNUNET_ERROR_TYPE_ERROR,
+ "gcry_sexp_build",
+ rc);
return NULL;
}
+#else
+ if (0 != (rc = gcry_sexp_build (&data, NULL,
+ "(data(flags rfc6979)(hash %s %b))",
+ "sha512",
+ ntohl (purpose->size),
+ purpose)))
+ {
+ LOG_GCRY (GNUNET_ERROR_TYPE_ERROR,
+ "gcry_sexp_build",
+ rc);
+ return NULL;
+ }
+#endif
return data;
}
return GNUNET_SYSERR;
}
gcry_sexp_release (sig_sexp);
- GNUNET_CRYPTO_mpi_print_unsigned (sig->r, sizeof (sig->r), rs[0]);
- GNUNET_CRYPTO_mpi_print_unsigned (sig->s, sizeof (sig->s), rs[1]);
+ GNUNET_CRYPTO_mpi_print_unsigned (sig->r,
+ sizeof (sig->r),
+ rs[0]);
+ GNUNET_CRYPTO_mpi_print_unsigned (sig->s,
+ sizeof (sig->s),
+ rs[1]);
gcry_mpi_release (rs[0]);
gcry_mpi_release (rs[1]);