Adds casts for 64-bit
authorMat <mberchtold@gmail.com>
Sun, 29 May 2016 18:44:27 +0000 (20:44 +0200)
committerRich Salz <rsalz@openssl.org>
Fri, 3 Jun 2016 16:18:59 +0000 (12:18 -0400)
Adds missing casts for 64-bit.
Removed zero initialization of hProvider. hProvider is an "out" parameter of CryptAcquireContextW.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1142)

crypto/rand/rand_win.c

index 21cc9b6bcb982d088ba579af7e3558f6907f9576..ae5bbddcd2cd3a39a7ce0251c20f2616a05b634d 100644 (file)
@@ -37,7 +37,7 @@ int RAND_poll(void)
 {
     MEMORYSTATUS mst;
 # ifndef USE_BCRYPT
-    HCRYPTPROV hProvider = 0;
+    HCRYPTPROV hProvider;
 # endif
     DWORD w;
     BYTE buf[64];
@@ -50,7 +50,7 @@ int RAND_poll(void)
     /* poll the CryptoAPI PRNG */
     /* The CryptoAPI returns sizeof(buf) bytes of randomness */
     if (CryptAcquireContextW(&hProvider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
-        if (CryptGenRandom(hProvider, sizeof(buf), buf) != 0) {
+        if (CryptGenRandom(hProvider, (DWORD)sizeof(buf), buf) != 0) {
             RAND_add(buf, sizeof(buf), sizeof(buf));
         }
         CryptReleaseContext(hProvider, 0);
@@ -58,7 +58,7 @@ int RAND_poll(void)
 
     /* poll the Pentium PRG with CryptoAPI */
     if (CryptAcquireContextW(&hProvider, NULL, INTEL_DEF_PROV, PROV_INTEL_SEC, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
-        if (CryptGenRandom(hProvider, sizeof(buf), buf) != 0) {
+        if (CryptGenRandom(hProvider, (DWORD)sizeof(buf), buf) != 0) {
             RAND_add(buf, sizeof(buf), sizeof(buf));
         }
         CryptReleaseContext(hProvider, 0);