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
getentropy
getentropy.cpp
Go to the documentation of this file.
1
/*
2
* System Call getentropy(2)
3
* (C) 2017 Alexander Bluhm (genua GmbH)
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#include <botan/internal/getentropy.h>
9
#include <unistd.h>
10
11
// macOS and Android include it in sys/random.h instead
12
#if __has_include(<sys/random.h>)
13
#include <sys/random.h>
14
#endif
15
16
namespace
Botan
{
17
18
/**
19
* Gather 256 bytes entropy from getentropy(2). Note that maximum
20
* buffer size is limited to 256 bytes. On OpenBSD this does neither
21
* block nor fail.
22
*/
23
size_t
Getentropy::poll
(
RandomNumberGenerator
& rng) {
24
secure_vector<uint8_t>
buf(256);
25
26
if
(::getentropy(buf.data(), buf.size()) == 0) {
27
rng.
add_entropy
(buf.data(), buf.size());
28
return
buf.size() * 8;
29
}
30
31
return
0;
32
}
23
size_t
Getentropy::poll
(
RandomNumberGenerator
& rng) {
…
}
33
34
}
// namespace Botan
Botan::Getentropy::poll
size_t poll(RandomNumberGenerator &rng) override
Definition
getentropy.cpp:23
Botan::RandomNumberGenerator
Definition
rng.h:31
Botan::RandomNumberGenerator::add_entropy
void add_entropy(std::span< const uint8_t > input)
Definition
rng.h:76
Botan
Definition
alg_id.cpp:13
Botan::secure_vector
std::vector< T, secure_allocator< T > > secure_vector
Definition
secmem.h:61
Generated by
1.12.0