Botan 3.14.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#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 // We assume all of the below is basically junk, so none of it is credited
19 acc.add_T(::GetTickCount(), 0);
20 acc.add_T(::GetMessagePos(), 0);
21 acc.add_T(::GetMessageTime(), 0);
22 acc.add_T(::GetInputState(), 0);
23
24 acc.add_T(::GetCurrentProcessId(), 0);
25 acc.add_T(::GetCurrentThreadId(), 0);
26
27 SYSTEM_INFO sys_info{};
28 ::GetSystemInfo(&sys_info); // no return value
29 acc.add_T(sys_info, 0);
30
31 MEMORYSTATUSEX mem_info{};
32 mem_info.dwLength = sizeof(mem_info);
33 if(::GlobalMemoryStatusEx(&mem_info) != 0) {
34 acc.add_T(mem_info, 0);
35 }
36
37 POINT point{};
38 if(::GetCursorPos(&point) != 0) {
39 acc.add_T(point, 0);
40 }
41
42 if(::GetCaretPos(&point) != 0) {
43 acc.add_T(point, 0);
44 }
45
46 /*
47 Potential other sources to investigate
48
49 GetProductInfo
50 GetComputerNameExA
51 GetSystemFirmwareTable
52 GetVersionExA
53 GetProcessorSystemCycleTime
54 GetProcessHandleCount(GetCurrentProcess())
55 GetThreadTimes(GetCurrentThread())
56 QueryThreadCycleTime
57 QueryIdleProcessorCycleTime
58 QueryUnbiasedInterruptTime
59 */
60}
61
62} // namespace Botan
void add_T(const T &t, size_t estimated_entropy_bits)
Definition entropy_src.h:62
void gather(Entropy_Accumulator &acc) override
Definition es_win32.cpp:17