Remove FIPS guards in GetASN_BitString length check#10027
Open
embhorn wants to merge 1 commit intowolfSSL:masterfrom
Open
Remove FIPS guards in GetASN_BitString length check#10027embhorn wants to merge 1 commit intowolfSSL:masterfrom
embhorn wants to merge 1 commit intowolfSSL:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Removes conditional compilation guards so GetASN_BitString always rejects zero-length BIT STRING content, aligning behavior across FIPS/non-FIPS builds.
Changes:
- Removed
#if/#endifgating around thelength == 0validation inGetASN_BitString. - Ensured the “one or more octets” check runs in all build configurations.
Comments suppressed due to low confidence (2)
wolfcrypt/src/asn.c:1
lengthis anint, but the new guard only rejectslength == 0. Iflengthcan ever be negative (e.g., propagated from a decode error), this check won’t trigger and the function will continue and potentially readinput[idx]despite an invalid length. Consider changing the condition to reject all non-positive lengths (e.g.,length <= 0) so invalid/underflowed lengths fail fast as well.
wolfcrypt/src/asn.c:1- Removing the
HAVE_SELFTEST/HAVE_FIPSguards changes behavior specifically for those build modes (previously,length == 0would not returnASN_PARSE_Ein those configurations). If consumers rely on the prior behavior in FIPS/selftest builds, this is a behavioral breaking change; consider documenting it (release notes / migration note) or clarifying in the PR description why this is safe/required for those configurations.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description
Remove FIPS guards in GetASN_BitString length check
Fixes zd21394
Testing
Build test
Checklist