.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) .\" .\" 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_Process 3" .TH TPMLIB_Process 3 2024-11-15 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_Process \- process a TPM command .SH LIBRARY .IX Header "LIBRARY" TPM library (libtpms, \-ltpms) .SH SYNOPSIS .IX Header "SYNOPSIS" \&\fB#include .PP \&\fB#include .PP \&\fBTPM_RESULT TPMLIB_Process(unsigned char\fR **\fIrespbuffer\fR\fB, uint32_t\fR *\fIresp_size\fR\fB, uint32_t\fR *\fIrespbufsize\fR\fB, unsigned char\fR *\fIcommand\fR\fB, uint32_t\fR \fIcommand_size\fR\fB);\fR .SH DESCRIPTION .IX Header "DESCRIPTION" The \fBTPMLIB_Process()\fR function is used to send TPM commands to the TPM and receive the results. .PP The \fIcommand\fR parameter provides the buffer for the TPM command and the \fIcommand_size\fR the number of valid TPM command bytes within that buffer. .PP The \fIrespbuffer\fR is a pointer to a buffer where the TPM will return its result. If no buffer is given (\fIrespbuffer\fR is NULL), the TPM will allocate a buffer. The parameter \fIresp_size\fR returns the number of valid TPM response bytes in the buffer. The number of valid bytes in the response is guaranteed to not exceed the maximum I/O buffer size. Use the \&\fR\f(BITPMLIB_GetTPMProperty()\fR\fI\fR API and parameter \fITPMPROP_TPM_BUFFER_MAX\fR for getting the maximum size. The user must indicate the size of a provided buffer with the \fIrespbufsize\fR parameter. If the buffer is not big enough for the response, the TPM will free the provided buffer and allocate one of sufficient size and adapt \&\fIrespbufsize\fR. The returned buffer is only subject to size restrictions as explained for \fI\fR\f(BITPM_Malloc()\fR\fI\fR. .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 \& \& static unsigned char TPM_Startup_ST_CLEAR[] = { \& 0x00, 0xC1, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x99, \& 0x00, TPM_ST_CLEAR \& }; \& \& 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 */ \& command = TPM_Startup_ST_CLEAR; \& command_size = sizeof(TPM_Startup_ST_CLEAR); \& [...] \& \& res = TPMLIB_Process(&respbuffer, &resp_size, \& &respbufsize, \& command, command_size); \& [...] \& \& TPMLIB_Terminate(); \& \& return 0; \& } .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBTPMLIB_MainInit\fR(3), \fBTPMLIB_Terminate\fR(3), \fBTPMLIB_RegisterCallbacks\fR(3) \&\fBTPMLIB_GetTPMProperty\fR(3), \fBTPMLIB_Malloc\fR(3), \fBTPMLIB_Realloc\fR(3)