summaryrefslogtreecommitdiff
path: root/ext/openssl/lib/openssl/ssl.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-25 23:35:49 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-25 23:35:49 +0000
commitb380c987e1b54aa720668af37bbb0c4f46f191eb (patch)
tree135ac138a466d41351927b9cd6599470f58c0980 /ext/openssl/lib/openssl/ssl.rb
parent486e6e02c264b90c5c323fb98dfffeec1fc289ae (diff)
* ext/openssl/lib/openssl/pkey.rb: implement DEFAULT_512 and
DEFAULT_1024 constants in Ruby. * ext/openssl/lib/openssl/ssl.rb (module OpenSSL): Ask PKey for the default DH callback since it aleady must check whether openssl has been compiled with DH support. * ext/openssl/ossl_pkey_dh.c (OSSL_PKEY_BN): Remove C definitions of DEFAULT_512 and DEFAULT_1024 * ext/openssl/ossl_pkey_dh.c (Init_ossl_dh): ditto * test/openssl/test_pkey_dh.rb (class OpenSSL): add test to ensure the Ruby definitions are the same as the C definitions were. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/lib/openssl/ssl.rb')
-rw-r--r--ext/openssl/lib/openssl/ssl.rb18
1 files changed, 2 insertions, 16 deletions
diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb
index 1c0cc2fd00..e1b557cd68 100644
--- a/ext/openssl/lib/openssl/ssl.rb
+++ b/ext/openssl/lib/openssl/ssl.rb
@@ -74,20 +74,6 @@ module OpenSSL
DEFAULT_CERT_STORE.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL
end
- if defined?(OpenSSL::PKey::DH)
- DEFAULT_TMP_DH_CALLBACK = lambda { |ctx, is_export, keylen|
- warn "using default DH parameters." if $VERBOSE
- case keylen
- when 512 then OpenSSL::PKey::DH::DEFAULT_512
- when 1024 then OpenSSL::PKey::DH::DEFAULT_1024
- else
- nil
- end
- }
- else
- DEFAULT_TMP_DH_CALLBACK = nil
- end
-
INIT_VARS = ["cert", "key", "client_ca", "ca_file", "ca_path",
"timeout", "verify_mode", "verify_depth", "renegotiation_cb",
"verify_callback", "options", "cert_store", "extra_chain_cert",
@@ -105,7 +91,7 @@ module OpenSSL
# You can get a list of valid methods with OpenSSL::SSL::SSLContext::METHODS
def initialize(version = nil)
INIT_VARS.each { |v| instance_variable_set v, nil }
- @tmp_dh_callback = DEFAULT_TMP_DH_CALLBACK
+ @tmp_dh_callback = OpenSSL::PKey::DEFAULT_TMP_DH_CALLBACK
return unless version
self.ssl_version = version
end
@@ -130,7 +116,7 @@ module OpenSSL
end
def tmp_dh_callback=(value)
- @tmp_dh_callback = value || DEFAULT_TMP_DH_CALLBACK
+ @tmp_dh_callback = value || OpenSSL::PKey::DEFAULT_TMP_DH_CALLBACK
end
end