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
nahi d3507e3ea6 * Release GVL while OpenSSL's public key generation.
t = Thread.new { print "."; sleep 0.1 }
    key = OpenSSL::PKey::RSA.new(2048)
    #=> Thread t works in parallel with public key generation if
        OS/machine allows it.

  This works with OpenSSL >= 0.9.8. From this version, it has new 
  public key generation function which allows us to interrupt the
  execution while pkey generation iterations.

* ext/openssl/extconf.rb: Check existence of OpenSSL's new public key
  generation function. (DH_generate_parameters_ex,
  DSA_generate_parameters_ex and RSA_generate_key_ex.

* ext/openssl/ossl_pkey.{h,c} (ossl_generate_cb_2,
  ossl_generate_cb_stop): Added new callback function for OpenSSL pkey
  generation which handles Thread interruption by Ruby.
  ossl_generate_cb_stop is the unblock function(ubf) for Ruby which
  sets a stop flag. New pkey generation callback ossl_generate_cb_2
  checks the stop flag at each iterations of OpenSSL and interrupts
  pkey generation when the flag is set.

* ext/openssl/ossl_pkey_dsa.c (dsa_generate): Call
  rb_thread_blocking_region with the above unblock function to release
  GVL while pkey generation.

* ext/openssl/ossl_pkey_rsa.c (rsa_generate): ditto.

* ext/openssl/ossl_pkey_dh.c (dh_generate): ditto.

* test/openssl/test_pkey_{dh,dsa,rsa}.rb: Test it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-01 07:42:29 +00:00
..
lib * ext/openssl/lib/openssl/bn.rb: Hide copyright info from RDoc. 2011-08-25 00:43:45 +00:00
extconf.rb * Release GVL while OpenSSL's public key generation. 2011-09-01 07:42:29 +00:00
openssl_missing.c * ext/openssl/extconf.rb 2011-06-26 01:32:03 +00:00
openssl_missing.h * ext/openssl/extconf.rb 2011-06-26 01:32:03 +00:00
ossl.c * ext/openssl/ossl.c (ossl_verify_cb): trap the exception from 2011-07-14 05:41:05 +00:00
ossl.h * ext/openssl/ossl.h: include openssl/e_os2.h before checking the 2011-07-08 06:03:17 +00:00
ossl_asn1.c * ext/openssl/ossl_asn1.c (decode_eoc): remove unused variables. 2011-08-07 13:52:36 +00:00
ossl_asn1.h * ext/**/*.[ch]: removed trailing spaces. 2010-04-22 08:04:13 +00:00
ossl_bio.c * include/ruby/intern.h (rb_update_max_fd): declaration moved from 2011-07-20 13:26:10 +00:00
ossl_bio.h
ossl_bn.c * ext/openssl/ossl.c: surpress warning: shorten-64-to-32. 2011-03-24 07:29:21 +00:00
ossl_bn.h
ossl_cipher.c * ext/openssl/ossl_cipher.c (ossl_cipher_initialize): Avoid possible 2011-07-28 13:48:05 +00:00
ossl_cipher.h
ossl_config.c * ext/openssl/ossl_config.c (parse_config): remove dead declaration. 2010-09-29 03:37:44 +00:00
ossl_config.h
ossl_digest.c * ext/openssl/ossl_digest.c: Document OpenSSL::Digest::digest and add 2011-08-25 00:29:02 +00:00
ossl_digest.h
ossl_engine.c * ext/openssl/ossl_engine.c: Avoid double free of ENGINE reference. 2011-07-22 00:13:07 +00:00
ossl_engine.h
ossl_hmac.c * ext/openssl/ossl_hmac.c: Revert checking return type of 2011-07-22 04:11:38 +00:00
ossl_hmac.h
ossl_ns_spki.c * ext/openssl/ossl.c: surpress warning: shorten-64-to-32. 2011-03-24 07:29:21 +00:00
ossl_ns_spki.h
ossl_ocsp.c * ext/openssl/ossl.c: surpress warning: shorten-64-to-32. 2011-03-24 07:29:21 +00:00
ossl_ocsp.h
ossl_pkcs5.c * ext/openssl/ossl.c: surpress warning: shorten-64-to-32. 2011-03-24 07:29:21 +00:00
ossl_pkcs5.h
ossl_pkcs7.c * sytle fixes. 2011-06-30 20:20:32 +00:00
ossl_pkcs7.h
ossl_pkcs12.c * ext/openssl/ossl.h: Introduced OSSL_BIO_reset macro for PEM/DER 2011-06-22 08:41:08 +00:00
ossl_pkcs12.h
ossl_pkey.c * Release GVL while OpenSSL's public key generation. 2011-09-01 07:42:29 +00:00
ossl_pkey.h * Release GVL while OpenSSL's public key generation. 2011-09-01 07:42:29 +00:00
ossl_pkey_dh.c * Release GVL while OpenSSL's public key generation. 2011-09-01 07:42:29 +00:00
ossl_pkey_dsa.c * Release GVL while OpenSSL's public key generation. 2011-09-01 07:42:29 +00:00
ossl_pkey_ec.c * ext/openssl/ossl.h: Introduced OSSL_BIO_reset macro for PEM/DER 2011-06-22 08:41:08 +00:00
ossl_pkey_rsa.c * Release GVL while OpenSSL's public key generation. 2011-09-01 07:42:29 +00:00
ossl_rand.c * ext/openssl/ossl.c: surpress warning: shorten-64-to-32. 2011-03-24 07:29:21 +00:00
ossl_rand.h
ossl_ssl.c * ext/openssl/ossl_ssl.c: Support disabling OpenSSL compression. 2011-08-15 01:10:26 +00:00
ossl_ssl.h * ext/openssl/ossl_ssl.h: parenthesize macro arguments. 2011-03-10 13:28:58 +00:00
ossl_ssl_session.c * ext/openssl/ossl_ssl_session.c (ossl_ssl_session_set_time): Check 2011-06-23 10:36:09 +00:00
ossl_version.h
ossl_x509.c
ossl_x509.h
ossl_x509attr.c * ext/openssl/ossl_x509attr.c: parenthesize macro arguments. 2011-03-13 09:11:45 +00:00
ossl_x509cert.c * ext/openssl/ossl_x509cert.c: fixed whitespace issues 2011-08-16 21:41:25 +00:00
ossl_x509crl.c * ext/openssl/ossl.h: Introduced OSSL_BIO_reset macro for PEM/DER 2011-06-22 08:41:08 +00:00
ossl_x509ext.c * ext/openssl/ossl.c: surpress warning: shorten-64-to-32. 2011-03-24 07:29:21 +00:00
ossl_x509name.c * ext/openssl/ossl_x509name.c: Add X509::Name#hash_old as a wrapper 2011-06-23 13:51:55 +00:00
ossl_x509req.c * ext/openssl/ossl.h: Introduced OSSL_BIO_reset macro for PEM/DER 2011-06-22 08:41:08 +00:00
ossl_x509revoked.c * ext/openssl/ossl_x509revoked.c: parenthesize macro arguments. 2011-03-19 03:30:59 +00:00
ossl_x509store.c * ext/openssl/ossl_rand.c (ossl_rand_egd_bytes): use NUM2INT because 2011-03-24 04:49:18 +00:00
ruby_missing.h * ext/openssl/ruby_missing.h: parenthesize macro arguments. 2011-03-22 11:09:43 +00:00