curl/lib/vtls
Viktor Szakats 76172511e7
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
2022-07-04 09:38:24 +00:00
..
bearssl.c copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
bearssl.h copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
gskit.c copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
gskit.h copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
gtls.c copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
gtls.h copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
hostcheck.c copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
hostcheck.h copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
keylog.c copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
keylog.h copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
mbedtls_threadlock.c copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
mbedtls_threadlock.h copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
mbedtls.c copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
mbedtls.h copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
nss.c copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
nssg.h copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
openssl.c copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
openssl.h copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
rustls.c copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
rustls.h copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
schannel_verify.c copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
schannel.c windows: improve random source 2022-07-04 09:38:24 +00:00
schannel.h curl_setup: include _mingw.h 2022-06-23 03:34:51 -04:00
sectransp.c copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
sectransp.h copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
vtls.c vtls: make curl_global_sslset thread-safe 2022-06-16 03:18:40 -04:00
vtls.h vtls: make curl_global_sslset thread-safe 2022-06-16 03:18:40 -04:00
wolfssl.c copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
wolfssl.h copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
x509asn1.c copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00
x509asn1.h copyright: make repository REUSE compliant 2022-06-13 09:13:00 +02:00