1TPMLIB_GetTPMProperty(3) TPMLIB_GetTPMProperty(3)
2
3
4
6 TPMLIB_GetTPMProperty - Get a runtime property of the TPM
7
9 TPM library (libtpms, -ltpms)
10
12 #include <libtpms/tpm_library.h>
13
14 TPM_RESULT TPMLIB_GetTPMProperty(enum TPMLIB_TPMProperty, int *result);
15
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 The following properties have been defined:
27
28 TPMPROP_TPM_RSA_KEY_LENGTH_MAX
29 The maximum size of an RSA key.
30
31 TPMPROP_TPM_BUFFER_MAX
32 The maximum sizes of the TPM command and result buffers.
33
34 TPMPROP_TPM_KEY_HANDLES
35 The number of key slots.
36
37 TPMPROP_TPM_OWNER_EVICT_KEY_HANDLES
38 The number of owner-evict keys.
39
40 TPMPROP_TPM_MIN_AUTH_SESSIONS
41 The number of authorization sessions.
42
43 TPMPROP_TPM_MIN_TRANS_SESSIONS
44 The number of transport sessions.
45
46 TPMPROP_TPM_MIN_DAA_SESSIONS
47 The number of DAA sessions.
48
49 TPMPROP_TPM_MIN_SESSION_LIST
50 The size of the session list.
51
52 TPMPROP_TPM_MIN_COUNTERS
53 The number of monotonic counters.
54
55 TPMPROP_TPM_NUM_FAMILY_TABLE_ENTRY_MIN
56 The number of family entries.
57
58 TPMPROP_TPM_NUM_DELEGATE_TABLE_ENTRY_MIN
59 The number of delegate entries.
60
61 TPMPROP_TPM_SPACE_SAFETY_MARGIN
62 The space saftey margin used for the worst-case sizes of the
63 savestate and volatile state blobs. This safety marging is not used
64 for the size of the permanent data blob.
65
66 TPMPROP_TPM_MAX_NV_SPACE
67 The maximum size of the permanent data blob.
68
69 TPMPROP_TPM_MAX_SAVESTATE_SPACE
70 The maximum size of the savestate blob (includes the space safety
71 margin).
72
73 TPMPROP_TPM_MAX_VOLATILESTATE_SPACE
74 The maximum size of the volatile state blob (includes the space
75 saferty margin).
76
78 TPM_SUCCESS
79 The function completed sucessfully.
80
81 TPM_FAIL
82 An undefined property was queried.
83
84 For a complete list of TPM error codes please consult the include file
85 libtpms/tpm_error.h
86
88 #include <stdio.h>
89
90 #include <libtpms/tpm_library.h>
91 #include <libtpms/tpm_error.h>
92
93 int main(void) {
94 TPM_RESULT res;
95 int result;
96 int rc = 0;
97
98 if (TPMLIB_MainInit() != TPM_SUCCESS) {
99 fprintf(stderr, "Could not start the TPM.\n");
100 return 1;
101 }
102
103 if (TPMLIB_GetTPMProperty(TPMPROP_TPM_RSA_KEY_LENGTH_MAX, &result)
104 != TPM_SUCCESS) {
105 fprintf(stderr, "Could not read the max. size of RSA keys.\n");
106 goto err_exit;
107 }
108
109 fprintf(stdout, "Max. size of RSA keys: %d\n", result);
110
111 err_exit:
112 TPMLIB_Terminate();
113
114 return 0;
115 }
116
118 TPMLIB_MainInit(3), TPMLIB_Terminate(3), TPMLIB_Process(3),
119 TPMLIB_RegisterCallbacks(3), TPMLIB_GetVersion(3)
120
121
122
123libtpms 2018-03-16 TPMLIB_GetTPMProperty(3)