← Commit list

d986b89c88

Viktor Szakats
Viktor Szakats
2026-03-18
SUCCESS Duration: 253s

Subject

rand: use `BCryptGenRandom()` in UWP builds

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 →

.github/workflows/windows.yml+2 -2
@@ -309,7 +309,7 @@ jobs:
TFLAGS: '${{ matrix.tflags }}'
run: |
if [ "${MATRIX_TEST}" = 'uwp' ]; then
- CPPFLAGS+=' -DWINSTORECOMPAT -DWINAPI_FAMILY=WINAPI_FAMILY_APP'
+ CPPFLAGS+=' -DWINSTORECOMPAT -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WIN32_WINNT=0x0a00'
if [[ "${MATRIX_ENV}" != 'clang'* ]]; then
specs="$(realpath gcc-specs-uwp)"
gcc -dumpspecs | sed -e 's/-lmingwex/-lwindowsapp -lmingwex -lwindowsapp/' -e 's/-lmsvcrt/-lucrtapp/' > "${specs}"
@@ -325,7 +325,7 @@ jobs:
options='-DCMAKE_C_COMPILER=gcc'
fi
[ "${MATRIX_SYS}" = 'msys' ] && options+=' -D_CURL_PREFILL=ON'
- [ "${MATRIX_TEST}" = 'uwp' ] && options+=' -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0'
+ [ "${MATRIX_TEST}" = 'uwp' ] && options+=' -DCMAKE_SYSTEM_NAME=WindowsStore'
[ "${TFLAGS}" = 'skiprun' ] && options+=' -D_CURL_SKIP_BUILD_CERTS=ON'
[ "${_chkprefill}" = '_chkprefill' ] && options+=' -D_CURL_PREFILL=OFF'
cmake -B "bld${_chkprefill}" -G Ninja ${options} \
lib/rand.c+6 -13
@@ -34,30 +34,23 @@
#include "escape.h"
#ifdef _WIN32
-
-#ifndef CURL_WINDOWS_UWP
-# include <bcrypt.h>
-# ifdef _MSC_VER
-# pragma comment(lib, "bcrypt.lib")
-# endif
-# ifndef STATUS_SUCCESS
-# define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
-# endif
+#include <bcrypt.h>
+#ifdef _MSC_VER
+# pragma comment(lib, "bcrypt.lib")
+#endif
+#ifndef STATUS_SUCCESS
+#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
#endif
CURLcode Curl_win32_random(unsigned char *entropy, size_t length)
{
memset(entropy, 0, length);
-#ifndef CURL_WINDOWS_UWP
if(BCryptGenRandom(NULL, entropy, (ULONG)length,
BCRYPT_USE_SYSTEM_PREFERRED_RNG) != STATUS_SUCCESS)
return CURLE_FAILED_INIT;
return CURLE_OK;
-#else
- return CURLE_NOT_BUILT_IN;
-#endif
}
#endif