Last active
August 29, 2015 14:24
-
-
Save tenderlove/20d5c5db9ef8fbd4634a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c | |
index 4496d46..89a0ab1 100644 | |
--- a/ext/openssl/ossl_ssl.c | |
+++ b/ext/openssl/ossl_ssl.c | |
@@ -660,6 +660,21 @@ ssl_info_cb(const SSL *ssl, int where, int val) | |
} | |
} | |
+static VALUE ossl_sslctx_set_tmp_ecdh(VALUE self, VALUE ecdh) | |
+{ | |
+ SSL_CTX *ctx; | |
+ EC_KEY *_ecdh; | |
+ EVP_PKEY *pkey; | |
+ | |
+ GetSSLCTX(self, ctx); | |
+ GetPKey(ecdh, pkey); | |
+ _ecdh = pkey->pkey.ec; | |
+ | |
+ SSL_CTX_set_tmp_ecdh(ctx, _ecdh); | |
+ | |
+ return Qnil; | |
+} | |
+ | |
/* | |
* call-seq: | |
* ctx.setup => Qtrue # first time | |
@@ -2224,6 +2239,7 @@ Init_ossl_ssl(void) | |
rb_define_method(cSSLContext, "session_cache_size=", ossl_sslctx_set_session_cache_size, 1); | |
rb_define_method(cSSLContext, "session_cache_stats", ossl_sslctx_get_session_cache_stats, 0); | |
rb_define_method(cSSLContext, "flush_sessions", ossl_sslctx_flush_sessions, -1); | |
+ rb_define_method(cSSLContext, "tmp_ecdh=", ossl_sslctx_set_tmp_ecdh, 1); | |
ary = rb_ary_new2(numberof(ossl_ssl_method_tab)); | |
for (i = 0; i < numberof(ossl_ssl_method_tab); i++) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment