diff options
Diffstat (limited to 'www/iridium/files/patch-base_rand__util__posix.cc')
-rw-r--r-- | www/iridium/files/patch-base_rand__util__posix.cc | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/www/iridium/files/patch-base_rand__util__posix.cc b/www/iridium/files/patch-base_rand__util__posix.cc index 7fd63f41875e..ba6e34af5213 100644 --- a/www/iridium/files/patch-base_rand__util__posix.cc +++ b/www/iridium/files/patch-base_rand__util__posix.cc @@ -1,7 +1,7 @@ ---- base/rand_util_posix.cc.orig 2022-03-28 18:11:04 UTC +--- base/rand_util_posix.cc.orig 2023-11-22 14:00:11 UTC +++ base/rand_util_posix.cc -@@ -17,7 +17,7 @@ - #include "base/posix/eintr_wrapper.h" +@@ -22,7 +22,7 @@ + #include "base/time/time.h" #include "build/build_config.h" -#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_NACL) @@ -9,31 +9,36 @@ #include "third_party/lss/linux_syscall_support.h" #elif BUILDFLAG(IS_MAC) // TODO(crbug.com/995996): Waiting for this header to appear in the iOS SDK. -@@ -34,6 +34,7 @@ static constexpr int kOpenFlags = O_RDONLY; - static constexpr int kOpenFlags = O_RDONLY | O_CLOEXEC; - #endif - -+#if !BUILDFLAG(IS_OPENBSD) - // We keep the file descriptor for /dev/urandom around so we don't need to - // reopen it (which is expensive), and since we may not even be able to reopen - // it if we are later put in a sandbox. This class wraps the file descriptor so -@@ -51,6 +52,7 @@ class URandomFd { +@@ -39,6 +39,7 @@ namespace base { + + namespace { + ++#if !BUILDFLAG(IS_BSD) + #if BUILDFLAG(IS_AIX) + // AIX has no 64-bit support for O_CLOEXEC. + static constexpr int kOpenFlags = O_RDONLY; +@@ -63,10 +64,11 @@ class URandomFd { private: const int fd_; }; +#endif - } // namespace + #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ + BUILDFLAG(IS_ANDROID)) && \ +- !BUILDFLAG(IS_NACL) ++ !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD) + // TODO(pasko): Unify reading kernel version numbers in: + // mojo/core/channel_linux.cc + // chrome/browser/android/seccomp_support_detector.cc +@@ -176,6 +178,7 @@ bool UseBoringSSLForRandBytes() { + namespace { -@@ -62,6 +64,7 @@ namespace base { - // (https://chromium-review.googlesource.com/c/chromium/src/+/1545096) and land - // it or some form of it. - void RandBytes(void* output, size_t output_length) { -+#if !BUILDFLAG(IS_OPENBSD) - #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_NACL) - // We have to call `getrandom` via Linux Syscall Support, rather than through - // the libc wrapper, because we might not have an up-to-date libc (e.g. on -@@ -93,11 +96,16 @@ void RandBytes(void* output, size_t output_length) { + void RandBytes(void* output, size_t output_length, bool avoid_allocation) { ++#if !BUILDFLAG(IS_BSD) + #if !BUILDFLAG(IS_NACL) + // The BoringSSL experiment takes priority over everything else. + if (!avoid_allocation && internal::UseBoringSSLForRandBytes()) { +@@ -214,6 +217,9 @@ void RandBytes(void* output, size_t output_length, boo const bool success = ReadFromFD(urandom_fd, static_cast<char*>(output), output_length); CHECK(success); @@ -42,7 +47,12 @@ +#endif } -+#if !BUILDFLAG(IS_OPENBSD) + } // namespace +@@ -233,9 +239,11 @@ void RandBytes(void* output, size_t output_length) { + RandBytes(output, output_length, /*avoid_allocation=*/false); + } + ++#if !BUILDFLAG(IS_BSD) int GetUrandomFD() { static NoDestructor<URandomFd> urandom_fd; return urandom_fd->fd(); |