14#include <openssl/crypto.h>
15#include <openssl/rand.h>
24CryptoLink::~CryptoLink() {
28class RNGImpl :
public RNG {
35 std::vector<uint8_t> random(
size_t len) {
36 std::vector<uint8_t> data;
39 if (RAND_bytes(&data[0], len) != 1) {
41 "OpenSSL RAND_bytes() failed");
49CryptoLink::initialize(CryptoLink& c) {
52 c.impl_.reset(
new CryptoLinkImpl());
53 }
catch (
const std::exception &ex) {
56 "Error during OpenSSL initialization:" << ex.what());
60 "Error during OpenSSL initialization");
65 c.rng_.reset(
new RNGImpl());
66 }
catch (
const std::exception &ex) {
69 "Error during OpenSSL RNG initialization:" << ex.what());
73 "Error during OpenSSL RNG initialization");
80 return (SSLeay_version(SSLEAY_VERSION));
static std::string getVersion()
Get version string.
This exception is raised when a general error that was not specifically caught is thrown by the under...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Defines the logger used by the top-level component of kea-lfc.