← Commit list

05189f5549

Viktor Szakats
Viktor Szakats
2026-03-09
SUCCESS Duration: 254s

Subject

rand: drop impossible preprocessor branches (wincrypt)

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/rand.c+1 -23
@@ -36,7 +36,6 @@
#ifdef _WIN32
#ifndef CURL_WINDOWS_UWP
-# define HAVE_WIN_BCRYPTGENRANDOM
# include <bcrypt.h>
# ifdef _MSC_VER
# pragma comment(lib, "bcrypt.lib")
@@ -44,38 +43,17 @@
# ifndef STATUS_SUCCESS
# define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
# endif
-#elif defined(USE_WIN32_CRYPTO)
-# include <wincrypt.h>
-# ifdef _MSC_VER
-# pragma comment(lib, "advapi32.lib")
-# endif
#endif
CURLcode Curl_win32_random(unsigned char *entropy, size_t length)
{
memset(entropy, 0, length);
-#ifdef HAVE_WIN_BCRYPTGENRANDOM
+#ifndef CURL_WINDOWS_UWP
if(BCryptGenRandom(NULL, entropy, (ULONG)length,
BCRYPT_USE_SYSTEM_PREFERRED_RNG) != STATUS_SUCCESS)
return CURLE_FAILED_INIT;
- return CURLE_OK;
-#elif defined(USE_WIN32_CRYPTO)
- {
- HCRYPTPROV hCryptProv = 0;
-
- if(!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
- CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
- return CURLE_FAILED_INIT;
-
- if(!CryptGenRandom(hCryptProv, (DWORD)length, entropy)) {
- CryptReleaseContext(hCryptProv, 0UL);
- return CURLE_FAILED_INIT;
- }
-
- CryptReleaseContext(hCryptProv, 0UL);
- }
return CURLE_OK;
#else
return CURLE_NOT_BUILT_IN;