Commit 635ffe8bb9 for openssl.org
commit 635ffe8bb9c0d14ce33c5368d90d5e87781480c3
Author: Milan Broz <gmazyland@gmail.com>
Date: Mon Jun 29 15:30:52 2026 +0200
Fix use of BCryptGenRandom
Current path for Windows RNG (for Vista and above) should
use BCryptGenRandom() function but the symbol is not included
in platform_symbols.
The issue was hidden before commit 1eaf29ef6c reordered
Windows header inclusion.
Moreover, a cast to ULONG is required for strict warnings build.
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Jul 1 09:14:17 2026
(Merged from https://github.com/openssl/openssl/pull/31774)
diff --git a/providers/implementations/rands/seeding/rand_win.c b/providers/implementations/rands/seeding/rand_win.c
index 9b889e38bc..acc35936f0 100644
--- a/providers/implementations/rands/seeding/rand_win.c
+++ b/providers/implementations/rands/seeding/rand_win.c
@@ -70,7 +70,7 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool)
buffer = ossl_rand_pool_add_begin(pool, bytes_needed);
if (buffer != NULL) {
size_t bytes = 0;
- if (BCryptGenRandom(NULL, buffer, bytes_needed,
+ if (BCryptGenRandom(NULL, buffer, (ULONG)bytes_needed,
BCRYPT_USE_SYSTEM_PREFERRED_RNG)
== STATUS_SUCCESS)
bytes = bytes_needed;
diff --git a/util/platform_symbols/windows-symbols.txt b/util/platform_symbols/windows-symbols.txt
index 0f6cc11450..7ae58a3f18 100644
--- a/util/platform_symbols/windows-symbols.txt
+++ b/util/platform_symbols/windows-symbols.txt
@@ -1,5 +1,6 @@
AcquireSRWLockExclusive
AcquireSRWLockShared
+BCryptGenRandom
CertCloseStore
CertFindCertificateInStore
CertFreeCertificateContext