diff options
-rw-r--r-- | .travis.yml | 13 | ||||
-rw-r--r-- | Rakefile | 3 | ||||
-rw-r--r-- | ext/openssl/ossl_ts.c | 7 | ||||
-rw-r--r-- | test/openssl/envutil.rb (renamed from test/envutil.rb) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/chain/dh512.pem (renamed from test/fixtures/chain/dh512.pem) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/chain/server.crt (renamed from test/fixtures/chain/server.crt) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/chain/server.csr (renamed from test/fixtures/chain/server.csr) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/chain/server.key (renamed from test/fixtures/chain/server.key) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/pkey/dh-1.pem (renamed from test/fixtures/pkey/dh-1.pem) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/pkey/dh1024.pem (renamed from test/fixtures/pkey/dh1024.pem) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/pkey/dsa1024.pem (renamed from test/fixtures/pkey/dsa1024.pem) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/pkey/dsa256.pem (renamed from test/fixtures/pkey/dsa256.pem) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/pkey/dsa512.pem (renamed from test/fixtures/pkey/dsa512.pem) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/pkey/p256.pem (renamed from test/fixtures/pkey/p256.pem) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/pkey/rsa-1.pem (renamed from test/fixtures/pkey/rsa-1.pem) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/pkey/rsa-2.pem (renamed from test/fixtures/pkey/rsa-2.pem) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/pkey/rsa-3.pem (renamed from test/fixtures/pkey/rsa-3.pem) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/pkey/rsa1024.pem (renamed from test/fixtures/pkey/rsa1024.pem) | 0 | ||||
-rw-r--r-- | test/openssl/fixtures/pkey/rsa2048.pem (renamed from test/fixtures/pkey/rsa2048.pem) | 0 | ||||
-rw-r--r-- | test/openssl/test_asn1.rb (renamed from test/test_asn1.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_bn.rb (renamed from test/test_bn.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_buffering.rb (renamed from test/test_buffering.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_cipher.rb (renamed from test/test_cipher.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_config.rb (renamed from test/test_config.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_digest.rb (renamed from test/test_digest.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_engine.rb (renamed from test/test_engine.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_fips.rb (renamed from test/test_fips.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_hmac.rb (renamed from test/test_hmac.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_kdf.rb (renamed from test/test_kdf.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_ns_spki.rb (renamed from test/test_ns_spki.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_ocsp.rb (renamed from test/test_ocsp.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_ossl.rb (renamed from test/test_ossl.rb) | 11 | ||||
-rw-r--r-- | test/openssl/test_pair.rb (renamed from test/test_pair.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_pkcs12.rb (renamed from test/test_pkcs12.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_pkcs7.rb (renamed from test/test_pkcs7.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_pkey_dh.rb (renamed from test/test_pkey_dh.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_pkey_dsa.rb (renamed from test/test_pkey_dsa.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_pkey_ec.rb (renamed from test/test_pkey_ec.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_pkey_rsa.rb (renamed from test/test_pkey_rsa.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_random.rb (renamed from test/test_random.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_ssl.rb (renamed from test/test_ssl.rb) | 4 | ||||
-rw-r--r-- | test/openssl/test_ssl_session.rb (renamed from test/test_ssl_session.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_ts.rb (renamed from test/test_ts.rb) | 10 | ||||
-rw-r--r-- | test/openssl/test_x509attr.rb (renamed from test/test_x509attr.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_x509cert.rb (renamed from test/test_x509cert.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_x509crl.rb (renamed from test/test_x509crl.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_x509ext.rb (renamed from test/test_x509ext.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_x509name.rb (renamed from test/test_x509name.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_x509req.rb (renamed from test/test_x509req.rb) | 0 | ||||
-rw-r--r-- | test/openssl/test_x509store.rb (renamed from test/test_x509store.rb) | 0 | ||||
-rw-r--r-- | test/openssl/ut_eof.rb (renamed from test/ut_eof.rb) | 0 | ||||
-rw-r--r-- | test/openssl/utils.rb (renamed from test/utils.rb) | 0 |
52 files changed, 14 insertions, 34 deletions
diff --git a/.travis.yml b/.travis.yml index a4fae0f2..4447352f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,23 +12,10 @@ script: matrix: fast_finish: true include: - - env: RUBY_VERSION=ruby-2.3 OPENSSL_VERSION=openssl-1.0.2 - env: RUBY_VERSION=ruby-2.4 OPENSSL_VERSION=openssl-1.0.2 - env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=openssl-1.0.1 - env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=openssl-1.0.2 - env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=openssl-1.1.0 - - env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=openssl-1.1.1 - env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=libressl-2.5 - env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=libressl-2.6 - env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=libressl-2.7 - - language: ruby - rvm: ruby-head - before_install: - - "rake install_dependencies" - script: - - "rake compile -- --enable-debug" - - "rake test" - allow_failures: - - language: ruby - rvm: ruby-head - - env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=openssl-1.1.1 @@ -11,7 +11,8 @@ rescue LoadError end Rake::TestTask.new do |t| - t.libs << 'test' + t.libs << 'test/openssl' + t.test_files = FileList["test/**/test_*.rb"] t.warning = true end diff --git a/ext/openssl/ossl_ts.c b/ext/openssl/ossl_ts.c index 24f5289c..ba0df750 100644 --- a/ext/openssl/ossl_ts.c +++ b/ext/openssl/ossl_ts.c @@ -217,7 +217,7 @@ ossl_ts_req_initialize(int argc, VALUE *argv, VALUE self) * algorithm that was used to create the message imprint digest. * * call-seq: - * request.get_algorithm -> string or nil + * request.algorithm -> string */ static VALUE ossl_ts_req_get_algorithm(VALUE self) @@ -225,15 +225,10 @@ ossl_ts_req_get_algorithm(VALUE self) TS_REQ *req; TS_MSG_IMPRINT *mi; X509_ALGOR *algor; - int algi; GetTSRequest(self, req); mi = TS_REQ_get_msg_imprint(req); algor = TS_MSG_IMPRINT_get_algo(mi); - algi = OBJ_obj2nid(algor->algorithm); - if (algi == NID_undef || algi == NID_ccitt) - return Qnil; - return get_asn1obj(algor->algorithm); } diff --git a/test/envutil.rb b/test/openssl/envutil.rb index 05d6fe27..05d6fe27 100644 --- a/test/envutil.rb +++ b/test/openssl/envutil.rb diff --git a/test/fixtures/chain/dh512.pem b/test/openssl/fixtures/chain/dh512.pem index fec138c7..fec138c7 100644 --- a/test/fixtures/chain/dh512.pem +++ b/test/openssl/fixtures/chain/dh512.pem diff --git a/test/fixtures/chain/server.crt b/test/openssl/fixtures/chain/server.crt index d6b814f4..d6b814f4 100644 --- a/test/fixtures/chain/server.crt +++ b/test/openssl/fixtures/chain/server.crt diff --git a/test/fixtures/chain/server.csr b/test/openssl/fixtures/chain/server.csr index 51b38e33..51b38e33 100644 --- a/test/fixtures/chain/server.csr +++ b/test/openssl/fixtures/chain/server.csr diff --git a/test/fixtures/chain/server.key b/test/openssl/fixtures/chain/server.key index 9590235d..9590235d 100644 --- a/test/fixtures/chain/server.key +++ b/test/openssl/fixtures/chain/server.key diff --git a/test/fixtures/pkey/dh-1.pem b/test/openssl/fixtures/pkey/dh-1.pem index 3340a6a1..3340a6a1 100644 --- a/test/fixtures/pkey/dh-1.pem +++ b/test/openssl/fixtures/pkey/dh-1.pem diff --git a/test/fixtures/pkey/dh1024.pem b/test/openssl/fixtures/pkey/dh1024.pem index f99c757f..f99c757f 100644 --- a/test/fixtures/pkey/dh1024.pem +++ b/test/openssl/fixtures/pkey/dh1024.pem diff --git a/test/fixtures/pkey/dsa1024.pem b/test/openssl/fixtures/pkey/dsa1024.pem index 1bf49889..1bf49889 100644 --- a/test/fixtures/pkey/dsa1024.pem +++ b/test/openssl/fixtures/pkey/dsa1024.pem diff --git a/test/fixtures/pkey/dsa256.pem b/test/openssl/fixtures/pkey/dsa256.pem index d9a407f7..d9a407f7 100644 --- a/test/fixtures/pkey/dsa256.pem +++ b/test/openssl/fixtures/pkey/dsa256.pem diff --git a/test/fixtures/pkey/dsa512.pem b/test/openssl/fixtures/pkey/dsa512.pem index 962c41cc..962c41cc 100644 --- a/test/fixtures/pkey/dsa512.pem +++ b/test/openssl/fixtures/pkey/dsa512.pem diff --git a/test/fixtures/pkey/p256.pem b/test/openssl/fixtures/pkey/p256.pem index 97c97d9f..97c97d9f 100644 --- a/test/fixtures/pkey/p256.pem +++ b/test/openssl/fixtures/pkey/p256.pem diff --git a/test/fixtures/pkey/rsa-1.pem b/test/openssl/fixtures/pkey/rsa-1.pem index bd5a624f..bd5a624f 100644 --- a/test/fixtures/pkey/rsa-1.pem +++ b/test/openssl/fixtures/pkey/rsa-1.pem diff --git a/test/fixtures/pkey/rsa-2.pem b/test/openssl/fixtures/pkey/rsa-2.pem index e4fd4f43..e4fd4f43 100644 --- a/test/fixtures/pkey/rsa-2.pem +++ b/test/openssl/fixtures/pkey/rsa-2.pem diff --git a/test/fixtures/pkey/rsa-3.pem b/test/openssl/fixtures/pkey/rsa-3.pem index 6c9c9ced..6c9c9ced 100644 --- a/test/fixtures/pkey/rsa-3.pem +++ b/test/openssl/fixtures/pkey/rsa-3.pem diff --git a/test/fixtures/pkey/rsa1024.pem b/test/openssl/fixtures/pkey/rsa1024.pem index 464de074..464de074 100644 --- a/test/fixtures/pkey/rsa1024.pem +++ b/test/openssl/fixtures/pkey/rsa1024.pem diff --git a/test/fixtures/pkey/rsa2048.pem b/test/openssl/fixtures/pkey/rsa2048.pem index ac89cd88..ac89cd88 100644 --- a/test/fixtures/pkey/rsa2048.pem +++ b/test/openssl/fixtures/pkey/rsa2048.pem diff --git a/test/test_asn1.rb b/test/openssl/test_asn1.rb index 5f457551..5f457551 100644 --- a/test/test_asn1.rb +++ b/test/openssl/test_asn1.rb diff --git a/test/test_bn.rb b/test/openssl/test_bn.rb index 547d334c..547d334c 100644 --- a/test/test_bn.rb +++ b/test/openssl/test_bn.rb diff --git a/test/test_buffering.rb b/test/openssl/test_buffering.rb index 7575c5b4..7575c5b4 100644 --- a/test/test_buffering.rb +++ b/test/openssl/test_buffering.rb diff --git a/test/test_cipher.rb b/test/openssl/test_cipher.rb index f6ec4980..f6ec4980 100644 --- a/test/test_cipher.rb +++ b/test/openssl/test_cipher.rb diff --git a/test/test_config.rb b/test/openssl/test_config.rb index dba66b08..dba66b08 100644 --- a/test/test_config.rb +++ b/test/openssl/test_config.rb diff --git a/test/test_digest.rb b/test/openssl/test_digest.rb index e47fc0a3..e47fc0a3 100644 --- a/test/test_digest.rb +++ b/test/openssl/test_digest.rb diff --git a/test/test_engine.rb b/test/openssl/test_engine.rb index 232ba866..232ba866 100644 --- a/test/test_engine.rb +++ b/test/openssl/test_engine.rb diff --git a/test/test_fips.rb b/test/openssl/test_fips.rb index 8cd474f9..8cd474f9 100644 --- a/test/test_fips.rb +++ b/test/openssl/test_fips.rb diff --git a/test/test_hmac.rb b/test/openssl/test_hmac.rb index 9cb3c5a8..9cb3c5a8 100644 --- a/test/test_hmac.rb +++ b/test/openssl/test_hmac.rb diff --git a/test/test_kdf.rb b/test/openssl/test_kdf.rb index f4790c96..f4790c96 100644 --- a/test/test_kdf.rb +++ b/test/openssl/test_kdf.rb diff --git a/test/test_ns_spki.rb b/test/openssl/test_ns_spki.rb index 052507de..052507de 100644 --- a/test/test_ns_spki.rb +++ b/test/openssl/test_ns_spki.rb diff --git a/test/test_ocsp.rb b/test/openssl/test_ocsp.rb index a490a153..a490a153 100644 --- a/test/test_ocsp.rb +++ b/test/openssl/test_ocsp.rb diff --git a/test/test_ossl.rb b/test/openssl/test_ossl.rb index f517b1d8..f83e8136 100644 --- a/test/test_ossl.rb +++ b/test/openssl/test_ossl.rb @@ -52,10 +52,13 @@ class OpenSSL::OSSL < OpenSSL::SSLTestCase c = "y#{a}" a = "#{a}x" - n = 10_000 - a_b_time = Benchmark.measure { n.times { OpenSSL.fixed_length_secure_compare(a, b) } }.real - a_c_time = Benchmark.measure { n.times { OpenSSL.fixed_length_secure_compare(a, c) } }.real - assert_in_delta(a_b_time, a_c_time, 1, "fixed_length_secure_compare timing test failed") + a_b_time = a_c_time = 0 + 100.times do + a_b_time += Benchmark.measure { 100.times { OpenSSL.fixed_length_secure_compare(a, b) } }.real + a_c_time += Benchmark.measure { 100.times { OpenSSL.fixed_length_secure_compare(a, c) } }.real + end + assert_operator(a_b_time, :<, a_c_time * 10, "fixed_length_secure_compare timing test failed") + assert_operator(a_c_time, :<, a_b_time * 10, "fixed_length_secure_compare timing test failed") end end diff --git a/test/test_pair.rb b/test/openssl/test_pair.rb index e9cf98df..e9cf98df 100644 --- a/test/test_pair.rb +++ b/test/openssl/test_pair.rb diff --git a/test/test_pkcs12.rb b/test/openssl/test_pkcs12.rb index fdbe753b..fdbe753b 100644 --- a/test/test_pkcs12.rb +++ b/test/openssl/test_pkcs12.rb diff --git a/test/test_pkcs7.rb b/test/openssl/test_pkcs7.rb index d0d9dcaf..d0d9dcaf 100644 --- a/test/test_pkcs7.rb +++ b/test/openssl/test_pkcs7.rb diff --git a/test/test_pkey_dh.rb b/test/openssl/test_pkey_dh.rb index 6397e76d..6397e76d 100644 --- a/test/test_pkey_dh.rb +++ b/test/openssl/test_pkey_dh.rb diff --git a/test/test_pkey_dsa.rb b/test/openssl/test_pkey_dsa.rb index 2c839b7d..2c839b7d 100644 --- a/test/test_pkey_dsa.rb +++ b/test/openssl/test_pkey_dsa.rb diff --git a/test/test_pkey_ec.rb b/test/openssl/test_pkey_ec.rb index 6b83ed76..6b83ed76 100644 --- a/test/test_pkey_ec.rb +++ b/test/openssl/test_pkey_ec.rb diff --git a/test/test_pkey_rsa.rb b/test/openssl/test_pkey_rsa.rb index a9587aa1..a9587aa1 100644 --- a/test/test_pkey_rsa.rb +++ b/test/openssl/test_pkey_rsa.rb diff --git a/test/test_random.rb b/test/openssl/test_random.rb index 33af3757..33af3757 100644 --- a/test/test_random.rb +++ b/test/openssl/test_random.rb diff --git a/test/test_ssl.rb b/test/openssl/test_ssl.rb index eb5b77be..eae369a1 100644 --- a/test/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -1419,6 +1419,10 @@ end end def test_fallback_scsv + supported = check_supported_protocol_versions + return unless supported.include?(OpenSSL::SSL::TLS1_1_VERSION) && + supported.include?(OpenSSL::SSL::TLS1_2_VERSION) + pend "Fallback SCSV is not supported" unless \ OpenSSL::SSL::SSLContext.method_defined?(:enable_fallback_scsv) diff --git a/test/test_ssl_session.rb b/test/openssl/test_ssl_session.rb index 89726d44..89726d44 100644 --- a/test/test_ssl_session.rb +++ b/test/openssl/test_ssl_session.rb diff --git a/test/test_ts.rb b/test/openssl/test_ts.rb index c57f08cf..1fa4a7cf 100644 --- a/test/test_ts.rb +++ b/test/openssl/test_ts.rb @@ -67,16 +67,6 @@ _end_of_pem_ @ts_cert_ee ||= OpenSSL::Certs.ts_cert_ee(ee_key, intermediate_cert, intermediate_key) end - def test_create_request - req = OpenSSL::Timestamp::Request.new - assert_equal(true, req.cert_requested?) - assert_equal(1, req.version) - assert_nil(req.algorithm) - assert_equal("", req.message_imprint) - assert_nil(req.policy_id) - assert_nil(req.nonce) - end - def test_request_mandatory_fields req = OpenSSL::Timestamp::Request.new assert_raise(OpenSSL::Timestamp::TimestampError) do diff --git a/test/test_x509attr.rb b/test/openssl/test_x509attr.rb index 2919d23d..2919d23d 100644 --- a/test/test_x509attr.rb +++ b/test/openssl/test_x509attr.rb diff --git a/test/test_x509cert.rb b/test/openssl/test_x509cert.rb index ed0758a6..ed0758a6 100644 --- a/test/test_x509cert.rb +++ b/test/openssl/test_x509cert.rb diff --git a/test/test_x509crl.rb b/test/openssl/test_x509crl.rb index a6d0adc5..a6d0adc5 100644 --- a/test/test_x509crl.rb +++ b/test/openssl/test_x509crl.rb diff --git a/test/test_x509ext.rb b/test/openssl/test_x509ext.rb index 7ad010d1..7ad010d1 100644 --- a/test/test_x509ext.rb +++ b/test/openssl/test_x509ext.rb diff --git a/test/test_x509name.rb b/test/openssl/test_x509name.rb index 4ec5db20..4ec5db20 100644 --- a/test/test_x509name.rb +++ b/test/openssl/test_x509name.rb diff --git a/test/test_x509req.rb b/test/openssl/test_x509req.rb index bace06b3..bace06b3 100644 --- a/test/test_x509req.rb +++ b/test/openssl/test_x509req.rb diff --git a/test/test_x509store.rb b/test/openssl/test_x509store.rb index 8223c9b7..8223c9b7 100644 --- a/test/test_x509store.rb +++ b/test/openssl/test_x509store.rb diff --git a/test/ut_eof.rb b/test/openssl/ut_eof.rb index cf1f2d42..cf1f2d42 100644 --- a/test/ut_eof.rb +++ b/test/openssl/ut_eof.rb diff --git a/test/utils.rb b/test/openssl/utils.rb index acece979..acece979 100644 --- a/test/utils.rb +++ b/test/openssl/utils.rb |