-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2898 from kkimurak/ruby-patching_backport16.7.x
Backport to 16.7.x : Add patch for Ruby to fix issue on running on legacy kernel
- Loading branch information
Showing
6 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
45 changes: 45 additions & 0 deletions
45
assets/build/patches/ruby/0001-avoid-seeding_until-ruby3.3.0.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
From 64e503eb62aff0952b655e9a86217e355f786146 Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= | ||
<[email protected]> | ||
Date: Thu, 13 Apr 2023 15:36:24 +0900 | ||
Subject: [PATCH] avoid seeding | ||
|
||
OpenSSL's man page previously stated that "the application is | ||
responsible for seeding the PRNG by calling RAND_add" (see [1]). | ||
So we had this code. However things changed. They no longer | ||
say so, instead "manual (re-)seeding of the default OpenSSL | ||
random generator is not necessary" now (see [2]). It seems all | ||
OpenSSL versions that we support now already behaves like this. | ||
Let's follow that. | ||
|
||
[1]: https://www.openssl.org/docs/man1.0.2/man3/RAND_add.html | ||
[2]: https://www.openssl.org/docs/manmaster/man3/RAND_add.html | ||
--- | ||
lib/securerandom.rb | 11 ----------- | ||
1 file changed, 11 deletions(-) | ||
|
||
diff --git a/lib/securerandom.rb b/lib/securerandom.rb | ||
index 07ae048634..c5be6ce734 100644 | ||
--- a/lib/securerandom.rb | ||
+++ b/lib/securerandom.rb | ||
@@ -47,17 +47,6 @@ def bytes(n) | ||
private | ||
|
||
def gen_random_openssl(n) | ||
- @pid = 0 unless defined?(@pid) | ||
- pid = $$ | ||
- unless @pid == pid | ||
- now = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond) | ||
- OpenSSL::Random.random_add([now, @pid, pid].join(""), 0.0) | ||
- seed = Random.urandom(16) | ||
- if (seed) | ||
- OpenSSL::Random.random_add(seed, 16) | ||
- end | ||
- @pid = pid | ||
- end | ||
return OpenSSL::Random.random_bytes(n) | ||
end | ||
|
||
-- | ||
2.43.0.windows.1 | ||
|