From 15bc6086ec7ee9e72efa7faf02514e5938377ff6 Mon Sep 17 00:00:00 2001 From: Suyash Bagad Date: Thu, 20 Apr 2023 10:08:07 +0000 Subject: [PATCH] gcc fix. --- cpp/src/barretenberg/crypto/ecdsa/ecdsa_impl.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cpp/src/barretenberg/crypto/ecdsa/ecdsa_impl.hpp b/cpp/src/barretenberg/crypto/ecdsa/ecdsa_impl.hpp index 2920b420b3..33cec9c433 100644 --- a/cpp/src/barretenberg/crypto/ecdsa/ecdsa_impl.hpp +++ b/cpp/src/barretenberg/crypto/ecdsa/ecdsa_impl.hpp @@ -40,7 +40,10 @@ signature construct_signature(const std::string& message, const key_pair bool is_r_finite = (uint256_t(r_fq) == uint256_t(r_fr)); bool y_parity = uint256_t(R.y).get_bit(0); constexpr uint8_t offset = 27; - sig.v = offset + y_parity + static_cast(2) * !is_r_finite; + + int value = offset + y_parity + static_cast(2) * !is_r_finite; + ASSERT(value <= UINT8_MAX); + sig.v = static_cast(value); return sig; }