Raise specialized WolfCryptApiError for failed API calls.#110
Merged
dgarske merged 3 commits intoMay 8, 2026
Merged
Conversation
This exception takes the return value and converts that to a human-readable string (if error string support is compiled in.) The specialized exception is derived from WolfCryptError meaning that existing users will not notice the difference except for the nicer description.
JeremiahM37
reviewed
Apr 28, 2026
Contributor
JeremiahM37
left a comment
There was a problem hiding this comment.
Skoll Code Review
Scan type: review
Overall recommendation: COMMENT
Findings: 6 total — 3 posted, 3 skipped
2 finding(s) posted as inline comments (see file-level comments below)
Posted findings
- [Medium] Inconsistent conversion in ECC
decode_key: only one of two adjacent size checks was migrated —wolfcrypt/ciphers.py:1267-1272 - [Medium] WolfCryptApiError fed non-error-code values (sizes, lengths) — produces misleading messages —
wolfcrypt/ciphers.py:741,904,1269; wolfcrypt/asn.py:56-62 - [Medium] Bug exposure:
RsaPrivate.make_keypasses wrong variable as err_code —wolfcrypt/ciphers.py:874
Skipped findings
- [Medium]
No tests for the newWolfCryptApiErrorclass - [Low]
Behavioral change in_Hmac._init: error condition narrowed from!= 0to< 0 - [Low]
Inconsistent conversion inasn.py:make_signatureandhash_oid_from_classleft as WolfCryptError
Review generated by Skoll
If the size return value is negative, an error is detected. In that case raise an exception. Even though a zero is not a valid size value, it would indicate success in other cases. But a 0 return value would not make much sense as a return value for this function.
dgarske
approved these changes
May 8, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This exception takes the return value and converts that to a human-readable string (if error string support is compiled in.)
The specialized exception is derived from WolfCryptError meaning that existing users will not notice the difference except for the nicer description.