[ruby/openssl] Use openssl? instead of OpenSSL::OPENSSL_VERSION_NUMBER.

Update the `openssl?` method by adding status argument.

Note the format is below.

* OpenSSL 3: 0xMNN00PP0 (major minor 00 patch 0)
* OpenSSL 1: 0xMNNFFPPS (major minor fix patch status)

See <https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_VERSION_NUMBER.html>
for details.

db8deaacd3
This commit is contained in:
Jun Aruga 2023-08-14 17:13:22 +02:00 committed by Kazuki Yamaguchi
parent 12bdacdca5
commit 8ca0d53fd0
3 changed files with 5 additions and 4 deletions

View file

@ -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") }