openssl 4.0.1 → 4.0.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 +4 -4
- data/History.md +22 -0
- data/ext/openssl/extconf.rb +3 -0
- data/ext/openssl/openssl_missing.h +23 -0
- data/ext/openssl/ossl.c +17 -5
- data/ext/openssl/ossl_asn1.c +26 -21
- data/ext/openssl/ossl_bio.c +5 -1
- data/ext/openssl/ossl_ocsp.c +2 -3
- data/ext/openssl/ossl_pkey.h +0 -1
- data/ext/openssl/ossl_ts.c +1 -1
- data/ext/openssl/ossl_x509.h +6 -6
- data/ext/openssl/ossl_x509attr.c +5 -4
- data/ext/openssl/ossl_x509cert.c +6 -6
- data/ext/openssl/ossl_x509crl.c +5 -5
- data/ext/openssl/ossl_x509ext.c +14 -5
- data/ext/openssl/ossl_x509name.c +3 -2
- data/ext/openssl/ossl_x509req.c +2 -2
- data/ext/openssl/ossl_x509revoked.c +4 -3
- data/ext/openssl/ossl_x509store.c +4 -6
- data/lib/openssl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d14d5404847b546dc00b3603c37199ae79377a8459f8c7570fbc959aac6e0c0c
|
|
4
|
+
data.tar.gz: ed9ddd41814af2938ba6ba52d5d5cc44cc6fc7eec6e50d3a301f7ec3a10dc93f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fce02041d9b11cb6a5e0f6a6ef218d92da8d033c0c0f6a1be6f45bd9c7a541eab413b42181bb95fd3fb39d82a81a39bbd521e528dd33563c12073c6e3a748a63
|
|
7
|
+
data.tar.gz: 0ea3ff3553029192225eee748397cd4ba8b57ac18d86be3a4899e05501eb710c3752562186be6fdf87bec148f8ae0eea4724342d6940cacb3ee58273435eba50
|
data/History.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
Version 4.0.2
|
|
2
|
+
=============
|
|
3
|
+
|
|
4
|
+
Merged changes in 3.2.4 and 3.3.3.
|
|
5
|
+
|
|
6
|
+
|
|
1
7
|
Version 4.0.1
|
|
2
8
|
=============
|
|
3
9
|
|
|
@@ -103,6 +109,12 @@ Notable changes
|
|
|
103
109
|
[[GitHub #983]](https://github.com/ruby/openssl/pull/983)
|
|
104
110
|
|
|
105
111
|
|
|
112
|
+
Version 3.3.3
|
|
113
|
+
=============
|
|
114
|
+
|
|
115
|
+
Merged changes in 3.2.4.
|
|
116
|
+
|
|
117
|
+
|
|
106
118
|
Version 3.3.2
|
|
107
119
|
=============
|
|
108
120
|
|
|
@@ -191,6 +203,16 @@ And various non-user-visible changes and bug fixes. Please see the commit
|
|
|
191
203
|
history for more details.
|
|
192
204
|
|
|
193
205
|
|
|
206
|
+
Version 3.2.4
|
|
207
|
+
=============
|
|
208
|
+
|
|
209
|
+
Notable changes
|
|
210
|
+
---------------
|
|
211
|
+
|
|
212
|
+
* Add support for OpenSSL 4.0.
|
|
213
|
+
[[GitHub #1051]](https://github.com/ruby/openssl/pull/1051)
|
|
214
|
+
|
|
215
|
+
|
|
194
216
|
Version 3.2.3
|
|
195
217
|
=============
|
|
196
218
|
|
data/ext/openssl/extconf.rb
CHANGED
|
@@ -169,6 +169,9 @@ have_func("TS_VERIFY_CTX_set0_certs(NULL, NULL)", ts_h)
|
|
|
169
169
|
# added in 3.5.0
|
|
170
170
|
have_func("SSL_get0_peer_signature_name(NULL, NULL)", ssl_h)
|
|
171
171
|
|
|
172
|
+
# added in 4.0.0
|
|
173
|
+
have_func("ASN1_BIT_STRING_set1(NULL, NULL, 0, 0)", "openssl/asn1.h")
|
|
174
|
+
|
|
172
175
|
Logging::message "=== Checking done. ===\n"
|
|
173
176
|
|
|
174
177
|
# Append flags from environment variables.
|
|
@@ -29,4 +29,27 @@
|
|
|
29
29
|
# define EVP_PKEY_eq(a, b) EVP_PKEY_cmp(a, b)
|
|
30
30
|
#endif
|
|
31
31
|
|
|
32
|
+
/* added in 4.0.0 */
|
|
33
|
+
#ifndef HAVE_ASN1_BIT_STRING_SET1
|
|
34
|
+
static inline int
|
|
35
|
+
ASN1_BIT_STRING_set1(ASN1_BIT_STRING *bitstr, const uint8_t *data,
|
|
36
|
+
size_t length, int unused_bits)
|
|
37
|
+
{
|
|
38
|
+
if (length > INT_MAX || !ASN1_STRING_set(bitstr, data, (int)length))
|
|
39
|
+
return 0;
|
|
40
|
+
bitstr->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07);
|
|
41
|
+
bitstr->flags |= ASN1_STRING_FLAG_BITS_LEFT | unused_bits;
|
|
42
|
+
return 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static inline int
|
|
46
|
+
ASN1_BIT_STRING_get_length(const ASN1_BIT_STRING *bitstr, size_t *length,
|
|
47
|
+
int *unused_bits)
|
|
48
|
+
{
|
|
49
|
+
*length = bitstr->length;
|
|
50
|
+
*unused_bits = bitstr->flags & 0x07;
|
|
51
|
+
return 1;
|
|
52
|
+
}
|
|
53
|
+
#endif
|
|
54
|
+
|
|
32
55
|
#endif /* _OSSL_OPENSSL_MISSING_H_ */
|
data/ext/openssl/ossl.c
CHANGED
|
@@ -34,7 +34,11 @@ ossl_##name##_ary2sk0(VALUE ary) \
|
|
|
34
34
|
" of class ##type##"); \
|
|
35
35
|
} \
|
|
36
36
|
x = dup(val); /* NEED TO DUP */ \
|
|
37
|
-
sk_##type##_push(sk, x)
|
|
37
|
+
if (!sk_##type##_push(sk, x)) { \
|
|
38
|
+
type##_free(x); \
|
|
39
|
+
sk_##type##_pop_free(sk, type##_free); \
|
|
40
|
+
ossl_raise(eOSSLError, NULL); \
|
|
41
|
+
} \
|
|
38
42
|
} \
|
|
39
43
|
return (VALUE)sk; \
|
|
40
44
|
} \
|
|
@@ -523,10 +527,18 @@ ossl_fips_mode_set(VALUE self, VALUE enabled)
|
|
|
523
527
|
static VALUE
|
|
524
528
|
ossl_crypto_fixed_length_secure_compare(VALUE dummy, VALUE str1, VALUE str2)
|
|
525
529
|
{
|
|
526
|
-
const unsigned char *p1
|
|
527
|
-
const unsigned char *p2
|
|
528
|
-
long len1
|
|
529
|
-
long len2
|
|
530
|
+
const unsigned char *p1;
|
|
531
|
+
const unsigned char *p2;
|
|
532
|
+
long len1;
|
|
533
|
+
long len2;
|
|
534
|
+
|
|
535
|
+
StringValue(str1);
|
|
536
|
+
StringValue(str2);
|
|
537
|
+
|
|
538
|
+
p1 = (const unsigned char *)RSTRING_PTR(str1);
|
|
539
|
+
p2 = (const unsigned char *)RSTRING_PTR(str2);
|
|
540
|
+
len1 = RSTRING_LEN(str1);
|
|
541
|
+
len2 = RSTRING_LEN(str2);
|
|
530
542
|
|
|
531
543
|
if (len1 != len2) {
|
|
532
544
|
ossl_raise(rb_eArgError, "inputs must be of equal length");
|
data/ext/openssl/ossl_asn1.c
CHANGED
|
@@ -130,15 +130,17 @@ asn1integer_to_num(const ASN1_INTEGER *ai)
|
|
|
130
130
|
if (!ai) {
|
|
131
131
|
ossl_raise(rb_eTypeError, "ASN1_INTEGER is NULL!");
|
|
132
132
|
}
|
|
133
|
+
|
|
134
|
+
num = ossl_bn_new(BN_value_one());
|
|
135
|
+
bn = GetBNPtr(num);
|
|
136
|
+
|
|
133
137
|
if (ASN1_STRING_type(ai) == V_ASN1_ENUMERATED)
|
|
134
|
-
bn = ASN1_ENUMERATED_to_BN(ai,
|
|
138
|
+
bn = ASN1_ENUMERATED_to_BN(ai, bn);
|
|
135
139
|
else
|
|
136
|
-
bn = ASN1_INTEGER_to_BN(ai,
|
|
140
|
+
bn = ASN1_INTEGER_to_BN(ai, bn);
|
|
137
141
|
|
|
138
142
|
if (!bn)
|
|
139
143
|
ossl_raise(eOSSLError, NULL);
|
|
140
|
-
num = ossl_bn_new(bn);
|
|
141
|
-
BN_free(bn);
|
|
142
144
|
|
|
143
145
|
return num;
|
|
144
146
|
}
|
|
@@ -226,7 +228,7 @@ obj_to_asn1int(VALUE obj)
|
|
|
226
228
|
}
|
|
227
229
|
|
|
228
230
|
static ASN1_BIT_STRING*
|
|
229
|
-
obj_to_asn1bstr(VALUE obj,
|
|
231
|
+
obj_to_asn1bstr(VALUE obj, int unused_bits)
|
|
230
232
|
{
|
|
231
233
|
ASN1_BIT_STRING *bstr;
|
|
232
234
|
|
|
@@ -234,11 +236,11 @@ obj_to_asn1bstr(VALUE obj, long unused_bits)
|
|
|
234
236
|
ossl_raise(eASN1Error, "unused_bits for a bitstring value must be in "\
|
|
235
237
|
"the range 0 to 7");
|
|
236
238
|
StringValue(obj);
|
|
237
|
-
if(!(bstr = ASN1_BIT_STRING_new()))
|
|
238
|
-
ossl_raise(eASN1Error,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
if (!(bstr = ASN1_BIT_STRING_new()))
|
|
240
|
+
ossl_raise(eASN1Error, "ASN1_BIT_STRING_new");
|
|
241
|
+
if (!ASN1_BIT_STRING_set1(bstr, (uint8_t *)RSTRING_PTR(obj),
|
|
242
|
+
RSTRING_LEN(obj), unused_bits))
|
|
243
|
+
ossl_raise(eASN1Error, "ASN1_BIT_STRING_set1");
|
|
242
244
|
|
|
243
245
|
return bstr;
|
|
244
246
|
}
|
|
@@ -362,22 +364,25 @@ decode_int(unsigned char* der, long length)
|
|
|
362
364
|
}
|
|
363
365
|
|
|
364
366
|
static VALUE
|
|
365
|
-
decode_bstr(unsigned char* der, long length,
|
|
367
|
+
decode_bstr(unsigned char* der, long length, int *unused_bits)
|
|
366
368
|
{
|
|
367
369
|
ASN1_BIT_STRING *bstr;
|
|
368
370
|
const unsigned char *p;
|
|
369
|
-
|
|
371
|
+
size_t len;
|
|
370
372
|
VALUE ret;
|
|
373
|
+
int state;
|
|
371
374
|
|
|
372
375
|
p = der;
|
|
373
|
-
if(!(bstr = d2i_ASN1_BIT_STRING(NULL, &p, length)))
|
|
374
|
-
ossl_raise(eASN1Error,
|
|
375
|
-
len
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
ret =
|
|
376
|
+
if (!(bstr = d2i_ASN1_BIT_STRING(NULL, &p, length)))
|
|
377
|
+
ossl_raise(eASN1Error, "d2i_ASN1_BIT_STRING");
|
|
378
|
+
if (!ASN1_BIT_STRING_get_length(bstr, &len, unused_bits)) {
|
|
379
|
+
ASN1_BIT_STRING_free(bstr);
|
|
380
|
+
ossl_raise(eASN1Error, "ASN1_BIT_STRING_get_length");
|
|
381
|
+
}
|
|
382
|
+
ret = ossl_str_new((const char *)ASN1_STRING_get0_data(bstr), len, &state);
|
|
380
383
|
ASN1_BIT_STRING_free(bstr);
|
|
384
|
+
if (state)
|
|
385
|
+
rb_jump_tag(state);
|
|
381
386
|
|
|
382
387
|
return ret;
|
|
383
388
|
}
|
|
@@ -761,7 +766,7 @@ int_ossl_asn1_decode0_prim(unsigned char **pp, long length, long hlen, int tag,
|
|
|
761
766
|
{
|
|
762
767
|
VALUE value, asn1data;
|
|
763
768
|
unsigned char *p;
|
|
764
|
-
|
|
769
|
+
int flag = 0;
|
|
765
770
|
|
|
766
771
|
p = *pp;
|
|
767
772
|
|
|
@@ -818,7 +823,7 @@ int_ossl_asn1_decode0_prim(unsigned char **pp, long length, long hlen, int tag,
|
|
|
818
823
|
asn1data = rb_obj_alloc(klass);
|
|
819
824
|
ossl_asn1_initialize(4, args, asn1data);
|
|
820
825
|
if(tag == V_ASN1_BIT_STRING){
|
|
821
|
-
rb_ivar_set(asn1data, sivUNUSED_BITS,
|
|
826
|
+
rb_ivar_set(asn1data, sivUNUSED_BITS, INT2NUM(flag));
|
|
822
827
|
}
|
|
823
828
|
}
|
|
824
829
|
else {
|
data/ext/openssl/ossl_bio.c
CHANGED
|
@@ -32,7 +32,11 @@ ossl_membio2str(BIO *bio)
|
|
|
32
32
|
int state;
|
|
33
33
|
BUF_MEM *buf;
|
|
34
34
|
|
|
35
|
-
BIO_get_mem_ptr(bio, &buf)
|
|
35
|
+
if (BIO_get_mem_ptr(bio, &buf) <= 0) {
|
|
36
|
+
BIO_free(bio);
|
|
37
|
+
ossl_raise(eOSSLError, "BIO_get_mem_ptr");
|
|
38
|
+
}
|
|
39
|
+
|
|
36
40
|
ret = ossl_str_new(buf->data, buf->length, &state);
|
|
37
41
|
BIO_free(bio);
|
|
38
42
|
if (state)
|
data/ext/openssl/ossl_ocsp.c
CHANGED
|
@@ -922,7 +922,7 @@ ossl_ocspbres_get_status(VALUE self)
|
|
|
922
922
|
VALUE ext = rb_ary_new();
|
|
923
923
|
int ext_count = OCSP_SINGLERESP_get_ext_count(single);
|
|
924
924
|
for (int j = 0; j < ext_count; j++) {
|
|
925
|
-
X509_EXTENSION *x509ext = OCSP_SINGLERESP_get_ext(single, j);
|
|
925
|
+
const X509_EXTENSION *x509ext = OCSP_SINGLERESP_get_ext(single, j);
|
|
926
926
|
rb_ary_push(ext, ossl_x509ext_new(x509ext));
|
|
927
927
|
}
|
|
928
928
|
rb_ary_push(ary, ext);
|
|
@@ -1341,7 +1341,6 @@ static VALUE
|
|
|
1341
1341
|
ossl_ocspsres_get_extensions(VALUE self)
|
|
1342
1342
|
{
|
|
1343
1343
|
OCSP_SINGLERESP *sres;
|
|
1344
|
-
X509_EXTENSION *ext;
|
|
1345
1344
|
int count, i;
|
|
1346
1345
|
VALUE ary;
|
|
1347
1346
|
|
|
@@ -1350,7 +1349,7 @@ ossl_ocspsres_get_extensions(VALUE self)
|
|
|
1350
1349
|
count = OCSP_SINGLERESP_get_ext_count(sres);
|
|
1351
1350
|
ary = rb_ary_new2(count);
|
|
1352
1351
|
for (i = 0; i < count; i++) {
|
|
1353
|
-
ext = OCSP_SINGLERESP_get_ext(sres, i);
|
|
1352
|
+
const X509_EXTENSION *ext = OCSP_SINGLERESP_get_ext(sres, i);
|
|
1354
1353
|
rb_ary_push(ary, ossl_x509ext_new(ext)); /* will dup */
|
|
1355
1354
|
}
|
|
1356
1355
|
|
data/ext/openssl/ossl_pkey.h
CHANGED
data/ext/openssl/ossl_ts.c
CHANGED
data/ext/openssl/ossl_x509.h
CHANGED
|
@@ -29,7 +29,7 @@ void Init_ossl_x509(void);
|
|
|
29
29
|
*/
|
|
30
30
|
extern VALUE cX509Attr;
|
|
31
31
|
|
|
32
|
-
VALUE ossl_x509attr_new(X509_ATTRIBUTE *);
|
|
32
|
+
VALUE ossl_x509attr_new(const X509_ATTRIBUTE *);
|
|
33
33
|
X509_ATTRIBUTE *GetX509AttrPtr(VALUE);
|
|
34
34
|
void Init_ossl_x509attr(void);
|
|
35
35
|
|
|
@@ -38,7 +38,7 @@ void Init_ossl_x509attr(void);
|
|
|
38
38
|
*/
|
|
39
39
|
extern VALUE cX509Cert;
|
|
40
40
|
|
|
41
|
-
VALUE ossl_x509_new(X509 *);
|
|
41
|
+
VALUE ossl_x509_new(const X509 *);
|
|
42
42
|
X509 *GetX509CertPtr(VALUE);
|
|
43
43
|
X509 *DupX509CertPtr(VALUE);
|
|
44
44
|
void Init_ossl_x509cert(void);
|
|
@@ -46,7 +46,7 @@ void Init_ossl_x509cert(void);
|
|
|
46
46
|
/*
|
|
47
47
|
* X509CRL
|
|
48
48
|
*/
|
|
49
|
-
VALUE ossl_x509crl_new(X509_CRL *);
|
|
49
|
+
VALUE ossl_x509crl_new(const X509_CRL *);
|
|
50
50
|
X509_CRL *GetX509CRLPtr(VALUE);
|
|
51
51
|
void Init_ossl_x509crl(void);
|
|
52
52
|
|
|
@@ -55,14 +55,14 @@ void Init_ossl_x509crl(void);
|
|
|
55
55
|
*/
|
|
56
56
|
extern VALUE cX509Ext;
|
|
57
57
|
|
|
58
|
-
VALUE ossl_x509ext_new(X509_EXTENSION *);
|
|
58
|
+
VALUE ossl_x509ext_new(const X509_EXTENSION *);
|
|
59
59
|
X509_EXTENSION *GetX509ExtPtr(VALUE);
|
|
60
60
|
void Init_ossl_x509ext(void);
|
|
61
61
|
|
|
62
62
|
/*
|
|
63
63
|
* X509Name
|
|
64
64
|
*/
|
|
65
|
-
VALUE ossl_x509name_new(X509_NAME *);
|
|
65
|
+
VALUE ossl_x509name_new(const X509_NAME *);
|
|
66
66
|
X509_NAME *GetX509NamePtr(VALUE);
|
|
67
67
|
void Init_ossl_x509name(void);
|
|
68
68
|
|
|
@@ -77,7 +77,7 @@ void Init_ossl_x509req(void);
|
|
|
77
77
|
*/
|
|
78
78
|
extern VALUE cX509Rev;
|
|
79
79
|
|
|
80
|
-
VALUE ossl_x509revoked_new(X509_REVOKED *);
|
|
80
|
+
VALUE ossl_x509revoked_new(const X509_REVOKED *);
|
|
81
81
|
X509_REVOKED *DupX509RevokedPtr(VALUE);
|
|
82
82
|
void Init_ossl_x509revoked(void);
|
|
83
83
|
|
data/ext/openssl/ossl_x509attr.c
CHANGED
|
@@ -48,13 +48,14 @@ static const rb_data_type_t ossl_x509attr_type = {
|
|
|
48
48
|
* Public
|
|
49
49
|
*/
|
|
50
50
|
VALUE
|
|
51
|
-
ossl_x509attr_new(X509_ATTRIBUTE *attr)
|
|
51
|
+
ossl_x509attr_new(const X509_ATTRIBUTE *attr)
|
|
52
52
|
{
|
|
53
53
|
X509_ATTRIBUTE *new;
|
|
54
54
|
VALUE obj;
|
|
55
55
|
|
|
56
56
|
obj = NewX509Attr(cX509Attr);
|
|
57
|
-
|
|
57
|
+
/* OpenSSL 1.1.1 takes a non-const pointer */
|
|
58
|
+
new = X509_ATTRIBUTE_dup((X509_ATTRIBUTE *)attr);
|
|
58
59
|
if (!new)
|
|
59
60
|
ossl_raise(eX509AttrError, "X509_ATTRIBUTE_dup");
|
|
60
61
|
SetX509Attr(obj, new);
|
|
@@ -196,7 +197,7 @@ ossl_x509attr_set_value(VALUE self, VALUE value)
|
|
|
196
197
|
ossl_raise(eX509AttrError, "attribute value must be ASN1::Set");
|
|
197
198
|
|
|
198
199
|
if (X509_ATTRIBUTE_count(attr)) { /* populated, reset first */
|
|
199
|
-
ASN1_OBJECT *obj = X509_ATTRIBUTE_get0_object(attr);
|
|
200
|
+
const ASN1_OBJECT *obj = X509_ATTRIBUTE_get0_object(attr);
|
|
200
201
|
X509_ATTRIBUTE *new_attr = X509_ATTRIBUTE_create_by_OBJ(NULL, obj, 0, NULL, -1);
|
|
201
202
|
if (!new_attr) {
|
|
202
203
|
sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
|
|
@@ -240,7 +241,7 @@ ossl_x509attr_get_value(VALUE self)
|
|
|
240
241
|
|
|
241
242
|
count = X509_ATTRIBUTE_count(attr);
|
|
242
243
|
for (i = 0; i < count; i++)
|
|
243
|
-
sk_ASN1_TYPE_push(sk, X509_ATTRIBUTE_get0_type(attr, i));
|
|
244
|
+
sk_ASN1_TYPE_push(sk, (ASN1_TYPE *)X509_ATTRIBUTE_get0_type(attr, i));
|
|
244
245
|
|
|
245
246
|
if ((len = i2d_ASN1_SET_ANY(sk, NULL)) <= 0) {
|
|
246
247
|
sk_ASN1_TYPE_free(sk);
|
data/ext/openssl/ossl_x509cert.c
CHANGED
|
@@ -48,13 +48,14 @@ static const rb_data_type_t ossl_x509_type = {
|
|
|
48
48
|
* Public
|
|
49
49
|
*/
|
|
50
50
|
VALUE
|
|
51
|
-
ossl_x509_new(X509 *x509)
|
|
51
|
+
ossl_x509_new(const X509 *x509)
|
|
52
52
|
{
|
|
53
53
|
X509 *new;
|
|
54
54
|
VALUE obj;
|
|
55
55
|
|
|
56
56
|
obj = NewX509(cX509Cert);
|
|
57
|
-
|
|
57
|
+
/* OpenSSL 1.1.1 takes a non-const pointer */
|
|
58
|
+
new = X509_dup((X509 *)x509);
|
|
58
59
|
if (!new)
|
|
59
60
|
ossl_raise(eX509CertError, "X509_dup");
|
|
60
61
|
SetX509(obj, new);
|
|
@@ -345,7 +346,7 @@ static VALUE
|
|
|
345
346
|
ossl_x509_get_subject(VALUE self)
|
|
346
347
|
{
|
|
347
348
|
X509 *x509;
|
|
348
|
-
X509_NAME *name;
|
|
349
|
+
const X509_NAME *name;
|
|
349
350
|
|
|
350
351
|
GetX509(self, x509);
|
|
351
352
|
if (!(name = X509_get_subject_name(x509))) { /* NO DUP - don't free! */
|
|
@@ -380,7 +381,7 @@ static VALUE
|
|
|
380
381
|
ossl_x509_get_issuer(VALUE self)
|
|
381
382
|
{
|
|
382
383
|
X509 *x509;
|
|
383
|
-
X509_NAME *name;
|
|
384
|
+
const X509_NAME *name;
|
|
384
385
|
|
|
385
386
|
GetX509(self, x509);
|
|
386
387
|
if(!(name = X509_get_issuer_name(x509))) { /* NO DUP - don't free! */
|
|
@@ -603,14 +604,13 @@ ossl_x509_get_extensions(VALUE self)
|
|
|
603
604
|
{
|
|
604
605
|
X509 *x509;
|
|
605
606
|
int count, i;
|
|
606
|
-
X509_EXTENSION *ext;
|
|
607
607
|
VALUE ary;
|
|
608
608
|
|
|
609
609
|
GetX509(self, x509);
|
|
610
610
|
count = X509_get_ext_count(x509);
|
|
611
611
|
ary = rb_ary_new_capa(count);
|
|
612
612
|
for (i=0; i<count; i++) {
|
|
613
|
-
ext = X509_get_ext(x509, i);
|
|
613
|
+
const X509_EXTENSION *ext = X509_get_ext(x509, i);
|
|
614
614
|
rb_ary_push(ary, ossl_x509ext_new(ext));
|
|
615
615
|
}
|
|
616
616
|
|
data/ext/openssl/ossl_x509crl.c
CHANGED
|
@@ -58,13 +58,14 @@ GetX509CRLPtr(VALUE obj)
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
VALUE
|
|
61
|
-
ossl_x509crl_new(X509_CRL *crl)
|
|
61
|
+
ossl_x509crl_new(const X509_CRL *crl)
|
|
62
62
|
{
|
|
63
63
|
X509_CRL *tmp;
|
|
64
64
|
VALUE obj;
|
|
65
65
|
|
|
66
66
|
obj = NewX509CRL(cX509CRL);
|
|
67
|
-
|
|
67
|
+
/* OpenSSL 1.1.1 takes a non-const pointer */
|
|
68
|
+
tmp = X509_CRL_dup((X509_CRL *)crl);
|
|
68
69
|
if (!tmp)
|
|
69
70
|
ossl_raise(eX509CRLError, "X509_CRL_dup");
|
|
70
71
|
SetX509CRL(obj, tmp);
|
|
@@ -289,7 +290,7 @@ ossl_x509crl_get_revoked(VALUE self)
|
|
|
289
290
|
num = sk_X509_REVOKED_num(sk);
|
|
290
291
|
ary = rb_ary_new_capa(num);
|
|
291
292
|
for(i=0; i<num; i++) {
|
|
292
|
-
X509_REVOKED *rev = sk_X509_REVOKED_value(sk, i);
|
|
293
|
+
const X509_REVOKED *rev = sk_X509_REVOKED_value(sk, i);
|
|
293
294
|
rb_ary_push(ary, ossl_x509revoked_new(rev));
|
|
294
295
|
}
|
|
295
296
|
|
|
@@ -443,14 +444,13 @@ ossl_x509crl_get_extensions(VALUE self)
|
|
|
443
444
|
{
|
|
444
445
|
X509_CRL *crl;
|
|
445
446
|
int count, i;
|
|
446
|
-
X509_EXTENSION *ext;
|
|
447
447
|
VALUE ary;
|
|
448
448
|
|
|
449
449
|
GetX509CRL(self, crl);
|
|
450
450
|
count = X509_CRL_get_ext_count(crl);
|
|
451
451
|
ary = rb_ary_new_capa(count);
|
|
452
452
|
for (i=0; i<count; i++) {
|
|
453
|
-
ext = X509_CRL_get_ext(crl, i);
|
|
453
|
+
const X509_EXTENSION *ext = X509_CRL_get_ext(crl, i);
|
|
454
454
|
rb_ary_push(ary, ossl_x509ext_new(ext));
|
|
455
455
|
}
|
|
456
456
|
|
data/ext/openssl/ossl_x509ext.c
CHANGED
|
@@ -62,13 +62,14 @@ static const rb_data_type_t ossl_x509ext_type = {
|
|
|
62
62
|
* Public
|
|
63
63
|
*/
|
|
64
64
|
VALUE
|
|
65
|
-
ossl_x509ext_new(X509_EXTENSION *ext)
|
|
65
|
+
ossl_x509ext_new(const X509_EXTENSION *ext)
|
|
66
66
|
{
|
|
67
67
|
X509_EXTENSION *new;
|
|
68
68
|
VALUE obj;
|
|
69
69
|
|
|
70
70
|
obj = NewX509Ext(cX509Ext);
|
|
71
|
-
|
|
71
|
+
/* OpenSSL 1.1.1 takes a non-const pointer */
|
|
72
|
+
new = X509_EXTENSION_dup((X509_EXTENSION *)ext);
|
|
72
73
|
if (!new)
|
|
73
74
|
ossl_raise(eX509ExtError, "X509_EXTENSION_dup");
|
|
74
75
|
SetX509Ext(obj, new);
|
|
@@ -338,12 +339,20 @@ ossl_x509ext_set_value(VALUE self, VALUE data)
|
|
|
338
339
|
GetX509Ext(self, ext);
|
|
339
340
|
data = ossl_to_der_if_possible(data);
|
|
340
341
|
StringValue(data);
|
|
341
|
-
asn1s = X509_EXTENSION_get_data(ext);
|
|
342
342
|
|
|
343
|
+
asn1s = ASN1_OCTET_STRING_new();
|
|
344
|
+
if (!asn1s)
|
|
345
|
+
ossl_raise(eX509ExtError, "ASN1_OCTET_STRING_new");
|
|
343
346
|
if (!ASN1_OCTET_STRING_set(asn1s, (unsigned char *)RSTRING_PTR(data),
|
|
344
347
|
RSTRING_LENINT(data))) {
|
|
348
|
+
ASN1_OCTET_STRING_free(asn1s);
|
|
345
349
|
ossl_raise(eX509ExtError, "ASN1_OCTET_STRING_set");
|
|
346
350
|
}
|
|
351
|
+
if (!X509_EXTENSION_set_data(ext, asn1s)) {
|
|
352
|
+
ASN1_OCTET_STRING_free(asn1s);
|
|
353
|
+
ossl_raise(eX509ExtError, "X509_EXTENSION_set_data");
|
|
354
|
+
}
|
|
355
|
+
ASN1_OCTET_STRING_free(asn1s);
|
|
347
356
|
|
|
348
357
|
return data;
|
|
349
358
|
}
|
|
@@ -386,7 +395,7 @@ ossl_x509ext_get_value(VALUE obj)
|
|
|
386
395
|
if (!(out = BIO_new(BIO_s_mem())))
|
|
387
396
|
ossl_raise(eX509ExtError, NULL);
|
|
388
397
|
if (!X509V3_EXT_print(out, ext, 0, 0))
|
|
389
|
-
ASN1_STRING_print(out,
|
|
398
|
+
ASN1_STRING_print(out, X509_EXTENSION_get_data(ext));
|
|
390
399
|
ret = ossl_membio2str(out);
|
|
391
400
|
|
|
392
401
|
return ret;
|
|
@@ -396,7 +405,7 @@ static VALUE
|
|
|
396
405
|
ossl_x509ext_get_value_der(VALUE obj)
|
|
397
406
|
{
|
|
398
407
|
X509_EXTENSION *ext;
|
|
399
|
-
ASN1_OCTET_STRING *value;
|
|
408
|
+
const ASN1_OCTET_STRING *value;
|
|
400
409
|
|
|
401
410
|
GetX509Ext(obj, ext);
|
|
402
411
|
if ((value = X509_EXTENSION_get_data(ext)) == NULL)
|
data/ext/openssl/ossl_x509name.c
CHANGED
|
@@ -53,13 +53,14 @@ static const rb_data_type_t ossl_x509name_type = {
|
|
|
53
53
|
* Public
|
|
54
54
|
*/
|
|
55
55
|
VALUE
|
|
56
|
-
ossl_x509name_new(X509_NAME *name)
|
|
56
|
+
ossl_x509name_new(const X509_NAME *name)
|
|
57
57
|
{
|
|
58
58
|
X509_NAME *new;
|
|
59
59
|
VALUE obj;
|
|
60
60
|
|
|
61
61
|
obj = NewX509Name(cX509Name);
|
|
62
|
-
|
|
62
|
+
/* OpenSSL 1.1.1 takes a non-const pointer */
|
|
63
|
+
new = X509_NAME_dup((X509_NAME *)name);
|
|
63
64
|
if (!new)
|
|
64
65
|
ossl_raise(eX509NameError, "X509_NAME_dup");
|
|
65
66
|
SetX509Name(obj, new);
|
data/ext/openssl/ossl_x509req.c
CHANGED
|
@@ -231,7 +231,7 @@ static VALUE
|
|
|
231
231
|
ossl_x509req_get_subject(VALUE self)
|
|
232
232
|
{
|
|
233
233
|
X509_REQ *req;
|
|
234
|
-
X509_NAME *name;
|
|
234
|
+
const X509_NAME *name;
|
|
235
235
|
|
|
236
236
|
GetX509Req(self, req);
|
|
237
237
|
if (!(name = X509_REQ_get_subject_name(req))) { /* NO DUP - don't free */
|
|
@@ -351,7 +351,7 @@ ossl_x509req_get_attributes(VALUE self)
|
|
|
351
351
|
{
|
|
352
352
|
X509_REQ *req;
|
|
353
353
|
int count, i;
|
|
354
|
-
X509_ATTRIBUTE *attr;
|
|
354
|
+
const X509_ATTRIBUTE *attr;
|
|
355
355
|
VALUE ary;
|
|
356
356
|
|
|
357
357
|
GetX509Req(self, req);
|
|
@@ -48,13 +48,14 @@ static const rb_data_type_t ossl_x509rev_type = {
|
|
|
48
48
|
* PUBLIC
|
|
49
49
|
*/
|
|
50
50
|
VALUE
|
|
51
|
-
ossl_x509revoked_new(X509_REVOKED *rev)
|
|
51
|
+
ossl_x509revoked_new(const X509_REVOKED *rev)
|
|
52
52
|
{
|
|
53
53
|
X509_REVOKED *new;
|
|
54
54
|
VALUE obj;
|
|
55
55
|
|
|
56
56
|
obj = NewX509Rev(cX509Rev);
|
|
57
|
-
|
|
57
|
+
/* OpenSSL 1.1.1 takes a non-const pointer */
|
|
58
|
+
new = X509_REVOKED_dup((X509_REVOKED *)rev);
|
|
58
59
|
if (!new)
|
|
59
60
|
ossl_raise(eX509RevError, "X509_REVOKED_dup");
|
|
60
61
|
SetX509Rev(obj, new);
|
|
@@ -185,7 +186,7 @@ ossl_x509revoked_get_extensions(VALUE self)
|
|
|
185
186
|
{
|
|
186
187
|
X509_REVOKED *rev;
|
|
187
188
|
int count, i;
|
|
188
|
-
X509_EXTENSION *ext;
|
|
189
|
+
const X509_EXTENSION *ext;
|
|
189
190
|
VALUE ary;
|
|
190
191
|
|
|
191
192
|
GetX509Rev(self, rev);
|
|
@@ -512,10 +512,8 @@ static void
|
|
|
512
512
|
ossl_x509stctx_free(void *ptr)
|
|
513
513
|
{
|
|
514
514
|
X509_STORE_CTX *ctx = ptr;
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
if (X509_STORE_CTX_get0_cert(ctx))
|
|
518
|
-
X509_free(X509_STORE_CTX_get0_cert(ctx));
|
|
515
|
+
sk_X509_pop_free(X509_STORE_CTX_get0_untrusted(ctx), X509_free);
|
|
516
|
+
X509_free((X509 *)X509_STORE_CTX_get0_cert(ctx));
|
|
519
517
|
X509_STORE_CTX_free(ctx);
|
|
520
518
|
}
|
|
521
519
|
|
|
@@ -736,7 +734,7 @@ static VALUE
|
|
|
736
734
|
ossl_x509stctx_get_curr_cert(VALUE self)
|
|
737
735
|
{
|
|
738
736
|
X509_STORE_CTX *ctx;
|
|
739
|
-
X509 *x509;
|
|
737
|
+
const X509 *x509;
|
|
740
738
|
|
|
741
739
|
GetX509StCtx(self, ctx);
|
|
742
740
|
x509 = X509_STORE_CTX_get_current_cert(ctx);
|
|
@@ -758,7 +756,7 @@ static VALUE
|
|
|
758
756
|
ossl_x509stctx_get_curr_crl(VALUE self)
|
|
759
757
|
{
|
|
760
758
|
X509_STORE_CTX *ctx;
|
|
761
|
-
X509_CRL *crl;
|
|
759
|
+
const X509_CRL *crl;
|
|
762
760
|
|
|
763
761
|
GetX509StCtx(self, ctx);
|
|
764
762
|
crl = X509_STORE_CTX_get0_current_crl(ctx);
|
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: 4.0.
|
|
4
|
+
version: 4.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martin Bosslet
|
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
118
118
|
- !ruby/object:Gem::Version
|
|
119
119
|
version: '0'
|
|
120
120
|
requirements: []
|
|
121
|
-
rubygems_version: 4.0.
|
|
121
|
+
rubygems_version: 4.0.10
|
|
122
122
|
specification_version: 4
|
|
123
123
|
summary: SSL/TLS and general-purpose cryptography for Ruby
|
|
124
124
|
test_files: []
|