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

Windows Ruby 3.3: Workaround: Set OPENSSL_MODULES to find providers. #712

Merged

Conversation

junaruga
Copy link
Member

This PR is a workaround to pass the following failing tests addressed on #711. So, this PR technically fixes #711. The issue is that OpenSSL couldn't find the lib\ossl-modules\legacy.dll. The openssl/openssl#19368 was helpful to understand teh issue and find the solution.


This commit is a workaround to avoid the following test failures by loading legacy provider.

2) Error: test_openssl_legacy_provider(OpenSSL::TestProvider): OpenSSL::Provider::ProviderError: Failed to load legacy provider: (null) (name=legacy)
D:/a/ruby-openssl/ruby-openssl/test/openssl/test_provider.rb:62:in `load'
D:/a/ruby-openssl/ruby-openssl/test/openssl/test_provider.rb:62:in `<main>'
D:/a/ruby-openssl/ruby-openssl/test/openssl/test_provider.rb:61:in `with_openssl'
D:/a/ruby-openssl/ruby-openssl/test/openssl/test_provider.rb:36:in `test_openssl_legacy_provider'
     33:   end
     34:
     35:   def test_openssl_legacy_provider
  => 36:     with_openssl(<<-'end;')
     37:       OpenSSL::Provider.load("legacy")
     38:       algo = "RC4"
     39:       data = "a" * 1000

I hope this logic is included in an Ruby installer used in GitHub Actions Windows cases.

By the way, I found

$ bin\openssl.exe list -provider legacy -providers
$HOME/.local/openssl-3.0.12-fips-debug-c3cc0f1386/bin/openssl list -provider legacy -providers
Providers:
  legacy
    name: OpenSSL Legacy Provider
    version: 3.0.12
    status: active

This commit is a workaround to avoid the following test failures by loading
legacy provider.

```
2) Error: test_openssl_legacy_provider(OpenSSL::TestProvider): OpenSSL::Provider::ProviderError: Failed to load legacy provider: (null) (name=legacy)
D:/a/ruby-openssl/ruby-openssl/test/openssl/test_provider.rb:62:in `load'
D:/a/ruby-openssl/ruby-openssl/test/openssl/test_provider.rb:62:in `<main>'
D:/a/ruby-openssl/ruby-openssl/test/openssl/test_provider.rb:61:in `with_openssl'
D:/a/ruby-openssl/ruby-openssl/test/openssl/test_provider.rb:36:in `test_openssl_legacy_provider'
     33:   end
     34:
     35:   def test_openssl_legacy_provider
  => 36:     with_openssl(<<-'end;')
     37:       OpenSSL::Provider.load("legacy")
     38:       algo = "RC4"
     39:       data = "a" * 1000
```
@junaruga
Copy link
Member Author

The CI is green. Let me merge this PR to make the CI green immediately.
https://github.com/ruby/openssl/actions/runs/7494112180?pr=712

@junaruga junaruga merged commit 2c1add3 into ruby:master Jan 11, 2024
49 checks passed
@junaruga junaruga deleted the wip/win-3.3-legacy-provider-not-loaded branch January 11, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant