diff --git a/src/blake2b.c b/src/blake2b.c index 2a92e2f..c5e89c7 100644 --- a/src/blake2b.c +++ b/src/blake2b.c @@ -186,8 +186,8 @@ static FORCE_INLINE uint64_t rotr64(const uint64_t w, const unsigned c) { /// END: blake2-impl.h -void clear_internal_memory(void *mem, const size_t length) { - memwipe(mem, length); +static void clear_internal_memory(void *mem, const size_t length) { + memwipe(mem, length); } /// BEGIN: blake2b.c @@ -560,4 +560,4 @@ fail: } /* Argon2 Team - End Code */ -/// END: blake2b.c \ No newline at end of file +/// END: blake2b.c diff --git a/src/block_template.cpp b/src/block_template.cpp index 8da8809..1e0e28f 100644 --- a/src/block_template.cpp +++ b/src/block_template.cpp @@ -70,7 +70,7 @@ static constexpr uint8_t PROTOCOL_TX_MIN_VERSION = 2; static constexpr uint8_t PROTOCOL_TX_VERSION = 4; static constexpr uint8_t PROTOCOL_TX_TYPE = 2; static constexpr uint8_t PROTOCOL_RCT_TYPE = 0; -static constexpr uint8_t MINER_TX_TYPE = 1; +[[maybe_unused]] static constexpr uint8_t MINER_TX_TYPE = 1; // DEBUG helper: derive expected Ko for a given wallet and enote data static bool debug_derive_wallet_match(const hash& spend_pub, const hash& view_pub, const salvium_carrot::CoinbaseEnote& e) diff --git a/src/salvium_carrot.cpp b/src/salvium_carrot.cpp index d9d1730..5d87036 100644 --- a/src/salvium_carrot.cpp +++ b/src/salvium_carrot.cpp @@ -45,12 +45,12 @@ static const mx25519_impl* get_mx_impl() } // Domain separators (copied from Salvium carrot_core/config.h) -static constexpr unsigned char CARROT_DOMAIN_SEP_AMOUNT_BLINDING_FACTOR[] = "Carrot commitment mask"; +[[maybe_unused]] static constexpr unsigned char CARROT_DOMAIN_SEP_AMOUNT_BLINDING_FACTOR[] = "Carrot commitment mask"; static constexpr unsigned char CARROT_DOMAIN_SEP_ONETIME_EXTENSION_G[] = "Carrot key extension G"; static constexpr unsigned char CARROT_DOMAIN_SEP_ONETIME_EXTENSION_T[] = "Carrot key extension T"; static constexpr unsigned char CARROT_DOMAIN_SEP_ENCRYPTION_MASK_ANCHOR[] = "Carrot encryption mask anchor"; -static constexpr unsigned char CARROT_DOMAIN_SEP_ENCRYPTION_MASK_AMOUNT[] = "Carrot encryption mask a"; -static constexpr unsigned char CARROT_DOMAIN_SEP_EPHEMERAL_PRIVKEY[] = "Carrot sending key normal"; +[[maybe_unused]] static constexpr unsigned char CARROT_DOMAIN_SEP_ENCRYPTION_MASK_AMOUNT[] = "Carrot encryption mask a"; +[[maybe_unused]] static constexpr unsigned char CARROT_DOMAIN_SEP_EPHEMERAL_PRIVKEY[] = "Carrot sending key normal"; static constexpr unsigned char CARROT_DOMAIN_SEP_VIEW_TAG[] = "Carrot view tag"; static constexpr unsigned char CARROT_DOMAIN_SEP_SENDER_RECEIVER_SECRET[] = "Carrot sender-receiver secret"; static constexpr unsigned char CARROT_DOMAIN_SEP_INPUT_CONTEXT_COINBASE = 'C'; diff --git a/src/wallet.cpp b/src/wallet.cpp index 7637d3e..b8f4408 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -23,6 +23,7 @@ #include "keccak.h" #include "crypto.h" #include "salvium_carrot.h" +#include #include #include @@ -49,13 +50,13 @@ constexpr int block_sizes_lookup[11] = { 0, -1, 1, 2, -1, 3, 4, 5, -1, 6, 7 }; constexpr char alphabet[] = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; constexpr size_t alphabet_size = sizeof(alphabet) - 1; +constexpr std::array encoded_block_sizes{ 0, 2, 3, 5, 6, 7, 9, 10, 11 }; +constexpr size_t full_block_size = encoded_block_sizes.size() - 1; +constexpr size_t full_encoded_block_size = encoded_block_sizes[full_block_size]; + // Salvium-compatible base58 decoder (adapted from src/common/base58.cpp) static bool b58_decode(const std::string& in, std::string& out) { - static const size_t encoded_block_sizes[] = { 0, 2, 3, 5, 6, 7, 9, 10, 11 }; - static const size_t full_block_size = sizeof(encoded_block_sizes) / sizeof(encoded_block_sizes[0]) - 1; - static const size_t full_encoded_block_size = encoded_block_sizes[full_block_size]; - constexpr size_t alphabet_size_local = alphabet_size; static int8_t reverse_alphabet[256] = {};