linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Questions about encryption and (possibly weak) checksum
@ 2025-11-20 21:58 Qu Wenruo
  2025-11-20 22:32 ` Eric Biggers
  2025-11-21 13:02 ` Daniel Vacek
  0 siblings, 2 replies; 5+ messages in thread
From: Qu Wenruo @ 2025-11-20 21:58 UTC (permalink / raw)
  To: linux-crypto, linux-btrfs, linux-fsdevel@vger.kernel.org,
	Daniel Vacek, Josef Bacik

Hi,

Recently Daniel is reviving the fscrypt support for btrfs, and one thing 
caught my attention, related the sequence of encryption and checksum.

What is the preferred order between encryption and (possibly weak) checksum?

The original patchset implies checksum-then-encrypt, which follows what 
ext4 is doing when both verity and fscrypt are involved.


But on the other hand, btrfs' default checksum (CRC32C) is definitely 
not a cryptography level HMAC, it's mostly for btrfs to detect incorrect 
content from the storage and switch to another mirror.

Furthermore, for compression, btrfs follows the idea of 
compress-then-checksum, thus to me the idea of encrypt-then-checksum 
looks more straightforward, and easier to implement.

Finally, the btrfs checksum itself is not encrypted (at least for now), 
meaning the checksum is exposed for any one to modify as long as they 
understand how to re-calculate the checksum of the metadata.


So my question here is:

- Is there any preferred sequence between encryption and checksum?

- Will a weak checksum (CRC32C) introduce any extra attack vector?

Thanks,
Qu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-11-21 19:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-20 21:58 Questions about encryption and (possibly weak) checksum Qu Wenruo
2025-11-20 22:32 ` Eric Biggers
2025-11-20 22:36   ` Qu Wenruo
2025-11-21 13:02 ` Daniel Vacek
2025-11-21 19:08   ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).