From ee7f93aabd0203322e9f3f1b31598cc9e5b328d1 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sat, 6 Feb 2016 13:14:35 -0500 Subject: Revert GH #365 Replace deprecated Win API calls in Win32_EntropySource Thinking it over I've realized this was not a good move; XP may be EOLed but is still widely used and even VS 2015 still supports targeting XP. It's not really the same situation as going to extra efforts for supporting SunOS 5.1 or VAX/VMS, instead it actively broke support for something which is still widely deployed. And for those building for XP the options are patch out the call (GH #416) or disable win32_stats altogether in their build. I'd like to prevent downstream distributors from having to patch, because that can get messy. And while the design of CryptGenRandom is not disclosed it apparently has changed over time and at one point (IIRC) used RC4 to generate outputs, so if there is any OS that could use some extra help generating seed material it is XP. There may be future code that really makes use of APIs added after XP - CryptoNG, TPM support, etc and then people targetting XP will have to compile out those modules. But it doesn't make sense to break it here for this small gain. --- src/lib/entropy/win32_stats/es_win32.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/entropy/win32_stats/es_win32.cpp b/src/lib/entropy/win32_stats/es_win32.cpp index c0a8acdbd..52bb24136 100644 --- a/src/lib/entropy/win32_stats/es_win32.cpp +++ b/src/lib/entropy/win32_stats/es_win32.cpp @@ -20,7 +20,7 @@ void Win32_EntropySource::poll(Entropy_Accumulator& accum) First query a bunch of basic statistical stuff, though don't count it for much in terms of contributed entropy. */ - accum.add(GetTickCount64(), BOTAN_ENTROPY_ESTIMATE_SYSTEM_DATA); + accum.add(GetTickCount(), BOTAN_ENTROPY_ESTIMATE_SYSTEM_DATA); accum.add(GetMessagePos(), BOTAN_ENTROPY_ESTIMATE_SYSTEM_DATA); accum.add(GetMessageTime(), BOTAN_ENTROPY_ESTIMATE_SYSTEM_DATA); accum.add(GetInputState(), BOTAN_ENTROPY_ESTIMATE_SYSTEM_DATA); @@ -32,8 +32,8 @@ void Win32_EntropySource::poll(Entropy_Accumulator& accum) GetSystemInfo(&sys_info); accum.add(sys_info, BOTAN_ENTROPY_ESTIMATE_STATIC_SYSTEM_DATA); - MEMORYSTATUSEX mem_info; - GlobalMemoryStatusEx(&mem_info); + MEMORYSTATUS mem_info; + GlobalMemoryStatus(&mem_info); accum.add(mem_info, BOTAN_ENTROPY_ESTIMATE_SYSTEM_DATA); POINT point; -- cgit v1.2.3