openssl 2.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +35 -45
- data/History.md +426 -0
- data/README.md +38 -21
- data/ext/openssl/extconf.rb +132 -72
- data/ext/openssl/openssl_missing.c +0 -66
- data/ext/openssl/openssl_missing.h +62 -46
- data/ext/openssl/ossl.c +177 -252
- data/ext/openssl/ossl.h +39 -17
- data/ext/openssl/ossl_asn1.c +53 -14
- data/ext/openssl/ossl_bn.c +288 -146
- data/ext/openssl/ossl_bn.h +2 -1
- data/ext/openssl/ossl_cipher.c +42 -32
- data/ext/openssl/ossl_config.c +412 -41
- data/ext/openssl/ossl_config.h +4 -7
- data/ext/openssl/ossl_digest.c +32 -63
- data/ext/openssl/ossl_engine.c +19 -28
- data/ext/openssl/ossl_hmac.c +61 -146
- data/ext/openssl/ossl_kdf.c +15 -23
- data/ext/openssl/ossl_ns_spki.c +2 -2
- data/ext/openssl/ossl_ocsp.c +17 -70
- data/ext/openssl/ossl_ocsp.h +3 -3
- data/ext/openssl/ossl_pkcs12.c +23 -4
- data/ext/openssl/ossl_pkcs7.c +49 -81
- data/ext/openssl/ossl_pkcs7.h +16 -0
- data/ext/openssl/ossl_pkey.c +1508 -195
- data/ext/openssl/ossl_pkey.h +41 -78
- data/ext/openssl/ossl_pkey_dh.c +153 -348
- data/ext/openssl/ossl_pkey_dsa.c +157 -413
- data/ext/openssl/ossl_pkey_ec.c +257 -343
- data/ext/openssl/ossl_pkey_rsa.c +166 -490
- data/ext/openssl/ossl_provider.c +211 -0
- data/ext/openssl/ossl_provider.h +5 -0
- data/ext/openssl/ossl_rand.c +2 -40
- data/ext/openssl/ossl_ssl.c +666 -456
- data/ext/openssl/ossl_ssl_session.c +29 -30
- data/ext/openssl/ossl_ts.c +1539 -0
- data/ext/openssl/ossl_ts.h +16 -0
- data/ext/openssl/ossl_x509.c +86 -1
- data/ext/openssl/ossl_x509attr.c +1 -1
- data/ext/openssl/ossl_x509cert.c +170 -14
- data/ext/openssl/ossl_x509crl.c +14 -11
- data/ext/openssl/ossl_x509ext.c +29 -9
- data/ext/openssl/ossl_x509name.c +24 -12
- data/ext/openssl/ossl_x509req.c +14 -11
- data/ext/openssl/ossl_x509revoked.c +4 -4
- data/ext/openssl/ossl_x509store.c +205 -96
- data/lib/openssl/bn.rb +1 -1
- data/lib/openssl/buffering.rb +42 -20
- data/lib/openssl/cipher.rb +1 -1
- data/lib/openssl/digest.rb +10 -16
- data/lib/openssl/hmac.rb +78 -0
- data/lib/openssl/marshal.rb +30 -0
- data/lib/openssl/pkcs5.rb +1 -1
- data/lib/openssl/pkey.rb +447 -1
- data/lib/openssl/ssl.rb +68 -24
- data/lib/openssl/version.rb +5 -0
- data/lib/openssl/x509.rb +177 -1
- data/lib/openssl.rb +24 -9
- metadata +18 -71
- data/ext/openssl/deprecation.rb +0 -23
- data/ext/openssl/ossl_version.h +0 -15
- data/ext/openssl/ruby_missing.h +0 -24
- data/lib/openssl/config.rb +0 -474
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
#include "ossl.h"
|
6
6
|
|
7
|
+
#ifndef OPENSSL_NO_SOCK
|
7
8
|
VALUE cSSLSession;
|
8
9
|
static VALUE eSSLSession;
|
9
10
|
|
@@ -18,7 +19,7 @@ const rb_data_type_t ossl_ssl_session_type = {
|
|
18
19
|
{
|
19
20
|
0, ossl_ssl_session_free,
|
20
21
|
},
|
21
|
-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
22
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
|
22
23
|
};
|
23
24
|
|
24
25
|
static VALUE ossl_ssl_session_alloc(VALUE klass)
|
@@ -34,43 +35,38 @@ static VALUE ossl_ssl_session_alloc(VALUE klass)
|
|
34
35
|
* Creates a new Session object from an instance of SSLSocket or DER/PEM encoded
|
35
36
|
* String.
|
36
37
|
*/
|
37
|
-
static VALUE
|
38
|
+
static VALUE
|
39
|
+
ossl_ssl_session_initialize(VALUE self, VALUE arg1)
|
38
40
|
{
|
39
|
-
|
40
|
-
|
41
|
-
if (RDATA(self)->data)
|
42
|
-
ossl_raise(eSSLSession, "SSL Session already initialized");
|
43
|
-
|
44
|
-
if (rb_obj_is_instance_of(arg1, cSSLSocket)) {
|
45
|
-
SSL *ssl;
|
46
|
-
|
47
|
-
GetSSL(arg1, ssl);
|
48
|
-
|
49
|
-
if ((ctx = SSL_get1_session(ssl)) == NULL)
|
50
|
-
ossl_raise(eSSLSession, "no session available");
|
51
|
-
} else {
|
52
|
-
BIO *in = ossl_obj2bio(&arg1);
|
41
|
+
SSL_SESSION *ctx;
|
53
42
|
|
54
|
-
|
43
|
+
if (RTYPEDDATA_DATA(self))
|
44
|
+
ossl_raise(eSSLSession, "SSL Session already initialized");
|
55
45
|
|
56
|
-
|
57
|
-
|
58
|
-
ctx = d2i_SSL_SESSION_bio(in, NULL);
|
59
|
-
}
|
46
|
+
if (rb_obj_is_instance_of(arg1, cSSLSocket)) {
|
47
|
+
SSL *ssl;
|
60
48
|
|
61
|
-
|
49
|
+
GetSSL(arg1, ssl);
|
62
50
|
|
63
|
-
|
64
|
-
|
65
|
-
|
51
|
+
if ((ctx = SSL_get1_session(ssl)) == NULL)
|
52
|
+
ossl_raise(eSSLSession, "no session available");
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
BIO *in = ossl_obj2bio(&arg1);
|
66
56
|
|
67
|
-
|
68
|
-
|
69
|
-
|
57
|
+
ctx = d2i_SSL_SESSION_bio(in, NULL);
|
58
|
+
if (!ctx) {
|
59
|
+
OSSL_BIO_reset(in);
|
60
|
+
ctx = PEM_read_bio_SSL_SESSION(in, NULL, NULL, NULL);
|
61
|
+
}
|
62
|
+
BIO_free(in);
|
63
|
+
if (!ctx)
|
64
|
+
ossl_raise(rb_eArgError, "unknown type");
|
65
|
+
}
|
70
66
|
|
71
|
-
|
67
|
+
RTYPEDDATA_DATA(self) = ctx;
|
72
68
|
|
73
|
-
|
69
|
+
return self;
|
74
70
|
}
|
75
71
|
|
76
72
|
static VALUE
|
@@ -304,6 +300,7 @@ static VALUE ossl_ssl_session_to_text(VALUE self)
|
|
304
300
|
return ossl_membio2str(out);
|
305
301
|
}
|
306
302
|
|
303
|
+
#endif /* !defined(OPENSSL_NO_SOCK) */
|
307
304
|
|
308
305
|
void Init_ossl_ssl_session(void)
|
309
306
|
{
|
@@ -312,6 +309,7 @@ void Init_ossl_ssl_session(void)
|
|
312
309
|
mSSL = rb_define_module_under(mOSSL, "SSL");
|
313
310
|
eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError);
|
314
311
|
#endif
|
312
|
+
#ifndef OPENSSL_NO_SOCK
|
315
313
|
cSSLSession = rb_define_class_under(mSSL, "Session", rb_cObject);
|
316
314
|
eSSLSession = rb_define_class_under(cSSLSession, "SessionError", eOSSLError);
|
317
315
|
|
@@ -329,4 +327,5 @@ void Init_ossl_ssl_session(void)
|
|
329
327
|
rb_define_method(cSSLSession, "to_der", ossl_ssl_session_to_der, 0);
|
330
328
|
rb_define_method(cSSLSession, "to_pem", ossl_ssl_session_to_pem, 0);
|
331
329
|
rb_define_method(cSSLSession, "to_text", ossl_ssl_session_to_text, 0);
|
330
|
+
#endif /* !defined(OPENSSL_NO_SOCK) */
|
332
331
|
}
|