BitShares-Core
6.1.0
BitShares blockchain implementation and command-line interface software
libraries
fc
src
crypto
rand.cpp
Go to the documentation of this file.
1
#include <openssl/rand.h>
2
#include <
fc/crypto/openssl.hpp
>
3
#include <
fc/exception/exception.hpp
>
4
#include <
fc/fwd_impl.hpp
>
5
6
7
namespace
fc
{
8
9
void
rand_bytes
(
char
* buf,
int
count)
10
{
11
static
int
init =
init_openssl
();
12
(void)init;
13
14
int
result = RAND_bytes((
unsigned
char
*)buf, count);
15
if
(result != 1)
16
FC_THROW
(
"Error calling OpenSSL's RAND_bytes(): ${code}"
, (
"code"
, (uint32_t)ERR_get_error()));
17
}
18
19
}
// namespace fc
fc::rand_bytes
void rand_bytes(char *buf, int count)
Definition:
rand.cpp:9
fc::init_openssl
int init_openssl()
Definition:
openssl.cpp:63
FC_THROW
#define FC_THROW( ...)
Definition:
exception.hpp:366
openssl.hpp
exception.hpp
Defines exception's used by fc.
fc
Definition:
api.hpp:15
fwd_impl.hpp
Generated on Thu Dec 1 2022 10:13:44 for BitShares-Core by
1.8.13