diff options
author | Mat <mberchtold@gmail.com> | 2016-06-02 23:38:56 +0200 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-06-03 12:18:59 -0400 |
commit | 6191fc8634eb0eee1a358bea7dbfbf33ad1f8981 (patch) | |
tree | ea5f15d02cd86a730ee5f8e8a2143e760fffa699 /crypto | |
parent | e56f956ef1347b8eb9024471f4fa16691cf8e3ea (diff) | |
download | openssl-6191fc8634eb0eee1a358bea7dbfbf33ad1f8981.tar.gz |
Added define for STATUS_SUCCESS
Use STATUS_SUCCESS instead of 0.
Renamed USE_BCRYPT to RAND_WINDOWS_USE_BCRYPT to avoid possible collisions with other defines.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1142)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/rand/rand_win.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/crypto/rand/rand_win.c b/crypto/rand/rand_win.c index ae5bbddcd2..c5d0aa155a 100644 --- a/crypto/rand/rand_win.c +++ b/crypto/rand/rand_win.c @@ -15,12 +15,15 @@ # 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 -# define USE_BCRYPT 1 +# define RAND_WINDOWS_USE_BCRYPT # endif -# ifdef USE_BCRYPT +# ifdef RAND_WINDOWS_USE_BCRYPT # include <bcrypt.h> # pragma comment(lib, "bcrypt.lib") +# ifndef STATUS_SUCCESS +# define STATUS_SUCCESS ((NTSTATUS)0x00000000L) +# endif # else # include <wincrypt.h> /* @@ -36,14 +39,14 @@ static void readtimer(void); int RAND_poll(void) { MEMORYSTATUS mst; -# ifndef USE_BCRYPT +# ifndef RAND_WINDOWS_USE_BCRYPT HCRYPTPROV hProvider; # endif DWORD w; BYTE buf[64]; -# ifdef USE_BCRYPT - if (BCryptGenRandom(NULL, buf, (ULONG)sizeof(buf), BCRYPT_USE_SYSTEM_PREFERRED_RNG) == 0) { +# ifdef RAND_WINDOWS_USE_BCRYPT + if (BCryptGenRandom(NULL, buf, (ULONG)sizeof(buf), BCRYPT_USE_SYSTEM_PREFERRED_RNG) == STATUS_SUCCESS) { RAND_add(buf, sizeof(buf), sizeof(buf)); } # else |