__calc_tpm2_event_size(9)
π
__calc_tpm2_event_size β the Kernel API Manual, bestie edition
okay so this is a page straight out of the Kernel API Manual (man section 9, iykyk) and it's about one very specific little function: __calc_tpm2_event_size. she's niche, she's precise, she's literally just here to do math on your TPM2 event log. slay.
β¨ NAME β¨
__calc_tpm2_event_size β calculate the size of a TPM2 event log entry π
πΈ SYNOPSIS πΈ
u32 __calc_tpm2_event_size (struct tcg_pcr_event2_head *event , struct
tcg_pcr_event *event_header , bool do_mapping );
like, three arguments, one u32 coming back at you. that's the whole vibe.
π¦ ARGUMENTS π¦
eventβ Pointer to the event whose size should be calculated. yes bestie, this is the one we're measuring πevent_headerβ Pointer to the initial event containing the digest lengths. she's the one holding the receipts (the digest length info) so the math actually works πdo_mappingβ Whether or not the event needs to be mapped.bool, so likeβ¦ yes or no, no in-between β¨
π DESCRIPTION π
okay so here's the situation. the TPM2 event log format can contain multiple digests corresponding to separate PCR banks, and it also contains a variable length of the data that was measured. the way it's giving "surprise, the length is different every time" π
this means you need knowledge of how long each digest type is β and that info lives inside the first event in the log. she's the main character, she knows everything π«Ά
so how do we get the length? we examine the number of events, and then look at each event in turn to determine how much space is used for events in total. once we've done all that, we know the offset of the data length field, and then we can calculate the total size of the event. it's giving detective work, ngl π₯
π RETURN π
- size of the event on success π
0on failure π
β SEE ALSO β
- Kernel file
./include/linux/tpm_eventlog.hβ go read it, i'm obsessed π
and that's the whole page, bestie! β¨ source/version vibes: ./include/linux, dated October 2026 β mwah, no cap, that's a wrap π
ππ
π¦ 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