openssl 2.0.6 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of openssl might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ff180f09fe084e079637b8a469304bb0f8fb1659
4
- data.tar.gz: 459612fe58c8eff068a64cd3fa31bf7624ad2232
2
+ SHA256:
3
+ metadata.gz: ce5a2e8d001a9150d08622ad74ce5956699f2019fe5440290a08bcb1efbfc801
4
+ data.tar.gz: 8b4199dec376210e502f34504e68f83ba992da0a28aa5c6ec37341b05cf3ed00
5
5
  SHA512:
6
- metadata.gz: 15303d9a24b3dd47ca0fa5bc49f95d33535f9d085eb08e610cb18765e022351623b325a3a70b6c8386a0ec986b53968a121b66521533552f9adef91c330aa326
7
- data.tar.gz: 6d2f286a4b3cfcea4d7a71c4962b30e2050a81ce3bfef6abf51381d1299401199ce3b96651f2e77fb53e4595648fd90234cf1ae9617f04a0b464a9104c8ece2c
6
+ metadata.gz: d2a3fbf38ae0922eeb55755c19038369e53fac3587f2c9e04fec2d88d6e33dc0149b2b2d2591e2f259d0df42dde17e10e62cf355dc5fb6b6addee8d264fe2b2b
7
+ data.tar.gz: 999ba923fd91bda5b699e810a171d7ea24148bf19fc38c9a9feb93870c26025500ea969f556e13a51b0271ede667ee4ec09c31e87df4d7273dc9f83c4ca5ed8c
data/History.md CHANGED
@@ -1,3 +1,18 @@
1
+ Version 2.0.7
2
+ =============
3
+
4
+ Bug fixes
5
+ ---------
6
+
7
+ * OpenSSL::Cipher#auth_data= could segfault if called against a non-AEAD cipher.
8
+ [[Bug #14024]](https://bugs.ruby-lang.org/issues/14024)
9
+ * OpenSSL::X509::Certificate#public_key= (and similar methods) could segfault
10
+ when an instance of OpenSSL::PKey::PKey with no public key components is
11
+ passed.
12
+ [[Bug #14087]](https://bugs.ruby-lang.org/issues/14087)
13
+ [[GitHub #168]](https://github.com/ruby/openssl/pull/168)
14
+
15
+
1
16
  Version 2.0.6
2
17
  =============
3
18
 
@@ -170,7 +185,7 @@ Notable changes
170
185
  - A new option 'verify_hostname' is added to OpenSSL::SSL::SSLContext. When it
171
186
  is enabled, and the SNI hostname is also set, the hostname verification on
172
187
  the server certificate is automatically performed. It is now enabled by
173
- OpenSSL::SSL::Context#set_params.
188
+ OpenSSL::SSL::SSLContext#set_params.
174
189
  [[GH ruby/openssl#60]](https://github.com/ruby/openssl/pull/60)
175
190
 
176
191
  Removals
@@ -1718,12 +1718,12 @@ Init_ossl_asn1(void)
1718
1718
  * == Primitive sub-classes and their mapping to Ruby classes
1719
1719
  * * OpenSSL::ASN1::EndOfContent <=> +value+ is always +nil+
1720
1720
  * * OpenSSL::ASN1::Boolean <=> +value+ is a +Boolean+
1721
- * * OpenSSL::ASN1::Integer <=> +value+ is a +Number+
1721
+ * * OpenSSL::ASN1::Integer <=> +value+ is an OpenSSL::BN
1722
1722
  * * OpenSSL::ASN1::BitString <=> +value+ is a +String+
1723
1723
  * * OpenSSL::ASN1::OctetString <=> +value+ is a +String+
1724
1724
  * * OpenSSL::ASN1::Null <=> +value+ is always +nil+
1725
1725
  * * OpenSSL::ASN1::Object <=> +value+ is a +String+
1726
- * * OpenSSL::ASN1::Enumerated <=> +value+ is a +Number+
1726
+ * * OpenSSL::ASN1::Enumerated <=> +value+ is an OpenSSL::BN
1727
1727
  * * OpenSSL::ASN1::UTF8String <=> +value+ is a +String+
1728
1728
  * * OpenSSL::ASN1::NumericString <=> +value+ is a +String+
1729
1729
  * * OpenSSL::ASN1::PrintableString <=> +value+ is a +String+
@@ -580,6 +580,8 @@ ossl_cipher_set_auth_data(VALUE self, VALUE data)
580
580
  in_len = RSTRING_LEN(data);
581
581
 
582
582
  GetCipher(self, ctx);
583
+ if (!(EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(ctx)) & EVP_CIPH_FLAG_AEAD_CIPHER))
584
+ ossl_raise(eCipherError, "AEAD not supported by this cipher");
583
585
 
584
586
  if (!ossl_cipher_update_long(ctx, NULL, &out_len, in, in_len))
585
587
  ossl_raise(eCipherError, "couldn't set additional authenticated data");
@@ -208,12 +208,13 @@ static VALUE
208
208
  ossl_spki_set_public_key(VALUE self, VALUE key)
209
209
  {
210
210
  NETSCAPE_SPKI *spki;
211
+ EVP_PKEY *pkey;
211
212
 
212
213
  GetSPKI(self, spki);
213
- if (!NETSCAPE_SPKI_set_pubkey(spki, GetPKeyPtr(key))) { /* NO NEED TO DUP */
214
- ossl_raise(eSPKIError, NULL);
215
- }
216
-
214
+ pkey = GetPKeyPtr(key);
215
+ ossl_pkey_check_public_key(pkey);
216
+ if (!NETSCAPE_SPKI_set_pubkey(spki, pkey))
217
+ ossl_raise(eSPKIError, "NETSCAPE_SPKI_set_pubkey");
217
218
  return key;
218
219
  }
219
220
 
@@ -307,17 +308,20 @@ static VALUE
307
308
  ossl_spki_verify(VALUE self, VALUE key)
308
309
  {
309
310
  NETSCAPE_SPKI *spki;
311
+ EVP_PKEY *pkey;
310
312
 
311
313
  GetSPKI(self, spki);
312
- switch (NETSCAPE_SPKI_verify(spki, GetPKeyPtr(key))) { /* NO NEED TO DUP */
313
- case 0:
314
+ pkey = GetPKeyPtr(key);
315
+ ossl_pkey_check_public_key(pkey);
316
+ switch (NETSCAPE_SPKI_verify(spki, pkey)) {
317
+ case 0:
318
+ ossl_clear_error();
314
319
  return Qfalse;
315
- case 1:
320
+ case 1:
316
321
  return Qtrue;
317
- default:
318
- ossl_raise(eSPKIError, NULL);
322
+ default:
323
+ ossl_raise(eSPKIError, "NETSCAPE_SPKI_verify");
319
324
  }
320
- return Qnil; /* dummy */
321
325
  }
322
326
 
323
327
  /* Document-class: OpenSSL::Netscape::SPKI
@@ -163,8 +163,8 @@ ossl_pkey_new_from_data(int argc, VALUE *argv, VALUE self)
163
163
  return ossl_pkey_new(pkey);
164
164
  }
165
165
 
166
- static void
167
- pkey_check_public_key(EVP_PKEY *pkey)
166
+ void
167
+ ossl_pkey_check_public_key(const EVP_PKEY *pkey)
168
168
  {
169
169
  void *ptr;
170
170
  const BIGNUM *n, *e, *pubkey;
@@ -172,7 +172,8 @@ pkey_check_public_key(EVP_PKEY *pkey)
172
172
  if (EVP_PKEY_missing_parameters(pkey))
173
173
  ossl_raise(ePKeyError, "parameters missing");
174
174
 
175
- ptr = EVP_PKEY_get0(pkey);
175
+ /* OpenSSL < 1.1.0 takes non-const pointer */
176
+ ptr = EVP_PKEY_get0((EVP_PKEY *)pkey);
176
177
  switch (EVP_PKEY_base_id(pkey)) {
177
178
  case EVP_PKEY_RSA:
178
179
  RSA_get0_key(ptr, &n, &e, NULL);
@@ -352,7 +353,7 @@ ossl_pkey_verify(VALUE self, VALUE digest, VALUE sig, VALUE data)
352
353
  int siglen, result;
353
354
 
354
355
  GetPKey(self, pkey);
355
- pkey_check_public_key(pkey);
356
+ ossl_pkey_check_public_key(pkey);
356
357
  md = GetDigestPtr(digest);
357
358
  StringValue(sig);
358
359
  siglen = RSTRING_LENINT(sig);
@@ -48,6 +48,7 @@ int ossl_generate_cb_2(int p, int n, BN_GENCB *cb);
48
48
  void ossl_generate_cb_stop(void *ptr);
49
49
 
50
50
  VALUE ossl_pkey_new(EVP_PKEY *);
51
+ void ossl_pkey_check_public_key(const EVP_PKEY *);
51
52
  EVP_PKEY *GetPKeyPtr(VALUE);
52
53
  EVP_PKEY *DupPKeyPtr(VALUE);
53
54
  EVP_PKEY *GetPrivPKeyPtr(VALUE);
@@ -996,12 +996,7 @@ ossl_sslctx_get_ciphers(VALUE self)
996
996
  int i, num;
997
997
 
998
998
  GetSSLCTX(self, ctx);
999
- if(!ctx){
1000
- rb_warning("SSL_CTX is not initialized.");
1001
- return Qnil;
1002
- }
1003
999
  ciphers = SSL_CTX_get_ciphers(ctx);
1004
-
1005
1000
  if (!ciphers)
1006
1001
  return rb_ary_new();
1007
1002
 
@@ -1049,10 +1044,6 @@ ossl_sslctx_set_ciphers(VALUE self, VALUE v)
1049
1044
  }
1050
1045
 
1051
1046
  GetSSLCTX(self, ctx);
1052
- if(!ctx){
1053
- ossl_raise(eSSLError, "SSL_CTX is not initialized.");
1054
- return Qnil;
1055
- }
1056
1047
  if (!SSL_CTX_set_cipher_list(ctx, StringValueCStr(str))) {
1057
1048
  ossl_raise(eSSLError, "SSL_CTX_set_cipher_list");
1058
1049
  }
@@ -2446,6 +2437,10 @@ Init_ossl_ssl(void)
2446
2437
  * A callback invoked when a session is removed from the internal cache.
2447
2438
  *
2448
2439
  * The callback is invoked with an SSLContext and a Session.
2440
+ *
2441
+ * IMPORTANT NOTE: It is currently not possible to use this safely in a
2442
+ * multi-threaded application. The callback is called inside a global lock
2443
+ * and it can randomly cause deadlock on Ruby thread switching.
2449
2444
  */
2450
2445
  rb_attr(cSSLContext, rb_intern("session_remove_cb"), 1, 1, Qfalse);
2451
2446
 
@@ -10,6 +10,6 @@
10
10
  #if !defined(_OSSL_VERSION_H_)
11
11
  #define _OSSL_VERSION_H_
12
12
 
13
- #define OSSL_VERSION "2.0.6"
13
+ #define OSSL_VERSION "2.0.7"
14
14
 
15
15
  #endif /* _OSSL_VERSION_H_ */
@@ -546,18 +546,19 @@ ossl_x509_get_public_key(VALUE self)
546
546
 
547
547
  /*
548
548
  * call-seq:
549
- * cert.public_key = key => key
549
+ * cert.public_key = key
550
550
  */
551
551
  static VALUE
552
552
  ossl_x509_set_public_key(VALUE self, VALUE key)
553
553
  {
554
554
  X509 *x509;
555
+ EVP_PKEY *pkey;
555
556
 
556
557
  GetX509(self, x509);
557
- if (!X509_set_pubkey(x509, GetPKeyPtr(key))) { /* DUPs pkey */
558
- ossl_raise(eX509CertError, NULL);
559
- }
560
-
558
+ pkey = GetPKeyPtr(key);
559
+ ossl_pkey_check_public_key(pkey);
560
+ if (!X509_set_pubkey(x509, pkey))
561
+ ossl_raise(eX509CertError, "X509_set_pubkey");
561
562
  return key;
562
563
  }
563
564
 
@@ -594,9 +595,9 @@ ossl_x509_verify(VALUE self, VALUE key)
594
595
  X509 *x509;
595
596
  EVP_PKEY *pkey;
596
597
 
597
- pkey = GetPKeyPtr(key); /* NO NEED TO DUP */
598
598
  GetX509(self, x509);
599
-
599
+ pkey = GetPKeyPtr(key);
600
+ ossl_pkey_check_public_key(pkey);
600
601
  switch (X509_verify(x509, pkey)) {
601
602
  case 1:
602
603
  return Qtrue;
@@ -366,9 +366,12 @@ static VALUE
366
366
  ossl_x509crl_verify(VALUE self, VALUE key)
367
367
  {
368
368
  X509_CRL *crl;
369
+ EVP_PKEY *pkey;
369
370
 
370
371
  GetX509CRL(self, crl);
371
- switch (X509_CRL_verify(crl, GetPKeyPtr(key))) {
372
+ pkey = GetPKeyPtr(key);
373
+ ossl_pkey_check_public_key(pkey);
374
+ switch (X509_CRL_verify(crl, pkey)) {
372
375
  case 1:
373
376
  return Qtrue;
374
377
  case 0:
@@ -330,11 +330,10 @@ ossl_x509req_set_public_key(VALUE self, VALUE key)
330
330
  EVP_PKEY *pkey;
331
331
 
332
332
  GetX509Req(self, req);
333
- pkey = GetPKeyPtr(key); /* NO NEED TO DUP */
334
- if (!X509_REQ_set_pubkey(req, pkey)) {
335
- ossl_raise(eX509ReqError, NULL);
336
- }
337
-
333
+ pkey = GetPKeyPtr(key);
334
+ ossl_pkey_check_public_key(pkey);
335
+ if (!X509_REQ_set_pubkey(req, pkey))
336
+ ossl_raise(eX509ReqError, "X509_REQ_set_pubkey");
338
337
  return key;
339
338
  }
340
339
 
@@ -365,7 +364,8 @@ ossl_x509req_verify(VALUE self, VALUE key)
365
364
  EVP_PKEY *pkey;
366
365
 
367
366
  GetX509Req(self, req);
368
- pkey = GetPKeyPtr(key); /* NO NEED TO DUP */
367
+ pkey = GetPKeyPtr(key);
368
+ ossl_pkey_check_public_key(pkey);
369
369
  switch (X509_REQ_verify(req, pkey)) {
370
370
  case 1:
371
371
  return Qtrue;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openssl
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Bosslet
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-09-24 00:00:00.000000000 Z
14
+ date: 2017-12-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -77,8 +77,8 @@ extensions:
77
77
  - ext/openssl/extconf.rb
78
78
  extra_rdoc_files:
79
79
  - CONTRIBUTING.md
80
- - README.md
81
80
  - History.md
81
+ - README.md
82
82
  files:
83
83
  - BSDL
84
84
  - CONTRIBUTING.md
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  version: '0'
173
173
  requirements: []
174
174
  rubyforge_project:
175
- rubygems_version: 2.6.13
175
+ rubygems_version: 2.7.3
176
176
  signing_key:
177
177
  specification_version: 4
178
178
  summary: OpenSSL provides SSL, TLS and general purpose cryptography.