librustls: switch common.c's read_file to binary mode#650
Merged
Conversation
Member
Author
Both need #649 to land first |
Member
Author
|
Not that it demonstrates too much except a lack of regressions, but here's a manually invoked daily tasks job passing on this branch. |
djc
approved these changes
Jun 26, 2026
ctz
approved these changes
Jun 26, 2026
Prior to ECH support all of the consumers of the common `read_file()` helper were loading text data (PEM encoded certs, keys, and CRLs). However, for ECH, we're loading a binary serialized ECH Config List structure. On Windows specifically if we don't `fopen()` with mode==rb instead of mode==r we open the file in _text mode_, and certain byte sequences are translated. This in turn breaks ECH config deserialization when the config data happens to have those byte sequences. This manifests as a Windows-only flake of the ECH example unit test in CI. The fix is simple: we can use 'rb' as the mode in `read_file()` and avoid this issue.
18e23ca to
258f320
Compare
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.
Prior to ECH support all of the consumers of the common
read_file()helper were loading text data (PEM encoded certs, keys, and CRLs). However, for ECH, we're loading a binary serialized ECH Config List structure.On Windows specifically if we don't
fopen()with mode==rb instead of mode==r we open the file in text mode, and certain byte sequences are translated:This in turn breaks ECH config deserialization when the config data happens to have those byte sequences. This manifests as a Windows-only flake of the ECH example unit test in CI, with the error:
The fix is simple: we can use 'rb' as the mode in
read_file()and avoid this issue.Resolves #514