Botan 3.6.1
Crypto and TLS for C&
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
13namespace Botan {
14
16 rng.add_entropy_T(::GetTickCount());
17 rng.add_entropy_T(::GetMessagePos());
18 rng.add_entropy_T(::GetMessageTime());
19 rng.add_entropy_T(::GetInputState());
20
21 rng.add_entropy_T(::GetCurrentProcessId());
22 rng.add_entropy_T(::GetCurrentThreadId());
23
24 SYSTEM_INFO sys_info;
25 ::GetSystemInfo(&sys_info);
26 rng.add_entropy_T(sys_info);
27
28 MEMORYSTATUSEX mem_info;
29 ::GlobalMemoryStatusEx(&mem_info);
30 rng.add_entropy_T(mem_info);
31
32 POINT point;
33 ::GetCursorPos(&point);
34 rng.add_entropy_T(point);
35
36 ::GetCaretPos(&point);
37 rng.add_entropy_T(point);
38
39 /*
40 Potential other sources to investigate
41
42 GetProductInfo
43 GetComputerNameExA
44 GetSystemFirmwareTable
45 GetVersionExA
46 GetProcessorSystemCycleTime
47 GetProcessHandleCount(GetCurrentProcess())
48 GetThreadTimes(GetCurrentThread())
49 QueryThreadCycleTime
50 QueryIdleProcessorCycleTime
51 QueryUnbiasedInterruptTime
52 */
53
54 // We assume all of the above is basically junk
55 return 0;
56}
57
58} // namespace Botan
void add_entropy_T(const T &t)
Definition rng.h:85
size_t poll(RandomNumberGenerator &rng) override
Definition es_win32.cpp:15