Repository navigation
Fixes for native callback length checks, callback ByteBuffer docs, and dist packaging cleanup - #445
Conversation
…arger than the inline buffer
…ord before narrowing to unsigned int
…ntil the callback returns
|
@claude review |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #445
Scan targets checked: wolfssljni-src, wolfssljni-bugs
Not reviewed (no scan target covers them): Makefile
Coverage: 1 of 17 in-scope changed file(s) opened by the reviewer; not opened: native/com_wolfssl_WolfSSLSession.c, src/java/com/wolfssl/WolfSSLByteBufferIORecvCallback.java, src/java/com/wolfssl/WolfSSLByteBufferIOSendCallback.java, src/java/com/wolfssl/WolfSSLDecryptVerifyCallback.java, src/java/com/wolfssl/WolfSSLEccSharedSecretCallback.java, src/java/com/wolfssl/WolfSSLEccSignCallback.java, src/java/com/wolfssl/WolfSSLEccVerifyCallback.java, src/java/com/wolfssl/WolfSSLMacEncryptCallback.java, src/java/com/wolfssl/WolfSSLRsaDecCallback.java, src/java/com/wolfssl/WolfSSLRsaEncCallback.java and 6 more
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
There was a problem hiding this comment.
I reviewed this PR and didn't find any bugs. The new bounds checks are in JNI crypto callback paths whose output lengths and pointers go straight into wolfSSL, so a maintainer who knows those wolfSSL callback contracts should still take a look.
What was reviewed:
- The padSz checks in NativeDecryptVerifyCb and NativeVerifyDecryptCb. Values that are negative or larger than decSz are now rejected before the cast to unsigned int.
- The positive-return length checks against sigSz/inSz in the RSA verify, sign-check, PSS sign-check and decrypt callbacks. Each one runs before
*outis set, so an oversized return never reaches wolfSSL. - The Makefile dist cleanup of .o/.d files, the receive-callback comment fix, the ByteBuffer lifetime Javadoc, and the new oversized-return JUnit tests, including the pkCbHandshakeLoop change to also return the error code.
Extended reasoning...
The change adds input validation to the native JNI callbacks in com_wolfssl_WolfSSLContext.c, which are the paths where Java-supplied lengths and padding sizes go back into wolfSSL's TLS record and RSA handling. It also fixes a comment, tidies the dist target, adds Javadoc to 14 callback interfaces, and adds about 270 lines of handshake-based tests. Memory-safety checks in crypto callbacks are security-sensitive, so this is not a mechanical change to auto-approve, even though the checks look correct and are covered by tests. An earlier automated reviewer left a COMMENTED review whose content isn't visible here.
This PR includes 5 Fenrir fixes:
make distoutput.