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

8325 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 27168a1cf7 [ruby/nkf] Fix a typo [ci skip]
https://github.com/ruby/nkf/commit/18c118c83c
2021-11-16 21:07:19 +09:00
Yusuke Endoh 489c8cebf5 [ruby/date] Add length limit option for methods that parses date strings
`Date.parse` now raises an ArgumentError when a given date string is
longer than 128. You can configure the limit by giving `limit` keyword
arguments like `Date.parse(str, limit: 1000)`. If you pass `limit: nil`,
the limit is disabled.

Not only `Date.parse` but also the following methods are changed.

* Date._parse
* Date.parse
* DateTime.parse
* Date._iso8601
* Date.iso8601
* DateTime.iso8601
* Date._rfc3339
* Date.rfc3339
* DateTime.rfc3339
* Date._xmlschema
* Date.xmlschema
* DateTime.xmlschema
* Date._rfc2822
* Date.rfc2822
* DateTime.rfc2822
* Date._rfc822
* Date.rfc822
* DateTime.rfc822
* Date._jisx0301
* Date.jisx0301
* DateTime.jisx0301

https://github.com/ruby/date/commit/3959accef8
2021-11-16 20:56:56 +09:00
Nobuyoshi Nakada c910de3575 [ruby/io-wait] Fix dependency for ruby 2.6
https://github.com/ruby/io-wait/commit/2eb3841e9c
2021-11-16 20:25:47 +09:00
Nobuyoshi Nakada 96d9cfba08 [ruby/io-wait] Allow earlier versions
https://github.com/ruby/io-wait/commit/1060f9348c
2021-11-16 20:25:46 +09:00
Nobuyoshi Nakada db71a04c2e [ruby/io-wait] Fix backward compatibility with earlier versions
https://github.com/ruby/io-wait/commit/898248931f
2021-11-16 20:25:43 +09:00
Hiroshi SHIBATA 018266ca38
Merge digest-3.0.3.pre3 and efd76821b8 2021-11-16 19:42:20 +09:00
Akinori MUSHA 625cffc808 [ruby/digest] Abort loading if being loaded by gem/bundle pre Ruby 3.0.3
https://github.com/ruby/digest/commit/efd76821b8
2021-11-16 18:35:13 +09:00
xtkoba fed65e6a48 [ruby/digest] Avoid null pointer subtraction in digest/md5
Fixes warning on Clang 13.

Fixes [Bug #18076]

https://github.com/ruby/digest/commit/32135c7487
2021-11-16 18:35:07 +09:00
Peter Zhu aeae6e2842 [Feature #18290] Remove all usages of rb_gc_force_recycle
This commit removes usages of rb_gc_force_recycle since it is a burden
to maintain and makes changes to the GC difficult.
2021-11-08 14:05:54 -05:00
Nobuyoshi Nakada 2772f85648
Prefer ANSI-style prototypes over old K&R-style definitions 2021-11-08 17:08:01 +09:00
Nobuyoshi Nakada b47f7afbc3
Fix filename typo [Bug #18140] 2021-11-08 17:08:01 +09:00
Nobuyoshi Nakada 5b8d22ebe6 [ruby/openssl] Fix typos [ci skip]
https://github.com/ruby/openssl/commit/708ebf2f7a
2021-11-03 23:43:04 +09:00
Yusuke Endoh 8413749ec0 ext/socket/extconf.rb: Fix the chech if if_indextoname is available
The check had not work because "headers" were not passed.
2021-11-02 23:41:01 +09:00
Nobuyoshi Nakada a202408180
Fix typos 2021-11-02 19:17:37 +09:00
Kazuki Yamaguchi b474049c78 [ruby/openssl] x509name: improve docs for X509::Name
Add docs for X509::Name.parse_openssl and X509::Name.parse_rfc2253,
which are currently undocumented despite being widely used.

Small changes are also made to #to_s and the class description to
recommend using RFC 2253-based methods.

Fixes: https://github.com/ruby/openssl/issues/470

https://github.com/ruby/openssl/commit/74041a35d4
2021-11-01 17:48:03 +09:00
Kazuki Yamaguchi 1ac7f23bb8 [ruby/openssl] ssl: disallow reading/writing to unstarted SSL socket
OpenSSL::SSL::SSLSocket allowed #read and #write to be called before an
SSL/TLS handshake is completed. They passed unencrypted data to the
underlying socket.

This behavior is very odd to have in this library. A verbose mode
warning "SSL session is not started yet" was emitted whenever this
happened. It also didn't behave well with OpenSSL::Buffering. Let's
just get rid of it.

Fixes: https://github.com/ruby/openssl/issues/9

https://github.com/ruby/openssl/commit/bf780748b3
2021-11-01 17:48:02 +09:00
Peter Zhu a5b6598192 [Feature #18239] Implement VWA for strings
This commit adds support for embedded strings with variable capacity and
uses Variable Width Allocation to allocate strings.
2021-10-25 13:26:23 -04:00
Yusuke Endoh 86e3d77abb
Make Coverage suspendable (#4856)
* Make Coverage suspendable

Add `Coverage.suspend`, `Coverage.resume` and some methods.

[Feature #18176] [ruby-core:105321]
2021-10-25 20:00:51 +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 1b5ccc8a0c [ruby/openssl] pkey, ssl: use EVP_PKEY_eq() instead of EVP_PKEY_cmp()
OpenSSL 3.0 renamed EVP_PKEY_cmp() to EVP_PKEY_eq() because that was a
confusing name.

https://github.com/ruby/openssl/commit/d42bd7fcdb
2021-10-25 00:40:47 +09:00
Kazuki Yamaguchi ee7131614c [ruby/openssl] pkey/ec: use EC_GROUP_free() instead of EC_GROUP_clear_free()
EC_GROUP_clear_free() is deprecated in OpenSSL 3.0.

EC_GROUP does not include any sensitive data, so we can safely use
EC_GROUP_free() instead.

https://github.com/ruby/openssl/commit/e93a5fdffc
2021-10-25 00:40:47 +09:00
Kazuki Yamaguchi 555788b622 [ruby/openssl] pkey/ec: deprecate PKey::EC::Point#make_affine! and make it a no-op
It converts the internal representation of the point object to the
affine coordinate system. However, it had no real use case because the
difference in the internal representation has not been visible from
Ruby/OpenSSL at all.

EC_POINT_make_affine() is marked as deprecated in OpenSSL 3.0.

https://github.com/ruby/openssl/commit/e2cc81fef7
2021-10-25 00:40:46 +09:00
Kazuki Yamaguchi 16272d9ae9 [ruby/openssl] hmac: use EVP_MD_CTX_get_pkey_ctx() instead of EVP_MD_CTX_pkey_ctx()
OpenSSL 3.0 renamed EVP_MD_CTX_pkey_ctx() to include "get" in the
function name. Adjust compatibility macro so that we can use the new
function name for all OpenSSL 1.0.2-3.0.

https://github.com/ruby/openssl/commit/c106d888c6
2021-10-25 00:40:46 +09:00
Kazuki Yamaguchi 040387d265 [ruby/openssl] digest: use EVP_MD_CTX_get0_md() instead of EVP_MD_CTX_md() if exists
The function was renamed in OpenSSL 3.0 due to the change of the
lifetime of EVP_MD objects. They are no longer necessarily statically
allocated and can be reference-counted -- when an EVP_MD_CTX is free'd,
the associated EVP_MD can also become inaccessible.

Currently Ruby/OpenSSL only handles builtin algorithms, so no special
handling is needed except for adapting to the rename.

https://github.com/ruby/openssl/commit/0a253027e6
2021-10-25 00:40:45 +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
Kazuki Yamaguchi fa24e7a57e [ruby/openssl] ssl: use SSL_get_rbio() to check if SSL is started or not
Use SSL_get_rbio() instead of SSL_get_fd(). SSL_get_fd() internally
calls SSL_get_rbio() and it's enough for our purpose.

In OpenSSL 3.0, SSL_get_fd() leaves an entry in the OpenSSL error queue
if BIO has not been set up yet, and we would have to clean it up.

https://github.com/ruby/openssl/commit/e95ee24867
2021-10-25 00:40:44 +09:00
Kazuki Yamaguchi d5aa3fcae6 [ruby/openssl] ssl: use SSL_CTX_load_verify_{file,dir}() if available
SSL_CTX_load_verify_locations() is deprecated in OpenSSL 3.0 and
replaced with those two separate functions. Use them if they exist.

https://github.com/ruby/openssl/commit/5375a55ffc
2021-10-25 00:40:44 +09:00
Kazuki Yamaguchi 19ef7082ba [ruby/openssl] ts: use TS_VERIFY_CTX_set_certs instead of TS_VERIFY_CTS_set_certs
OpenSSL 3.0 fixed the typo in the function name and replaced the
current 'CTS' version with a macro.

https://github.com/ruby/openssl/commit/2be6779b08
2021-10-25 00:40:43 +09:00
Kazuki Yamaguchi 3d16401508 [ruby/openssl] ossl.c: use ERR_get_error_all() if available
OpenSSL 3.0 deprecated ERR_get_error_line_data() in favor of
ERR_get_error_all(), as part of the error queue structure changes.

https://github.com/ruby/openssl/commit/8e98d2ecc8
2021-10-25 00:40:43 +09:00
Kazuki Yamaguchi 32d49e93cf [ruby/openssl] ext/openssl/ossl.h: add helper macros for OpenSSL/LibreSSL versions
Add following convenient macros:

 - OSSL_IS_LIBRESSL
 - OSSL_OPENSSL_PREREQ(maj, min, pat)
 - OSSL_LIBRESSL_PREREQ(maj, min, pat)

https://github.com/ruby/openssl/commit/00abee791d
2021-10-25 00:40:42 +09:00
Hiroshi SHIBATA 1be2875e1d
[flori/json] Bump version to v2.6.1
https://github.com/flori/json/commit/2db5894cfa
2021-10-24 09:25:20 +09:00
Josef Šimánek 4cbce79438
[flori/json] Bump JSON::VERSION to 2.6.0.
https://github.com/flori/json/commit/da94d9f059
2021-10-24 09:25:01 +09:00
David Rodríguez d04d6bbc6c [ruby/psych] Prefer `require_relative` for internal requires
https://github.com/ruby/psych/commit/a0f55ee85a
2021-10-24 08:49:14 +09:00
Josef Šimánek 48cd633094 [ruby/psych] Add stringio as a dependency.
https://github.com/ruby/psych/commit/86e3049579
2021-10-24 08:48:40 +09:00
Sutou Kouhei c0c43276a1 [ruby/strscan] Bump version
If we use the same version as the default strscan gem in Ruby, "gem
install" doesn't extract .gem. It fails "gem install" because "gem
install" can't find ext/strscan/ to be built.

https://github.com/ruby/strscan/commit/3ceafa6cdc
2021-10-24 05:57:48 +09:00
Aaron Patterson 35b9d8d393 [ruby/openssl] Raise an exception if the IO object passed to SSLSocket isn't a file
SSLSocket#connect eventually calls `GetOpenFile` in order to get the
underlying file descriptor for the IO object passed in on
initialization.  `GetOpenFile` assumes that the Ruby object passed in is
a T_FILE object and just casts it to a T_FILE without any checks.  If
you pass an object that *isn't* a T_FILE to that function, the program
will segv.

Since we assume the IO object is a file in the `connect` method, this
commit adds a `CheckType` in the initialize method to ensure that the IO
object is actually a T_FILE.  If the object *isn't* a T_FILE, this class
will segv on `connect`, so I think this is a backwards compatible
change.

https://github.com/ruby/openssl/commit/919fa44ec2
2021-10-23 13:38:40 +09:00
Hiroshi SHIBATA 93691d0752
Import bigdecimal-3.1.0.dev 2021-10-22 15:53:49 +09:00
Hiroshi SHIBATA c5345979e8
Bump up readline-ext version to 0.1.3 2021-10-21 21:17:45 +09:00
Hiroshi SHIBATA 7529fe82f0 [ruby/io-wait] Bump up io-wait version to 0.2.0
https://github.com/ruby/io-wait/commit/f6a1b10a59
2021-10-21 20:54:20 +09:00
Hiroshi SHIBATA 8eb8522f47 [ruby/stringio] Bump up stringio version to 3.0.1
https://github.com/ruby/stringio/commit/f7c40aa339
2021-10-21 20:53:53 +09:00
Hiroshi SHIBATA 5823168706 [ruby/psych] Bump up psych version to 4.0.2
https://github.com/ruby/psych/commit/69a713f860
2021-10-21 13:49:20 +09:00
Alan Wu c02517bacb Tie lifetime of uJIT blocks to iseqs
* Tie lifetime of uJIT blocks to iseqs

   Blocks weren't being freed when iseqs are collected.

* Add rb_dary. Use it for method dependency table

* Keep track of blocks per iseq

  Remove global version_tbl

* Block version bookkeeping fix

* dary -> darray

* free ujit_blocks

* comment about size of ujit_blocks
2021-10-20 18:19:29 -04:00
Hiroshi SHIBATA 847eeafd65 [ruby/etc] Bump up etc version to 1.3.0
https://github.com/ruby/etc/commit/85ca541d0b
2021-10-19 20:55:33 +09:00
Hiroshi SHIBATA b482a516d2 [ruby/zlib] Bump up zlib version to 2.1.1
https://github.com/ruby/zlib/commit/82e9a636a6
2021-10-19 20:28:57 +09:00
Nobuyoshi Nakada ae25313e80
[ruby/etc] Remove unnecessary declaration
Fix https://github.com/ruby/etc/pull/12

https://github.com/ruby/etc/commit/7cbf03d22d
2021-10-19 17:25:40 +09:00
Kazuki Yamaguchi cc8ff8b50d [ruby/openssl] require Ruby 2.6 or later
Drop support for Ruby 2.3, 2.4, and 2.5.

As of 2021-10, Ruby 2.6 is the oldest version that still receives
security fixes from the Ruby core team, so it doesn't make much sense
to keep code for those ancient versions.

https://github.com/ruby/openssl/commit/3436bd040d
2021-10-16 19:39:13 +09:00
Kazuki Yamaguchi 4991dabdd0 [ruby/openssl] bump version number to 3.0.0.pre
https://github.com/ruby/openssl/commit/baa83a8a57
2021-10-16 18:57:57 +09:00
Kazuki Yamaguchi cea3c55d58 [ruby/openssl] Ruby/OpenSSL 2.2.1
https://github.com/ruby/openssl/commit/65e7207a07
2021-10-16 18:34:35 +09:00
Kazuki Yamaguchi 75e72baba1 [ruby/openssl] Ruby/OpenSSL 2.1.3
https://github.com/ruby/openssl/commit/e8ee01b22c
2021-10-16 18:34:35 +09:00
Kazuki Yamaguchi c1147f7f71 [ruby/openssl] ssl: avoid directly storing String object in NPN callback
On the server side, the serialized list of protocols is stored in
SSL_CTX as a String object reference. We utilize a hidden instance
variable to prevent it from being GC'ed, but this is not enough because
it can also be relocated by GC.compact.

https://github.com/ruby/openssl/commit/5eb68ba778
2021-10-16 18:34:35 +09:00
Kazuki Yamaguchi f6612203fa [ruby/openssl] x509store: explicitly call rb_gc_mark() against Store/StoreContext
We store the reverse reference to the Ruby object in the OpenSSL
struct for use from OpenSSL callback functions. To prevent the Ruby
object from being relocated by GC.compact, we must "pin" it by calling
rb_gc_mark().

https://github.com/ruby/openssl/commit/a6ba9f894f
2021-10-16 18:34:35 +09:00
Kazuki Yamaguchi ca28545b51 [ruby/openssl] ssl: explicitly call rb_gc_mark() against SSLContext/SSLSocket objects
We store the reverse reference to the Ruby object in the OpenSSL
struct for use from OpenSSL callback functions. To prevent the Ruby
object from being relocated by GC.compact, we must "pin" it by calling
rb_gc_mark().

https://github.com/ruby/openssl/commit/022b7ceada
2021-10-16 18:34:35 +09:00
Kazuki Yamaguchi c6c2190c4c [ruby/openssl] digest: load digest library using Kernel#require
The digest library is a default gem now, too. Therefore we can't simply
use rb_require() to load it, but we should use Kernel#require instead.

This change is based on the suggestion by David Rodríguez in
16172612d5 (commitcomment-57778397)

https://github.com/ruby/openssl/commit/157f80794b
2021-10-16 18:34:35 +09:00
Nobuhiro IMAI f88401f38e [ruby/openssl] fix segv in Timestamp::{Request,Response,TokenInfo}.new
prevent `ossl_ts_*_free()` from calling when `d2i_TS_*_bio()` failed.

https://github.com/ruby/openssl/commit/b29e215786
2021-10-16 18:34:35 +09:00
David Carlier 6dcc74155f [ruby/openssl] ts: libressl build fix warning
TS_time_cb on libressl expects an long long/time_t 64 bits long instead.

https://github.com/ruby/openssl/commit/4c99f577b2
2021-10-16 18:34:35 +09:00
Kazuki Yamaguchi daeb914a52 [ruby/openssl] ssl: temporary lock string buffer while reading
Similarly to SSLSocket#syswrite, the blocking SSLSocket#sysread allows
context switches. We must prevent other threads from modifying the
string buffer.

We can use rb_str_locktmp() and rb_str_unlocktmp() to temporarily
prohibit modification of the string.

https://github.com/ruby/openssl/commit/d38274949f
2021-10-16 18:34:35 +09:00
Kazuki Yamaguchi 5828807626 [ruby/openssl] ssl: create a temporary frozen string buffer when writing
Since a blocking SSLSocket#syswrite call allows context switches while
waiting for the underlying socket to be ready, we must freeze the string
buffer to prevent other threads from modifying it.

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

https://github.com/ruby/openssl/commit/aea874bc6e
2021-10-16 18:25:28 +09:00
Kazuki Yamaguchi 6105ef7629 [ruby/openssl] ssl: add SSLContext#tmp_dh=
Provide a wrapper of SSL_set0_tmp_dh_pkey()/SSL_CTX_set_tmp_dh(), which
sets the DH parameters used for ephemeral DH key exchange.

SSLContext#tmp_dh_callback= already exists for this purpose, as a
wrapper around SSL_CTX_set_tmp_dh_callback(), but it is considered
obsolete and the OpenSSL API is deprecated for future removal. There is
no practical use case where an application needs to use different DH
parameters nowadays. This was originally introduced to support export
grade ciphers.

RDoc for #tmp_dh_callback= is updated to recommend the new #tmp_dh=.

Note that current versions of OpenSSL support automatic ECDHE curve
selection which is enabled by default. SSLContext#tmp_dh= should only be
necessary if you must allow ancient clients which don't support ECDHE.

https://github.com/ruby/openssl/commit/aa43da4f04
2021-10-16 18:19:52 +09:00
Kazuki Yamaguchi 49217086ad [ruby/openssl] ssl: remove private method SSLSocket#tmp_ecdh_callback
Commit ee037e146037 ("ssl: remove SSL::SSLContext#tmp_ecdh_callback",
2020-08-12) forgot to remove the method.

https://github.com/ruby/openssl/commit/bef9ea84e4
2021-10-16 18:19:51 +09:00
Sutou Kouhei 027a3379d6 [ruby/zlib] Fix a bug that GZipReader#gets may return incomplete line
See also: https://github.com/ruby/csv/issues/117#issuecomment-933289373

How to reproduce with x.csv.gz in the issue comment:

    Zlib::GzipReader.open("x.csv.gz") do |rio|
      rio.gets(nil, 1024)
      while line = rio.gets(nil, 8192)
        raise line unless line.valid_encoding?
      end
    end

Reported by Dimitrij Denissenko. Thanks!!!

https://github.com/ruby/zlib/commit/b1f182e98f
2021-10-15 15:31:15 +09:00
Nobuyoshi Nakada e057b9eea9
Prefer the reentrant versions of gmtime and localtime 2021-10-14 23:44:15 +09:00
Hiroshi SHIBATA 2fa0d51ac9 [ruby/date] Bump up date version to 3.2.0
https://github.com/ruby/date/commit/e0a4cbc8f6
2021-10-14 21:15:57 +09:00
Hiroshi SHIBATA b7f557178d [ruby/pathname] Bump up pathname version to 0.2.0
https://github.com/ruby/pathname/commit/e6b3b3ed25
2021-10-14 21:08:03 +09:00
Hiroshi SHIBATA f88628014a [ruby/nkf] Bump up nkf version to 0.1.1
https://github.com/ruby/nkf/commit/9aa7c6b841
2021-10-14 20:29:27 +09:00
Nobuyoshi Nakada d210950196
[ruby/etc] Get rid of alloca in the loop
https://github.com/ruby/etc/commit/c989bacc4c
2021-10-14 18:44:27 +09:00
Hiroshi SHIBATA 1220556f33
[ruby/fcntl] Bump up fcntl version to 1.0.1
https://github.com/ruby/fcntl/commit/0bcc0c4518
2021-10-14 17:18:21 +09:00
Hiroshi SHIBATA 91c2069dcf [flori/json] Bump up json version to 2.6.0
https://github.com/flori/json/commit/1942689b67
2021-10-14 17:04:37 +09:00
Hiroshi SHIBATA 6b13448040 [ruby/zlib] Bump up zlib version to 2.1.0
https://github.com/ruby/zlib/commit/dd593acaee
2021-10-14 16:18:41 +09:00
Hiroshi SHIBATA db500f05c2 [ruby/zlib] Bump version to v2.0.0
https://github.com/ruby/zlib/commit/434eba55ae
2021-10-14 16:18:36 +09:00
Hiroshi SHIBATA 9e86a60306
Removed redundant digest namespace 2021-10-14 14:07:50 +09:00
Hiroshi SHIBATA 3265af2f9e
separate pure ruby location under the digest/* extensions 2021-10-14 13:31:45 +09:00
Hiroshi SHIBATA 13772caee2
Move pure ruby files under the ext/gemname/lib directory. 2021-10-14 13:23:45 +09:00
Nobuyoshi Nakada 013bac15b0
Fix libraries under digest 2021-10-12 22:32:42 +09:00
Akinori MUSHA 01dc55ffad
[ruby/digest] Bump version to 3.1.0.pre2
https://github.com/ruby/digest/commit/5184207611
2021-10-12 20:53:18 +09:00
Akinori MUSHA ab787c493b
[ruby/digest] Bump version to 3.1.0.pre1
https://github.com/ruby/digest/commit/56679008cf
2021-10-12 20:53:18 +09:00
Pavel Rosický 10a0fac7e4
[ruby/digest] include jars
https://github.com/ruby/digest/commit/c15cbcd978
2021-10-12 20:53:17 +09:00
Akinori MUSHA e94bcda025
[ruby/digest] Bump version to 3.1.0.pre0
https://github.com/ruby/digest/commit/594cc4d548
2021-10-12 20:53:17 +09:00
Akinori MUSHA b245b67d9e
[ruby/digest] Place common parts in lib and engine specific parts under ext/**/lib
https://github.com/ruby/digest/commit/8d7496c3be
2021-10-12 20:53:16 +09:00
Pavel Rosický 5e1d2c5c97
[ruby/digest] relicence under the Ruby license and the BSD 2-clause
https://github.com/ruby/digest/commit/154d461e91
2021-10-12 20:46:16 +09:00
Pavel Rosický 94882df3a2
[ruby/digest] jruby support
https://github.com/ruby/digest/commit/2e9dc14693
2021-10-12 20:46:13 +09:00
Nobuyoshi Nakada ff1f696d30
[ruby/digest] Move digest.rb back under ext as the extension bundled library
https://github.com/ruby/digest/commit/026ba7f361
2021-10-12 20:44:14 +09:00
Kazuhiro NISHIYAMA 8dd6d58543 Add more socket constants
from http://manpages.ubuntu.com/manpages/focal/en/man2/socket.2.html
2021-10-12 16:45:22 +09:00
卜部昌平 5c167a9778 ruby tool/update-deps --fix 2021-10-05 14:18:23 +09:00
Rei Odaira ceeae31901 Avoid using the altzone variable in AIX
In AIX, altzone exists in the standard library but is not declared
in time.h.  By 524513be39, have_var
and try_var in mkmf recognizes a variable that exists in a library
even when it is not declared.  As a result, in AIX, HAVE_ALTZONE
is defined, but compile fails due to the lack of the declaration.
2021-10-02 21:23:34 -05:00
Jeremy Evans f9f7f3a75e [ruby/date] Make %v strftime flag use uppercase month
%v is supposed to be the VMS date, and VMS date format uses an
uppercase month.

Ruby 1.8 used an uppercase month for %v, but the behavior was
changed without explanation in r31672.

Time#strftime still uses an uppercase month for %v, so this change
makes Date#strftime consistent with Time#strftime.

Fixes [Bug #13810]

https://github.com/ruby/date/commit/56c489fd7e
2021-09-28 17:34:26 +09:00
Kazuhiro NISHIYAMA e0c6e8c64a
[DOC] Use `unpack1` instead of `unpack(template)[0]` [ci skip] 2021-09-23 09:20:00 +09:00
Nobuyoshi Nakada 289f3a79b5 [ruby/openssl] Add fallthrough comments
https://github.com/ruby/openssl/commit/258e30b640
2021-09-12 22:49:07 +09:00
Nobuyoshi Nakada 6920f3dc96 [ruby/openssl] Suppress cast-function-type warnings
https://github.com/ruby/openssl/commit/0f91e2a6ee
2021-09-12 22:49:05 +09:00
Nobuyoshi Nakada 598d66f6b2 [ruby/openssl] Separate formatting from ossl_make_error
Just append OpenSSL error reason to the given message string
object, which would be alreadly formatted.
Suppress -Wformat-security warning in `ossl_tsfac_create_ts`.

https://github.com/ruby/openssl/commit/11b1d8a6b8
2021-09-12 22:49:03 +09:00
Nobuyoshi Nakada c7dce12eb9 [ruby/openssl] Suppress printf format warnings
* Add `printf` format attribute to `ossl_raise`.
* Fix a format specifier in `config_load_bio`.
* Use `ASSUME` for the unreachable condition.

https://github.com/ruby/openssl/commit/41da2955db
2021-09-12 22:49:01 +09:00
Nobuyoshi Nakada 2bd6c5dc16 [ruby/date] Ignore warned variables
To suppress warnings at the compilation time.

https://github.com/ruby/date/commit/ff21132203
2021-09-09 13:56:13 +09:00
Hiroshi SHIBATA 8f752c95d2
[ruby/fiddle] Use test-unit gem (https://github.com/ruby/fiddle/pull/69)
https://github.com/ruby/fiddle/commit/e08c4c635e

Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2021-09-05 17:43:48 +09:00
Nobuyoshi Nakada afa33da72b [ruby/fiddle] Create extconf header for MSVC
Not to include parenthesized argument.

https://github.com/ruby/fiddle/commit/c2c921e16a
2021-09-05 17:31:46 +09:00
Nobuyoshi Nakada ab63f6d854
Refined test [Bug #18140] 2021-09-02 09:11:41 +09:00
Aaron Patterson 8db269edb3
Guard array when appending
This prevents early collection of the array.  The GC doesn't see the
array on the stack when Ruby is compiled with optimizations enabled

Thanks @jhaberman for the test case

[ruby-core:105099] [Bug #18140]
2021-09-01 10:58:20 -07:00
Nobuyoshi Nakada d3155e3632 [ruby/zlib] Don't print out warnings when finalizing
https://github.com/ruby/zlib/commit/44a56d36e7
2021-08-31 23:20:42 +09:00
Nobuyoshi Nakada 31c427511c [ruby/zlib] Revert "Don't print out warnings when freeing."
https://github.com/ruby/zlib/commit/931aa7a272
2021-08-31 23:20:40 +09:00
jory-graham db154b20cc [ruby/psych] Replace A-Za-z with [:alpha:]
https://github.com/ruby/psych/commit/8ec36494fb
2021-08-31 19:34:54 +09:00
Aaron Patterson 9ed2cb26de [ruby/psych] Add quotes to the strings "y" and "n"
'y' and 'n' are kind of ambiguous.  Syck treated y and n literals in
YAML documents as strings.  But this is not what the YAML 1.1 spec says.
YAML 1.1 says they should be treated as booleans.  When we're dumping
documents, we know it's a string, so adding quotes will eliminate the
"ambiguity" in the emitted document

Fixes #443

https://github.com/ruby/psych/commit/6a1c30634e
2021-08-31 19:34:46 +09:00
opak 0925fddc80 [ruby/psych] Update lib/psych/scalar_scanner.rb
https://github.com/ruby/psych/commit/64cc239557

Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
2021-08-31 19:34:36 +09:00
Alexandr Opak 44353d0dee [ruby/psych] add more tests
https://github.com/ruby/psych/commit/8f71222bf3
2021-08-31 19:34:28 +09:00
Alexandr Opak 48b50cb4fe [ruby/psych] fix parsing integer values with '_' at the end
https://github.com/ruby/psych/commit/e0bb853014
2021-08-31 19:34:13 +09:00
Tomer Brisker 31ba0921f8 [ruby/psych] Improve float scalar scanner
Previously, `+.inf` was not handled correctly. Additionally, the regexp
was checking for inf and NaN, even though these cases are handled earlier
in the condition. Added a few tests to ensure handling some missing
cases.

https://github.com/ruby/psych/commit/6e0e7a1e9f
2021-08-31 19:34:06 +09:00
Samuel Williams d19af1675c [ruby/zlib] Don't print out warnings when freeing.
https://github.com/ruby/zlib/commit/098c50255d
2021-08-31 19:33:38 +09:00
Nobuyoshi Nakada 2dd26bed86
[Feature #16972] Add mode: option to Pathname#mkpath 2021-08-31 11:53:41 +09:00
schneems 51070ee5c4 Faster Pathname FileUtils methods
Currently when calling any of the "FileUtils" methods on pathname `require` is called every time even though that library might already be loaded. This is slow:

We can speed it up by either checking first if the constant is already defined, or by using autoload.

Using defined speeds up the action by about 300x and using autoload is about twice as fast as that (600x faster than current require method).

I'm proposing we use autoload:

```ruby
require 'benchmark/ips'

Benchmark.ips do |x|
  autoload(:FileUtils, "fileutils")
  x.report("require") { require 'fileutils' }
  x.report("defined") { require 'fileutils' unless defined?(FileUtils) }
  x.report("autoload") { FileUtils }

  x.compare!
end

# Warming up --------------------------------------
#              require     3.624k i/100ms
#              defined     1.465M i/100ms
#             autoload     2.320M i/100ms
# Calculating -------------------------------------
#              require     36.282k (± 2.4%) i/s -    184.824k in   5.097153s
#              defined     14.539M (± 2.0%) i/s -     73.260M in   5.041161s
#             autoload     23.100M (± 1.9%) i/s -    115.993M in   5.023271s

# Comparison:
#             autoload: 23099779.2 i/s
#              defined: 14538544.9 i/s - 1.59x  (± 0.00) slower
#              require:    36282.3 i/s - 636.67x  (± 0.00) slower
```

Because this autoload is scoped to Pathname it will not change the behavior of existing programs that are not expecting FileUtils to be loaded yet:

```
ruby -rpathname -e "class Pathname; autoload(:FileUtils, 'fileutils'); end; puts FileUtils.exist?"
Traceback (most recent call last):
-e:1:in `<main>': uninitialized constant FileUtils (NameError)
```
2021-08-30 15:18:11 +09:00
Peter Zhu c08d4067be [Feature #18045] Remove T_PAYLOAD
This commit removes T_PAYLOAD since the new VWA implementation no longer
requires T_PAYLOAD types.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-08-25 09:28:21 -04:00
Aaron Patterson 0f1e8f38c9 [ruby/fiddle] Improve "offsetof" calculations (https://github.com/ruby/fiddle/pull/90)
I need to get the offset of members inside sub structures.  This patch
adds sub-structure offset support for structs.

https://github.com/ruby/fiddle/commit/cf78eddbb6
2021-08-24 16:18:22 +09:00
Peter Zhu eddd369e73 Revert "[Feature #18045] Implement size classes for GC"
This reverts commits 48ff7a9f3e
and b2e2cf2ded because it is causing
crashes in SPARC solaris and i386 debian.
2021-08-23 10:54:53 -04:00
Peter Zhu 48ff7a9f3e [Feature #18045] Remove T_PAYLOAD
This commit removes T_PAYLOAD since the new VWA implementation no longer
requires T_PAYLOAD types.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2021-08-23 09:15:42 -04:00
Nobuyoshi Nakada 0b9a3371ea [ruby/date] Add zontab.list dependency
https://github.com/ruby/date/commit/7e1ffbf568
2021-08-22 20:28:52 +09:00
Mike Dalessio c0f4e4ca6d undefine alloc functions for C extensions
per guidance in doc/extension.rdoc, these classes now undefine their
alloc functions:

- ObjectSpace::InternalObjectWrapper
- Socket::Ifaddr
2021-08-20 08:30:06 +09:00
Nobuyoshi Nakada 36ae44ce2c
[ruby/date] Update zonetab.h at 2021-08-11
https://github.com/ruby/date/commit/de7dca353f
2021-08-17 22:57:59 +09:00
Nobuyoshi Nakada b8f7e8ac6b
Include ruby.h before internal headers to suppress -Wundef warnings 2021-08-09 19:25:18 +09:00
Nobuyoshi Nakada ae275f67ce Show WorkingSetSize as RSS on Windows 2021-08-05 17:14:38 +09:00
Nobuyoshi Nakada 3b52230452
Define functions using rb_wait_for_single_fd [Bug #18046] 2021-08-01 06:49:07 +09:00
Nobuyoshi Nakada 7564e066ff
Renamed thraed_fd_close as thread_fd 2021-07-29 21:15:04 +09:00
Hiroshi SHIBATA a889ab486e
Update the latest version of json.gemspec from flori/json 2021-07-29 15:57:58 +09:00
Rhys Powell e99d2d066f [ruby/psych] fix: use git repository link for LibYAML in docs
LibYAML has moved from their previous Mercurial based hosting on BitBucket to a git repository on GitHub. This commit updates the `Psych` module's documentation to point to this new repository, instead of the old one which is now a 404.

https://github.com/ruby/psych/commit/947a84d0dd
2021-07-29 15:54:41 +09:00
Jeremy Evans b3d62a77d9 [ruby/zlib] Synchronize access to zstream to prevent segfault in multithreaded use
I'm not sure whether this handles all multithreaded use cases,
but this handles the example that crashes almost immediately
and does 10,000,000 total deflates using 100 separate threads.

To prevent the tests from taking forever, the committed test
for this uses only 10,000 deflates across 10 separate threads,
which still causes a segfault in the previous implementation
almost immediately.

Fixes [Bug #17803]

https://github.com/ruby/zlib/commit/4b1023b3f2
2021-07-28 13:40:03 +09:00
Hiroshi SHIBATA 30d0e5d1ae
[ruby/digest] Also drop to support Ruby 2.4
https://github.com/ruby/digest/commit/360a7de366
2021-07-28 11:48:36 +09:00
Hiroshi SHIBATA 260546ba26
[ruby/digest] Use Gemfile instead of Gem::Specification#add_development_dependency
https://github.com/ruby/digest/commit/460a6f807e
2021-07-28 11:48:36 +09:00
Hiroshi SHIBATA 5b96f4dd8c
[ruby/digest] Drop to support Ruby 2.3
https://github.com/ruby/digest/commit/23dc9c7425
2021-07-28 11:48:36 +09:00
Olle Jonsson 26e859b5c7
[ruby/digest] gemspec: Avoid distributing extraneous files
https://github.com/ruby/digest/commit/0a451e0c94
2021-07-28 11:48:36 +09:00
Olle Jonsson add48acea3
[ruby/digest] gemspec: Explicitly have 0 executables
https://github.com/ruby/digest/commit/086d54ba94
2021-07-28 11:48:36 +09:00
Olle Jonsson 478f0ddb5f
[ruby/digest] Experiment: Use a .pre version in gemspec
This makes it slightly more explicit that this is not a definite new version.

https://github.com/ruby/digest/commit/2bb5bb78a3
2021-07-28 11:48:36 +09:00
Olle Jonsson 73c5d4d54e
[ruby/digest] Experiment: bump patch version
This is a test, to see if the build failures are about the shipped Ruby master version of this gem.

https://github.com/ruby/digest/commit/d2606b2cce
2021-07-28 11:48:36 +09:00
Nobuyoshi Nakada 070557afc4 Distinguish signal and timeout [Bug #16608] 2021-07-25 13:09:03 -07:00
Benoit Daloze 9b972310fa [ruby/racc] Add missing check for rb_block_call()
* It used to be hardcoded since 0affbf9d2c7c5c618b8d3fe191e74d9ae8ad22fc
  but got removed in 23abf3d3fb82afcc26d35769f0dec59dd46de4bb
* This means that since that second commit, rb_iterate() was used unintentionally.

https://github.com/ruby/racc/commit/8816ced525
2021-07-18 20:38:34 +09:00
Kazuki Yamaguchi bd356c6899 [ruby/openssl] Strip trailing spaces
https://github.com/ruby/openssl/commit/68fa9c86f1
2021-07-18 18:04:50 +09:00
Samuel Williams 3f1d8a18ea [ruby/openssl] Deprecate and rework old (fd) centric functions
[ky: fixed compatibility with older versions of Ruby]

(cherry picked from commit ruby/ruby@45e65f302b)

https://github.com/ruby/openssl/commit/8d928e0fb9
2021-07-18 17:48:49 +09:00
Benoit Daloze 3975840780 [ruby/openssl] Use rb_block_call() instead of the deprecated rb_iterate() in OpenSSL
* See https://bugs.ruby-lang.org/issues/18025
  and https://github.com/ruby/ruby/pull/4629

https://github.com/ruby/openssl/commit/b8e4852dcc
2021-07-18 17:48:49 +09:00
Yusuke Nakamura 11651ab703 [ruby/openssl] Add example to OpenSSL::KDF.hkdf method (https://github.com/ruby/openssl/pull/447)
The values from RFC 5869
https://datatracker.ietf.org/doc/html/rfc5869#appendix-A.1

https://github.com/ruby/openssl/commit/ec14a87f4f
2021-07-18 17:48:49 +09:00
Kazuki Yamaguchi 70f0a802fe [ruby/openssl] use Bundler for dependency management and Rake gem tasks
Back in 2016, we chose not to use Bundler in Ruby/OpenSSL development
because Bundler depended on openssl and could not be used for testing
openssl itself - "bundle exec rake test" would end up with loading two
different versions of openssl at the same time.

This has been resolved long time ago. We can now safely use it for
development dependency management and for Rake tasks.

https://github.com/ruby/openssl/commit/47283d9161
2021-07-18 17:48:42 +09:00
Vinicius Stock 4f7c3f631a [ruby/openssl] Include peer socket IP address in errors
https://github.com/ruby/openssl/commit/8a1e3f5085
2021-07-18 17:45:03 +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 5fc2912e60 [ruby/openssl] pkey/dsa: refactor DSA#sys{sign,verify} with PKey#{sign,verify}_raw
With the newly added OpenSSL::PKey::PKey#{sign,verify}_raw,
OpenSSL::PKey::DSA's low level signing operation methods can be
implemented in Ruby. The definitions are now in lib/openssl/pkey.rb.

https://github.com/ruby/openssl/commit/ce805adf0c
2021-07-18 17:45:01 +09:00
Kazuki Yamaguchi 0c23e4a7aa [ruby/openssl] pkey/ec: refactor EC#dsa_{sign,verify}_asn1 with PKey#{sign,verify}_raw
With the newly added OpenSSL::PKey::PKey#{sign,verify}_raw,
OpenSSL::PKey::EC's low level signing operation methods can be
implemented in Ruby. The definitions are now in lib/openssl/pkey.rb.

https://github.com/ruby/openssl/commit/1f9da0cd9d
2021-07-18 17:45:00 +09:00
Kazuki Yamaguchi 857a177b03 [ruby/openssl] pkey/rsa: port RSA#{private,public}_{encrypt,decrypt} to the EVP API
Implement these methods using the new OpenSSL::PKey::PKey#{encrypt,sign}
family. The definitions are now in lib/openssl/pkey.rb.

Also, recommend using those generic methods in the documentation.

https://github.com/ruby/openssl/commit/2dfc1779d3
2021-07-18 17:44:59 +09:00
Kazuki Yamaguchi 4ebff35971 [ruby/openssl] pkey: implement PKey#sign_raw, #verify_raw, and #verify_recover
Add a variant of PKey#sign and #verify that do not hash the data
automatically.

Sometimes the caller has the hashed data only, but not the plaintext
to be signed. In that case, users would have to use the low-level API
such as RSA#private_encrypt or #public_decrypt directly.

OpenSSL 1.0.0 and later supports EVP_PKEY_sign() and EVP_PKEY_verify()
which provide the same functionality as part of the EVP API. This patch
adds wrappers for them.

https://github.com/ruby/openssl/commit/16cca4e0c4
2021-07-18 17:44:58 +09:00
Kazuki Yamaguchi cbc560e38f [ruby/openssl] pkey: update version reference in #sign and #verify documentation
The next release is decided to be 3.0 rather than 2.3.

https://github.com/ruby/openssl/commit/b8a434e462
2021-07-18 17:44:58 +09:00
Kazuki Yamaguchi 87458ff2ae [ruby/openssl] pkey: implement PKey#encrypt and #decrypt
Support public key encryption and decryption operations using the EVP
API.

https://github.com/ruby/openssl/commit/75326d4bbc
2021-07-18 17:44:57 +09:00
Kazuki Yamaguchi eac7fd57f8 [ruby/openssl] pkey: remove deprecated parameter setters
Remove the following methods, which have been marked as deprecated and
produced a warning since version 2.0, commit 7ea72f1f5084 ("adapt
OpenSSL::PKey to OpenSSL 1.1.0 opaque structs", 2016-06-05).

 - OpenSSL::PKey::RSA#n=, #e=, #d=, #p=, #q=, #dmp1=, #dmq1=, #iqmp=
 - OpenSSL::PKey::DSA#p=, #q=, #g=, #priv_key=, #pub_key=
 - OpenSSL::PKey::DH#p=, #g=, #priv_key=, #pub_key=

These methods could only work with OpenSSL 1.0.2 or older, which is now
EOL.

https://github.com/ruby/openssl/commit/2334862cc0
2021-07-18 17:44:56 +09:00
Samuel Williams 1146a94aee [ruby/openssl] Implement `Certificate.load` to load certificate chain. (https://github.com/ruby/openssl/pull/441)
* Add feature for loading the chained certificate into Certificate array.

https://github.com/ruby/openssl/commit/05e1c015d6

Co-authored-by: Sao I Kuan <saoikuan@gmail.com>
2021-07-18 17:44:55 +09:00
Kazuki Yamaguchi a01daab656 [ruby/openssl] x509, ssl, pkcs7: try to parse as DER-encoding first
Methods that take both PEM-encoding and DER-encoding have not been
consistent in the order in which encoding to attempt to parse.

A DER-encoding may contain a valid PEM block ("\n-----BEGIN ..-----" to
"-----END ...-----") embedded within it. Also, the PEM-encoding parser
allows arbitrary data around the PEM block and silently skips it. As a
result, attempting to parse data in DER-encoding as PEM-encoding first
can incorrectly finds the embedded PEM block instead.

This commit ensures that DER encoding will always be attempted before
PEM encoding. OpenSSL::X509::Certificate is one of the updated classes.
With this, the following will always be true:

    # obj is an OpenSSL::X509::Certificate
    obj == OpenSSL::X509::Certificate.new(obj.to_der)
    obj == OpenSSL::X509::Certificate.new(obj.to_pem)

https://github.com/ruby/openssl/commit/b280eb1fd0
2021-07-18 17:44:54 +09:00
Ryuta Kamizono 29ad4ab3d0 [ruby/openssl] Fix some typos [ci skip]
https://github.com/ruby/openssl/commit/51b3030b2b
2021-07-18 17:44:54 +09:00
Aaron Patterson 593164c2be [ruby/openssl] Add SSLSocket#getbyte
Normal sockets respond to `getbyte`, so we should make SSLSocket respond
to `getbyte` as well.  This way we can substitute SSLSockets for regular
sockets.

https://github.com/ruby/openssl/commit/ac1490b7c9
2021-07-18 17:44:53 +09:00
Kazuki Yamaguchi 6d71918d94 [ruby/openssl] pkey/dh, pkey/ec: use EVP_PKEY_check() family
Use EVP_PKEY_param_check() instead of DH_check() if available. Also,
use EVP_PKEY_public_check() instead of EC_KEY_check_key().

EVP_PKEY_*check() is part of the EVP API and is meant to replace those
low-level functions. They were added by OpenSSL 1.1.1. It is currently
not provided by LibreSSL.

https://github.com/ruby/openssl/commit/797e9f8e08
2021-07-18 17:44:52 +09:00
Kazuki Yamaguchi 3fe8387950 [ruby/openssl] pkey: implement {DH,DSA,RSA}#public_key in Ruby
The low-level API that is used to implement #public_key is deprecated
in OpenSSL 3.0. It is actually very simple to implement in another way,
using existing methods only, in much shorter code. Let's do it.

While we are at it, the documentation is updated to recommend against
using #public_key. Now that OpenSSL::PKey::PKey implements public_to_der
method, there is no real use case for #public_key in newly written Ruby
programs.

https://github.com/ruby/openssl/commit/48a6c391ef
2021-07-18 17:44:51 +09:00