diff options
| author | 2024-07-13 13:21:50 +0100 | |
|---|---|---|
| committer | 2024-07-13 13:31:44 +0100 | |
| commit | 610688e410a0b544d5dfd9de0bc50fab090bd5f3 (patch) | |
| tree | 5f0ddcddf91dd41d9690d9162e8bf5fc84269776 /src/helperfuncs.cpp | |
| parent | Allow using /ACCEPT to override more blocking modes. (diff) | |
| download | inspircd++-610688e410a0b544d5dfd9de0bc50fab090bd5f3.tar.gz inspircd++-610688e410a0b544d5dfd9de0bc50fab090bd5f3.tar.bz2 inspircd++-610688e410a0b544d5dfd9de0bc50fab090bd5f3.zip | |
Use getentropy() from POSIX 2024 if it is available.
Diffstat (limited to 'src/helperfuncs.cpp')
| -rw-r--r-- | src/helperfuncs.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index aeaad9ab9..16e97da1b 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -456,7 +456,11 @@ unsigned long InspIRCd::GenRandomInt(unsigned long max) const // This is overridden by a higher-quality algorithm when TLS support is loaded void InspIRCd::DefaultGenRandom(char* output, size_t max) { -#if defined HAS_ARC4RANDOM_BUF +#ifdef HAS_GETENTROPY + if (getentropy(output, max) == 0) + return; +#endif +#ifdef HAS_ARC4RANDOM_BUF arc4random_buf(output, max); #else static std::random_device device; |
