openssl 3.0.2 → 3.2.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.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +1 -1
- data/History.md +76 -0
- data/README.md +36 -19
- data/ext/openssl/extconf.rb +89 -55
- data/ext/openssl/ossl.c +73 -195
- data/ext/openssl/ossl.h +11 -6
- data/ext/openssl/ossl_asn1.c +11 -10
- data/ext/openssl/ossl_bn.c +25 -13
- data/ext/openssl/ossl_cipher.c +2 -3
- data/ext/openssl/ossl_config.c +1 -1
- data/ext/openssl/ossl_digest.c +1 -1
- data/ext/openssl/ossl_engine.c +1 -1
- data/ext/openssl/ossl_hmac.c +1 -1
- data/ext/openssl/ossl_kdf.c +4 -4
- data/ext/openssl/ossl_ns_spki.c +1 -1
- data/ext/openssl/ossl_ocsp.c +8 -8
- data/ext/openssl/ossl_pkcs12.c +1 -1
- data/ext/openssl/ossl_pkcs7.c +3 -3
- data/ext/openssl/ossl_pkey.c +219 -46
- data/ext/openssl/ossl_pkey.h +1 -1
- data/ext/openssl/ossl_pkey_dh.c +28 -13
- data/ext/openssl/ossl_pkey_dsa.c +64 -15
- data/ext/openssl/ossl_pkey_ec.c +73 -17
- data/ext/openssl/ossl_pkey_rsa.c +74 -19
- data/ext/openssl/ossl_provider.c +211 -0
- data/ext/openssl/ossl_provider.h +5 -0
- data/ext/openssl/ossl_ssl.c +292 -113
- data/ext/openssl/ossl_ssl_session.c +5 -1
- data/ext/openssl/ossl_ts.c +3 -3
- data/ext/openssl/ossl_x509attr.c +1 -1
- data/ext/openssl/ossl_x509cert.c +1 -1
- data/ext/openssl/ossl_x509crl.c +1 -1
- data/ext/openssl/ossl_x509ext.c +13 -7
- data/ext/openssl/ossl_x509name.c +1 -1
- data/ext/openssl/ossl_x509req.c +1 -1
- data/ext/openssl/ossl_x509revoked.c +1 -1
- data/ext/openssl/ossl_x509store.c +12 -5
- data/lib/openssl/buffering.rb +2 -5
- data/lib/openssl/digest.rb +1 -5
- data/lib/openssl/pkey.rb +8 -4
- data/lib/openssl/ssl.rb +15 -10
- data/lib/openssl/version.rb +1 -1
- metadata +9 -6
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
#include "ossl.h"
|
6
6
|
|
7
|
+
#ifndef OPENSSL_NO_SOCK
|
7
8
|
VALUE cSSLSession;
|
8
9
|
static VALUE eSSLSession;
|
9
10
|
|
@@ -18,7 +19,7 @@ const rb_data_type_t ossl_ssl_session_type = {
|
|
18
19
|
{
|
19
20
|
0, ossl_ssl_session_free,
|
20
21
|
},
|
21
|
-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
22
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
|
22
23
|
};
|
23
24
|
|
24
25
|
static VALUE ossl_ssl_session_alloc(VALUE klass)
|
@@ -299,6 +300,7 @@ static VALUE ossl_ssl_session_to_text(VALUE self)
|
|
299
300
|
return ossl_membio2str(out);
|
300
301
|
}
|
301
302
|
|
303
|
+
#endif /* !defined(OPENSSL_NO_SOCK) */
|
302
304
|
|
303
305
|
void Init_ossl_ssl_session(void)
|
304
306
|
{
|
@@ -307,6 +309,7 @@ void Init_ossl_ssl_session(void)
|
|
307
309
|
mSSL = rb_define_module_under(mOSSL, "SSL");
|
308
310
|
eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError);
|
309
311
|
#endif
|
312
|
+
#ifndef OPENSSL_NO_SOCK
|
310
313
|
cSSLSession = rb_define_class_under(mSSL, "Session", rb_cObject);
|
311
314
|
eSSLSession = rb_define_class_under(cSSLSession, "SessionError", eOSSLError);
|
312
315
|
|
@@ -324,4 +327,5 @@ void Init_ossl_ssl_session(void)
|
|
324
327
|
rb_define_method(cSSLSession, "to_der", ossl_ssl_session_to_der, 0);
|
325
328
|
rb_define_method(cSSLSession, "to_pem", ossl_ssl_session_to_pem, 0);
|
326
329
|
rb_define_method(cSSLSession, "to_text", ossl_ssl_session_to_text, 0);
|
330
|
+
#endif /* !defined(OPENSSL_NO_SOCK) */
|
327
331
|
}
|
data/ext/openssl/ossl_ts.c
CHANGED
@@ -83,7 +83,7 @@ static const rb_data_type_t ossl_ts_req_type = {
|
|
83
83
|
{
|
84
84
|
0, ossl_ts_req_free,
|
85
85
|
},
|
86
|
-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
86
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
|
87
87
|
};
|
88
88
|
|
89
89
|
static void
|
@@ -97,7 +97,7 @@ static const rb_data_type_t ossl_ts_resp_type = {
|
|
97
97
|
{
|
98
98
|
0, ossl_ts_resp_free,
|
99
99
|
},
|
100
|
-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
100
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
|
101
101
|
};
|
102
102
|
|
103
103
|
static void
|
@@ -111,7 +111,7 @@ static const rb_data_type_t ossl_ts_token_info_type = {
|
|
111
111
|
{
|
112
112
|
0, ossl_ts_token_info_free,
|
113
113
|
},
|
114
|
-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
114
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
|
115
115
|
};
|
116
116
|
|
117
117
|
static VALUE
|
data/ext/openssl/ossl_x509attr.c
CHANGED
data/ext/openssl/ossl_x509cert.c
CHANGED
data/ext/openssl/ossl_x509crl.c
CHANGED
data/ext/openssl/ossl_x509ext.c
CHANGED
@@ -55,7 +55,7 @@ static const rb_data_type_t ossl_x509ext_type = {
|
|
55
55
|
{
|
56
56
|
0, ossl_x509ext_free,
|
57
57
|
},
|
58
|
-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
58
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
|
59
59
|
};
|
60
60
|
|
61
61
|
/*
|
@@ -108,7 +108,7 @@ static const rb_data_type_t ossl_x509extfactory_type = {
|
|
108
108
|
{
|
109
109
|
0, ossl_x509extfactory_free,
|
110
110
|
},
|
111
|
-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
111
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
|
112
112
|
};
|
113
113
|
|
114
114
|
static VALUE
|
@@ -209,15 +209,16 @@ ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self)
|
|
209
209
|
int nid;
|
210
210
|
VALUE rconf;
|
211
211
|
CONF *conf;
|
212
|
+
const char *oid_cstr = NULL;
|
212
213
|
|
213
214
|
rb_scan_args(argc, argv, "21", &oid, &value, &critical);
|
214
|
-
StringValueCStr(oid);
|
215
215
|
StringValue(value);
|
216
216
|
if(NIL_P(critical)) critical = Qfalse;
|
217
217
|
|
218
|
-
|
219
|
-
|
220
|
-
if(
|
218
|
+
oid_cstr = StringValueCStr(oid);
|
219
|
+
nid = OBJ_ln2nid(oid_cstr);
|
220
|
+
if (nid != NID_undef)
|
221
|
+
oid_cstr = OBJ_nid2sn(nid);
|
221
222
|
|
222
223
|
valstr = rb_str_new2(RTEST(critical) ? "critical," : "");
|
223
224
|
rb_str_append(valstr, value);
|
@@ -228,7 +229,12 @@ ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self)
|
|
228
229
|
rconf = rb_iv_get(self, "@config");
|
229
230
|
conf = NIL_P(rconf) ? NULL : GetConfig(rconf);
|
230
231
|
X509V3_set_nconf(ctx, conf);
|
231
|
-
|
232
|
+
|
233
|
+
#if OSSL_OPENSSL_PREREQ(1, 1, 0) || OSSL_IS_LIBRESSL
|
234
|
+
ext = X509V3_EXT_nconf(conf, ctx, oid_cstr, RSTRING_PTR(valstr));
|
235
|
+
#else
|
236
|
+
ext = X509V3_EXT_nconf(conf, ctx, (char *)oid_cstr, RSTRING_PTR(valstr));
|
237
|
+
#endif
|
232
238
|
X509V3_set_ctx_nodb(ctx);
|
233
239
|
if (!ext){
|
234
240
|
ossl_raise(eX509ExtError, "%"PRIsVALUE" = %"PRIsVALUE, oid, valstr);
|
data/ext/openssl/ossl_x509name.c
CHANGED
data/ext/openssl/ossl_x509req.c
CHANGED
@@ -116,6 +116,9 @@ static void
|
|
116
116
|
ossl_x509store_mark(void *ptr)
|
117
117
|
{
|
118
118
|
X509_STORE *store = ptr;
|
119
|
+
// Note: this reference is stored as @verify_callback so we don't need to mark it.
|
120
|
+
// However we do need to ensure GC compaction won't move it, hence why
|
121
|
+
// we call rb_gc_mark here.
|
119
122
|
rb_gc_mark((VALUE)X509_STORE_get_ex_data(store, store_ex_verify_cb_idx));
|
120
123
|
}
|
121
124
|
|
@@ -130,7 +133,7 @@ static const rb_data_type_t ossl_x509store_type = {
|
|
130
133
|
{
|
131
134
|
ossl_x509store_mark, ossl_x509store_free,
|
132
135
|
},
|
133
|
-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
136
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
|
134
137
|
};
|
135
138
|
|
136
139
|
/*
|
@@ -187,8 +190,9 @@ ossl_x509store_set_vfy_cb(VALUE self, VALUE cb)
|
|
187
190
|
X509_STORE *store;
|
188
191
|
|
189
192
|
GetX509Store(self, store);
|
190
|
-
X509_STORE_set_ex_data(store, store_ex_verify_cb_idx, (void *)cb);
|
191
193
|
rb_iv_set(self, "@verify_callback", cb);
|
194
|
+
// We don't need to trigger a write barrier because `rb_iv_set` did it.
|
195
|
+
X509_STORE_set_ex_data(store, store_ex_verify_cb_idx, (void *)cb);
|
192
196
|
|
193
197
|
return cb;
|
194
198
|
}
|
@@ -507,6 +511,9 @@ static void
|
|
507
511
|
ossl_x509stctx_mark(void *ptr)
|
508
512
|
{
|
509
513
|
X509_STORE_CTX *ctx = ptr;
|
514
|
+
// Note: this reference is stored as @verify_callback so we don't need to mark it.
|
515
|
+
// However we do need to ensure GC compaction won't move it, hence why
|
516
|
+
// we call rb_gc_mark here.
|
510
517
|
rb_gc_mark((VALUE)X509_STORE_CTX_get_ex_data(ctx, stctx_ex_verify_cb_idx));
|
511
518
|
}
|
512
519
|
|
@@ -526,7 +533,7 @@ static const rb_data_type_t ossl_x509stctx_type = {
|
|
526
533
|
{
|
527
534
|
ossl_x509stctx_mark, ossl_x509stctx_free,
|
528
535
|
},
|
529
|
-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
536
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
|
530
537
|
};
|
531
538
|
|
532
539
|
static VALUE
|
@@ -614,8 +621,8 @@ ossl_x509stctx_verify(VALUE self)
|
|
614
621
|
X509_STORE_CTX *ctx;
|
615
622
|
|
616
623
|
GetX509StCtx(self, ctx);
|
617
|
-
|
618
|
-
|
624
|
+
VALUE cb = rb_iv_get(self, "@verify_callback");
|
625
|
+
X509_STORE_CTX_set_ex_data(ctx, stctx_ex_verify_cb_idx, (void *)cb);
|
619
626
|
|
620
627
|
switch (X509_verify_cert(ctx)) {
|
621
628
|
case 1:
|
data/lib/openssl/buffering.rb
CHANGED
@@ -93,9 +93,7 @@ module OpenSSL::Buffering
|
|
93
93
|
nil
|
94
94
|
else
|
95
95
|
size = @rbuffer.size unless size
|
96
|
-
|
97
|
-
@rbuffer[0, size] = ""
|
98
|
-
ret
|
96
|
+
@rbuffer.slice!(0, size)
|
99
97
|
end
|
100
98
|
end
|
101
99
|
|
@@ -106,8 +104,7 @@ module OpenSSL::Buffering
|
|
106
104
|
#
|
107
105
|
# Get the next 8bit byte from `ssl`. Returns `nil` on EOF
|
108
106
|
def getbyte
|
109
|
-
|
110
|
-
byte && byte.unpack1("C")
|
107
|
+
read(1)&.ord
|
111
108
|
end
|
112
109
|
|
113
110
|
##
|
data/lib/openssl/digest.rb
CHANGED
@@ -18,13 +18,9 @@ module OpenSSL
|
|
18
18
|
# Return the hash value computed with _name_ Digest. _name_ is either the
|
19
19
|
# long name or short name of a supported digest algorithm.
|
20
20
|
#
|
21
|
-
# ===
|
21
|
+
# === Example
|
22
22
|
#
|
23
23
|
# OpenSSL::Digest.digest("SHA256", "abc")
|
24
|
-
#
|
25
|
-
# which is equivalent to:
|
26
|
-
#
|
27
|
-
# OpenSSL::Digest.digest('SHA256', "abc")
|
28
24
|
|
29
25
|
def self.digest(name, data)
|
30
26
|
super(data, name)
|
data/lib/openssl/pkey.rb
CHANGED
@@ -363,7 +363,8 @@ module OpenSSL::PKey
|
|
363
363
|
# rsa.private_encrypt(string, padding) -> String
|
364
364
|
#
|
365
365
|
# Encrypt +string+ with the private key. +padding+ defaults to
|
366
|
-
# PKCS1_PADDING
|
366
|
+
# PKCS1_PADDING, which is known to be insecure but is kept for backwards
|
367
|
+
# compatibility. The encrypted string output can be decrypted using
|
367
368
|
# #public_decrypt.
|
368
369
|
#
|
369
370
|
# <b>Deprecated in version 3.0</b>.
|
@@ -386,7 +387,8 @@ module OpenSSL::PKey
|
|
386
387
|
# rsa.public_decrypt(string, padding) -> String
|
387
388
|
#
|
388
389
|
# Decrypt +string+, which has been encrypted with the private key, with the
|
389
|
-
# public key. +padding+ defaults to PKCS1_PADDING
|
390
|
+
# public key. +padding+ defaults to PKCS1_PADDING which is known to be
|
391
|
+
# insecure but is kept for backwards compatibility.
|
390
392
|
#
|
391
393
|
# <b>Deprecated in version 3.0</b>.
|
392
394
|
# Consider using PKey::PKey#sign_raw and PKey::PKey#verify_raw, and
|
@@ -407,7 +409,8 @@ module OpenSSL::PKey
|
|
407
409
|
# rsa.public_encrypt(string, padding) -> String
|
408
410
|
#
|
409
411
|
# Encrypt +string+ with the public key. +padding+ defaults to
|
410
|
-
# PKCS1_PADDING
|
412
|
+
# PKCS1_PADDING, which is known to be insecure but is kept for backwards
|
413
|
+
# compatibility. The encrypted string output can be decrypted using
|
411
414
|
# #private_decrypt.
|
412
415
|
#
|
413
416
|
# <b>Deprecated in version 3.0</b>.
|
@@ -428,7 +431,8 @@ module OpenSSL::PKey
|
|
428
431
|
# rsa.private_decrypt(string, padding) -> String
|
429
432
|
#
|
430
433
|
# Decrypt +string+, which has been encrypted with the public key, with the
|
431
|
-
# private key. +padding+ defaults to PKCS1_PADDING
|
434
|
+
# private key. +padding+ defaults to PKCS1_PADDING, which is known to be
|
435
|
+
# insecure but is kept for backwards compatibility.
|
432
436
|
#
|
433
437
|
# <b>Deprecated in version 3.0</b>.
|
434
438
|
# Consider using PKey::PKey#encrypt and PKey::PKey#decrypt instead.
|
data/lib/openssl/ssl.rb
CHANGED
@@ -11,6 +11,9 @@
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require "openssl/buffering"
|
14
|
+
|
15
|
+
if defined?(OpenSSL::SSL)
|
16
|
+
|
14
17
|
require "io/nonblock"
|
15
18
|
require "ipaddr"
|
16
19
|
require "socket"
|
@@ -31,21 +34,21 @@ module OpenSSL
|
|
31
34
|
}
|
32
35
|
|
33
36
|
if defined?(OpenSSL::PKey::DH)
|
34
|
-
|
37
|
+
DH_ffdhe2048 = OpenSSL::PKey::DH.new <<-_end_of_pem_
|
35
38
|
-----BEGIN DH PARAMETERS-----
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
MIIBCAKCAQEA//////////+t+FRYortKmq/cViAnPTzx2LnFg84tNpWp4TZBFGQz
|
40
|
+
+8yTnc4kmz75fS/jY2MMddj2gbICrsRhetPfHtXV/WVhJDP1H18GbtCFY2VVPe0a
|
41
|
+
87VXE15/V8k1mE8McODmi3fipona8+/och3xWKE2rec1MKzKT0g6eXq8CrGCsyT7
|
42
|
+
YdEIqUuyyOP7uWrat2DX9GgdT0Kj3jlN9K5W7edjcrsZCwenyO4KbXCeAvzhzffi
|
43
|
+
7MA0BM0oNC9hkXL+nOmFg/+OTxIy7vKBg8P+OxtMb61zO7X8vC7CIAXFjvGDfRaD
|
44
|
+
ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
|
42
45
|
-----END DH PARAMETERS-----
|
43
46
|
_end_of_pem_
|
44
|
-
private_constant :
|
47
|
+
private_constant :DH_ffdhe2048
|
45
48
|
|
46
49
|
DEFAULT_TMP_DH_CALLBACK = lambda { |ctx, is_export, keylen| # :nodoc:
|
47
50
|
warn "using default DH parameters." if $VERBOSE
|
48
|
-
|
51
|
+
DH_ffdhe2048
|
49
52
|
}
|
50
53
|
end
|
51
54
|
|
@@ -491,7 +494,7 @@ YoaOffgTf5qxiwkjnlVZQc3whgnEt9FpVMvQ9eknyeGB5KHfayAc3+hUAvI3/Cr3
|
|
491
494
|
unless ctx.session_id_context
|
492
495
|
# see #6137 - session id may not exceed 32 bytes
|
493
496
|
prng = ::Random.new($0.hash)
|
494
|
-
session_id = prng.bytes(16).
|
497
|
+
session_id = prng.bytes(16).unpack1('H*')
|
495
498
|
@ctx.session_id_context = session_id
|
496
499
|
end
|
497
500
|
@start_immediately = true
|
@@ -540,3 +543,5 @@ YoaOffgTf5qxiwkjnlVZQc3whgnEt9FpVMvQ9eknyeGB5KHfayAc3+hUAvI3/Cr3
|
|
540
543
|
end
|
541
544
|
end
|
542
545
|
end
|
546
|
+
|
547
|
+
end
|
data/lib/openssl/version.rb
CHANGED
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: 3.0
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Bosslet
|
@@ -11,9 +11,10 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2023-09-21 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
|
-
description:
|
16
|
+
description: OpenSSL for Ruby provides access to SSL/TLS and general-purpose cryptography
|
17
|
+
based on the OpenSSL library.
|
17
18
|
email:
|
18
19
|
- ruby-core@ruby-lang.org
|
19
20
|
executables: []
|
@@ -66,6 +67,8 @@ files:
|
|
66
67
|
- ext/openssl/ossl_pkey_dsa.c
|
67
68
|
- ext/openssl/ossl_pkey_ec.c
|
68
69
|
- ext/openssl/ossl_pkey_rsa.c
|
70
|
+
- ext/openssl/ossl_provider.c
|
71
|
+
- ext/openssl/ossl_provider.h
|
69
72
|
- ext/openssl/ossl_rand.c
|
70
73
|
- ext/openssl/ossl_rand.h
|
71
74
|
- ext/openssl/ossl_ssl.c
|
@@ -110,15 +113,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
113
|
requirements:
|
111
114
|
- - ">="
|
112
115
|
- !ruby/object:Gem::Version
|
113
|
-
version: 2.
|
116
|
+
version: 2.7.0
|
114
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
118
|
requirements:
|
116
119
|
- - ">="
|
117
120
|
- !ruby/object:Gem::Version
|
118
121
|
version: '0'
|
119
122
|
requirements: []
|
120
|
-
rubygems_version: 3.4.
|
123
|
+
rubygems_version: 3.4.10
|
121
124
|
signing_key:
|
122
125
|
specification_version: 4
|
123
|
-
summary:
|
126
|
+
summary: SSL/TLS and general-purpose cryptography for Ruby
|
124
127
|
test_files: []
|