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

68 Коммитов

Автор SHA1 Сообщение Дата
Ben Toews 7db29de008 [ruby/openssl] add document-method for BN#mod_inverse
https://github.com/ruby/openssl/commit/5befde7519
2022-10-17 23:38:35 +09:00
Ben Toews 149cb049f1 [ruby/openssl] add BN#mod_sqrt
https://github.com/ruby/openssl/commit/4619ab3e76
2022-10-17 23:38:34 +09:00
Ben Toews e037731c9f [ruby/openssl] define BIGNUM_2cr macro for BN function that takes context and
returns a BN

https://github.com/ruby/openssl/commit/4d0971c51c
2022-10-17 23:38:34 +09:00
Kazuki Yamaguchi e10dfdf623 [ruby/openssl] bn: expand BIGNUM_RAND and BIGNUM_RAND_RANGE macros
Now that BN.pseudo_rand{,_range} are alias, those macros are only used
once. Let's expand the macros for better readability.

https://github.com/ruby/openssl/commit/7c2fc00dee
2021-10-25 00:40:48 +09:00
Kazuki Yamaguchi e19186707a [ruby/openssl] bn: make BN.pseudo_rand{,_range} an alias of BN.rand{,_range}
BN_pseudo_rand() and BN_pseudo_rand_range() are deprecated in
OpenSSL 3.0. Since they are identical to their non-'pseudo' version
anyway, let's make them alias.

https://github.com/ruby/openssl/commit/2d34e85ddf
2021-10-25 00:40:48 +09:00
Kazuki Yamaguchi cfa4fa636e [ruby/openssl] bn: use BN_check_prime() in OpenSSL::BN#prime{,_fasttest}?
In OpenSSL 3.0, BN_is_prime_ex() and BN_is_prime_fasttest_ex() are
deprecated in favor of BN_check_prime().

https://github.com/ruby/openssl/commit/90d51ef510
2021-10-25 00:40:45 +09:00
Yusuke Endoh 3d37e5d11c [ruby/openssl] Add OpenSSL::BN#set_flags and #get_flags
Also, OpenSSL::BN::CONSTTIME is added.

OpenSSL itself had a feature that was vulnerable against a side-channel
attack. The OpenSSL authors determined that it was not a security issue,
and they have already fixed the issue by using BN_set_flags.

https://github.com/openssl/openssl/pull/13888

If a Ruby OpenSSL user was faced with a similar issue, they couldn't
prevent the issue because Ruby OpenSSL lacks a wrapper to BN_set_flags.
For the case, this change introduces the wrapper.

https://github.com/ruby/openssl/commit/1e565eba89
2021-07-18 17:45:02 +09:00
Kazuki Yamaguchi decce40da7 [ruby/openssl] bn: update documentation of OpenSSL::BN#initialize and #to_s
Clarify that BN.new(str, 2) and bn.to_s(2) handles binary string in
big-endian, and the sign of the bignum is ignored.

Reference: https://github.com/ruby/openssl/issues/431

https://github.com/ruby/openssl/commit/6fae2bd612
2021-07-18 17:44:40 +09:00
Rick Mark 01fcb8f45b [ruby/openssl] BN.abs and BN uplus
Adds standard math abs fuction and revises uplus to return a duplicated object due to BN mutability

https://github.com/ruby/openssl/commit/0321b1e945
2021-07-18 17:44:39 +09:00
Tom Stuart 8b2f2a707d [ruby/openssl] Use #ifdef consistently for HAVE_RB_EXT_RACTOR_SAFE
We previously used a mix of both `#if` and `#ifdef`, but the latter is
more reliable because it will still work if the macro is undefined.

https://github.com/ruby/openssl/commit/e4a622e67e
2021-03-31 18:05:08 +09:00
Kazuki Yamaguchi 1eb6d8aa63 [ruby/openssl] bn: check -1 return from BIGNUM functions
Although the manpage says that BIGNUM functions return 0 on error,
OpenSSL versions before 1.0.2n and current LibreSSL versions may return
-1 instead.

Note that the implementation of OpenSSL::BN#mod_inverse is extracted
from BIGNUM_2c() macro as it didn't really share the same function
signature with others.

https://github.com/ruby/openssl/commit/9b59f34345
2021-03-16 19:37:06 +09:00
Koichi Sasada e76b56f58e support Ruby 2.x for openssl 2020-12-19 02:05:08 +09:00
Koichi Sasada b5588edc0a openssl is ractor-safe
ossl_bn_ctx is C's global variable and it should be ractor-local
to make it ractor-safe.
2020-12-18 18:19:33 +09:00
Hiroshi SHIBATA b99775b163
Import openssl-2.2.0 (#2693)
Import the master branch of ruby/openssl for preparing to release openssl-2.2.0
2020-02-16 15:21:29 +09:00
mame 82632d4c0c ext/openssl/ossl_bn.c (ossl_bn_initialize): get rid of SEGV
OpenSSL::BN.new(nil, 2) dumped core.

[ruby-core:92231] [Bug #15760]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10 12:57:39 +00:00
svn 481481b81a * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10 09:16:00 +00:00
kazu 25c1fd3b90 Reverting all commits from r67479 to r67496 because of CI failures
Because hard to specify commits related to r67479 only.
So please commit again.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10 09:15:21 +00:00
svn 0cc2ffbc1b * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10 08:03:48 +00:00
mame 83fc324d1d ext/openssl/ossl_bn.c (ossl_bn_initialize): get rid of SEGV
OpenSSL::BN.new(nil, 2) dumped core.

[ruby-core:92231] [Bug #15760]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-10 08:03:47 +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
nobu 65b87de350 ruby.h: unnormalized Fixnum value
* include/ruby/ruby.h (ST2FIX): fix unnormalized Fixnum value bug
  on mingw/mswin.  [ruby-core:82687] [Bug #13877]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-07 03:24: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 9eb92007b6 openssl: import v2.0.4
Import Ruby/OpenSSL 2.0.4. Only bug (and typo) fixes. The full commit
history since v2.0.3 (imported at r57482) can be found at:

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

This contains the fix for [Bug #11033].

----------------------------------------------------------------
Jun Aruga (1):
      Update .travis.yml and Dockerfile

Kazuki Yamaguchi (9):
      test/test_pkey_ec: do not use dummy 0 order
      test/test_ssl: fix typo in test_sysread_and_syswrite
      ssl: check return value of SSL_set_fd()
      Fix typos
      test/test_x509store: skip OpenSSL::TestX509Store#test_set_errors
      tool/sync-with-trunk: 'LASY' -> 'LAST'
      x509store: clear error queue after calling X509_LOOKUP_load_file()
      extconf.rb: simplify searching libraries logic
      Ruby/OpenSSL 2.0.4

SHIBATA Hiroshi (1):
      Fix typos

Vladimir Rybas (1):
      Fix documentation for OpenSSL::Cipher#final

nobu (2):
      openssl: fix broken openssl check
      openssl: fix broken openssl check

usa (1):
      Search SSL libraries by testing various filename patterns

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-14 09:49:09 +00:00
rhe 0c83666c6c openssl: import v2.0.1
Import Ruby/OpenSSL 2.0.1. The full commit history since 2.0.0 (imported
at r56946) can be found at:

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

This release contains only bug fixes. Note, the first two commits since
v2.0.0 are already imported at r56953 to make Travis and RubyCI green.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-10 08:12:02 +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 1f3ec6d858 openssl: avoid deprecated BN_*prime* functions
* ext/openssl/ossl_bn.c (ossl_bn_s_generate_prime, ossl_bn_is_prime,
  ossl_bn_is_prime_fasttest): Avoid deprecated BN_generate_prime(),
  BN_is_prime{,_fasttest}(). They are deprecated because they expect an
  old style callback function (we don't use it here). They can be simply
  replaced by _ex suffixed functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-04 02:35:09 +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 b43fd8e080 openssl: fix equality test methods of OpenSSL::BN
* ext/openssl/ossl_bn.c (try_convert_to_bnptr): Extracted from
  GetBNPtr(). This doesn't raise exception but returns NULL on error.
  (GetBNPtr): Raise TypeError if conversion fails.
  (ossl_bn_eq): Implement BN#==.
  (ossl_bn_eql): #eql? should not raise TypeError even if the argument
  is not compatible with BN.
  (ossl_bn_hash): Implement BN#hash.

* ext/openssl/ossl_bn.c (Init_ossl_bn): Define #== and #hash.

* test/openssl/test_bn.rb: Test BN#eql?, #== and #hash

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 02:55:45 +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 c5d781dded ossl_bn.c: [DOC] expand rdocs [ci skip]
* ext/openssl/ossl_bn.c: [DOC] expand rdocs as RDoc does not
  expand C-preprocessor macros.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-21 23:28:47 +00:00
zzak b0317ee815 [DOC] Backport ruby/openssl@86eb721 [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-21 19:06:17 +00:00
nobu e580a631be use 0 for reserved
use 0 for rb_data_type_t::reserved instead of NULL, since its type
may be changed in the future and possibly not a pointer type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01 06:38:04 +00:00
nobu 163cb5b43d openssl: typed data
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-04 23:33:15 +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
akr ab67419b75 * ext/openssl/ossl_bn.c (ossl_bn_initialize): Use rb_integer_pack.
Fix SEGV by OpenSSL::BN.new(1 << (2**34)).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-11 14:06:51 +00:00
akr 2b93ed5e76 * bignum.c (MSB): Removed.
(BDIGIT_MSB): Defined using BIGRAD_HALF.
  (bary_2comp): Apply BIGLO after possible over flow of BDIGIT.
  (get2comp): Ditto.
  (bary_unpack_internal): Use BDIGIT_MSB.
  Apply BIGLO after possible over flow of BDIGIT.
  (rb_integer_unpack): Use BDIGIT_MSB.
  (calc_hbase): Use BDIGMAX.
  (big2dbl): Use BDIGMAX.
  Apply BIGLO after possible over flow of BDIGIT.
  (rb_big_neg): Apply BIGLO after possible over flow of BDIGIT.
  (biglsh_bang): Ditto.
  (bigrsh_bang): Ditto.
  (bary_divmod): Use BDIGIT_MSB.
  (bigdivrem): Ditto.
  (bigxor_int): Apply BIGLO after possible over flow of BDIGIT.

* marshal.c (shortlen): Use SIZEOF_BDIGITS instead of sizeof(BDIGIT).

* ext/openssl/ossl_bn.c (ossl_bn_initialize): Use SIZEOF_BDIGITS
  instead of sizeof(BDIGIT).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-25 03:08:23 +00:00
nobu 6fb5140dd6 ossl_bn.c: reduce alloca/malloc
* ext/openssl/ossl_bn.c (ossl_bn_initialize): no need of alloca for
  small fixed size array.
* ext/openssl/ossl_bn.c (ossl_bn_initialize): check overflow first,
  and use alloca for small size input.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-28 21:58:36 +00:00
shirosaki be4aa33037 ossl_bn.c: fix ossl_bn_initialize bug with integer
* ext/openssl/ossl_bn.c (ossl_bn_initialize): fix buffer overflow on
  x64 Windows and memory leak when initializing with integer.
  [ruby-core:54615] [Bug #8337]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-28 13:20:11 +00:00
nobu adb492406c ext/openssl/ossl_bn.c: fix implicit conversion
* ext/openssl/ossl_bn.c (ossl_bn_initialize): fix precision loss by
  implicit conversion.

* ext/openssl/ossl_bn.c (ossl_bn_initialize): check Bignum overflow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-25 07:57:17 +00:00
naruse 8b29525dad * ext/openssl/ossl_bn.c (ossl_bn_initialize): allow Fixnum and Bignum.
[ruby-core:53986] [Feature #8217]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-25 07:02:31 +00:00
naruse 106595827a * ext/openssl/ossl_bn.c (ossl_bn_to_i): Use bn2hex to speed up.
In general, binary to/from decimal needs extra cost.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04 02:35:07 +00:00
naruse 7b58445ebd * ext/openssl/ossl_bn.c (ossl_bn_initialize): fix can't create from bn.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-03 18:28:56 +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
akr 1343f8c536 * ext/openssl/ossl_bn.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-19 15:47:21 +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
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