OpenVPN 3 Core Library
Loading...
Searching...
No Matches
reseed.hpp
Go to the documentation of this file.
1
// OpenVPN -- An application to securely tunnel IP networks
2
// over a single port, with support for SSL/TLS-based
3
// session authentication and key exchange,
4
// packet encryption, packet authentication, and
5
// packet compression.
6
//
7
// Copyright (C) 2012- OpenVPN Inc.
8
//
9
// SPDX-License-Identifier: MPL-2.0 OR AGPL-3.0-only WITH openvpn3-openssl-exception
10
//
11
12
#pragma once
13
14
// seed OpenSSL's random number generator with /dev/urandom
15
16
#include <openssl/rand.h>
17
18
#include <
openvpn/random/devurand.hpp
>
19
20
namespace
openvpn
{
21
inline
void
openssl_reseed_rng
()
22
{
23
unsigned
char
entropy[64];
24
25
RandomAPI::Ptr
rng(
new
DevURand
);
26
rng->
rand_bytes
(entropy,
sizeof
(entropy));
27
28
RAND_seed(entropy,
sizeof
(entropy));
29
}
30
}
// namespace openvpn
openvpn::DevURand
Definition
devurand.hpp:27
openvpn::RCPtr< RandomAPI >
openvpn::RandomAPI::rand_bytes
virtual void rand_bytes(unsigned char *buf, size_t size)=0
Fill a buffer with random bytes.
devurand.hpp
openvpn
Support deferred server-side state creation when client connects.
Definition
ovpncli.cpp:95
openvpn::openssl_reseed_rng
void openssl_reseed_rng()
Definition
reseed.hpp:21
openvpn
openssl
util
reseed.hpp
Generated by
1.9.8