Uh oh!
There was an error while loading. Please reload this page.
gh-131316: handle NULL values returned by HACL* functions - #131324
Conversation
- Handle NULL returned by allocation functions. - Handle NULL returned by copy functions. - Suppress unused impossible return codes.
chris-eibl
commented
Mar 16, 2025
Most probably you've already found out: Py_ssize_t is only signed 32bit in 32bit platforms (same for Windows and Linux). |
Yeah... that's what I observed afterwards... so I just removed the assertion (can't fail if the assertion isn't here 😈) |
gpshead
commented
Mar 16, 2025
FWIW it is quite reasonable for these update loops to use a size lower than UINT32_MAX, by the time data gets that large the computation already takes a long time so just looping over 1-2gb chunks up to INT32_MAX to fit within our smallest signed size constraint is fine. |
…on#131324) - Handle NULL returned by allocation functions. - Handle NULL returned by copy functions. - Suppress unused impossible return codes.
In a follow-up PR I'd like to move all
UPDATEfunctions in a single helper. The construction is always the same and it would help the HMAC PR as well (I've done it out there).More generally, I'd like to have the same construction for MD5/SHA1/SHA2/SHA3 as they really share common code. I don't know how much I can change the code so that it looks better, which is why I didn't change anything here.
We had a discussion on the blake2 PR concerning the cosmetics of blake2module and I think we can definitely improve how it's currently structured, because the functions become quite ugly. But that'd be another issue.
cc @msprotz@chris-eibl