-
Notifications
You must be signed in to change notification settings - Fork 172
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
Reading PEM/DER from an IO object fails with "no OPENSSL_Applink" error on mswin Ruby #128
Comments
Thanks for the report, I could reproduce the problem with my x64-mswin64_140 Ruby by opening 20 files at a same time:
The cause is that we don't provide OPENSSL_Applink(), but apparently OpenSSL only looks up the symbol in the application[1] (ruby.exe, in this case) where we can't place one. I haven't come up with a good solution yet. |
Thanks for looking into it. I'm not that much of an OpenSSL user, so I don't know if IO would be a typical application. I assume your build works fine with strings? Also, if IO is common, maybe someone could (me?) could revise the docs to show that either strings or IO can be used? I came across the issue running test-all, but verified it using:
on the test folder... |
Read everything from an IO object into a String first and use the memory buffer BIO method just as we do for String inputs. For MSVC builds, the FILE BIO method uses the "UPLINK" interface that requires the application to provide OPENSSL_Applink() function. For us, the "application" means ruby.exe, in which we can't do anything. As a workaround, avoid using the FILE BIO method at all. Usually private keys or X.509 certificates aren't that large and the temporarily increased memory usage hopefully won't be an issue. Fixes: ruby#128
Only the FILE BIO method and the file descriptor BIO method use the UPLINK interface, so yes, reading from String should work well on all platforms. I have made it not use the FILE BIO at all by f842b0d. Thanks. |
Please see Ruby 13718 net/* tests using OpenSSL::PKey::RSA and OpenSSL::X509::Certificate for full info.
When running tests on a mswin trunk build with OpenSSL 1.1.0f, I have a silent stop with the following error:
As mentioned in the issue, the current tests pass a File instance to
OpenSSL::PKey::RSA.new
andOpenSSL::X509::Certificate.new
, instead of a string.I assume an error should be generated, or they should accept a File/IO object, but they shouldn't silent stop with the above error.
The text was updated successfully, but these errors were encountered: