summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
fa64e63)
Define USE_BCRYPT
Removed _WIN32_WINNT define
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1142)
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
# include <windows.h>
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
# include <windows.h>
+/* On Windows 7 or higher use BCrypt instead of the legacy CryptoAPI */
# if defined(_MSC_VER) && defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0601
# if defined(_MSC_VER) && defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0601
+# define USE_BCRYPT 1
+# endif
+
+# ifdef USE_BCRYPT
# include <bcrypt.h>
# pragma comment(lib, "bcrypt.lib")
# else
# include <bcrypt.h>
# pragma comment(lib, "bcrypt.lib")
# else
-# ifndef _WIN32_WINNT
-# define _WIN32_WINNT 0x0400
-# endif
# include <wincrypt.h>
/*
* Intel hardware RNG CSP -- available from
# include <wincrypt.h>
/*
* Intel hardware RNG CSP -- available from
int RAND_poll(void)
{
MEMORYSTATUS mst;
int RAND_poll(void)
{
MEMORYSTATUS mst;
-# if !(defined(_MSC_VER) && defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0601)
HCRYPTPROV hProvider = 0;
# endif
DWORD w;
BYTE buf[64];
HCRYPTPROV hProvider = 0;
# endif
DWORD w;
BYTE buf[64];
-# if defined(_MSC_VER) && defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0601
if (BCryptGenRandom(NULL, buf, (ULONG)sizeof(buf), BCRYPT_USE_SYSTEM_PREFERRED_RNG) == 0) {
RAND_add(buf, sizeof(buf), sizeof(buf));
}
if (BCryptGenRandom(NULL, buf, (ULONG)sizeof(buf), BCRYPT_USE_SYSTEM_PREFERRED_RNG) == 0) {
RAND_add(buf, sizeof(buf), sizeof(buf));
}