Uh oh!
There was an error while loading. Please reload this page.
memory.c: add wc_ConstantCompare wrapper. - #10867
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new public wolfCrypt API wrapper wc_ConstantCompare() (patterned after the existing wc_ForceZero() wrapper) and updates Linux kernel module glue code to prefer the public wc_ wrappers over internal ForceZero() / ConstantCompare().
Changes:
- Add public
wc_ConstantCompare()declaration towolfssl/wolfcrypt/memory.h. - Implement
wc_ConstantCompare()inwolfcrypt/src/memory.cas a thin wrapper aroundConstantCompare(). - Update several
linuxkm/*_glue.ccall sites to usewc_ForceZero()andwc_ConstantCompare().
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfssl/wolfcrypt/memory.h | Exposes new public wc_ConstantCompare() API (guarded by WOLFSSL_NO_CONST_CMP). |
| wolfcrypt/src/memory.c | Implements wc_ConstantCompare() wrapper calling ConstantCompare(). |
| linuxkm/lkcapi_sha_glue.c | Switches sensitive-buffer clearing to wc_ForceZero(). |
| linuxkm/lkcapi_rsa_glue.c | Switches buffer clearing to wc_ForceZero() and signature comparisons to wc_ConstantCompare(). |
| linuxkm/lkcapi_ecdh_glue.c | Switches shared-secret clearing to wc_ForceZero(). |
| linuxkm/lkcapi_dh_glue.c | Switches key/shared-secret clearing to wc_ForceZero(). |
| linuxkm/lkcapi_aes_glue.c | Switches temp buffer clearing to wc_ForceZero(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
philljj
commented
Jul 9, 2026
No Malloc Tests failure will be fixed here: |
douzzer
left a comment
There was a problem hiding this comment.
We want the fast inline version, ForceZero, in the linuxkm glue layer -- it's faster and avoids some a little stack burden.
Retest this please ("fatal: early EOF". Network disruption or something.) |
Description
Add a public
wc_ConstantComparewrapper, similar to the existingwc_ForceZerowrapper. Other project integrations regularly reuse wc_ForceZero, but then reimplement their own ConstantCompare if they don't includemisc.c.The
wc_ConstantCompareis guarded by#ifndef WOLFSSL_NO_CONST_CMP.Testing
Tested with bsdkm, linuxkm, and
all-c89-clang-tidy.