openssl 2.1.3 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +35 -45
  3. data/History.md +266 -1
  4. data/README.md +2 -2
  5. data/ext/openssl/extconf.rb +46 -38
  6. data/ext/openssl/openssl_missing.c +0 -66
  7. data/ext/openssl/openssl_missing.h +59 -43
  8. data/ext/openssl/ossl.c +110 -64
  9. data/ext/openssl/ossl.h +27 -10
  10. data/ext/openssl/ossl_asn1.c +41 -4
  11. data/ext/openssl/ossl_bn.c +251 -134
  12. data/ext/openssl/ossl_bn.h +2 -1
  13. data/ext/openssl/ossl_cipher.c +38 -29
  14. data/ext/openssl/ossl_config.c +412 -41
  15. data/ext/openssl/ossl_config.h +4 -7
  16. data/ext/openssl/ossl_digest.c +25 -60
  17. data/ext/openssl/ossl_engine.c +18 -27
  18. data/ext/openssl/ossl_hmac.c +60 -145
  19. data/ext/openssl/ossl_kdf.c +11 -19
  20. data/ext/openssl/ossl_ns_spki.c +1 -1
  21. data/ext/openssl/ossl_ocsp.c +9 -62
  22. data/ext/openssl/ossl_ocsp.h +3 -3
  23. data/ext/openssl/ossl_pkcs12.c +21 -3
  24. data/ext/openssl/ossl_pkcs7.c +45 -78
  25. data/ext/openssl/ossl_pkcs7.h +16 -0
  26. data/ext/openssl/ossl_pkey.c +1295 -178
  27. data/ext/openssl/ossl_pkey.h +35 -72
  28. data/ext/openssl/ossl_pkey_dh.c +124 -334
  29. data/ext/openssl/ossl_pkey_dsa.c +93 -398
  30. data/ext/openssl/ossl_pkey_ec.c +186 -329
  31. data/ext/openssl/ossl_pkey_rsa.c +105 -484
  32. data/ext/openssl/ossl_rand.c +2 -32
  33. data/ext/openssl/ossl_ssl.c +347 -394
  34. data/ext/openssl/ossl_ssl_session.c +24 -29
  35. data/ext/openssl/ossl_ts.c +1539 -0
  36. data/ext/openssl/ossl_ts.h +16 -0
  37. data/ext/openssl/ossl_x509.c +0 -6
  38. data/ext/openssl/ossl_x509cert.c +169 -13
  39. data/ext/openssl/ossl_x509crl.c +13 -10
  40. data/ext/openssl/ossl_x509ext.c +15 -2
  41. data/ext/openssl/ossl_x509name.c +15 -4
  42. data/ext/openssl/ossl_x509req.c +13 -10
  43. data/ext/openssl/ossl_x509revoked.c +3 -3
  44. data/ext/openssl/ossl_x509store.c +154 -70
  45. data/lib/openssl/bn.rb +1 -1
  46. data/lib/openssl/buffering.rb +37 -5
  47. data/lib/openssl/cipher.rb +1 -1
  48. data/lib/openssl/digest.rb +10 -12
  49. data/lib/openssl/hmac.rb +78 -0
  50. data/lib/openssl/marshal.rb +30 -0
  51. data/lib/openssl/pkcs5.rb +1 -1
  52. data/lib/openssl/pkey.rb +443 -1
  53. data/lib/openssl/ssl.rb +47 -9
  54. data/lib/openssl/version.rb +5 -0
  55. data/lib/openssl/x509.rb +177 -1
  56. data/lib/openssl.rb +24 -9
  57. metadata +10 -79
  58. data/ext/openssl/deprecation.rb +0 -27
  59. data/ext/openssl/ossl_version.h +0 -15
  60. data/ext/openssl/ruby_missing.h +0 -24
  61. data/lib/openssl/config.rb +0 -492
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7698d18ecab870cfddfbc527123fb4e77cd8f993321440167feec83485828ea7
4
- data.tar.gz: 1132a2cc147808d3e42ca9d3f726b24d635da93d3c8e62af31f4f9c8b5c51ce1
3
+ metadata.gz: b8568ca84395c137b32a22127dcaa2125265d1f5b61a62ba1d56e2373b7a96c4
4
+ data.tar.gz: 1cef2e5798b482c3096826306a3264b82626f6d6cb23f53d9a71025f5afa46b3
5
5
  SHA512:
6
- metadata.gz: 99bad919e464275130913d0ba39db26271d3d43f843a27cefc16b7777727715214e26810236227ef2c13588a7311f4cfef6954275f64e034724b21696ecf37e7
7
- data.tar.gz: d44e451531531e45db6f86ecfd2eaa0099c5e4143e5dc1f7794ff85822ef6dc92ad10ac87e62faa1c8a227e2aed1089cde2a022fb71f5eba4b764f6ef7bade12
6
+ metadata.gz: 1bb9f6a40f535f4331097321296028fc2bdc8e5f90e6366c8db5c8e6dca771b55932c01479f667bd0751940917c83a9c98ca9ea70d7c622688cbb24432afdb36
7
+ data.tar.gz: d9905167ac9e1ffc3201155d39d947e5b0e923797a09ba172a443d4a4040a5d8663edfdb30c935a6d2fa71438e8f8a0fec025c21b5af9290eb76b02a8c100326
data/CONTRIBUTING.md CHANGED
@@ -12,14 +12,17 @@ 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
13
  ["Security at ruby-lang.org"](https://www.ruby-lang.org/en/security/).
14
14
 
15
- When reporting a bug, please make sure you include the version of Ruby, the
16
- version of openssl gem, the version of the OpenSSL library, along with a sample
17
- file that illustrates the problem or link to repository or gem that is
18
- associated with the bug.
15
+ When reporting a bug, please make sure you include:
19
16
 
20
- There is a number of unresolved issues and feature requests for openssl that
17
+ * Ruby version (`ruby -v`)
18
+ * `openssl` gem version (`gem list openssl` and `OpenSSL::VERSION`)
19
+ * OpenSSL library version (`OpenSSL::OPENSSL_VERSION`)
20
+ * A sample file that illustrates the problem or link to the repository or
21
+ gem that is associated with the bug.
22
+
23
+ There are a number of unresolved issues and feature requests for openssl that
21
24
  need review. Before submitting a new ticket, it is recommended to check
22
- [known issues] and [bugs.ruby-lang.org], the previous issue tracker.
25
+ [known issues].
23
26
 
24
27
  ## Submitting patches
25
28
 
@@ -32,62 +35,50 @@ Make sure that your branch does:
32
35
  * Have good commit messages
33
36
  * Follow Ruby's coding style ([DeveloperHowTo])
34
37
  * Pass the test suite successfully (see "Testing")
35
- * Add an entry to [History.md] if necessary
36
38
 
37
39
  ## Testing
38
40
 
39
41
  We have a test suite!
40
42
 
41
43
  Test cases are located under the
42
- [`test/`](https://github.com/ruby/openssl/tree/master/test) directory.
44
+ [`test/openssl`](https://github.com/ruby/openssl/tree/master/test/openssl)
45
+ directory.
43
46
 
44
47
  You can run it with the following three commands:
45
48
 
46
49
  ```
47
- $ rake install_dependencies # installs rake-compiler, test-unit, ...
48
- $ rake compile
49
- $ rake test
50
+ $ bundle install # installs rake-compiler, test-unit, ...
51
+ $ bundle exec rake compile
52
+ $ bundle exec rake test
50
53
  ```
51
54
 
52
- ### Docker
53
-
54
- You can also use Docker Compose to run tests. It can be used to check that your
55
- changes work correctly with various supported versions of Ruby and OpenSSL.
56
-
57
- First, you need to install [Docker](https://www.docker.com/products/docker) and
58
- [Docker Compose](https://www.docker.com/products/docker-compose) on your
59
- computer.
55
+ ### With different versions of OpenSSL
60
56
 
61
- If you're on MacOS or Windows, we recommended to use the official [Docker
62
- Toolbox](https://www.docker.com/products/docker-toolbox). On Linux, follow the
63
- instructions for your package manager. For further information, please check
64
- the [official documentation](https://docs.docker.com/).
57
+ Ruby OpenSSL supports various versions of OpenSSL library. The test suite needs
58
+ to pass on all supported combinations.
65
59
 
66
- Once you have Docker and Docker Compose, running the following commands will
67
- build the container and execute the openssl tests. In this example, we will use
68
- Ruby version 2.3 with OpenSSL version 1.0.2.
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.
69
63
 
70
64
  ```
71
- $ docker-compose build
72
- $ export RUBY_VERSION=ruby-2.3
73
- $ export OPENSSL_VERSION=openssl-1.0.2
74
- $ docker-compose run test
75
-
76
- # You may want an interactive shell for dubugging
77
- $ docker-compose run debug
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 )
71
+
72
+ $ # in Ruby/OpenSSL's source directory
73
+ $ bundle exec rake clean
74
+ $ bundle exec rake compile -- --with-openssl-dir=$HOME/.openssl/openssl-3.0.1
75
+ $ bundle exec rake test
78
76
  ```
79
77
 
80
- All possible values for `RUBY_VERSION` and `OPENSSL_VERSION` can be found in
81
- [`.travis.yml`](https://github.com/ruby/openssl/tree/master/.travis.yml).
82
-
83
- **NOTE**: these commands must be run from the openssl repository root, in order
84
- to use the
85
- [`docker-compose.yml`](https://github.com/ruby/openssl/blob/master/docker-compose.yml)
86
- file we have provided.
87
-
88
- This Docker image is built using the
89
- [Dockerfile](https://github.com/ruby/openssl/tree/master/tool/ruby-openssl-docker)
90
- provided in the repository.
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.
91
82
 
92
83
 
93
84
  ## Relation with Ruby source tree
@@ -122,7 +113,6 @@ _Thanks for your contributions!_
122
113
 
123
114
  [GitHub]: https://github.com/ruby/openssl
124
115
  [known issues]: https://github.com/ruby/openssl/issues
125
- [bugs.ruby-lang.org]: https://bugs.ruby-lang.org/issues?utf8=%E2%9C%93&set_filter=1&f%5B%5D=status_id&op%5Bstatus_id%5D=o&f%5B%5D=assigned_to_id&op%5Bassigned_to_id%5D=%3D&v%5Bassigned_to_id%5D%5B%5D=7150&f%5B%5D=&c%5B%5D=project&c%5B%5D=tracker&c%5B%5D=status&c%5B%5D=subject&c%5B%5D=assigned_to&c%5B%5D=updated_on&group_by=&t%5B%5D=
126
116
  [DeveloperHowTo]: https://bugs.ruby-lang.org/projects/ruby/wiki/DeveloperHowto
127
117
  [HackerOne]: https://hackerone.com/ruby
128
118
  [Security]: https://www.ruby-lang.org/en/security/
data/History.md CHANGED
@@ -1,3 +1,268 @@
1
+ Version 3.0.2
2
+ =============
3
+
4
+ Merged changes in 2.2.3. Additionally, the following issues are fixed by this
5
+ release.
6
+
7
+ Bug fixes
8
+ ---------
9
+
10
+ * Fix OpenSSL::PKey::EC#check_key not working correctly on OpenSSL 3.0.
11
+ [[GitHub #563]](https://github.com/ruby/openssl/issues/563)
12
+ [[GitHub #580]](https://github.com/ruby/openssl/pull/580)
13
+
14
+
15
+ Version 3.0.1
16
+ =============
17
+
18
+ Merged changes in 2.1.4 and 2.2.2. Additionally, the following issues are fixed
19
+ by this release.
20
+
21
+ Bug fixes
22
+ ---------
23
+
24
+ * Add missing type check in OpenSSL::PKey::PKey#sign's optional parameters.
25
+ [[GitHub #531]](https://github.com/ruby/openssl/pull/531)
26
+ * Work around OpenSSL 3.0's HMAC issues with a zero-length key.
27
+ [[GitHub #538]](https://github.com/ruby/openssl/pull/538)
28
+ * Fix a regression in OpenSSL::PKey::DSA.generate's default of 'q' size.
29
+ [[GitHub #483]](https://github.com/ruby/openssl/issues/483)
30
+ [[GitHub #539]](https://github.com/ruby/openssl/pull/539)
31
+ * Restore OpenSSL::PKey.read's ability to decode "openssl ecparam -genkey"
32
+ output when linked against OpenSSL 3.0.
33
+ [[GitHub #535]](https://github.com/ruby/openssl/pull/535)
34
+ [[GitHub #540]](https://github.com/ruby/openssl/pull/540)
35
+ * Restore error checks in OpenSSL::PKey::EC#{to_der,to_pem}.
36
+ [[GitHub #541]](https://github.com/ruby/openssl/pull/541)
37
+
38
+
39
+ Version 3.0.0
40
+ =============
41
+
42
+ Compatibility notes
43
+ -------------------
44
+
45
+ * OpenSSL 1.0.1 and Ruby 2.3-2.5 are no longer supported.
46
+ [[GitHub #396]](https://github.com/ruby/openssl/pull/396)
47
+ [[GitHub #466]](https://github.com/ruby/openssl/pull/466)
48
+
49
+ * OpenSSL 3.0 support is added. It is the first major version bump from OpenSSL
50
+ 1.1 and contains incompatible changes that affect Ruby/OpenSSL.
51
+ Note that OpenSSL 3.0 support is preliminary and not all features are
52
+ currently available:
53
+ [[GitHub #369]](https://github.com/ruby/openssl/issues/369)
54
+
55
+ - Deprecate the ability to modify `OpenSSL::PKey::PKey` instances. OpenSSL 3.0
56
+ made EVP_PKEY structure immutable, and hence the following methods are not
57
+ available when Ruby/OpenSSL is linked against OpenSSL 3.0.
58
+ [[GitHub #480]](https://github.com/ruby/openssl/pull/480)
59
+
60
+ - `OpenSSL::PKey::RSA#set_key`, `#set_factors`, `#set_crt_params`
61
+ - `OpenSSL::PKey::DSA#set_pqg`, `#set_key`
62
+ - `OpenSSL::PKey::DH#set_pqg`, `#set_key`, `#generate_key!`
63
+ - `OpenSSL::PKey::EC#private_key=`, `#public_key=`, `#group=`, `#generate_key!`
64
+
65
+ - Deprecate `OpenSSL::Engine`. The ENGINE API has been deprecated in OpenSSL 3.0
66
+ in favor of the new "provider" concept and will be removed in a future
67
+ version.
68
+ [[GitHub #481]](https://github.com/ruby/openssl/pull/481)
69
+
70
+ * `OpenSSL::SSL::SSLContext#tmp_ecdh_callback` has been removed. It has been
71
+ deprecated since v2.0.0 because it is incompatible with modern OpenSSL
72
+ versions.
73
+ [[GitHub #394]](https://github.com/ruby/openssl/pull/394)
74
+
75
+ * `OpenSSL::SSL::SSLSocket#read` and `#write` now raise `OpenSSL::SSL::SSLError`
76
+ if called before a TLS connection is established. Historically, they
77
+ read/wrote unencrypted data to the underlying socket directly in that case.
78
+ [[GitHub #9]](https://github.com/ruby/openssl/issues/9)
79
+ [[GitHub #469]](https://github.com/ruby/openssl/pull/469)
80
+
81
+
82
+ Notable changes
83
+ ---------------
84
+
85
+ * Enhance OpenSSL::PKey's common interface.
86
+ [[GitHub #370]](https://github.com/ruby/openssl/issues/370)
87
+
88
+ - Key deserialization: Enhance `OpenSSL::PKey.read` to handle PEM encoding of
89
+ DH parameters, which used to be only deserialized by `OpenSSL::PKey::DH.new`.
90
+ [[GitHub #328]](https://github.com/ruby/openssl/issues/328)
91
+ - Key generation: Add `OpenSSL::PKey.generate_parameters` and
92
+ `OpenSSL::PKey.generate_key`.
93
+ [[GitHub #329]](https://github.com/ruby/openssl/issues/329)
94
+ - Public key signing: Enhance `OpenSSL::PKey::PKey#sign` and `#verify` to use
95
+ the new EVP_DigestSign() family to enable PureEdDSA support on OpenSSL 1.1.1
96
+ or later. They also now take optional algorithm-specific parameters for more
97
+ control.
98
+ [[GitHub #329]](https://github.com/ruby/openssl/issues/329)
99
+ - Low-level public key signing and verification: Add
100
+ `OpenSSL::PKey::PKey#sign_raw`, `#verify_raw`, and `#verify_recover`.
101
+ [[GitHub #382]](https://github.com/ruby/openssl/issues/382)
102
+ - Public key encryption: Add `OpenSSL::PKey::PKey#encrypt` and `#decrypt`.
103
+ [[GitHub #382]](https://github.com/ruby/openssl/issues/382)
104
+ - Key agreement: Add `OpenSSL::PKey::PKey#derive`.
105
+ [[GitHub #329]](https://github.com/ruby/openssl/issues/329)
106
+ - Key comparison: Add `OpenSSL::PKey::PKey#compare?` to conveniently check
107
+ that two keys have common parameters and a public key.
108
+ [[GitHub #383]](https://github.com/ruby/openssl/issues/383)
109
+
110
+ * Add `OpenSSL::BN#set_flags` and `#get_flags`. This can be used in combination
111
+ with `OpenSSL::BN::CONSTTIME` to force constant-time computation.
112
+ [[GitHub #417]](https://github.com/ruby/openssl/issues/417)
113
+
114
+ * Add `OpenSSL::BN#abs` to get the absolute value of the BIGNUM.
115
+ [[GitHub #430]](https://github.com/ruby/openssl/issues/430)
116
+
117
+ * Add `OpenSSL::SSL::SSLSocket#getbyte`.
118
+ [[GitHub #438]](https://github.com/ruby/openssl/issues/438)
119
+
120
+ * Add `OpenSSL::SSL::SSLContext#tmp_dh=`.
121
+ [[GitHub #459]](https://github.com/ruby/openssl/pull/459)
122
+
123
+ * Add `OpenSSL::X509::Certificate.load` to load a PEM-encoded and concatenated
124
+ list of X.509 certificates at once.
125
+ [[GitHub #441]](https://github.com/ruby/openssl/pull/441)
126
+
127
+ * Change `OpenSSL::X509::Certificate.new` to attempt to deserialize the given
128
+ string first as DER encoding first and then as PEM encoding to ensure the
129
+ round-trip consistency.
130
+ [[GitHub #442]](https://github.com/ruby/openssl/pull/442)
131
+
132
+ * Update various part of the code base to use the modern API. No breaking
133
+ changes are intended with this. This includes:
134
+
135
+ - `OpenSSL::HMAC` uses the EVP API.
136
+ [[GitHub #371]](https://github.com/ruby/openssl/issues/371)
137
+ - `OpenSSL::Config` uses native OpenSSL API to parse config files.
138
+ [[GitHub #342]](https://github.com/ruby/openssl/issues/342)
139
+
140
+
141
+ Version 2.2.3
142
+ =============
143
+
144
+ Bug fixes
145
+ ---------
146
+
147
+ * Fix serveral methods in OpenSSL::PKey::EC::Point attempting to raise an error
148
+ with an incorrect class, which would end up with a TypeError.
149
+ [[GitHub #570]](https://github.com/ruby/openssl/pull/570)
150
+ * Fix OpenSSL::PKey::EC::Point#eql? and OpenSSL::PKey::EC::Group#eql?
151
+ incorrectly treated OpenSSL's internal errors as "not equal".
152
+ [[GitHub #564]](https://github.com/ruby/openssl/pull/564)
153
+ * Fix build with LibreSSL 3.5 or later.
154
+
155
+
156
+ Version 2.2.2
157
+ =============
158
+
159
+ Merged changes in 2.1.4.
160
+
161
+
162
+ Version 2.2.1
163
+ =============
164
+
165
+ Merged changes in 2.1.3. Additionally, the following issues are fixed by this
166
+ release.
167
+
168
+ Bug fixes
169
+ ---------
170
+
171
+ * Fix crash in `OpenSSL::Timestamp::{Request,Response,TokenInfo}.new` when
172
+ invalid arguments are given.
173
+ [[GitHub #407]](https://github.com/ruby/openssl/pull/407)
174
+ * Fix `OpenSSL::Timestamp::Factory#create_timestamp` with LibreSSL on platforms
175
+ where `time_t` has a different size from `long`.
176
+ [[GitHub #454]](https://github.com/ruby/openssl/pull/454)
177
+
178
+
179
+ Version 2.2.0
180
+ =============
181
+
182
+ Compatibility notes
183
+ -------------------
184
+
185
+ * Remove unsupported MDC2, DSS, DSS1, and SHA algorithms.
186
+ * Remove `OpenSSL::PKCS7::SignerInfo#name` alias for `#issuer`.
187
+ [[GitHub #266]](https://github.com/ruby/openssl/pull/266)
188
+ * Deprecate `OpenSSL::Config#add_value` and `#[]=` for future removal.
189
+ [[GitHub #322]](https://github.com/ruby/openssl/pull/322)
190
+
191
+
192
+ Notable changes
193
+ ---------------
194
+
195
+ * Change default `OpenSSL::SSL::SSLServer#listen` backlog argument from
196
+ 5 to `Socket::SOMAXCONN`.
197
+ [[GitHub #286]](https://github.com/ruby/openssl/issues/286)
198
+ * Make `OpenSSL::HMAC#==` use a timing safe string comparison.
199
+ [[GitHub #284]](https://github.com/ruby/openssl/pull/284)
200
+ * Add support for SHA3 and BLAKE digests.
201
+ [[GitHub #282]](https://github.com/ruby/openssl/pull/282)
202
+ * Add `OpenSSL::SSL::SSLSocket.open` for opening a `TCPSocket` and
203
+ returning an `OpenSSL::SSL::SSLSocket` for it.
204
+ [[GitHub #225]](https://github.com/ruby/openssl/issues/225)
205
+ * Support marshalling of `OpenSSL::X509` and `OpenSSL::PKey` objects.
206
+ [[GitHub #281]](https://github.com/ruby/openssl/pull/281)
207
+ [[GitHub #363]](https://github.com/ruby/openssl/pull/363)
208
+ * Add `OpenSSL.secure_compare` for timing safe string comparison for
209
+ strings of possibly unequal length.
210
+ [[GitHub #280]](https://github.com/ruby/openssl/pull/280)
211
+ * Add `OpenSSL.fixed_length_secure_compare` for timing safe string
212
+ comparison for strings of equal length.
213
+ [[GitHub #269]](https://github.com/ruby/openssl/pull/269)
214
+ * Add `OpenSSL::SSL::SSLSocket#{finished_message,peer_finished_message}`
215
+ for last finished message sent and received.
216
+ [[GitHub #250]](https://github.com/ruby/openssl/pull/250)
217
+ * Add `OpenSSL::Timestamp` module for handing timestamp requests and
218
+ responses.
219
+ [[GitHub #204]](https://github.com/ruby/openssl/pull/204)
220
+ * Add helper methods for `OpenSSL::X509::Certificate`:
221
+ `find_extension`, `subject_key_identifier`,
222
+ `authority_key_identifier`, `crl_uris`, `ca_issuer_uris` and
223
+ `ocsp_uris`, and for `OpenSSL::X509::CRL`:
224
+ `find_extension` and `subject_key_identifier`.
225
+ [[GitHub #260]](https://github.com/ruby/openssl/pull/260)
226
+ [[GitHub #275]](https://github.com/ruby/openssl/pull/275)
227
+ [[GitHub #293]](https://github.com/ruby/openssl/pull/293)
228
+ * Add `OpenSSL::ECPoint#add` for performing elliptic curve point addition.
229
+ [[GitHub #261]](https://github.com/ruby/openssl/pull/261)
230
+ * Make `OpenSSL::PKey::RSA#{export,to_der}` check `key`, `factors`, and
231
+ `crt_params` to do proper private key serialization.
232
+ [[GitHub #258]](https://github.com/ruby/openssl/pull/258)
233
+ * Add `OpenSSL::SSL::{SSLSocket,SSLServer}#fileno`, returning the
234
+ underlying socket file descriptor number.
235
+ [[GitHub #247]](https://github.com/ruby/openssl/pull/247)
236
+ * Support client certificates with TLS 1.3, and support post-handshake
237
+ authentication with OpenSSL 1.1.1+.
238
+ [[GitHub #239]](https://github.com/ruby/openssl/pull/239)
239
+ * Add `OpenSSL::ASN1::ObjectId#==` for equality testing.
240
+ * Add `OpenSSL::X509::Extension#value_der` for the raw value of
241
+ the extension.
242
+ [[GitHub #234]](https://github.com/ruby/openssl/pull/234)
243
+ * Significantly reduce allocated memory in `OpenSSL::Buffering#do_write`.
244
+ [[GitHub #212]](https://github.com/ruby/openssl/pull/212)
245
+ * Ensure all valid IPv6 addresses are considered valid as elements
246
+ of subjectAlternativeName in certificates.
247
+ [[GitHub #185]](https://github.com/ruby/openssl/pull/185)
248
+ * Allow recipient's certificate to be omitted in PCKS7#decrypt.
249
+ [[GitHub #183]](https://github.com/ruby/openssl/pull/183)
250
+ * Add support for reading keys in PKCS #8 format and export via instance methods
251
+ added to `OpenSSL::PKey` classes: `private_to_der`, `private_to_pem`,
252
+ `public_to_der` and `public_to_pem`.
253
+ [[GitHub #297]](https://github.com/ruby/openssl/pull/297)
254
+
255
+
256
+ Version 2.1.4
257
+ =============
258
+
259
+ Bug fixes
260
+ ---------
261
+
262
+ * Do not use pkg-config if --with-openssl-dir option is specified.
263
+ [[GitHub #486]](https://github.com/ruby/openssl/pull/486)
264
+
265
+
1
266
  Version 2.1.3
2
267
  =============
3
268
 
@@ -19,7 +284,7 @@ Bug fixes
19
284
  [[GitHub #453]](https://github.com/ruby/openssl/pull/453)
20
285
  * Fix misuse of input record separator in `OpenSSL::Buffering` where it was
21
286
  for output.
22
- * Fix wrong interger casting in `OpenSSL::PKey::EC#dsa_verify_asn1`.
287
+ * Fix wrong integer casting in `OpenSSL::PKey::EC#dsa_verify_asn1`.
23
288
  [[GitHub #460]](https://github.com/ruby/openssl/pull/460)
24
289
  * `extconf.rb` explicitly checks that OpenSSL's version number is 1.0.1 or
25
290
  newer but also less than 3.0. Ruby/OpenSSL v2.1.x and v2.2.x will not support
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # OpenSSL for Ruby
2
2
 
3
- [![Build Status](https://travis-ci.org/ruby/openssl.svg?branch=master)](https://travis-ci.org/ruby/openssl)
4
- [![Build status](https://ci.appveyor.com/api/projects/status/b8djtmwo7l26f88y/branch/master?svg=true)](https://ci.appveyor.com/project/ruby/openssl/branch/master)
3
+ [![Actions Status](https://github.com/ruby/openssl/workflows/CI/badge.svg)](https://github.com/ruby/openssl/actions?workflow=CI)
4
+
5
5
 
6
6
  OpenSSL provides SSL, TLS and general purpose cryptography. It wraps the
7
7
  OpenSSL library.
@@ -1,5 +1,5 @@
1
1
  # -*- coding: us-ascii -*-
2
- # frozen_string_literal: false
2
+ # frozen_string_literal: true
3
3
  =begin
4
4
  = Info
5
5
  'OpenSSL for Ruby 2' project
@@ -12,16 +12,12 @@
12
12
  =end
13
13
 
14
14
  require "mkmf"
15
- require File.expand_path('../deprecation', __FILE__)
16
15
 
17
- dir_config("openssl")
16
+ dir_config_given = dir_config("openssl").any?
18
17
  dir_config("kerberos")
19
18
 
20
19
  Logging::message "=== OpenSSL for Ruby configurator ===\n"
21
20
 
22
- # Check with -Werror=deprecated-declarations if available
23
- OpenSSL.deprecated_warning_flag
24
-
25
21
  ##
26
22
  # Adds -DOSSL_DEBUG for compilation and some more targets when GCC is used
27
23
  # To turn it on, use: --with-debug or --enable-debug
@@ -30,6 +26,8 @@ if with_config("debug") or enable_config("debug")
30
26
  $defs.push("-DOSSL_DEBUG")
31
27
  end
32
28
 
29
+ have_func("rb_io_maybe_wait") # Ruby 3.1
30
+
33
31
  Logging::message "=== Checking for system dependent stuff... ===\n"
34
32
  have_library("nsl", "t_open")
35
33
  have_library("socket", "socket")
@@ -37,6 +35,12 @@ if $mswin || $mingw
37
35
  have_library("ws2_32")
38
36
  end
39
37
 
38
+ if $mingw
39
+ append_cflags '-D_FORTIFY_SOURCE=2'
40
+ append_ldflags '-fstack-protector'
41
+ have_library 'ssp'
42
+ end
43
+
40
44
  def find_openssl_library
41
45
  if $mswin || $mingw
42
46
  # required for static OpenSSL libraries
@@ -88,7 +92,7 @@ def find_openssl_library
88
92
  end
89
93
 
90
94
  Logging::message "=== Checking for required stuff... ===\n"
91
- pkg_config_found = pkg_config("openssl") && have_header("openssl/ssl.h")
95
+ pkg_config_found = !dir_config_given && pkg_config("openssl") && have_header("openssl/ssl.h")
92
96
 
93
97
  if !pkg_config_found && !find_openssl_library
94
98
  Logging::message "=== Checking for required stuff failed. ===\n"
@@ -100,15 +104,14 @@ end
100
104
 
101
105
  version_ok = if have_macro("LIBRESSL_VERSION_NUMBER", "openssl/opensslv.h")
102
106
  is_libressl = true
103
- checking_for("LibreSSL version >= 2.5.0") {
104
- try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x20500000L", "openssl/opensslv.h") }
107
+ checking_for("LibreSSL version >= 3.1.0") {
108
+ try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x30100000L", "openssl/opensslv.h") }
105
109
  else
106
- checking_for("OpenSSL version >= 1.0.1 and < 3.0.0") {
107
- try_static_assert("OPENSSL_VERSION_NUMBER >= 0x10001000L", "openssl/opensslv.h") &&
108
- !try_static_assert("OPENSSL_VERSION_MAJOR >= 3", "openssl/opensslv.h") }
110
+ checking_for("OpenSSL version >= 1.0.2") {
111
+ try_static_assert("OPENSSL_VERSION_NUMBER >= 0x10002000L", "openssl/opensslv.h") }
109
112
  end
110
113
  unless version_ok
111
- raise "OpenSSL >= 1.0.1, < 3.0.0 or LibreSSL >= 2.5.0 is required"
114
+ raise "OpenSSL >= 1.0.2 or LibreSSL >= 3.1.0 is required"
112
115
  end
113
116
 
114
117
  # Prevent wincrypt.h from being included, which defines conflicting macro with openssl/x509.h
@@ -119,38 +122,22 @@ end
119
122
  Logging::message "=== Checking for OpenSSL features... ===\n"
120
123
  # compile options
121
124
  have_func("RAND_egd")
122
- engines = %w{builtin_engines openbsd_dev_crypto dynamic 4758cca aep atalla chil
123
- cswift nuron sureware ubsec padlock capi gmp gost cryptodev aesni}
125
+ engines = %w{dynamic 4758cca aep atalla chil
126
+ cswift nuron sureware ubsec padlock capi gmp gost cryptodev}
124
127
  engines.each { |name|
125
- OpenSSL.check_func_or_macro("ENGINE_load_#{name}", "openssl/engine.h")
128
+ have_func("ENGINE_load_#{name}()", "openssl/engine.h")
126
129
  }
127
130
 
128
- # added in 1.0.2
129
- have_func("EC_curve_nist2nid")
130
- have_func("X509_REVOKED_dup")
131
- have_func("X509_STORE_CTX_get0_store")
132
- have_func("SSL_CTX_set_alpn_select_cb")
133
- OpenSSL.check_func_or_macro("SSL_CTX_set1_curves_list", "openssl/ssl.h")
134
- OpenSSL.check_func_or_macro("SSL_CTX_set_ecdh_auto", "openssl/ssl.h")
135
- OpenSSL.check_func_or_macro("SSL_get_server_tmp_key", "openssl/ssl.h")
136
- have_func("SSL_is_server")
137
-
138
131
  # added in 1.1.0
139
- if !have_struct_member("SSL", "ctx", "openssl/ssl.h") ||
140
- try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x2070000fL", "openssl/opensslv.h")
132
+ if !have_struct_member("SSL", "ctx", "openssl/ssl.h") || is_libressl
141
133
  $defs.push("-DHAVE_OPAQUE_OPENSSL")
142
134
  end
143
- have_func("CRYPTO_lock") || $defs.push("-DHAVE_OPENSSL_110_THREADING_API")
144
- have_func("BN_GENCB_new")
145
- have_func("BN_GENCB_free")
146
- have_func("BN_GENCB_get_arg")
147
135
  have_func("EVP_MD_CTX_new")
148
136
  have_func("EVP_MD_CTX_free")
149
- have_func("HMAC_CTX_new")
150
- have_func("HMAC_CTX_free")
151
- OpenSSL.check_func("RAND_pseudo_bytes", "openssl/rand.h") # deprecated
137
+ have_func("EVP_MD_CTX_pkey_ctx")
152
138
  have_func("X509_STORE_get_ex_data")
153
139
  have_func("X509_STORE_set_ex_data")
140
+ have_func("X509_STORE_get_ex_new_index")
154
141
  have_func("X509_CRL_get0_signature")
155
142
  have_func("X509_REQ_get0_signature")
156
143
  have_func("X509_REVOKED_get0_serialNumber")
@@ -166,16 +153,37 @@ have_func("X509_CRL_up_ref")
166
153
  have_func("X509_STORE_up_ref")
167
154
  have_func("SSL_SESSION_up_ref")
168
155
  have_func("EVP_PKEY_up_ref")
169
- OpenSSL.check_func_or_macro("SSL_CTX_set_tmp_ecdh_callback", "openssl/ssl.h") # removed
170
- OpenSSL.check_func_or_macro("SSL_CTX_set_min_proto_version", "openssl/ssl.h")
156
+ have_func("SSL_CTX_set_min_proto_version(NULL, 0)", "openssl/ssl.h")
171
157
  have_func("SSL_CTX_get_security_level")
172
158
  have_func("X509_get0_notBefore")
173
159
  have_func("SSL_SESSION_get_protocol_version")
160
+ have_func("TS_STATUS_INFO_get0_status")
161
+ have_func("TS_STATUS_INFO_get0_text")
162
+ have_func("TS_STATUS_INFO_get0_failure_info")
163
+ have_func("TS_VERIFY_CTS_set_certs(NULL, NULL)", "openssl/ts.h")
164
+ have_func("TS_VERIFY_CTX_set_store")
165
+ have_func("TS_VERIFY_CTX_add_flags")
166
+ have_func("TS_RESP_CTX_set_time_cb")
174
167
  have_func("EVP_PBE_scrypt")
168
+ have_func("SSL_CTX_set_post_handshake_auth")
169
+
170
+ # added in 1.1.1
171
+ have_func("EVP_PKEY_check")
172
+ have_func("EVP_PKEY_new_raw_private_key")
173
+
174
+ # added in 3.0.0
175
+ have_func("SSL_set0_tmp_dh_pkey")
176
+ have_func("ERR_get_error_all")
177
+ have_func("TS_VERIFY_CTX_set_certs(NULL, NULL)", "openssl/ts.h")
178
+ have_func("SSL_CTX_load_verify_file")
179
+ have_func("BN_check_prime")
180
+ have_func("EVP_MD_CTX_get0_md")
181
+ have_func("EVP_MD_CTX_get_pkey_ctx")
182
+ have_func("EVP_PKEY_eq")
183
+ have_func("EVP_PKEY_dup")
175
184
 
176
185
  Logging::message "=== Checking done. ===\n"
177
186
 
178
187
  create_header
179
- OpenSSL.restore_warning_flag
180
188
  create_makefile("openssl")
181
189
  Logging::message "Done.\n"
@@ -10,77 +10,11 @@
10
10
  #include RUBY_EXTCONF_H
11
11
 
12
12
  #include <string.h> /* memcpy() */
13
- #if !defined(OPENSSL_NO_ENGINE)
14
- # include <openssl/engine.h>
15
- #endif
16
- #if !defined(OPENSSL_NO_HMAC)
17
- # include <openssl/hmac.h>
18
- #endif
19
13
  #include <openssl/x509_vfy.h>
20
14
 
21
15
  #include "openssl_missing.h"
22
16
 
23
- /* added in 1.0.2 */
24
- #if !defined(OPENSSL_NO_EC)
25
- #if !defined(HAVE_EC_CURVE_NIST2NID)
26
- static struct {
27
- const char *name;
28
- int nid;
29
- } nist_curves[] = {
30
- {"B-163", NID_sect163r2},
31
- {"B-233", NID_sect233r1},
32
- {"B-283", NID_sect283r1},
33
- {"B-409", NID_sect409r1},
34
- {"B-571", NID_sect571r1},
35
- {"K-163", NID_sect163k1},
36
- {"K-233", NID_sect233k1},
37
- {"K-283", NID_sect283k1},
38
- {"K-409", NID_sect409k1},
39
- {"K-571", NID_sect571k1},
40
- {"P-192", NID_X9_62_prime192v1},
41
- {"P-224", NID_secp224r1},
42
- {"P-256", NID_X9_62_prime256v1},
43
- {"P-384", NID_secp384r1},
44
- {"P-521", NID_secp521r1}
45
- };
46
-
47
- int
48
- ossl_EC_curve_nist2nid(const char *name)
49
- {
50
- size_t i;
51
- for (i = 0; i < (sizeof(nist_curves) / sizeof(nist_curves[0])); i++) {
52
- if (!strcmp(nist_curves[i].name, name))
53
- return nist_curves[i].nid;
54
- }
55
- return NID_undef;
56
- }
57
- #endif
58
- #endif
59
-
60
17
  /*** added in 1.1.0 ***/
61
- #if !defined(HAVE_HMAC_CTX_NEW)
62
- HMAC_CTX *
63
- ossl_HMAC_CTX_new(void)
64
- {
65
- HMAC_CTX *ctx = OPENSSL_malloc(sizeof(HMAC_CTX));
66
- if (!ctx)
67
- return NULL;
68
- HMAC_CTX_init(ctx);
69
- return ctx;
70
- }
71
- #endif
72
-
73
- #if !defined(HAVE_HMAC_CTX_FREE)
74
- void
75
- ossl_HMAC_CTX_free(HMAC_CTX *ctx)
76
- {
77
- if (ctx) {
78
- HMAC_CTX_cleanup(ctx);
79
- OPENSSL_free(ctx);
80
- }
81
- }
82
- #endif
83
-
84
18
  #if !defined(HAVE_X509_CRL_GET0_SIGNATURE)
85
19
  void
86
20
  ossl_X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig,