* ext/openssl/ossl_ssl.c (ossl_call_tmp_ecdh_callback): The SSL socket

always holds a reference to the SSLContext object, which will have
  the callback object.  Ask the context for the callback instead of
  storing the callback in two places.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2015-07-31 18:29:12 +00:00
Родитель fa2040230c
Коммит cbb45e2f4e
2 изменённых файлов: 11 добавлений и 9 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Sat Aug 1 03:27:12 2015 Aaron Patterson <tenderlove@ruby-lang.org>
* ext/openssl/ossl_ssl.c (ossl_call_tmp_ecdh_callback): The SSL socket
always holds a reference to the SSLContext object, which will have
the callback object. Ask the context for the callback instead of
storing the callback in two places.
Sat Aug 1 03:14:07 2015 Aaron Patterson <tenderlove@ruby-lang.org>
* ext/openssl/lib/openssl/ssl.rb (module OpenSSL): convert

Просмотреть файл

@ -139,7 +139,6 @@ int ossl_ssl_ex_store_p;
int ossl_ssl_ex_ptr_idx;
int ossl_ssl_ex_client_cert_cb_idx;
int ossl_ssl_ex_tmp_dh_callback_idx;
int ossl_ssl_ex_tmp_ecdh_callback_idx;
static void
ossl_sslctx_free(void *ptr)
@ -288,12 +287,12 @@ ossl_tmp_dh_callback(SSL *ssl, int is_export, int keylength)
static VALUE
ossl_call_tmp_ecdh_callback(VALUE args)
{
SSL *ssl;
VALUE cb, ecdh;
VALUE cb, ecdh, ctx;
EVP_PKEY *pkey;
GetSSL(rb_ary_entry(args, 0), ssl);
cb = (VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_tmp_ecdh_callback_idx);
ctx = rb_funcall(rb_ary_entry(args, 0), rb_intern("context"), 0);
cb = rb_funcall(ctx, rb_intern("tmp_ecdh_callback"), 0);
if (NIL_P(cb)) return Qfalse;
ecdh = rb_apply(cb, rb_intern("call"), args);
pkey = GetPKeyPtr(ecdh);
@ -1259,8 +1258,6 @@ ossl_ssl_setup(VALUE self)
SSL_set_ex_data(ssl, ossl_ssl_ex_client_cert_cb_idx, (void*)cb);
cb = ossl_sslctx_get_tmp_dh_cb(v_ctx);
SSL_set_ex_data(ssl, ossl_ssl_ex_tmp_dh_callback_idx, (void*)cb);
cb = ossl_sslctx_get_tmp_ecdh_cb(v_ctx);
SSL_set_ex_data(ssl, ossl_ssl_ex_tmp_ecdh_callback_idx, (void*)cb);
SSL_set_info_callback(ssl, ssl_info_cb);
}
@ -1978,8 +1975,6 @@ Init_ossl_ssl(void)
SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_client_cert_cb_idx",0,0,0);
ossl_ssl_ex_tmp_dh_callback_idx =
SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_tmp_dh_callback_idx",0,0,0);
ossl_ssl_ex_tmp_ecdh_callback_idx =
SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_tmp_ecdh_callback_idx",0,0,0);
/* Document-module: OpenSSL::SSL
*