ruby-changes:41644
From: naruse <ko1@a...>
Date: Tue, 2 Feb 2016 20:01:06 +0900 (JST)
Subject: [ruby-changes:41644] naruse:r53718 (trunk): Skip SHA from test_digest_constants for LibreSSL 2.3
naruse 2016-02-02 20:02:10 +0900 (Tue, 02 Feb 2016) New Revision: 53718 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53718 Log: Skip SHA from test_digest_constants for LibreSSL 2.3 The first one of ruby/openssl#40 https://github.com/ruby/openssl/issues/40#issuecomment-159839338 Modified files: trunk/test/openssl/test_digest.rb Index: test/openssl/test_digest.rb =================================================================== --- test/openssl/test_digest.rb (revision 53717) +++ test/openssl/test_digest.rb (revision 53718) @@ -58,7 +58,10 @@ class OpenSSL::TestDigest < Test::Unit:: https://github.com/ruby/ruby/blob/trunk/test/openssl/test_digest.rb#L58 end def test_digest_constants - algs = %w(DSS1 MD4 MD5 RIPEMD160 SHA SHA1) + algs = %w(DSS1 MD4 MD5 RIPEMD160 SHA1) + if !libressl? || !version_since([2,3]) + algs += %w(SHA) + end if OpenSSL::OPENSSL_VERSION_NUMBER > 0x00908000 algs += %w(SHA224 SHA256 SHA384 SHA512) end @@ -122,6 +125,14 @@ class OpenSSL::TestDigest < Test::Unit:: https://github.com/ruby/ruby/blob/trunk/test/openssl/test_digest.rb#L125 d = OpenSSL::Digest.new(oid.oid) assert_not_nil(d) end + + def libressl? + OpenSSL::OPENSSL_VERSION.include?('LibreSSL') + end + + def version_since(verary) + (OpenSSL::OPENSSL_LIBRARY_VERSION.scan(/\d+/).map(&:to_i) <=> verary) != -1 + end end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/