TPMLIB_GetTPMProperty(3)
π TPMLIB_GetTPMProperty(3) β NAME π
okay bestie, this is the TPMLIB_GetTPMProperty(3) manual, and it's literally about getting a runtime property of the TPM. iconic little fetch quest, no cap. β¨
π LIBRARY π
TPM library (libtpms, -ltpms) π«Ά
β¨ SYNOPSIS β¨
#include <libtpms/tpm_library.h>
TPM_RESULT TPMLIB_GetTPMProperty(enum TPMLIB_TPMProperty, int *result);
π DESCRIPTION π
The TPMLIB_GetTPMProperty() call is your bestie for retrieving run-time parameters of the TPM β things like the number of authorization sessions it can hold, or the maximum sizes of the permanent state, savestate or volatile state blobs. it's giving "ask the TPM for its stats" energy. π
This function can be called before or after the TPM has been created. The current implementation of libtpms will return the same value before and after the TPM was started. lowkey consistent, we love that.
With the introduction of the function TPMLIB_ChooseTPMVersion(), the call to this function should be executed after the TPM version has been chosen. The reason is that different TPM versions may return different values.
β οΈ version vibe check: different TPM versions may return different values, so the docs say to call this after TPMLIB_ChooseTPMVersion() has chosen the version. periodt.
The following properties have been defined:
TPMPROP_TPM_RSA_KEY_LENGTH_MAXβ the maximum size of an RSA key. πTPMPROP_TPM_BUFFER_MAXβ the maximum sizes of the TPM command and result buffers.TPMPROP_TPM_KEY_HANDLESβ the number of key slots.TPMPROP_TPM_OWNER_EVICT_KEY_HANDLESβ the number of owner-evict keys.TPMPROP_TPM_MIN_AUTH_SESSIONSβ the number of authorization sessions.TPMPROP_TPM_MIN_TRANS_SESSIONSβ the number of transport sessions.TPMPROP_TPM_MIN_DAA_SESSIONSβ the number of DAA sessions.TPMPROP_TPM_MIN_SESSION_LISTβ the size of the session list.TPMPROP_TPM_MIN_COUNTERSβ the number of monotonic counters.TPMPROP_TPM_NUM_FAMILY_TABLE_ENTRY_MINβ the number of family entries.TPMPROP_TPM_NUM_DELEGATE_TABLE_ENTRY_MINβ the number of delegate entries.TPMPROP_TPM_SPACE_SAFETY_MARGINβ the space safety margin used for the worst-case sizes of the savestate and volatile state blobs. This safety margin is not used for the size of the permanent data blob.TPMPROP_TPM_MAX_NV_SPACEβ the maximum size of the permanent data blob.TPMPROP_TPM_MAX_SAVESTATE_SPACEβ the maximum size of the savestate blob (includes the space safety margin).TPMPROP_TPM_MAX_VOLATILESTATE_SPACEβ the maximum size of the volatile state blob (includes the space safety margin).
π ERRORS π
TPM_SUCCESSβ the function completed successfully. slay. πTPM_FAILβ an undefined property was queried. π
For a complete list of TPM error codes please consult the include file libtpms/tpm_error.h.
π§ EXAMPLE π§
#include <stdio.h>
#include <libtpms/tpm_library.h>
#include <libtpms/tpm_error.h>
int main(void) {
TPM_RESULT res;
int result;
int rc = 0;
if (TPMLIB_MainInit() != TPM_SUCCESS) {
fprintf(stderr, "Could not start the TPM.\n");
return 1;
}
if (TPMLIB_GetTPMProperty(TPMPROP_TPM_RSA_KEY_LENGTH_MAX, &result)
!= TPM_SUCCESS) {
fprintf(stderr, "Could not read the max. size of RSA keys.\n");
goto err_exit;
}
fprintf(stdout, "Max. size of RSA keys: %d\n", result);
err_exit:
TPMLIB_Terminate();
return 0;
}
π SEE ALSO π
TPMLIB_MainInit(3)TPMLIB_Terminate(3)TPMLIB_Process(3)TPMLIB_RegisterCallbacks(3)TPMLIB_GetVersion(3)TPMLIB_ChooseTPMVersion(3)
that's the whole page, bestie π«Ά source/version: libtpms, date: 2026-01-02, page: TPMLIB_GetTPMProperty(3). literally iconic. π β¨
π¦ 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