Kea 2.7.6
crypto_rng.cc
Go to the documentation of this file.
1// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#include <config.h>
8
9#include <cryptolink.h>
11
12#include <boost/scoped_ptr.hpp>
13
14#include <cstring>
15
16namespace isc {
17namespace cryptolink {
18
20}
21
23}
24
25std::vector<uint8_t>
26random(size_t len) {
27 RNGPtr rng(CryptoLink::getCryptoLink().getRNG());
28 return (rng->random(len));
29}
30
31uint16_t generateQid() {
32 uint16_t val;
33 std::vector<uint8_t> rnd = random(sizeof(uint16_t));
34 memmove(&val, &rnd[0], sizeof(uint16_t));
35 return (val);
36}
37
38} // namespace cryptolink
39} // namespace isc
Defines the logger used by the top-level component of kea-lfc.