Botan  2.19.1
Crypto and TLS for C++11
es_win32.cpp
Go to the documentation of this file.
1 /*
2 * (C) 1999-2009,2016,2020 Jack Lloyd
3 *
4 * Botan is released under the Simplified BSD License (see license.txt)
5 */
6 
7 #include <botan/internal/es_win32.h>
8 
9 #define NOMINMAX 1
10 #define _WINSOCKAPI_ // stop windows.h including winsock.h
11 #include <windows.h>
12 
13 namespace Botan {
14 
16  {
17  rng.add_entropy_T(::GetTickCount());
18  rng.add_entropy_T(::GetMessagePos());
19  rng.add_entropy_T(::GetMessageTime());
20  rng.add_entropy_T(::GetInputState());
21 
22  rng.add_entropy_T(::GetCurrentProcessId());
23  rng.add_entropy_T(::GetCurrentThreadId());
24 
25  SYSTEM_INFO sys_info;
26  ::GetSystemInfo(&sys_info);
27  rng.add_entropy_T(sys_info);
28 
29  MEMORYSTATUSEX mem_info;
30  ::GlobalMemoryStatusEx(&mem_info);
31  rng.add_entropy_T(mem_info);
32 
33  POINT point;
34  ::GetCursorPos(&point);
35  rng.add_entropy_T(point);
36 
37  ::GetCaretPos(&point);
38  rng.add_entropy_T(point);
39 
40  /*
41  Potential other sources to investigate
42 
43  GetProductInfo
44  GetComputerNameExA
45  GetSystemFirmwareTable
46  GetVersionExA
47  GetProcessorSystemCycleTime
48  GetProcessHandleCount(GetCurrentProcess())
49  GetThreadTimes(GetCurrentThread())
50  QueryThreadCycleTime
51  QueryIdleProcessorCycleTime
52  QueryUnbiasedInterruptTime
53  */
54 
55  // We assume all of the above is basically junk
56  return 0;
57  }
58 
59 }
void add_entropy_T(const T &t)
Definition: rng.h:69
size_t poll(RandomNumberGenerator &rng) override
Definition: es_win32.cpp:15
Definition: alg_id.cpp:13