aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2023-08-16 11:24:41 +0900
committerGitHub <noreply@github.com>2023-08-16 11:24:41 +0900
commit6424402375380aacec77c1fb99ec67162c8935dd (patch)
treeede2e038e98840701b460c6655d03ac23ff06e8f
parent1c0d28e7dc3830482c9214bd0dc55ee50e60ec48 (diff)
parentdb8deaacd3ba37fc34af795c235486c1c0af87c3 (diff)
downloadruby-openssl-6424402375380aacec77c1fb99ec67162c8935dd.tar.gz
Merge pull request #663 from junaruga/wip/test-use-openssl-version-method
Use openssl? instead of OpenSSL::OPENSSL_VERSION_NUMBER.
-rw-r--r--test/openssl/test_cipher.rb2
-rw-r--r--test/openssl/test_pkey.rb2
-rw-r--r--test/openssl/utils.rb5
3 files changed, 5 insertions, 4 deletions
diff --git a/test/openssl/test_cipher.rb b/test/openssl/test_cipher.rb
index 1c8610b2..8faa5706 100644
--- a/test/openssl/test_cipher.rb
+++ b/test/openssl/test_cipher.rb
@@ -205,7 +205,7 @@ class OpenSSL::TestCipher < OpenSSL::TestCase
assert_raise(OpenSSL::Cipher::CipherError) { cipher.update(ct2) }
end if has_cipher?("aes-128-ccm") &&
OpenSSL::Cipher.new("aes-128-ccm").authenticated? &&
- OpenSSL::OPENSSL_VERSION_NUMBER >= 0x1010103f # version >= 1.1.1c
+ openssl?(1, 1, 1, 0x03, 0xf) # version >= 1.1.1c
def test_aes_gcm
# GCM spec Appendix B Test Case 4
diff --git a/test/openssl/test_pkey.rb b/test/openssl/test_pkey.rb
index 691dd74a..92331323 100644
--- a/test/openssl/test_pkey.rb
+++ b/test/openssl/test_pkey.rb
@@ -188,7 +188,7 @@ class OpenSSL::TestPKey < OpenSSL::PKeyTestCase
end
def raw_initialize
- pend "Ed25519 is not implemented" unless OpenSSL::OPENSSL_VERSION_NUMBER >= 0x10101000 && # >= v1.1.1
+ pend "Ed25519 is not implemented" unless openssl?(1, 1, 1) # >= v1.1.1
assert_raise(OpenSSL::PKey::PKeyError) { OpenSSL::PKey.new_raw_private_key("foo123", "xxx") }
assert_raise(OpenSSL::PKey::PKeyError) { OpenSSL::PKey.new_raw_private_key("ED25519", "xxx") }
diff --git a/test/openssl/utils.rb b/test/openssl/utils.rb
index f00084ff..3d4d05fe 100644
--- a/test/openssl/utils.rb
+++ b/test/openssl/utils.rb
@@ -131,11 +131,12 @@ module OpenSSL::TestUtils
end
end
- def openssl?(major = nil, minor = nil, fix = nil, patch = 0)
+ def openssl?(major = nil, minor = nil, fix = nil, patch = 0, status = 0)
return false if OpenSSL::OPENSSL_VERSION.include?("LibreSSL")
return true unless major
OpenSSL::OPENSSL_VERSION_NUMBER >=
- major * 0x10000000 + minor * 0x100000 + fix * 0x1000 + patch * 0x10
+ major * 0x10000000 + minor * 0x100000 + fix * 0x1000 + patch * 0x10 +
+ status * 0x1
end
def libressl?(major = nil, minor = nil, fix = nil)