1TPMLIB_GetTPMProperty(3)                              TPMLIB_GetTPMProperty(3)
2
3
4

NAME

6       TPMLIB_GetTPMProperty    - Get a runtime property of the TPM
7

LIBRARY

9       TPM library (libtpms, -ltpms)
10

SYNOPSIS

12       #include <libtpms/tpm_library.h>
13
14       TPM_RESULT TPMLIB_GetTPMProperty(enum TPMLIB_TPMProperty, int *result);
15

DESCRIPTION

17       The TPMLIB_GetTPMProperty() call is used to retrieve run-time
18       parameters of the TPM such as the number of authorization sessions it
19       can hold or the maximum sizes of the permanent state, savestate or
20       volatile state blobs.
21
22       This function can be called before or after the TPM has been created.
23       The current implementation of libtpms will return the same value before
24       and after the TPM was started.
25
26       With the introduction of the function TPMLIB_ChooseTPMVersion(), the
27       call to this function should be executed after the TPM version has been
28       chosen. The reason is that different TPM versions may return different
29       values.
30
31       The following properties have been defined:
32
33       TPMPROP_TPM_RSA_KEY_LENGTH_MAX
34           The maximum size of an RSA key.
35
36       TPMPROP_TPM_BUFFER_MAX
37           The maximum sizes of the TPM command and result buffers.
38
39       TPMPROP_TPM_KEY_HANDLES
40           The number of key slots.
41
42       TPMPROP_TPM_OWNER_EVICT_KEY_HANDLES
43           The number of owner-evict keys.
44
45       TPMPROP_TPM_MIN_AUTH_SESSIONS
46           The number of authorization sessions.
47
48       TPMPROP_TPM_MIN_TRANS_SESSIONS
49           The number of transport sessions.
50
51       TPMPROP_TPM_MIN_DAA_SESSIONS
52           The number of DAA sessions.
53
54       TPMPROP_TPM_MIN_SESSION_LIST
55           The size of the session list.
56
57       TPMPROP_TPM_MIN_COUNTERS
58           The number of monotonic counters.
59
60       TPMPROP_TPM_NUM_FAMILY_TABLE_ENTRY_MIN
61           The number of family entries.
62
63       TPMPROP_TPM_NUM_DELEGATE_TABLE_ENTRY_MIN
64           The number of delegate entries.
65
66       TPMPROP_TPM_SPACE_SAFETY_MARGIN
67           The space safety margin used for the worst-case sizes of the
68           savestate and volatile state blobs. This safety margin is not used
69           for the size of the permanent data blob.
70
71       TPMPROP_TPM_MAX_NV_SPACE
72           The maximum size of the permanent data blob.
73
74       TPMPROP_TPM_MAX_SAVESTATE_SPACE
75           The maximum size of the savestate blob (includes the space safety
76           margin).
77
78       TPMPROP_TPM_MAX_VOLATILESTATE_SPACE
79           The maximum size of the volatile state blob (includes the space
80           saferty margin).
81

ERRORS

83       TPM_SUCCESS
84           The function completed successfully.
85
86       TPM_FAIL
87           An undefined property was queried.
88
89       For a complete list of TPM error codes please consult the include file
90       libtpms/tpm_error.h
91

EXAMPLE

93        #include <stdio.h>
94
95        #include <libtpms/tpm_library.h>
96        #include <libtpms/tpm_error.h>
97
98        int main(void) {
99            TPM_RESULT res;
100            int result;
101            int rc = 0;
102
103            if (TPMLIB_MainInit() != TPM_SUCCESS) {
104                fprintf(stderr, "Could not start the TPM.\n");
105                return 1;
106            }
107
108            if (TPMLIB_GetTPMProperty(TPMPROP_TPM_RSA_KEY_LENGTH_MAX, &result)
109                != TPM_SUCCESS) {
110                fprintf(stderr, "Could not read the max. size of RSA keys.\n");
111                goto err_exit;
112            }
113
114            fprintf(stdout, "Max. size of RSA keys: %d\n", result);
115
116        err_exit:
117            TPMLIB_Terminate();
118
119            return 0;
120        }
121

SEE ALSO

123       TPMLIB_MainInit(3), TPMLIB_Terminate(3), TPMLIB_Process(3),
124       TPMLIB_RegisterCallbacks(3), TPMLIB_GetVersion(3),
125       TPMLIB_ChooseTPMVersion(3)
126
127
128
129libtpms                           2022-07-01          TPMLIB_GetTPMProperty(3)
Impressum