openssl 3.2.1 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +180 -29
  3. data/History.md +76 -0
  4. data/README.md +11 -7
  5. data/ext/openssl/extconf.rb +7 -9
  6. data/ext/openssl/openssl_missing.c +1 -1
  7. data/ext/openssl/openssl_missing.h +1 -1
  8. data/ext/openssl/ossl.c +7 -9
  9. data/ext/openssl/ossl.h +12 -8
  10. data/ext/openssl/ossl_asn1.c +46 -237
  11. data/ext/openssl/ossl_asn1.h +1 -19
  12. data/ext/openssl/ossl_bio.c +1 -1
  13. data/ext/openssl/ossl_bio.h +1 -1
  14. data/ext/openssl/ossl_bn.c +12 -12
  15. data/ext/openssl/ossl_bn.h +1 -2
  16. data/ext/openssl/ossl_cipher.c +5 -5
  17. data/ext/openssl/ossl_cipher.h +1 -4
  18. data/ext/openssl/ossl_config.c +10 -9
  19. data/ext/openssl/ossl_config.h +1 -1
  20. data/ext/openssl/ossl_digest.c +39 -21
  21. data/ext/openssl/ossl_digest.h +1 -4
  22. data/ext/openssl/ossl_engine.c +3 -3
  23. data/ext/openssl/ossl_engine.h +1 -4
  24. data/ext/openssl/ossl_hmac.c +3 -3
  25. data/ext/openssl/ossl_hmac.h +1 -4
  26. data/ext/openssl/ossl_kdf.c +5 -5
  27. data/ext/openssl/ossl_ns_spki.c +8 -8
  28. data/ext/openssl/ossl_ns_spki.h +1 -5
  29. data/ext/openssl/ossl_ocsp.c +8 -8
  30. data/ext/openssl/ossl_ocsp.h +1 -8
  31. data/ext/openssl/ossl_pkcs12.c +54 -3
  32. data/ext/openssl/ossl_pkcs12.h +1 -4
  33. data/ext/openssl/ossl_pkcs7.c +68 -21
  34. data/ext/openssl/ossl_pkcs7.h +2 -22
  35. data/ext/openssl/ossl_pkey.c +1 -1
  36. data/ext/openssl/ossl_pkey.h +3 -14
  37. data/ext/openssl/ossl_pkey_dh.c +2 -2
  38. data/ext/openssl/ossl_pkey_dsa.c +2 -2
  39. data/ext/openssl/ossl_pkey_ec.c +6 -6
  40. data/ext/openssl/ossl_pkey_rsa.c +2 -2
  41. data/ext/openssl/ossl_provider.c +1 -1
  42. data/ext/openssl/ossl_rand.c +3 -3
  43. data/ext/openssl/ossl_rand.h +1 -4
  44. data/ext/openssl/ossl_ssl.c +71 -52
  45. data/ext/openssl/ossl_ssl.h +1 -1
  46. data/ext/openssl/ossl_ts.c +73 -15
  47. data/ext/openssl/ossl_ts.h +1 -1
  48. data/ext/openssl/ossl_x509.c +1 -1
  49. data/ext/openssl/ossl_x509.h +1 -20
  50. data/ext/openssl/ossl_x509attr.c +25 -26
  51. data/ext/openssl/ossl_x509cert.c +42 -3
  52. data/ext/openssl/ossl_x509crl.c +8 -4
  53. data/ext/openssl/ossl_x509ext.c +3 -3
  54. data/ext/openssl/ossl_x509name.c +3 -3
  55. data/ext/openssl/ossl_x509req.c +8 -4
  56. data/ext/openssl/ossl_x509revoked.c +2 -2
  57. data/ext/openssl/ossl_x509store.c +16 -11
  58. data/lib/openssl/asn1.rb +188 -0
  59. data/lib/openssl/bn.rb +1 -1
  60. data/lib/openssl/buffering.rb +13 -3
  61. data/lib/openssl/cipher.rb +1 -1
  62. data/lib/openssl/digest.rb +1 -1
  63. data/lib/openssl/marshal.rb +1 -1
  64. data/lib/openssl/ssl.rb +67 -4
  65. data/lib/openssl/version.rb +1 -1
  66. data/lib/openssl/x509.rb +1 -1
  67. data/lib/openssl.rb +2 -1
  68. metadata +5 -3
  69. /data/{LICENSE.txt → COPYING} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d768799eb4f3fb6e1ec8937cdf77c3ab5c5a3c453a8ea38e8886b0c96eb85778
4
- data.tar.gz: 7e36f7e488cce83fbeae8cea19bb5cc817a10759243c5ce9345a65e0837ba7ca
3
+ metadata.gz: a8432d7080faee7ddacde9ce67046b585bed0364f1f63f3e34ca68e28b94c939
4
+ data.tar.gz: 2e55e3ed68ce1bfa26d38e95481510d126282e4fb44b6f2379efe060cbc6a9d9
5
5
  SHA512:
6
- metadata.gz: 69dcd674d157588140b6ef64f3996a4a7a0847ddd713550752ac509310430fe5b9463c532c69538cbdc136bcbe934d6e2670a6bd4e2f91283cff18ddd5bf2eb3
7
- data.tar.gz: 5583751022390d99a99b2179113acd5589366ecc407b50c3a0833ba2873ba3d3037a05644e02ffffb507ea4c3852e90c9f9507a8f65188c96034ed36533e2213
6
+ metadata.gz: 8b47e7a7d5e2eb91a2beb38a3054f51bbec651823e4644ac16778d5a9d60545b8e53f8065ad8aa059d880d19aa01d7d5e171f8aea4d7262a62717221a4c47d1f
7
+ data.tar.gz: b3fd16b1cbe564abcafcf849c9666644f6a74672bd65c4019ba008e7f377b1ed4b121d89d9bc6f8b38306ee0c76ed60e1df798b6fe3533d633389393263438f7
data/CONTRIBUTING.md CHANGED
@@ -10,7 +10,7 @@ Bugs and feature requests are tracked on [GitHub].
10
10
 
11
11
  If you think you found a bug, file a ticket on GitHub. Please DO NOT report
12
12
  security issues here, there is a separate procedure which is described on
13
- ["Security at ruby-lang.org"](https://www.ruby-lang.org/en/security/).
13
+ ["Security at ruby-lang.org"][Ruby Security].
14
14
 
15
15
  When reporting a bug, please make sure you include:
16
16
 
@@ -22,26 +22,25 @@ When reporting a bug, please make sure you include:
22
22
 
23
23
  There are a number of unresolved issues and feature requests for openssl that
24
24
  need review. Before submitting a new ticket, it is recommended to check
25
- [known issues].
25
+ [known issues][Issues].
26
26
 
27
27
  ## Submitting patches
28
28
 
29
29
  Patches are also very welcome!
30
30
 
31
- Please submit a [pull request] with your changes.
31
+ Please submit a [pull request][Compare changes] with your changes.
32
32
 
33
33
  Make sure that your branch does:
34
34
 
35
35
  * Have good commit messages
36
- * Follow Ruby's coding style ([DeveloperHowTo])
36
+ * Follow Ruby's coding style ([Developer-How-To][Ruby Developer-How-To])
37
37
  * Pass the test suite successfully (see "Testing")
38
38
 
39
39
  ## Testing
40
40
 
41
41
  We have a test suite!
42
42
 
43
- Test cases are located under the
44
- [`test/openssl`](https://github.com/ruby/openssl/tree/master/test/openssl)
43
+ Test cases are located under the [`test/openssl`][GitHub test/openssl]
45
44
  directory.
46
45
 
47
46
  You can run it with the following three commands:
@@ -54,31 +53,176 @@ $ bundle exec rake test
54
53
 
55
54
  ### With different versions of OpenSSL
56
55
 
57
- Ruby OpenSSL supports various versions of OpenSSL library. The test suite needs
58
- to pass on all supported combinations.
56
+ Ruby OpenSSL supports various versions of the OpenSSL library. The test suite
57
+ needs to pass on all supported combinations.
59
58
 
60
- Similarly to when installing `openssl` gem via the `gem` command,
61
- you can pass a `--with-openssl-dir` argument to `rake compile`
62
- to specify the OpenSSL library to build against.
59
+ If you want to test, debug, report an issue, or contribute to the Ruby OpenSSL
60
+ or [the OpenSSL project][OpenSSL] in the non-FIPS or the
61
+ [FIPS][OpenSSL README-FIPS] case, compiling OpenSSL from the source by yourself
62
+ is a good practice.
63
+
64
+ The following steps are tested in Linux and GCC environment. You can adjust the
65
+ commands in the steps for a different environment.
66
+
67
+ To download the OpenSSL source from the Git repository, you can run the following
68
+ commands:
69
+
70
+ ```
71
+ $ git clone https://github.com/openssl/openssl.git
72
+ $ cd openssl
73
+ ```
74
+
75
+ You see the `master` branch used as a development branch. Testing against the
76
+ latest OpenSSL master branch is a good practice to report an issue to the
77
+ OpenSSL project.
78
+
79
+ ```
80
+ $ git branch | grep '^*'
81
+ * master
82
+ ```
83
+
84
+ If you test against the latest stable branch, you can run the following command.
85
+ In this example, the `openssl-3.1` branch is the stable branch of OpenSSL 3.1
86
+ series.
87
+
88
+ ```
89
+ $ git checkout openssl-3.1
90
+ ```
91
+
92
+ To configure OpenSSL, you can run the following commands.
93
+
94
+ In this example, we use the `OPENSSL_DIR` environment variable to specify the
95
+ OpenSSL installed directory for convenience. Including the commit hash in the
96
+ directory name is a good practice.
97
+
98
+ ```
99
+ $ git rev-parse --short HEAD
100
+ 0bf18140f4
101
+
102
+ $ OPENSSL_DIR=$HOME/.openssl/openssl-fips-debug-0bf18140f4
103
+ ```
104
+
105
+ The following configuration options are useful in this case.
106
+ You can check [OpenSSL installation document][OpenSSL INSTALL] for details.
107
+
108
+ * `enable-fips`: Add an option to run with the OpenSSL FIPS module.
109
+ * `enable-trace`: Add an option to enabling tracing log. You can trace logs by
110
+ implementing a code. See the man page [OSSL_TRACE(3)][OpenSSL OSSL_TRACE] for
111
+ details.
112
+ * compiler flags
113
+ * `-Wl,-rpath,$(LIBRPATH)`: Set the runtime shared library path to run the
114
+ `openssl` command without the `LD_LIBRARY_PATH`. You can check
115
+ [this document][OpenSSL NOTES-UNIX] for details.
116
+ * `-O0 -g3 -ggdb3 -gdwarf-5`: You can set debugging compiler flags.
63
117
 
64
118
  ```
65
- $ ( curl -OL https://ftp.openssl.org/source/openssl-3.0.1.tar.gz &&
66
- tar xf openssl-3.0.1.tar.gz &&
67
- cd openssl-3.0.1 &&
68
- ./config --prefix=$HOME/.openssl/openssl-3.0.1 --libdir=lib &&
69
- make -j4 &&
70
- make install )
119
+ $ ./Configure \
120
+ --prefix=$OPENSSL_DIR \
121
+ --libdir=lib \
122
+ enable-fips \
123
+ enable-trace \
124
+ '-Wl,-rpath,$(LIBRPATH)' \
125
+ -O0 -g3 -ggdb3 -gdwarf-5
126
+ $ make -j4
127
+ $ make install
128
+ ```
129
+
130
+ To print installed OpenSSL version, you can run the following command:
131
+
132
+ ```
133
+ $ $OPENSSL_DIR/bin/openssl version
134
+ OpenSSL 3.2.0-alpha3-dev (Library: OpenSSL 3.2.0-alpha3-dev )
135
+ ```
136
+
137
+ Change the current working directory into Ruby OpenSSL's source directory.
138
+
139
+ To compile Ruby OpenSSL, you can run the following commands:
71
140
 
72
- $ # in Ruby/OpenSSL's source directory
141
+ Similarly to when installing `openssl` gem via the `gem` command, you can pass a
142
+ `--with-openssl-dir` argument to `rake compile` to specify the OpenSSL library
143
+ to build against.
144
+
145
+ * `MAKEFLAGS="V=1"`: Enable the compiler command lines to print in
146
+ the log.
147
+ * `RUBY_OPENSSL_EXTCFLAGS`: Set extra compiler flags to compile Ruby OpenSSL.
148
+
149
+ ```
73
150
  $ bundle exec rake clean
74
- $ bundle exec rake compile -- --with-openssl-dir=$HOME/.openssl/openssl-3.0.1
151
+ $ MAKEFLAGS="V=1" \
152
+ RUBY_OPENSSL_EXTCFLAGS="-O0 -g3 -ggdb3 -gdwarf-5" \
153
+ bundle exec rake compile -- --with-openssl-dir=$OPENSSL_DIR
154
+ ```
155
+
156
+ #### Testing normally in non-FIPS case
157
+
158
+ To test Ruby OpenSSL, you can run the following command:
159
+
160
+ ```
75
161
  $ bundle exec rake test
76
162
  ```
77
163
 
78
- The GitHub Actions workflow file
79
- [`test.yml`](https://github.com/ruby/openssl/tree/master/.github/workflows/test.yml)
80
- contains useful information for building OpenSSL/LibreSSL and testing against
81
- them.
164
+ #### Testing in FIPS case
165
+
166
+ To use OpenSSL 3.0 or later versions in a FIPS-approved manner, you must load the
167
+ `fips` and `base` providers, and also use the property query `fips=yes`. The
168
+ property query is used when fetching cryptographic algorithm implementations.
169
+ This must be done at the startup of a process to avoid implicitly loading the
170
+ `default` provider which has the non-FIPS cryptographic algorithm
171
+ implementations. See also the man page [fips_module(7)][OpenSSL fips_module].
172
+
173
+ You can set this in your OpenSSL configuration file by either appropriately
174
+ modifying the default OpenSSL configuration file located at
175
+ `OpenSSL::Config::DEFAULT_CONFIG_FILE` or temporarily overriding it with the
176
+ `OPENSSL_CONF` environment variable.
177
+
178
+ In this example, we explain on the latter way.
179
+
180
+ You can create a OpenSSL FIPS config `openssl_fips.cnf` file based on the
181
+ `openssl_fips.cnf.tmpl` file in this repository, and replacing the placeholder
182
+ `OPENSSL_DIR` with your OpenSSL installed directory.
183
+
184
+ ```
185
+ $ sed -e "s|OPENSSL_DIR|$OPENSSL_DIR|" tool/openssl_fips.cnf.tmpl | \
186
+ tee $OPENSSL_DIR/ssl/openssl_fips.cnf
187
+ ```
188
+
189
+ You can see the base and fips providers by running the following command if you
190
+ setup the OpenSSL FIPS config file properly.
191
+
192
+ ```
193
+ $ OPENSSL_CONF=$OPENSSL_DIR/ssl/openssl_fips.cnf \
194
+ $OPENSSL_DIR/bin/openssl list -providers
195
+ Providers:
196
+ base
197
+ name: OpenSSL Base Provider
198
+ version: 3.2.0
199
+ status: active
200
+ fips
201
+ name: OpenSSL FIPS Provider
202
+ version: 3.2.0
203
+ status: active
204
+ ```
205
+
206
+ You can run the current tests in the FIPS module case used in the GitHub
207
+ Actions file `test.yml` explained in a later sentence.
208
+
209
+ ```
210
+ $ OPENSSL_CONF=$OPENSSL_DIR/ssl/openssl_fips.cnf \
211
+ bundle exec rake test_fips
212
+ ```
213
+
214
+ You can also run the all the tests in the FIPS module case. You see many
215
+ failures. We are working in progress to fix the failures. Your contribution is
216
+ welcome.
217
+
218
+ ```
219
+ $ OPENSSL_CONF=$OPENSSL_DIR/ssl/openssl_fips.cnf \
220
+ TEST_RUBY_OPENSSL_FIPS_ENABLED=true \
221
+ bundle exec rake test
222
+ ```
223
+
224
+ The GitHub Actions workflow file [`test.yml`][GitHub test.yml] contains useful
225
+ information for building OpenSSL/LibreSSL and testing against them.
82
226
 
83
227
 
84
228
  ## Relation with Ruby source tree
@@ -103,7 +247,7 @@ security issue handling procedure for Ruby core.
103
247
 
104
248
  You can either use [HackerOne] or send an email to security@ruby-lang.org.
105
249
 
106
- Please see [Security] page on ruby-lang.org website for details.
250
+ Please see [Security][Ruby Security] page on ruby-lang.org website for details.
107
251
 
108
252
  Reported problems will be published after a fix is released.
109
253
 
@@ -112,9 +256,16 @@ _Thanks for your contributions!_
112
256
  _\- The Ruby OpenSSL team_
113
257
 
114
258
  [GitHub]: https://github.com/ruby/openssl
115
- [known issues]: https://github.com/ruby/openssl/issues
116
- [DeveloperHowTo]: https://bugs.ruby-lang.org/projects/ruby/wiki/DeveloperHowto
259
+ [Issues]: https://github.com/ruby/openssl/issues
260
+ [Compare changes]: https://github.com/ruby/openssl/compare
261
+ [GitHub test/openssl]: https://github.com/ruby/openssl/tree/master/test/openssl
262
+ [GitHub test.yml]: https://github.com/ruby/openssl/tree/master/.github/workflows/test.yml
263
+ [Ruby Developer-How-To]: https://github.com/ruby/ruby/wiki/Developer-How-To
264
+ [Ruby Security]: https://www.ruby-lang.org/en/security/
117
265
  [HackerOne]: https://hackerone.com/ruby
118
- [Security]: https://www.ruby-lang.org/en/security/
119
- [pull request]: https://github.com/ruby/openssl/compare
120
- [History.md]: https://github.com/ruby/openssl/tree/master/History.md
266
+ [OpenSSL]: https://www.openssl.org/
267
+ [OpenSSL INSTALL]: https://github.com/openssl/openssl/blob/master/INSTALL.md
268
+ [OpenSSL README-FIPS]: https://github.com/openssl/openssl/blob/master/README-FIPS.md
269
+ [OpenSSL NOTES-UNIX]: https://github.com/openssl/openssl/blob/master/NOTES-UNIX.md
270
+ [OpenSSL OSSL_TRACE]: https://www.openssl.org/docs/manmaster/man3/OSSL_TRACE.html
271
+ [OpenSSL fips_module]: https://www.openssl.org/docs/manmaster/man7/fips_module.html
data/History.md CHANGED
@@ -1,3 +1,79 @@
1
+ Version 3.3.0
2
+ =============
3
+
4
+ Compatibility
5
+ -------------
6
+
7
+ * Ruby version: 2.7 or later
8
+ * OpenSSL version: OpenSSL 1.0.2 or later, and LibreSSL 3.1 or later
9
+
10
+ Notable changes
11
+ ---------------
12
+
13
+ * `OpenSSL::SSL`
14
+ - `OpenSSL::SSL::SSLSocket#set_params` no longer sets `#min_version=` to TLS
15
+ 1.0 except when OpenSSL 1.0.2 is used. This has been done to disable
16
+ SSL 3.0, which is not supported by default in OpenSSL 1.1.0 or later, or in
17
+ LibreSSL. This lets it respect the system default if the system-wide
18
+ configuration file specifies a higher minimum protocol version.
19
+ [[GitHub #710]](https://github.com/ruby/openssl/pull/710)
20
+ - `OpenSSL::SSL::SSLSocket.new` no longer enables the `OpenSSL::SSL::OP_ALL`
21
+ SSL options by default and follows the system default.
22
+ [[GitHub #767]](https://github.com/ruby/openssl/pull/767)
23
+ - Add the following IO methods to `OpenSSL::SSL::SSLSocket`, which will pass
24
+ along to the underlying socket: `#local_address`, `#remote_address`,
25
+ `#close_on_exec=`, `#close_on_exec?`, `#wait`, `#wait_readable`, and
26
+ `#wait_writable`.
27
+ [[GitHub #708]](https://github.com/ruby/openssl/pull/708)
28
+ - Update `OpenSSL::SSL::SSLSocket#gets` to take the `chomp` keyword argument.
29
+ [[GitHub #708]](https://github.com/ruby/openssl/pull/708)
30
+ - Make `OpenSSL::SSL::SSLSocket` respect the `IO#timeout` value of the
31
+ underlying socket on Ruby 3.2 or later. `#timeout` and `#timeout=` methods
32
+ are also added.
33
+ [[GitHub #714]](https://github.com/ruby/openssl/pull/714)
34
+ - Add `OpenSSL::SSL::SSLSocket#close_read` and `#close_write`.
35
+ [[GitHub #743]](https://github.com/ruby/openssl/pull/743)
36
+ - Add `OpenSSL::Digest.digests` to get a list of all available digest
37
+ algorithms.
38
+ [[GitHub #726]](https://github.com/ruby/openssl/pull/726)
39
+ - Fix `OpenSSL::SSL::SSLSocket#read_nonblock` clearing the passed String
40
+ buffer when nothing can be read from the connection.
41
+ [[GitHub #739]](https://github.com/ruby/openssl/pull/739)
42
+ * Add `#to_text` methods to `OpenSSL::Timestamp::Response`,
43
+ `OpenSSL::Timestamp::Request`, `OpenSSL::Timestamp::TokenInfo`, and
44
+ `OpenSSL::PKCS7` to get a human-readable representation of the object.
45
+ [[GitHub #756]](https://github.com/ruby/openssl/pull/756)
46
+ * Add `OpenSSL::X509::Certificate#tbs_bytes` to get the DER encoding of the
47
+ TBSCertificate.
48
+ [[GitHub #753]](https://github.com/ruby/openssl/pull/753)
49
+ * Allow passing `nil` as the digest algorithm to `#sign` methods on
50
+ `OpenSSL::X509::Certificate`, `OpenSSL::X509::Request`, and
51
+ `OpenSSL::X509::CRL`. This adds supports for signing with EdDSA keys.
52
+ [[GitHub #761]](https://github.com/ruby/openssl/pull/761)
53
+ [[GitHub #804]](https://github.com/ruby/openssl/pull/804)
54
+ * Add `OpenSSL::SSL::SSLSocket#readbyte`.
55
+ [[GitHub #771]](https://github.com/ruby/openssl/pull/771)
56
+ * Change `OpenSSL::X509::Store#time=` to set the time to the `X509_VERIFY_PARAM`
57
+ in the `X509_STORE`. This allows `OpenSSL::Timestamp::Response#verify` to
58
+ verify a signature with the specified timestamp.
59
+ [[GitHub #770]](https://github.com/ruby/openssl/pull/770)
60
+ * Make `OpenSSL::PKCS7.encrypt`'s third parameter `cipher` mandatory. It had
61
+ an undocumented default value "RC2-40-CBC", which is not only insecure, but
62
+ also not supported in OpenSSL 3.0 or later.
63
+ [[GitHub #796]](https://github.com/ruby/openssl/pull/796)
64
+ * Make `OpenSSL::BN` shareable between ractors when frozen.
65
+ [[GitHub #808]](https://github.com/ruby/openssl/pull/808)
66
+ * Make `OpenSSL::Config` instances frozen by default, and make it shareable
67
+ between ractors. `OpenSSL::Config::DEFAULT_CONFIG_FILE` is also frozen.
68
+ [[GitHub #809]](https://github.com/ruby/openssl/pull/809)
69
+ * Add `OpenSSL::PKCS12#set_mac` to configure the MAC parameters and recalculate
70
+ a MAC for the content.
71
+ [[GitHub #788]](https://github.com/ruby/openssl/pull/788)
72
+
73
+ And various non-user-visible changes and bug fixes. Please see the commit
74
+ history for more details.
75
+
76
+
1
77
  Version 3.2.1
2
78
  =============
3
79
 
data/README.md CHANGED
@@ -18,10 +18,11 @@ included as a default gem in [supported Ruby branches][Ruby Maintenance Branches
18
18
 
19
19
  |Version|Maintenance status |Ruby compatibility|OpenSSL compatibility |
20
20
  |-------|-------------------------------|------------------|--------------------------------------------|
21
- |3.2.x |normal maintenance (Ruby 3.3) |Ruby 2.7+ |OpenSSL 1.0.2-3.1 (current) or LibreSSL 3.1+|
22
- |3.1.x |normal maintenance (Ruby 3.2) |Ruby 2.6+ |OpenSSL 1.0.2-3.1 (current) or LibreSSL 3.1+|
23
- |3.0.x |normal maintenance (Ruby 3.1) |Ruby 2.6+ |OpenSSL 1.0.2-3.1 (current) or LibreSSL 3.1+|
24
- |2.2.x |security maintenance (Ruby 3.0)|Ruby 2.3+ |OpenSSL 1.0.1-1.1.1 or LibreSSL 2.9+ |
21
+ |3.3.x |normal maintenance (Ruby 3.4) |Ruby 2.7+ |OpenSSL 1.0.2-3.4 (current) or LibreSSL 3.1+|
22
+ |3.2.x |normal maintenance (Ruby 3.3) |Ruby 2.7+ |OpenSSL 1.0.2-3.4 (current) or LibreSSL 3.1+|
23
+ |3.1.x |normal maintenance (Ruby 3.2) |Ruby 2.6+ |OpenSSL 1.0.2-3.4 (current) or LibreSSL 3.1+|
24
+ |3.0.x |security maintenance (Ruby 3.1)|Ruby 2.6+ |OpenSSL 1.0.2-3.4 (current) or LibreSSL 3.1+|
25
+ |2.2.x |end-of-life (Ruby 3.0) |Ruby 2.3+ |OpenSSL 1.0.1-1.1.1 or LibreSSL 2.9+ |
25
26
  |2.1.x |end-of-life (Ruby 2.5-2.7) |Ruby 2.3+ |OpenSSL 1.0.1-1.1.1 or LibreSSL 2.5+ |
26
27
  |2.0.x |end-of-life (Ruby 2.4) |Ruby 2.3+ |OpenSSL 0.9.8-1.1.1 or LibreSSL 2.3+ |
27
28
 
@@ -32,8 +33,7 @@ included as a default gem in [supported Ruby branches][Ruby Maintenance Branches
32
33
 
33
34
  > **Note**
34
35
  > The openssl gem is included with Ruby by default, but you may wish to upgrade
35
- > it to a newer version available at
36
- > [rubygems.org](https://rubygems.org/gems/openssl).
36
+ > it to a newer version available at [rubygems.org][RubyGems.org openssl].
37
37
 
38
38
  To upgrade it, you can use RubyGems:
39
39
 
@@ -59,6 +59,8 @@ gem 'openssl', git: 'https://github.com/ruby/openssl'
59
59
 
60
60
  After running `bundle install`, you should have the gem installed in your bundle.
61
61
 
62
+ [RubyGems.org openssl]: https://rubygems.org/gems/openssl
63
+
62
64
  ## Usage
63
65
 
64
66
  Once installed, you can require "openssl" in your application.
@@ -80,4 +82,6 @@ Please read our [CONTRIBUTING.md] for instructions.
80
82
  ## Security
81
83
 
82
84
  Security issues should be reported to ruby-core by following the process
83
- described on ["Security at ruby-lang.org"](https://www.ruby-lang.org/en/security/).
85
+ described on ["Security at ruby-lang.org"][Security].
86
+
87
+ [Security]: https://www.ruby-lang.org/en/security/
@@ -8,19 +8,12 @@
8
8
 
9
9
  = Licence
10
10
  This program is licensed under the same licence as Ruby.
11
- (See the file 'LICENCE'.)
11
+ (See the file 'COPYING'.)
12
12
  =end
13
13
 
14
14
  require "mkmf"
15
15
 
16
- ssl_dirs = nil
17
- if defined?(::TruffleRuby)
18
- # Always respect the openssl prefix chosen by truffle/openssl-prefix
19
- require 'truffle/openssl-prefix'
20
- ssl_dirs = dir_config("openssl", ENV["OPENSSL_PREFIX"])
21
- else
22
- ssl_dirs = dir_config("openssl")
23
- end
16
+ ssl_dirs = dir_config("openssl")
24
17
  dir_config_given = ssl_dirs.any?
25
18
 
26
19
  _, ssl_ldir = ssl_dirs
@@ -49,6 +42,7 @@ $defs.push("-D""OPENSSL_SUPPRESS_DEPRECATED")
49
42
 
50
43
  have_func("rb_io_descriptor")
51
44
  have_func("rb_io_maybe_wait(0, Qnil, Qnil, Qnil)", "ruby/io.h") # Ruby 3.1
45
+ have_func("rb_io_timeout", "ruby/io.h")
52
46
 
53
47
  Logging::message "=== Checking for system dependent stuff... ===\n"
54
48
  have_library("nsl", "t_open")
@@ -155,6 +149,9 @@ engines.each { |name|
155
149
  have_func("ENGINE_load_#{name}()", "openssl/engine.h")
156
150
  }
157
151
 
152
+ # missing in libressl < 3.5
153
+ have_func("i2d_re_X509_tbs(NULL, NULL)", x509_h)
154
+
158
155
  # added in 1.1.0
159
156
  if !have_struct_member("SSL", "ctx", "openssl/ssl.h") || is_libressl
160
157
  $defs.push("-DHAVE_OPAQUE_OPENSSL")
@@ -193,6 +190,7 @@ have_func("TS_VERIFY_CTX_add_flags(NULL, 0)", ts_h)
193
190
  have_func("TS_RESP_CTX_set_time_cb(NULL, NULL, NULL)", ts_h)
194
191
  have_func("EVP_PBE_scrypt(\"\", 0, (unsigned char *)\"\", 0, 0, 0, 0, 0, NULL, 0)", evp_h)
195
192
  have_func("SSL_CTX_set_post_handshake_auth(NULL, 0)", ssl_h)
193
+ have_func("X509_STORE_get0_param(NULL)", x509_h)
196
194
 
197
195
  # added in 1.1.1
198
196
  have_func("EVP_PKEY_check(NULL)", evp_h)
@@ -5,7 +5,7 @@
5
5
  */
6
6
  /*
7
7
  * This program is licensed under the same licence as Ruby.
8
- * (See the file 'LICENCE'.)
8
+ * (See the file 'COPYING'.)
9
9
  */
10
10
  #include RUBY_EXTCONF_H
11
11
 
@@ -5,7 +5,7 @@
5
5
  */
6
6
  /*
7
7
  * This program is licensed under the same licence as Ruby.
8
- * (See the file 'LICENCE'.)
8
+ * (See the file 'COPYING'.)
9
9
  */
10
10
  #if !defined(_OSSL_OPENSSL_MISSING_H_)
11
11
  #define _OSSL_OPENSSL_MISSING_H_
data/ext/openssl/ossl.c CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  /*
7
7
  * This program is licensed under the same licence as Ruby.
8
- * (See the file 'LICENCE'.)
8
+ * (See the file 'COPYING'.)
9
9
  */
10
10
  #include "ossl.h"
11
11
  #include <stdarg.h> /* for ossl_raise */
@@ -355,7 +355,7 @@ ossl_clear_error(void)
355
355
  * Any errors you see here are probably due to a bug in Ruby's OpenSSL
356
356
  * implementation.
357
357
  */
358
- VALUE
358
+ static VALUE
359
359
  ossl_get_errors(VALUE _)
360
360
  {
361
361
  VALUE ary;
@@ -1150,24 +1150,22 @@ Init_openssl(void)
1150
1150
  /*
1151
1151
  * Init components
1152
1152
  */
1153
+ Init_ossl_asn1();
1153
1154
  Init_ossl_bn();
1154
1155
  Init_ossl_cipher();
1155
1156
  Init_ossl_config();
1156
1157
  Init_ossl_digest();
1158
+ Init_ossl_engine();
1157
1159
  Init_ossl_hmac();
1160
+ Init_ossl_kdf();
1158
1161
  Init_ossl_ns_spki();
1162
+ Init_ossl_ocsp();
1159
1163
  Init_ossl_pkcs12();
1160
1164
  Init_ossl_pkcs7();
1161
1165
  Init_ossl_pkey();
1166
+ Init_ossl_provider();
1162
1167
  Init_ossl_rand();
1163
1168
  Init_ossl_ssl();
1164
- #ifndef OPENSSL_NO_TS
1165
1169
  Init_ossl_ts();
1166
- #endif
1167
1170
  Init_ossl_x509();
1168
- Init_ossl_ocsp();
1169
- Init_ossl_engine();
1170
- Init_ossl_provider();
1171
- Init_ossl_asn1();
1172
- Init_ossl_kdf();
1173
1171
  }
data/ext/openssl/ossl.h CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  /*
7
7
  * This program is licensed under the same licence as Ruby.
8
- * (See the file 'LICENCE'.)
8
+ * (See the file 'COPYING'.)
9
9
  */
10
10
  #if !defined(_OSSL_H_)
11
11
  #define _OSSL_H_
@@ -17,6 +17,12 @@
17
17
  #include <errno.h>
18
18
  #include <ruby/io.h>
19
19
  #include <ruby/thread.h>
20
+ #ifdef HAVE_RUBY_RACTOR_H
21
+ #include <ruby/ractor.h>
22
+ #else
23
+ #define RUBY_TYPED_FROZEN_SHAREABLE 0
24
+ #endif
25
+
20
26
  #include <openssl/opensslv.h>
21
27
 
22
28
  #include <openssl/err.h>
@@ -39,6 +45,7 @@
39
45
  #include <openssl/dsa.h>
40
46
  #include <openssl/evp.h>
41
47
  #include <openssl/dh.h>
48
+ #include "openssl_missing.h"
42
49
 
43
50
  #ifndef LIBRESSL_VERSION_NUMBER
44
51
  # define OSSL_IS_LIBRESSL 0
@@ -172,28 +179,25 @@ extern VALUE dOSSL;
172
179
  /*
173
180
  * Include all parts
174
181
  */
175
- #include "openssl_missing.h"
176
182
  #include "ossl_asn1.h"
177
183
  #include "ossl_bio.h"
178
184
  #include "ossl_bn.h"
179
185
  #include "ossl_cipher.h"
180
186
  #include "ossl_config.h"
181
187
  #include "ossl_digest.h"
188
+ #include "ossl_engine.h"
182
189
  #include "ossl_hmac.h"
190
+ #include "ossl_kdf.h"
183
191
  #include "ossl_ns_spki.h"
184
192
  #include "ossl_ocsp.h"
185
193
  #include "ossl_pkcs12.h"
186
194
  #include "ossl_pkcs7.h"
187
195
  #include "ossl_pkey.h"
196
+ #include "ossl_provider.h"
188
197
  #include "ossl_rand.h"
189
198
  #include "ossl_ssl.h"
190
- #ifndef OPENSSL_NO_TS
191
- #include "ossl_ts.h"
192
- #endif
199
+ #include "ossl_ts.h"
193
200
  #include "ossl_x509.h"
194
- #include "ossl_engine.h"
195
- #include "ossl_provider.h"
196
- #include "ossl_kdf.h"
197
201
 
198
202
  void Init_openssl(void);
199
203