Loading crypto/rand/rand_win.c +21 −29 Original line number Original line Diff line number Diff line Loading @@ -167,7 +167,7 @@ typedef DWORD (WINAPI *GETQUEUESTATUS)(UINT); typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD); typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD); typedef BOOL (WINAPI *CLOSETOOLHELP32SNAPSHOT)(HANDLE); typedef BOOL (WINAPI *CLOSETOOLHELP32SNAPSHOT)(HANDLE); typedef BOOL (WINAPI *HEAP32FIRST)(LPHEAPENTRY32, DWORD, DWORD); typedef BOOL (WINAPI *HEAP32FIRST)(LPHEAPENTRY32, DWORD, ULONG_PTR); typedef BOOL (WINAPI *HEAP32NEXT)(LPHEAPENTRY32); typedef BOOL (WINAPI *HEAP32NEXT)(LPHEAPENTRY32); typedef BOOL (WINAPI *HEAP32LIST)(HANDLE, LPHEAPLIST32); typedef BOOL (WINAPI *HEAP32LIST)(HANDLE, LPHEAPLIST32); typedef BOOL (WINAPI *PROCESS32)(HANDLE, LPPROCESSENTRY32); typedef BOOL (WINAPI *PROCESS32)(HANDLE, LPPROCESSENTRY32); Loading Loading @@ -195,21 +195,8 @@ int RAND_poll(void) HCRYPTPROV hProvider = 0; HCRYPTPROV hProvider = 0; BYTE buf[64]; BYTE buf[64]; DWORD w; DWORD w; HWND h; int good = 0; int good = 0; HMODULE advapi, kernel, user, netapi; CRYPTACQUIRECONTEXTW acquire = 0; CRYPTGENRANDOM gen = 0; CRYPTRELEASECONTEXT release = 0; #if 1 /* There was previously a problem with NETSTATGET. Currently, this * section is still experimental, but if all goes well, this conditional * will be removed */ NETSTATGET netstatget = 0; NETFREE netfree = 0; #endif /* 1 */ /* Determine the OS version we are on so we can turn off things /* Determine the OS version we are on so we can turn off things * that do not work properly. * that do not work properly. */ */ Loading Loading @@ -246,17 +233,18 @@ int RAND_poll(void) * implement own shim routine, which would accept ANSI argument * implement own shim routine, which would accept ANSI argument * and expand it to Unicode. * and expand it to Unicode. */ */ { /* load functions dynamically - not available on all systems */ /* load functions dynamically - not available on all systems */ advapi = LoadLibrary(TEXT("ADVAPI32.DLL")); HMODULE advapi = LoadLibrary(TEXT("ADVAPI32.DLL")); kernel = LoadLibrary(TEXT("KERNEL32.DLL")); HMODULE kernel = LoadLibrary(TEXT("KERNEL32.DLL")); user = LoadLibrary(TEXT("USER32.DLL")); HMODULE user = NULL; netapi = LoadLibrary(TEXT("NETAPI32.DLL")); HMODULE netapi = LoadLibrary(TEXT("NETAPI32.DLL")); CRYPTACQUIRECONTEXTW acquire = NULL; #if 1 /* There was previously a problem with NETSTATGET. Currently, this CRYPTGENRANDOM gen = NULL; * section is still experimental, but if all goes well, this conditional CRYPTRELEASECONTEXT release = NULL; * will be removed NETSTATGET netstatget = NULL; */ NETFREE netfree = NULL; if (netapi) if (netapi) { { netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet"); netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet"); Loading Loading @@ -286,7 +274,6 @@ int RAND_poll(void) if (netapi) if (netapi) FreeLibrary(netapi); FreeLibrary(netapi); #endif /* 1 */ /* It appears like this can cause an exception deep within ADVAPI32.DLL /* It appears like this can cause an exception deep within ADVAPI32.DLL * at random times on Windows 2000. Reported by Jeffrey Altman. * at random times on Windows 2000. Reported by Jeffrey Altman. Loading Loading @@ -394,7 +381,9 @@ int RAND_poll(void) if (advapi) if (advapi) FreeLibrary(advapi); FreeLibrary(advapi); if (user) if ((osverinfo.dwPlatformId != VER_PLATFORM_WIN32_NT || !OPENSSL_isservice()) && (user = LoadLibrary(TEXT("USER32.DLL")))) { { GETCURSORINFO cursor; GETCURSORINFO cursor; GETFOREGROUNDWINDOW win; GETFOREGROUNDWINDOW win; Loading @@ -407,7 +396,7 @@ int RAND_poll(void) if (win) if (win) { { /* window handle */ /* window handle */ h = win(); HWND h = win(); RAND_add(&h, sizeof(h), 0); RAND_add(&h, sizeof(h), 0); } } if (cursor) if (cursor) Loading Loading @@ -570,6 +559,7 @@ int RAND_poll(void) FreeLibrary(kernel); FreeLibrary(kernel); } } } #endif /* !OPENSSL_SYS_WINCE */ #endif /* !OPENSSL_SYS_WINCE */ /* timer data */ /* timer data */ Loading Loading @@ -633,7 +623,6 @@ int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam) void RAND_screen(void) /* function available for backward compatibility */ void RAND_screen(void) /* function available for backward compatibility */ { { RAND_poll(); RAND_poll(); if (GetVersion() >= 0x80000000 || !OPENSSL_isservice()) readscreen(); readscreen(); } } Loading Loading @@ -710,6 +699,9 @@ static void readscreen(void) int y; /* y-coordinate of screen lines to grab */ int y; /* y-coordinate of screen lines to grab */ int n = 16; /* number of screen lines to grab at a time */ int n = 16; /* number of screen lines to grab at a time */ if (GetVersion() >= 0x80000000 || !OPENSSL_isservice()) return; /* Create a screen DC and a memory DC compatible to screen DC */ /* Create a screen DC and a memory DC compatible to screen DC */ hScrDC = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); hScrDC = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); hMemDC = CreateCompatibleDC(hScrDC); hMemDC = CreateCompatibleDC(hScrDC); Loading Loading
crypto/rand/rand_win.c +21 −29 Original line number Original line Diff line number Diff line Loading @@ -167,7 +167,7 @@ typedef DWORD (WINAPI *GETQUEUESTATUS)(UINT); typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD); typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD); typedef BOOL (WINAPI *CLOSETOOLHELP32SNAPSHOT)(HANDLE); typedef BOOL (WINAPI *CLOSETOOLHELP32SNAPSHOT)(HANDLE); typedef BOOL (WINAPI *HEAP32FIRST)(LPHEAPENTRY32, DWORD, DWORD); typedef BOOL (WINAPI *HEAP32FIRST)(LPHEAPENTRY32, DWORD, ULONG_PTR); typedef BOOL (WINAPI *HEAP32NEXT)(LPHEAPENTRY32); typedef BOOL (WINAPI *HEAP32NEXT)(LPHEAPENTRY32); typedef BOOL (WINAPI *HEAP32LIST)(HANDLE, LPHEAPLIST32); typedef BOOL (WINAPI *HEAP32LIST)(HANDLE, LPHEAPLIST32); typedef BOOL (WINAPI *PROCESS32)(HANDLE, LPPROCESSENTRY32); typedef BOOL (WINAPI *PROCESS32)(HANDLE, LPPROCESSENTRY32); Loading Loading @@ -195,21 +195,8 @@ int RAND_poll(void) HCRYPTPROV hProvider = 0; HCRYPTPROV hProvider = 0; BYTE buf[64]; BYTE buf[64]; DWORD w; DWORD w; HWND h; int good = 0; int good = 0; HMODULE advapi, kernel, user, netapi; CRYPTACQUIRECONTEXTW acquire = 0; CRYPTGENRANDOM gen = 0; CRYPTRELEASECONTEXT release = 0; #if 1 /* There was previously a problem with NETSTATGET. Currently, this * section is still experimental, but if all goes well, this conditional * will be removed */ NETSTATGET netstatget = 0; NETFREE netfree = 0; #endif /* 1 */ /* Determine the OS version we are on so we can turn off things /* Determine the OS version we are on so we can turn off things * that do not work properly. * that do not work properly. */ */ Loading Loading @@ -246,17 +233,18 @@ int RAND_poll(void) * implement own shim routine, which would accept ANSI argument * implement own shim routine, which would accept ANSI argument * and expand it to Unicode. * and expand it to Unicode. */ */ { /* load functions dynamically - not available on all systems */ /* load functions dynamically - not available on all systems */ advapi = LoadLibrary(TEXT("ADVAPI32.DLL")); HMODULE advapi = LoadLibrary(TEXT("ADVAPI32.DLL")); kernel = LoadLibrary(TEXT("KERNEL32.DLL")); HMODULE kernel = LoadLibrary(TEXT("KERNEL32.DLL")); user = LoadLibrary(TEXT("USER32.DLL")); HMODULE user = NULL; netapi = LoadLibrary(TEXT("NETAPI32.DLL")); HMODULE netapi = LoadLibrary(TEXT("NETAPI32.DLL")); CRYPTACQUIRECONTEXTW acquire = NULL; #if 1 /* There was previously a problem with NETSTATGET. Currently, this CRYPTGENRANDOM gen = NULL; * section is still experimental, but if all goes well, this conditional CRYPTRELEASECONTEXT release = NULL; * will be removed NETSTATGET netstatget = NULL; */ NETFREE netfree = NULL; if (netapi) if (netapi) { { netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet"); netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet"); Loading Loading @@ -286,7 +274,6 @@ int RAND_poll(void) if (netapi) if (netapi) FreeLibrary(netapi); FreeLibrary(netapi); #endif /* 1 */ /* It appears like this can cause an exception deep within ADVAPI32.DLL /* It appears like this can cause an exception deep within ADVAPI32.DLL * at random times on Windows 2000. Reported by Jeffrey Altman. * at random times on Windows 2000. Reported by Jeffrey Altman. Loading Loading @@ -394,7 +381,9 @@ int RAND_poll(void) if (advapi) if (advapi) FreeLibrary(advapi); FreeLibrary(advapi); if (user) if ((osverinfo.dwPlatformId != VER_PLATFORM_WIN32_NT || !OPENSSL_isservice()) && (user = LoadLibrary(TEXT("USER32.DLL")))) { { GETCURSORINFO cursor; GETCURSORINFO cursor; GETFOREGROUNDWINDOW win; GETFOREGROUNDWINDOW win; Loading @@ -407,7 +396,7 @@ int RAND_poll(void) if (win) if (win) { { /* window handle */ /* window handle */ h = win(); HWND h = win(); RAND_add(&h, sizeof(h), 0); RAND_add(&h, sizeof(h), 0); } } if (cursor) if (cursor) Loading Loading @@ -570,6 +559,7 @@ int RAND_poll(void) FreeLibrary(kernel); FreeLibrary(kernel); } } } #endif /* !OPENSSL_SYS_WINCE */ #endif /* !OPENSSL_SYS_WINCE */ /* timer data */ /* timer data */ Loading Loading @@ -633,7 +623,6 @@ int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam) void RAND_screen(void) /* function available for backward compatibility */ void RAND_screen(void) /* function available for backward compatibility */ { { RAND_poll(); RAND_poll(); if (GetVersion() >= 0x80000000 || !OPENSSL_isservice()) readscreen(); readscreen(); } } Loading Loading @@ -710,6 +699,9 @@ static void readscreen(void) int y; /* y-coordinate of screen lines to grab */ int y; /* y-coordinate of screen lines to grab */ int n = 16; /* number of screen lines to grab at a time */ int n = 16; /* number of screen lines to grab at a time */ if (GetVersion() >= 0x80000000 || !OPENSSL_isservice()) return; /* Create a screen DC and a memory DC compatible to screen DC */ /* Create a screen DC and a memory DC compatible to screen DC */ hScrDC = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); hScrDC = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); hMemDC = CreateCompatibleDC(hScrDC); hMemDC = CreateCompatibleDC(hScrDC); Loading