Add missing goto for checking encapsulation invariants.#121562
Merged
vcsjones merged 1 commit intodotnet:mainfrom Nov 13, 2025
Merged
Add missing goto for checking encapsulation invariants.#121562vcsjones merged 1 commit intodotnet:mainfrom
goto for checking encapsulation invariants.#121562vcsjones merged 1 commit intodotnet:mainfrom
Conversation
When we encapsulate something with ML-KEM on OpenSSL, we were checking that the amount written is what we expected, but a missing `goto` caused it to be marked as a success. This isn't really a reliability problem since we already know how much encapsulation sizes are, we're just making sure OpenSSL and the managed side agree on it.
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the ML-KEM encapsulation error handling where a missing goto statement caused an error condition to be incorrectly reported as success. When the encapsulation output lengths didn't match expected values, the code would set ret = -1 but then immediately proceed to set ret = 1, causing the function to return success despite the validation failure.
Key Changes:
- Added missing
goto done;statement after setting error code in length validation check
bartonjs
approved these changes
Nov 12, 2025
This was referenced Nov 13, 2025
Open
Member
Author
|
/ba-g Android timeouts and Android is not affected by this change. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
When we encapsulate something with ML-KEM on OpenSSL, we were checking that the amount written is what we expected, but a missing
gotocaused it to be marked as a success.This isn't really a reliability problem since we already know how much encapsulation sizes are, we're just making sure OpenSSL and the managed side agree on it.