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
19
20namespace openvpn {
21inline 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
virtual void rand_bytes(unsigned char *buf, size_t size)=0
Fill a buffer with random bytes.
Support deferred server-side state creation when client connects.
Definition ovpncli.cpp:95
void openssl_reseed_rng()
Definition reseed.hpp:21