TPMLIB_ChooseTPMVersion(3)
๐ TPMLIB_ChooseTPMVersion(3) โ like, the whole manual page, bestie
okay so this is a page from the libtpms manual, and honestly? it's giving "small function, big responsibilities." let's get into it ๐
โจ NAME โจ
TPMLIB_ChooseTPMVersion โ the function where you, the main character, pick which version of the TPM you want. that's it. that's the whole job. ๐
๐ฆ SYNOPSIS ๐ฆ
#include <libtpms/tpm_types.h>
#include <libtpms/tpm_library.h>
TPM_RESULT TPMLIB_ChooseTPMVersion(TPMLIB_TPMVersion ver);
typedef enum TPMLIB_TPMVersion {
TPMLIB_TPM_VERSION_1_2,
TPMLIB_TPM_VERSION_2,
} TPMLIB_TPMVersion;
like yes, you gotta include both headers, no shortcuts, we don't do that here ๐
๐ธ DESCRIPTION ๐ธ
so TPMLIB_ChooseTPMVersion() is literally the "pick your fighter" screen for the TPM โ you're choosing whether you want a TPM 1.2 or a TPM 2. that's the vibe check. ๐ฎ
timing matters, bestie. you must call this function before TPMLIB_MainInit() gets called โ do it after and it will return an error, no cap. ๐ญ that's the rule and we respect it.
the good news? you can call it again later โ but only once TPMLIB_Terminate() has been called. so like... terminate first, then re-choose. order is everything fr fr ๐ซถ
now for the โจ default behaviour โจ (iykyk, defaults are sneaky):
- if you don't call this function at all, then whatever TPM version was chosen last is the one that gets started with
TPMLIB_MainInit(). - and if this function is not called... a TPM 1.2 will be used.
so yeah, silence = TPM 1.2. iconic of it, honestly. ๐
๐ ERRORS ๐
TPM_SUCCESSโ slay! โจ the version of the TPM was chosen successfully. everything worked, we love to see it. ๐TPM_FAILโ oop. ๐ either the choice of the TPM was wrong, orTPMLIB_MainInit()has already been called (remember the timing rule? yeah, that one). ๐ญ
wanna see the complete list of TPM error codes? go look at the include file libtpms/tpm_error.h โ it's all there, i promise. ๐
๐ SEE ALSO ๐
and that's the page!! ๐ฆ okay bye, go call your functions in the right order โ mwah ๐
โ brought to you by libtpms, dated 2026-01-02, and yeah that's the same TPMLIB_ChooseTPMVersion(3) you started with. full circle, periodt. ๐
๐ฆ where this page comes from
- alpine 3.24: libtpms-doc 0.10.2-r0 ยท BSD-3-Clause
- arch rolling: libtpms 0.10.2-1 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms