openssl 2.0.0 → 2.0.1

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
2
  SHA1:
3
- metadata.gz: 03d318590b847c8c1c1b994254b8e2487107bf31
4
- data.tar.gz: 67dee2b7da3246aa429b2a35ec3fc44c93a7cc8f
3
+ metadata.gz: cc80177aa96ab17f6920d0e790efce7b53562e92
4
+ data.tar.gz: dfc39bf0895ae109cb29de4df756695676ee2b39
5
5
  SHA512:
6
- metadata.gz: 2797a1a1a48b1ddd8181f668a4bbda6efa4362f20a8aaf05b8e9e14e403f25bc98eeec8a4749c98756ce88da465b21c5494432dcebcdbd52437805209f376b1d
7
- data.tar.gz: e49508cdc45afcc6c564b4de70f1029b163c2660a583b06059f524b1a67e1295171bc253c2172d0ae7e77ac59d44a7b9edebc7415e135b5838120bca3dba3f05
6
+ metadata.gz: 65a3823e00d851a8ced0f6beabc81ec3a100ad01fe4da8e41ca3ae5763fd45c284717ffd1f7257fc632b492662c8234b686dacf12e0a6097727f886bef884dff
7
+ data.tar.gz: 66c8d3f98438ef4f8e1dae8658551d5cd92a9ba138ad4ecb0d82b70911e3cf4f54e4095d489ba174d2f20ca5e29ff7c2c64a2d490fa1c29b9636606071d6b94f
@@ -95,6 +95,7 @@ have_func("i2d_ASN1_SET_ANY")
95
95
  have_func("SSL_SESSION_cmp") # removed
96
96
  OpenSSL.check_func_or_macro("SSL_set_tlsext_host_name", "openssl/ssl.h")
97
97
  have_struct_member("CRYPTO_THREADID", "ptr", "openssl/crypto.h")
98
+ have_func("EVP_PKEY_get0")
98
99
 
99
100
  # added in 1.0.1
100
101
  have_func("SSL_CTX_set_next_proto_select_cb")
@@ -47,6 +47,10 @@ int HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in);
47
47
  i2d_ASN1_TYPE, V_ASN1_SET, V_ASN1_UNIVERSAL, 0)
48
48
  #endif
49
49
 
50
+ #if !defined(HAVE_EVP_PKEY_GET0)
51
+ # define EVP_PKEY_get0(pk) (pk->pkey.ptr)
52
+ #endif
53
+
50
54
  /* added in 1.0.2 */
51
55
  #if !defined(OPENSSL_NO_EC)
52
56
  #if !defined(HAVE_EC_CURVE_NIST2NID)
data/ext/openssl/ossl.c CHANGED
@@ -180,7 +180,7 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd_)
180
180
  len = RSTRING_LEN(pass);
181
181
  if (len >= OSSL_MIN_PWD_LEN && len <= max_len) {
182
182
  memcpy(buf, RSTRING_PTR(pass), len);
183
- return len;
183
+ return (int)len;
184
184
  }
185
185
  }
186
186
  OSSL_Debug("passed data is not valid String???");
@@ -47,9 +47,15 @@ asn1time_to_time(const ASN1_TIME *time)
47
47
  }
48
48
  break;
49
49
  case V_ASN1_GENERALIZEDTIME:
50
- if (sscanf((const char *)time->data, "%4d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon,
51
- &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) {
52
- ossl_raise(rb_eTypeError, "bad GENERALIZEDTIME format" );
50
+ count = sscanf((const char *)time->data, "%4d%2d%2d%2d%2d%2dZ",
51
+ &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min,
52
+ &tm.tm_sec);
53
+ if (count == 5) {
54
+ tm.tm_sec = 0;
55
+ }
56
+ else if (count != 6) {
57
+ ossl_raise(rb_eTypeError, "bad GENERALIZEDTIME format: \"%s\"",
58
+ time->data);
53
59
  }
54
60
  break;
55
61
  default:
@@ -120,30 +120,34 @@ integer_to_bnptr(VALUE obj, BIGNUM *orig)
120
120
  return bn;
121
121
  }
122
122
 
123
- static BIGNUM *
124
- try_convert_to_bnptr(VALUE obj)
123
+ static VALUE
124
+ try_convert_to_bn(VALUE obj)
125
125
  {
126
- BIGNUM *bn = NULL;
127
- VALUE newobj;
126
+ BIGNUM *bn;
127
+ VALUE newobj = Qnil;
128
128
 
129
- if (rb_obj_is_kind_of(obj, cBN)) {
130
- GetBN(obj, bn);
131
- }
132
- else if (RB_INTEGER_TYPE_P(obj)) {
129
+ if (rb_obj_is_kind_of(obj, cBN))
130
+ return obj;
131
+ if (RB_INTEGER_TYPE_P(obj)) {
133
132
  newobj = NewBN(cBN); /* Handle potencial mem leaks */
134
133
  bn = integer_to_bnptr(obj, NULL);
135
134
  SetBN(newobj, bn);
136
135
  }
137
136
 
138
- return bn;
137
+ return newobj;
139
138
  }
140
139
 
141
140
  BIGNUM *
142
- GetBNPtr(VALUE obj)
141
+ ossl_bn_value_ptr(volatile VALUE *ptr)
143
142
  {
144
- BIGNUM *bn = try_convert_to_bnptr(obj);
145
- if (!bn)
143
+ VALUE tmp;
144
+ BIGNUM *bn;
145
+
146
+ tmp = try_convert_to_bn(*ptr);
147
+ if (NIL_P(tmp))
146
148
  ossl_raise(rb_eTypeError, "Cannot convert into OpenSSL::BN");
149
+ GetBN(tmp, bn);
150
+ *ptr = tmp;
147
151
 
148
152
  return bn;
149
153
  }
@@ -893,10 +897,12 @@ ossl_bn_eq(VALUE self, VALUE other)
893
897
  BIGNUM *bn1, *bn2;
894
898
 
895
899
  GetBN(self, bn1);
896
- /* BNPtr may raise, so we can't use here */
897
- bn2 = try_convert_to_bnptr(other);
900
+ other = try_convert_to_bn(other);
901
+ if (NIL_P(other))
902
+ return Qfalse;
903
+ GetBN(other, bn2);
898
904
 
899
- if (bn2 && !BN_cmp(bn1, bn2)) {
905
+ if (!BN_cmp(bn1, bn2)) {
900
906
  return Qtrue;
901
907
  }
902
908
  return Qfalse;
@@ -15,8 +15,10 @@ extern VALUE eBNError;
15
15
 
16
16
  extern BN_CTX *ossl_bn_ctx;
17
17
 
18
+ #define GetBNPtr(obj) ossl_bn_value_ptr(&(obj))
19
+
18
20
  VALUE ossl_bn_new(const BIGNUM *);
19
- BIGNUM *GetBNPtr(VALUE);
21
+ BIGNUM *ossl_bn_value_ptr(volatile VALUE *);
20
22
  void Init_ossl_bn(void);
21
23
 
22
24
 
@@ -287,7 +287,7 @@ ossl_engine_finish(VALUE self)
287
287
  * This returns an OpenSSL::Cipher by +name+, if it is available in this
288
288
  * engine.
289
289
  *
290
- * A EngineError will be raised if the cipher is unavailable.
290
+ * An EngineError will be raised if the cipher is unavailable.
291
291
  *
292
292
  * e = OpenSSL::Engine.by_id("openssl")
293
293
  * => #<OpenSSL::Engine id="openssl" name="Software engine support">
@@ -1635,7 +1635,7 @@ static VALUE ossl_ec_point_mul(int argc, VALUE *argv, VALUE self)
1635
1635
  * points | self | arg2[0] | arg2[1] | ...
1636
1636
  */
1637
1637
  long i, num;
1638
- VALUE tmp_p, tmp_b;
1638
+ VALUE bns_tmp, tmp_p, tmp_b;
1639
1639
  const EC_POINT **points;
1640
1640
  const BIGNUM **bignums;
1641
1641
 
@@ -1645,9 +1645,13 @@ static VALUE ossl_ec_point_mul(int argc, VALUE *argv, VALUE self)
1645
1645
  ossl_raise(rb_eArgError, "bns must be 1 longer than points; see the documentation");
1646
1646
 
1647
1647
  num = RARRAY_LEN(arg1);
1648
+ bns_tmp = rb_ary_tmp_new(num);
1648
1649
  bignums = ALLOCV_N(const BIGNUM *, tmp_b, num);
1649
- for (i = 0; i < num; i++)
1650
- bignums[i] = GetBNPtr(RARRAY_AREF(arg1, i));
1650
+ for (i = 0; i < num; i++) {
1651
+ VALUE item = RARRAY_AREF(arg1, i);
1652
+ bignums[i] = GetBNPtr(item);
1653
+ rb_ary_push(bns_tmp, item);
1654
+ }
1651
1655
 
1652
1656
  points = ALLOCV_N(const EC_POINT *, tmp_p, num);
1653
1657
  points[0] = point_self; /* self */
@@ -32,7 +32,8 @@ VALUE cSSLSocket;
32
32
  static VALUE eSSLErrorWaitReadable;
33
33
  static VALUE eSSLErrorWaitWritable;
34
34
 
35
- static ID ID_callback_state, id_tmp_dh_callback, id_tmp_ecdh_callback;
35
+ static ID ID_callback_state, id_tmp_dh_callback, id_tmp_ecdh_callback,
36
+ id_npn_protocols_encoded;
36
37
  static VALUE sym_exception, sym_wait_readable, sym_wait_writable;
37
38
 
38
39
  static ID id_i_cert_store, id_i_ca_file, id_i_ca_path, id_i_verify_mode,
@@ -892,6 +893,7 @@ ossl_sslctx_setup(VALUE self)
892
893
  val = rb_attr_get(self, id_i_npn_protocols);
893
894
  if (!NIL_P(val)) {
894
895
  VALUE encoded = ssl_encode_npn_protocols(val);
896
+ rb_ivar_set(self, id_npn_protocols_encoded, encoded);
895
897
  SSL_CTX_set_next_protos_advertised_cb(ctx, ssl_npn_advertise_cb, (void *)encoded);
896
898
  OSSL_Debug("SSL NPN advertise callback added");
897
899
  }
@@ -2712,6 +2714,7 @@ Init_ossl_ssl(void)
2712
2714
 
2713
2715
  id_tmp_dh_callback = rb_intern("tmp_dh_callback");
2714
2716
  id_tmp_ecdh_callback = rb_intern("tmp_ecdh_callback");
2717
+ id_npn_protocols_encoded = rb_intern("npn_protocols_encoded");
2715
2718
 
2716
2719
  #define DefIVarID(name) do \
2717
2720
  id_i_##name = rb_intern("@"#name); while (0)
@@ -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.0"
13
+ #define OSSL_VERSION "2.0.1"
14
14
 
15
15
  #endif /* _OSSL_VERSION_H_ */
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.0
4
+ version: 2.0.1
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: 2016-11-30 00:00:00.000000000 Z
14
+ date: 2016-12-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake