From 52f941c748c69f063b04ea93ccd8aff6f68c2339 Mon Sep 17 00:00:00 2001 From: sowle Date: Mon, 10 Apr 2023 21:01:35 +0200 Subject: [PATCH 1/2] hopefully final fixes for gcc errors --- contrib/epee/include/storages/http_abstract_invoke.h | 1 + src/crypto/crypto-sugar.h | 2 ++ src/crypto/zarcanum.h | 3 --- tests/functional_tests/crypto_tests.cpp | 2 -- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/contrib/epee/include/storages/http_abstract_invoke.h b/contrib/epee/include/storages/http_abstract_invoke.h index 8dfca43d..aa0af3d8 100644 --- a/contrib/epee/include/storages/http_abstract_invoke.h +++ b/contrib/epee/include/storages/http_abstract_invoke.h @@ -29,6 +29,7 @@ #include "portable_storage_template_helper.h" #include "net/http_base.h" #include "net/http_server_handlers_map2.h" +#include "net/http_client.h" namespace epee { diff --git a/src/crypto/crypto-sugar.h b/src/crypto/crypto-sugar.h index 643ca19b..30a97135 100644 --- a/src/crypto/crypto-sugar.h +++ b/src/crypto/crypto-sugar.h @@ -11,6 +11,8 @@ namespace crypto { + namespace mp = boost::multiprecision; + extern "C" { #include "crypto/crypto-ops.h" diff --git a/src/crypto/zarcanum.h b/src/crypto/zarcanum.h index 9f881c28..096755ce 100644 --- a/src/crypto/zarcanum.h +++ b/src/crypto/zarcanum.h @@ -8,12 +8,9 @@ #include "crypto-sugar.h" #include "range_proofs.h" #include "clsag.h" -#include namespace crypto { - namespace mp = boost::multiprecision; - extern const mp::uint256_t c_zarcanum_z_coeff_mp; extern const scalar_t c_zarcanum_z_coeff_s; diff --git a/tests/functional_tests/crypto_tests.cpp b/tests/functional_tests/crypto_tests.cpp index fa6fae72..e8a6cad6 100644 --- a/tests/functional_tests/crypto_tests.cpp +++ b/tests/functional_tests/crypto_tests.cpp @@ -23,8 +23,6 @@ using namespace crypto; -namespace mp = boost::multiprecision; - // out = z ^ s (mod l) void sc_exp(unsigned char* out, const unsigned char* z, const unsigned char* s) { From 196c08a15fb04d0595ec2a9fb0827c3a1d850bcc Mon Sep 17 00:00:00 2001 From: sowle Date: Mon, 10 Apr 2023 22:15:45 +0200 Subject: [PATCH 2/2] crypto tests: minor fixes --- tests/functional_tests/crypto_tests.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/functional_tests/crypto_tests.cpp b/tests/functional_tests/crypto_tests.cpp index e8a6cad6..eafa34ed 100644 --- a/tests/functional_tests/crypto_tests.cpp +++ b/tests/functional_tests/crypto_tests.cpp @@ -473,10 +473,10 @@ uint64_t hash_64(const void* data, size_t size) static bool test_name_a ## _ ## test_name_b(); \ static test_keeper_t test_name_a ## _ ## test_name_b ## _ ## keeper(STR(COMBINE(test_name_a ## _, test_name_b)), & test_name_a ## _ ## test_name_b); \ static bool test_name_a ## _ ## test_name_b() -#define ASSERT_TRUE(expr) CHECK_AND_ASSERT_MES(expr, false, "This is not true: " #expr) -#define ASSERT_FALSE(expr) CHECK_AND_ASSERT_MES((expr) == false, false, "This is not false: " #expr) -#define ASSERT_EQ(a, b) CHECK_AND_ASSERT_MES(a == b, false, #a " != " #b "\n " << a << " != " << b) -#define ASSERT_NEQ(a, b) CHECK_AND_ASSERT_MES(a != b, false, #a " == " #b "\n " << a) +#define ASSERT_TRUE(expr) CHECK_AND_ASSERT_MES(expr, false, "This is not true: " #expr << " @ " << LOCATION_SS) +#define ASSERT_FALSE(expr) CHECK_AND_ASSERT_MES((expr) == false, false, "This is not false: " #expr << " @ " << LOCATION_SS) +#define ASSERT_EQ(a, b) CHECK_AND_ASSERT_MES(a == b, false, #a " != " #b "\n " << a << " != " << b << " @ " << LOCATION_SS) +#define ASSERT_NEQ(a, b) CHECK_AND_ASSERT_MES(a != b, false, #a " == " #b "\n " << a << " @ " << LOCATION_SS) typedef bool(*bool_func_ptr_t)(); static std::vector> g_tests; @@ -1537,14 +1537,14 @@ TEST(crypto, schnorr_sig) scalar_t a = scalar_t::random(); point_t A_pt = a * c_point_G; public_key A = A_pt.to_public_key(); - ASSERT_FALSE(generate_schnorr_sig(m, A_pt, a, ss)); + // (different behaviour in debug and release) ASSERT_FALSE(generate_schnorr_sig(m, A_pt, a, ss)); ASSERT_TRUE(generate_schnorr_sig(m, A_pt, a, ss)); ASSERT_FALSE(verify_schnorr_sig(m, A, ss)); ASSERT_TRUE(verify_schnorr_sig(m, A, ss)); A_pt = a * c_point_X; A = A_pt.to_public_key(); - ASSERT_FALSE(generate_schnorr_sig(m, A_pt, a, ss)); + // (different behaviour in debug and release) ASSERT_FALSE(generate_schnorr_sig(m, A_pt, a, ss)); ASSERT_TRUE(generate_schnorr_sig(m, A_pt, a, ss)); ASSERT_FALSE(verify_schnorr_sig(m, A, ss)); ASSERT_TRUE(verify_schnorr_sig(m, A, ss));