Hi Johannes, On Tue, Apr 28, 2020 at 12:58:57PM +0200, Johannes Thumshirn wrote: > Currently BRTFS supports CRC32C, XXHASH64, SHA256 and Blake2b for checksumming > these blocks. This series adds a new checksum algorithm, HMAC(SHA-256), which > does need an authentication key. When no, or an incoreect authentication key > is supplied no valid checksum can be generated and a read, fsck or scrub > operation would detect invalid or tampered blocks once the file-system is > mounted again with the correct key. In case you're interested, Blake2b and Blake2s both have "keyed" modes, which are more efficient than HMAC and achieve basically the same thing -- they provide a PRF/MAC. There are normal crypto API interfaces for these, and there's also an easy library interface: #include <crypto/blake2s.h> blake2s(output_mac, input_data, secret_key, output_mac_length, input_data_length, secret_key_length); You might find that the performance of Blake2b and Blake2s is better than HMAC-SHA2-256. But more generally, I'm wondering about the general design and what properties you're trying to provide. Is the block counter being hashed in to prevent rearranging? Are there generation counters to prevent replay/rollback? Also, I'm wondering if this is the kind of feature you'd consider pairing with a higher speed AEAD, and maybe in a way that would integrate with the existing fscrypt tooling, without the need to manage two sets of keys. Ever looked at bcachefs' design for this? https://bcachefs.org/Encryption/ Either way, I'm happy to learn that btrfs is a filesystem with some space baked in for authentication tags. Jason