From bcc94045c4d401d35cba8820d0a0218103365fac Mon Sep 17 00:00:00 2001 From: sowle Date: Wed, 14 Apr 2021 20:10:17 +0300 Subject: [PATCH] experimental crypto: all gcc issues fixed --- tests/functional_tests/crypto_tests.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/functional_tests/crypto_tests.cpp b/tests/functional_tests/crypto_tests.cpp index 52a9a08b..6b943803 100644 --- a/tests/functional_tests/crypto_tests.cpp +++ b/tests/functional_tests/crypto_tests.cpp @@ -264,8 +264,9 @@ struct alignas(32) scalar_t // do not need to call reduce as 2^64 < L } - // copy at most 32 bytes and reduce - explicit scalar_t(const boost::multiprecision::cpp_int &bigint) + // copy at most 256 bits (32 bytes) and reduce + template + explicit scalar_t(const boost::multiprecision::number& bigint) { zero(); unsigned int bytes_to_copy = bigint.backend().size() * bigint.backend().limb_bits / 8; @@ -274,7 +275,7 @@ struct alignas(32) scalar_t memcpy(&m_s[0], bigint.backend().limbs(), bytes_to_copy); sc_reduce32(&m_s[0]); } - + unsigned char* data() { return &m_s[0]; @@ -519,14 +520,14 @@ struct point_t point_t(const unsigned char(&v)[32]) { - static_assert(sizeof crypto::public_key == sizeof v, "size missmatch"); + static_assert(sizeof(crypto::public_key) == sizeof v, "size missmatch"); if (!from_public_key(*(const crypto::public_key*)v)) zero(); } point_t(const uint64_t(&v)[4]) { - static_assert(sizeof crypto::public_key == sizeof v, "size missmatch"); + static_assert(sizeof(crypto::public_key) == sizeof v, "size missmatch"); if (!from_public_key(*(const crypto::public_key*)v)) zero(); }