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{
23 Rand2() = default;
24
26 RandomAPI::Ptr prng_arg)
27 : rng(std::move(rng_arg)),
28 prng(std::move(prng_arg))
29 {
30 }
31
33 : rng(rng_arg),
34 prng(rng_arg)
35 {
36 }
37
38 bool defined() const
39 {
40 return rng && prng;
41 }
42
45};
46
47} // namespace openvpn
Implementation of the base classes for random number generators.
Rand2()=default
StrongRandomAPI::Ptr rng
Definition rand2.hpp:43
bool defined() const
Definition rand2.hpp:38
Rand2(StrongRandomAPI::Ptr rng_arg, RandomAPI::Ptr prng_arg)
Definition rand2.hpp:25
RandomAPI::Ptr prng
Definition rand2.hpp:44
Rand2(StrongRandomAPI::Ptr rng_arg)
Definition rand2.hpp:32