fsverity_get_digest(9)
π 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 aFS_VERITY_HASH_ALG_*value. this is one of your two algorithm-ID options.halgβ (out) the digest's algorithm, expressed as aHASH_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 π
- Kernel file
./fs/verity/measure.c fsverity_ioctl_measure(9)bpf_get_fsverity_digest(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms