1 | =head1 NAME
|
---|
2 |
|
---|
3 | TPMLIB_GetTPMProperty - Get a runtime property of the TPM
|
---|
4 |
|
---|
5 | =head1 LIBRARY
|
---|
6 |
|
---|
7 | TPM library (libtpms, -ltpms)
|
---|
8 |
|
---|
9 | =head1 SYNOPSIS
|
---|
10 |
|
---|
11 | B<#include <libtpms/tpm_library.h>>
|
---|
12 |
|
---|
13 | B<TPM_RESULT TPMLIB_GetTPMProperty(enum TPMLIB_TPMProperty, int *result);>
|
---|
14 |
|
---|
15 | =head1 DESCRIPTION
|
---|
16 |
|
---|
17 | The B<TPMLIB_GetTPMProperty()> call is used to retrieve run-time parameters
|
---|
18 | of the TPM such as the number of authorization sessions it can hold or
|
---|
19 | the maximum sizes of the permanent state, savestate or volatile state blobs.
|
---|
20 |
|
---|
21 | This function can be called before or after the TPM has been created.
|
---|
22 | The current implementation of libtpms will return the same value before
|
---|
23 | and after the TPM was started.
|
---|
24 |
|
---|
25 | With the introduction of the function B<TPMLIB_ChooseTPMVersion()>,
|
---|
26 | the call to this function should be executed after the TPM version
|
---|
27 | has been chosen. The reason is that different TPM versions may return
|
---|
28 | different values.
|
---|
29 |
|
---|
30 | The following properties have been defined:
|
---|
31 |
|
---|
32 | =over 4
|
---|
33 |
|
---|
34 | =item B<TPMPROP_TPM_RSA_KEY_LENGTH_MAX>
|
---|
35 |
|
---|
36 | The maximum size of an RSA key.
|
---|
37 |
|
---|
38 | =item B<TPMPROP_TPM_BUFFER_MAX>
|
---|
39 |
|
---|
40 | The maximum sizes of the TPM command and result buffers.
|
---|
41 |
|
---|
42 | =item B<TPMPROP_TPM_KEY_HANDLES>
|
---|
43 |
|
---|
44 | The number of key slots.
|
---|
45 |
|
---|
46 | =item B<TPMPROP_TPM_OWNER_EVICT_KEY_HANDLES>
|
---|
47 |
|
---|
48 | The number of owner-evict keys.
|
---|
49 |
|
---|
50 | =item B<TPMPROP_TPM_MIN_AUTH_SESSIONS>
|
---|
51 |
|
---|
52 | The number of authorization sessions.
|
---|
53 |
|
---|
54 | =item B<TPMPROP_TPM_MIN_TRANS_SESSIONS>
|
---|
55 |
|
---|
56 | The number of transport sessions.
|
---|
57 |
|
---|
58 | =item B<TPMPROP_TPM_MIN_DAA_SESSIONS>
|
---|
59 |
|
---|
60 | The number of DAA sessions.
|
---|
61 |
|
---|
62 | =item B<TPMPROP_TPM_MIN_SESSION_LIST>
|
---|
63 |
|
---|
64 | The size of the session list.
|
---|
65 |
|
---|
66 | =item B<TPMPROP_TPM_MIN_COUNTERS>
|
---|
67 |
|
---|
68 | The number of monotonic counters.
|
---|
69 |
|
---|
70 | =item B<TPMPROP_TPM_NUM_FAMILY_TABLE_ENTRY_MIN>
|
---|
71 |
|
---|
72 | The number of family entries.
|
---|
73 |
|
---|
74 | =item B<TPMPROP_TPM_NUM_DELEGATE_TABLE_ENTRY_MIN>
|
---|
75 |
|
---|
76 | The number of delegate entries.
|
---|
77 |
|
---|
78 | =item B<TPMPROP_TPM_SPACE_SAFETY_MARGIN>
|
---|
79 |
|
---|
80 | The space safety margin used for the worst-case sizes of the savestate and
|
---|
81 | volatile state blobs. This safety margin is not used for the size of the
|
---|
82 | permanent data blob.
|
---|
83 |
|
---|
84 | =item B<TPMPROP_TPM_MAX_NV_SPACE>
|
---|
85 |
|
---|
86 | The maximum size of the permanent data blob.
|
---|
87 |
|
---|
88 | =item B<TPMPROP_TPM_MAX_SAVESTATE_SPACE>
|
---|
89 |
|
---|
90 | The maximum size of the savestate blob (includes the space safety margin).
|
---|
91 |
|
---|
92 | =item B<TPMPROP_TPM_MAX_VOLATILESTATE_SPACE>
|
---|
93 |
|
---|
94 | The maximum size of the volatile state blob (includes the space saferty
|
---|
95 | margin).
|
---|
96 |
|
---|
97 | =back
|
---|
98 |
|
---|
99 | =head1 ERRORS
|
---|
100 |
|
---|
101 | =over 4
|
---|
102 |
|
---|
103 | =item B<TPM_SUCCESS>
|
---|
104 |
|
---|
105 | The function completed successfully.
|
---|
106 |
|
---|
107 | =item B<TPM_FAIL>
|
---|
108 |
|
---|
109 | An undefined property was queried.
|
---|
110 |
|
---|
111 | =back
|
---|
112 |
|
---|
113 | For a complete list of TPM error codes please consult the include file
|
---|
114 | B<libtpms/tpm_error.h>
|
---|
115 |
|
---|
116 | =head1 EXAMPLE
|
---|
117 |
|
---|
118 | #include <stdio.h>
|
---|
119 |
|
---|
120 | #include <libtpms/tpm_library.h>
|
---|
121 | #include <libtpms/tpm_error.h>
|
---|
122 |
|
---|
123 | int main(void) {
|
---|
124 | TPM_RESULT res;
|
---|
125 | int result;
|
---|
126 | int rc = 0;
|
---|
127 |
|
---|
128 | if (TPMLIB_MainInit() != TPM_SUCCESS) {
|
---|
129 | fprintf(stderr, "Could not start the TPM.\n");
|
---|
130 | return 1;
|
---|
131 | }
|
---|
132 |
|
---|
133 | if (TPMLIB_GetTPMProperty(TPMPROP_TPM_RSA_KEY_LENGTH_MAX, &result)
|
---|
134 | != TPM_SUCCESS) {
|
---|
135 | fprintf(stderr, "Could not read the max. size of RSA keys.\n");
|
---|
136 | goto err_exit;
|
---|
137 | }
|
---|
138 |
|
---|
139 | fprintf(stdout, "Max. size of RSA keys: %d\n", result);
|
---|
140 |
|
---|
141 | err_exit:
|
---|
142 | TPMLIB_Terminate();
|
---|
143 |
|
---|
144 | return 0;
|
---|
145 | }
|
---|
146 |
|
---|
147 | =head1 SEE ALSO
|
---|
148 |
|
---|
149 | B<TPMLIB_MainInit>(3), B<TPMLIB_Terminate>(3),
|
---|
150 | B<TPMLIB_Process>(3), B<TPMLIB_RegisterCallbacks>(3), B<TPMLIB_GetVersion>(3),
|
---|
151 | B<TPMLIB_ChooseTPMVersion>(3)
|
---|
152 |
|
---|
153 | =cut
|
---|