From: Andy Polyakov Date: Tue, 19 Jan 2010 13:48:18 +0000 (+0000) Subject: rand_win.c: handle GetTickCount wrap-around. X-Git-Tag: OpenSSL-fips-2_0-rc1~1340 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7a6e0901ff254fb444d3f5241c9d0eaeea4eaf82;p=oweals%2Fopenssl.git rand_win.c: handle GetTickCount wrap-around. --- diff --git a/crypto/rand/rand_win.c b/crypto/rand/rand_win.c index efe0f89070..3fac961922 100644 --- a/crypto/rand/rand_win.c +++ b/crypto/rand/rand_win.c @@ -463,7 +463,7 @@ int RAND_poll(void) PROCESSENTRY32 p; THREADENTRY32 t; MODULEENTRY32 m; - DWORD stoptime = 0; + DWORD starttime = 0; snap = (CREATETOOLHELP32SNAPSHOT) GetProcAddress(kernel, "CreateToolhelp32Snapshot"); @@ -496,7 +496,7 @@ int RAND_poll(void) */ ZeroMemory(&hlist, sizeof(HEAPLIST32)); hlist.dwSize = sizeof(HEAPLIST32); - if (good) stoptime = GetTickCount() + MAXDELAY; + if (good) starttime = GetTickCount(); #ifdef _MSC_VER if (heaplist_first(handle, &hlist)) { @@ -536,7 +536,7 @@ int RAND_poll(void) ex_cnt_limit--; } } while (heaplist_next(handle, &hlist) - && GetTickCount() < stoptime + && (GetTickCount()-starttime) 0); } @@ -559,7 +559,7 @@ int RAND_poll(void) && --entrycnt > 0); } } while (heaplist_next(handle, &hlist) - && GetTickCount() < stoptime); + && (GetTickCount()-starttime)