diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2017-08-13 23:26:12 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2017-08-24 21:01:09 +0900 |
commit | 9e2b5dc78a4e123425b4ff5eb30e64dd37ad9fb8 (patch) | |
tree | e7c57192e8a94b47dca11cf95b01454cd8889d62 /test/test_ssl.rb | |
parent | 8fea1ed5ede36a5b7269698a0718b186fb101fbf (diff) | |
download | ruby-openssl-9e2b5dc78a4e123425b4ff5eb30e64dd37ad9fb8.tar.gz |
test/utils: add OpenSSL::TestUtils.openssl? and .libressl?
Add methods that check whether the running OpenSSL is an OpenSSL or a
LibreSSL, and optionally check whether the version is newer or equal to
the given version number.
Diffstat (limited to 'test/test_ssl.rb')
-rw-r--r-- | test/test_ssl.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/test/test_ssl.rb b/test/test_ssl.rb index 3917793e..872dd226 100644 --- a/test/test_ssl.rb +++ b/test/test_ssl.rb @@ -839,7 +839,7 @@ if OpenSSL::SSL::SSLContext::METHODS.include?(:TLSv1_2) && OpenSSL::SSL::SSLCont ctx.ssl_version = :TLSv1_2_client server_connect(port, ctx) { |ssl| assert_equal("TLSv1.2", ssl.ssl_version) } } - end if OpenSSL::OPENSSL_VERSION_NUMBER > 0x10001000 + end def test_forbid_tls_v1_1_for_client ctx_proc = Proc.new { |ctx| ctx.options = OpenSSL::SSL::OP_ALL | OpenSSL::SSL::OP_NO_TLSv1_1 } @@ -888,7 +888,7 @@ end } end -if OpenSSL::OPENSSL_VERSION_NUMBER >= 0x10002000 +if openssl?(1, 0, 2) || libressl? def test_alpn_protocol_selection_ary advertised = ["http/1.1", "spdy/2"] ctx_proc = Proc.new { |ctx| @@ -1216,8 +1216,7 @@ end end } - if OpenSSL::OPENSSL_VERSION_NUMBER >= 0x10002000 && - !OpenSSL::OPENSSL_VERSION.include?("LibreSSL") + if openssl?(1, 0, 2) || libressl?(2, 5, 1) ctx = OpenSSL::SSL::SSLContext.new ctx.ecdh_curves = "P-256" |