aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_cipher.rb
diff options
context:
space:
mode:
authorrhe <rhe@ruby-lang.org>2016-05-25 08:50:03 +0000
committerKazuki Yamaguchi <k@rhe.jp>2016-05-31 11:31:27 +0900
commitc1d611158df3cd8ff2fa4964b029678c6b9f9fd6 (patch)
tree77afbc4ff18a609ce2017d69a8927210c3a7c0a2 /test/test_cipher.rb
parente34610d8d5e49301157afe435803b185774f39a2 (diff)
downloadruby-openssl-c1d611158df3cd8ff2fa4964b029678c6b9f9fd6.tar.gz
openssl: drop OpenSSL 0.9.6/0.9.7 support
* ext/openssl, test/openssl: Drop OpenSSL < 0.9.8 support. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_cipher.rb')
-rw-r--r--test/test_cipher.rb62
1 files changed, 30 insertions, 32 deletions
diff --git a/test/test_cipher.rb b/test/test_cipher.rb
index aec33fdd..ec14f467 100644
--- a/test/test_cipher.rb
+++ b/test/test_cipher.rb
@@ -114,40 +114,38 @@ class OpenSSL::TestCipher < OpenSSL::TestCase
end
end if has_cipher?('aes-128-ctr')
- if OpenSSL::OPENSSL_VERSION_NUMBER > 0x00907000
- def test_ciphers
- OpenSSL::Cipher.ciphers.each{|name|
- next if /netbsd/ =~ RUBY_PLATFORM && /idea|rc5/i =~ name
- begin
- assert_kind_of(OpenSSL::Cipher::Cipher, OpenSSL::Cipher::Cipher.new(name))
- rescue OpenSSL::Cipher::CipherError => e
- next if /wrap/ =~ name and e.message == 'wrap mode not allowed'
- raise
- end
- }
- end
+ def test_ciphers
+ OpenSSL::Cipher.ciphers.each{|name|
+ next if /netbsd/ =~ RUBY_PLATFORM && /idea|rc5/i =~ name
+ begin
+ assert_kind_of(OpenSSL::Cipher::Cipher, OpenSSL::Cipher::Cipher.new(name))
+ rescue OpenSSL::Cipher::CipherError => e
+ next if /wrap/ =~ name and e.message == 'wrap mode not allowed'
+ raise
+ end
+ }
+ end
- def test_AES
- pt = File.read(__FILE__)
- %w(ECB CBC CFB OFB).each{|mode|
- c1 = OpenSSL::Cipher::AES256.new(mode)
- c1.encrypt
- c1.pkcs5_keyivgen("passwd")
- ct = c1.update(pt) + c1.final
-
- c2 = OpenSSL::Cipher::AES256.new(mode)
- c2.decrypt
- c2.pkcs5_keyivgen("passwd")
- assert_equal(pt, c2.update(ct) + c2.final)
- }
- end
+ def test_AES
+ pt = File.read(__FILE__)
+ %w(ECB CBC CFB OFB).each{|mode|
+ c1 = OpenSSL::Cipher::AES256.new(mode)
+ c1.encrypt
+ c1.pkcs5_keyivgen("passwd")
+ ct = c1.update(pt) + c1.final
+
+ c2 = OpenSSL::Cipher::AES256.new(mode)
+ c2.decrypt
+ c2.pkcs5_keyivgen("passwd")
+ assert_equal(pt, c2.update(ct) + c2.final)
+ }
+ end
- def test_AES_crush
- 500.times do
- assert_nothing_raised("[Bug #2768]") do
- # it caused OpenSSL SEGV by uninitialized key
- OpenSSL::Cipher::AES128.new("ECB").update "." * 17
- end
+ def test_AES_crush
+ 500.times do
+ assert_nothing_raised("[Bug #2768]") do
+ # it caused OpenSSL SEGV by uninitialized key
+ OpenSSL::Cipher::AES128.new("ECB").update "." * 17
end
end
end