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

52 Коммитов

Автор SHA1 Сообщение Дата
rhe a0f292bbcd openssl: sync with upstream repository
Sync with the current tip of master branch, 62436385306c of
ruby/openssl.git. Changes can be found at:

	https://github.com/ruby/openssl/compare/v2.1.1...62436385306c

----------------------------------------------------------------
Brian Cunnie (1):
      Correctly verify abbreviated IPv6 SANs

Janko Marohnić (1):
      Reduce memory allocation when writing to SSLSocket

Jeremy Evans (1):
      Move rb_global_variable call to directly after assignment

Kazuki Yamaguchi (7):
      pkcs7: allow recipient's certificate to be omitted for PKCS7#decrypt
      pkey: resume key generation after interrupt
      tool/ruby-openssl-docker: update to latest versions
      test/test_ssl: fix test failure with TLS 1.3
      test/test_x509name: change script encoding to ASCII-8BIT
      x509name: refactor OpenSSL::X509::Name#to_s
      x509name: fix handling of X509_NAME_{oneline,print_ex}() return value

ahadc (1):
      Update CONTRIBUTING.md

nobu (6):
      no ID cache in Init functions
      search winsock libraries explicitly
      openssl: search winsock
      openssl_missing.h: constified
      reduce LibreSSL warnings
      openssl/buffering.rb: no RS when output

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-08 14:13:53 +00:00
nobu c8094ff154 no ID cache in Init functions
Init functions are called only once, cache is useless.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16 08:39:48 +00:00
rhe a55320b093 openssl: import v2.1.0.beta2
Import Ruby/OpenSSL 2.1.0.beta2. The full commit log since commit
e72d960db262 which was imported by r60013 can be found at:

	https://github.com/ruby/openssl/compare/e72d960db262...v2.1.0.beta2

----------------------------------------------------------------
Kazuki Yamaguchi (26):
      bn: use ALLOCV() macro instead of xmalloc()
      appveyor.yml: remove 'openssl version' line
      test/test_ssl_session: skip tests for session_remove_cb
      x509ext: implement X509::Extension#==
      x509attr: implement X509::Attribute#==
      x509cert: implement X509::Certificate#==
      x509revoked: add missing X509::Revoked#to_der
      x509crl, x509revoked: implement X509::{CRL,Revoked}#==
      x509req: implement X509::Request#==
      ssl: extract rb_intern("call")
      cipher: disallow setting AAD for non-AEAD ciphers
      test/test_cipher: fix test_non_aead_cipher_set_auth_data failure
      ssl: fix conflict of options in SSLContext#set_params
      buffering: let #write accept multiple arguments
      pkey: make pkey_check_public_key() non-static
      x509cert, x509crl, x509req, ns_spki: check sanity of public key
      test/envutil: port assert_warning from Ruby trunk
      test/utils: remove a pointless .public_key call in issue_cert
      ssl: add SSLContext#add_certificate
      test/test_ssl: fix test_security_level
      Drop support for LibreSSL 2.4
      kdf: add HKDF support
      test/test_x509cert: fix flaky test
      test/test_x509crl: fix random failure
      History.md: fix a typo
      Ruby/OpenSSL 2.1.0.beta2

Mark Wright (1):
      Fix build failure against OpenSSL 1.1 built with no-deprecated Thanks rhenium for the code review and fixes.

Peter Karman (1):
      Add RSA sign_pss() and verify_pss() methods

aeris (1):
      TLS Fallback Signaling Cipher Suite Value

kazu (1):
      Use caller with length to reduce unused strings

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-25 14:12:08 +00:00
rhe 609103dbb5 openssl: import v2.1.0.beta1
Import Ruby/OpenSSL 2.1.0.beta1. The full commit log since v2.0.5
(imported by r59567) can be found at:

	https://github.com/ruby/openssl/compare/v2.0.5...v2.1.0.beta1

----------------------------------------------------------------
Antonio Terceiro (1):
      test/test_ssl: explicitly accept TLS 1.1 in corresponding test

Colby Swandale (1):
      document using secure protocol to fetch git master in Bundler

Colton Jenkins (1):
      Add fips_mode_get to return fips_mode

Kazuki Yamaguchi (85):
      Start preparing for 2.1.0
      Remove support for OpenSSL 0.9.8 and 1.0.0
      bn: refine tests
      bn: implement unary {plus,minus} operators for OpenSSL::BN
      bn: implement OpenSSL::BN#negative?
      Don't define main() when built with --enable-debug
      test: let OpenSSL::TestCase include OpenSSL::TestUtils
      test: prepare test PKey instances on demand
      Add OpenSSL.print_mem_leaks
      Enable OSSL_MDEBUG on CI builds
      ssl: move default DH parameters from OpenSSL::PKey::DH
      Make exceptions with the same format regardless of OpenSSL.debug
      ssl: show reason of 'certificate verify error' in exception message
      ssl: remove OpenSSL::ExtConfig::TLS_DH_anon_WITH_AES_256_GCM_SHA384
      ssl: do not confuse different ex_data index registries
      ssl: assume SSL/SSL_CTX always have a valid reference to the Ruby object
      Fix RDoc markup
      ssl: suppress compiler warning
      ext/openssl/deprecation.rb: remove broken-apple-openssl
      extconf.rb: print informative message if OpenSSL can't be found
      Rakefile: compile the extension before test
      kdf: introduce OpenSSL::KDF module
      ossl.h: add NUM2UINT64T() macro
      kdf: add scrypt
      Expand rb_define_copy_func() macro
      Expand FPTR_TO_FD() macro
      Remove SafeGet*() macros
      cipher: rename GetCipherPtr() to ossl_evp_get_cipherbyname()
      digest: rename GetDigestPtr() to ossl_evp_get_digestbyname()
      Add ossl_str_new(), an exception-safe rb_str_new()
      bio: simplify ossl_membio2str() using ossl_str_new()
      Remove unused functions and macros
      Drop support for LibreSSL 2.3
      ocsp: add OpenSSL::OCSP::Request#signed?
      asn1: infinite length -> indefinite length
      asn1: rearrange tests
      ssl: remove a needless NULL check in SSL::SSLContext#ciphers
      ssl: return nil in SSL::SSLSocket#cipher if session is not started
      asn1: remove an unnecessary function prototype
      asn1: require tag information when instantiating generic type
      asn1: initialize 'unused_bits' attribute of BitString with 0
      asn1: check for illegal 'unused_bits' value of BitString
      asn1: disallow NULL to be passed to asn1time_to_time()
      asn1: avoid truncating OID in OpenSSL::ASN1::ObjectId#oid
      asn1: allow constructed encoding with definite length form
      asn1: prohibit indefinite length form for primitive encoding
      asn1: allow tag number to be >= 32 for universal tag class
      asn1: use ossl_asn1_tag()
      asn1: clean up OpenSSL::ASN1::Constructive#to_der
      asn1: harmonize OpenSSL::ASN1::*#to_der
      asn1: prevent EOC octets from being in the middle of the content
      asn1: do not treat EOC octets as part of content octets
      x509name: add 'loc' and 'set' kwargs to OpenSSL::X509::Name#add_entry
      ssl: do not call session_remove_cb during GC
      Backport "Merge branch 'topic/test-memory-leak'" to maint
      cipher: update the documentation for Cipher#auth_tag=
      Rakefile: let sync:to_ruby know about test/openssl/fixtures
      test: fix formatting
      test/utils: remove OpenSSL::TestUtils.silent
      test/utils: add SSLTestCase#tls12_supported?
      test/utils: have start_server yield only the port number
      test/utils: do not set ecdh_curves in start_server
      test/utils: let server_loop close socket
      test/utils: improve error handling in start_server
      test/utils: add OpenSSL::TestUtils.openssl? and .libressl?
      test/utils: do not use DSA certificates in SSL tests
      test/test_ssl: remove test_invalid_shutdown_by_gc
      test/test_ssl: move test_multibyte_read_write to test_pair
      test/test_ssl_session: rearrange tests
      test/test_pair, test/test_ssl: fix for TLS 1.3
      ssl: remove useless call to rb_thread_wait_fd()
      ssl: fix NPN support
      ssl: mark OpenSSL::SSL::SSLContext::DEFAULT_{1024,2048} as private
      ssl: use 2048-bit group in the default tmp_dh_cb
      ssl: ensure that SSL option flags are non-negative
      ssl: update OpenSSL::SSL::OP_* flags
      ssl: prefer TLS_method() over SSLv23_method()
      ssl: add SSLContext#min_version= and #max_version=
      ssl: rework SSLContext#ssl_version=
      test/test_x509name: change script encoding to ASCII-8BIT
      x509name: refactor OpenSSL::X509::Name#to_s
      x509name: add OpenSSL::X509::Name#to_utf8
      x509name: add OpenSSL::X509::Name#inspect
      x509name: update regexp in OpenSSL::X509::Name.parse
      Ruby/OpenSSL 2.1.0.beta1

Marcus Stollsteimer (1):
      Fix rdoc for core Integer class

nobu (4):
      [DOC] {read,write}_nonblock with exception: false
      [DOC] keyword argument _exception_
      [DOC] mark up literals
      Revert r57690 except for read_nonblock

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-03 12:35:27 +00:00
rhe df94c66f71 openssl: import v2.0.5
Import Ruby/OpenSSL 2.0.5. The full commit history since v2.0.4
(imported at r59081) can be found at:

	https://github.com/ruby/openssl/compare/v2.0.4...v2.0.5

This will fix the test failure on latest Debian sid and the "no
OPENSSL_Applink" issue on mswin.

----------------------------------------------------------------
Kazuki Yamaguchi (11):
      test/test_ssl: allow 3DES cipher suites in test_sslctx_set_params
      bio: prevent possible GC issue in ossl_obj2bio()
      bio: do not use the FILE BIO method in ossl_obj2bio()
      Rakefile: install_dependencies: install only when needed
      appveyor.yml: test against Ruby 2.4
      ossl_pem_passwd_cb: relax passphrase length constraint
      ossl_pem_passwd_cb: do not check for taintedness
      ossl_pem_passwd_cb: handle nil from the block explicitly
      ssl: remove unsupported TLS versions from SSLContext::METHODS
      ssl: fix compile error with OpenSSL 1.0.0
      Ruby/OpenSSL 2.0.5

Lars Kanis (1):
      Add msys2 library dependency tag in gem metadata

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-10 09:23:45 +00:00
rhe b7458f20ff openssl: import v2.0.2
Import Ruby/OpenSSL 2.0.2. This release contains only bugfixes. The full
commit log since 2.0.1 (imported at r57041) can be found at:

  https://github.com/ruby/openssl/compare/v2.0.1...v2.0.2

----------------------------------------------------------------
Kazuki Yamaguchi (5):
      ssl: check for SSL_CTX_clear_options()
      Rename functions in openssl_missing.c
      ssl: use SSL_SESSION_get_protocol_version()
      pkey: allow instantiating OpenSSL::PKey::PKey with unsupported key type
      Ruby/OpenSSL 2.0.2

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-22 01:43:41 +00:00
rhe aab0d67a1f openssl: import v2.0.0
Import Ruby/OpenSSL 2.0.0. The full commit history since 2.0.0 beta.2
(imported at r56098) can be found at:

  https://github.com/ruby/openssl/compare/v2.0.0.beta.2...v2.0.0

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-30 14:41:46 +00:00
rhe c9dc0164b8 import Ruby/OpenSSL 2.0.0.beta.1
* NEWS, {ext,test,sample}/openssl: Import Ruby/OpenSSL 2.0.0.beta.1.
  ext/openssl is now converted into a default gem. The full commit
  history since r55538 can be found at:
  https://github.com/ruby/openssl/compare/08e1881f5663...v2.0.0.beta.1
  [Feature #9612]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-29 05:47:09 +00:00
rhe 0a523ab20d openssl: adapt to OpenSSL 1.1.0 opaque structs
* ext/openssl/extconf.rb: Check existence of accessor functions that
  don't exist in OpenSSL 0.9.8. OpenSSL 1.1.0 made most of its
  structures opaque and requires use of these accessor functions.
  [ruby-core:75225] [Feature #12324]

* ext/openssl/openssl_missing.[ch]: Implement them if missing.

* ext/openssl/ossl*.c: Use these accessor functions.

* test/openssl/test_hmac.rb: Add missing test for HMAC#reset.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-05 15:35:12 +00:00
rhe 63abe00785 openssl: adapt OpenSSL::PKey to OpenSSL 1.1.0 opaque structs
* ext/openssl/openssl_missing.[ch]: Implement EVP_PKEY_get0_*() and
  {RSA,DSA,EC_KEY,DH}_get0_*() functions.
  OpenSSL 1.1.0 makes EVP_PKEY/RSA/DSA/DH opaque. We used to provide
  setter methods for each parameter of each PKey type, for example
  PKey::RSA#e=, but this is no longer possible because the new API
  RSA_set0_key() requires the 'n' at the same time. This commit adds
  deprecation warning to them and adds PKey::*#set_* methods as direct
  wrapper for those new APIs. For example, 'rsa.e = 3' now needs to be
  rewritten as 'rsa.set_key(rsa.n, 3, rsa.d)'.
  [ruby-core:75225] [Feature #12324]

* ext/openssl/ossl_pkey*.[ch]: Use the new accessor functions. Implement
  RSA#set_{key,factors,crt_params}, DSA#set_{key,pqg}, DH#set_{key,pqg}.
  Emit a warning with rb_warning() when old setter methods are used.

* test/drb/ut_array_drbssl.rb, test/drb/ut_drb_drbssl.rb,
  test/rubygems/test_gem_remote_fetcher.rb: Don't set a priv_key for DH
  object that are used in tmp_dh_callback. Generating a new key pair
  every time should be fine - actually the private exponent is ignored
  in OpenSSL >= 1.0.2f/1.0.1r even if we explicitly set.
  https://www.openssl.org/news/secadv/20160128.txt

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-05 15:00:47 +00:00
rhe e478bb7d79 openssl: support OpenSSL 1.1.0's new multi-threading API
* ext/openssl/extconf.rb: Check absence of CRYPTO_lock() to see if the
  OpenSSL has the new threading API. In OpenSSL <= 1.0.2, an application
  had to set locking callbacks to use OpenSSL in a multi-threaded
  environment. OpenSSL 1.1.0 now finds pthreads or Windows threads so we
  don't need to do something special.
  [ruby-core:75225] [Feature #12324]

  Also check existence of *_up_ref(). Some structures in OpenSSL have
  a reference counter. We used to increment it with CRYPTO_add() which
  is a part of the old API.

* ext/openssl/openssl_missing.h: Implement *_up_ref() if missing.

* ext/openssl/ossl.c: Don't set locking callbacks if unneeded.

* ext/openssl/ossl_pkey.c, ext/openssl/ossl_ssl.c,
  ext/openssl/ossl_x509cert.c, ext/openssl/ossl_x509crl.c,
  ext/openssl/ossl_x509store.c: Use *_up_ref() instead of CRYPTO_add().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-05 12:46:05 +00:00
rhe cf2792d591 openssl: drop OpenSSL 0.9.6/0.9.7 support
* ext/openssl, test/openssl: Drop OpenSSL < 0.9.8 support.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-25 08:50:03 +00:00
rhe 582fa9cde9 openssl: use StringValueCStr() where NUL-terminated string is expected
* ext/openssl/ossl_asn1.c, ext/openssl/ossl_bn.c,
  ext/openssl/ossl_cipher.c, ext/openssl/ossl_digest.c
  ext/openssl/ossl_engine.c, ext/openssl/ossl_ns_spki.c
  ext/openssl/ossl_pkcs12.c, ext/openssl/ossl_pkcs7.c
  ext/openssl/ossl_pkey.c, ext/openssl/ossl_pkey_ec.c
  ext/openssl/ossl_rand.c, ext/openssl/ossl_ssl.c
  ext/openssl/ossl_x509attr.c, ext/openssl/ossl_x509cert.c
  ext/openssl/ossl_x509ext.c, ext/openssl/ossl_x509store.c: Use
  StringValueCStr() where NUL-terminated string is expected.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-23 11:40:07 +00:00
rhe f52ab6e494 openssl: improve handling of password for encrypted PEM
* ext/openssl/ossl.c (ossl_pem_passwd_value): Added. Convert the
  argument to String with StringValue() and validate the length is in
  4..PEM_BUFSIZE. PEM_BUFSIZE is a macro defined in OpenSSL headers.
  (ossl_pem_passwd_cb): When reading/writing encrypted PEM format, we
  used to pass the password to PEM_def_callback() directly but it was
  problematic. It is not NUL character safe. And surprisingly, it
  silently truncates the password to 1024 bytes.  [GH ruby/openssl#51]

* ext/openssl/ossl.h: Add function prototype declaration of newly
  added ossl_pem_passwd_value().

* ext/openssl/ossl_pkey.c (ossl_pkey_new_from_data): Use
  ossl_pem_passwd_value() to validate the password String.

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

* ext/openssl/ossl_pkey_ec.c (ossl_ec_key_initialize,
  ossl_ec_key_to_string): ditto.

* ext/openssl/ossl_pkey_rsa.c (ossl_rsa_initialize, ossl_rsa_export):
  ditto.

* test/openssl/test_pkey_{dsa,ec,rsa}.rb: test this.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-20 15:05:25 +00:00
nobu e14c9f1048 Fix typo on OpenSSL::PKey doc [ci skip]
* ext/openssl/ossl_pkey.c (Init_ossl_pkey): [DOC] Fix typo
  "encrypted" to "decrypted".  [Fix GH-1235]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-02 23:25:40 +00:00
zzak 293aa87118 Commit miss from r52556
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-13 05:03:55 +00:00
zzak 85dd19cf38 * ext/openssl/ossl_pkey.c: Merge ruby/openssl@b9ea8ef [Bug #10735]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-13 05:01:15 +00:00
zzak 0ecc3688ed * ext/openssl/*: Remove svn commit id macros to make sync easier
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-22 16:12:15 +00:00
nobu 451fe269e5 openssl: wrapper object before alloc
* ext/openssl: make wrapper objects before allocating structs to
  get rid of potential memory leaks.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-29 05:55:02 +00:00
hsbt 325a50fc57 * ext/openssl/*: use license instead of licence.
[fix GH-876][ci skip] Patch by @davydovanton
* lib/net/https.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-20 03:55:09 +00:00
nobu 16294913f7 use rb_funcallv
* use rb_funcallv() for no arguments call instead of variadic
  rb_funcall().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-16 04:08:52 +00:00
nobu 68c8994a69 ossl_pkey.c: typed data
* ext/openssl/ossl_pkey.c (ossl_evp_pkey_type): use typed data.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-12 23:19:07 +00:00
nobu 28b9f11d5a protoize no-arguments functions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-30 05:25:32 +00:00
nobu a39b88d2fd ossl_pkey.c: fix memory leak
* ext/openssl/ossl_pkey.c (ossl_pkey_verify): as EVP_VerifyFinal()
  finalizes only a copy of the digest context, the context must be
  cleaned up after initialization by EVP_MD_CTX_cleanup() or a
  memory leak will occur.  [ruby-core:62038] [Bug #9743]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-16 00:51:18 +00:00
drbrain e95f7ea80d * variable.c (trace_ev): Removed "not reached" comment as this line is
reached.
* variable.c (rb_obj_remove_instance_variable):  Replaced "not reached"
  comment with the UNREACHABLE macro.
* variable.c (rb_mod_const_missing):  ditto.
* variable.c (rb_mod_remove_cvar):  ditto.
* enum.c (first_i):  ditto.
* string.c (rb_str_aref):  ditto.
* string.c (str_byte_aref):  ditto.
* string.c (rb_to_id):  ditto.
* io.c (rb_io_fmode_modestr):  ditto.
* io.c (rb_io_oflags_modestr):  ditto.
* pack.c (num2i32):  ditto.
* vm_eval.c (rb_method_missing):  ditto.
* vm_eval.c (rb_f_throw):  ditto.
* dir.c (dir_read):  ditto.
* win32/win32.c (child_result):  ditto.
* struct.c (rb_struct_getmember):  ditto.
* struct.c (rb_struct_set):  ditto.
* struct.c (rb_struct_aref_id):  ditto.
* eval.c (rb_f_raise):  ditto.
* process.c (rb_f_exit_bang):  ditto.
* process.c (rb_f_exit):  ditto.
* process.c (rb_f_abort):  ditto.
* ext/-test-/iter/break.c (iter_break_value):  ditto.
* ext/pty/pty.c (pty_check):  ditto.
* ext/openssl/ossl_pkey.c (ossl_pkey_new):  ditto.
* ext/readline/readline.c (rb_remove_history):  ditto.
* ext/stringio/stringio.c (strio_unimpl):  ditto.
* numeric.c (num_sadded):  ditto.
* numeric.c (num_init_copy):  ditto.
* numeric.c (rb_num2ll):  ditto.
* numeric.c (rb_num2ull):  ditto.
* vm_insnhelper.c (call_cfunc):  ditto.
* ruby.c (opt_W_getter):  ditto.
* bignum.c (rb_big_coerce):  ditto.
* file.c (rb_f_test):  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14 00:36:26 +00:00
akr b848d4f9c8 * ext/openssl/ossl_pkey.c (ossl_pkey_new_from_file): set close-on-exec
flag.

* ext/openssl/ossl_x509cert.c (rb_fd_fix_cloexec): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-14 13:06:51 +00:00
emboss c35204f7bd * ext/openssl/ossl_ssl.c: Remove set, but unused variables.
ext/openssl/ossl_pkey.c: ditto

* ext/openssl/ossl_pkey_dh.c: Make functions passed to
  rb_thread_blocking_region return VALUE instead of void. 
  ext/openssl/ossl_pkey_dsa.c: ditto
  ext/openssl/ossl_pkey_rsa.c: ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-19 01:15:35 +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 a517fe0518 * ext/openssl/ossl_pkey.c: corrected docs, OpenSSL::PKey::DH does
*not* support #sign/verify.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-16 19:59:38 +00:00
kosaki 9c760d0aad * ext/openssl/ossl_asn1.c (decode_eoc): remove unused variables.
Patch by Eric Wong. [Feature #5157] [ruby-core:38798]
* ext/openssl/ossl_asn1.c (ossl_asn1_decode): ditto.
* ext/openssl/ossl_pkey.c (ossl_pkey_new_from_data): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-07 13:52:36 +00:00
nobu 198c2570e7 * sytle fixes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-30 20:20:32 +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
nobu d371e3583e * lib: revert r31635-r31638 and untabify with expand(1).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-19 00:07:25 +00:00
emboss 7f7fef1813 *ext/openssl/ossl_pkey.c: Add documentation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 22:22:34 +00:00
emboss e16d6108c0 Sat May 14 05:08:32 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
* ext/openssl/ossl_digest.c
	* ext/openssl/ossl_pkey.c
	* ext/openssl/ossl_pkey.h
	* test/openssl/pkey/test_pkey_rsa.rb
	Reverted premature commit. Sorry for the noise!

Previous revision: 31555



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-13 20:10:27 +00:00
emboss cb57042bee Sat May 14 04:19:06 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
* NEWS: Describe altered behaviour for RSA and DSA public key
	encoding. [Ruby 1.9 - Bug #4421, Bug #4422]
	[ruby-core:35327,35328]

Previous revision: 31553



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-13 19:25:18 +00:00
naruse 3a16cc24e8 * ext/openssl/ossl.c: surpress warning: shorten-64-to-32.
* ext/openssl/ossl.h: ditto.

* ext/openssl/ossl_asn1.c: ditto.

* ext/openssl/ossl_bio.c: ditto.

* ext/openssl/ossl_bn.c: ditto.

* ext/openssl/ossl_cipher.c: ditto.

* ext/openssl/ossl_hmac.c: ditto.

* ext/openssl/ossl_ns_spki.c: ditto.

* ext/openssl/ossl_ocsp.c: ditto.

* ext/openssl/ossl_pkcs5.c: ditto.

* ext/openssl/ossl_pkey.c: ditto.

* ext/openssl/ossl_pkey_dh.c: ditto.

* ext/openssl/ossl_pkey_dsa.c: ditto.

* ext/openssl/ossl_pkey_ec.c: ditto.

* ext/openssl/ossl_pkey_rsa.c: ditto.

* ext/openssl/ossl_rand.c: ditto.

* ext/openssl/ossl_ssl.c: ditto.

* ext/openssl/ossl_x509ext.c: ditto.

* ext/openssl/ossl_x509name.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-24 07:29:21 +00:00
drbrain 41bfc7a721 Add toplevel documentation for OpenSSL
Add additional documentation for OpenSSL::SSL::SSLContext and
OpenSSL::SSL::SSLSocket.

Move "let rdoc know about mOSSL" comments so they don't show up in output.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-06 00:54:44 +00:00
nobu d0e5a34ac7 * ext/**/*.[ch]: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-22 08:21:01 +00:00
nobu 977267c2e0 * ext/**/*.[ch]: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-22 08:04:13 +00:00
nobu 1f46af14e4 * ext/openssl/openssl_missing.h (i2d_of_void): cast for callbacks.
[ruby-core:22860]

* ext/openssl/ossl_engine.c (ossl_engine_s_by_id): suppress a
  warning.

* ext/openssl/ossl_ssl.c (ossl_sslctx_flush_sessions): time_t may
  be larger than long.

* ext/openssl/ossl_ssl_session.c (ossl_ssl_session_get_time),
  (ossl_ssl_session_get_timeout): use TIMET2NUM() to convert
  time_t.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-13 07:45:35 +00:00
nobu 6c0f540298 * ext/openssl: suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-22 15:34:23 +00:00
technorama 8b95ee24de * ext/openssl/ossl_bn.c: More documentation.
* ext/openssl/lib/ossl_{pkey,pkey_ec}.[ch]: Add elliptic curves.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-03 07:02:44 +00:00
knu 024a7fd7a4 * ext/openssl/ossl_asn1.c (Init_ossl_asn1): Let rdoc know about
externally defined modules; submitted by Technorama
  Ltd. <oss-ruby AT technorama.net> in [ruby-bugs:PR#4704].

* ext/openssl/ossl_bn.c (Init_ossl_bn): Ditto.

* ext/openssl/ossl_cipher.c (Init_ossl_cipher): Ditto.

* ext/openssl/ossl_digest.c (Init_ossl_digest): Ditto.

* ext/openssl/ossl_hmac.c (Init_ossl_hmac): Ditto.

* ext/openssl/ossl_pkey.c (Init_ossl_pkey): Ditto.

* ext/openssl/ossl_pkey_dh.c (Init_ossl_dh): Ditto.

* ext/openssl/ossl_pkey_dsa.c (Init_ossl_dsa): Ditto.

* ext/openssl/ossl_pkey_rsa.c (Init_ossl_rsa): Ditto.

* ext/openssl/ossl_rand.c (Init_ossl_rand): Ditto.

* ext/openssl/ossl_ssl.c (Init_ossl_ssl): Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-12 02:01:19 +00:00
matz 25c50cd193 * ruby.h (struct RString): embed small strings.
(RSTRING_LEN): defined for accessing string members.
  (RSTRING_PTR): ditto.

* string.c: use RSTRING_LEN and RSTRING_PTR.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-31 10:30:33 +00:00
gotoyuzo 5505449793 * ext/openssl/ossl_ssl.c: OpenSSL::SSL::SSLContexts suports callbacks:
- SSLContext#client_cert_cb is a Proc. it is called when a client
    certificate is requested by a server and no certificate was yet
    set for the SSLContext. it must return an Array which includes
    OpenSSL::X509::Certificate and OpenSSL::PKey::RSA/DSA objects.
  - SSLContext#tmp_dh_callback is called in key exchange with DH
    algorithm. it must return an OpenSSL::PKey::DH object.

* ext/openssl/ossl_ssl.c:
  (ossl_sslctx_set_ciphers): ignore the argument if it's nil.
  (ossl_start_ssl, ossl_ssl_write): call rb_sys_fail if errno isn't 0.
  [ruby-dev:25831]

* ext/openssl/ossl_pkey.c
  (GetPrivPKeyPtr, ossl_pkey_sign): should call rb_funcall first.
  (DupPrivPKeyPtr): new function.

* ext/openssl/ossl_pkey_dh.c: add default DH parameters.

* ext/openssl/ossl_pkey.h: ditto.

* ext/openssl/lib/openssl/cipher.rb: fix typo. [ruby-dev:24285]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-09 10:45:42 +00:00
gotoyuzo 54d29aaba9 * ext/openssl/ossl_pkey.c (ossl_pkey_to_der): removed; it returns
public key only.

* ext/openssl/ossl_pkey_dh.c (ossl_dh_to_der): new function for
  OpenSSL::PKey::DH#to_der.

* ext/openssl/ossl_pkey_dsa.c (ossl_dsa_to_der): new function for
  OpenSSL::PKey::DSA#to_der.

* ext/openssl/ossl_pkey_rsa.c (ossl_rsa_to_der): new function for
  OpenSSL::PKey::RSA#to_der.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-08 12:24:22 +00:00
gotoyuzo 30103702c3 * ext/openssl: all files are reviewed to simplify and avoid memory leak.
* ext/openssl/extconf.rb: add check for assert.h.

* ext/openssl/ossl.c (ossl_buf2str): new function to convert
  C buffer to String and free buffer.

* ext/openssl/ossl.c (ossl_x509_ary2sk): new function to convert
  Array of OpenSSL::X509 to STACK_OF(X509) with exception safe.

* ext/openssl/ossl.c (ossl_to_der, ossl_to_der_if_possible): new
  functions to convert object to DER string.

* ext/openssl/ossl.h: ditto.

* ext/openssl/ossl_bio.c (ossl_membio2str): new function to convert
  BIO to String object and free BIO.

* ext/openssl/ossl_bio.h: ditto.

* ext/openssl/ossl_pkcs7.c (ossl_pkcs7_to_der): add for "to_der".

* ext/openssl/ossl_x509name.c (ossl_x509name_to_der): ditto.

* ext/openssl/ossl_x509ext.c (ossl_x509ext_to_der): ditto.

* ext/openssl/ossl_x509ext.c (create_ext_from_array): removed
  and reimplement in openssl/x509.rb.

* ext/openssl/ossl_x509attr.c: reimplemented and disable some
  method temporarily. this class doesn't work fine without ASN.1
  data support;-) I'll rewrite in near future.

* ext/openssl/lib/openssl/x509.c (X509::Attribute): get rid off
  unused code.

* ext/openssl/lib/openssl/x509.c (X509::ExtensionFactory): refine all.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-17 09:05:02 +00:00
michal bd96b4c8cc OpenSSL update
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-12 13:46:48 +00:00