Repository navigation
feat(encryption): implement key reading from file and update verification options for encrypted containers - #16
Merged
Conversation
…tion options for encrypted containers
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.
Fixes found while preparing the FreeBSD port, and bumps the version to 1.4.1 so the port can pin a release that includes them.
Changes
bfc verifyworks on encrypted containersverify --deepon an encrypted container always failed: the library returnsBFC_E_PERMwithout a key, and the CLI had no way to pass one.--password PASSand-K, --keyfile FILE(same meaning as inextract). There is no short-pfor the password becauseverifyalready uses-pfor--progress, and that stays as it is.--passwordor--keyfileis needed, instead of a bare "Permission denied".read_key_from_filemoved tocli_util.c. Before,createandextracteach had their own copy.SSE4.2 limited to the hardware CRC32C function
-msse4.2 -mcrc32was applied to the whole library. At-O3the compiler can put SSE4.2 instructions anywhere, so a generic x86_64 package could crash with SIGILL on CPUs without SSE4.2, even though the runtimecpuidcheck exists. The flags are removed, and onlycrc32c_hw_x86gets__attribute__((target("sse4.2"))).objdumpconfirmscrc32instructions appear only in that function.Software CRC32C matches the hardware paths
The SSE4.2 and ARMv8 paths compute CRC32C with initial value 0 and no final XOR.
crc32c_swinverted the value on input and output, so on"123456789"it gave0xE3069283while the hardware paths gave0x58E3FA20. A container written on a machine with hardware CRC failed verification on a machine without it (i386, powerpc64, riscv64, armv7), and the other way round.The software path now matches the hardware paths. Containers written on x86_64 or arm64, which is almost all of them, stay valid. The checksum definition is now written down in
docs/format.md, and a unit test pins the value0x58E3FA20.Version
1.4.0→1.4.1.Testing
-m32) gives0x58E3FA20verify --deepon FreeBSD amd64verify --deepwith 1.4.1, and the other way roundverifywith a password, a key file, a wrong password, no key,-ptogether with--password, and--passwordwith no argumentclang-format --dry-run -Werrorclean, no warnings with-Werror