fsverity_get_digest(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– fsverity_get_digest(9) β€” kernel API manual, bestie edition ✨

okay so you're in the kernel, you're poking at fsverity_get_digest(9), and you want the tea. this is a page from the Kernel API Manual, and honestly it's giving "short but important" energy. let's get into it 🫢


✨ NAME ✨

fsverity_get_digest β€” get a verity file's digest πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

int fsverity_get_digest (struct inode *inode , u8
raw_digest[FS_VERITY_MAX_DIGEST_SIZE] , u8 *alg , enum hash_algo *halg
);

no cap, that's the whole signature. four things go in, and the return value is a int β€” we'll get to what it means, don't worry πŸŽ€


🌸 ARGUMENTS 🌸

  • inode β€” the inode you want the digest of, bestie. that's the one.
  • raw_digest β€” (out) the raw file digest. it's an output, so it gets filled in for you πŸ’– and notice the size cap: FS_VERITY_MAX_DIGEST_SIZE.
  • alg β€” (out) the digest's algorithm, expressed as a FS_VERITY_HASH_ALG_* value. this is one of your two algorithm-ID options.
  • halg β€” (out) the digest's algorithm, expressed as a HASH_ALGO_* value. this is the other one.

πŸ’œ DESCRIPTION πŸ’œ

So basically this function retrieves the fsverity digest of the given file. simple enough, right? ✨

But β€” and this is the part people mess up, so listen up β€” fsverity_ensure_verity_info must be called on the inode beforehand. If you don't, this function will not recognize when fsverity is enabled. like, it just won't see it. forewarned is forearmed, iykyk 😭

The file's fsverity digest consists of raw_digest in combination with either alg or halg. The caller can choose which one of alg or halg to use β€” you literally get to pick, main character choice πŸ’…

🚨 IMPORTANT: Callers must make use of one of the two algorithm IDs, since raw_digest is meaningless without knowing which algorithm it uses! fsverity provides no security guarantee for users who ignore the algorithm ID, even if they use the digest size (since algorithms can share the same digest size). like, this is the whole point, do not skip it, periodt πŸ”₯

⭐ RETURN ⭐

The size of the raw digest in bytes β€” or 0 if the file doesn't have fsverity enabled. that's it, that's the return πŸŽ€


🌈 SEE ALSO 🌈


okay that's the whole page, you ate that πŸ“ and before you go β€” this lil gem lives under ./fs/verity, dated October 2026. mwah, go forth and check those algorithm IDs πŸ’–βœ¨πŸ‘‘

πŸ“¦ where this page comes from