Граф коммитов

93 Коммитов

Автор SHA1 Сообщение Дата
naruse d5b1fde5c7 * ext/openssl/ossl_pkey_dh.c (ossl_dh_initialize):
pop pushed error after each try of reading. fixes #4550

* ext/openssl/ossl_pkey_dsa.c (ossl_dsa_initialize): ditto.

* ext/openssl/ossl_pkey_ec.c (ossl_ec_initialize): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-06 06:14:05 +00:00
drbrain d6fb308078 * ext/openssl/lib/openssl/buffering.rb (module OpenSSL): #flush should
not change sync mode on exception.
	* test/openssl/test_buffering.rb: added


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-16 06:07:03 +00:00
nobu 7c3a80272a * test/openssl/test_config.rb (OpenSSL#test_freeze): fix error
message assertion.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-13 00:56:52 +00:00
nobu 74e6dd4078 * ext/openssl/ossl_cipher.c (ossl_cipher_alloc): leave data ptr
NULL.
* ext/openssl/ossl_cipher.c (ossl_cipher_new, ossl_cipher_initialize):
  allocate internal structure.  [ruby-core:35094]
* ext/openssl/ossl_cipher.c (ossl_cipher_copy): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-05 02:48:55 +00:00
naruse 5323407175 * ext/openssl/ossl_bn.c (GetBNPtr): add missing nil case.
patched by Martin Bosslet. [ruby-core:34987]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-29 18:48:24 +00:00
nahi 0522ffd51f * ext/openssl/ossl_asn1.c (ossl_asn1_decode0): OpenSSL::ASN1.decode
should reject indefinite length primitive encodings as that is
          illegal. Patch by Martin Bosslet. See #4324.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-26 08:17:01 +00:00
naruse 9ff4e23741 Support OpenSSL 1.1; it supports RSA1024 and DSS1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-25 09:02:03 +00:00
tenderlove 033cea7d8e drying up the requires in the openssl tests
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-15 19:50:00 +00:00
tenderlove b130018e86 adding a test for OpenSSL::PKCS12.create
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-13 04:17:42 +00:00
tenderlove b82ba18990 * ext/openssl/ossl_asn1.c: indefinite length BER to DER encoding is
properly supported.  Thanks Martin Bosslet! [ruby-core:33082]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-11 17:45:42 +00:00
tenderlove e1e671d60d refactor load error rescue to the openssl util file
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-11 01:25:25 +00:00
drbrain 62e2f9052b Include Comparable in OpenSSL::X509::Name, document #<=>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-10 21:26:23 +00:00
tenderlove 16a166dd35 * ext/openssl/ossl_x509store.c (ossl_x509stctx_cleanup): removing C
implementation of `cleanup`.

* ext/openssl/lib/openssl/x509.rb: adding ruby implementation of
  `cleanup`.  OpenSSL::X509::StoreContext#cleanup is deprecated since
  reusing the underlying struct doesn't make sense. [ruby-dev:42546]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-09 17:18:54 +00:00
naruse 7fd6016e1c Set DH Parameter for SSLContext to clean warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-07 14:24:40 +00:00
usa 1972f9eec1 * test/openssl/test_ssl.rb (test_not_started_session): non socket
argument of SSLSocket.new is not supported on Windows.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-01 06:09:22 +00:00
tenderlove 8a6ebf4c51 making ssl test a little better
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-15 02:46:55 +00:00
naruse a33b5edda0 STDIN is not valid when ruby doesn't have tty.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-15 02:37:23 +00:00
tenderlove fb7a337e97 * etc/openssl/ossl_ssl.c (ossl_ssl_get_cert): raise exception if
pointer is invalid.  Thanks Ippei Obayashi! [ruby-dev:42573]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-14 21:46:08 +00:00
tenderlove 37e7bf7619 removing empty teardown, cleaning up whitespace errors
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-06 21:19:11 +00:00
tenderlove e6a8cbc2a2 * test/openssl/test_ocsp.rb: adding test for r29699. Thanks Elise
Huard! [ruby-core:32460]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-06 21:19:00 +00:00
naruse 3a633b812e * ext/openssl/lib/openssl/bn.rb (Integer#to_bn): OpenSSL::BN.new
accepts only Strings, so call Integer#to_s(16).
  16 is for an optimization. [ruby-dev:42336]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-04 00:33:22 +00:00
kazu 631d23c57b * test/openssl/utils.rb (OpenSSL#silent): always restore $VERBOSE. [ruby-dev:42285]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-22 08:16:49 +00:00
naruse 6ebb345dd7 * ext/openssl/ossl_bn.c (ossl_bn_is_prime): fix comparison
with rb_scan_args. Before this fix, OpenSSL::BN#prime?
  is fully broken.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-13 00:40:10 +00:00
nahi 7f438d8402 * ext/openssl/lib/openssl/x509-internal.rb: removed unused local
variable.

        * test/openssl/*: less warnings while test running with -w.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-10 08:54:50 +00:00
nahi 298a6e1cd5 * backport r29071 from ruby_1_8;
* ext/openssl/ossl_asn1.c (obj_to_asn1bool): fixed ASN1::Boolean 
            encoding issue for OpenSSL 1.0.0 compatibility.
            ASN1::Boolean.new(false).to_der wrongly generated "\1\1\377" which 
            means 'true'. 

            ASN1_TYPE_set of OpenSSL <= 0.9.8 treats value 0x100 as 'false' 
            but OpenSSL >= 1.0.0 treats it as 'true'.  ruby-ossl was using
            0x100 for 'false' for backward compatibility.  Just use 0x0 for
            the case OpenSSL >= OpenSSL 0.9.7.

          * test/openssl/test_asn1.rb: test added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-23 04:12:08 +00:00
nahi 15c39b07bd * backport r28621 and r28632 from ruby_1_8;
* ext/openssl/ossl_config.c, ext/openssl/lib/openssl/config.rb,
            ext/openssl/lib/openssl.rb: reimplement OpenSSL::Config in Ruby. 
            Now it should work on windows. 

          * test/openssl/test_config.rb: added tests for OpenSSL::Config#dup.

          * test/openssl/test_config.rb: added tests for Config#clone.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-19 08:22:31 +00:00
usa 4b1a1f7701 * test/openssl/test_ssl.rb (test_client_auth): Errno::ECONNRESET is raised on
Windows.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-19 05:14:41 +00:00
usa 119863716b * test/openssl/test_ssl.rb (server_loop): treat Errno::ENOTSOCK just like as
Errno::EBADF and Errno::EINVAL.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-19 05:08:17 +00:00
nobu bcd0bcc390 * test/openssl/test_ec.rb: added test_dsa_sign_asn1_FIPS186_3. dgst is
truncated with ec_key.group.order.size after openssl 0.9.8m for
  FIPS 186-3 compliance.

  WARNING: ruby-openssl aims to wrap an OpenSSL so when you're using
  openssl 0.9.8l or earlier version, EC.dsa_sign_asn1 raises
  OpenSSL::PKey::ECError as before and EC.dsa_verify_asn1 just returns
  false when you pass dgst longer than expected (no truncation
  performed).

* ext/openssl/ossl_pkey_ec.c: rdoc typo fixed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-06 10:13:46 +00:00
nobu 59fc499c63 * test: fixed wrong assertions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-02 08:25:11 +00:00
naruse 663a7488ce * test/openssl/{test_x509cert.rb,openssl,test_x509crl.rb,
test_x509req.rb}:
  fix false positive tests because of OpenSSL spec change.
  patched by originally Hongli Lai [ruby-core:27417],
  and fixed by Motohiro KOSAKI [ruby-core:28063]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-28 02:47:19 +00:00
naruse bd7326c383 * test/openssl/{test_x509cert.rb,openssl,test_x509req.rb}:
remove false positive tests because of OpenSSL spec change.
  patched by Motohiro KOSAKI [ruby-core:28063]
  see also [ruby-dev:40077]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-28 02:40:31 +00:00
knu fdb57d043d Add some more tests, revisited.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-23 17:36:12 +00:00
knu d223734555 Back out the series of changes pending a due discussion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-23 17:33:39 +00:00
knu 28501bb6e5 Add some more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-23 17:01:08 +00:00
akr 48d402db88 use require_relative.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-02 13:58:56 +00:00
akr 37679ee584 supress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-25 23:12:50 +00:00
yugui 2c3a48614a * test/openssl/test_config.rb (OpenSSL::TestConfig): new test case.
test for r25017.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26 12:18:04 +00:00
naruse 6bbed0e31b * test: use require_relative.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-12 17:00:51 +00:00
akr 7fd155cf0f * ext/openssl/ossl_ssl.c (write_would_block): defined.
(read_would_block): defined.
  (ossl_start_ssl): add nonblock argument.
  (ossl_ssl_connect): follow ossl_start_ssl change.
  (ossl_ssl_connect_nonblock): new method.
  (ossl_ssl_accept): follow ossl_start_ssl change.
  (ossl_ssl_accept_nonblock): new method.
  (ossl_ssl_read_internal): use write_would_block and
  read_would_block.
  (ossl_ssl_write_internal): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-21 06:56:33 +00:00
akr 17a085ea8c * ext/openssl/lib/openssl/buffering.rb
(OpenSSL::Buffering#write_nonblock): new method.

* ext/openssl/ossl_ssl.c (ossl_ssl_write_nonblock): new method.
  (ossl_ssl_write_internal): defined.
  (ossl_ssl_write): use ossl_ssl_write_internal.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-20 17:39:44 +00:00
akr c4049f4cb6 * io.c (rb_mWaitReadable): defined.
(rb_mWaitWritable): defined.
  (io_getpartial): extend IO::WaitReadable on EWOULDBLOCK and EAGAIN.
  (rb_io_write_nonblock): extend IO::WaitWritable on EWOULDBLOCK and
  EAGAIN.

* error.c (make_errno_exc): extracted from rb_sys_fail.
  (rb_mod_sys_fail): new function.

* include/ruby/ruby.h (rb_mod_sys_fail): declared.
  (rb_mWaitReadable): declared.
  (rb_mWaitWritable): declared.

* ext/socket/init.c (rsock_s_recvfrom_nonblock): extend
  IO::WaitReadable on EWOULDBLOCK and EAGAIN.
  (rsock_s_accept_nonblock): extend IO::WaitReadable on EWOULDBLOCK,
  EAGAIN, ECONNABORTED and EPROTO.

* ext/socket/socket.c (sock_connect_nonblock): extend IO::WaitWritable
  on EINPROGRESS.

* ext/socket/ancdata.c (bsock_sendmsg_internal): extend
  IO::WaitWritable on EWOULDBLOCK and EAGAIN.
  (bsock_recvmsg_internal): extend IO::WaitReadable on EWOULDBLOCK and
  EAGAIN.

* ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): raise SSLError
  extended by IO::WaitReadable/IO::WaitWritable on
  SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE.

* ext/openssl/ossl.c (ossl_make_error): extracted from ossl_raise.
  (ossl_exc_new): new function.

* ext/openssl/ossl.h (ossl_exc_new): declared.

* lib/net/protocol.rb (rbuf_fill): rescue IO::WaitReadable and
  IO::WaitWritable.

  [ruby-core:22539], [ruby-dev:38140] 



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-19 11:40:38 +00:00
nobu 287a34ae0d * {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06 03:56:38 +00:00
akr 6294d065bb select before read_nonblock.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-08 02:01:22 +00:00
technorama 7361a2ecb3 * ext/openssl/ossl_ssl.c: Server Name Indication support.
new methods SSLContext#server_name_cb=, SSLSocket#hostname=.

* test/openssl/test_ssl.rb: Tests for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-24 21:45:42 +00:00
akr 021aaa70d6 * ext/openssl/ossl_ssl.c (ossl_ssl_read_internal): show openssl error
code in EWOULDBLOCK error.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-31 08:18:12 +00:00
akr 8cc42bc701 add a test for OpenSSL::SSL::SSLSocket#read_nonblock.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-28 16:09:59 +00:00
matz 57f7d8c2cd * ext/openssl/ossl_ssl.c (ossl_ssl_read_nonblock):
OpenSSL::SSL::SSLSocket should implement read_nonblock.  a patch
  from Aaron Patterson in [ruby-core:20277].  fix: #814 [ruby-core:20241]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-04 07:21:10 +00:00
nobu 00b4a3f9c4 * test: assert_raises has been deprecated since a long time ago.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-24 17:44:39 +00:00
kazu 8bf5284c1e * test/openssl/test_ssl.rb (OpenSSL#test_client_session):
Debian's openssl 0.9.8g-13 failed at assert(ssl.session_reused?),
  when use default SSLContext. [ruby-dev:36167]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-09 11:41:45 +00:00