1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/openssl
rhe 61a3fff661 openssl: move SSLSocket#initialize to C extension
* ext/openssl/lib/openssl/ssl.rb (SSLSocket): Move the implementation of
  SSLSocket#initialize to C. Initialize the SSL (OpenSSL object) in it.
  Currently this is delayed until ossl_ssl_setup(), which is called from
  SSLSocket#accept or #connect. Say we call SSLSocket#hostname= with an
  illegal value. We expect an exception to be raised in #hostname= but
  actually we get it in the later SSLSocket#connect. Because the SSL is
  not ready at #hostname=, the actual call of SSL_set_tlsext_host_name()
  is also delayed.
  This also fixes: [ruby-dev:49376] [Bug #11724]

* ext/openssl/ossl_ssl.c (ossl_ssl_initialize): Added. Almost the same
  as the Ruby version but this instantiate the SSL object at the same
  time.

  (ossl_ssl_setup): Adjust to the changes. Just set the underlying IO to
  the SSL.

  (ssl_started): Added. Make use of SSL_get_fd(). This returns -1 if not
  yet set by SSL_set_fd().

  (ossl_ssl_data_get_struct): Removed. Now GetSSL() checks that the SSL
  exists.

  (ossl_ssl_set_session): Don't call ossl_ssl_setup() here as now the
  SSL is already instantiated in #initialize.

  (ossl_ssl_shutdown, ossl_start_ssl, ossl_ssl_read_internal,
   ossl_ssl_write_internal, ossl_ssl_stop, ossl_ssl_get_cert,
   ossl_ssl_get_peer_cert, ossl_ssl_get_peer_cert_chain,
   ossl_ssl_get_version, ossl_ssl_get_cipher, ossl_ssl_get_state,
   ossl_ssl_pending, ossl_ssl_session_reused,
   ossl_ssl_get_verify_result, ossl_ssl_get_client_ca_list,
   ossl_ssl_npn_protocol, ossl_ssl_alpn_protocol, ossl_ssl_tmp_key): Use
  GetSSL() instead of ossl_ssl_data_get_struct(). Use ssl_started().

  (Init_ossl_ssl): Add method declarations of SSLSocket#{initialize,
  hostname=}.

* ext/openssl/ossl_ssl.h (GetSSL): Check that the SSL is not NULL. It
  should not be NULL because we now set it in #initialize.

* ext/openssl/ossl_ssl_session.c (ossl_ssl_session_initialize): No need
  to check if the SSL is NULL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-28 05:00:36 +00:00
..
lib openssl: move SSLSocket#initialize to C extension 2016-05-28 05:00:36 +00:00
depend Update dependencies. 2016-04-11 11:50:00 +00:00
deprecation.rb openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
extconf.rb openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
openssl_missing.c openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
openssl_missing.h openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl.c openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl.h openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl_asn1.c openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl_asn1.h * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_bio.c prefer rb_syserr_fail 2015-12-23 08:57:48 +00:00
ossl_bio.h * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_bn.c openssl: use StringValueCStr() where NUL-terminated string is expected 2016-05-23 11:40:07 +00:00
ossl_bn.h * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_cipher.c openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl_cipher.h * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_config.c * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_config.h * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_digest.c openssl: use StringValueCStr() where NUL-terminated string is expected 2016-05-23 11:40:07 +00:00
ossl_digest.h * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_engine.c openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl_engine.h * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_hmac.c * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_hmac.h * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_ns_spki.c openssl: use StringValueCStr() where NUL-terminated string is expected 2016-05-23 11:40:07 +00:00
ossl_ns_spki.h * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_ocsp.c openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl_ocsp.h openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl_pkcs5.c openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl_pkcs5.h
ossl_pkcs7.c openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl_pkcs7.h * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_pkcs12.c openssl: use StringValueCStr() where NUL-terminated string is expected 2016-05-23 11:40:07 +00:00
ossl_pkcs12.h * ext/openssl/ossl_pkcs12*: Remove svn commit id macro 2015-09-23 13:23:02 +00:00
ossl_pkey.c openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl_pkey.h openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl_pkey_dh.c openssl: avoid NULL dereference in {DH,DSA,RSA}_size() 2016-05-26 05:24:58 +00:00
ossl_pkey_dsa.c openssl: avoid NULL dereference in {DH,DSA,RSA}_size() 2016-05-26 05:24:58 +00:00
ossl_pkey_ec.c openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl_pkey_rsa.c openssl: avoid NULL dereference in {DH,DSA,RSA}_size() 2016-05-26 05:24:58 +00:00
ossl_rand.c openssl: use StringValueCStr() where NUL-terminated string is expected 2016-05-23 11:40:07 +00:00
ossl_rand.h * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_ssl.c openssl: move SSLSocket#initialize to C extension 2016-05-28 05:00:36 +00:00
ossl_ssl.h openssl: move SSLSocket#initialize to C extension 2016-05-28 05:00:36 +00:00
ossl_ssl_session.c openssl: move SSLSocket#initialize to C extension 2016-05-28 05:00:36 +00:00
ossl_version.h * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_x509.c openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl_x509.h * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_x509attr.c openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl_x509cert.c openssl: use StringValueCStr() where NUL-terminated string is expected 2016-05-23 11:40:07 +00:00
ossl_x509crl.c openssl: clear OpenSSL error queue before return to Ruby 2016-05-18 04:07:47 +00:00
ossl_x509ext.c openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ossl_x509name.c * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00
ossl_x509req.c openssl: clear OpenSSL error queue before return to Ruby 2016-05-18 04:07:47 +00:00
ossl_x509revoked.c ext: use RARRAY_AREF 2015-11-05 01:09:17 +00:00
ossl_x509store.c openssl: drop OpenSSL 0.9.6/0.9.7 support 2016-05-25 08:50:03 +00:00
ruby_missing.h * ext/openssl/*: Remove svn commit id macros to make sync easier 2015-09-22 16:12:15 +00:00