aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_pair.rb
Commit message (Collapse)AuthorAgeFilesLines
* test: fix formattingKazuki Yamaguchi2017-08-241-3/+1
| | | | | | Fix wrong nesting in test/utils.rb. Remove unnecessary requires. Wrap the code with 'if defined?(OpenSSL::TestUtils) ~ end' and avoid class definition with modifier if.
* Backport "Merge branch 'topic/test-memory-leak'" to maintKazuki Yamaguchi2017-08-241-3/+3
| | | | | | | | | | | | | | * topic/test-memory-leak: Enable OSSL_MDEBUG on CI builds Add OpenSSL.print_mem_leaks test: prepare test PKey instances on demand test: let OpenSSL::TestCase include OpenSSL::TestUtils Don't define main() when built with --enable-debug (cherry picked from commit 5c586acc387834ab4e09260937dc21064fc59de4) Note that fix for new test cases that use the old constants removed by this is squashed in.
* test/test_pair: make TestPairM#test_write_nonblock_retry fasterKazuki Yamaguchi2016-12-051-1/+1
| | | | | | | Write 4099-bytes blocks instead of 11-bytes blocks to run it faster. The buffer may be as large as megabytes and it takes too much time to fill up, especially under GC.stress. I didn't measured but it didn't finish in an hour.
* openssl/ut_eof.rb: rename TestEOFnobu2016-11-301-4/+4
| | | | | | | * test/openssl/ut_eof.rb (OpenSSL::TestEOF): move TestEOF module under OpenSSL to get rid of conflict with test/ruby/ut_eof.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/test_pair: revert workaround added by r42790Kazuki Yamaguchi2016-10-241-12/+6
| | | | | | | It was added as a workaround for "bad write retry" error that occurs when SSLSocket#write_nonblock is retried with a different String. This is now fixed by r54466 ("openssl: accept moving write buffer for write_nonblock", 2016-03-31).
* test/test_pair: extract IO-like methods tests from test_ssl.rbKazuki Yamaguchi2016-09-071-1/+15
| | | | | Move a test case of SSLSocket#gets to test_pair.rb, and remove test cases from test_ssl.rb which duplicate the tests in test_pair.rb
* test/test_ssl: move DH and ECDH tests from test_pair.rbKazuki Yamaguchi2016-09-071-141/+0
| | | | | | test_pair.rb is the file for tests of IO-like methods - the test cases in OpenSSL::TestPairM run twice with different underlying socket type. test_ssl.rb is more appropriate file for {EC,}DH tests.
* test: move test_partial_record_read into test_pair.rbKazuki Yamaguchi2016-08-281-0/+10
| | | | It can make use of ssl_pair. This allows removing 6 secs sleep.
* openssl: avoid undefined behavior on empty SSL_writenormal2016-08-071-0/+11
| | | | | | | | | | | | | | | | | | | SSL_write(3ssl) manpage has this in the WARNINGS section: When calling SSL_write() with num=0 bytes to be sent the behaviour is undefined. And indeed, the new test case demonstrates failures when empty strings are used. So, match the behavior of IO#write, IO#write_nonblock, and IO#syswrite by returning zero, as the OpenSSL::SSL::SSLSocket API already closely mimics the IO one. * ext/openssl/ossl_ssl.c (ossl_ssl_write_internal): avoid undefined behavior * test/openssl/test_pair.rb (test_write_zero): new test [ruby-core:76751] [Bug #12660] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test: use assert_includenobu2016-07-281-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Suppress warnings in testsKazuki Yamaguchi2016-07-101-9/+9
|
* Merge changes from Ruby trunk r55335..r55457Kazuki Yamaguchi2016-06-191-1/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also adjust tests. * ruby-trunk r55335..r55457: (15 commits) (r55457) openssl: add OpenSSL::OCSP::SingleResponse (r55456) openssl: allow passing absolute times in OCSP::BasicRespons.. (r55455) openssl: implement initialize_copy for OpenSSL::OCSP::* (r55454) openssl: implement initialize_copy method for PKey classes (r55450) openssl: add 'const's required in OpenSSL master (r55444) openssl: avoid test crash on Ubuntu 16.04 (r55423) openssl: refactor OpenSSL::OCSP::*#verify (r55422) openssl: allow specifying hash algorithm in OCSP::*#sign (r55411) openssl: add some accessor methods for OCSP::CertificateId (r55409) openssl: add missing #to_der to OCSP::{CertificateId,BasicR.. (r55408) openssl: fix acesssor functions for RSA and DH in openssl_m.. (r55388) openssl: support non AES-GCM AEAD ciphers in OpenSSL::Cipher (r55387) openssl: avoid test failure in test_engine.rb (r55344) openssl: use ASN1_ENUMERATED_to_BN() if needed (r55342) openssl: fix build with OPENSSL_NO_EC Sync-with-trunk: r55457
| * openssl: fix build with OPENSSL_NO_ECrhe2016-06-191-1/+6
|/ | | | | | | | | | | | | | * ext/openssl/ossl_ssl.c: Add define guards for OPENSSL_NO_EC. SSL_CTX_set_ecdh_auto() is defined even when ECDH is disabled in OpenSSL's configuration. This fixes r55214. * test/openssl/test_pair.rb (test_ecdh_curves): Skip if the OpenSSL does not support ECDH. * test/openssl/utils.rb (start_server): Ignore error in SSLContext#ecdh_curves=. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Merge changes from Ruby trunk r55224..r55335Kazuki Yamaguchi2016-06-091-1/+16
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And adjust tests for test-unit. * ruby-trunk r55224..r55335: (16 commits) (r55335) openssl: fix build with OpenSSL 1.1.0 and no pkg-config (r55314) openssl: adjust tests for OpenSSL 1.1.0 (r55309) openssl: add SSL::SSLContext#security_level{=,} (r55304) openssl: avoid deprecated version-specific ssl methods if n.. (r55294) openssl: fix free function of OpenSSL::Cipher (r55291) openssl: fix compile on VC (r55289) openssl: use SSL_is_server() (r55288) openssl: avoid d2i_ASN1_BOOLEAN() (r55287) openssl: adapt to OpenSSL 1.1.0 opaque structs (r55285) openssl: adapt OpenSSL::PKey to OpenSSL 1.1.0 opaque structs (r55283) openssl: support OpenSSL 1.1.0's new multi-threading API (r55282) openssl: check existence of RAND_pseudo_bytes() (r55273) openssl: avoid deprecated BN_*prime* functions (r55252) ossl_asn1.c: check overflow (r55249) openssl: fix the Year 2038 problem (r55229) openssl: add missing test for r55219 Sync-with-trunk: r55335
| * openssl: adjust tests for OpenSSL 1.1.0rhe2016-06-091-0/+15
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes `make test-all TESTS=openssl` with OpenSSL master. * test/openssl/test_x509name.rb: Don't register OID for 'emailAddress' and 'serialNumber'. A recent change in OpenSSL made OBJ_create() reject an already existing OID. They were needed to run tests with OpenSSL 0.9.6 which is now unsupported. https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=52832e470f5fe8c222249ae5b539aeb3c74cdb25 [ruby-core:75225] [Feature #12324] * test/openssl/test_ssl_session.rb (test_server_session): Duplicate SSL::Session before re-adding to the session store. OpenSSL 1.1.0 starts rejecting SSL_SESSION once removed by SSL_CTX_remove_session(). https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=7c2d4fee2547650102cd16d23f8125b76112ae75 * test/openssl/test_pkey_ec.rb (setup): Remove X25519 from @keys. X25519 is new in OpenSSL 1.1.0 but this is for key agreement and not for signing. * test/openssl/test_pair.rb, test/openssl/test_ssl.rb, test/openssl/utils.rb: Set security level to 0 when using aNULL cipher suites. * test/openssl/utils.rb: Use 1024 bits DSA key for client certificates. * test/openssl/test_engine.rb: Run each test in separate process. We can no longer cleanup engines explicitly as ENGINE_cleanup() was removed. https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=6d4fb1d59e61aacefa25edc4fe5acfe1ac93f743 * ext/openssl/ossl_engine.c (ossl_engine_s_cleanup): Add a note to the RDoc for Engine.cleanup. * ext/openssl/lib/openssl/digest.rb: Don't define constants for DSS, DSS1 and SHA(-0) when using with OpenSSL 1.1.0. They are removed. * test/openssl/test_digest.rb, test/openssl/test_pkey_dsa.rb, test/openssl/test_pkey_dsa.rb, test/openssl/test_ssl.rb, test/openssl/test_x509cert.rb, test/openssl/test_x509req.rb: Don't test unsupported hash functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* openssl: fix test failure on Fedora 23rhe2016-05-311-1/+1
| | | | | | | | * test/openssl/test_pair.rb (test_ecdh_curves): Avoid P-224. The FIPS patch from RHEL disables it. The curve has to be chosen from: { secp256k1, secp384r1, secp521r1, prime256v1 }. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* openssl: add SSLContext#ecdh_curves=rhe2016-05-311-28/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ext/openssl/ossl_ssl.c (ossl_sslctx_s_alloc): Enable the automatic curve selection for ECDH by calling SSL_CTX_set_ecdh_auto(). With this a TLS server automatically selects a curve which both the client and the server support to use in ECDH. This changes the default behavior but users can still disable ECDH by excluding 'ECDH' cipher suites from the cipher list (with SSLContext#ciphers=). This commit also deprecate #tmp_ecdh_callback=. It was added in Ruby 2.3.0. It wraps SSL_CTX_set_tmp_ecdh_callback() which will be removed in OpenSSL 1.1.0. Its callback receives two values 'is_export' and 'keylength' but both are completely useless for determining a curve to use in ECDH. The automatic curve selection was introduced to replace this. (ossl_sslctx_setup): Deprecate SSLContext#tmp_ecdh_callback=. Emit a warning if this is in use. (ossl_sslctx_set_ecdh_curves): Add SSLContext#ecdh_curves=. Wrap SSL_CTX_set1_curves_list(). If it is not available, this falls back to SSL_CTX_set_tmp_ecdh(). (Init_ossl_ssl): Define SSLContext#ecdh_curves=. * ext/openssl/extconf.rb: Check the existence of EC_curve_nist2nid(), SSL_CTX_set1_curves_list(), SSL_CTX_set_ecdh_auto() and SSL_CTX_set_tmp_ecdh_callback(). * ext/openssl/openssl_missing.[ch]: Implement EC_curve_nist2nid() if missing. * test/openssl/test_pair.rb (test_ecdh_callback): Use EnvUtil.suppress_warning to suppress deprecated warning. (test_ecdh_curves): Test that SSLContext#ecdh_curves= works. * test/openssl/utils.rb (start_server): Use SSLContext#ecdh_curves=. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* openssl: clear OpenSSL error queue before return to Rubyrhe2016-05-311-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * ext/openssl/ossl_x509cert.c (ossl_x509_verify): X509_verify() family may put errors on 0 return (0 means verification failure). Clear OpenSSL error queue before return to Ruby. Since the queue is thread global, remaining errors in the queue can cause an unexpected error in the next OpenSSL operation. [ruby-core:48284] [Bug #7215] * ext/openssl/ossl_x509crl.c (ossl_x509crl_verify): ditto. * ext/openssl/ossl_x509req.c (ossl_x509req_verify): ditto. * ext/openssl/ossl_x509store.c (ossl_x509stctx_verify): ditto. * ext/openssl/ossl_pkey_dh.c (dh_generate): clear the OpenSSL error queue before re-raising exception. * ext/openssl/ossl_pkey_dsa.c (dsa_generate): ditto. * ext/openssl/ossl_pkey_rsa.c (rsa_generate): ditto. * ext/openssl/ossl_ssl.c (ossl_start_ssl): ditto. * test/openssl: check that OpenSSL.errors is empty every time after running a test case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* openssl: accept moving write buffer for write_nonblocknormal2016-05-311-0/+29
| | | | | | | | | | | | | | | | | | | By setting the SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER flag. This flag was introduced at the same time as SSL_MODE_ENABLE_PARTIAL_WRITE in OpenSSL 0.9.4 and makes usage with non-blocking sockets much easier. Before this, a Rubyist would need to remember the exact object which failed to write and reuse it later when the socket became writable again. This causes problems when the buffer is given by another layer of the application (e.g. a buffer is given by a Rack middleware or application to a Rack web server). * ext/openssl/ossl_ssl.c (ossl_sslctx_s_alloc): enable SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER by default [Bug #12126] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* We can remove this condition since we don't support/test Ruby < 2.3Zachary Scott2016-02-021-1/+1
|
* Merge ruby/ruby@6cf568f4b56dcafc5c0fe84df2c0d2491fb0c62bZachary Scott2016-02-021-1/+1
| | | | This means we won't support Ruby < 2.3.0
* Sync trunkZachary Scott2016-02-021-0/+1
|
* Merge trunk upstreamZachary Scott2015-11-131-0/+6
|
* Sync with ruby trunkZachary Scott2015-09-231-36/+94
|
* Skip this test if openssl was compiled without tmp_ecdh_callbackZachary Scott2015-07-221-32/+34
|
* * ext/openssl/ossl_ssl.c: add ECDH callback support. [Feature #11356]tenderlove2015-07-221-0/+39
| | | | | | * test/openssl/test_pair.rb: test for ECDH callback support git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Don't run this test on Ruby 2.2Zachary Scott2015-06-031-1/+1
|
* Upstream ruby/ruby@c18df6d87cb1a26f596218beb8099c709e30aaf4Zachary Scott2015-06-031-2/+22
|
* Upstream test from ruby/ruby@aaf2d07Zachary Scott2015-06-031-0/+27
|
* Update location of ut_eof from trunkZachary Scott2015-01-231-1/+1
|
* Sync tests with trunkZachary Scott2015-01-061-1/+1
|
* ut_eof is already in test directoryZachary Scott2015-01-061-1/+1
|
* Sync tests with trunkZachary Scott2015-01-061-2/+2
|
* rake test works now.SHIBATA Hiroshi2014-10-271-1/+1
|
* import ruby trunkSHIBATA Hiroshi2014-10-271-0/+372