openssl 3.2.3 → 3.2.4
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 +10 -0
- data/ext/openssl/extconf.rb +5 -8
- 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 +43 -38
- 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: d06c3d1d14d9de4a0616845210c849da50df3230776a679bb7487344cd175091
|
|
4
|
+
data.tar.gz: 4ffac6e8ceb9d6fa799d54d7f09c9884932f1c0df95580a759df722075841966
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e0e8cce66598e322b6986c0ca44e997653db0ae2bd60a6f8cb009b463da60019bfa429674102738f8924c4d1e5c4045a54d223a657ff4dcf7d10213b6f9cf55
|
|
7
|
+
data.tar.gz: cc3e123d99c469f5b9c97fd4f238806c51a1c8b4a4e8673ae167eb6d1c2ed2e5d9d64636aa3cd68534e7ccf25ac7648613f62b92561ed330cdfc608a39720349
|
data/History.md
CHANGED
data/ext/openssl/extconf.rb
CHANGED
|
@@ -13,14 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
require "mkmf"
|
|
15
15
|
|
|
16
|
-
ssl_dirs =
|
|
17
|
-
if defined?(::TruffleRuby)
|
|
18
|
-
# Always respect the openssl prefix chosen by truffle/openssl-prefix
|
|
19
|
-
require 'truffle/openssl-prefix'
|
|
20
|
-
ssl_dirs = dir_config("openssl", ENV["OPENSSL_PREFIX"])
|
|
21
|
-
else
|
|
22
|
-
ssl_dirs = dir_config("openssl")
|
|
23
|
-
end
|
|
16
|
+
ssl_dirs = dir_config("openssl")
|
|
24
17
|
dir_config_given = ssl_dirs.any?
|
|
25
18
|
|
|
26
19
|
_, ssl_ldir = ssl_dirs
|
|
@@ -193,6 +186,7 @@ have_func("TS_VERIFY_CTX_add_flags(NULL, 0)", ts_h)
|
|
|
193
186
|
have_func("TS_RESP_CTX_set_time_cb(NULL, NULL, NULL)", ts_h)
|
|
194
187
|
have_func("EVP_PBE_scrypt(\"\", 0, (unsigned char *)\"\", 0, 0, 0, 0, 0, NULL, 0)", evp_h)
|
|
195
188
|
have_func("SSL_CTX_set_post_handshake_auth(NULL, 0)", ssl_h)
|
|
189
|
+
have_func("ASN1_STRING_get0_data(NULL)", "openssl/asn1.h")
|
|
196
190
|
|
|
197
191
|
# added in 1.1.1
|
|
198
192
|
have_func("EVP_PKEY_check(NULL)", evp_h)
|
|
@@ -210,6 +204,9 @@ have_func("EVP_MD_CTX_get_pkey_ctx(NULL)", evp_h)
|
|
|
210
204
|
have_func("EVP_PKEY_eq(NULL, NULL)", evp_h)
|
|
211
205
|
have_func("EVP_PKEY_dup(NULL)", evp_h)
|
|
212
206
|
|
|
207
|
+
# added in 4.0.0
|
|
208
|
+
have_func("ASN1_BIT_STRING_set1(NULL, NULL, 0, 0)", "openssl/asn1.h")
|
|
209
|
+
|
|
213
210
|
Logging::message "=== Checking done. ===\n"
|
|
214
211
|
|
|
215
212
|
# 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
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
|
|
65
65
|
#if OSSL_OPENSSL_PREREQ(3, 0, 0)
|
|
66
66
|
# define OSSL_USE_PROVIDER
|
|
67
|
+
# include <openssl/provider.h>
|
|
67
68
|
#endif
|
|
68
69
|
|
|
69
70
|
/*
|
|
@@ -119,7 +120,7 @@ do{\
|
|
|
119
120
|
* Convert binary string to hex string. The caller is responsible for
|
|
120
121
|
* ensuring out has (2 * len) bytes of capacity.
|
|
121
122
|
*/
|
|
122
|
-
void ossl_bin2hex(unsigned char *in, char *out, size_t len);
|
|
123
|
+
void ossl_bin2hex(const unsigned char *in, char *out, size_t len);
|
|
123
124
|
|
|
124
125
|
/*
|
|
125
126
|
* Our default PEM callback
|
data/ext/openssl/ossl_asn1.c
CHANGED
|
@@ -17,17 +17,18 @@ static VALUE ossl_asn1_initialize(int argc, VALUE *argv, VALUE self);
|
|
|
17
17
|
* DATE conversion
|
|
18
18
|
*/
|
|
19
19
|
VALUE
|
|
20
|
-
asn1time_to_time(const ASN1_TIME *
|
|
20
|
+
asn1time_to_time(const ASN1_TIME *time_)
|
|
21
21
|
{
|
|
22
|
+
ASN1_TIME *time = (ASN1_TIME *)time_; // const cast for OpenSSL 1.0.2
|
|
22
23
|
struct tm tm;
|
|
23
24
|
VALUE argv[6];
|
|
24
25
|
int count;
|
|
25
26
|
|
|
26
27
|
memset(&tm, 0, sizeof(struct tm));
|
|
27
28
|
|
|
28
|
-
switch (time
|
|
29
|
+
switch (ASN1_STRING_type(time)) {
|
|
29
30
|
case V_ASN1_UTCTIME:
|
|
30
|
-
count = sscanf((const char *)time
|
|
31
|
+
count = sscanf((const char *)ASN1_STRING_get0_data(time), "%2d%2d%2d%2d%2d%2dZ",
|
|
31
32
|
&tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min,
|
|
32
33
|
&tm.tm_sec);
|
|
33
34
|
|
|
@@ -35,7 +36,7 @@ asn1time_to_time(const ASN1_TIME *time)
|
|
|
35
36
|
tm.tm_sec = 0;
|
|
36
37
|
} else if (count != 6) {
|
|
37
38
|
ossl_raise(rb_eTypeError, "bad UTCTIME format: \"%s\"",
|
|
38
|
-
time
|
|
39
|
+
ASN1_STRING_get0_data(time));
|
|
39
40
|
}
|
|
40
41
|
if (tm.tm_year < 69) {
|
|
41
42
|
tm.tm_year += 2000;
|
|
@@ -44,7 +45,7 @@ asn1time_to_time(const ASN1_TIME *time)
|
|
|
44
45
|
}
|
|
45
46
|
break;
|
|
46
47
|
case V_ASN1_GENERALIZEDTIME:
|
|
47
|
-
count = sscanf((const char *)time
|
|
48
|
+
count = sscanf((const char *)ASN1_STRING_get0_data(time), "%4d%2d%2d%2d%2d%2dZ",
|
|
48
49
|
&tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min,
|
|
49
50
|
&tm.tm_sec);
|
|
50
51
|
if (count == 5) {
|
|
@@ -52,7 +53,7 @@ asn1time_to_time(const ASN1_TIME *time)
|
|
|
52
53
|
}
|
|
53
54
|
else if (count != 6) {
|
|
54
55
|
ossl_raise(rb_eTypeError, "bad GENERALIZEDTIME format: \"%s\"",
|
|
55
|
-
time
|
|
56
|
+
ASN1_STRING_get0_data(time));
|
|
56
57
|
}
|
|
57
58
|
break;
|
|
58
59
|
default:
|
|
@@ -97,7 +98,8 @@ ossl_time_split(VALUE time, time_t *sec, int *days)
|
|
|
97
98
|
VALUE
|
|
98
99
|
asn1str_to_str(const ASN1_STRING *str)
|
|
99
100
|
{
|
|
100
|
-
return rb_str_new((const char *)str
|
|
101
|
+
return rb_str_new((const char *)ASN1_STRING_get0_data(str),
|
|
102
|
+
ASN1_STRING_length(str));
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
/*
|
|
@@ -112,9 +114,9 @@ asn1integer_to_num(const ASN1_INTEGER *ai)
|
|
|
112
114
|
if (!ai) {
|
|
113
115
|
ossl_raise(rb_eTypeError, "ASN1_INTEGER is NULL!");
|
|
114
116
|
}
|
|
115
|
-
if (ai
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
if (ASN1_STRING_type((ASN1_STRING *)ai) == V_ASN1_ENUMERATED)
|
|
118
|
+
/* const_cast: workaround for old OpenSSL */
|
|
119
|
+
bn = ASN1_ENUMERATED_to_BN((ASN1_ENUMERATED *)ai, NULL);
|
|
118
120
|
else
|
|
119
121
|
bn = ASN1_INTEGER_to_BN(ai, NULL);
|
|
120
122
|
|
|
@@ -210,7 +212,7 @@ obj_to_asn1int(VALUE obj)
|
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
static ASN1_BIT_STRING*
|
|
213
|
-
obj_to_asn1bstr(VALUE obj,
|
|
215
|
+
obj_to_asn1bstr(VALUE obj, int unused_bits)
|
|
214
216
|
{
|
|
215
217
|
ASN1_BIT_STRING *bstr;
|
|
216
218
|
|
|
@@ -218,11 +220,11 @@ obj_to_asn1bstr(VALUE obj, long unused_bits)
|
|
|
218
220
|
ossl_raise(eASN1Error, "unused_bits for a bitstring value must be in "\
|
|
219
221
|
"the range 0 to 7");
|
|
220
222
|
StringValue(obj);
|
|
221
|
-
if(!(bstr = ASN1_BIT_STRING_new()))
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
223
|
+
if (!(bstr = ASN1_BIT_STRING_new()))
|
|
224
|
+
ossl_raise(eASN1Error, "ASN1_BIT_STRING_new");
|
|
225
|
+
if (!ASN1_BIT_STRING_set1(bstr, (uint8_t *)RSTRING_PTR(obj),
|
|
226
|
+
RSTRING_LEN(obj), unused_bits))
|
|
227
|
+
ossl_raise(eASN1Error, "ASN1_BIT_STRING_set1");
|
|
226
228
|
|
|
227
229
|
return bstr;
|
|
228
230
|
}
|
|
@@ -346,22 +348,25 @@ decode_int(unsigned char* der, long length)
|
|
|
346
348
|
}
|
|
347
349
|
|
|
348
350
|
static VALUE
|
|
349
|
-
decode_bstr(unsigned char* der, long length,
|
|
351
|
+
decode_bstr(unsigned char* der, long length, int *unused_bits)
|
|
350
352
|
{
|
|
351
353
|
ASN1_BIT_STRING *bstr;
|
|
352
354
|
const unsigned char *p;
|
|
353
|
-
|
|
355
|
+
size_t len;
|
|
354
356
|
VALUE ret;
|
|
357
|
+
int state;
|
|
355
358
|
|
|
356
359
|
p = der;
|
|
357
|
-
if(!(bstr = d2i_ASN1_BIT_STRING(NULL, &p, length)))
|
|
358
|
-
|
|
359
|
-
len
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
ret =
|
|
360
|
+
if (!(bstr = d2i_ASN1_BIT_STRING(NULL, &p, length)))
|
|
361
|
+
ossl_raise(eASN1Error, "d2i_ASN1_BIT_STRING");
|
|
362
|
+
if (!ASN1_BIT_STRING_get_length(bstr, &len, unused_bits)) {
|
|
363
|
+
ASN1_BIT_STRING_free(bstr);
|
|
364
|
+
ossl_raise(eASN1Error, "ASN1_BIT_STRING_get_length");
|
|
365
|
+
}
|
|
366
|
+
ret = ossl_str_new((const char *)ASN1_STRING_get0_data(bstr), len, &state);
|
|
364
367
|
ASN1_BIT_STRING_free(bstr);
|
|
368
|
+
if (state)
|
|
369
|
+
rb_jump_tag(state);
|
|
365
370
|
|
|
366
371
|
return ret;
|
|
367
372
|
}
|
|
@@ -746,7 +751,7 @@ int_ossl_asn1_decode0_prim(unsigned char **pp, long length, long hlen, int tag,
|
|
|
746
751
|
{
|
|
747
752
|
VALUE value, asn1data;
|
|
748
753
|
unsigned char *p;
|
|
749
|
-
|
|
754
|
+
int flag = 0;
|
|
750
755
|
|
|
751
756
|
p = *pp;
|
|
752
757
|
|
|
@@ -793,18 +798,18 @@ int_ossl_asn1_decode0_prim(unsigned char **pp, long length, long hlen, int tag,
|
|
|
793
798
|
*num_read = hlen + length;
|
|
794
799
|
|
|
795
800
|
if (tc == sym_UNIVERSAL &&
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
801
|
+
tag < ossl_asn1_info_size && ossl_asn1_info[tag].klass) {
|
|
802
|
+
VALUE klass = *ossl_asn1_info[tag].klass;
|
|
803
|
+
VALUE args[4];
|
|
804
|
+
args[0] = value;
|
|
805
|
+
args[1] = INT2NUM(tag);
|
|
806
|
+
args[2] = Qnil;
|
|
807
|
+
args[3] = tc;
|
|
808
|
+
asn1data = rb_obj_alloc(klass);
|
|
809
|
+
ossl_asn1_initialize(4, args, asn1data);
|
|
810
|
+
if(tag == V_ASN1_BIT_STRING){
|
|
811
|
+
rb_ivar_set(asn1data, sivUNUSED_BITS, INT2NUM(flag));
|
|
812
|
+
}
|
|
808
813
|
}
|
|
809
814
|
else {
|
|
810
815
|
asn1data = rb_obj_alloc(cASN1Data);
|
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
|
@@ -288,7 +288,7 @@ ossl_ts_req_get_msg_imprint(VALUE self)
|
|
|
288
288
|
mi = TS_REQ_get_msg_imprint(req);
|
|
289
289
|
hashed_msg = TS_MSG_IMPRINT_get_msg(mi);
|
|
290
290
|
|
|
291
|
-
ret =
|
|
291
|
+
ret = asn1str_to_str(hashed_msg);
|
|
292
292
|
|
|
293
293
|
return ret;
|
|
294
294
|
}
|
|
@@ -497,7 +497,7 @@ ossl_ts_req_to_der(VALUE self)
|
|
|
497
497
|
ossl_raise(eTimestampError, "Message imprint missing algorithm");
|
|
498
498
|
|
|
499
499
|
hashed_msg = TS_MSG_IMPRINT_get_msg(mi);
|
|
500
|
-
if (!hashed_msg
|
|
500
|
+
if (!ASN1_STRING_length(hashed_msg))
|
|
501
501
|
ossl_raise(eTimestampError, "Message imprint missing hashed message");
|
|
502
502
|
|
|
503
503
|
return asn1_to_der((void *)req, (int (*)(void *, unsigned char **))i2d_TS_REQ);
|
|
@@ -730,7 +730,7 @@ ossl_ts_resp_get_tsa_certificate(VALUE self)
|
|
|
730
730
|
TS_RESP *resp;
|
|
731
731
|
PKCS7 *p7;
|
|
732
732
|
PKCS7_SIGNER_INFO *ts_info;
|
|
733
|
-
X509 *cert;
|
|
733
|
+
const X509 *cert;
|
|
734
734
|
|
|
735
735
|
GetTSResponse(self, resp);
|
|
736
736
|
if (!(p7 = TS_RESP_get_token(resp)))
|
|
@@ -974,7 +974,7 @@ ossl_ts_token_info_get_msg_imprint(VALUE self)
|
|
|
974
974
|
GetTSTokenInfo(self, info);
|
|
975
975
|
mi = TS_TST_INFO_get_msg_imprint(info);
|
|
976
976
|
hashed_msg = TS_MSG_IMPRINT_get_msg(mi);
|
|
977
|
-
ret =
|
|
977
|
+
ret = asn1str_to_str(hashed_msg);
|
|
978
978
|
|
|
979
979
|
return ret;
|
|
980
980
|
}
|
data/ext/openssl/ossl_x509.h
CHANGED
|
@@ -30,7 +30,7 @@ void Init_ossl_x509(void);
|
|
|
30
30
|
extern VALUE cX509Attr;
|
|
31
31
|
extern VALUE eX509AttrError;
|
|
32
32
|
|
|
33
|
-
VALUE ossl_x509attr_new(X509_ATTRIBUTE *);
|
|
33
|
+
VALUE ossl_x509attr_new(const X509_ATTRIBUTE *);
|
|
34
34
|
X509_ATTRIBUTE *GetX509AttrPtr(VALUE);
|
|
35
35
|
void Init_ossl_x509attr(void);
|
|
36
36
|
|
|
@@ -40,7 +40,7 @@ void Init_ossl_x509attr(void);
|
|
|
40
40
|
extern VALUE cX509Cert;
|
|
41
41
|
extern VALUE eX509CertError;
|
|
42
42
|
|
|
43
|
-
VALUE ossl_x509_new(X509 *);
|
|
43
|
+
VALUE ossl_x509_new(const X509 *);
|
|
44
44
|
X509 *GetX509CertPtr(VALUE);
|
|
45
45
|
X509 *DupX509CertPtr(VALUE);
|
|
46
46
|
void Init_ossl_x509cert(void);
|
|
@@ -51,7 +51,7 @@ void Init_ossl_x509cert(void);
|
|
|
51
51
|
extern VALUE cX509CRL;
|
|
52
52
|
extern VALUE eX509CRLError;
|
|
53
53
|
|
|
54
|
-
VALUE ossl_x509crl_new(X509_CRL *);
|
|
54
|
+
VALUE ossl_x509crl_new(const X509_CRL *);
|
|
55
55
|
X509_CRL *GetX509CRLPtr(VALUE);
|
|
56
56
|
void Init_ossl_x509crl(void);
|
|
57
57
|
|
|
@@ -62,7 +62,7 @@ extern VALUE cX509Ext;
|
|
|
62
62
|
extern VALUE cX509ExtFactory;
|
|
63
63
|
extern VALUE eX509ExtError;
|
|
64
64
|
|
|
65
|
-
VALUE ossl_x509ext_new(X509_EXTENSION *);
|
|
65
|
+
VALUE ossl_x509ext_new(const X509_EXTENSION *);
|
|
66
66
|
X509_EXTENSION *GetX509ExtPtr(VALUE);
|
|
67
67
|
void Init_ossl_x509ext(void);
|
|
68
68
|
|
|
@@ -72,7 +72,7 @@ void Init_ossl_x509ext(void);
|
|
|
72
72
|
extern VALUE cX509Name;
|
|
73
73
|
extern VALUE eX509NameError;
|
|
74
74
|
|
|
75
|
-
VALUE ossl_x509name_new(X509_NAME *);
|
|
75
|
+
VALUE ossl_x509name_new(const X509_NAME *);
|
|
76
76
|
X509_NAME *GetX509NamePtr(VALUE);
|
|
77
77
|
void Init_ossl_x509name(void);
|
|
78
78
|
|
|
@@ -91,7 +91,7 @@ void Init_ossl_x509req(void);
|
|
|
91
91
|
extern VALUE cX509Rev;
|
|
92
92
|
extern VALUE eX509RevError;
|
|
93
93
|
|
|
94
|
-
VALUE ossl_x509revoked_new(X509_REVOKED *);
|
|
94
|
+
VALUE ossl_x509revoked_new(const X509_REVOKED *);
|
|
95
95
|
X509_REVOKED *DupX509RevokedPtr(VALUE);
|
|
96
96
|
void Init_ossl_x509revoked(void);
|
|
97
97
|
|
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
|
|
|
@@ -214,7 +215,7 @@ ossl_x509attr_set_value(VALUE self, VALUE value)
|
|
|
214
215
|
|
|
215
216
|
GetX509Attr(self, attr);
|
|
216
217
|
if (X509_ATTRIBUTE_count(attr)) { /* populated, reset first */
|
|
217
|
-
ASN1_OBJECT *obj = X509_ATTRIBUTE_get0_object(attr);
|
|
218
|
+
const ASN1_OBJECT *obj = X509_ATTRIBUTE_get0_object(attr);
|
|
218
219
|
X509_ATTRIBUTE *new_attr = X509_ATTRIBUTE_create_by_OBJ(NULL, obj, 0, NULL, -1);
|
|
219
220
|
if (!new_attr)
|
|
220
221
|
ossl_raise(eX509AttrError, NULL);
|
|
@@ -256,7 +257,7 @@ ossl_x509attr_get_value(VALUE self)
|
|
|
256
257
|
|
|
257
258
|
count = X509_ATTRIBUTE_count(attr);
|
|
258
259
|
for (i = 0; i < count; i++)
|
|
259
|
-
|
|
260
|
+
sk_ASN1_TYPE_push(sk, (ASN1_TYPE *)X509_ATTRIBUTE_get0_type(attr, i));
|
|
260
261
|
|
|
261
262
|
if ((len = i2d_ASN1_SET_ANY(sk, NULL)) <= 0) {
|
|
262
263
|
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! */
|
|
@@ -608,7 +609,6 @@ ossl_x509_get_extensions(VALUE self)
|
|
|
608
609
|
{
|
|
609
610
|
X509 *x509;
|
|
610
611
|
int count, i;
|
|
611
|
-
X509_EXTENSION *ext;
|
|
612
612
|
VALUE ary;
|
|
613
613
|
|
|
614
614
|
GetX509(self, x509);
|
|
@@ -618,7 +618,7 @@ ossl_x509_get_extensions(VALUE self)
|
|
|
618
618
|
}
|
|
619
619
|
ary = rb_ary_new2(count);
|
|
620
620
|
for (i=0; i<count; i++) {
|
|
621
|
-
ext = X509_get_ext(x509, i);
|
|
621
|
+
const X509_EXTENSION *ext = X509_get_ext(x509, i);
|
|
622
622
|
rb_ary_push(ary, ossl_x509ext_new(ext));
|
|
623
623
|
}
|
|
624
624
|
|
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);
|
|
@@ -440,7 +441,6 @@ ossl_x509crl_get_extensions(VALUE self)
|
|
|
440
441
|
{
|
|
441
442
|
X509_CRL *crl;
|
|
442
443
|
int count, i;
|
|
443
|
-
X509_EXTENSION *ext;
|
|
444
444
|
VALUE ary;
|
|
445
445
|
|
|
446
446
|
GetX509CRL(self, crl);
|
|
@@ -451,7 +451,7 @@ ossl_x509crl_get_extensions(VALUE self)
|
|
|
451
451
|
}
|
|
452
452
|
ary = rb_ary_new2(count);
|
|
453
453
|
for (i=0; i<count; i++) {
|
|
454
|
-
ext = X509_CRL_get_ext(crl, i);
|
|
454
|
+
const X509_EXTENSION *ext = X509_CRL_get_ext(crl, i);
|
|
455
455
|
rb_ary_push(ary, ossl_x509ext_new(ext));
|
|
456
456
|
}
|
|
457
457
|
|
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 */
|
|
@@ -348,7 +348,7 @@ ossl_x509req_get_attributes(VALUE self)
|
|
|
348
348
|
{
|
|
349
349
|
X509_REQ *req;
|
|
350
350
|
int count, i;
|
|
351
|
-
X509_ATTRIBUTE *attr;
|
|
351
|
+
const X509_ATTRIBUTE *attr;
|
|
352
352
|
VALUE ary;
|
|
353
353
|
|
|
354
354
|
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);
|
|
@@ -521,10 +521,8 @@ static void
|
|
|
521
521
|
ossl_x509stctx_free(void *ptr)
|
|
522
522
|
{
|
|
523
523
|
X509_STORE_CTX *ctx = ptr;
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
if (X509_STORE_CTX_get0_cert(ctx))
|
|
527
|
-
X509_free(X509_STORE_CTX_get0_cert(ctx));
|
|
524
|
+
sk_X509_pop_free(X509_STORE_CTX_get0_untrusted(ctx), X509_free);
|
|
525
|
+
X509_free((X509 *)X509_STORE_CTX_get0_cert(ctx));
|
|
528
526
|
X509_STORE_CTX_free(ctx);
|
|
529
527
|
}
|
|
530
528
|
|
|
@@ -765,7 +763,7 @@ static VALUE
|
|
|
765
763
|
ossl_x509stctx_get_curr_crl(VALUE self)
|
|
766
764
|
{
|
|
767
765
|
X509_STORE_CTX *ctx;
|
|
768
|
-
X509_CRL *crl;
|
|
766
|
+
const X509_CRL *crl;
|
|
769
767
|
|
|
770
768
|
GetX509StCtx(self, ctx);
|
|
771
769
|
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.2.
|
|
4
|
+
version: 3.2.4
|
|
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:
|
|
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: []
|