mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
Codechange: Use arc4random_buf on random_func.cpp for OpenBSD
This commit is contained in:
parent
018326321c
commit
b477a8458c
@ -97,7 +97,7 @@ void RandomBytesWithFallback(std::span<uint8_t> buf)
|
|||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
auto res = BCryptGenRandom(nullptr, static_cast<PUCHAR>(buf.data()), static_cast<ULONG>(buf.size()), BCRYPT_USE_SYSTEM_PREFERRED_RNG);
|
auto res = BCryptGenRandom(nullptr, static_cast<PUCHAR>(buf.data()), static_cast<ULONG>(buf.size()), BCRYPT_USE_SYSTEM_PREFERRED_RNG);
|
||||||
if (res >= 0) return;
|
if (res >= 0) return;
|
||||||
#elif defined(__APPLE__) || defined(__NetBSD__) || defined(__FreeBSD__)
|
#elif defined(__APPLE__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||||
arc4random_buf(buf.data(), buf.size());
|
arc4random_buf(buf.data(), buf.size());
|
||||||
return;
|
return;
|
||||||
#elif defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 25)))
|
#elif defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 25)))
|
||||||
|
Loading…
Reference in New Issue
Block a user