Commit graph

8776 commits

Author SHA1 Message Date
Kazuki Yamaguchi
75e72baba1 [ruby/openssl] Ruby/OpenSSL 2.1.3
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.

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().

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().

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)

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.

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.

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.

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

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.

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.

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!!!

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
e0a4cbc8f6
2021-10-14 21:15:57 +09:00
Hiroshi SHIBATA
b7f557178d [ruby/pathname] Bump up pathname version to 0.2.0
e6b3b3ed25
2021-10-14 21:08:03 +09:00
Hiroshi SHIBATA
f88628014a [ruby/nkf] Bump up nkf version to 0.1.1
9aa7c6b841
2021-10-14 20:29:27 +09:00
Nobuyoshi Nakada
d210950196
[ruby/etc] Get rid of alloca in the loop
c989bacc4c
2021-10-14 18:44:27 +09:00
Hiroshi SHIBATA
1220556f33
[ruby/fcntl] Bump up fcntl version to 1.0.1
0bcc0c4518
2021-10-14 17:18:21 +09:00
Hiroshi SHIBATA
91c2069dcf [flori/json] Bump up json version to 2.6.0
1942689b67
2021-10-14 17:04:37 +09:00
Hiroshi SHIBATA
6b13448040 [ruby/zlib] Bump up zlib version to 2.1.0
dd593acaee
2021-10-14 16:18:41 +09:00
Hiroshi SHIBATA
db500f05c2 [ruby/zlib] Bump version to v2.0.0
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
5184207611
2021-10-12 20:53:18 +09:00
Akinori MUSHA
ab787c493b
[ruby/digest] Bump version to 3.1.0.pre1
56679008cf
2021-10-12 20:53:18 +09:00
Pavel Rosický
10a0fac7e4
[ruby/digest] include jars
c15cbcd978
2021-10-12 20:53:17 +09:00
Akinori MUSHA
e94bcda025
[ruby/digest] Bump version to 3.1.0.pre0
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
8d7496c3be
2021-10-12 20:53:16 +09:00
Pavel Rosický
5e1d2c5c97
[ruby/digest] relicence under the Ruby license and the BSD 2-clause
154d461e91
2021-10-12 20:46:16 +09:00
Pavel Rosický
94882df3a2
[ruby/digest] jruby support
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
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]

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
258e30b640
2021-09-12 22:49:07 +09:00
Nobuyoshi Nakada
6920f3dc96 [ruby/openssl] Suppress cast-function-type warnings
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`.

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.

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

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)
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.

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
44a56d36e7
2021-08-31 23:20:42 +09:00
Nobuyoshi Nakada
31c427511c [ruby/zlib] Revert "Don't print out warnings when freeing."
931aa7a272
2021-08-31 23:20:40 +09:00
jory-graham
db154b20cc [ruby/psych] Replace A-Za-z with [:alpha:]
8ec36494fb
2021-08-31 19:34:54 +09:00