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