Skip to content

Commit

Permalink
cipher: update test_ciphers
Browse files Browse the repository at this point in the history
Do not attempt to actually use all algorithms. Not all algorithms listed
in OpenSSL::Cipher.ciphers are always available.
  • Loading branch information
rhenium committed Dec 20, 2021
1 parent 5d0df40 commit 91d04f9
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions test/openssl/test_cipher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,11 @@ def test_ctr_if_exists
end

def test_ciphers
OpenSSL::Cipher.ciphers.each{|name|
next if /netbsd/ =~ RUBY_PLATFORM && /idea|rc5/i =~ name
begin
assert_kind_of(OpenSSL::Cipher, OpenSSL::Cipher.new(name))
rescue OpenSSL::Cipher::CipherError => e
raise unless /wrap/ =~ name and /wrap mode not allowed/ =~ e.message
end
}
ciphers = OpenSSL::Cipher.ciphers
assert_kind_of Array, ciphers
assert_include ciphers, "aes-128-cbc"
assert_include ciphers, "aes128" # alias of aes-128-cbc
assert_include ciphers, "aes-128-gcm"
end

def test_AES
Expand Down

0 comments on commit 91d04f9

Please sign in to comment.