Botan
3.7.1
Crypto and TLS for C&
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerations
a
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
c
d
f
i
m
n
r
s
t
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
f
h
i
m
n
o
p
r
s
t
u
v
w
Enumerations
b
c
d
e
k
m
n
o
p
s
t
x
Enumerator
_
a
b
c
d
e
f
h
k
l
m
n
p
q
r
s
t
u
w
x
Related Symbols
b
c
d
e
f
k
o
p
s
t
x
Files
File List
File Members
All
_
a
b
c
d
e
f
i
k
m
n
o
p
q
s
t
u
w
x
y
z
Functions
b
c
Variables
Typedefs
b
c
e
p
t
Enumerations
Enumerator
b
c
d
e
k
n
Macros
_
a
b
c
f
m
n
q
s
t
w
src
lib
entropy
win32_stats
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
15
size_t
Win32_EntropySource::poll
(
RandomNumberGenerator
& rng) {
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
}
15
size_t
Win32_EntropySource::poll
(
RandomNumberGenerator
& rng) {
…
}
57
58
}
// namespace Botan
Botan::RandomNumberGenerator
Definition
rng.h:31
Botan::RandomNumberGenerator::add_entropy_T
void add_entropy_T(const T &t)
Definition
rng.h:85
Botan::Win32_EntropySource::poll
size_t poll(RandomNumberGenerator &rng) override
Definition
es_win32.cpp:15
Botan
Definition
alg_id.cpp:13
Generated by
1.12.0