openssl 3.2.2 → 3.3.1
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 +180 -29
- data/History.md +82 -0
- data/README.md +11 -7
- data/ext/openssl/extconf.rb +7 -9
- data/ext/openssl/openssl_missing.c +1 -1
- data/ext/openssl/openssl_missing.h +1 -1
- data/ext/openssl/ossl.c +7 -9
- data/ext/openssl/ossl.h +12 -8
- data/ext/openssl/ossl_asn1.c +46 -237
- data/ext/openssl/ossl_asn1.h +1 -19
- data/ext/openssl/ossl_bio.c +1 -1
- data/ext/openssl/ossl_bio.h +1 -1
- data/ext/openssl/ossl_bn.c +12 -12
- data/ext/openssl/ossl_bn.h +1 -2
- data/ext/openssl/ossl_cipher.c +5 -5
- data/ext/openssl/ossl_cipher.h +1 -4
- data/ext/openssl/ossl_config.c +10 -9
- data/ext/openssl/ossl_config.h +1 -1
- data/ext/openssl/ossl_digest.c +39 -21
- data/ext/openssl/ossl_digest.h +1 -4
- data/ext/openssl/ossl_engine.c +3 -3
- data/ext/openssl/ossl_engine.h +1 -4
- data/ext/openssl/ossl_hmac.c +3 -3
- data/ext/openssl/ossl_hmac.h +1 -4
- data/ext/openssl/ossl_kdf.c +5 -5
- data/ext/openssl/ossl_ns_spki.c +8 -8
- data/ext/openssl/ossl_ns_spki.h +1 -5
- data/ext/openssl/ossl_ocsp.c +8 -8
- data/ext/openssl/ossl_ocsp.h +1 -8
- data/ext/openssl/ossl_pkcs12.c +54 -3
- data/ext/openssl/ossl_pkcs12.h +1 -4
- data/ext/openssl/ossl_pkcs7.c +68 -21
- data/ext/openssl/ossl_pkcs7.h +2 -22
- data/ext/openssl/ossl_pkey.c +1 -1
- data/ext/openssl/ossl_pkey.h +3 -14
- data/ext/openssl/ossl_pkey_dh.c +2 -2
- data/ext/openssl/ossl_pkey_dsa.c +2 -2
- data/ext/openssl/ossl_pkey_ec.c +6 -6
- data/ext/openssl/ossl_pkey_rsa.c +2 -2
- data/ext/openssl/ossl_provider.c +1 -1
- data/ext/openssl/ossl_rand.c +3 -3
- data/ext/openssl/ossl_rand.h +1 -4
- data/ext/openssl/ossl_ssl.c +80 -61
- data/ext/openssl/ossl_ssl.h +1 -1
- data/ext/openssl/ossl_ts.c +73 -15
- data/ext/openssl/ossl_ts.h +1 -1
- data/ext/openssl/ossl_x509.c +1 -1
- data/ext/openssl/ossl_x509.h +1 -20
- data/ext/openssl/ossl_x509attr.c +25 -26
- data/ext/openssl/ossl_x509cert.c +42 -3
- data/ext/openssl/ossl_x509crl.c +8 -4
- data/ext/openssl/ossl_x509ext.c +3 -3
- data/ext/openssl/ossl_x509name.c +3 -3
- data/ext/openssl/ossl_x509req.c +8 -4
- data/ext/openssl/ossl_x509revoked.c +2 -2
- data/ext/openssl/ossl_x509store.c +16 -11
- data/lib/openssl/asn1.rb +188 -0
- data/lib/openssl/bn.rb +1 -1
- data/lib/openssl/buffering.rb +13 -3
- data/lib/openssl/cipher.rb +1 -1
- data/lib/openssl/digest.rb +1 -1
- data/lib/openssl/marshal.rb +1 -1
- data/lib/openssl/ssl.rb +67 -4
- data/lib/openssl/version.rb +1 -1
- data/lib/openssl/x509.rb +1 -1
- data/lib/openssl.rb +2 -1
- metadata +4 -2
- /data/{LICENSE.txt → COPYING} +0 -0
data/lib/openssl/asn1.rb
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#--
|
3
|
+
#
|
4
|
+
# = Ruby-space definitions that completes C-space funcs for ASN.1
|
5
|
+
#
|
6
|
+
# = Licence
|
7
|
+
# This program is licensed under the same licence as Ruby.
|
8
|
+
# (See the file 'COPYING'.)
|
9
|
+
#++
|
10
|
+
|
11
|
+
module OpenSSL
|
12
|
+
module ASN1
|
13
|
+
class ASN1Data
|
14
|
+
#
|
15
|
+
# Carries the value of a ASN.1 type.
|
16
|
+
# Please confer Constructive and Primitive for the mappings between
|
17
|
+
# ASN.1 data types and Ruby classes.
|
18
|
+
#
|
19
|
+
attr_accessor :value
|
20
|
+
|
21
|
+
# An Integer representing the tag number of this ASN1Data. Never +nil+.
|
22
|
+
attr_accessor :tag
|
23
|
+
|
24
|
+
# A Symbol representing the tag class of this ASN1Data. Never +nil+.
|
25
|
+
# See ASN1Data for possible values.
|
26
|
+
attr_accessor :tag_class
|
27
|
+
|
28
|
+
#
|
29
|
+
# Never +nil+. A boolean value indicating whether the encoding uses
|
30
|
+
# indefinite length (in the case of parsing) or whether an indefinite
|
31
|
+
# length form shall be used (in the encoding case).
|
32
|
+
# In DER, every value uses definite length form. But in scenarios where
|
33
|
+
# large amounts of data need to be transferred it might be desirable to
|
34
|
+
# have some kind of streaming support available.
|
35
|
+
# For example, huge OCTET STRINGs are preferably sent in smaller-sized
|
36
|
+
# chunks, each at a time.
|
37
|
+
# This is possible in BER by setting the length bytes of an encoding
|
38
|
+
# to zero and by this indicating that the following value will be
|
39
|
+
# sent in chunks. Indefinite length encodings are always constructed.
|
40
|
+
# The end of such a stream of chunks is indicated by sending a EOC
|
41
|
+
# (End of Content) tag. SETs and SEQUENCEs may use an indefinite length
|
42
|
+
# encoding, but also primitive types such as e.g. OCTET STRINGS or
|
43
|
+
# BIT STRINGS may leverage this functionality (cf. ITU-T X.690).
|
44
|
+
#
|
45
|
+
attr_accessor :indefinite_length
|
46
|
+
|
47
|
+
alias infinite_length indefinite_length
|
48
|
+
alias infinite_length= indefinite_length=
|
49
|
+
|
50
|
+
#
|
51
|
+
# :call-seq:
|
52
|
+
# OpenSSL::ASN1::ASN1Data.new(value, tag, tag_class) => ASN1Data
|
53
|
+
#
|
54
|
+
# _value_: Please have a look at Constructive and Primitive to see how Ruby
|
55
|
+
# types are mapped to ASN.1 types and vice versa.
|
56
|
+
#
|
57
|
+
# _tag_: An Integer indicating the tag number.
|
58
|
+
#
|
59
|
+
# _tag_class_: A Symbol indicating the tag class. Please cf. ASN1 for
|
60
|
+
# possible values.
|
61
|
+
#
|
62
|
+
# == Example
|
63
|
+
# asn1_int = OpenSSL::ASN1Data.new(42, 2, :UNIVERSAL) # => Same as OpenSSL::ASN1::Integer.new(42)
|
64
|
+
# tagged_int = OpenSSL::ASN1Data.new(42, 0, :CONTEXT_SPECIFIC) # implicitly 0-tagged INTEGER
|
65
|
+
#
|
66
|
+
def initialize(value, tag, tag_class)
|
67
|
+
raise ASN1Error, "invalid tag class" unless tag_class.is_a?(Symbol)
|
68
|
+
|
69
|
+
@tag = tag
|
70
|
+
@value = value
|
71
|
+
@tag_class = tag_class
|
72
|
+
@indefinite_length = false
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
module TaggedASN1Data
|
77
|
+
#
|
78
|
+
# May be used as a hint for encoding a value either implicitly or
|
79
|
+
# explicitly by setting it either to +:IMPLICIT+ or to +:EXPLICIT+.
|
80
|
+
# _tagging_ is not set when a ASN.1 structure is parsed using
|
81
|
+
# OpenSSL::ASN1.decode.
|
82
|
+
#
|
83
|
+
attr_accessor :tagging
|
84
|
+
|
85
|
+
# :call-seq:
|
86
|
+
# OpenSSL::ASN1::Primitive.new(value [, tag, tagging, tag_class ]) => Primitive
|
87
|
+
#
|
88
|
+
# _value_: is mandatory.
|
89
|
+
#
|
90
|
+
# _tag_: optional, may be specified for tagged values. If no _tag_ is
|
91
|
+
# specified, the UNIVERSAL tag corresponding to the Primitive sub-class
|
92
|
+
# is used by default.
|
93
|
+
#
|
94
|
+
# _tagging_: may be used as an encoding hint to encode a value either
|
95
|
+
# explicitly or implicitly, see ASN1 for possible values.
|
96
|
+
#
|
97
|
+
# _tag_class_: if _tag_ and _tagging_ are +nil+ then this is set to
|
98
|
+
# +:UNIVERSAL+ by default. If either _tag_ or _tagging_ are set then
|
99
|
+
# +:CONTEXT_SPECIFIC+ is used as the default. For possible values please
|
100
|
+
# cf. ASN1.
|
101
|
+
#
|
102
|
+
# == Example
|
103
|
+
# int = OpenSSL::ASN1::Integer.new(42)
|
104
|
+
# zero_tagged_int = OpenSSL::ASN1::Integer.new(42, 0, :IMPLICIT)
|
105
|
+
# private_explicit_zero_tagged_int = OpenSSL::ASN1::Integer.new(42, 0, :EXPLICIT, :PRIVATE)
|
106
|
+
#
|
107
|
+
def initialize(value, tag = nil, tagging = nil, tag_class = nil)
|
108
|
+
tag ||= ASN1.take_default_tag(self.class)
|
109
|
+
|
110
|
+
raise ASN1Error, "must specify tag number" unless tag
|
111
|
+
|
112
|
+
if tagging
|
113
|
+
raise ASN1Error, "invalid tagging method" unless tagging.is_a?(Symbol)
|
114
|
+
end
|
115
|
+
|
116
|
+
tag_class ||= tagging ? :CONTEXT_SPECIFIC : :UNIVERSAL
|
117
|
+
|
118
|
+
raise ASN1Error, "invalid tag class" unless tag_class.is_a?(Symbol)
|
119
|
+
|
120
|
+
@tagging = tagging
|
121
|
+
super(value ,tag, tag_class)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
class Primitive < ASN1Data
|
126
|
+
include TaggedASN1Data
|
127
|
+
|
128
|
+
undef_method :indefinite_length=
|
129
|
+
undef_method :infinite_length=
|
130
|
+
end
|
131
|
+
|
132
|
+
class Constructive < ASN1Data
|
133
|
+
include TaggedASN1Data
|
134
|
+
include Enumerable
|
135
|
+
|
136
|
+
# :call-seq:
|
137
|
+
# asn1_ary.each { |asn1| block } => asn1_ary
|
138
|
+
#
|
139
|
+
# Calls the given block once for each element in self, passing that element
|
140
|
+
# as parameter _asn1_. If no block is given, an enumerator is returned
|
141
|
+
# instead.
|
142
|
+
#
|
143
|
+
# == Example
|
144
|
+
# asn1_ary.each do |asn1|
|
145
|
+
# puts asn1
|
146
|
+
# end
|
147
|
+
#
|
148
|
+
def each(&blk)
|
149
|
+
@value.each(&blk)
|
150
|
+
|
151
|
+
self
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
class Boolean < Primitive ; end
|
156
|
+
class Integer < Primitive ; end
|
157
|
+
class Enumerated < Primitive ; end
|
158
|
+
|
159
|
+
class BitString < Primitive
|
160
|
+
attr_accessor :unused_bits
|
161
|
+
|
162
|
+
def initialize(*)
|
163
|
+
super
|
164
|
+
|
165
|
+
@unused_bits = 0
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
class EndOfContent < ASN1Data
|
170
|
+
def initialize
|
171
|
+
super("", 0, :UNIVERSAL)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# :nodoc:
|
176
|
+
def self.take_default_tag(klass)
|
177
|
+
tag = CLASS_TAG_MAP[klass]
|
178
|
+
|
179
|
+
return tag if tag
|
180
|
+
|
181
|
+
sklass = klass.superclass
|
182
|
+
|
183
|
+
return unless sklass
|
184
|
+
|
185
|
+
take_default_tag(sklass)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
data/lib/openssl/bn.rb
CHANGED
data/lib/openssl/buffering.rb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
#
|
9
9
|
#= Licence
|
10
10
|
# This program is licensed under the same licence as Ruby.
|
11
|
-
# (See the file '
|
11
|
+
# (See the file 'COPYING'.)
|
12
12
|
#++
|
13
13
|
|
14
14
|
##
|
@@ -107,6 +107,12 @@ module OpenSSL::Buffering
|
|
107
107
|
read(1)&.ord
|
108
108
|
end
|
109
109
|
|
110
|
+
# Get the next 8bit byte. Raises EOFError on EOF
|
111
|
+
def readbyte
|
112
|
+
raise EOFError if eof?
|
113
|
+
getbyte
|
114
|
+
end
|
115
|
+
|
110
116
|
##
|
111
117
|
# Reads _size_ bytes from the stream. If _buf_ is provided it must
|
112
118
|
# reference a string which will receive the data.
|
@@ -229,7 +235,7 @@ module OpenSSL::Buffering
|
|
229
235
|
#
|
230
236
|
# Unlike IO#gets the separator must be provided if a limit is provided.
|
231
237
|
|
232
|
-
def gets(eol=$/, limit=nil)
|
238
|
+
def gets(eol=$/, limit=nil, chomp: false)
|
233
239
|
idx = @rbuffer.index(eol)
|
234
240
|
until @eof
|
235
241
|
break if idx
|
@@ -244,7 +250,11 @@ module OpenSSL::Buffering
|
|
244
250
|
if size && limit && limit >= 0
|
245
251
|
size = [size, limit].min
|
246
252
|
end
|
247
|
-
consume_rbuff(size)
|
253
|
+
line = consume_rbuff(size)
|
254
|
+
if chomp && line
|
255
|
+
line.chomp!(eol)
|
256
|
+
end
|
257
|
+
line
|
248
258
|
end
|
249
259
|
|
250
260
|
##
|
data/lib/openssl/cipher.rb
CHANGED
data/lib/openssl/digest.rb
CHANGED
data/lib/openssl/marshal.rb
CHANGED
data/lib/openssl/ssl.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
= Licence
|
9
9
|
This program is licensed under the same licence as Ruby.
|
10
|
-
(See the file '
|
10
|
+
(See the file 'COPYING'.)
|
11
11
|
=end
|
12
12
|
|
13
13
|
require "openssl/buffering"
|
@@ -22,7 +22,6 @@ module OpenSSL
|
|
22
22
|
module SSL
|
23
23
|
class SSLContext
|
24
24
|
DEFAULT_PARAMS = { # :nodoc:
|
25
|
-
:min_version => OpenSSL::SSL::TLS1_VERSION,
|
26
25
|
:verify_mode => OpenSSL::SSL::VERIFY_PEER,
|
27
26
|
:verify_hostname => true,
|
28
27
|
:options => -> {
|
@@ -55,6 +54,7 @@ ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
|
|
55
54
|
if !(OpenSSL::OPENSSL_VERSION.start_with?("OpenSSL") &&
|
56
55
|
OpenSSL::OPENSSL_VERSION_NUMBER >= 0x10100000)
|
57
56
|
DEFAULT_PARAMS.merge!(
|
57
|
+
min_version: OpenSSL::SSL::TLS1_VERSION,
|
58
58
|
ciphers: %w{
|
59
59
|
ECDHE-ECDSA-AES128-GCM-SHA256
|
60
60
|
ECDHE-RSA-AES128-GCM-SHA256
|
@@ -124,7 +124,6 @@ ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
|
|
124
124
|
# that this form is deprecated. New applications should use #min_version=
|
125
125
|
# and #max_version= as necessary.
|
126
126
|
def initialize(version = nil)
|
127
|
-
self.options |= OpenSSL::SSL::OP_ALL
|
128
127
|
self.ssl_version = version if version
|
129
128
|
self.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
130
129
|
self.verify_hostname = false
|
@@ -144,7 +143,7 @@ ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
|
|
144
143
|
# used.
|
145
144
|
def set_params(params={})
|
146
145
|
params = DEFAULT_PARAMS.merge(params)
|
147
|
-
self.options
|
146
|
+
self.options |= params.delete(:options) # set before min_version/max_version
|
148
147
|
params.each{|name, value| self.__send__("#{name}=", value) }
|
149
148
|
if self.verify_mode != OpenSSL::SSL::VERIFY_NONE
|
150
149
|
unless self.ca_file or self.ca_path or self.cert_store
|
@@ -251,6 +250,14 @@ ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
|
|
251
250
|
to_io.peeraddr
|
252
251
|
end
|
253
252
|
|
253
|
+
def local_address
|
254
|
+
to_io.local_address
|
255
|
+
end
|
256
|
+
|
257
|
+
def remote_address
|
258
|
+
to_io.remote_address
|
259
|
+
end
|
260
|
+
|
254
261
|
def setsockopt(level, optname, optval)
|
255
262
|
to_io.setsockopt(level, optname, optval)
|
256
263
|
end
|
@@ -270,6 +277,36 @@ ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
|
|
270
277
|
def do_not_reverse_lookup=(flag)
|
271
278
|
to_io.do_not_reverse_lookup = flag
|
272
279
|
end
|
280
|
+
|
281
|
+
def close_on_exec=(value)
|
282
|
+
to_io.close_on_exec = value
|
283
|
+
end
|
284
|
+
|
285
|
+
def close_on_exec?
|
286
|
+
to_io.close_on_exec?
|
287
|
+
end
|
288
|
+
|
289
|
+
def wait(*args)
|
290
|
+
to_io.wait(*args)
|
291
|
+
end
|
292
|
+
|
293
|
+
def wait_readable(*args)
|
294
|
+
to_io.wait_readable(*args)
|
295
|
+
end
|
296
|
+
|
297
|
+
def wait_writable(*args)
|
298
|
+
to_io.wait_writable(*args)
|
299
|
+
end
|
300
|
+
|
301
|
+
if IO.method_defined?(:timeout)
|
302
|
+
def timeout
|
303
|
+
to_io.timeout
|
304
|
+
end
|
305
|
+
|
306
|
+
def timeout=(value)
|
307
|
+
to_io.timeout=(value)
|
308
|
+
end
|
309
|
+
end
|
273
310
|
end
|
274
311
|
|
275
312
|
def verify_certificate_identity(cert, hostname)
|
@@ -420,6 +457,32 @@ ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
|
|
420
457
|
nil
|
421
458
|
end
|
422
459
|
|
460
|
+
# Close the stream for reading.
|
461
|
+
# This method is ignored by OpenSSL as there is no reasonable way to
|
462
|
+
# implement it, but exists for compatibility with IO.
|
463
|
+
def close_read
|
464
|
+
# Unsupported and ignored.
|
465
|
+
# Just don't read any more.
|
466
|
+
end
|
467
|
+
|
468
|
+
# Closes the stream for writing. The behavior of this method depends on
|
469
|
+
# the version of OpenSSL and the TLS protocol in use.
|
470
|
+
#
|
471
|
+
# - Sends a 'close_notify' alert to the peer.
|
472
|
+
# - Does not wait for the peer's 'close_notify' alert in response.
|
473
|
+
#
|
474
|
+
# In TLS 1.2 and earlier:
|
475
|
+
# - On receipt of a 'close_notify' alert, responds with a 'close_notify'
|
476
|
+
# alert of its own and close down the connection immediately,
|
477
|
+
# discarding any pending writes.
|
478
|
+
#
|
479
|
+
# Therefore, on TLS 1.2, this method will cause the connection to be
|
480
|
+
# completely shut down. On TLS 1.3, the connection will remain open for
|
481
|
+
# reading only.
|
482
|
+
def close_write
|
483
|
+
stop
|
484
|
+
end
|
485
|
+
|
423
486
|
private
|
424
487
|
|
425
488
|
def using_anon_cipher?
|
data/lib/openssl/version.rb
CHANGED
data/lib/openssl/x509.rb
CHANGED
data/lib/openssl.rb
CHANGED
@@ -7,12 +7,13 @@
|
|
7
7
|
|
8
8
|
= Licence
|
9
9
|
This program is licensed under the same licence as Ruby.
|
10
|
-
(See the file '
|
10
|
+
(See the file 'COPYING'.)
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'openssl.so'
|
14
14
|
|
15
15
|
require_relative 'openssl/bn'
|
16
|
+
require_relative 'openssl/asn1'
|
16
17
|
require_relative 'openssl/pkey'
|
17
18
|
require_relative 'openssl/cipher'
|
18
19
|
require_relative 'openssl/digest'
|
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.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Bosslet
|
@@ -26,8 +26,8 @@ extra_rdoc_files:
|
|
26
26
|
files:
|
27
27
|
- BSDL
|
28
28
|
- CONTRIBUTING.md
|
29
|
+
- COPYING
|
29
30
|
- History.md
|
30
|
-
- LICENSE.txt
|
31
31
|
- README.md
|
32
32
|
- ext/openssl/extconf.rb
|
33
33
|
- ext/openssl/openssl_missing.c
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- ext/openssl/ossl_x509revoked.c
|
87
87
|
- ext/openssl/ossl_x509store.c
|
88
88
|
- lib/openssl.rb
|
89
|
+
- lib/openssl/asn1.rb
|
89
90
|
- lib/openssl/bn.rb
|
90
91
|
- lib/openssl/buffering.rb
|
91
92
|
- lib/openssl/cipher.rb
|
@@ -100,6 +101,7 @@ files:
|
|
100
101
|
homepage: https://github.com/ruby/openssl
|
101
102
|
licenses:
|
102
103
|
- Ruby
|
104
|
+
- BSD-2-Clause
|
103
105
|
metadata:
|
104
106
|
msys2_mingw_dependencies: openssl
|
105
107
|
rdoc_options:
|
/data/{LICENSE.txt → COPYING}
RENAMED
File without changes
|