aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_cipher.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_cipher.rb')
-rw-r--r--test/test_cipher.rb18
1 files changed, 6 insertions, 12 deletions
diff --git a/test/test_cipher.rb b/test/test_cipher.rb
index ad0e87b4..ce64fbb9 100644
--- a/test/test_cipher.rb
+++ b/test/test_cipher.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: false
require_relative 'utils'
-if defined?(OpenSSL::TestUtils)
-
class OpenSSL::TestCipher < OpenSSL::TestCase
module Helper
def has_cipher?(name)
@@ -129,7 +127,7 @@ class OpenSSL::TestCipher < OpenSSL::TestCase
assert_equal ct, cipher.update(pt) << cipher.final
cipher = new_decryptor("aes-128-ctr", key: key, iv: iv, padding: 0)
assert_equal pt, cipher.update(ct) << cipher.final
- end if has_cipher?('aes-128-ctr')
+ end
def test_ciphers
OpenSSL::Cipher.ciphers.each{|name|
@@ -165,10 +163,8 @@ class OpenSSL::TestCipher < OpenSSL::TestCase
end
def test_authenticated
- if has_cipher?('aes-128-gcm')
- cipher = OpenSSL::Cipher.new('aes-128-gcm')
- assert_predicate(cipher, :authenticated?)
- end
+ cipher = OpenSSL::Cipher.new('aes-128-gcm')
+ assert_predicate(cipher, :authenticated?)
cipher = OpenSSL::Cipher.new('aes-128-cbc')
assert_not_predicate(cipher, :authenticated?)
end
@@ -220,7 +216,7 @@ class OpenSSL::TestCipher < OpenSSL::TestCase
cipher = new_decryptor("aes-128-gcm", key: key, iv: iv, auth_tag: tag, auth_data: aad)
cipher.update(ct2)
assert_raise(OpenSSL::Cipher::CipherError) { cipher.final }
- end if has_cipher?("aes-128-gcm")
+ end
def test_aes_gcm_variable_iv_len
# GCM spec Appendix B Test Case 5
@@ -243,7 +239,7 @@ class OpenSSL::TestCipher < OpenSSL::TestCase
assert_equal tag, cipher.auth_tag
cipher = new_decryptor("aes-128-gcm", key: key, iv_len: 8, iv: iv, auth_tag: tag, auth_data: aad)
assert_equal pt, cipher.update(ct) << cipher.final
- end if has_cipher?("aes-128-gcm")
+ end
def test_aes_ocb_tag_len
# RFC 7253 Appendix A; the second sample
@@ -295,7 +291,7 @@ class OpenSSL::TestCipher < OpenSSL::TestCase
assert_equal ct1, ct2
assert_equal tag1, tag2
- end if has_cipher?("aes-128-gcm")
+ end
private
@@ -314,5 +310,3 @@ class OpenSSL::TestCipher < OpenSSL::TestCase
end
end
-
-end