pyca / cryptography

cryptography is a package designed to expose cryptographic primitives and recipes to Python developers.
https://cryptography.io
Other
6.56k stars 1.51k forks source link

Releasing GIL in cryptographic operations #11585

Open JakubKahovec opened 1 week ago

JakubKahovec commented 1 week ago

I'd like to ask if GIL gets released when cryptographic operations are being performed as I can't find it in the code, i.e https://github.com/pyca/cryptography/blob/60913069bb27d788c57687840a8b1b54904e9139/src/rust/src/backend/kdf.rs#L10

alex commented 1 week ago

Not really. I thought we did for things like scrypt, but I don't see it, so I guess not. I'd be open to taking PRs for these though

On Wed, Sep 11, 2024, 9:19 AM Jakub Kahovec @.***> wrote:

I'd like to ask if GIL gets released when cryptographic operations are being performed as I can't find it in the code, i.e https://github.com/pyca/cryptography/blob/60913069bb27d788c57687840a8b1b54904e9139/src/rust/src/backend/kdf.rs#L10

— Reply to this email directly, view it on GitHub https://github.com/pyca/cryptography/issues/11585, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAGBA76QMRPU377PPVYV3ZWA7NLAVCNFSM6AAAAABOA6WQYWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGUYTSNZTGI3TCMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jkahovec commented 1 week ago

Ok, I was kind of puzzled by this comment
https://github.com/pyca/cryptography/issues/6896#issuecomment-1273808225

alex commented 1 week ago

That predates a lot of reactors, including moving to rust. Cffi used to implicitly drop the GIL during all calls to openssl

On Wed, Sep 11, 2024, 10:48 AM Jakub Kahovec @.***> wrote:

Ok, I was kind of puzzled by this comment

6896 (comment)

https://github.com/pyca/cryptography/issues/6896#issuecomment-1273808225

— Reply to this email directly, view it on GitHub https://github.com/pyca/cryptography/issues/11585#issuecomment-2343893256, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAGBBAWICSB3OOGVB5DELZWBJ2DAVCNFSM6AAAAABOA6WQYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBTHA4TGMRVGY . You are receiving this because you commented.Message ID: @.***>