Skip to content

Commit 3e01c80

Browse files
rheniumjunaruga
authored andcommitted
ssl: fix test_tmp_dh and test_tmp_dh_callback with OpenSSL 4.0
OpenSSL master added support for RFC 7919 groups in TLS 1.2. They are preferred over SSLContext#tmp_dh= or #tmp_dh_callback= values if the client advertises them in the supported_groups extension.
1 parent ebb505f commit 3e01c80

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/openssl/test_ssl.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,7 +1909,9 @@ def test_tmp_dh_callback
19091909
}
19101910
}
19111911
start_server(ctx_proc: ctx_proc) do |port|
1912-
server_connect(port) { |ssl|
1912+
ctx = OpenSSL::SSL::SSLContext.new
1913+
ctx.groups = "P-256" # Exclude RFC 7919 groups
1914+
server_connect(port, ctx) { |ssl|
19131915
assert called, "dh callback should be called"
19141916
assert_equal dh.to_der, ssl.tmp_key.to_der
19151917
}
@@ -2172,7 +2174,9 @@ def test_tmp_dh
21722174
ctx.tmp_dh = dh
21732175
}
21742176
start_server(ctx_proc: ctx_proc) do |port|
2175-
server_connect(port) { |ssl|
2177+
ctx = OpenSSL::SSL::SSLContext.new
2178+
ctx.groups = "P-256" # Exclude RFC 7919 groups
2179+
server_connect(port, ctx) { |ssl|
21762180
assert_equal dh.to_der, ssl.tmp_key.to_der
21772181
}
21782182
end

0 commit comments

Comments
 (0)