OpenVPN 3 Core Library
Loading...
Searching...
No Matches
rand2.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#include <utility>
15
17
18namespace openvpn {
19
20// By convention, rng is crypto-strength while prng is not.
21struct Rand2
22{
24 {
25 }
26
28 RandomAPI::Ptr prng_arg)
29 : rng(std::move(rng_arg)),
30 prng(std::move(prng_arg))
31 {
32 }
33
35 : rng(rng_arg),
36 prng(rng_arg)
37 {
38 }
39
40 bool defined() const
41 {
42 return rng && prng;
43 }
44
47};
48
49} // namespace openvpn
Implementation of the base classes for random number generators.
StrongRandomAPI::Ptr rng
Definition rand2.hpp:45
bool defined() const
Definition rand2.hpp:40
Rand2(StrongRandomAPI::Ptr rng_arg, RandomAPI::Ptr prng_arg)
Definition rand2.hpp:27
RandomAPI::Ptr prng
Definition rand2.hpp:46
Rand2(StrongRandomAPI::Ptr rng_arg)
Definition rand2.hpp:34