.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "TPMLIB_SetState 3" .TH TPMLIB_SetState 3 2024-03-09 libtpms "" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME TPMLIB_SetState \- Set the TPM's volatile, permanent, or save state .PP TPMLIB_GetState \- Get the TPM's volatile, permanent, or save state .SH LIBRARY .IX Header "LIBRARY" TPM library (libtpms, \-ltpms) .SH SYNOPSIS .IX Header "SYNOPSIS" \&\fB#include .PP \&\fBTPM_RESULT TPMLIB_SetState(enum TPMLIB_StateType st, const unsigned char *buffer, uint32_t buflen);\fR .PP \&\fBTPM_RESULT TPMLIB_GetState(enum TPMLIB_StateType st, unsigned char **buffer, uint32_t *buflen);\fR .SH DESCRIPTION .IX Header "DESCRIPTION" The \fBTPMLIB_SetState()\fR function allows to set either one of the state blobs of the TPM. The passed state blob is tested for whether it can be accepted and a TPM error code is returned in case it cannot be accepted. In case of acceptance, the state blob will be passed to the TPM upon \fBTPM_MainInit()\fR. Setting a state blob hides a file that may contain the same type of blob and would be read otherwise. It is required to call this function with a NULL pointer for the buffer parameter to hide a state blob in a file. .PP It is only possible to set the state blobs after \fBTPMLIB_ChooseTPMVersion()\fR has been called. All state blobs are cleared when a different version of TPM is chosen using \fBTPMLIB_ChooseTPMVersion\fR or when a call to \fBTPMLIB_SetState()\fR fails because a state blob could not be accepted. .PP The order in which state blobs are set is important. The first state blob has to be the one representing the TPM's permanent state. Only after that either the volatile or save state blobs can be set. .PP The \fBTPMLIB_GetState()\fR function allows to get the current state of the TPM. For as long as the TPM has not been started, this function either returns the state blob previously set with \fBTPMLIB_SetState()\fR or the state is read from a file. Once the TPM has been start the state of the running TPM is returned. .PP The \fBTPMLIB_STATE_SAVE_STATE\fR (save state) type of TPM state can be set with this function. The same state blob will be returned until TPM_Startup(ST_STATE) has been called, after which an empty blob will be returned. This blob can also only be read after \fBTPM_SaveState()\fR has been sent to the TPM. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBTPMLIB_ChooseTPMVersion\fR(3), \fBTPMLIB_MainInit\fR(3), \fBTPMLIB_Terminate\fR(3)