[前][次][番号順一覧][スレッド一覧]

ruby-changes:42977

From: rhe <ko1@a...>
Date: Wed, 18 May 2016 13:07:54 +0900 (JST)
Subject: [ruby-changes:42977] rhe:r55051 (trunk): openssl: clear OpenSSL error queue before return to Ruby

rhe	2016-05-18 13:07:47 +0900 (Wed, 18 May 2016)

  New Revision: 55051

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55051

  Log:
    openssl: clear OpenSSL error queue before return to Ruby
    
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/ext/openssl/ossl_pkey_dh.c
    trunk/ext/openssl/ossl_pkey_dsa.c
    trunk/ext/openssl/ossl_pkey_rsa.c
    trunk/ext/openssl/ossl_ssl.c
    trunk/ext/openssl/ossl_x509cert.c
    trunk/ext/openssl/ossl_x509crl.c
    trunk/ext/openssl/ossl_x509req.c
    trunk/ext/openssl/ossl_x509store.c
    trunk/test/openssl/test_asn1.rb
    trunk/test/openssl/test_bn.rb
    trunk/test/openssl/test_buffering.rb
    trunk/test/openssl/test_cipher.rb
    trunk/test/openssl/test_config.rb
    trunk/test/openssl/test_digest.rb
    trunk/test/openssl/test_engine.rb
    trunk/test/openssl/test_fips.rb
    trunk/test/openssl/test_hmac.rb
    trunk/test/openssl/test_ns_spki.rb
    trunk/test/openssl/test_ocsp.rb
    trunk/test/openssl/test_pair.rb
    trunk/test/openssl/test_pkcs12.rb
    trunk/test/openssl/test_pkcs5.rb
    trunk/test/openssl/test_pkcs7.rb
    trunk/test/openssl/test_pkey_dh.rb
    trunk/test/openssl/test_pkey_dsa.rb
    trunk/test/openssl/test_pkey_ec.rb
    trunk/test/openssl/test_pkey_rsa.rb
    trunk/test/openssl/test_random.rb
    trunk/test/openssl/test_x509cert.rb
    trunk/test/openssl/test_x509crl.rb
    trunk/test/openssl/test_x509ext.rb
    trunk/test/openssl/test_x509name.rb
    trunk/test/openssl/test_x509req.rb
    trunk/test/openssl/test_x509store.rb
    trunk/test/openssl/utils.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55050)
+++ ChangeLog	(revision 55051)
@@ -1,3 +1,29 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed May 18 13:03:07 2016  Kazuki Yamaguchi  <k@r...>
+
+	* 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.
+
 Wed May 18 12:07:42 2016  Kazuki Yamaguchi  <k@r...>
 
 	* ext/openssl/ossl.c (ossl_clear_error): Extracted from
Index: test/openssl/test_pkcs5.rb
===================================================================
--- test/openssl/test_pkcs5.rb	(revision 55050)
+++ test/openssl/test_pkcs5.rb	(revision 55051)
@@ -1,7 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkcs5.rb#L1
 # frozen_string_literal: false
 require_relative 'utils'
 
-class OpenSSL::TestPKCS5 < Test::Unit::TestCase
+class OpenSSL::TestPKCS5 < OpenSSL::TestCase
 
   def test_pbkdf2_hmac_sha1_rfc6070_c_1_len_20
     p ="password"
Index: test/openssl/test_x509ext.rb
===================================================================
--- test/openssl/test_x509ext.rb	(revision 55050)
+++ test/openssl/test_x509ext.rb	(revision 55051)
@@ -3,7 +3,7 @@ require_relative 'utils' https://github.com/ruby/ruby/blob/trunk/test/openssl/test_x509ext.rb#L3
 
 if defined?(OpenSSL::TestUtils)
 
-class OpenSSL::TestX509Extension < Test::Unit::TestCase
+class OpenSSL::TestX509Extension < OpenSSL::TestCase
   def setup
     @basic_constraints_value = OpenSSL::ASN1::Sequence([
       OpenSSL::ASN1::Boolean(true),   # CA
@@ -16,9 +16,6 @@ class OpenSSL::TestX509Extension < Test: https://github.com/ruby/ruby/blob/trunk/test/openssl/test_x509ext.rb#L16
     ])
   end
 
-  def teardown
-  end
-
   def test_new
     ext = OpenSSL::X509::Extension.new(@basic_constraints.to_der)
     assert_equal("basicConstraints", ext.oid)
Index: test/openssl/test_pkcs7.rb
===================================================================
--- test/openssl/test_pkcs7.rb	(revision 55050)
+++ test/openssl/test_pkcs7.rb	(revision 55051)
@@ -3,7 +3,7 @@ require_relative 'utils' https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkcs7.rb#L3
 
 if defined?(OpenSSL::TestUtils)
 
-class OpenSSL::TestPKCS7 < Test::Unit::TestCase
+class OpenSSL::TestPKCS7 < OpenSSL::TestCase
   def setup
     @rsa1024 = OpenSSL::TestUtils::TEST_KEY_RSA1024
     @rsa2048 = OpenSSL::TestUtils::TEST_KEY_RSA2048
Index: test/openssl/test_pair.rb
===================================================================
--- test/openssl/test_pair.rb	(revision 55050)
+++ test/openssl/test_pair.rb	(revision 55051)
@@ -517,36 +517,36 @@ module OpenSSL::TestPairM https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pair.rb#L517
   end
 end
 
-class OpenSSL::TestEOF1 < Test::Unit::TestCase
+class OpenSSL::TestEOF1 < OpenSSL::TestCase
   include TestEOF
   include OpenSSL::SSLPair
   include OpenSSL::TestEOF1M
 end
 
-class OpenSSL::TestEOF1LowlevelSocket < Test::Unit::TestCase
+class OpenSSL::TestEOF1LowlevelSocket < OpenSSL::TestCase
   include TestEOF
   include OpenSSL::SSLPairLowlevelSocket
   include OpenSSL::TestEOF1M
 end
 
-class OpenSSL::TestEOF2 < Test::Unit::TestCase
+class OpenSSL::TestEOF2 < OpenSSL::TestCase
   include TestEOF
   include OpenSSL::SSLPair
   include OpenSSL::TestEOF2M
 end
 
-class OpenSSL::TestEOF2LowlevelSocket < Test::Unit::TestCase
+class OpenSSL::TestEOF2LowlevelSocket < OpenSSL::TestCase
   include TestEOF
   include OpenSSL::SSLPairLowlevelSocket
   include OpenSSL::TestEOF2M
 end
 
-class OpenSSL::TestPair < Test::Unit::TestCase
+class OpenSSL::TestPair < OpenSSL::TestCase
   include OpenSSL::SSLPair
   include OpenSSL::TestPairM
 end
 
-class OpenSSL::TestPairLowlevelSocket < Test::Unit::TestCase
+class OpenSSL::TestPairLowlevelSocket < OpenSSL::TestCase
   include OpenSSL::SSLPairLowlevelSocket
   include OpenSSL::TestPairM
 end
Index: test/openssl/test_bn.rb
===================================================================
--- test/openssl/test_bn.rb	(revision 55050)
+++ test/openssl/test_bn.rb	(revision 55051)
@@ -3,7 +3,7 @@ require_relative 'utils' https://github.com/ruby/ruby/blob/trunk/test/openssl/test_bn.rb#L3
 
 if defined?(OpenSSL::TestUtils)
 
-class OpenSSL::TestBN < Test::Unit::TestCase
+class OpenSSL::TestBN < OpenSSL::TestCase
   def test_new_str
     e1 = OpenSSL::BN.new(999.to_s(16), 16) # OpenSSL::BN.new(str, 16) must be most stable
     e2 = OpenSSL::BN.new((2**107-1).to_s(16), 16)
Index: test/openssl/test_pkey_dsa.rb
===================================================================
--- test/openssl/test_pkey_dsa.rb	(revision 55050)
+++ test/openssl/test_pkey_dsa.rb	(revision 55051)
@@ -4,7 +4,7 @@ require 'base64' https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_dsa.rb#L4
 
 if defined?(OpenSSL::TestUtils)
 
-class OpenSSL::TestPKeyDSA < Test::Unit::TestCase
+class OpenSSL::TestPKeyDSA < OpenSSL::TestCase
   def test_private
     key = OpenSSL::PKey::DSA.new(256)
     assert(key.private?)
@@ -20,7 +20,6 @@ class OpenSSL::TestPKeyDSA < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_dsa.rb#L20
     key = OpenSSL::PKey::DSA.new 256
     pem  = key.public_key.to_pem
     OpenSSL::PKey::DSA.new pem
-    assert_equal([], OpenSSL.errors)
   end
 
   def test_new_break
@@ -84,7 +83,6 @@ end https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_dsa.rb#L83
     assert_equal(g, key.g)
     assert_equal(y, key.pub_key)
     assert_equal(nil, key.priv_key)
-    assert_equal([], OpenSSL.errors)
   end
 
   def test_read_DSAPublicKey_pem
@@ -109,7 +107,6 @@ fWLOqqkzFeRrYMDzUpl36XktY6Yq8EJYlW9pCMmB https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_dsa.rb#L107
     assert_equal(g, key.g)
     assert_equal(y, key.pub_key)
     assert_equal(nil, key.priv_key)
-    assert_equal([], OpenSSL.errors)
   end
 
   def test_read_DSA_PUBKEY_pem
@@ -135,7 +132,6 @@ YNMbNw== https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_dsa.rb#L132
     assert_equal(g, key.g)
     assert_equal(y, key.pub_key)
     assert_equal(nil, key.priv_key)
-    assert_equal([], OpenSSL.errors)
   end
 
   def test_export_format_is_DSA_PUBKEY_pem
@@ -165,7 +161,6 @@ YNMbNw== https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_dsa.rb#L161
     pub_key = OpenSSL::ASN1.decode(seq[1].value)
     assert_equal(OpenSSL::ASN1::INTEGER, pub_key.tag)
     assert_equal(key.pub_key, pub_key.value)
-    assert_equal([], OpenSSL.errors)
   end
 
   def test_read_private_key_der
@@ -174,7 +169,6 @@ YNMbNw== https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_dsa.rb#L169
     key2 = OpenSSL::PKey.read(der)
     assert(key2.private?)
     assert_equal(der, key2.to_der)
-    assert_equal([], OpenSSL.errors)
   end
 
   def test_read_private_key_pem
@@ -183,7 +177,6 @@ YNMbNw== https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_dsa.rb#L177
     key2 = OpenSSL::PKey.read(pem)
     assert(key2.private?)
     assert_equal(pem, key2.to_pem)
-    assert_equal([], OpenSSL.errors)
   end
 
   def test_read_public_key_der
@@ -192,7 +185,6 @@ YNMbNw== https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_dsa.rb#L185
     key2 = OpenSSL::PKey.read(der)
     assert(!key2.private?)
     assert_equal(der, key2.to_der)
-    assert_equal([], OpenSSL.errors)
   end
 
   def test_read_public_key_pem
@@ -201,7 +193,6 @@ YNMbNw== https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_dsa.rb#L193
     key2 = OpenSSL::PKey.read(pem)
     assert(!key2.private?)
     assert_equal(pem, key2.to_pem)
-    assert_equal([], OpenSSL.errors)
   end
 
   def test_read_private_key_pem_pw
@@ -216,7 +207,6 @@ YNMbNw== https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_dsa.rb#L207
     key2 = OpenSSL::PKey.read(pem, 'secret')
     assert(key2.private?)
     #omit pem equality check, will be different due to cipher iv
-    assert_equal([], OpenSSL.errors)
   end
 
   def test_export_password_length
Index: test/openssl/test_fips.rb
===================================================================
--- test/openssl/test_fips.rb	(revision 55050)
+++ test/openssl/test_fips.rb	(revision 55051)
@@ -3,7 +3,7 @@ require_relative 'utils' https://github.com/ruby/ruby/blob/trunk/test/openssl/test_fips.rb#L3
 
 if defined?(OpenSSL::TestUtils)
 
-class OpenSSL::TestFIPS < Test::Unit::TestCase
+class OpenSSL::TestFIPS < OpenSSL::TestCase
 
   def test_fips_mode_is_reentrant
     OpenSSL.fips_mode = false
Index: test/openssl/utils.rb
===================================================================
--- test/openssl/utils.rb	(revision 55050)
+++ test/openssl/utils.rb	(revision 55051)
@@ -181,7 +181,14 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOP https://github.com/ruby/ruby/blob/trunk/test/openssl/utils.rb#L181
     end
   end
 
-  class OpenSSL::SSLTestCase < Test::Unit::TestCase
+  class OpenSSL::TestCase < Test::Unit::TestCase
+    def teardown
+      # OpenSSL error stack must be empty
+      assert_equal([], OpenSSL.errors)
+    end
+  end
+
+  class OpenSSL::SSLTestCase < OpenSSL::TestCase
     RUBY = EnvUtil.rubybin
     ITERATIONS = ($0 == __FILE__) ? 100 : 10
 
@@ -206,9 +213,6 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOP https://github.com/ruby/ruby/blob/trunk/test/openssl/utils.rb#L213
       @server = nil
     end
 
-    def teardown
-    end
-
     def issue_cert(*arg)
       OpenSSL::TestUtils.issue_cert(*arg)
     end
Index: test/openssl/test_asn1.rb
===================================================================
--- test/openssl/test_asn1.rb	(revision 55050)
+++ test/openssl/test_asn1.rb	(revision 55051)
@@ -1,7 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/test/openssl/test_asn1.rb#L1
 # frozen_string_literal: false
 require_relative 'utils'
 
-class  OpenSSL::TestASN1 < Test::Unit::TestCase
+class  OpenSSL::TestASN1 < OpenSSL::TestCase
   def test_decode
     subj = OpenSSL::X509::Name.parse("/DC=org/DC=ruby-lang/CN=TestCA")
     key = OpenSSL::TestUtils::TEST_KEY_RSA1024
Index: test/openssl/test_pkcs12.rb
===================================================================
--- test/openssl/test_pkcs12.rb	(revision 55050)
+++ test/openssl/test_pkcs12.rb	(revision 55051)
@@ -4,7 +4,7 @@ require_relative "utils" https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkcs12.rb#L4
 if defined?(OpenSSL::TestUtils)
 
 module OpenSSL
-  class TestPKCS12 < Test::Unit::TestCase
+  class TestPKCS12 < OpenSSL::TestCase
     include OpenSSL::TestUtils
 
     def setup
Index: test/openssl/test_ocsp.rb
===================================================================
--- test/openssl/test_ocsp.rb	(revision 55050)
+++ test/openssl/test_ocsp.rb	(revision 55051)
@@ -3,7 +3,7 @@ require_relative "utils" https://github.com/ruby/ruby/blob/trunk/test/openssl/test_ocsp.rb#L3
 
 if defined?(OpenSSL::TestUtils)
 
-class OpenSSL::TestOCSP < Test::Unit::TestCase
+class OpenSSL::TestOCSP < OpenSSL::TestCase
   def setup
     ca_subj = OpenSSL::X509::Name.parse("/DC=org/DC=ruby-lang/CN=TestCA")
     ca_key = OpenSSL::TestUtils::TEST_KEY_RSA1024
Index: test/openssl/test_config.rb
===================================================================
--- test/openssl/test_config.rb	(revision 55050)
+++ test/openssl/test_config.rb	(revision 55051)
@@ -1,7 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/test/openssl/test_config.rb#L1
 # frozen_string_literal: false
 require_relative 'utils'
 
-class OpenSSL::TestConfig < Test::Unit::TestCase
+class OpenSSL::TestConfig < OpenSSL::TestCase
   def setup
     file = Tempfile.open("openssl.cnf")
     file << <<__EOD__
@@ -18,6 +18,7 @@ __EOD__ https://github.com/ruby/ruby/blob/trunk/test/openssl/test_config.rb#L18
   end
 
   def teardown
+    super
     @tmpfile.close!
   end
 
Index: test/openssl/test_engine.rb
===================================================================
--- test/openssl/test_engine.rb	(revision 55050)
+++ test/openssl/test_engine.rb	(revision 55051)
@@ -1,9 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/test/openssl/test_engine.rb#L1
 # frozen_string_literal: false
 require_relative 'utils'
 
-class OpenSSL::TestEngine < Test::Unit::TestCase
+class OpenSSL::TestEngine < OpenSSL::TestCase
 
   def teardown
+    super
     OpenSSL::Engine.cleanup # [ruby-core:40669]
     assert_equal(0, OpenSSL::Engine.engines.size)
   end
Index: test/openssl/test_x509name.rb
===================================================================
--- test/openssl/test_x509name.rb	(revision 55050)
+++ test/openssl/test_x509name.rb	(revision 55051)
@@ -4,7 +4,7 @@ require_relative 'utils' https://github.com/ruby/ruby/blob/trunk/test/openssl/test_x509name.rb#L4
 
 if defined?(OpenSSL::TestUtils)
 
-class OpenSSL::TestX509Name < Test::Unit::TestCase
+class OpenSSL::TestX509Name < OpenSSL::TestCase
   OpenSSL::ASN1::ObjectId.register(
     "1.2.840.113549.1.9.1", "emailAddress", "emailAddress")
   OpenSSL::ASN1::ObjectId.register(
@@ -15,9 +15,6 @@ class OpenSSL::TestX509Name < Test::Unit https://github.com/ruby/ruby/blob/trunk/test/openssl/test_x509name.rb#L15
     @obj_type_tmpl.update(OpenSSL::X509::Name::OBJECT_TYPE_TEMPLATE)
   end
 
-  def teardown
-  end
-
   def test_s_new
     dn = [ ["C", "JP"], ["O", "example"], ["CN", "www.example.jp"] ]
     name = OpenSSL::X509::Name.new(dn)
Index: test/openssl/test_x509crl.rb
===================================================================
--- test/openssl/test_x509crl.rb	(revision 55050)
+++ test/openssl/test_x509crl.rb	(revision 55051)
@@ -3,7 +3,7 @@ require_relative "utils" https://github.com/ruby/ruby/blob/trunk/test/openssl/test_x509crl.rb#L3
 
 if defined?(OpenSSL::TestUtils)
 
-class OpenSSL::TestX509CRL < Test::Unit::TestCase
+class OpenSSL::TestX509CRL < OpenSSL::TestCase
   def setup
     @rsa1024 = OpenSSL::TestUtils::TEST_KEY_RSA1024
     @rsa2048 = OpenSSL::TestUtils::TEST_KEY_RSA2048
@@ -14,9 +14,6 @@ class OpenSSL::TestX509CRL < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/openssl/test_x509crl.rb#L14
     @ee2 = OpenSSL::X509::Name.parse("/DC=org/DC=ruby-lang/CN=EE2")
   end
 
-  def teardown
-  end
-
   def issue_crl(*args)
     OpenSSL::TestUtils.issue_crl(*args)
   end
Index: test/openssl/test_ns_spki.rb
===================================================================
--- test/openssl/test_ns_spki.rb	(revision 55050)
+++ test/openssl/test_ns_spki.rb	(revision 55051)
@@ -3,7 +3,7 @@ require_relative 'utils' https://github.com/ruby/ruby/blob/trunk/test/openssl/test_ns_spki.rb#L3
 
 if defined?(OpenSSL::TestUtils)
 
-class OpenSSL::TestNSSPI < Test::Unit::TestCase
+class OpenSSL::TestNSSPI < OpenSSL::TestCase
   def setup
     # This request data is adopt from the specification of
     # "Netscape Extensions for User Key Generation".
Index: test/openssl/test_buffering.rb
===================================================================
--- test/openssl/test_buffering.rb	(revision 55050)
+++ test/openssl/test_buffering.rb	(revision 55051)
@@ -2,7 +2,7 @@ https://github.com/ruby/ruby/blob/trunk/test/openssl/test_buffering.rb#L2
 require_relative 'utils'
 require 'stringio'
 
-class OpenSSL::TestBuffering < Test::Unit::TestCase
+class OpenSSL::TestBuffering < OpenSSL::TestCase
 
   class IO
     include OpenSSL::Buffering
Index: test/openssl/test_hmac.rb
===================================================================
--- test/openssl/test_hmac.rb	(revision 55050)
+++ test/openssl/test_hmac.rb	(revision 55051)
@@ -3,7 +3,7 @@ https://github.com/ruby/ruby/blob/trunk/test/openssl/test_hmac.rb#L3
 
 require_relative 'utils'
 
-class OpenSSL::TestHMAC < Test::Unit::TestCase
+class OpenSSL::TestHMAC < OpenSSL::TestCase
   def setup
     @digest = OpenSSL::Digest::MD5
     @key = "KEY"
@@ -12,9 +12,6 @@ class OpenSSL::TestHMAC < Test::Unit::Te https://github.com/ruby/ruby/blob/trunk/test/openssl/test_hmac.rb#L12
     @h2 = OpenSSL::HMAC.new(@key, "MD5")
   end
 
-  def teardown
-  end
-
   def test_hmac
     @h1.update(@data)
     @h2.update(@data)
Index: test/openssl/test_cipher.rb
===================================================================
--- test/openssl/test_cipher.rb	(revision 55050)
+++ test/openssl/test_cipher.rb	(revision 55051)
@@ -3,7 +3,7 @@ require_relative 'utils' https://github.com/ruby/ruby/blob/trunk/test/openssl/test_cipher.rb#L3
 
 if defined?(OpenSSL::TestUtils)
 
-class OpenSSL::TestCipher < Test::Unit::TestCase
+class OpenSSL::TestCipher < OpenSSL::TestCase
 
   class << self
 
@@ -34,6 +34,7 @@ class OpenSSL::TestCipher < Test::Unit:: https://github.com/ruby/ruby/blob/trunk/test/openssl/test_cipher.rb#L34
   end
 
   def teardown
+    super
     @c1 = @c2 = nil
   end
 
Index: test/openssl/test_x509req.rb
===================================================================
--- test/openssl/test_x509req.rb	(revision 55050)
+++ test/openssl/test_x509req.rb	(revision 55051)
@@ -3,7 +3,7 @@ require_relative "utils" https://github.com/ruby/ruby/blob/trunk/test/openssl/test_x509req.rb#L3
 
 if defined?(OpenSSL::TestUtils)
 
-class OpenSSL::TestX509Request < Test::Unit::TestCase
+class OpenSSL::TestX509Request < OpenSSL::TestCase
   def setup
     @rsa1024 = OpenSSL::TestUtils::TEST_KEY_RSA1024
     @rsa2048 = OpenSSL::TestUtils::TEST_KEY_RSA2048
Index: test/openssl/test_pkey_rsa.rb
===================================================================
--- test/openssl/test_pkey_rsa.rb	(revision 55050)
+++ test/openssl/test_pkey_rsa.rb	(revision 55051)
@@ -4,7 +4,7 @@ require 'base64' https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_rsa.rb#L4
 
 if defined?(OpenSSL::TestUtils)
 
-class OpenSSL::TestPKeyRSA < Test::Unit::TestCase
+class OpenSSL::TestPKeyRSA < OpenSSL::TestCase
   def test_padding
     key = OpenSSL::PKey::RSA.new(512, 3)
 
@@ -180,7 +180,6 @@ AudJR1JobbIbDJrQu6AXnWh5k/YtAgMBAAE= https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_rsa.rb#L180
     assert_equal(nil, key.d)
     assert_equal(nil, key.p)
     assert_equal(nil, key.q)
-    assert_equal([], OpenSSL.errors)
   end
 
   def test_read_RSA_PUBKEY_pem
@@ -201,7 +200,6 @@ AwEAAQ== https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_rsa.rb#L200
     assert_equal(nil, key.d)
     assert_equal(nil, key.p)
     assert_equal(nil, key.q)
-    assert_equal([], OpenSSL.errors)
   end
 
   def test_export_format_is_RSA_PUBKEY
@@ -223,7 +221,6 @@ AwEAAQ== https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_rsa.rb#L221
     key = OpenSSL::PKey.read(der)
     assert(key.private?)
     assert_equal(der, key.to_der)
-    assert_equal([], OpenSSL.errors)
   end
 
   def test_read_private_key_pem
@@ -231,7 +228,6 @@ AwEAAQ== https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_rsa.rb#L228
     key = OpenSSL::PKey.read(pem)
     assert(key.private?)
     assert_equal(pem, key.to_pem)
-    assert_equal([], OpenSSL.errors)
   end
 
   def test_read_public_key_der
@@ -239,7 +235,6 @@ AwEAAQ== https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pkey_rsa.rb#L235
     key = OpenSSL::PKey.read(der)
     assert(!key.private?)
     assert_equal(der, key.to_der)
-    assert_equal([], OpenSSL.errors)
   end (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]