GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
TPMLIB_MainInit(3) TPMLIB_MainInit(3)

TPMLIB_MainInit - Initialize the TPM

TPMLIB_Terminate - Terminate the TPM

TPM library (libtpms, -ltpms)

#include <libtpms/tpm_types.h>

#include <libtpms/tpm_library.h>

#include <libtpms/tpm_error.h>

TPM_RESULT TPMLIB_MainInit(void);

TPM_RESULT TPMLIB_Terminate(void);

The TPMLIB_MainInit() and TPMLIB_Terminate() functions are used to initialize and terminate the TPM respectively. The TPMLIB_MainInit() function must be called before the TPM processes any TPM command. The TPMLIB_Terminate() 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 TPMLIB_MainInit() function can then be called again.

Use TPMLIB_RegisterCallbacks() to set callback functions for initialization and writing and restoring the internal state in a portable format.

The function completed successfully.
General failure.

For a complete list of TPM error codes please consult the include file libtpms/tpm_error.h

 #include <stdio.h>
 #include <libtpms/tpm_types.h>
 #include <libtpms/tpm_library.h>
 #include <libtpms/tpm_error.h>
 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.\n");
         return 1;
     }
     [...]
     /* build TPM command */
     [...]
     res = TPMLIB_Process(&respbuffer, &resp_size,
                          &respbufsize,
                          command, command_size);
     [...]
     TPMLIB_Terminate();
     return 0;
 }

TPMLIB_Process(3), TPMLIB_RegisterCallbacks(3), TPMLIB_GetVersion(3) TPMLIB_GetTPMProperty(3), TPMLIB_DecodeBlob(3)

2025-06-10 libtpms

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.