File indexing completed on 2025-01-18 09:53:31
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_UUID_DETAIL_RANDOM_PROVIDER_PLATFORM_DETECTION_HPP
0012 #define BOOST_UUID_DETAIL_RANDOM_PROVIDER_PLATFORM_DETECTION_HPP
0013
0014 #include <boost/predef/library/c/cloudabi.h>
0015 #include <boost/predef/library/c/gnu.h>
0016 #include <boost/predef/os/bsd/open.h>
0017 #include <boost/predef/os/windows.h>
0018
0019
0020
0021 #if (defined(__linux__) || defined(__linux) || defined(linux)) && (!defined(__ANDROID__) || __ANDROID_API__ >= 28)
0022 #include <sys/syscall.h>
0023 #if defined(SYS_getrandom)
0024 #define BOOST_UUID_RANDOM_PROVIDER_HAS_GETRANDOM
0025 #endif
0026 #endif
0027
0028
0029
0030 #if !defined(BOOST_UUID_RANDOM_PROVIDER_DISABLE_GETENTROPY) && (defined(__linux__) || defined(__linux) || defined(linux) || defined(__ANDROID__))
0031 #define BOOST_UUID_RANDOM_PROVIDER_DISABLE_GETENTROPY
0032 #endif
0033
0034
0035
0036
0037
0038
0039 #if BOOST_OS_BSD_OPEN >= BOOST_VERSION_NUMBER(2, 1, 0) || BOOST_LIB_C_CLOUDABI
0040 # define BOOST_UUID_RANDOM_PROVIDER_ARC4RANDOM
0041 # define BOOST_UUID_RANDOM_PROVIDER_NAME arc4random
0042
0043 #elif BOOST_OS_WINDOWS
0044 # include <boost/winapi/config.hpp>
0045 # if BOOST_WINAPI_PARTITION_APP_SYSTEM && \
0046 !defined(BOOST_UUID_RANDOM_PROVIDER_FORCE_WINCRYPT) && \
0047 !defined(_WIN32_WCE) && \
0048 (BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6)
0049 # define BOOST_UUID_RANDOM_PROVIDER_BCRYPT
0050 # define BOOST_UUID_RANDOM_PROVIDER_NAME bcrypt
0051
0052 # elif BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM
0053 # define BOOST_UUID_RANDOM_PROVIDER_WINCRYPT
0054 # define BOOST_UUID_RANDOM_PROVIDER_NAME wincrypt
0055 # else
0056 # error Unable to find a suitable windows entropy provider
0057 # endif
0058
0059 #elif defined(BOOST_UUID_RANDOM_PROVIDER_HAS_GETRANDOM) && !defined(BOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX) && !defined(BOOST_UUID_RANDOM_PROVIDER_DISABLE_GETRANDOM)
0060 # define BOOST_UUID_RANDOM_PROVIDER_GETRANDOM
0061 # define BOOST_UUID_RANDOM_PROVIDER_NAME getrandom
0062
0063 #elif BOOST_LIB_C_GNU >= BOOST_VERSION_NUMBER(2, 25, 0) && !defined(BOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX) && !defined(BOOST_UUID_RANDOM_PROVIDER_DISABLE_GETENTROPY)
0064 # define BOOST_UUID_RANDOM_PROVIDER_GETENTROPY
0065 # define BOOST_UUID_RANDOM_PROVIDER_NAME getentropy
0066
0067 #else
0068 # define BOOST_UUID_RANDOM_PROVIDER_POSIX
0069 # define BOOST_UUID_RANDOM_PROVIDER_NAME posix
0070
0071 #endif
0072
0073 #define BOOST_UUID_RANDOM_PROVIDER_STRINGIFY2(X) #X
0074 #define BOOST_UUID_RANDOM_PROVIDER_STRINGIFY(X) BOOST_UUID_RANDOM_PROVIDER_STRINGIFY2(X)
0075
0076 #if defined(BOOST_UUID_RANDOM_PROVIDER_SHOW)
0077 #pragma message("BOOST_UUID_RANDOM_PROVIDER_NAME " BOOST_UUID_RANDOM_PROVIDER_STRINGIFY(BOOST_UUID_RANDOM_PROVIDER_NAME))
0078 #endif
0079
0080 #endif