$OpenBSD: patch-src_3rdparty_chromium_base_rand_util_posix_cc,v 1.2 2021/01/19 06:16:33 rsadowski Exp $

Index: src/3rdparty/chromium/base/rand_util_posix.cc
--- src/3rdparty/chromium/base/rand_util_posix.cc.orig
+++ src/3rdparty/chromium/base/rand_util_posix.cc
@@ -17,6 +17,7 @@
 
 namespace {
 
+#if !defined(OS_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
@@ -42,21 +43,28 @@ class URandomFd {
  private:
   const int fd_;
 };
+#endif
 
 }  // namespace
 
 namespace base {
 
 void RandBytes(void* output, size_t output_length) {
+#if !defined(OS_OPENBSD)
   const int urandom_fd = GetUrandomFD();
   const bool success =
       ReadFromFD(urandom_fd, static_cast<char*>(output), output_length);
   CHECK(success);
+#else
+  arc4random_buf(static_cast<char*>(output), output_length);
+#endif
 }
 
+#if !defined(OS_OPENBSD)
 int GetUrandomFD() {
   static NoDestructor<URandomFd> urandom_fd;
   return urandom_fd->fd();
 }
+#endif
 
 }  // namespace base
