Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move bundled OpenSSL related files to bin/lib subdirectory. #379

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-3.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Update to ruby-3.2.4, see [release notes](https://www.ruby-lang.org/en/news/2024/04/23/ruby-3-2-4-released/).
- Update the SSL CA certificate list.
- Update to OpenSSL-3.3.0. The Ruby API dosn't change.
- Move bundled OpenSSL related files to bin/lib subdirectory so that legacy algorithms can be loaded through provider support. #365
- Update the bundled MSYS2 keyring package.
- Avoid crash even if a registry key incldues inconvertible characters
- Avoid method redefinition warning in rubygems hook
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG-3.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Update to ruby-3.3.1, see [release notes](https://www.ruby-lang.org/en/news/2024/04/23/ruby-3-3-1-released/).
- Update the SSL CA certificate list.
- Update to OpenSSL-3.3.0. The Ruby API dosn't change.
- Move bundled OpenSSL related files to bin/lib subdirectory so that legacy algorithms can be loaded through provider support. #365
- Update the bundled MSYS2 keyring package.
- Avoid crash even if a registry key incldues inconvertible characters
- Avoid method redefinition warning in rubygems hook
Expand Down
22 changes: 22 additions & 0 deletions recipes/sandbox/70-move-openssl-files-to-bin.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Move bundled OpenSSL related files to bin/lib subdirectory.
# This is necessary because libcrypt.dll and libssl.dll are located in bin/ruby_builtin_dlls and they search other dlls in ../lib

if package.rubyver2 >= "3.2"
osl_files = %w[
lib/engines-3/capi.dll
lib/engines-3/loader_attic.dll
lib/engines-3/padlock.dll
lib/ossl-modules/legacy.dll
]

osl_files.each do |path|
# Add tasks to write the DLLs into the sub directory
destpath = File.join(sandboxdir, "bin", path)
file destpath => [File.join(unpackdirmgw, path), File.dirname(destpath)] do |t|
cp(t.prerequisites.first, t.name)
end

# Add the DLLs in the dependent files list to the subdirectory
self.sandboxfiles << destpath
end
end
4 changes: 0 additions & 4 deletions recipes/sandbox/rubyinstaller-3.2.4.files
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ bin/ruby.exe
bin/rubyw.exe
bin/zlib1.dll
include/ruby-3.2.0
lib/engines-3/capi.dll
lib/engines-3/loader_attic.dll
lib/engines-3/padlock.dll
lib/ossl-modules/legacy.dll
lib/pkgconfig/ruby-3.2.pc
lib/ruby/3.2.0
lib/ruby/gems/3.2.0
Expand Down
4 changes: 0 additions & 4 deletions recipes/sandbox/rubyinstaller-3.3.1.files
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ bin/ruby.exe
bin/rubyw.exe
bin/zlib1.dll
include/ruby-3.3.0
lib/engines-3/capi.dll
lib/engines-3/loader_attic.dll
lib/engines-3/padlock.dll
lib/ossl-modules/legacy.dll
lib/pkgconfig/ruby-3.3.pc
lib/ruby/3.3.0
lib/ruby/gems/3.3.0
Expand Down
4 changes: 0 additions & 4 deletions recipes/sandbox/rubyinstaller-head.files
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ bin/ruby.exe
bin/rubyw.exe
bin/zlib1.dll
include/ruby-3.4.0+0
lib/engines-3/capi.dll
lib/engines-3/loader_attic.dll
lib/engines-3/padlock.dll
lib/ossl-modules/legacy.dll
lib/pkgconfig/ruby-3.4.pc
lib/ruby/3.4.0+0
lib/ruby/gems/3.4.0+0
Expand Down
10 changes: 10 additions & 0 deletions test/test_stdlib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,14 @@ def test_openssl_version
assert_match(/OpenSSL 3\./, OpenSSL::OPENSSL_LIBRARY_VERSION)
end
end

def test_openssl_provider
# ruby-3.2 has OpenSSL-3.x which supports provider API, but the ruby C-ext is too old there
return if RUBY_VERSION =~ /^2\.[34567]\.|^3\.[012]\./
require "openssl"

OpenSSL::Provider.load("legacy")
cipher = OpenSSL::Cipher.new("RC4")
assert_equal "RC4", cipher.name
end
end
Loading