Skip to content

Commit a98152a

Browse files
committed
ssl: use 2048-bit group in the default tmp_dh_cb
The 'keylen' parameter of the tmp_dh_callback is only meaningful when 'is_export' is non-zero. Ignore them and just return the default 2048-bit DH group.
1 parent 4d6a3b9 commit a98152a

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

lib/openssl/ssl.rb

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ class SSLContext
3030
}
3131

3232
if defined?(OpenSSL::PKey::DH)
33-
DEFAULT_1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_
34-
-----BEGIN DH PARAMETERS-----
35-
MIGHAoGBAJ0lOVy0VIr/JebWn0zDwY2h+rqITFOpdNr6ugsgvkDXuucdcChhYExJ
36-
AV/ZD2AWPbrTqV76mGRgJg4EddgT1zG0jq3rnFdMj2XzkBYx3BVvfR0Arnby0RHR
37-
T4h7KZ/2zmjvV+eF8kBUHBJAojUlzxKj4QeO2x20FP9X5xmNUXeDAgEC
38-
-----END DH PARAMETERS-----
39-
_end_of_pem_
40-
private_constant :DEFAULT_1024
41-
4233
DEFAULT_2048 = OpenSSL::PKey::DH.new <<-_end_of_pem_
4334
-----BEGIN DH PARAMETERS-----
4435
MIIBCAKCAQEA7E6kBrYiyvmKAMzQ7i8WvwVk9Y/+f8S7sCTN712KkK3cqd1jhJDY
@@ -53,11 +44,7 @@ class SSLContext
5344

5445
DEFAULT_TMP_DH_CALLBACK = lambda { |ctx, is_export, keylen| # :nodoc:
5546
warn "using default DH parameters." if $VERBOSE
56-
case keylen
57-
when 1024 then DEFAULT_1024
58-
when 2048 then DEFAULT_2048
59-
else nil
60-
end
47+
DEFAULT_2048
6148
}
6249
end
6350

0 commit comments

Comments
 (0)