Skip to content

Commit

Permalink
Add tests around setting min_version in SSLContext
Browse files Browse the repository at this point in the history
  • Loading branch information
junaruga authored and ekohl committed Jan 12, 2024
1 parent ae215a4 commit 104d68f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/openssl/test_ssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,27 @@ def test_sslctx_set_params
ctx.options & OpenSSL::SSL::OP_NO_COMPRESSION
end

def test_sslctx_set_params_min_version_on_greater_than_equal_openssl_11
omit 'Omit in OpenSSL 1.0 or earlier versions' unless openssl?(1, 1, 0)
omit 'Omit in LibreSSL' if libressl?

ctx = OpenSSL::SSL::SSLContext.new
ctx.set_params

# The cached value should not exist.
assert_raise(NoMethodError) { ctx.send(:@min_proto_version) }
end

def test_sslctx_set_params_min_version_on_less_than_openssl_11
omit 'Omit in OpenSSL 1.1 or later versions' if openssl?(1, 1, 0)

ctx = OpenSSL::SSL::SSLContext.new
ctx.set_params

# This is not publicly exposed, but read the cached version.
assert_equal OpenSSL::SSL::TLS1_VERSION, ctx.send(:@min_proto_version)
end

def test_post_connect_check_with_anon_ciphers
ctx_proc = -> ctx {
ctx.ssl_version = :TLSv1_2
Expand Down

0 comments on commit 104d68f

Please sign in to comment.