-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8367b16
commit cc4fd69
Showing
2 changed files
with
11 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,10 +10,6 @@ | |
/* modified by Michal Rokos <[email protected]> */ | ||
#include "ossl.h" | ||
|
||
#ifdef HAVE_RB_EXT_RACTOR_SAFE | ||
#include <ruby/ractor.h> | ||
#endif | ||
|
||
#define NewBN(klass) \ | ||
TypedData_Wrap_Struct((klass), &ossl_bn_type, 0) | ||
#define SetBN(obj, bn) do { \ | ||
|
@@ -41,7 +37,7 @@ static const rb_data_type_t ossl_bn_type = { | |
{ | ||
0, ossl_bn_free, | ||
}, | ||
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, | ||
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FROZEN_SHAREABLE, | ||
}; | ||
|
||
/* | ||
|
@@ -693,6 +689,7 @@ BIGNUM_3c(mod_exp) | |
ossl_bn_##func(VALUE self, VALUE bit) \ | ||
{ \ | ||
BIGNUM *bn; \ | ||
rb_check_frozen(self); \ | ||
GetBN(self, bn); \ | ||
if (BN_##func(bn, NUM2INT(bit)) <= 0) { \ | ||
ossl_raise(eBNError, NULL); \ | ||
|
@@ -748,6 +745,7 @@ ossl_bn_is_bit_set(VALUE self, VALUE bit) | |
BIGNUM *bn, *result; \ | ||
int b; \ | ||
VALUE obj; \ | ||
rb_check_frozen(self); \ | ||
b = NUM2INT(bits); \ | ||
GetBN(self, bn); \ | ||
obj = NewBN(rb_obj_class(self)); \ | ||
|
@@ -782,6 +780,7 @@ BIGNUM_SHIFT(rshift) | |
{ \ | ||
BIGNUM *bn; \ | ||
int b; \ | ||
rb_check_frozen(self); \ | ||
b = NUM2INT(bits); \ | ||
GetBN(self, bn); \ | ||
if (BN_##func(bn, bn, b) <= 0) \ | ||
|
@@ -1191,6 +1190,7 @@ ossl_bn_set_flags(VALUE self, VALUE arg) | |
BIGNUM *bn; | ||
GetBN(self, bn); | ||
|
||
rb_check_frozen(self); | ||
BN_set_flags(bn, NUM2INT(arg)); | ||
return Qnil; | ||
} | ||
|