Repository navigation
Harden COSE decoding, key attachment, scratch buffer and zeroization paths and close MISRA findings - #97
Open
aidangarske wants to merge 53 commits into
Conversation
aidangarske
commented
Nov 30, 2026
Member
- Decoders skipped or mis-bounded some header maps, recipient bodies and PSA claims. Skipped maps are now validated and bounded, duplicate labels are rejected, and truncated or empty containers report a malformed message.
- Several APIs accepted inputs that RFC 9052 and RFC 9053 rule out, such as a detached payload when the message carries its own, or a missing or mismatched key attachment. These now fail closed with an argument error.
- Every create, verify and decrypt API now rejects a scratch buffer that overlaps any input or output, including the returned header, payload pointer and length objects. The check is one O(1) address comparison under deviation D-11.4-001.
- HMAC contexts, the ECDH-ES HKDF PRK, AES key wrap contexts and cached ML-DSA private vectors are wiped after use, and the zeroize tests count each expected wipe.
- A failed public CBOR encode or decode leaves the cursor unchanged. A failed HPKE-0-KE recipient open still runs the content cipher, so a wrong key and a tampered tag fail the same way.
- The CBOR float encoders require IEEE 754 binary32 and binary64 at build time. They also check the stored byte order at run time and return WOLFCOSE_E_UNSUPPORTED on a mismatch.
- MISRA cleanups: explicit size_t, uint64_t and int conversions, dead initializers removed, library byte arrays initialized from hex bytes, and const inputs copied before non-const wolfCrypt calls.
- The Rule 14.2 status-guarded loop deviation is proven by scripts/check_loops.py, which reads clang's AST and fails closed on any loop it cannot prove. A second AST check keeps library byte arrays off string literals. Both run in the MISRA workflow with self-tests.
- No public API signature changes. The new rejections return WOLFCOSE_E_INVALID_ARG or WOLFCOSE_E_CBOR_MALFORMED for inputs that were already invalid.
aidangarske
force-pushed
the
fenrir-fixes-17413-17445-13637-14972-14973-14974-14994-17424-18398
branch
from
November 30, 2026 19:56
a95f518 to
fc577b2
Compare
This branch has not been deployed
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.