1TPMLIB_SetState(3)                                          TPMLIB_SetState(3)
2
3
4

NAME

6       TPMLIB_SetState  - Set the TPM's volatile, permanent, or save state
7
8       TPMLIB_GetState  - Get the TPM's volatile, permanent, or save state
9

LIBRARY

11       TPM library (libtpms, -ltpms)
12

SYNOPSIS

14       #include <libtpms/tpm_library.h>
15
16       TPM_RESULT TPMLIB_SetState(enum TPMLIB_StateType st,
17                                  const unsigned char *buffer, uint32_t
18       buflen);
19
20       TPM_RESULT TPMLIB_GetState(enum TPMLIB_StateType st,
21                                  unsigned char **buffer, uint32_t *buflen);
22

DESCRIPTION

24       The TPMLIB_SetState() function allows to set either one of the state
25       blobs of the TPM. The passed state blob is tested for whether it can be
26       accepted and a TPM error code is returned in case it cannot be
27       accepted. In case of acceptance, the state blob will be passed to the
28       TPM upon TPM_MainInit(). Setting a state blob hides a file that may
29       contain the same type of blob and would be read otherwise.  It is
30       required to call this function with a NULL pointer for the buffer
31       parameter to hide a state blob in a file.
32
33       It is only possible to set the state blobs after
34       TPMLIB_ChooseTPMVersion() has been called. All state blobs are cleared
35       when a different version of TPM is chosen using TPMLIB_ChooseTPMVersion
36       or when a call to TPMLIB_SetState() fails because a state blob could
37       not be accepted.
38
39       The order in which state blobs are set is important. The first state
40       blob has to be the one representing the TPM's permanent state. Only
41       after that either the volatile or save state blobs can be set.
42
43       The TPMLIB_GetState() function allows to get the current state of the
44       TPM.  For as long as the TPM has not been started, this function either
45       returns the state blob previously set with TPMLIB_SetState() or the
46       state is read from a file.  Once the TPM has been start the state of
47       the running TPM is returned.
48
49       The TPMLIB_STATE_SAVE_STATE (save state) type of TPM state can be set
50       with this function. The same state blob will be returned until
51       TPM_Startup(ST_STATE) has been called, after which an empty blob will
52       be returned. This blob can also only be read after TPM_SaveState() has
53       been sent to the TPM.
54

SEE ALSO

56       TPMLIB_ChooseTPMVersion(3), TPMLIB_MainInit(3), TPMLIB_Terminate(3)
57
58
59
60libtpms                           2022-07-01                TPMLIB_SetState(3)
Impressum