openssl 3.3.2 → 3.3.3
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 +16 -0
- data/ext/openssl/extconf.rb +4 -0
- data/ext/openssl/openssl_missing.c +1 -0
- data/ext/openssl/openssl_missing.h +27 -0
- data/ext/openssl/ossl.c +1 -1
- data/ext/openssl/ossl.h +2 -1
- data/ext/openssl/ossl_asn1.c +32 -27
- data/ext/openssl/ossl_ns_spki.c +4 -5
- data/ext/openssl/ossl_ocsp.c +8 -8
- data/ext/openssl/ossl_pkcs7.c +1 -1
- data/ext/openssl/ossl_pkey.c +61 -21
- data/ext/openssl/ossl_provider.c +0 -2
- data/ext/openssl/ossl_ts.c +4 -4
- data/ext/openssl/ossl_x509.h +6 -6
- data/ext/openssl/ossl_x509attr.c +7 -6
- data/ext/openssl/ossl_x509cert.c +6 -6
- data/ext/openssl/ossl_x509crl.c +5 -5
- data/ext/openssl/ossl_x509ext.c +18 -9
- data/ext/openssl/ossl_x509name.c +7 -5
- data/ext/openssl/ossl_x509req.c +2 -2
- data/ext/openssl/ossl_x509revoked.c +4 -3
- data/ext/openssl/ossl_x509store.c +3 -5
- 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: 270faf783ff75be8a47f83db04265151f21d43ab7afe3e3041747258b5c55aef
|
|
4
|
+
data.tar.gz: 67ddc09a58e2e3ae2de50490923247084c9a4b18548e068a203d09a0cdb0c97e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bcda4095985afab3facb189c86055511ac48f88812fdce46b0d4cb66ba870cc2decc2bf9b87faab3e6a6deb1b0ed4efbbe19be7277918b73931a3e4e14c00d8b
|
|
7
|
+
data.tar.gz: e21e82f16bbd34294d1fb9bb02822910562358fdbf570b591e67918003b798fd630046782da7f46b865faddb1f4fbb556d78b574766f4fc84e5be468070233c1
|
data/History.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
Version 3.3.3
|
|
2
|
+
=============
|
|
3
|
+
|
|
4
|
+
Merged changes in 3.2.4.
|
|
5
|
+
|
|
6
|
+
|
|
1
7
|
Version 3.3.2
|
|
2
8
|
=============
|
|
3
9
|
|
|
@@ -86,6 +92,16 @@ And various non-user-visible changes and bug fixes. Please see the commit
|
|
|
86
92
|
history for more details.
|
|
87
93
|
|
|
88
94
|
|
|
95
|
+
Version 3.2.4
|
|
96
|
+
=============
|
|
97
|
+
|
|
98
|
+
Notable changes
|
|
99
|
+
---------------
|
|
100
|
+
|
|
101
|
+
* Add support for OpenSSL 4.0.
|
|
102
|
+
[[GitHub #1051]](https://github.com/ruby/openssl/pull/1051)
|
|
103
|
+
|
|
104
|
+
|
|
89
105
|
Version 3.2.3
|
|
90
106
|
=============
|
|
91
107
|
|
data/ext/openssl/extconf.rb
CHANGED
|
@@ -191,6 +191,7 @@ have_func("TS_RESP_CTX_set_time_cb(NULL, NULL, NULL)", ts_h)
|
|
|
191
191
|
have_func("EVP_PBE_scrypt(\"\", 0, (unsigned char *)\"\", 0, 0, 0, 0, 0, NULL, 0)", evp_h)
|
|
192
192
|
have_func("SSL_CTX_set_post_handshake_auth(NULL, 0)", ssl_h)
|
|
193
193
|
have_func("X509_STORE_get0_param(NULL)", x509_h)
|
|
194
|
+
have_func("ASN1_STRING_get0_data(NULL)", "openssl/asn1.h")
|
|
194
195
|
|
|
195
196
|
# added in 1.1.1
|
|
196
197
|
have_func("EVP_PKEY_check(NULL)", evp_h)
|
|
@@ -208,6 +209,9 @@ have_func("EVP_MD_CTX_get_pkey_ctx(NULL)", evp_h)
|
|
|
208
209
|
have_func("EVP_PKEY_eq(NULL, NULL)", evp_h)
|
|
209
210
|
have_func("EVP_PKEY_dup(NULL)", evp_h)
|
|
210
211
|
|
|
212
|
+
# added in 4.0.0
|
|
213
|
+
have_func("ASN1_BIT_STRING_set1(NULL, NULL, 0, 0)", "openssl/asn1.h")
|
|
214
|
+
|
|
211
215
|
Logging::message "=== Checking done. ===\n"
|
|
212
216
|
|
|
213
217
|
# Append flags from environment variables.
|
|
@@ -210,6 +210,10 @@ IMPL_PKEY_GETTER(EC_KEY, ec)
|
|
|
210
210
|
} while (0)
|
|
211
211
|
#endif
|
|
212
212
|
|
|
213
|
+
#if !defined(HAVE_ASN1_STRING_GET0_DATA)
|
|
214
|
+
# define ASN1_STRING_get0_data(x) ((x)->data)
|
|
215
|
+
#endif
|
|
216
|
+
|
|
213
217
|
/* added in 3.0.0 */
|
|
214
218
|
#if !defined(HAVE_TS_VERIFY_CTX_SET_CERTS)
|
|
215
219
|
# define TS_VERIFY_CTX_set_certs(ctx, crts) TS_VERIFY_CTS_set_certs(ctx, crts)
|
|
@@ -235,4 +239,27 @@ IMPL_PKEY_GETTER(EC_KEY, ec)
|
|
|
235
239
|
# define EVP_PKEY_eq(a, b) EVP_PKEY_cmp(a, b)
|
|
236
240
|
#endif
|
|
237
241
|
|
|
242
|
+
/* added in 4.0.0 */
|
|
243
|
+
#ifndef HAVE_ASN1_BIT_STRING_SET1
|
|
244
|
+
static inline int
|
|
245
|
+
ASN1_BIT_STRING_set1(ASN1_BIT_STRING *bitstr, const uint8_t *data,
|
|
246
|
+
size_t length, int unused_bits)
|
|
247
|
+
{
|
|
248
|
+
if (length > INT_MAX || !ASN1_STRING_set(bitstr, data, (int)length))
|
|
249
|
+
return 0;
|
|
250
|
+
bitstr->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07);
|
|
251
|
+
bitstr->flags |= ASN1_STRING_FLAG_BITS_LEFT | unused_bits;
|
|
252
|
+
return 1;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
static inline int
|
|
256
|
+
ASN1_BIT_STRING_get_length(const ASN1_BIT_STRING *bitstr, size_t *length,
|
|
257
|
+
int *unused_bits)
|
|
258
|
+
{
|
|
259
|
+
*length = bitstr->length;
|
|
260
|
+
*unused_bits = bitstr->flags & 0x07;
|
|
261
|
+
return 1;
|
|
262
|
+
}
|
|
263
|
+
#endif
|
|
264
|
+
|
|
238
265
|
#endif /* _OSSL_OPENSSL_MISSING_H_ */
|
data/ext/openssl/ossl.c
CHANGED
data/ext/openssl/ossl.h
CHANGED
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
|
|
72
72
|
#if OSSL_OPENSSL_PREREQ(3, 0, 0)
|
|
73
73
|
# define OSSL_USE_PROVIDER
|
|
74
|
+
# include <openssl/provider.h>
|
|
74
75
|
#endif
|
|
75
76
|
|
|
76
77
|
/*
|
|
@@ -126,7 +127,7 @@ do{\
|
|
|
126
127
|
* Convert binary string to hex string. The caller is responsible for
|
|
127
128
|
* ensuring out has (2 * len) bytes of capacity.
|
|
128
129
|
*/
|
|
129
|
-
void ossl_bin2hex(unsigned char *in, char *out, size_t len);
|
|
130
|
+
void ossl_bin2hex(const unsigned char *in, char *out, size_t len);
|
|
130
131
|
|
|
131
132
|
/*
|
|
132
133
|
* Our default PEM callback
|
data/ext/openssl/ossl_asn1.c
CHANGED
|
@@ -16,17 +16,18 @@ static VALUE ossl_asn1_decode0(unsigned char **pp, long length, long *offset,
|
|
|
16
16
|
* DATE conversion
|
|
17
17
|
*/
|
|
18
18
|
VALUE
|
|
19
|
-
asn1time_to_time(const ASN1_TIME *
|
|
19
|
+
asn1time_to_time(const ASN1_TIME *time_)
|
|
20
20
|
{
|
|
21
|
+
ASN1_TIME *time = (ASN1_TIME *)time_; // const cast for OpenSSL 1.0.2
|
|
21
22
|
struct tm tm;
|
|
22
23
|
VALUE argv[6];
|
|
23
24
|
int count;
|
|
24
25
|
|
|
25
26
|
memset(&tm, 0, sizeof(struct tm));
|
|
26
27
|
|
|
27
|
-
switch (time
|
|
28
|
+
switch (ASN1_STRING_type(time)) {
|
|
28
29
|
case V_ASN1_UTCTIME:
|
|
29
|
-
count = sscanf((const char *)time
|
|
30
|
+
count = sscanf((const char *)ASN1_STRING_get0_data(time), "%2d%2d%2d%2d%2d%2dZ",
|
|
30
31
|
&tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min,
|
|
31
32
|
&tm.tm_sec);
|
|
32
33
|
|
|
@@ -34,7 +35,7 @@ asn1time_to_time(const ASN1_TIME *time)
|
|
|
34
35
|
tm.tm_sec = 0;
|
|
35
36
|
} else if (count != 6) {
|
|
36
37
|
ossl_raise(rb_eTypeError, "bad UTCTIME format: \"%s\"",
|
|
37
|
-
time
|
|
38
|
+
ASN1_STRING_get0_data(time));
|
|
38
39
|
}
|
|
39
40
|
if (tm.tm_year < 69) {
|
|
40
41
|
tm.tm_year += 2000;
|
|
@@ -43,7 +44,7 @@ asn1time_to_time(const ASN1_TIME *time)
|
|
|
43
44
|
}
|
|
44
45
|
break;
|
|
45
46
|
case V_ASN1_GENERALIZEDTIME:
|
|
46
|
-
count = sscanf((const char *)time
|
|
47
|
+
count = sscanf((const char *)ASN1_STRING_get0_data(time), "%4d%2d%2d%2d%2d%2dZ",
|
|
47
48
|
&tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min,
|
|
48
49
|
&tm.tm_sec);
|
|
49
50
|
if (count == 5) {
|
|
@@ -51,7 +52,7 @@ asn1time_to_time(const ASN1_TIME *time)
|
|
|
51
52
|
}
|
|
52
53
|
else if (count != 6) {
|
|
53
54
|
ossl_raise(rb_eTypeError, "bad GENERALIZEDTIME format: \"%s\"",
|
|
54
|
-
time
|
|
55
|
+
ASN1_STRING_get0_data(time));
|
|
55
56
|
}
|
|
56
57
|
break;
|
|
57
58
|
default:
|
|
@@ -96,7 +97,8 @@ ossl_time_split(VALUE time, time_t *sec, int *days)
|
|
|
96
97
|
VALUE
|
|
97
98
|
asn1str_to_str(const ASN1_STRING *str)
|
|
98
99
|
{
|
|
99
|
-
return rb_str_new((const char *)str
|
|
100
|
+
return rb_str_new((const char *)ASN1_STRING_get0_data(str),
|
|
101
|
+
ASN1_STRING_length(str));
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
/*
|
|
@@ -111,9 +113,9 @@ asn1integer_to_num(const ASN1_INTEGER *ai)
|
|
|
111
113
|
if (!ai) {
|
|
112
114
|
ossl_raise(rb_eTypeError, "ASN1_INTEGER is NULL!");
|
|
113
115
|
}
|
|
114
|
-
if (ai
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
if (ASN1_STRING_type((ASN1_STRING *)ai) == V_ASN1_ENUMERATED)
|
|
117
|
+
/* const_cast: workaround for old OpenSSL */
|
|
118
|
+
bn = ASN1_ENUMERATED_to_BN((ASN1_ENUMERATED *)ai, NULL);
|
|
117
119
|
else
|
|
118
120
|
bn = ASN1_INTEGER_to_BN(ai, NULL);
|
|
119
121
|
|
|
@@ -204,7 +206,7 @@ obj_to_asn1int(VALUE obj)
|
|
|
204
206
|
}
|
|
205
207
|
|
|
206
208
|
static ASN1_BIT_STRING*
|
|
207
|
-
obj_to_asn1bstr(VALUE obj,
|
|
209
|
+
obj_to_asn1bstr(VALUE obj, int unused_bits)
|
|
208
210
|
{
|
|
209
211
|
ASN1_BIT_STRING *bstr;
|
|
210
212
|
|
|
@@ -212,11 +214,11 @@ obj_to_asn1bstr(VALUE obj, long unused_bits)
|
|
|
212
214
|
ossl_raise(eASN1Error, "unused_bits for a bitstring value must be in "\
|
|
213
215
|
"the range 0 to 7");
|
|
214
216
|
StringValue(obj);
|
|
215
|
-
if(!(bstr = ASN1_BIT_STRING_new()))
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
if (!(bstr = ASN1_BIT_STRING_new()))
|
|
218
|
+
ossl_raise(eASN1Error, "ASN1_BIT_STRING_new");
|
|
219
|
+
if (!ASN1_BIT_STRING_set1(bstr, (uint8_t *)RSTRING_PTR(obj),
|
|
220
|
+
RSTRING_LEN(obj), unused_bits))
|
|
221
|
+
ossl_raise(eASN1Error, "ASN1_BIT_STRING_set1");
|
|
220
222
|
|
|
221
223
|
return bstr;
|
|
222
224
|
}
|
|
@@ -340,22 +342,25 @@ decode_int(unsigned char* der, long length)
|
|
|
340
342
|
}
|
|
341
343
|
|
|
342
344
|
static VALUE
|
|
343
|
-
decode_bstr(unsigned char* der, long length,
|
|
345
|
+
decode_bstr(unsigned char* der, long length, int *unused_bits)
|
|
344
346
|
{
|
|
345
347
|
ASN1_BIT_STRING *bstr;
|
|
346
348
|
const unsigned char *p;
|
|
347
|
-
|
|
349
|
+
size_t len;
|
|
348
350
|
VALUE ret;
|
|
351
|
+
int state;
|
|
349
352
|
|
|
350
353
|
p = der;
|
|
351
|
-
if(!(bstr = d2i_ASN1_BIT_STRING(NULL, &p, length)))
|
|
352
|
-
|
|
353
|
-
len
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
ret =
|
|
354
|
+
if (!(bstr = d2i_ASN1_BIT_STRING(NULL, &p, length)))
|
|
355
|
+
ossl_raise(eASN1Error, "d2i_ASN1_BIT_STRING");
|
|
356
|
+
if (!ASN1_BIT_STRING_get_length(bstr, &len, unused_bits)) {
|
|
357
|
+
ASN1_BIT_STRING_free(bstr);
|
|
358
|
+
ossl_raise(eASN1Error, "ASN1_BIT_STRING_get_length");
|
|
359
|
+
}
|
|
360
|
+
ret = ossl_str_new((const char *)ASN1_STRING_get0_data(bstr), len, &state);
|
|
358
361
|
ASN1_BIT_STRING_free(bstr);
|
|
362
|
+
if (state)
|
|
363
|
+
rb_jump_tag(state);
|
|
359
364
|
|
|
360
365
|
return ret;
|
|
361
366
|
}
|
|
@@ -711,7 +716,7 @@ int_ossl_asn1_decode0_prim(unsigned char **pp, long length, long hlen, int tag,
|
|
|
711
716
|
{
|
|
712
717
|
VALUE value, asn1data;
|
|
713
718
|
unsigned char *p;
|
|
714
|
-
|
|
719
|
+
int flag = 0;
|
|
715
720
|
|
|
716
721
|
p = *pp;
|
|
717
722
|
|
|
@@ -767,7 +772,7 @@ int_ossl_asn1_decode0_prim(unsigned char **pp, long length, long hlen, int tag,
|
|
|
767
772
|
asn1data = rb_funcallv_public(klass, rb_intern("new"), 4, args);
|
|
768
773
|
}
|
|
769
774
|
if(tag == V_ASN1_BIT_STRING){
|
|
770
|
-
rb_ivar_set(asn1data, sivUNUSED_BITS,
|
|
775
|
+
rb_ivar_set(asn1data, sivUNUSED_BITS, INT2NUM(flag));
|
|
771
776
|
}
|
|
772
777
|
}
|
|
773
778
|
else {
|
data/ext/openssl/ossl_ns_spki.c
CHANGED
|
@@ -230,13 +230,12 @@ ossl_spki_get_challenge(VALUE self)
|
|
|
230
230
|
NETSCAPE_SPKI *spki;
|
|
231
231
|
|
|
232
232
|
GetSPKI(self, spki);
|
|
233
|
-
if (spki->spkac->challenge
|
|
234
|
-
|
|
235
|
-
|
|
233
|
+
if (ASN1_STRING_length(spki->spkac->challenge) <= 0) {
|
|
234
|
+
OSSL_Debug("Challenge.length <= 0?");
|
|
235
|
+
return rb_str_new(0, 0);
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
return
|
|
239
|
-
spki->spkac->challenge->length);
|
|
238
|
+
return asn1str_to_str(spki->spkac->challenge);
|
|
240
239
|
}
|
|
241
240
|
|
|
242
241
|
/*
|
data/ext/openssl/ossl_ocsp.c
CHANGED
|
@@ -900,7 +900,6 @@ ossl_ocspbres_get_status(VALUE self)
|
|
|
900
900
|
OCSP_CERTID *cid;
|
|
901
901
|
ASN1_TIME *revtime, *thisupd, *nextupd;
|
|
902
902
|
int status, reason;
|
|
903
|
-
X509_EXTENSION *x509ext;
|
|
904
903
|
VALUE ret, ary, ext;
|
|
905
904
|
int count, ext_count, i, j;
|
|
906
905
|
|
|
@@ -927,7 +926,7 @@ ossl_ocspbres_get_status(VALUE self)
|
|
|
927
926
|
ext = rb_ary_new();
|
|
928
927
|
ext_count = OCSP_SINGLERESP_get_ext_count(single);
|
|
929
928
|
for(j = 0; j < ext_count; j++){
|
|
930
|
-
x509ext = OCSP_SINGLERESP_get_ext(single, j);
|
|
929
|
+
const X509_EXTENSION *x509ext = OCSP_SINGLERESP_get_ext(single, j);
|
|
931
930
|
rb_ary_push(ext, ossl_x509ext_new(x509ext));
|
|
932
931
|
}
|
|
933
932
|
rb_ary_push(ary, ext);
|
|
@@ -1358,7 +1357,6 @@ static VALUE
|
|
|
1358
1357
|
ossl_ocspsres_get_extensions(VALUE self)
|
|
1359
1358
|
{
|
|
1360
1359
|
OCSP_SINGLERESP *sres;
|
|
1361
|
-
X509_EXTENSION *ext;
|
|
1362
1360
|
int count, i;
|
|
1363
1361
|
VALUE ary;
|
|
1364
1362
|
|
|
@@ -1367,7 +1365,7 @@ ossl_ocspsres_get_extensions(VALUE self)
|
|
|
1367
1365
|
count = OCSP_SINGLERESP_get_ext_count(sres);
|
|
1368
1366
|
ary = rb_ary_new2(count);
|
|
1369
1367
|
for (i = 0; i < count; i++) {
|
|
1370
|
-
ext = OCSP_SINGLERESP_get_ext(sres, i);
|
|
1368
|
+
const X509_EXTENSION *ext = OCSP_SINGLERESP_get_ext(sres, i);
|
|
1371
1369
|
rb_ary_push(ary, ossl_x509ext_new(ext)); /* will dup */
|
|
1372
1370
|
}
|
|
1373
1371
|
|
|
@@ -1565,8 +1563,9 @@ ossl_ocspcid_get_issuer_name_hash(VALUE self)
|
|
|
1565
1563
|
GetOCSPCertId(self, id);
|
|
1566
1564
|
OCSP_id_get0_info(&name_hash, NULL, NULL, NULL, id);
|
|
1567
1565
|
|
|
1568
|
-
ret = rb_str_new(NULL, name_hash
|
|
1569
|
-
ossl_bin2hex(name_hash
|
|
1566
|
+
ret = rb_str_new(NULL, ASN1_STRING_length(name_hash) * 2);
|
|
1567
|
+
ossl_bin2hex(ASN1_STRING_get0_data(name_hash), RSTRING_PTR(ret),
|
|
1568
|
+
ASN1_STRING_length(name_hash));
|
|
1570
1569
|
|
|
1571
1570
|
return ret;
|
|
1572
1571
|
}
|
|
@@ -1588,8 +1587,9 @@ ossl_ocspcid_get_issuer_key_hash(VALUE self)
|
|
|
1588
1587
|
GetOCSPCertId(self, id);
|
|
1589
1588
|
OCSP_id_get0_info(NULL, NULL, &key_hash, NULL, id);
|
|
1590
1589
|
|
|
1591
|
-
ret = rb_str_new(NULL, key_hash
|
|
1592
|
-
ossl_bin2hex(key_hash
|
|
1590
|
+
ret = rb_str_new(NULL, ASN1_STRING_length(key_hash) * 2);
|
|
1591
|
+
ossl_bin2hex(ASN1_STRING_get0_data(key_hash), RSTRING_PTR(ret),
|
|
1592
|
+
ASN1_STRING_length(key_hash));
|
|
1593
1593
|
|
|
1594
1594
|
return ret;
|
|
1595
1595
|
}
|
data/ext/openssl/ossl_pkcs7.c
CHANGED
data/ext/openssl/ossl_pkey.c
CHANGED
|
@@ -636,6 +636,30 @@ ossl_pkey_initialize_copy(VALUE self, VALUE other)
|
|
|
636
636
|
#endif
|
|
637
637
|
|
|
638
638
|
#ifdef HAVE_EVP_PKEY_NEW_RAW_PRIVATE_KEY
|
|
639
|
+
|
|
640
|
+
#ifndef OSSL_USE_PROVIDER
|
|
641
|
+
static int
|
|
642
|
+
lookup_pkey_type(VALUE type)
|
|
643
|
+
{
|
|
644
|
+
const EVP_PKEY_ASN1_METHOD *ameth;
|
|
645
|
+
int pkey_id;
|
|
646
|
+
|
|
647
|
+
StringValue(type);
|
|
648
|
+
/*
|
|
649
|
+
* XXX: EVP_PKEY_asn1_find_str() looks up a PEM type string. Should we use
|
|
650
|
+
* OBJ_txt2nid() instead (and then somehow check if the NID is an acceptable
|
|
651
|
+
* EVP_PKEY type)?
|
|
652
|
+
* It is probably fine, though, since it can handle all algorithms that
|
|
653
|
+
* support raw keys in 1.1.1: { X25519, X448, ED25519, ED448, HMAC }.
|
|
654
|
+
*/
|
|
655
|
+
ameth = EVP_PKEY_asn1_find_str(NULL, RSTRING_PTR(type), RSTRING_LENINT(type));
|
|
656
|
+
if (!ameth)
|
|
657
|
+
ossl_raise(ePKeyError, "algorithm %"PRIsVALUE" not found", type);
|
|
658
|
+
EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, NULL, NULL, ameth);
|
|
659
|
+
return pkey_id;
|
|
660
|
+
}
|
|
661
|
+
#endif
|
|
662
|
+
|
|
639
663
|
/*
|
|
640
664
|
* call-seq:
|
|
641
665
|
* OpenSSL::PKey.new_raw_private_key(algo, string) -> PKey
|
|
@@ -647,22 +671,23 @@ static VALUE
|
|
|
647
671
|
ossl_pkey_new_raw_private_key(VALUE self, VALUE type, VALUE key)
|
|
648
672
|
{
|
|
649
673
|
EVP_PKEY *pkey;
|
|
650
|
-
const EVP_PKEY_ASN1_METHOD *ameth;
|
|
651
|
-
int pkey_id;
|
|
652
674
|
size_t keylen;
|
|
653
675
|
|
|
654
|
-
StringValue(type);
|
|
655
676
|
StringValue(key);
|
|
656
|
-
ameth = EVP_PKEY_asn1_find_str(NULL, RSTRING_PTR(type), RSTRING_LENINT(type));
|
|
657
|
-
if (!ameth)
|
|
658
|
-
ossl_raise(ePKeyError, "algorithm %"PRIsVALUE" not found", type);
|
|
659
|
-
EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, NULL, NULL, ameth);
|
|
660
|
-
|
|
661
677
|
keylen = RSTRING_LEN(key);
|
|
662
678
|
|
|
679
|
+
#ifdef OSSL_USE_PROVIDER
|
|
680
|
+
pkey = EVP_PKEY_new_raw_private_key_ex(NULL, StringValueCStr(type), NULL,
|
|
681
|
+
(unsigned char *)RSTRING_PTR(key),
|
|
682
|
+
keylen);
|
|
683
|
+
if (!pkey)
|
|
684
|
+
ossl_raise(ePKeyError, "EVP_PKEY_new_raw_private_key_ex");
|
|
685
|
+
#else
|
|
686
|
+
int pkey_id = lookup_pkey_type(type);
|
|
663
687
|
pkey = EVP_PKEY_new_raw_private_key(pkey_id, NULL, (unsigned char *)RSTRING_PTR(key), keylen);
|
|
664
688
|
if (!pkey)
|
|
665
689
|
ossl_raise(ePKeyError, "EVP_PKEY_new_raw_private_key");
|
|
690
|
+
#endif
|
|
666
691
|
|
|
667
692
|
return ossl_pkey_new(pkey);
|
|
668
693
|
}
|
|
@@ -680,22 +705,23 @@ static VALUE
|
|
|
680
705
|
ossl_pkey_new_raw_public_key(VALUE self, VALUE type, VALUE key)
|
|
681
706
|
{
|
|
682
707
|
EVP_PKEY *pkey;
|
|
683
|
-
const EVP_PKEY_ASN1_METHOD *ameth;
|
|
684
|
-
int pkey_id;
|
|
685
708
|
size_t keylen;
|
|
686
709
|
|
|
687
|
-
StringValue(type);
|
|
688
710
|
StringValue(key);
|
|
689
|
-
ameth = EVP_PKEY_asn1_find_str(NULL, RSTRING_PTR(type), RSTRING_LENINT(type));
|
|
690
|
-
if (!ameth)
|
|
691
|
-
ossl_raise(ePKeyError, "algorithm %"PRIsVALUE" not found", type);
|
|
692
|
-
EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, NULL, NULL, ameth);
|
|
693
|
-
|
|
694
711
|
keylen = RSTRING_LEN(key);
|
|
695
712
|
|
|
713
|
+
#ifdef OSSL_USE_PROVIDER
|
|
714
|
+
pkey = EVP_PKEY_new_raw_public_key_ex(NULL, StringValueCStr(type), NULL,
|
|
715
|
+
(unsigned char *)RSTRING_PTR(key),
|
|
716
|
+
keylen);
|
|
717
|
+
if (!pkey)
|
|
718
|
+
ossl_raise(ePKeyError, "EVP_PKEY_new_raw_public_key_ex");
|
|
719
|
+
#else
|
|
720
|
+
int pkey_id = lookup_pkey_type(type);
|
|
696
721
|
pkey = EVP_PKEY_new_raw_public_key(pkey_id, NULL, (unsigned char *)RSTRING_PTR(key), keylen);
|
|
697
722
|
if (!pkey)
|
|
698
723
|
ossl_raise(ePKeyError, "EVP_PKEY_new_raw_public_key");
|
|
724
|
+
#endif
|
|
699
725
|
|
|
700
726
|
return ossl_pkey_new(pkey);
|
|
701
727
|
}
|
|
@@ -715,6 +741,10 @@ ossl_pkey_oid(VALUE self)
|
|
|
715
741
|
|
|
716
742
|
GetPKey(self, pkey);
|
|
717
743
|
nid = EVP_PKEY_id(pkey);
|
|
744
|
+
#ifdef OSSL_USE_PROVIDER
|
|
745
|
+
if (nid == EVP_PKEY_KEYMGMT)
|
|
746
|
+
ossl_raise(ePKeyError, "EVP_PKEY_id");
|
|
747
|
+
#endif
|
|
718
748
|
return rb_str_new_cstr(OBJ_nid2sn(nid));
|
|
719
749
|
}
|
|
720
750
|
|
|
@@ -728,13 +758,23 @@ static VALUE
|
|
|
728
758
|
ossl_pkey_inspect(VALUE self)
|
|
729
759
|
{
|
|
730
760
|
EVP_PKEY *pkey;
|
|
731
|
-
int nid;
|
|
732
761
|
|
|
733
762
|
GetPKey(self, pkey);
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
763
|
+
VALUE str = rb_sprintf("#<%"PRIsVALUE":%p",
|
|
764
|
+
rb_obj_class(self), (void *)self);
|
|
765
|
+
int nid = EVP_PKEY_id(pkey);
|
|
766
|
+
#ifdef OSSL_USE_PROVIDER
|
|
767
|
+
if (nid != EVP_PKEY_KEYMGMT)
|
|
768
|
+
#endif
|
|
769
|
+
rb_str_catf(str, " oid=%s", OBJ_nid2sn(nid));
|
|
770
|
+
#ifdef OSSL_USE_PROVIDER
|
|
771
|
+
rb_str_catf(str, " type_name=%s", EVP_PKEY_get0_type_name(pkey));
|
|
772
|
+
const OSSL_PROVIDER *prov = EVP_PKEY_get0_provider(pkey);
|
|
773
|
+
if (prov)
|
|
774
|
+
rb_str_catf(str, " provider=%s", OSSL_PROVIDER_get0_name(prov));
|
|
775
|
+
#endif
|
|
776
|
+
rb_str_catf(str, ">");
|
|
777
|
+
return str;
|
|
738
778
|
}
|
|
739
779
|
|
|
740
780
|
/*
|
data/ext/openssl/ossl_provider.c
CHANGED
data/ext/openssl/ossl_ts.c
CHANGED
|
@@ -291,7 +291,7 @@ ossl_ts_req_get_msg_imprint(VALUE self)
|
|
|
291
291
|
mi = TS_REQ_get_msg_imprint(req);
|
|
292
292
|
hashed_msg = TS_MSG_IMPRINT_get_msg(mi);
|
|
293
293
|
|
|
294
|
-
ret =
|
|
294
|
+
ret = asn1str_to_str(hashed_msg);
|
|
295
295
|
|
|
296
296
|
return ret;
|
|
297
297
|
}
|
|
@@ -500,7 +500,7 @@ ossl_ts_req_to_der(VALUE self)
|
|
|
500
500
|
ossl_raise(eTimestampError, "Message imprint missing algorithm");
|
|
501
501
|
|
|
502
502
|
hashed_msg = TS_MSG_IMPRINT_get_msg(mi);
|
|
503
|
-
if (!hashed_msg
|
|
503
|
+
if (!ASN1_STRING_length(hashed_msg))
|
|
504
504
|
ossl_raise(eTimestampError, "Message imprint missing hashed message");
|
|
505
505
|
|
|
506
506
|
return asn1_to_der((void *)req, (int (*)(void *, unsigned char **))i2d_TS_REQ);
|
|
@@ -743,7 +743,7 @@ ossl_ts_resp_get_tsa_certificate(VALUE self)
|
|
|
743
743
|
TS_RESP *resp;
|
|
744
744
|
PKCS7 *p7;
|
|
745
745
|
PKCS7_SIGNER_INFO *ts_info;
|
|
746
|
-
X509 *cert;
|
|
746
|
+
const X509 *cert;
|
|
747
747
|
|
|
748
748
|
GetTSResponse(self, resp);
|
|
749
749
|
if (!(p7 = TS_RESP_get_token(resp)))
|
|
@@ -1006,7 +1006,7 @@ ossl_ts_token_info_get_msg_imprint(VALUE self)
|
|
|
1006
1006
|
GetTSTokenInfo(self, info);
|
|
1007
1007
|
mi = TS_TST_INFO_get_msg_imprint(info);
|
|
1008
1008
|
hashed_msg = TS_MSG_IMPRINT_get_msg(mi);
|
|
1009
|
-
ret =
|
|
1009
|
+
ret = asn1str_to_str(hashed_msg);
|
|
1010
1010
|
|
|
1011
1011
|
return ret;
|
|
1012
1012
|
}
|
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,7 +48,7 @@ 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;
|
|
@@ -57,7 +57,8 @@ ossl_x509attr_new(X509_ATTRIBUTE *attr)
|
|
|
57
57
|
if (!attr) {
|
|
58
58
|
new = X509_ATTRIBUTE_new();
|
|
59
59
|
} else {
|
|
60
|
-
|
|
60
|
+
/* OpenSSL 1.1.1 takes a non-const pointer */
|
|
61
|
+
new = X509_ATTRIBUTE_dup((X509_ATTRIBUTE *)attr);
|
|
61
62
|
}
|
|
62
63
|
if (!new) {
|
|
63
64
|
ossl_raise(eX509AttrError, NULL);
|
|
@@ -174,7 +175,7 @@ static VALUE
|
|
|
174
175
|
ossl_x509attr_get_oid(VALUE self)
|
|
175
176
|
{
|
|
176
177
|
X509_ATTRIBUTE *attr;
|
|
177
|
-
ASN1_OBJECT *oid;
|
|
178
|
+
const ASN1_OBJECT *oid;
|
|
178
179
|
BIO *out;
|
|
179
180
|
VALUE ret;
|
|
180
181
|
int nid;
|
|
@@ -186,7 +187,7 @@ ossl_x509attr_get_oid(VALUE self)
|
|
|
186
187
|
else{
|
|
187
188
|
if (!(out = BIO_new(BIO_s_mem())))
|
|
188
189
|
ossl_raise(eX509AttrError, NULL);
|
|
189
|
-
i2a_ASN1_OBJECT(out, oid);
|
|
190
|
+
i2a_ASN1_OBJECT(out, (ASN1_OBJECT *)oid);
|
|
190
191
|
ret = ossl_membio2str(out);
|
|
191
192
|
}
|
|
192
193
|
|
|
@@ -211,7 +212,7 @@ ossl_x509attr_set_value(VALUE self, VALUE value)
|
|
|
211
212
|
ossl_raise(eX509AttrError, "attribute value must be ASN1::Set");
|
|
212
213
|
|
|
213
214
|
if (X509_ATTRIBUTE_count(attr)) { /* populated, reset first */
|
|
214
|
-
ASN1_OBJECT *obj = X509_ATTRIBUTE_get0_object(attr);
|
|
215
|
+
const ASN1_OBJECT *obj = X509_ATTRIBUTE_get0_object(attr);
|
|
215
216
|
X509_ATTRIBUTE *new_attr = X509_ATTRIBUTE_create_by_OBJ(NULL, obj, 0, NULL, -1);
|
|
216
217
|
if (!new_attr) {
|
|
217
218
|
sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
|
|
@@ -255,7 +256,7 @@ ossl_x509attr_get_value(VALUE self)
|
|
|
255
256
|
|
|
256
257
|
count = X509_ATTRIBUTE_count(attr);
|
|
257
258
|
for (i = 0; i < count; i++)
|
|
258
|
-
|
|
259
|
+
sk_ASN1_TYPE_push(sk, (ASN1_TYPE *)X509_ATTRIBUTE_get0_type(attr, i));
|
|
259
260
|
|
|
260
261
|
if ((len = i2d_ASN1_SET_ANY(sk, NULL)) <= 0) {
|
|
261
262
|
sk_ASN1_TYPE_free(sk);
|
data/ext/openssl/ossl_x509cert.c
CHANGED
|
@@ -48,7 +48,7 @@ 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;
|
|
@@ -57,7 +57,8 @@ ossl_x509_new(X509 *x509)
|
|
|
57
57
|
if (!x509) {
|
|
58
58
|
new = X509_new();
|
|
59
59
|
} else {
|
|
60
|
-
|
|
60
|
+
/* OpenSSL 1.1.1 takes a non-const pointer */
|
|
61
|
+
new = X509_dup((X509 *)x509);
|
|
61
62
|
}
|
|
62
63
|
if (!new) {
|
|
63
64
|
ossl_raise(eX509CertError, NULL);
|
|
@@ -351,7 +352,7 @@ static VALUE
|
|
|
351
352
|
ossl_x509_get_subject(VALUE self)
|
|
352
353
|
{
|
|
353
354
|
X509 *x509;
|
|
354
|
-
X509_NAME *name;
|
|
355
|
+
const X509_NAME *name;
|
|
355
356
|
|
|
356
357
|
GetX509(self, x509);
|
|
357
358
|
if (!(name = X509_get_subject_name(x509))) { /* NO DUP - don't free! */
|
|
@@ -386,7 +387,7 @@ static VALUE
|
|
|
386
387
|
ossl_x509_get_issuer(VALUE self)
|
|
387
388
|
{
|
|
388
389
|
X509 *x509;
|
|
389
|
-
X509_NAME *name;
|
|
390
|
+
const X509_NAME *name;
|
|
390
391
|
|
|
391
392
|
GetX509(self, x509);
|
|
392
393
|
if(!(name = X509_get_issuer_name(x509))) { /* NO DUP - don't free! */
|
|
@@ -612,7 +613,6 @@ ossl_x509_get_extensions(VALUE self)
|
|
|
612
613
|
{
|
|
613
614
|
X509 *x509;
|
|
614
615
|
int count, i;
|
|
615
|
-
X509_EXTENSION *ext;
|
|
616
616
|
VALUE ary;
|
|
617
617
|
|
|
618
618
|
GetX509(self, x509);
|
|
@@ -622,7 +622,7 @@ ossl_x509_get_extensions(VALUE self)
|
|
|
622
622
|
}
|
|
623
623
|
ary = rb_ary_new2(count);
|
|
624
624
|
for (i=0; i<count; i++) {
|
|
625
|
-
ext = X509_get_ext(x509, i);
|
|
625
|
+
const X509_EXTENSION *ext = X509_get_ext(x509, i);
|
|
626
626
|
rb_ary_push(ary, ossl_x509ext_new(ext));
|
|
627
627
|
}
|
|
628
628
|
|
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 = crl ? X509_CRL_dup((X509_CRL *)crl) : X509_CRL_new();
|
|
68
69
|
if(!tmp) ossl_raise(eX509CRLError, NULL);
|
|
69
70
|
SetX509CRL(obj, tmp);
|
|
70
71
|
|
|
@@ -274,7 +275,7 @@ ossl_x509crl_get_revoked(VALUE self)
|
|
|
274
275
|
{
|
|
275
276
|
X509_CRL *crl;
|
|
276
277
|
int i, num;
|
|
277
|
-
X509_REVOKED *rev;
|
|
278
|
+
const X509_REVOKED *rev;
|
|
278
279
|
VALUE ary, revoked;
|
|
279
280
|
|
|
280
281
|
GetX509CRL(self, crl);
|
|
@@ -444,7 +445,6 @@ ossl_x509crl_get_extensions(VALUE self)
|
|
|
444
445
|
{
|
|
445
446
|
X509_CRL *crl;
|
|
446
447
|
int count, i;
|
|
447
|
-
X509_EXTENSION *ext;
|
|
448
448
|
VALUE ary;
|
|
449
449
|
|
|
450
450
|
GetX509CRL(self, crl);
|
|
@@ -455,7 +455,7 @@ ossl_x509crl_get_extensions(VALUE self)
|
|
|
455
455
|
}
|
|
456
456
|
ary = rb_ary_new2(count);
|
|
457
457
|
for (i=0; i<count; i++) {
|
|
458
|
-
ext = X509_CRL_get_ext(crl, i);
|
|
458
|
+
const X509_EXTENSION *ext = X509_CRL_get_ext(crl, i);
|
|
459
459
|
rb_ary_push(ary, ossl_x509ext_new(ext));
|
|
460
460
|
}
|
|
461
461
|
|
data/ext/openssl/ossl_x509ext.c
CHANGED
|
@@ -62,7 +62,7 @@ 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;
|
|
@@ -71,7 +71,8 @@ ossl_x509ext_new(X509_EXTENSION *ext)
|
|
|
71
71
|
if (!ext) {
|
|
72
72
|
new = X509_EXTENSION_new();
|
|
73
73
|
} else {
|
|
74
|
-
|
|
74
|
+
/* OpenSSL 1.1.1 takes a non-const pointer */
|
|
75
|
+
new = X509_EXTENSION_dup((X509_EXTENSION *)ext);
|
|
75
76
|
}
|
|
76
77
|
if (!new) {
|
|
77
78
|
ossl_raise(eX509ExtError, NULL);
|
|
@@ -346,12 +347,20 @@ ossl_x509ext_set_value(VALUE self, VALUE data)
|
|
|
346
347
|
GetX509Ext(self, ext);
|
|
347
348
|
data = ossl_to_der_if_possible(data);
|
|
348
349
|
StringValue(data);
|
|
349
|
-
asn1s = X509_EXTENSION_get_data(ext);
|
|
350
350
|
|
|
351
|
+
asn1s = ASN1_OCTET_STRING_new();
|
|
352
|
+
if (!asn1s)
|
|
353
|
+
ossl_raise(eX509ExtError, "ASN1_OCTET_STRING_new");
|
|
351
354
|
if (!ASN1_OCTET_STRING_set(asn1s, (unsigned char *)RSTRING_PTR(data),
|
|
352
|
-
|
|
353
|
-
|
|
355
|
+
RSTRING_LENINT(data))) {
|
|
356
|
+
ASN1_OCTET_STRING_free(asn1s);
|
|
357
|
+
ossl_raise(eX509ExtError, "ASN1_OCTET_STRING_set");
|
|
354
358
|
}
|
|
359
|
+
if (!X509_EXTENSION_set_data(ext, asn1s)) {
|
|
360
|
+
ASN1_OCTET_STRING_free(asn1s);
|
|
361
|
+
ossl_raise(eX509ExtError, "X509_EXTENSION_set_data");
|
|
362
|
+
}
|
|
363
|
+
ASN1_OCTET_STRING_free(asn1s);
|
|
355
364
|
|
|
356
365
|
return data;
|
|
357
366
|
}
|
|
@@ -371,7 +380,7 @@ static VALUE
|
|
|
371
380
|
ossl_x509ext_get_oid(VALUE obj)
|
|
372
381
|
{
|
|
373
382
|
X509_EXTENSION *ext;
|
|
374
|
-
ASN1_OBJECT *extobj;
|
|
383
|
+
const ASN1_OBJECT *extobj;
|
|
375
384
|
BIO *out;
|
|
376
385
|
VALUE ret;
|
|
377
386
|
int nid;
|
|
@@ -383,7 +392,7 @@ ossl_x509ext_get_oid(VALUE obj)
|
|
|
383
392
|
else{
|
|
384
393
|
if (!(out = BIO_new(BIO_s_mem())))
|
|
385
394
|
ossl_raise(eX509ExtError, NULL);
|
|
386
|
-
i2a_ASN1_OBJECT(out, extobj);
|
|
395
|
+
i2a_ASN1_OBJECT(out, (ASN1_OBJECT *)extobj);
|
|
387
396
|
ret = ossl_membio2str(out);
|
|
388
397
|
}
|
|
389
398
|
|
|
@@ -411,13 +420,13 @@ static VALUE
|
|
|
411
420
|
ossl_x509ext_get_value_der(VALUE obj)
|
|
412
421
|
{
|
|
413
422
|
X509_EXTENSION *ext;
|
|
414
|
-
ASN1_OCTET_STRING *value;
|
|
423
|
+
const ASN1_OCTET_STRING *value;
|
|
415
424
|
|
|
416
425
|
GetX509Ext(obj, ext);
|
|
417
426
|
if ((value = X509_EXTENSION_get_data(ext)) == NULL)
|
|
418
427
|
ossl_raise(eX509ExtError, NULL);
|
|
419
428
|
|
|
420
|
-
return
|
|
429
|
+
return asn1str_to_str(value);
|
|
421
430
|
}
|
|
422
431
|
|
|
423
432
|
static VALUE
|
data/ext/openssl/ossl_x509name.c
CHANGED
|
@@ -53,7 +53,7 @@ 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;
|
|
@@ -62,7 +62,8 @@ ossl_x509name_new(X509_NAME *name)
|
|
|
62
62
|
if (!name) {
|
|
63
63
|
new = X509_NAME_new();
|
|
64
64
|
} else {
|
|
65
|
-
|
|
65
|
+
/* OpenSSL 1.1.1 takes a non-const pointer */
|
|
66
|
+
new = X509_NAME_dup((X509_NAME *)name);
|
|
66
67
|
}
|
|
67
68
|
if (!new) {
|
|
68
69
|
ossl_raise(eX509NameError, NULL);
|
|
@@ -360,7 +361,7 @@ ossl_x509name_to_a(VALUE self)
|
|
|
360
361
|
}
|
|
361
362
|
ret = rb_ary_new2(entries);
|
|
362
363
|
for (i=0; i<entries; i++) {
|
|
363
|
-
if (!(entry = X509_NAME_get_entry(name, i))) {
|
|
364
|
+
if (!(entry = (X509_NAME_ENTRY *)X509_NAME_get_entry(name, i))) {
|
|
364
365
|
ossl_raise(eX509NameError, NULL);
|
|
365
366
|
}
|
|
366
367
|
if (!i2t_ASN1_OBJECT(long_name, sizeof(long_name),
|
|
@@ -374,8 +375,9 @@ ossl_x509name_to_a(VALUE self)
|
|
|
374
375
|
short_name = OBJ_nid2sn(nid);
|
|
375
376
|
vname = rb_str_new2(short_name); /*do not free*/
|
|
376
377
|
}
|
|
377
|
-
value = X509_NAME_ENTRY_get_data(entry);
|
|
378
|
-
ary = rb_ary_new3(3, vname, asn1str_to_str(value),
|
|
378
|
+
value = (ASN1_STRING *)X509_NAME_ENTRY_get_data(entry);
|
|
379
|
+
ary = rb_ary_new3(3, vname, asn1str_to_str(value),
|
|
380
|
+
INT2NUM(ASN1_STRING_type(value)));
|
|
379
381
|
rb_ary_push(ret, ary);
|
|
380
382
|
}
|
|
381
383
|
return ret;
|
data/ext/openssl/ossl_x509req.c
CHANGED
|
@@ -230,7 +230,7 @@ static VALUE
|
|
|
230
230
|
ossl_x509req_get_subject(VALUE self)
|
|
231
231
|
{
|
|
232
232
|
X509_REQ *req;
|
|
233
|
-
X509_NAME *name;
|
|
233
|
+
const X509_NAME *name;
|
|
234
234
|
|
|
235
235
|
GetX509Req(self, req);
|
|
236
236
|
if (!(name = X509_REQ_get_subject_name(req))) { /* NO DUP - don't free */
|
|
@@ -352,7 +352,7 @@ ossl_x509req_get_attributes(VALUE self)
|
|
|
352
352
|
{
|
|
353
353
|
X509_REQ *req;
|
|
354
354
|
int count, i;
|
|
355
|
-
X509_ATTRIBUTE *attr;
|
|
355
|
+
const X509_ATTRIBUTE *attr;
|
|
356
356
|
VALUE ary;
|
|
357
357
|
|
|
358
358
|
GetX509Req(self, req);
|
|
@@ -48,7 +48,7 @@ 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;
|
|
@@ -57,7 +57,8 @@ ossl_x509revoked_new(X509_REVOKED *rev)
|
|
|
57
57
|
if (!rev) {
|
|
58
58
|
new = X509_REVOKED_new();
|
|
59
59
|
} else {
|
|
60
|
-
|
|
60
|
+
/* OpenSSL 1.1.1 takes a non-const pointer */
|
|
61
|
+
new = X509_REVOKED_dup((X509_REVOKED *)rev);
|
|
61
62
|
}
|
|
62
63
|
if (!new) {
|
|
63
64
|
ossl_raise(eX509RevError, NULL);
|
|
@@ -189,7 +190,7 @@ ossl_x509revoked_get_extensions(VALUE self)
|
|
|
189
190
|
{
|
|
190
191
|
X509_REVOKED *rev;
|
|
191
192
|
int count, i;
|
|
192
|
-
X509_EXTENSION *ext;
|
|
193
|
+
const X509_EXTENSION *ext;
|
|
193
194
|
VALUE ary;
|
|
194
195
|
|
|
195
196
|
GetX509Rev(self, rev);
|
|
@@ -529,10 +529,8 @@ static void
|
|
|
529
529
|
ossl_x509stctx_free(void *ptr)
|
|
530
530
|
{
|
|
531
531
|
X509_STORE_CTX *ctx = ptr;
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
if (X509_STORE_CTX_get0_cert(ctx))
|
|
535
|
-
X509_free(X509_STORE_CTX_get0_cert(ctx));
|
|
532
|
+
sk_X509_pop_free(X509_STORE_CTX_get0_untrusted(ctx), X509_free);
|
|
533
|
+
X509_free((X509 *)X509_STORE_CTX_get0_cert(ctx));
|
|
536
534
|
X509_STORE_CTX_free(ctx);
|
|
537
535
|
}
|
|
538
536
|
|
|
@@ -770,7 +768,7 @@ static VALUE
|
|
|
770
768
|
ossl_x509stctx_get_curr_crl(VALUE self)
|
|
771
769
|
{
|
|
772
770
|
X509_STORE_CTX *ctx;
|
|
773
|
-
X509_CRL *crl;
|
|
771
|
+
const X509_CRL *crl;
|
|
774
772
|
|
|
775
773
|
GetX509StCtx(self, ctx);
|
|
776
774
|
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: 3.3.
|
|
4
|
+
version: 3.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martin Bosslet
|
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
120
120
|
- !ruby/object:Gem::Version
|
|
121
121
|
version: '0'
|
|
122
122
|
requirements: []
|
|
123
|
-
rubygems_version:
|
|
123
|
+
rubygems_version: 4.0.10
|
|
124
124
|
specification_version: 4
|
|
125
125
|
summary: SSL/TLS and general-purpose cryptography for Ruby
|
|
126
126
|
test_files: []
|