2018-05-28 15:22:23 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
|
*
|
2021-06-03 08:37:05 +02:00
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*
|
2018-05-28 15:22:23 +02:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
2020-09-14 16:20:40 -07:00
|
|
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
2018-05-28 15:22:23 +02:00
|
|
|
*
|
|
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
|
|
* information regarding copyright ownership.
|
|
|
|
*/
|
|
|
|
|
2020-03-09 16:17:26 +01:00
|
|
|
#include <openssl/err.h>
|
|
|
|
#include <openssl/rand.h>
|
|
|
|
|
2018-05-30 06:26:05 +02:00
|
|
|
#include <isc/types.h>
|
2020-02-12 13:59:18 +01:00
|
|
|
#include <isc/util.h>
|
2018-05-28 15:22:23 +02:00
|
|
|
|
|
|
|
#include "entropy_private.h"
|
|
|
|
|
|
|
|
void
|
2020-02-13 14:44:37 -08:00
|
|
|
isc_entropy_get(void *buf, size_t buflen) {
|
2018-05-28 15:22:23 +02:00
|
|
|
if (RAND_bytes(buf, buflen) < 1) {
|
2020-02-12 13:59:18 +01:00
|
|
|
FATAL_ERROR(__FILE__, __LINE__, "RAND_bytes(): %s",
|
2018-05-28 15:22:23 +02:00
|
|
|
ERR_error_string(ERR_get_error(), NULL));
|
|
|
|
}
|
|
|
|
}
|