1TPMLIB_MAININIT(1)           libtpms documentation          TPMLIB_MAININIT(1)
2
3
4

NAME

6       TPMLIB_MainInit    - Initialize the TPM
7
8       TPMLIB_Terminate   - Terminate the TPM
9

LIBRARY

11       TPM library (libtpms, -ltpms)
12

SYNOPSIS

14       #include <libtpms/tpm_types.h>
15
16       #include <libtpms/tpm_library.h>
17
18       #include <libtpms/tpm_error.h>
19
20       TPM_RESULT TPMLIB_MainInit(void);
21
22       TPM_RESULT TPMLIB_Terminate(void);
23

DESCRIPTION

25       The TPMLIB_MainInit() and TPMLIB_Terminate() functions are used to
26       initialize and terminate the TPM respectively. The TPMLIB_MainInit()
27       function must be called before the TPM processes any TPM command.  The
28       TPMLIB_Terminate() function is called to free all the internal
29       resources (memory allocations) the TPM has used and must be called
30       after the last TPM command was processed by the TPM. The
31       TPMLIB_MainInit() function can then be called again.
32

ERRORS

34       TPM_SUCCESS
35           The function completed sucessfully.
36
37       TPM_FAIL
38           General failure.
39
40       For a complete list of TPM error codes please consult the include file
41       libtpms/tpm_error.h
42

EXAMPLE

44        #include <stdio.h>
45
46        #include <libtpms/tpm_types.h>
47        #include <libtpms/tpm_library.h>
48        #include <libtpms/tpm_error.h>
49
50        int main(void) {
51            TPM_RESULT res;
52            unsigned char *respbuffer = NULL;
53            uint32_t resp_size = 0;
54            uint32_t respbufsize = 0;
55            unsigned char *command;
56            uint32_t command_size;
57
58            [...]
59
60            if (TPMLIB_MainInit() != TPM_SUCCESS) {
61                fprintf(stderr, "Could not start the TPM.\n");
62                return 1;
63            }
64
65            [...]
66            /* build TPM command */
67            [...]
68
69            res = TPMLIB_Process(&respbuffer, &resp_size,
70                                 &respbufsize,
71                                 command, command_size);
72            [...]
73
74            TPMLIB_Terminate();
75
76            return 0;
77        }
78

SEE ALSO

80       TPMLIB_Process(3), TPMLIB_RegisterCallbacks(3), TPMLIB_GetVersion(3)
81       TPMLIB_GetTPMProperty(3), TPMLIB_DecodeBlob(3)
82
83
84
85libtpms-0.5.1                     2011-08-30                TPMLIB_MAININIT(1)
Impressum