ruby / openssl

Provides SSL, TLS and general purpose cryptography.
Other
240 stars 167 forks source link

make bn shareable when frozen #808

Closed HoneyryderChuck closed 1 week ago

HoneyryderChuck commented 1 month ago

added frozen check on every state change.

rhenium commented 3 weeks ago

Could you make the part that changes #include <ruby/ractor.h> a separate commit or PR?

HoneyryderChuck commented 3 weeks ago

@rhenium done. I'll rebase it here once it's merged.

HoneyryderChuck commented 2 weeks ago

@rhenium done

HoneyryderChuck commented 1 week ago

initialize also needs a frozen check.

why and where? 🤔

added a test.

rhenium commented 1 week ago

ossl_bn_initialize() - it doesn't have a rb_check_frozen(self).

HoneyryderChuck commented 1 week ago

gotcha, added. One question though: is it worth it, considering that on intialize, the object isn't expected to be frozen? What would that guard against?

rhenium commented 1 week ago

It's needed because it's callable from Ruby, especially if the object is now expected to be thread safe when frozen. Whether calling #initialize on a frozen object makes sense or not doesn't matter.

rhenium commented 1 week ago

It looks good to me now. Thanks!