.\" -*- 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_MainInit 3" .TH TPMLIB_MainInit 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_MainInit \- Initialize the TPM .PP TPMLIB_Terminate \- Terminate the TPM .SH LIBRARY .IX Header "LIBRARY" TPM library (libtpms, \-ltpms) .SH SYNOPSIS .IX Header "SYNOPSIS" \&\fB#include .PP \&\fB#include .PP \&\fB#include .PP \&\fBTPM_RESULT TPMLIB_MainInit(void);\fR .PP \&\fBTPM_RESULT TPMLIB_Terminate(void);\fR .SH DESCRIPTION .IX Header "DESCRIPTION" The \fBTPMLIB_MainInit()\fR and \fBTPMLIB_Terminate()\fR functions are used to initialize and terminate the TPM respectively. The \fBTPMLIB_MainInit()\fR function must be called before the TPM processes any TPM command. The \fBTPMLIB_Terminate()\fR function is called to free all the internal resources (memory allocations) the TPM has used and must be called after the last TPM command was processed by the TPM. The \fBTPMLIB_MainInit()\fR function can then be called again. .PP Use \fBTPMLIB_RegisterCallbacks()\fR to set callback functions for initialization and writing and restoring the internal state in a portable format. .SH ERRORS .IX Header "ERRORS" .IP \fBTPM_SUCCESS\fR 4 .IX Item "TPM_SUCCESS" The function completed successfully. .IP \fBTPM_FAIL\fR 4 .IX Item "TPM_FAIL" General failure. .PP For a complete list of TPM error codes please consult the include file \&\fBlibtpms/tpm_error.h\fR .SH EXAMPLE .IX Header "EXAMPLE" .Vb 1 \& #include \& \& #include \& #include \& #include \& \& int main(void) { \& TPM_RESULT res; \& unsigned char *respbuffer = NULL; \& uint32_t resp_size = 0; \& uint32_t respbufsize = 0; \& unsigned char *command; \& uint32_t command_size; \& \& [...] \& \& if (TPMLIB_MainInit() != TPM_SUCCESS) { \& fprintf(stderr, "Could not start the TPM.\en"); \& return 1; \& } \& \& [...] \& /* build TPM command */ \& [...] \& \& res = TPMLIB_Process(&respbuffer, &resp_size, \& &respbufsize, \& command, command_size); \& [...] \& \& TPMLIB_Terminate(); \& \& return 0; \& } .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBTPMLIB_Process\fR(3), \fBTPMLIB_RegisterCallbacks\fR(3), \fBTPMLIB_GetVersion\fR(3) \&\fBTPMLIB_GetTPMProperty\fR(3), \fBTPMLIB_DecodeBlob\fR(3)