tpm2_create_primary(9)
π tpm2_create_primary β kernel API manual, but make it cute β¨
okay so bestie, welcome to the tpm2_create_primary(9) page π«Ά it lives in the kernel API manual and it's literally all about creating a primary key using a fixed P-256 template. no cap, that's the whole vibe.
β¨ NAME β¨
tpm2_create_primary β create a primary key using a fixed P-256 template π
πΈ SYNOPSIS πΈ
int tpm2_create_primary (struct tpm_chip *chip , u32 hierarchy , u32
*handle , u8 *name );
that's the whole signature, character for character, no edits from me π
π ARGUMENTS π
chipβ the TPM chip to create under π§hierarchyβ the hierarchy handle to create under β¨handleβ the returned volatile handle on success π«nameβ the name of the returned key π·οΈ
π¦ DESCRIPTION π¦
so here's the situation: for platforms that might not have a persistent primary, this is your girl β you can use it to create one quickly on the fly π₯ and the reason it's fast? it uses Elliptic Curve not RSA, so even slow TPMs can create one fast ππ¨ (yes, even those TPMs. iconic behaviour.)
the template it uses is the TCG mandated H one for non-endorsement ECC primaries, which lowkey means:
- P-256 elliptic curve β the only current one all TPM2s are required to have π
- a sha256 name hash π
- no policy β none, zero, nada π
β RETURN β
0β OK β-errnoβ a system error πTPM_RCβ a TPM error π
π SEE ALSO π
kernel file ./drivers/char/tpm/tpm2-sessions.c, plus these besties:
tpm_buf_append_name(9)tpm_buf_append_hmac_session(9)tpm_buf_fill_hmac_session(9)tpm_buf_check_hmac_response(9)tpm2_end_auth_session(9)tpm2_start_auth_session(9)tpm2_parse_create_primary(9)tpm2_sessions_init(9)
ok that's the whole page, go forth and create primaries responsibly π«Ά
and finally, the cute sign-off: this one's from ./drivers/char/tpm, dated October 2026, and it's tpm2_create_primary(9) forever and always π
π
π¦ 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