From 11a5d3ff94b6ea63ecf80a140c5c5fcd8d0cfa7f Mon Sep 17 00:00:00 2001 From: Matt Hess Date: Tue, 13 Jan 2026 00:32:23 +0000 Subject: [PATCH] Fix cppcheck const warning and update BoringSSL win7 patch --- patches/boringssl/win7.patch | 18 +++++++++--------- src/p2pool.cpp | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/patches/boringssl/win7.patch b/patches/boringssl/win7.patch index 3ff31f1..711bb7b 100644 --- a/patches/boringssl/win7.patch +++ b/patches/boringssl/win7.patch @@ -1,33 +1,33 @@ diff --git a/crypto/rand/windows.cc b/crypto/rand/windows.cc -index 59df467e7..aa5ac076c 100644 +index 1234567..abcdefg 100644 --- a/crypto/rand/windows.cc +++ b/crypto/rand/windows.cc @@ -24,6 +24,7 @@ #include - + #include +#include - + #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \ !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) -@@ -57,16 +58,40 @@ void CRYPTO_sysrand(uint8_t *out, size_t requested) { +@@ -55,16 +56,40 @@ void CRYPTO_sysrand(uint8_t *out, size_t requested) { // See: https://learn.microsoft.com/en-us/windows/win32/seccng/processprng typedef BOOL (WINAPI *ProcessPrngFunction)(PBYTE pbData, SIZE_T cbData); - static ProcessPrngFunction g_processprng_fn = NULL; + static ProcessPrngFunction g_processprng_fn = nullptr; +static HCRYPTPROV g_hCryptProv = 0; + +static BOOL WINAPI wrapper_CryptGenRandom(PBYTE pbData, SIZE_T cbData) +{ + return CryptGenRandom(g_hCryptProv, cbData, pbData); +} - + static void init_processprng(void) { HMODULE hmod = LoadLibraryW(L"bcryptprimitives"); -- if (hmod == NULL) { +- if (hmod == nullptr) { - abort(); - } - g_processprng_fn = (ProcessPrngFunction)GetProcAddress(hmod, "ProcessPrng"); -- if (g_processprng_fn == NULL) { +- if (g_processprng_fn == nullptr) { - abort(); + + if (hmod) { @@ -55,5 +55,5 @@ index 59df467e7..aa5ac076c 100644 + + abort(); } - + void CRYPTO_init_sysrand(void) { diff --git a/src/p2pool.cpp b/src/p2pool.cpp index ccd135f..dc240de 100644 --- a/src/p2pool.cpp +++ b/src/p2pool.cpp @@ -1463,7 +1463,7 @@ void p2pool::download_block_headers4(uint64_t start_height, uint64_t current_hei genesis_wait_count++; // Genesis node escape: if we created genesis and have no peers, proceed - P2PServer* server = m_p2pServer.load(); + const P2PServer* server = m_p2pServer.load(); if (server && server->num_connections() == 0 && genesis_wait_count >= 6) { LOGINFO(0, log::LightGreen() << "########################################"); LOGINFO(0, log::LightGreen() << "GENESIS NODE - MINING IS NOW ENABLED");