Fix cppcheck const warning and update BoringSSL win7 patch

This commit is contained in:
Matt Hess
2026-01-13 00:32:23 +00:00
parent 6c8b8894ee
commit 11a5d3ff94
2 changed files with 10 additions and 10 deletions
+9 -9
View File
@@ -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 <stdlib.h>
#include <windows.h>
+#include <wincrypt.h>
#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) {
+1 -1
View File
@@ -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");