| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
Fix wrong use of X509_NAME_cmp() return value. OpenSSL::X509::Name#<=>
could return 0 when the two objects aren't identical.
Reported by Tyler Eckstein. CVE-2018-16395.
Reference: https://hackerone.com/reports/387250
|
| |
|
|\
| |
| | |
Test fixes for OpenSSL 1.1.1
|
| |
| |
| |
| |
| |
| |
| | |
Clients that implement TLS 1.3's Middlebox Compatibility Mode will
always provide a non-empty session ID in the ClientHello. This means
the "get" callback for the server-side session caching may be called
for the initial connection.
|
| |
| |
| |
| | |
OpenSSL 1.1.1 raised the minimum size for RSA keys to 512 bits.
|
|\ \
| |/
|/| |
extconf.rb: fix build with LibreSSL 2.7.0
|
|/
|
|
|
|
|
|
|
|
| |
Our compat implementation of accessor functions that were introduced in
OpenSSL 1.1.0 conflicts with those from LibreSSL 2.7.0. Use the
HAVE_OPAQUE_OPENSSL code path when LibreSSL 2.7 or newer is detected.
Fix suggested by Joel Sing.
Fixes: https://github.com/ruby/openssl/issues/192
|
|\
| |
| | |
cipher: validate iterations argument for Cipher#pkcs5_keyivgen
|
|/
|
|
|
|
|
| |
EVP_BytesToKey() internally converts the iteration count given as an
"int" into an "unsigned int". Calling that with a negative integer will
result in a hang. This is surprising, so let's validate the value by
ourselves and raise ArgumentError as necessary.
|
|
|
|
|
|
|
|
|
| |
Those threads can purposefully raise exceptions when they call 'pend'.
The report_on_exception feature can be safely disabled in this case
since we use assert_join_threads that captures all exceptions raised.
This is necessary to suppress warnings on Ruby 2.5, which enables the
report_on_exception feature by default.
|
| |
|
|
|
|
|
|
|
| |
The value of 'value' attribute of OpenSSL::ASN1::{Integer,Enumerated}
should be an instance of OpenSSL::BN.
Reference: https://github.com/ruby/openssl/issues/176
|
|
|
|
| |
GetSSLCTX() never returns NULL.
|
| |
|
|\
| |
| | |
[Bug #14087] x509cert, x509crl, x509req, ns_spki: check sanity of public key
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The pub_encode routine of an EVP_PKEY_ASN1_METHOD seems to assume the
parameters and public key component(s) to be set properly. Calling that,
for example, through X509_set_pubkey(), with an incomplete object may
cause segfault.
Use ossl_pkey_check_public_key() to check that. It doesn't look pretty,
but unfortunately there isn't a generic way to do that with the EVP API.
Something similar applies to the verify routine of an EVP_PKEY_METHOD.
Do the same check before calling *_verify().
Reference: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/83688
Reference: https://bugs.ruby-lang.org/issues/14087
|
|/
|
|
| |
Also make it take const pointer as it never modifies the pkey.
|
|
|
|
|
|
| |
A follow-up to commit bb10767b0570 ("cipher: disallow setting AAD for
non-AEAD ciphers", 2017-10-18). Cipher#auth_data= raises
NotImplementedError if built with OpenSSL < 1.0.1.
|
|
|
|
|
|
|
|
|
| |
EVP_CipherUpdate() must not be call with the output parameter set to
NULL when the cipher does not support AEAD. Check the flag of
EVP_CIPHER, and raise an exception as necessary.
Reference: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/83337
Reference: https://bugs.ruby-lang.org/issues/14024
|
|\
| |
| | |
test/test_ssl_session: skip tests for session_remove_cb
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In OpenSSL < 1.1.0, the session_remove_cb callback is called inside the
global lock for CRYPTO_LOCK_SSL_CTX which is shared across the entire
process, not just for the specific SSL_CTX object. It is possible that
the callback releases GVL while the lock for CRYPTO_LOCK_SSL_CTX is
held, causing another thread calling an OpenSSL function that tries to
acquire the same lock stuck forever.
Add a note about the possible deadlock to the docs for
SSLContext#session_remove_cb=, and skip the relevant test cases unless
the OSSL_TEST_ALL environment variable is set to 1.
A deadlock due to this issue is observed:
http://ci.rvm.jp/results/trunk-test@frontier/104428
|
|/
|
|
|
|
|
|
|
| |
It runs the 'openssl' command line tool that is not of the version used
to compile and run the test suite.
Thanks to MSP-Greg for pointing this out.
Fixes: https://github.com/ruby/openssl/issues/157
|
| |
|
|\
| |
| | |
ossl.c: make legacy locking callbacks reentrant
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Although it's not documented explicitly that the locking callbacks must
provide reentrant mutexes, it seems to be required.
Specifically, the session_remove_cb callback function of an SSL_CTX is
called in a critical section for CRYPTO_LOCK_SSL_CTX, which is shared
across the library. This leads, if the callback function calls another
OpenSSL function that will attempt to lock CRYPTO_LOCK_SSL_CTX, to
deadlock. SSL_CTX_free() is one example of such a function.
http://ci.rvm.jp/results/trunk@P895/64001
|
| |
| |
| |
| |
| | |
In preparation for making the mutexes reentrant. It is common to the
non-dynamic and the dynamic locking callbacks.
|
|\ \
| | |
| | | |
ssl: prevent SSLSocket#sysread* from leaking uninitialized data
|
| | |
| | |
| | |
| | |
| | |
| | | |
Set the length of the buffer string to 0 first, and adjust to the size
successfully read by the SSL_read() call later. This is needed because
the buffer string may be provided by the caller.
|
| |/
| |
| |
| |
| | |
The sleep was to ensure that the SSLSocket#read_nonblock will get
close_notify alert. A simple IO.select will suffice.
|
| |
| |
| |
| |
| |
| |
| | |
Skip test_openssl_engine_cipher_rc4 which will fail without RC4 support.
It may be disabled by 'no-rc4' configure option of the OpenSSL library.
Reference: https://github.com/ruby/openssl/issues/154
|
|/
|
|
|
|
|
| |
Use ignore_stderr option of assert_separately instead of $stderr.reopen
which may not work if the OpenSSL library uses a different stdio.
Reference: https://github.com/ruby/openssl/issues/154
|
|
|
|
|
|
|
| |
- Upgrade to latest Ubuntu LTS.
- Remove unnecessary packages.
- Update OpenSSL, LibreSSL, and Ruby versions. Notably, LibreSSL 2.6 is
added. Accordingly, .travis.yml is also updated to use that.
|
|
|
|
|
|
| |
Similar to the previous one, LibreSSL 2.6.1 has relevant functions such
as SSL_CTX_set_next_proto_select_cb(), but they are broken and do
nothing.
|
|
|
|
|
| |
LibreSSL 2.6.1 has SSL_CTX_set_tmp_ecdh_callback() function, but it does
not work.
|
|
|
|
|
|
|
| |
The test cases added by commit 8ed81ff4b0a8 ("test/test_pair: fix
test_write_nonblock{,_no_exceptions}", 2017-09-04) can consume much
memory and time if the OpenSSL supports SSL/TLS compression. Disable it
explicitly.
|
|
|
|
| |
Suppress "using default DH parameters" message.
|
|
|
|
|
|
|
|
|
|
| |
* include/ruby/ruby.h (ST2FIX): fix unnormalized Fixnum value bug
on mingw/mswin. [ruby-core:82687] [Bug #13877]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[ky: add ST2FIX() definition to ext/openssl/ruby_missing.h, and adapt
the test case to the 2.0 branch.]
Sync-with-trunk: r59765
|
|
|
|
|
|
|
|
|
| |
When the previous SSLSocket#write_nonblock call does not finish writing
the complete contents, SSL_shutdown() which is called through
SSLSocket#close will not send a close_notify alert.
As of commit e3a305063675 ssl_pair no longer uses the sync_close
feature. Do not expect that SSL_read() would get ECONNRESET.
|
|\
| |
| | |
test/test_ssl: explicitly accept TLS 1.1 in corresponding test
|
|/
|
|
|
|
| |
OpenSSL in Debian sid has recently disabled TLS < 1.2 by default, so in
order to test that TLS 1.1 works, we need to explicitly make our test
client accept it.
|
|\
| |
| | |
ssl: remove useless call to rb_thread_wait_fd()
|
| |
| |
| |
| |
| |
| | |
That there is no immediately readable data in the SSL instance does not
imply it has to read more bytes from the underlying socket. Just call
SSL_read() and check the return value.
|
|\ \
| |/
|/| |
Fix test failures with TLS 1.3-capable OpenSSL
|
| |
| |
| |
| | |
Fix test cases failing with TLS 1.3-enabled OpenSSL master.
|
| |
| |
| |
| |
| | |
Use TLS 1.2 explicitly where needed, since TLS 1.3 will remove session
ID based session resumption.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The very patch that added this test case made the dfree function not
send close_notify alert when an SSLSocket is being GCed.
Anyway, the new OSSL_GC_STRESS option added by 6ee4b285036e ("test: run
test cases under GC.stress if OSSL_GC_STRESS is specified", 2016-12-04)
will cover this kind of issues.
|
| |
| |
| |
| |
| |
| | |
LibreSSL 2.6.1 removed DSA support from its SSL code. Also, TLS 1.3 will
not support DSA certificates. Use an RSA certificate as the client
certificate in the tests, too.
|
| |
| |
| |
| |
| |
| | |
Add methods that check whether the running OpenSSL is an OpenSSL or a
LibreSSL, and optionally check whether the version is newer or equal to
the given version number.
|
| |
| |
| |
| |
| |
| | |
start_server can hang if the given block exits before closing sockets
that the block opens. While this is a carelessness of the caller, we
can do a better job.
|