openssl 3.2.0 → 3.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5040b959a35f5692d6d19e2bf520e1123da8133fff2f878cfc21c2ff0f145d6e
4
- data.tar.gz: dfee6ebd76e423511aa0fc4630f8120edce8fe79d4f40ee7105ccad12c2d3340
3
+ metadata.gz: b0e45e3664b7a3f0ece679baf73ddb2da020d9255d1af3d40ed6e9cdd416ea93
4
+ data.tar.gz: 9628e1a30a0c953b631f8d2e0c0703f700594a3257fc5d5866f4834776504436
5
5
  SHA512:
6
- metadata.gz: f542ec360be844382829f4bcc46b5cffdfcaf675b02ecdc1cd15a6e80c061476ee4582fdb201ef2dd0f430806d74036233eef3a5c23e5b4028560ad075ed706b
7
- data.tar.gz: 0173033ebe6efb76b747cc80835cc9530dd664d038256bbdf963d4940b5f3bfad90be313554f548a911ac0977d4bdc33c088dfd3b6fb8e46db7bcd5d2ec34a8c
6
+ metadata.gz: 80d8c83ecee3e6279ff11923b370b2053960c8b964d9298882a69971bb135712a8ac7449cd3d6262b9120da922232703859a2cd83782b1ee9f770ce0db466607
7
+ data.tar.gz: 226de23eddbdfe81d734839cb719331061e90b3b86eeca651e6d51dded1556a76bcf2a0dd9e52f6a6cbba49c01985200eb6b907b8ac75df7041508fee45aaa22
data/History.md CHANGED
@@ -1,3 +1,15 @@
1
+ Version 3.2.2
2
+ =============
3
+
4
+ Merged changes in 3.1.2.
5
+
6
+
7
+ Version 3.2.1
8
+ =============
9
+
10
+ Merged changes in 3.0.3.
11
+
12
+
1
13
  Version 3.2.0
2
14
  =============
3
15
 
@@ -38,6 +50,29 @@ Notable changes
38
50
  [[GitHub #141]](https://github.com/ruby/openssl/pull/141)
39
51
 
40
52
 
53
+ Version 3.1.2
54
+ =============
55
+
56
+ Bug fixes
57
+ ---------
58
+
59
+ * Fix crash when attempting to export an incomplete `OpenSSL::PKey::DSA` key.
60
+ [[GitHub #845]](https://github.com/ruby/openssl/issues/845)
61
+ [[GitHub #847]](https://github.com/ruby/openssl/pull/847)
62
+ * Remove the `OpenSSL::X509::V_FLAG_CRL_CHECK_ALL` flag from the default store
63
+ used by `OpenSSL::SSL::SSLContext#set_params`. It causes certificate
64
+ verification to fail with OpenSSL 3.6.0. It has no effect with any other
65
+ OpenSSL versions.
66
+ [[GitHub #949]](https://github.com/ruby/openssl/issues/949)
67
+ [[GitHub #950]](https://github.com/ruby/openssl/pull/950)
68
+
69
+
70
+ Version 3.1.1
71
+ =============
72
+
73
+ Merged changes in 3.0.3.
74
+
75
+
41
76
  Version 3.1.0
42
77
  =============
43
78
 
@@ -74,6 +109,31 @@ Notable changes
74
109
  LibreSSL 3.6 and Ed25519 support in LibreSSL 3.7.
75
110
 
76
111
 
112
+ Version 3.0.3
113
+ =============
114
+
115
+ Bug fixes
116
+ ---------
117
+
118
+ * Fix a performance regression introduced in v2.1.3 on a buffered write to
119
+ `SSLSocket`.
120
+ [[GitHub #706]](https://github.com/ruby/openssl/pull/706)
121
+ * Fix `OpenSSL::PKCS7` to handle PKCS#7 structures without content.
122
+ [[GitHub #690]](https://github.com/ruby/openssl/pull/690)
123
+ [[GitHub #752]](https://github.com/ruby/openssl/pull/752)
124
+ * Fix `OpenSSL::ASN1::ObjectId#==` with OIDs without a known name.
125
+ [[GitHub #791]](https://github.com/ruby/openssl/issues/791)
126
+ [[GitHub #792]](https://github.com/ruby/openssl/pull/792)
127
+ * Fix `OpenSSL::X509::Certificate#crl_uris` to handle CDP with multiple CRL
128
+ URIs.
129
+ [[GitHub #775]](https://github.com/ruby/openssl/issues/775)
130
+ [[GitHub #776]](https://github.com/ruby/openssl/pull/776)
131
+ * Fix `OpenSSL::Cipher#update` to always make the output buffer `String`
132
+ independent.
133
+ [[Bug #20937]](https://bugs.ruby-lang.org/issues/20937)
134
+ [[GitHub #824]](https://github.com/ruby/openssl/pull/824)
135
+
136
+
77
137
  Version 3.0.2
78
138
  =============
79
139
 
@@ -457,7 +517,7 @@ Security fixes
457
517
  Bug fixes
458
518
  ---------
459
519
 
460
- * Fixed OpenSSL::PKey::*.{new,generate} immediately aborting if the thread is
520
+ * Fixed OpenSSL::PKey::\*.{new,generate} immediately aborting if the thread is
461
521
  interrupted.
462
522
  [[Bug #14882]](https://bugs.ruby-lang.org/issues/14882)
463
523
  [[GitHub #205]](https://github.com/ruby/openssl/pull/205)
@@ -1298,30 +1298,6 @@ ossl_asn1obj_get_ln(VALUE self)
1298
1298
  return ret;
1299
1299
  }
1300
1300
 
1301
- /*
1302
- * call-seq:
1303
- * oid == other_oid => true or false
1304
- *
1305
- * Returns +true+ if _other_oid_ is the same as _oid_
1306
- */
1307
- static VALUE
1308
- ossl_asn1obj_eq(VALUE self, VALUE other)
1309
- {
1310
- VALUE valSelf, valOther;
1311
- int nidSelf, nidOther;
1312
-
1313
- valSelf = ossl_asn1_get_value(self);
1314
- valOther = ossl_asn1_get_value(other);
1315
-
1316
- if ((nidSelf = OBJ_txt2nid(StringValueCStr(valSelf))) == NID_undef)
1317
- ossl_raise(eASN1Error, "OBJ_txt2nid");
1318
-
1319
- if ((nidOther = OBJ_txt2nid(StringValueCStr(valOther))) == NID_undef)
1320
- ossl_raise(eASN1Error, "OBJ_txt2nid");
1321
-
1322
- return nidSelf == nidOther ? Qtrue : Qfalse;
1323
- }
1324
-
1325
1301
  static VALUE
1326
1302
  asn1obj_get_oid_i(VALUE vobj)
1327
1303
  {
@@ -1366,6 +1342,25 @@ ossl_asn1obj_get_oid(VALUE self)
1366
1342
  return str;
1367
1343
  }
1368
1344
 
1345
+ /*
1346
+ * call-seq:
1347
+ * oid == other_oid => true or false
1348
+ *
1349
+ * Returns +true+ if _other_oid_ is the same as _oid_.
1350
+ */
1351
+ static VALUE
1352
+ ossl_asn1obj_eq(VALUE self, VALUE other)
1353
+ {
1354
+ VALUE oid1, oid2;
1355
+
1356
+ if (!rb_obj_is_kind_of(other, cASN1ObjectId))
1357
+ return Qfalse;
1358
+
1359
+ oid1 = ossl_asn1obj_get_oid(self);
1360
+ oid2 = ossl_asn1obj_get_oid(other);
1361
+ return rb_str_equal(oid1, oid2);
1362
+ }
1363
+
1369
1364
  #define OSSL_ASN1_IMPL_FACTORY_METHOD(klass) \
1370
1365
  static VALUE ossl_asn1_##klass(int argc, VALUE *argv, VALUE self)\
1371
1366
  { return rb_funcall3(cASN1##klass, rb_intern("new"), argc, argv); }
@@ -386,22 +386,37 @@ ossl_cipher_update(int argc, VALUE *argv, VALUE self)
386
386
  in = (unsigned char *)RSTRING_PTR(data);
387
387
  in_len = RSTRING_LEN(data);
388
388
  GetCipher(self, ctx);
389
- out_len = in_len+EVP_CIPHER_CTX_block_size(ctx);
390
- if (out_len <= 0) {
389
+
390
+ /*
391
+ * As of OpenSSL 3.2, there is no reliable way to determine the required
392
+ * output buffer size for arbitrary cipher modes.
393
+ * https://github.com/openssl/openssl/issues/22628
394
+ *
395
+ * in_len+block_size is usually sufficient, but AES key wrap with padding
396
+ * ciphers require in_len+15 even though they have a block size of 8 bytes.
397
+ *
398
+ * Using EVP_MAX_BLOCK_LENGTH (32) as a safe upper bound for ciphers
399
+ * currently implemented in OpenSSL, but this can change in the future.
400
+ */
401
+ if (in_len > LONG_MAX - EVP_MAX_BLOCK_LENGTH) {
391
402
  ossl_raise(rb_eRangeError,
392
403
  "data too big to make output buffer: %ld bytes", in_len);
393
404
  }
405
+ out_len = in_len + EVP_MAX_BLOCK_LENGTH;
394
406
 
395
407
  if (NIL_P(str)) {
396
408
  str = rb_str_new(0, out_len);
397
409
  } else {
398
410
  StringValue(str);
399
- rb_str_resize(str, out_len);
411
+ if ((long)rb_str_capacity(str) >= out_len)
412
+ rb_str_modify(str);
413
+ else
414
+ rb_str_modify_expand(str, out_len - RSTRING_LEN(str));
400
415
  }
401
416
 
402
417
  if (!ossl_cipher_update_long(ctx, (unsigned char *)RSTRING_PTR(str), &out_len, in, in_len))
403
418
  ossl_raise(eCipherError, NULL);
404
- assert(out_len < RSTRING_LEN(str));
419
+ assert(out_len <= RSTRING_LEN(str));
405
420
  rb_str_set_len(str, out_len);
406
421
 
407
422
  return str;
@@ -232,6 +232,7 @@ ossl_digest_finish(int argc, VALUE *argv, VALUE self)
232
232
  str = rb_str_new(NULL, out_len);
233
233
  } else {
234
234
  StringValue(str);
235
+ rb_str_modify(str);
235
236
  rb_str_resize(str, out_len);
236
237
  }
237
238
 
@@ -165,7 +165,13 @@ ossl_pkcs7_s_read_smime(VALUE klass, VALUE arg)
165
165
  out = NULL;
166
166
  pkcs7 = SMIME_read_PKCS7(in, &out);
167
167
  BIO_free(in);
168
- if(!pkcs7) ossl_raise(ePKCS7Error, NULL);
168
+ if (!pkcs7)
169
+ ossl_raise(ePKCS7Error, "Could not parse the PKCS7");
170
+ if (!pkcs7->d.ptr) {
171
+ PKCS7_free(pkcs7);
172
+ ossl_raise(ePKCS7Error, "No content in PKCS7");
173
+ }
174
+
169
175
  data = out ? ossl_membio2str(out) : Qnil;
170
176
  SetPKCS7(ret, pkcs7);
171
177
  ossl_pkcs7_set_data(ret, data);
@@ -346,6 +352,10 @@ ossl_pkcs7_initialize(int argc, VALUE *argv, VALUE self)
346
352
  BIO_free(in);
347
353
  if (!p7)
348
354
  ossl_raise(rb_eArgError, "Could not parse the PKCS7");
355
+ if (!p7->d.ptr) {
356
+ PKCS7_free(p7);
357
+ ossl_raise(rb_eArgError, "No content in PKCS7");
358
+ }
349
359
 
350
360
  RTYPEDDATA_DATA(self) = p7;
351
361
  PKCS7_free(p7_orig);
@@ -937,6 +937,7 @@ ossl_pkey_export_spki(VALUE self, int to_der)
937
937
  BIO *bio;
938
938
 
939
939
  GetPKey(self, pkey);
940
+ ossl_pkey_check_public_key(pkey);
940
941
  bio = BIO_new(BIO_s_mem());
941
942
  if (!bio)
942
943
  ossl_raise(ePKeyError, "BIO_new");
@@ -345,13 +345,18 @@ module OpenSSL::Buffering
345
345
  @wbuffer << s
346
346
  @wbuffer.force_encoding(Encoding::BINARY)
347
347
  @sync ||= false
348
- if @sync or @wbuffer.size > BLOCK_SIZE
349
- until @wbuffer.empty?
350
- begin
351
- nwrote = syswrite(@wbuffer)
352
- rescue Errno::EAGAIN
353
- retry
348
+ buffer_size = @wbuffer.size
349
+ if @sync or buffer_size > BLOCK_SIZE
350
+ nwrote = 0
351
+ begin
352
+ while nwrote < buffer_size do
353
+ begin
354
+ nwrote += syswrite(@wbuffer[nwrote, buffer_size - nwrote])
355
+ rescue Errno::EAGAIN
356
+ retry
357
+ end
354
358
  end
359
+ ensure
355
360
  @wbuffer[0, nwrote] = ""
356
361
  end
357
362
  end
data/lib/openssl/ssl.rb CHANGED
@@ -92,7 +92,6 @@ ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
92
92
 
93
93
  DEFAULT_CERT_STORE = OpenSSL::X509::Store.new # :nodoc:
94
94
  DEFAULT_CERT_STORE.set_default_paths
95
- DEFAULT_CERT_STORE.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL
96
95
 
97
96
  # A callback invoked when DH parameters are required for ephemeral DH key
98
97
  # exchange.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenSSL
4
- VERSION = "3.2.0"
4
+ VERSION = "3.2.2"
5
5
  end
data/lib/openssl/x509.rb CHANGED
@@ -122,8 +122,8 @@ module OpenSSL
122
122
  include Helpers
123
123
 
124
124
  # Get the distributionPoint fullName URI from the certificate's CRL
125
- # distribution points extension, as described in RFC5280 Section
126
- # 4.2.1.13
125
+ # distribution points extension, as described in RFC 5280 Section
126
+ # 4.2.1.13.
127
127
  #
128
128
  # Returns an array of strings or nil or raises ASN1::ASN1Error.
129
129
  def crl_uris
@@ -135,19 +135,19 @@ module OpenSSL
135
135
  raise ASN1::ASN1Error, "invalid extension"
136
136
  end
137
137
 
138
- crl_uris = cdp_asn1.map do |crl_distribution_point|
138
+ crl_uris = cdp_asn1.flat_map do |crl_distribution_point|
139
139
  distribution_point = crl_distribution_point.value.find do |v|
140
140
  v.tag_class == :CONTEXT_SPECIFIC && v.tag == 0
141
141
  end
142
142
  full_name = distribution_point&.value&.find do |v|
143
143
  v.tag_class == :CONTEXT_SPECIFIC && v.tag == 0
144
144
  end
145
- full_name&.value&.find do |v|
145
+ full_name&.value&.select do |v|
146
146
  v.tag_class == :CONTEXT_SPECIFIC && v.tag == 6 # uniformResourceIdentifier
147
147
  end
148
148
  end
149
149
 
150
- crl_uris&.map(&:value)
150
+ crl_uris.empty? ? nil : crl_uris.map(&:value)
151
151
  end
152
152
  end
153
153
 
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openssl
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Bosslet
8
8
  - SHIBATA Hiroshi
9
9
  - Zachary Scott
10
10
  - Kazuki Yamaguchi
11
- autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2023-09-21 00:00:00.000000000 Z
13
+ date: 1980-01-02 00:00:00.000000000 Z
15
14
  dependencies: []
16
15
  description: OpenSSL for Ruby provides access to SSL/TLS and general-purpose cryptography
17
16
  based on the OpenSSL library.
@@ -103,7 +102,6 @@ licenses:
103
102
  - Ruby
104
103
  metadata:
105
104
  msys2_mingw_dependencies: openssl
106
- post_install_message:
107
105
  rdoc_options:
108
106
  - "--main"
109
107
  - README.md
@@ -120,8 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
118
  - !ruby/object:Gem::Version
121
119
  version: '0'
122
120
  requirements: []
123
- rubygems_version: 3.4.10
124
- signing_key:
121
+ rubygems_version: 3.6.9
125
122
  specification_version: 4
126
123
  summary: SSL/TLS and general-purpose cryptography for Ruby
127
124
  test_files: []