1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
Commit graph

7 commits

Author SHA1 Message Date
emboss
5bd7899b98 * ext/openssl/ossl.c
ext/openssl/ossl_pkey_rsa.c
  ext/openssl/ossl_pkey_dsa.c
  ext/openssl/ossl_pkey_ec.c: Forbid export passwords that are less
  than four characters long, as OpenSSL itself does not allow this.
  Issue found by Eric Hodel.
* ext/openssl/ossl_pkey_ec.c: Add export as an alias of to_pem,
  following the PKey interface contract.
* test/openssl/test_pkey_dsa.rb
  test/openssl/test_pkey_rsa.rb
  test/openssl/test_pkey_ec.rb: Add tests that assert correct
  behaviour when dealing with passwords that are less than four
  characters long.
  [ruby-core: 42281][ruby-trunk - Bug #5951]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-10 01:23:21 +00:00
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
emboss
26cb830df9 * ext/openssl/ossl.h: Introduced OSSL_BIO_reset macro for PEM/DER
fallback scenarios.

* ext/openssl/ossl_pkey_dsa.c
* ext/openssl/ossl_x509req.c
* ext/openssl/ossl_pkey_rsa.c
* ext/openssl/ossl_pkey_ec.c
* ext/openssl/ossl_ssl_session.c
* ext/openssl/ossl_x509crl.c
* ext/openssl/ossl_pkey.c
* ext/openssl/ossl_pkey_dh.c
* ext/openssl/ossl_x509cert.c
* ext/openssl/ossl_pkcs7.c: Use OSSL_BIO_reset.

* ext/openssl/ossl_ssl.c
* ext/openssl/ossl_cipher.c
* ext/openssl/ossl_pkey_ec.c
* ext/openssl/ossl_pkcs12.c
* ext/openssl/ossl_ssl_session.c: Replace rb_raise occurences by
  ossl_raise. This automatically flushes OpenSSL's error queue.

* ext/openssl/ossl_pkcs7.c: Raise error if DER fallback for parsing
  fails.

* test/openssl/test_pkey_ec.rb
* test/openssl/test_pkey_dsa.rb
* test/openssl/test_pkey_rsa.rb: Add assertions that OpenSSL.errors is
  empty.

* test/openssl/test_pkey_rsa.rb: Remove initial OpenSSL.errors call in
  test_new.
  [ Ruby 1.9 - Bug #4885 ] [ruby-core:37134]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-22 08:41:08 +00:00
emboss
bbb3cfb12b * ext/openssl/ossl_pkey.c: added PKey.read module function that allow
reading arbitrary public/private keys from DER-/PEM-encoded File or
  string instances.
* ext/openssl/ossl_pkey_dh.c: improved documentation.
* test/openssl/utils.rb: added EC test key.
* test/openssl/test_pkey_rsa.rb
  test/openssl/test_pkey_dsa.rb: Test PKey.read. Reuse keys from 
  OpenSSL::TestUtils.
* test/openssl/test_pkey_ec.rb: Created test file for EC tests.
  Test PKey.read.
  [Ruby 1.9 - Feature #4424] [ruby-core:35330]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-12 20:39:38 +00:00
emboss
f2c7a874a7 * test/openssl/test_pkey_dsa.rb: Test for DSA#syssign/sysverify.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-12 17:43:38 +00:00
emboss
affb9cfbc8 * test/openssl/test_pkey_dsa.rb: Add tests for sign/verify.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-21 22:13:27 +00:00
emboss
4ccb387f3b Sat May 14 12:00:54 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
* test/openssl/test_pkey_dsa.rb: Add basic tests and tests that 
	ensure new public key PEM encoding behavior and ensure backward 
	compatibility.
	[Ruby 1.9 - Bug #4422] [ruby-core:35328]
	* test/openssl/test_pkey_rsa.rb: Remove line with 'puts'.

previous revision: 31561



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-14 03:14:33 +00:00