Repository navigation
Refuse raw:hex: keys with non-hex characters, avoid an over-read - #313
Merged
Merged
Conversation
sqlite3mcExtractRawKey accepted a value after "raw:hex:" if only its length matched; non-hex characters were converted as 0, so for example "raw:hex:" followed by 64 times "z" gave an all-zero key without an error. Check isHex as well. The test for the secondary prefixes read 4 bytes even if fewer than 4 followed "raw:", up to 3 bytes past the end of a key passed without a terminating zero (for example "raw:b" with length 5).
Valid values with raw:hex:, raw:bin: and raw:, with and without salt, a 128-bit hex key that has the length of key plus salt in binary form, and invalid values (wrong length, non-hex characters after raw:hex:, too short), each passed in a buffer of its exact length.
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.
Two small fixes in sqlite3mcExtractRawKey, as discussed by mail:
cryptotest gets a section for raw keys: valid values with raw:hex:, raw:bin: and raw:, with and without salt, a 128-bit hex key whose length equals key plus salt in binary form, and invalid values (wrong length, non-hex characters after raw:hex:, too short). Each key is passed in a buffer of its exact length.
Testing (macOS arm64, flags from Makefile.am):