mirror of
https://github.com/curl/curl.git
synced 2026-07-27 23:53:06 +03:00
windows: improve random source
- Use the Windows API to seed the fallback random generator. This ensures to always have a random seed, even when libcurl is built with a vtls backend lacking a random generator API, such as rustls (experimental), GSKit and certain mbedTLS builds, or, when libcurl is built without a TLS backend. We reuse the Windows-specific random function from the Schannel backend. - Implement support for `BCryptGenRandom()` [1] on Windows, as a replacement for the deprecated `CryptGenRandom()` [2] function. It is used as the secure random generator for Schannel, and also to provide entropy for libcurl's fallback random generator. The new function is supported on Vista and newer via its `bcrypt.dll`. It is used automatically when building for supported versions. It also works in UWP apps (the old function did not). - Clear entropy buffer before calling the Windows random generator. This avoids using arbitrary application memory as entropy (with `CryptGenRandom()`) and makes sure to return in a predictable state when an API call fails. [1] https://docs.microsoft.com/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom [2] https://docs.microsoft.com/windows/win32/api/wincrypt/nf-wincrypt-cryptgenrandom Closes #9027
This commit is contained in:
parent
e6f8445ede
commit
76172511e7
8 changed files with 110 additions and 19 deletions
|
|
@ -266,7 +266,7 @@ ifdef SSH2
|
|||
curl_LDADD += -L"$(LIBSSH2_PATH)/win32" -lssh2
|
||||
ifdef SCHANNEL
|
||||
ifndef DYN
|
||||
curl_LDADD += -lbcrypt -lcrypt32
|
||||
curl_LDADD += -lcrypt32
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
|
@ -374,7 +374,7 @@ ifndef USE_LDAP_OPENLDAP
|
|||
curl_LDADD += -lwldap32
|
||||
endif
|
||||
endif
|
||||
curl_LDADD += -lws2_32
|
||||
curl_LDADD += -lws2_32 -lbcrypt
|
||||
|
||||
# Makefile.inc provides the check_PROGRAMS and COMPLICATED_EXAMPLES defines
|
||||
include Makefile.inc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue