Skip to content

Commit cfa7645

Browse files
authored
Merge pull request #1112 from luke-gruber/ssl_context_thread_safe_free
Make ossl_sslctx_type RUBY_TYPED_THREAD_SAFE_FREE
2 parents d8865a9 + e481c64 commit cfa7645

26 files changed

Lines changed: 43 additions & 40 deletions

‎ext/openssl/ossl.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
#else
2323
#define RUBY_TYPED_FROZEN_SHAREABLE 0
2424
#endif
25+
#if !defined(RUBY_TYPED_THREAD_SAFE_FREE)
26+
#define RUBY_TYPED_THREAD_SAFE_FREE RUBY_TYPED_FREE_IMMEDIATELY
27+
#endif
2528

2629
#include <openssl/opensslv.h>
2730

‎ext/openssl/ossl_bn.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static const rb_data_type_t ossl_bn_type = {
3737
{
3838
0, ossl_bn_free,
3939
},
40-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FROZEN_SHAREABLE,
40+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FROZEN_SHAREABLE,
4141
};
4242

4343
/*

‎ext/openssl/ossl_cipher.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static const rb_data_type_t ossl_cipher_type = {
4040
{
4141
0, ossl_cipher_free,
4242
},
43-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
43+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED,
4444
};
4545

4646
#ifdef OSSL_USE_PROVIDER
@@ -57,7 +57,7 @@ static const rb_data_type_t ossl_evp_cipher_holder_type = {
5757
{
5858
.dfree = ossl_evp_cipher_free,
5959
},
60-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
60+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED,
6161
};
6262
#endif
6363

‎ext/openssl/ossl_config.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static const rb_data_type_t ossl_config_type = {
2222
{
2323
0, nconf_free,
2424
},
25-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FROZEN_SHAREABLE,
25+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FROZEN_SHAREABLE,
2626
};
2727

2828
CONF *

‎ext/openssl/ossl_digest.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static const rb_data_type_t ossl_digest_type = {
3636
{
3737
0, ossl_digest_free,
3838
},
39-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
39+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED,
4040
};
4141

4242
#ifdef OSSL_USE_PROVIDER
@@ -53,7 +53,7 @@ static const rb_data_type_t ossl_evp_md_holder_type = {
5353
{
5454
.dfree = ossl_evp_md_free,
5555
},
56-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
56+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED,
5757
};
5858
#endif
5959

‎ext/openssl/ossl_engine.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static const rb_data_type_t ossl_engine_type = {
6868
{
6969
0, ossl_engine_free,
7070
},
71-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
71+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED,
7272
};
7373

7474
/*

‎ext/openssl/ossl_hmac.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static const rb_data_type_t ossl_hmac_type = {
4343
{
4444
0, ossl_hmac_free,
4545
},
46-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
46+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED,
4747
};
4848

4949
static VALUE

‎ext/openssl/ossl_hpke.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static const rb_data_type_t ossl_hpke_ctx_type = {
7878
{
7979
0, ossl_hpke_ctx_free,
8080
},
81-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
81+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED,
8282
};
8383

8484
#define GetHpkeSuite(obj, suite) do {\
@@ -105,7 +105,7 @@ static const rb_data_type_t ossl_hpke_suite_type = {
105105
{
106106
0, ossl_hpke_suite_free, ossl_hpke_suite_memsize,
107107
},
108-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
108+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED,
109109
};
110110

111111
/*

‎ext/openssl/ossl_ns_spki.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static const rb_data_type_t ossl_netscape_spki_type = {
4242
{
4343
0, ossl_netscape_spki_free,
4444
},
45-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
45+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED,
4646
};
4747

4848
static VALUE

‎ext/openssl/ossl_ocsp.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static const rb_data_type_t ossl_ocsp_request_type = {
5252
{
5353
0, ossl_ocsp_request_free,
5454
},
55-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
55+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED,
5656
};
5757

5858
static void
@@ -66,7 +66,7 @@ static const rb_data_type_t ossl_ocsp_response_type = {
6666
{
6767
0, ossl_ocsp_response_free,
6868
},
69-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
69+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED,
7070
};
7171

7272
static void
@@ -80,7 +80,7 @@ static const rb_data_type_t ossl_ocsp_basicresp_type = {
8080
{
8181
0, ossl_ocsp_basicresp_free,
8282
},
83-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
83+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED,
8484
};
8585

8686
static void
@@ -94,7 +94,7 @@ static const rb_data_type_t ossl_ocsp_singleresp_type = {
9494
{
9595
0, ossl_ocsp_singleresp_free,
9696
},
97-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
97+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED,
9898
};
9999

100100
static void
@@ -108,7 +108,7 @@ static const rb_data_type_t ossl_ocsp_certid_type = {
108108
{
109109
0, ossl_ocsp_certid_free,
110110
},
111-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
111+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED,
112112
};
113113

114114
/*

0 commit comments

Comments
 (0)