summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rand/rand_win.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rand/rand_win.c')
-rw-r--r--src/lib/libcrypto/rand/rand_win.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/lib/libcrypto/rand/rand_win.c b/src/lib/libcrypto/rand/rand_win.c
index 263068d256..113b58678f 100644
--- a/src/lib/libcrypto/rand/rand_win.c
+++ b/src/lib/libcrypto/rand/rand_win.c
@@ -162,7 +162,6 @@ typedef BOOL (WINAPI *GETCURSORINFO)(PCURSORINFO);
162typedef DWORD (WINAPI *GETQUEUESTATUS)(UINT); 162typedef DWORD (WINAPI *GETQUEUESTATUS)(UINT);
163 163
164typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD); 164typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD);
165typedef BOOL (WINAPI *CLOSETOOLHELP32SNAPSHOT)(HANDLE);
166typedef BOOL (WINAPI *HEAP32FIRST)(LPHEAPENTRY32, DWORD, DWORD); 165typedef BOOL (WINAPI *HEAP32FIRST)(LPHEAPENTRY32, DWORD, DWORD);
167typedef BOOL (WINAPI *HEAP32NEXT)(LPHEAPENTRY32); 166typedef BOOL (WINAPI *HEAP32NEXT)(LPHEAPENTRY32);
168typedef BOOL (WINAPI *HEAP32LIST)(HANDLE, LPHEAPLIST32); 167typedef BOOL (WINAPI *HEAP32LIST)(HANDLE, LPHEAPLIST32);
@@ -432,7 +431,7 @@ int RAND_poll(void)
432 * This seeding method was proposed in Peter Gutmann, Software 431 * This seeding method was proposed in Peter Gutmann, Software
433 * Generation of Practically Strong Random Numbers, 432 * Generation of Practically Strong Random Numbers,
434 * http://www.usenix.org/publications/library/proceedings/sec98/gutmann.html 433 * http://www.usenix.org/publications/library/proceedings/sec98/gutmann.html
435 * revised version at http://www.cryptoengines.com/~peter/06_random.pdf 434 * revised version at http://www.cryptoengines.com/~peter/06_random.pdf
436 * (The assignment of entropy estimates below is arbitrary, but based 435 * (The assignment of entropy estimates below is arbitrary, but based
437 * on Peter's analysis the full poll appears to be safe. Additional 436 * on Peter's analysis the full poll appears to be safe. Additional
438 * interactive seeding is encouraged.) 437 * interactive seeding is encouraged.)
@@ -441,7 +440,6 @@ int RAND_poll(void)
441 if (kernel) 440 if (kernel)
442 { 441 {
443 CREATETOOLHELP32SNAPSHOT snap; 442 CREATETOOLHELP32SNAPSHOT snap;
444 CLOSETOOLHELP32SNAPSHOT close_snap;
445 HANDLE handle; 443 HANDLE handle;
446 444
447 HEAP32FIRST heap_first; 445 HEAP32FIRST heap_first;
@@ -459,8 +457,6 @@ int RAND_poll(void)
459 457
460 snap = (CREATETOOLHELP32SNAPSHOT) 458 snap = (CREATETOOLHELP32SNAPSHOT)
461 GetProcAddress(kernel, TEXT("CreateToolhelp32Snapshot")); 459 GetProcAddress(kernel, TEXT("CreateToolhelp32Snapshot"));
462 close_snap = (CLOSETOOLHELP32SNAPSHOT)
463 GetProcAddress(kernel, TEXT("CloseToolhelp32Snapshot"));
464 heap_first = (HEAP32FIRST) GetProcAddress(kernel, TEXT("Heap32First")); 460 heap_first = (HEAP32FIRST) GetProcAddress(kernel, TEXT("Heap32First"));
465 heap_next = (HEAP32NEXT) GetProcAddress(kernel, TEXT("Heap32Next")); 461 heap_next = (HEAP32NEXT) GetProcAddress(kernel, TEXT("Heap32Next"));
466 heaplist_first = (HEAP32LIST) GetProcAddress(kernel, TEXT("Heap32ListFirst")); 462 heaplist_first = (HEAP32LIST) GetProcAddress(kernel, TEXT("Heap32ListFirst"));
@@ -476,7 +472,7 @@ int RAND_poll(void)
476 heaplist_next && process_first && process_next && 472 heaplist_next && process_first && process_next &&
477 thread_first && thread_next && module_first && 473 thread_first && thread_next && module_first &&
478 module_next && (handle = snap(TH32CS_SNAPALL,0)) 474 module_next && (handle = snap(TH32CS_SNAPALL,0))
479 != INVALID_HANDLE_VALUE) 475 != NULL)
480 { 476 {
481 /* heap list and heap walking */ 477 /* heap list and heap walking */
482 /* HEAPLIST32 contains 3 fields that will change with 478 /* HEAPLIST32 contains 3 fields that will change with
@@ -538,10 +534,8 @@ int RAND_poll(void)
538 do 534 do
539 RAND_add(&m, m.dwSize, 9); 535 RAND_add(&m, m.dwSize, 9);
540 while (module_next(handle, &m)); 536 while (module_next(handle, &m));
541 if (close_snap) 537
542 close_snap(handle); 538 CloseHandle(handle);
543 else
544 CloseHandle(handle);
545 } 539 }
546 540
547 FreeLibrary(kernel); 541 FreeLibrary(kernel);