16#ifndef OPENVPN_APPLECRYPTO_UTIL_RAND_H
17#define OPENVPN_APPLECRYPTO_UTIL_RAND_H
19#include <Security/SecRandom.h>
33 std::string
name()
const override
39 void rand_bytes(
unsigned char *buf,
size_t size)
override
42 throw rand_error_apple(
"rand_bytes");
55 return SecRandomCopyBytes(kSecRandomDefault, size, buf) ? false :
true;
bool rndbytes(unsigned char *buf, size_t size)
bool rand_bytes_noexcept(unsigned char *buf, size_t size) override
Fill a buffer with random bytes without throwing exceptions.
void rand_bytes(unsigned char *buf, size_t size) override
Fill a buffer with random bytes.
std::string name() const override
Get the name of the random number generation algorithm.
OPENVPN_EXCEPTION(rand_error_apple)
Abstract base class for cryptographically strong random number generators.
Implementation of the base classes for random number generators.