-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-131316: handle NULL values returned by HACL* functions #131324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
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 😈) |
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.
…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
UPDATE
functions 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