openssl 3.3.2 → 4.0.0

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +3 -0
  3. data/History.md +85 -0
  4. data/README.md +12 -11
  5. data/ext/openssl/extconf.rb +30 -69
  6. data/ext/openssl/openssl_missing.h +0 -206
  7. data/ext/openssl/ossl.c +280 -301
  8. data/ext/openssl/ossl.h +15 -10
  9. data/ext/openssl/ossl_asn1.c +598 -406
  10. data/ext/openssl/ossl_asn1.h +15 -1
  11. data/ext/openssl/ossl_bio.c +3 -3
  12. data/ext/openssl/ossl_bn.c +286 -291
  13. data/ext/openssl/ossl_cipher.c +252 -203
  14. data/ext/openssl/ossl_cipher.h +10 -1
  15. data/ext/openssl/ossl_config.c +1 -6
  16. data/ext/openssl/ossl_digest.c +74 -43
  17. data/ext/openssl/ossl_digest.h +9 -1
  18. data/ext/openssl/ossl_engine.c +39 -103
  19. data/ext/openssl/ossl_hmac.c +30 -36
  20. data/ext/openssl/ossl_kdf.c +42 -53
  21. data/ext/openssl/ossl_ns_spki.c +31 -37
  22. data/ext/openssl/ossl_ocsp.c +214 -241
  23. data/ext/openssl/ossl_pkcs12.c +26 -26
  24. data/ext/openssl/ossl_pkcs7.c +175 -145
  25. data/ext/openssl/ossl_pkey.c +162 -178
  26. data/ext/openssl/ossl_pkey.h +99 -99
  27. data/ext/openssl/ossl_pkey_dh.c +31 -68
  28. data/ext/openssl/ossl_pkey_dsa.c +15 -54
  29. data/ext/openssl/ossl_pkey_ec.c +179 -237
  30. data/ext/openssl/ossl_pkey_rsa.c +56 -103
  31. data/ext/openssl/ossl_provider.c +0 -7
  32. data/ext/openssl/ossl_rand.c +7 -14
  33. data/ext/openssl/ossl_ssl.c +478 -353
  34. data/ext/openssl/ossl_ssl.h +8 -8
  35. data/ext/openssl/ossl_ssl_session.c +93 -97
  36. data/ext/openssl/ossl_ts.c +81 -127
  37. data/ext/openssl/ossl_x509.c +9 -28
  38. data/ext/openssl/ossl_x509attr.c +33 -54
  39. data/ext/openssl/ossl_x509cert.c +69 -100
  40. data/ext/openssl/ossl_x509crl.c +78 -89
  41. data/ext/openssl/ossl_x509ext.c +45 -66
  42. data/ext/openssl/ossl_x509name.c +63 -88
  43. data/ext/openssl/ossl_x509req.c +55 -62
  44. data/ext/openssl/ossl_x509revoked.c +27 -41
  45. data/ext/openssl/ossl_x509store.c +38 -56
  46. data/lib/openssl/buffering.rb +30 -24
  47. data/lib/openssl/digest.rb +1 -1
  48. data/lib/openssl/pkey.rb +71 -49
  49. data/lib/openssl/ssl.rb +12 -79
  50. data/lib/openssl/version.rb +2 -1
  51. data/lib/openssl/x509.rb +9 -0
  52. data/lib/openssl.rb +9 -6
  53. metadata +1 -3
  54. data/ext/openssl/openssl_missing.c +0 -40
  55. data/lib/openssl/asn1.rb +0 -188
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0039c89cb0a5852520e895ae303d8b4a9f874a12c6b55684e002cc9d04278df9'
4
- data.tar.gz: 4634f9bf38e64d130d84f812e18eaa0ea918a4eb9fcdb4349deca9aff64030f1
3
+ metadata.gz: 6fcaf50b270f86ea2f4b858ebc39103f84dab425927ebe374763123882887ddf
4
+ data.tar.gz: 9443864ee52834e8c8fb065c6e560e5a7072eedb14ebf59cc7dbeff717ecfb6b
5
5
  SHA512:
6
- metadata.gz: 29c064c6c868bc9ec703fe7f29772b951a4712ffcfe6ab17600401650103ef68022c0fcc84d6b0a7b1b1671e12bd2842666e6f9a8a2692aa74fb24898239d374
7
- data.tar.gz: 95b6388a7a230616e5e248b81f917aef07b1827909c6e34465567dc56406223977ec9ddec1a590cfc05ae61b3658c2d681a76843d6b8130cd451401951476df5
6
+ metadata.gz: 9188ba72659d39dc3a61992e802f055d68ba0d282a0de671f691d8f96e3cdbcdbd3bf9ee1dec144afb6dba022227256d2bb2878b2dc053a115768d153b653325
7
+ data.tar.gz: cf5b06f6f262d8e2be158ffe8b94df87cf3b30d866722bb0b57a2ef3bdfa1792bffd2860988b3ed85ca590915ad0cb4bfcc87c0a0941b97f5bf736e2a8c43bb3
data/CONTRIBUTING.md CHANGED
@@ -224,6 +224,9 @@ $ OPENSSL_CONF=$OPENSSL_DIR/ssl/openssl_fips.cnf \
224
224
  The GitHub Actions workflow file [`test.yml`][GitHub test.yml] contains useful
225
225
  information for building OpenSSL/LibreSSL and testing against them.
226
226
 
227
+ ## Debugging
228
+
229
+ You can use the `OpenSSL.debug = true` to print additional error strings.
227
230
 
228
231
  ## Relation with Ruby source tree
229
232
 
data/History.md CHANGED
@@ -1,3 +1,88 @@
1
+ Version 4.0.0
2
+ =============
3
+
4
+ Compatibility
5
+ -------------
6
+
7
+ * Ruby >= 2.7
8
+ * OpenSSL >= 1.1.1, LibreSSL >= 3.9, and AWS-LC 1.66.0
9
+ - Removed support for OpenSSL 1.0.2-1.1.0 and LibreSSL 3.1-3.8.
10
+ [[GitHub #835]](https://github.com/ruby/openssl/issues/835)
11
+ - Added support for AWS-LC.
12
+ [[GitHub #833]](https://github.com/ruby/openssl/issues/833)
13
+
14
+
15
+ Notable changes
16
+ ---------------
17
+
18
+ * `OpenSSL::SSL`
19
+ - Reduce overhead when writing to `OpenSSL::SSL::SSLSocket`. `#syswrite` no
20
+ longer creates a temporary String object.
21
+ [[GitHub #831]](https://github.com/ruby/openssl/pull/831)
22
+ - Make `OpenSSL::SSL::SSLContext#min_version=` and `#max_version=` wrap the
23
+ corresponding OpenSSL APIs directly, and remove the fallback to SSL options.
24
+ [[GitHub #849]](https://github.com/ruby/openssl/pull/849)
25
+ - Add `OpenSSL::SSL::SSLContext#sigalgs=` and `#client_sigalgs=` for
26
+ specifying signature algorithms to use for connections.
27
+ [[GitHub #895]](https://github.com/ruby/openssl/pull/895)
28
+ - Rename `OpenSSL::SSL::SSLContext#ecdh_curves=` to `#groups=` following
29
+ the underlying OpenSSL API rename. This method is no longer specific to
30
+ ECDHE. The old method remains as an alias.
31
+ [[GitHub #900]](https://github.com/ruby/openssl/pull/900)
32
+ - Add `OpenSSL::SSL::SSLSocket#sigalg`, `#peer_sigalg`, and `#group` for
33
+ getting the signature algorithm and the key agreement group used in the
34
+ current connection.
35
+ [[GitHub #908]](https://github.com/ruby/openssl/pull/908)
36
+ - Enable `SSL_CTX_set_dh_auto()` for servers by default.
37
+ [[GitHub #924]](https://github.com/ruby/openssl/pull/924)
38
+ - Improve Ractor compatibility. Note that the internal-use constant
39
+ `OpenSSL::SSL::SSLContext::DEFAULT_PARAMS` is now frozen.
40
+ [[GitHub #925]](https://github.com/ruby/openssl/pull/925)
41
+ * `OpenSSL::PKey`
42
+ - Remove `OpenSSL::PKey::EC::Point#mul` support with array arguments. The
43
+ underlying OpenSSL API has been removed, and the method has been deprecated
44
+ since ruby/openssl v3.0.0.
45
+ [[GitHub #843]](https://github.com/ruby/openssl/pull/843)
46
+ - `OpenSSL::PKey::{RSA,DSA,DH}#params` uses `nil` to indicate missing fields
47
+ instead of the number `0`.
48
+ [[GitHub #774]](https://github.com/ruby/openssl/pull/774)
49
+ - Unify `OpenSSL::PKey::PKeyError` classes. The former subclasses
50
+ `OpenSSL::PKey::DHError`, `OpenSSL::PKey::DSAError`,
51
+ `OpenSSL::PKey::ECError`, and `OpenSSL::PKey::RSAError` have been merged
52
+ into a single class.
53
+ [[GitHub #929]](https://github.com/ruby/openssl/pull/929)
54
+ * `OpenSSL::Cipher`
55
+ - `OpenSSL::Cipher#encrypt` and `#decrypt` no longer accept arguments.
56
+ Passing passwords has been deprecated since Ruby 1.8.2 (released in 2004).
57
+ [[GitHub #887]](https://github.com/ruby/openssl/pull/887)
58
+ - `OpenSSL::Cipher#final` raises `OpenSSL::Cipher::AuthTagError` when the
59
+ integrity check fails for AEAD ciphers. `OpenSSL::Cipher::AuthTagError` is a
60
+ new subclass of `OpenSSL::Cipher::CipherError`, which was previously raised.
61
+ [[GitHub #939]](https://github.com/ruby/openssl/pull/939)
62
+ - `OpenSSL::Cipher.new` now raises `OpenSSL::Cipher::CipherError` instead of
63
+ `RuntimeError` when OpenSSL does not recognize the algorithm.
64
+ [[GitHub #958]](https://github.com/ruby/openssl/pull/958)
65
+ - Add support for "fetched" cipher algorithms with OpenSSL 3.0 or later.
66
+ [[GitHub #958]](https://github.com/ruby/openssl/pull/958)
67
+ * `OpenSSL::Digest`
68
+ - `OpenSSL::Digest.new` now raises `OpenSSL::Digest::DigestError` instead of
69
+ `RuntimeError` when OpenSSL does not recognize the algorithm.
70
+ [[GitHub #958]](https://github.com/ruby/openssl/pull/958)
71
+ - Add support for "fetched" digest algorithms with OpenSSL 3.0 or later.
72
+ [[GitHub #958]](https://github.com/ruby/openssl/pull/958)
73
+ * `OpenSSL::ASN1.decode` now assumes a 1950-2049 year range for `UTCTime`
74
+ according to RFC 5280. It previously used a 1969-2068 range. The encoder
75
+ has always used the 1950-2049 range.
76
+ [[GitHub #909]](https://github.com/ruby/openssl/pull/909)
77
+ * `OpenSSL::OpenSSLError`, the base class for all ruby/openssl errors, carry
78
+ an additional attribute `#errors` to keep the content of OpenSSL's error
79
+ queue. Also, add `#detailed_message` for Ruby 3.2 or later.
80
+ [[GitHub #976]](https://github.com/ruby/openssl/pull/976)
81
+ * `OpenSSL::PKCS7.new` raises `OpenSSL::PKCS7::PKCS7Error` instead of
82
+ `ArgumentError` on error to be consistent with other constructors.
83
+ [[GitHub #983]](https://github.com/ruby/openssl/pull/983)
84
+
85
+
1
86
  Version 3.3.2
2
87
  =============
3
88
 
data/README.md CHANGED
@@ -16,17 +16,18 @@ the standard library of Ruby. This is called a [default gem].
16
16
  Each stable branch of OpenSSL for Ruby will remain supported as long as it is
17
17
  included as a default gem in [supported Ruby branches][Ruby Maintenance Branches].
18
18
 
19
- |Version|Maintenance status |Ruby compatibility|OpenSSL compatibility |
20
- |-------|-------------------------------|------------------|--------------------------------------------|
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+ |
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+ |
27
- |2.0.x |end-of-life (Ruby 2.4) |Ruby 2.3+ |OpenSSL 0.9.8-1.1.1 or LibreSSL 2.3+ |
28
-
29
- [default gem]: https://docs.ruby-lang.org/en/master/standard_library_rdoc.html
19
+ |Version|Minimum Ruby|OpenSSL compatibility |Bundled with|Maintenance |
20
+ |-------|------------|-----------------------------------------|------------|-------------|
21
+ |4.0.x |Ruby 2.7 |OpenSSL 1.1.1-3.x, LibreSSL 3.9+, AWS-LC |Ruby 4.0 |bug fixes |
22
+ |3.3.x |Ruby 2.7 |OpenSSL 1.0.2-3.x, LibreSSL 3.1+ |Ruby 3.4 |bug fixes |
23
+ |3.2.x |Ruby 2.7 |OpenSSL 1.0.2-3.x, LibreSSL 3.1+ |Ruby 3.3 |bug fixes |
24
+ |3.1.x |Ruby 2.6 |OpenSSL 1.0.2-3.x, LibreSSL 3.1+ |Ruby 3.2 |security only|
25
+ |3.0.x |Ruby 2.6 |OpenSSL 1.0.2-3.x, LibreSSL 3.1+ |Ruby 3.1 |end-of-life |
26
+ |2.2.x |Ruby 2.3 |OpenSSL 1.0.1-1.1.1, LibreSSL 2.9+ |Ruby 3.0 |end-of-life |
27
+ |2.1.x |Ruby 2.3 |OpenSSL 1.0.1-1.1.1, LibreSSL 2.5+ |Ruby 2.5-2.7|end-of-life |
28
+ |2.0.x |Ruby 2.3 |OpenSSL 0.9.8-1.1.1, LibreSSL 2.3+ |Ruby 2.4 |end-of-life |
29
+
30
+ [default gem]: https://docs.ruby-lang.org/en/master/standard_library_md.html
30
31
  [Ruby Maintenance Branches]: https://www.ruby-lang.org/en/downloads/branches/
31
32
 
32
33
  ## Installation
@@ -34,14 +34,16 @@ if ssl_ldir&.split(File::PATH_SEPARATOR)&.none? { |dir| File.directory?(dir) }
34
34
  "library directories."
35
35
  end
36
36
 
37
- dir_config("kerberos")
38
-
39
37
  Logging::message "=== OpenSSL for Ruby configurator ===\n"
40
38
 
41
39
  $defs.push("-D""OPENSSL_SUPPRESS_DEPRECATED")
42
40
 
43
- have_func("rb_io_descriptor")
44
- have_func("rb_io_maybe_wait(0, Qnil, Qnil, Qnil)", "ruby/io.h") # Ruby 3.1
41
+ # Missing in TruffleRuby
42
+ have_func("rb_call_super_kw(0, NULL, 0)", "ruby.h")
43
+ # Ruby 3.1
44
+ have_func("rb_io_descriptor", "ruby/io.h")
45
+ have_func("rb_io_maybe_wait(0, Qnil, Qnil, Qnil)", "ruby/io.h")
46
+ # Ruby 3.2
45
47
  have_func("rb_io_timeout", "ruby/io.h")
46
48
 
47
49
  Logging::message "=== Checking for system dependent stuff... ===\n"
@@ -60,7 +62,6 @@ end
60
62
  def find_openssl_library
61
63
  if $mswin || $mingw
62
64
  # required for static OpenSSL libraries
63
- have_library("gdi32") # OpenSSL <= 1.0.2 (for RAND_screen())
64
65
  have_library("crypt32")
65
66
  end
66
67
 
@@ -77,12 +78,6 @@ def find_openssl_library
77
78
  return true
78
79
  end
79
80
 
80
- # OpenSSL <= 1.0.2: libeay32.lib and ssleay32.lib.
81
- if have_library("libeay32", "CRYPTO_malloc") &&
82
- have_library("ssleay32", "SSL_new")
83
- return true
84
- end
85
-
86
81
  # LibreSSL: libcrypto-##.lib and libssl-##.lib, where ## is the ABI version
87
82
  # number. We have to find the version number out by scanning libpath.
88
83
  libpath = $LIBPATH.dup
@@ -120,14 +115,15 @@ end
120
115
 
121
116
  version_ok = if have_macro("LIBRESSL_VERSION_NUMBER", "openssl/opensslv.h")
122
117
  is_libressl = true
123
- checking_for("LibreSSL version >= 3.1.0") {
124
- try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x30100000L", "openssl/opensslv.h") }
118
+ checking_for("LibreSSL version >= 3.9.0") {
119
+ try_static_assert("LIBRESSL_VERSION_NUMBER >= 0x30900000L", "openssl/opensslv.h") }
125
120
  else
126
- checking_for("OpenSSL version >= 1.0.2") {
127
- try_static_assert("OPENSSL_VERSION_NUMBER >= 0x10002000L", "openssl/opensslv.h") }
121
+ is_openssl = true
122
+ checking_for("OpenSSL version >= 1.1.1") {
123
+ try_static_assert("OPENSSL_VERSION_NUMBER >= 0x10101000L", "openssl/opensslv.h") }
128
124
  end
129
125
  unless version_ok
130
- raise "OpenSSL >= 1.0.2 or LibreSSL >= 3.1.0 is required"
126
+ raise "OpenSSL >= 1.1.1 or LibreSSL >= 3.9.0 is required"
131
127
  end
132
128
 
133
129
  # Prevent wincrypt.h from being included, which defines conflicting macro with openssl/x509.h
@@ -137,70 +133,26 @@ end
137
133
 
138
134
  Logging::message "=== Checking for OpenSSL features... ===\n"
139
135
  evp_h = "openssl/evp.h".freeze
140
- x509_h = "openssl/x509.h".freeze
141
136
  ts_h = "openssl/ts.h".freeze
142
137
  ssl_h = "openssl/ssl.h".freeze
143
138
 
144
139
  # compile options
145
140
  have_func("RAND_egd()", "openssl/rand.h")
146
- engines = %w{dynamic 4758cca aep atalla chil
147
- cswift nuron sureware ubsec padlock capi gmp gost cryptodev}
148
- engines.each { |name|
149
- have_func("ENGINE_load_#{name}()", "openssl/engine.h")
150
- }
151
-
152
- # missing in libressl < 3.5
153
- have_func("i2d_re_X509_tbs(NULL, NULL)", x509_h)
154
-
155
- # added in 1.1.0
156
- if !have_struct_member("SSL", "ctx", "openssl/ssl.h") || is_libressl
157
- $defs.push("-DHAVE_OPAQUE_OPENSSL")
158
- end
159
- have_func("EVP_MD_CTX_new()", evp_h)
160
- have_func("EVP_MD_CTX_free(NULL)", evp_h)
161
- have_func("EVP_MD_CTX_pkey_ctx(NULL)", evp_h)
162
- have_func("X509_STORE_get_ex_data(NULL, 0)", x509_h)
163
- have_func("X509_STORE_set_ex_data(NULL, 0, NULL)", x509_h)
164
- have_func("X509_STORE_get_ex_new_index(0, NULL, NULL, NULL, NULL)", x509_h)
165
- have_func("X509_CRL_get0_signature(NULL, NULL, NULL)", x509_h)
166
- have_func("X509_REQ_get0_signature(NULL, NULL, NULL)", x509_h)
167
- have_func("X509_REVOKED_get0_serialNumber(NULL)", x509_h)
168
- have_func("X509_REVOKED_get0_revocationDate(NULL)", x509_h)
169
- have_func("X509_get0_tbs_sigalg(NULL)", x509_h)
170
- have_func("X509_STORE_CTX_get0_untrusted(NULL)", x509_h)
171
- have_func("X509_STORE_CTX_get0_cert(NULL)", x509_h)
172
- have_func("X509_STORE_CTX_get0_chain(NULL)", x509_h)
173
- have_func("OCSP_SINGLERESP_get0_id(NULL)", "openssl/ocsp.h")
174
- have_func("SSL_CTX_get_ciphers(NULL)", ssl_h)
175
- have_func("X509_up_ref(NULL)", x509_h)
176
- have_func("X509_CRL_up_ref(NULL)", x509_h)
177
- have_func("X509_STORE_up_ref(NULL)", x509_h)
178
- have_func("SSL_SESSION_up_ref(NULL)", ssl_h)
179
- have_func("EVP_PKEY_up_ref(NULL)", evp_h)
180
- have_func("SSL_CTX_set_min_proto_version(NULL, 0)", ssl_h)
181
- have_func("SSL_CTX_get_security_level(NULL)", ssl_h)
182
- have_func("X509_get0_notBefore(NULL)", x509_h)
183
- have_func("SSL_SESSION_get_protocol_version(NULL)", ssl_h)
184
- have_func("TS_STATUS_INFO_get0_status(NULL)", ts_h)
185
- have_func("TS_STATUS_INFO_get0_text(NULL)", ts_h)
186
- have_func("TS_STATUS_INFO_get0_failure_info(NULL)", ts_h)
187
- have_func("TS_VERIFY_CTS_set_certs(NULL, NULL)", ts_h)
188
- have_func("TS_VERIFY_CTX_set_store(NULL, NULL)", ts_h)
189
- have_func("TS_VERIFY_CTX_add_flags(NULL, 0)", ts_h)
190
- have_func("TS_RESP_CTX_set_time_cb(NULL, NULL, NULL)", ts_h)
141
+
142
+ # added in OpenSSL 1.0.2, not in LibreSSL yet
143
+ have_func("SSL_CTX_set1_sigalgs_list(NULL, NULL)", ssl_h)
144
+ # added in OpenSSL 1.0.2, not in LibreSSL or AWS-LC yet
145
+ have_func("SSL_CTX_set1_client_sigalgs_list(NULL, NULL)", ssl_h)
146
+
147
+ # added in 1.1.0, currently not in LibreSSL
191
148
  have_func("EVP_PBE_scrypt(\"\", 0, (unsigned char *)\"\", 0, 0, 0, 0, 0, NULL, 0)", evp_h)
192
- have_func("SSL_CTX_set_post_handshake_auth(NULL, 0)", ssl_h)
193
- have_func("X509_STORE_get0_param(NULL)", x509_h)
194
149
 
195
- # added in 1.1.1
150
+ # added in OpenSSL 1.1.1 and LibreSSL 3.5.0, then removed in LibreSSL 4.0.0
196
151
  have_func("EVP_PKEY_check(NULL)", evp_h)
197
- have_func("EVP_PKEY_new_raw_private_key(0, NULL, (unsigned char *)\"\", 0)", evp_h)
198
- have_func("SSL_CTX_set_ciphersuites(NULL, \"\")", ssl_h)
199
152
 
200
153
  # added in 3.0.0
201
- have_func("SSL_set0_tmp_dh_pkey(NULL, NULL)", ssl_h)
154
+ have_func("SSL_CTX_set0_tmp_dh_pkey(NULL, NULL)", ssl_h)
202
155
  have_func("ERR_get_error_all(NULL, NULL, NULL, NULL, NULL)", "openssl/err.h")
203
- have_func("TS_VERIFY_CTX_set_certs(NULL, NULL)", ts_h)
204
156
  have_func("SSL_CTX_load_verify_file(NULL, \"\")", ssl_h)
205
157
  have_func("BN_check_prime(NULL, NULL, NULL)", "openssl/bn.h")
206
158
  have_func("EVP_MD_CTX_get0_md(NULL)", evp_h)
@@ -208,6 +160,15 @@ have_func("EVP_MD_CTX_get_pkey_ctx(NULL)", evp_h)
208
160
  have_func("EVP_PKEY_eq(NULL, NULL)", evp_h)
209
161
  have_func("EVP_PKEY_dup(NULL)", evp_h)
210
162
 
163
+ # added in 3.2.0
164
+ have_func("SSL_get0_group_name(NULL)", ssl_h)
165
+
166
+ # added in 3.4.0
167
+ have_func("TS_VERIFY_CTX_set0_certs(NULL, NULL)", ts_h)
168
+
169
+ # added in 3.5.0
170
+ have_func("SSL_get0_peer_signature_name(NULL, NULL)", ssl_h)
171
+
211
172
  Logging::message "=== Checking done. ===\n"
212
173
 
213
174
  # Append flags from environment variables.
@@ -12,209 +12,7 @@
12
12
 
13
13
  #include "ruby/config.h"
14
14
 
15
- /* added in 1.1.0 */
16
- #if !defined(HAVE_EVP_MD_CTX_NEW)
17
- # define EVP_MD_CTX_new EVP_MD_CTX_create
18
- #endif
19
-
20
- #if !defined(HAVE_EVP_MD_CTX_FREE)
21
- # define EVP_MD_CTX_free EVP_MD_CTX_destroy
22
- #endif
23
-
24
- #if !defined(HAVE_X509_STORE_GET_EX_DATA)
25
- # define X509_STORE_get_ex_data(x, idx) \
26
- CRYPTO_get_ex_data(&(x)->ex_data, (idx))
27
- #endif
28
-
29
- #if !defined(HAVE_X509_STORE_SET_EX_DATA)
30
- # define X509_STORE_set_ex_data(x, idx, data) \
31
- CRYPTO_set_ex_data(&(x)->ex_data, (idx), (data))
32
- #endif
33
-
34
- #if !defined(HAVE_X509_STORE_GET_EX_NEW_INDEX) && !defined(X509_STORE_get_ex_new_index)
35
- # define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \
36
- CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, (l), (p), \
37
- (newf), (dupf), (freef))
38
- #endif
39
-
40
- #if !defined(HAVE_X509_CRL_GET0_SIGNATURE)
41
- void ossl_X509_CRL_get0_signature(const X509_CRL *, const ASN1_BIT_STRING **, const X509_ALGOR **);
42
- # define X509_CRL_get0_signature ossl_X509_CRL_get0_signature
43
- #endif
44
-
45
- #if !defined(HAVE_X509_REQ_GET0_SIGNATURE)
46
- void ossl_X509_REQ_get0_signature(const X509_REQ *, const ASN1_BIT_STRING **, const X509_ALGOR **);
47
- # define X509_REQ_get0_signature ossl_X509_REQ_get0_signature
48
- #endif
49
-
50
- #if !defined(HAVE_X509_REVOKED_GET0_SERIALNUMBER)
51
- # define X509_REVOKED_get0_serialNumber(x) ((x)->serialNumber)
52
- #endif
53
-
54
- #if !defined(HAVE_X509_REVOKED_GET0_REVOCATIONDATE)
55
- # define X509_REVOKED_get0_revocationDate(x) ((x)->revocationDate)
56
- #endif
57
-
58
- #if !defined(HAVE_X509_GET0_TBS_SIGALG)
59
- # define X509_get0_tbs_sigalg(x) ((x)->cert_info->signature)
60
- #endif
61
-
62
- #if !defined(HAVE_X509_STORE_CTX_GET0_UNTRUSTED)
63
- # define X509_STORE_CTX_get0_untrusted(x) ((x)->untrusted)
64
- #endif
65
-
66
- #if !defined(HAVE_X509_STORE_CTX_GET0_CERT)
67
- # define X509_STORE_CTX_get0_cert(x) ((x)->cert)
68
- #endif
69
-
70
- #if !defined(HAVE_X509_STORE_CTX_GET0_CHAIN)
71
- # define X509_STORE_CTX_get0_chain(ctx) X509_STORE_CTX_get_chain(ctx)
72
- #endif
73
-
74
- #if !defined(HAVE_OCSP_SINGLERESP_GET0_ID)
75
- # define OCSP_SINGLERESP_get0_id(s) ((s)->certId)
76
- #endif
77
-
78
- #if !defined(HAVE_SSL_CTX_GET_CIPHERS)
79
- # define SSL_CTX_get_ciphers(ctx) ((ctx)->cipher_list)
80
- #endif
81
-
82
- #if !defined(HAVE_X509_UP_REF)
83
- # define X509_up_ref(x) \
84
- CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509)
85
- #endif
86
-
87
- #if !defined(HAVE_X509_CRL_UP_REF)
88
- # define X509_CRL_up_ref(x) \
89
- CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509_CRL);
90
- #endif
91
-
92
- #if !defined(HAVE_X509_STORE_UP_REF)
93
- # define X509_STORE_up_ref(x) \
94
- CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509_STORE);
95
- #endif
96
-
97
- #if !defined(HAVE_SSL_SESSION_UP_REF)
98
- # define SSL_SESSION_up_ref(x) \
99
- CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_SSL_SESSION);
100
- #endif
101
-
102
- #if !defined(HAVE_EVP_PKEY_UP_REF)
103
- # define EVP_PKEY_up_ref(x) \
104
- CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_EVP_PKEY);
105
- #endif
106
-
107
- #if !defined(HAVE_OPAQUE_OPENSSL)
108
- #define IMPL_PKEY_GETTER(_type, _name) \
109
- static inline _type *EVP_PKEY_get0_##_type(EVP_PKEY *pkey) { \
110
- return pkey->pkey._name; }
111
- #define IMPL_KEY_ACCESSOR2(_type, _group, a1, a2, _fail_cond) \
112
- static inline void _type##_get0_##_group(const _type *obj, const BIGNUM **a1, const BIGNUM **a2) { \
113
- if (a1) *a1 = obj->a1; \
114
- if (a2) *a2 = obj->a2; } \
115
- static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2) { \
116
- if (_fail_cond) return 0; \
117
- BN_clear_free(obj->a1); obj->a1 = a1; \
118
- BN_clear_free(obj->a2); obj->a2 = a2; \
119
- return 1; }
120
- #define IMPL_KEY_ACCESSOR3(_type, _group, a1, a2, a3, _fail_cond) \
121
- static inline void _type##_get0_##_group(const _type *obj, const BIGNUM **a1, const BIGNUM **a2, const BIGNUM **a3) { \
122
- if (a1) *a1 = obj->a1; \
123
- if (a2) *a2 = obj->a2; \
124
- if (a3) *a3 = obj->a3; } \
125
- static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2, BIGNUM *a3) { \
126
- if (_fail_cond) return 0; \
127
- BN_clear_free(obj->a1); obj->a1 = a1; \
128
- BN_clear_free(obj->a2); obj->a2 = a2; \
129
- BN_clear_free(obj->a3); obj->a3 = a3; \
130
- return 1; }
131
-
132
- #if !defined(OPENSSL_NO_RSA)
133
- IMPL_PKEY_GETTER(RSA, rsa)
134
- IMPL_KEY_ACCESSOR3(RSA, key, n, e, d, (n == obj->n || e == obj->e || (obj->d && d == obj->d)))
135
- IMPL_KEY_ACCESSOR2(RSA, factors, p, q, (p == obj->p || q == obj->q))
136
- IMPL_KEY_ACCESSOR3(RSA, crt_params, dmp1, dmq1, iqmp, (dmp1 == obj->dmp1 || dmq1 == obj->dmq1 || iqmp == obj->iqmp))
137
- #endif
138
-
139
- #if !defined(OPENSSL_NO_DSA)
140
- IMPL_PKEY_GETTER(DSA, dsa)
141
- IMPL_KEY_ACCESSOR2(DSA, key, pub_key, priv_key, (pub_key == obj->pub_key || (obj->priv_key && priv_key == obj->priv_key)))
142
- IMPL_KEY_ACCESSOR3(DSA, pqg, p, q, g, (p == obj->p || q == obj->q || g == obj->g))
143
- #endif
144
-
145
- #if !defined(OPENSSL_NO_DH)
146
- IMPL_PKEY_GETTER(DH, dh)
147
- IMPL_KEY_ACCESSOR2(DH, key, pub_key, priv_key, (pub_key == obj->pub_key || (obj->priv_key && priv_key == obj->priv_key)))
148
- IMPL_KEY_ACCESSOR3(DH, pqg, p, q, g, (p == obj->p || (obj->q && q == obj->q) || g == obj->g))
149
- static inline ENGINE *DH_get0_engine(DH *dh) { return dh->engine; }
150
- #endif
151
-
152
- #if !defined(OPENSSL_NO_EC)
153
- IMPL_PKEY_GETTER(EC_KEY, ec)
154
- #endif
155
-
156
- #undef IMPL_PKEY_GETTER
157
- #undef IMPL_KEY_ACCESSOR2
158
- #undef IMPL_KEY_ACCESSOR3
159
- #endif /* HAVE_OPAQUE_OPENSSL */
160
-
161
- #if !defined(EVP_CTRL_AEAD_GET_TAG)
162
- # define EVP_CTRL_AEAD_GET_TAG EVP_CTRL_GCM_GET_TAG
163
- # define EVP_CTRL_AEAD_SET_TAG EVP_CTRL_GCM_SET_TAG
164
- # define EVP_CTRL_AEAD_SET_IVLEN EVP_CTRL_GCM_SET_IVLEN
165
- #endif
166
-
167
- #if !defined(HAVE_X509_GET0_NOTBEFORE)
168
- # define X509_get0_notBefore(x) X509_get_notBefore(x)
169
- # define X509_get0_notAfter(x) X509_get_notAfter(x)
170
- # define X509_CRL_get0_lastUpdate(x) X509_CRL_get_lastUpdate(x)
171
- # define X509_CRL_get0_nextUpdate(x) X509_CRL_get_nextUpdate(x)
172
- # define X509_set1_notBefore(x, t) X509_set_notBefore(x, t)
173
- # define X509_set1_notAfter(x, t) X509_set_notAfter(x, t)
174
- # define X509_CRL_set1_lastUpdate(x, t) X509_CRL_set_lastUpdate(x, t)
175
- # define X509_CRL_set1_nextUpdate(x, t) X509_CRL_set_nextUpdate(x, t)
176
- #endif
177
-
178
- #if !defined(HAVE_SSL_SESSION_GET_PROTOCOL_VERSION)
179
- # define SSL_SESSION_get_protocol_version(s) ((s)->ssl_version)
180
- #endif
181
-
182
- #if !defined(HAVE_TS_STATUS_INFO_GET0_STATUS)
183
- # define TS_STATUS_INFO_get0_status(a) ((a)->status)
184
- #endif
185
-
186
- #if !defined(HAVE_TS_STATUS_INFO_GET0_TEXT)
187
- # define TS_STATUS_INFO_get0_text(a) ((a)->text)
188
- #endif
189
-
190
- #if !defined(HAVE_TS_STATUS_INFO_GET0_FAILURE_INFO)
191
- # define TS_STATUS_INFO_get0_failure_info(a) ((a)->failure_info)
192
- #endif
193
-
194
- #if !defined(HAVE_TS_VERIFY_CTS_SET_CERTS)
195
- # define TS_VERIFY_CTS_set_certs(ctx, crts) ((ctx)->certs=(crts))
196
- #endif
197
-
198
- #if !defined(HAVE_TS_VERIFY_CTX_SET_STORE)
199
- # define TS_VERIFY_CTX_set_store(ctx, str) ((ctx)->store=(str))
200
- #endif
201
-
202
- #if !defined(HAVE_TS_VERIFY_CTX_ADD_FLAGS)
203
- # define TS_VERIFY_CTX_add_flags(ctx, f) ((ctx)->flags |= (f))
204
- #endif
205
-
206
- #if !defined(HAVE_TS_RESP_CTX_SET_TIME_CB)
207
- # define TS_RESP_CTX_set_time_cb(ctx, callback, dta) do { \
208
- (ctx)->time_cb = (callback); \
209
- (ctx)->time_cb_data = (dta); \
210
- } while (0)
211
- #endif
212
-
213
15
  /* added in 3.0.0 */
214
- #if !defined(HAVE_TS_VERIFY_CTX_SET_CERTS)
215
- # define TS_VERIFY_CTX_set_certs(ctx, crts) TS_VERIFY_CTS_set_certs(ctx, crts)
216
- #endif
217
-
218
16
  #ifndef HAVE_EVP_MD_CTX_GET0_MD
219
17
  # define EVP_MD_CTX_get0_md(ctx) EVP_MD_CTX_md(ctx)
220
18
  #endif
@@ -224,11 +22,7 @@ IMPL_PKEY_GETTER(EC_KEY, ec)
224
22
  * EVP_MD_CTX_get_pkey_ctx(x) in OpenSSL 3.0.
225
23
  */
226
24
  #ifndef HAVE_EVP_MD_CTX_GET_PKEY_CTX
227
- # ifdef HAVE_EVP_MD_CTX_PKEY_CTX
228
25
  # define EVP_MD_CTX_get_pkey_ctx(x) EVP_MD_CTX_pkey_ctx(x)
229
- # else
230
- # define EVP_MD_CTX_get_pkey_ctx(x) (x)->pctx
231
- # endif
232
26
  #endif
233
27
 
234
28
  #ifndef HAVE_EVP_PKEY_EQ