]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/uuid/detail/random_provider_arc4random.ipp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / uuid / detail / random_provider_arc4random.ipp
1 //
2 // Copyright (c) 2017 James E. King III
3 //
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at
6 // https://www.boost.org/LICENSE_1_0.txt)
7 //
8 // "A Replacement Call for Random"
9 // https://man.openbsd.org/arc4random.3
10 //
11
12 #include <cstddef>
13 #include <stdlib.h>
14
15 namespace boost {
16 namespace uuids {
17 namespace detail {
18
19 class random_provider_base
20 {
21 public:
22 //! Obtain entropy and place it into a memory location
23 //! \param[in] buf the location to write entropy
24 //! \param[in] siz the number of bytes to acquire
25 void get_random_bytes(void *buf, std::size_t siz)
26 {
27 arc4random_buf(buf, siz);
28 }
29 };
30
31 } // detail
32 } // uuids
33 } // boost