aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* x509name: fix OpenSSL::X509::Name#{cmp,<=>}ky/x509name-cmp-bugfixKazuki Yamaguchi2018-10-172-5/+11
| | | | | | | | | 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
* Ruby/OpenSSL 2.0.8v2.0.8Kazuki Yamaguchi2018-05-123-2/+16
|
* Merge pull request #202 from rhenium/ky/openssl-1.1.1Kazuki Yamaguchi2018-05-122-6/+17
|\ | | | | Test fixes for OpenSSL 1.1.1
| * test/test_ssl_session: set client protocol version explicitlyky/openssl-1.1.1Kazuki Yamaguchi2018-05-111-5/+9
| | | | | | | | | | | | | | 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.
| * test/test_pkey_rsa: fix test failure with OpenSSL 1.1.1Kazuki Yamaguchi2018-05-111-1/+8
| | | | | | | | OpenSSL 1.1.1 raised the minimum size for RSA keys to 512 bits.
* | Merge pull request #193 from rhenium/ky/libressl-2.7Kazuki Yamaguchi2018-05-121-1/+4
|\ \ | |/ |/| extconf.rb: fix build with LibreSSL 2.7.0
| * extconf.rb: fix build with LibreSSL 2.7.0ky/libressl-2.7Kazuki Yamaguchi2018-03-241-1/+4
|/ | | | | | | | | | 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
* Merge pull request #184 from rhenium/ky/cipher-pkcs5-keyivgen-validate-iterKazuki Yamaguchi2018-02-192-0/+5
|\ | | | | cipher: validate iterations argument for Cipher#pkcs5_keyivgen
| * cipher: validate iterations argument for Cipher#pkcs5_keyivgenky/cipher-pkcs5-keyivgen-validate-iterKazuki Yamaguchi2018-01-122-0/+5
|/ | | | | | | 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.
* test/utils: disable Thread's report_on_exception in start_serverKazuki Yamaguchi2017-12-151-0/+12
| | | | | | | | | 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.
* Ruby/OpenSSL 2.0.7v2.0.7ky/release-2.0.7Kazuki Yamaguchi2017-12-143-2/+17
|
* asn1: fix docsKazuki Yamaguchi2017-12-141-2/+2
| | | | | | | 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
* ssl: remove unreachable codeKazuki Yamaguchi2017-12-081-9/+0
| | | | GetSSLCTX() never returns NULL.
* History.md: fix a typoKazuki Yamaguchi2017-11-251-1/+1
|
* Merge pull request #168 from rhenium/ky/pkey-check-sanityKazuki Yamaguchi2017-11-146-28/+38
|\ | | | | [Bug #14087] x509cert, x509crl, x509req, ns_spki: check sanity of public key
| * x509cert, x509crl, x509req, ns_spki: check sanity of public keyky/pkey-check-sanityKazuki Yamaguchi2017-11-134-24/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * pkey: make pkey_check_public_key() non-staticKazuki Yamaguchi2017-11-112-4/+6
|/ | | | Also make it take const pointer as it never modifies the pkey.
* test/test_cipher: fix test_non_aead_cipher_set_auth_data failureky/cipher-non-aead-auth-dataKazuki Yamaguchi2017-10-191-1/+1
| | | | | | 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.
* cipher: disallow setting AAD for non-AEAD ciphersKazuki Yamaguchi2017-10-182-0/+9
| | | | | | | | | 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
* Merge pull request #159 from rhenium/ky/skip-session-remove-cb-testsKazuki Yamaguchi2017-10-102-18/+44
|\ | | | | test/test_ssl_session: skip tests for session_remove_cb
| * test/test_ssl_session: skip tests for session_remove_cbky/skip-session-remove-cb-testsKazuki Yamaguchi2017-10-102-18/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | appveyor.yml: remove 'openssl version' lineKazuki Yamaguchi2017-10-081-1/+0
|/ | | | | | | | | 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
* Ruby/OpenSSL 2.0.6v2.0.6ky/release-2.0.6Kazuki Yamaguchi2017-09-243-2/+22
|
* Merge pull request #155 from rhenium/ky/fix-legacy-locking-callback-relockKazuki Yamaguchi2017-09-241-26/+40
|\ | | | | ossl.c: make legacy locking callbacks reentrant
| * ossl.c: make legacy locking callbacks reentrantky/fix-legacy-locking-callback-relockKazuki Yamaguchi2017-09-241-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * ossl.c: use struct CRYPTO_dynlock_value for non-dynamic locksKazuki Yamaguchi2017-09-241-26/+28
| | | | | | | | | | In preparation for making the mutexes reentrant. It is common to the non-dynamic and the dynamic locking callbacks.
* | Merge pull request #153 from rhenium/ky/ssl-read-fix-leak-uninitializedKazuki Yamaguchi2017-09-242-11/+39
|\ \ | | | | | | ssl: prevent SSLSocket#sysread* from leaking uninitialized data
| * | ssl: prevent SSLSocket#sysread* from leaking uninitialized dataky/ssl-read-fix-leak-uninitializedKazuki Yamaguchi2017-09-232-9/+37
| | | | | | | | | | | | | | | | | | 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.
| * | test/test_pair: replace sleep with IO.selectKazuki Yamaguchi2017-09-231-2/+2
| |/ | | | | | | | | The sleep was to ensure that the SSLSocket#read_nonblock will get close_notify alert. A simple IO.select will suffice.
* | test/test_engine: check if RC4 is supportedKazuki Yamaguchi2017-09-241-1/+7
| | | | | | | | | | | | | | 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
* | test/test_engine: suppress stderrKazuki Yamaguchi2017-09-241-20/+10
|/ | | | | | | 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
* tool/ruby-openssl-docker: updateky/maint-libressl-2.6Kazuki Yamaguchi2017-09-152-21/+22
| | | | | | | - 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.
* test/test_ssl: do not run NPN tests for LibreSSL >= 2.6.1Kazuki Yamaguchi2017-09-091-0/+5
| | | | | | 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.
* test/test_ssl: skip tmp_ecdh_callback test for LibreSSL >= 2.6.1Kazuki Yamaguchi2017-09-091-0/+2
| | | | | LibreSSL 2.6.1 has SSL_CTX_set_tmp_ecdh_callback() function, but it does not work.
* test/test_pair: disable compressionKazuki Yamaguchi2017-09-081-0/+1
| | | | | | | 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.
* test/test_ssl: suppress warning in test_alpn_protocol_selection_cancelKazuki Yamaguchi2017-09-081-0/+1
| | | | Suppress "using default DH parameters" message.
* ruby.h: unnormalized Fixnum valuenobu2017-09-083-3/+10
| | | | | | | | | | * 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
* test/test_pair: fix test_write_nonblock{,_no_exceptions}ky/fix-test-pair-write-nonblockKazuki Yamaguchi2017-09-041-30/+28
| | | | | | | | | 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.
* Merge pull request #140 from terceiro/tls1.1Kazuki Yamaguchi2017-08-261-1/+2
|\ | | | | test/test_ssl: explicitly accept TLS 1.1 in corresponding test
| * test/test_ssl: explicitly accept TLS 1.1 in corresponding testAntonio Terceiro2017-08-261-1/+2
|/ | | | | | 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.
* Merge pull request #139 from rhenium/ky/ssl-sysread-dont-check-ssl-pendingKazuki Yamaguchi2017-08-251-2/+0
|\ | | | | ssl: remove useless call to rb_thread_wait_fd()
| * ssl: remove useless call to rb_thread_wait_fd()ky/ssl-sysread-dont-check-ssl-pendingKazuki Yamaguchi2017-08-251-2/+0
| | | | | | | | | | | | 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.
* | Merge pull request #138 from rhenium/ky/maint-fix-test-with-tls13Kazuki Yamaguchi2017-08-2537-1030/+1064
|\ \ | |/ |/| Fix test failures with TLS 1.3-capable OpenSSL
| * test/test_pair, test/test_ssl: fix for TLS 1.3ky/maint-fix-test-with-tls13Kazuki Yamaguchi2017-08-242-176/+135
| | | | | | | | Fix test cases failing with TLS 1.3-enabled OpenSSL master.
| * test/test_ssl_session: rearrange testsKazuki Yamaguchi2017-08-241-201/+196
| | | | | | | | | | Use TLS 1.2 explicitly where needed, since TLS 1.3 will remove session ID based session resumption.
| * test/test_ssl: move test_multibyte_read_write to test_pairKazuki Yamaguchi2017-08-242-24/+21
| |
| * test/test_ssl: remove test_invalid_shutdown_by_gcKazuki Yamaguchi2017-08-241-14/+0
| | | | | | | | | | | | | | | | | | 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.
| * test/utils: do not use DSA certificates in SSL testsKazuki Yamaguchi2017-08-241-1/+1
| | | | | | | | | | | | 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.
| * test/utils: add OpenSSL::TestUtils.openssl? and .libressl?Kazuki Yamaguchi2017-08-248-59/+49
| | | | | | | | | | | | 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.
| * test/utils: improve error handling in start_serverKazuki Yamaguchi2017-08-241-37/+39
| | | | | | | | | | | | 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.