1 | =head1 NAME
|
---|
2 |
|
---|
3 | TPMLIB_MainInit - Initialize the TPM
|
---|
4 |
|
---|
5 | TPMLIB_Terminate - Terminate the TPM
|
---|
6 |
|
---|
7 | =head1 LIBRARY
|
---|
8 |
|
---|
9 | TPM library (libtpms, -ltpms)
|
---|
10 |
|
---|
11 | =head1 SYNOPSIS
|
---|
12 |
|
---|
13 | B<#include <libtpms/tpm_types.h>>
|
---|
14 |
|
---|
15 | B<#include <libtpms/tpm_library.h>>
|
---|
16 |
|
---|
17 | B<#include <libtpms/tpm_error.h>>
|
---|
18 |
|
---|
19 | B<TPM_RESULT TPMLIB_MainInit(void);>
|
---|
20 |
|
---|
21 | B<TPM_RESULT TPMLIB_Terminate(void);>
|
---|
22 |
|
---|
23 | =head1 DESCRIPTION
|
---|
24 |
|
---|
25 | The B<TPMLIB_MainInit()> and B<TPMLIB_Terminate()> functions are used
|
---|
26 | to initialize and terminate the TPM respectively. The B<TPMLIB_MainInit()>
|
---|
27 | function must be called before the TPM processes any TPM command.
|
---|
28 | The B<TPMLIB_Terminate()> function is called to free all the internal
|
---|
29 | resources (memory allocations) the TPM has used and must be called after
|
---|
30 | the last TPM command was processed by the TPM. The B<TPMLIB_MainInit()>
|
---|
31 | function can then be called again.
|
---|
32 |
|
---|
33 | Use B<TPMLIB_RegisterCallbacks()> to set callback functions for
|
---|
34 | initialization and writing and restoring the internal state in a
|
---|
35 | portable format.
|
---|
36 |
|
---|
37 | =head1 ERRORS
|
---|
38 |
|
---|
39 | =over 4
|
---|
40 |
|
---|
41 | =item B<TPM_SUCCESS>
|
---|
42 |
|
---|
43 | The function completed successfully.
|
---|
44 |
|
---|
45 | =item B<TPM_FAIL>
|
---|
46 |
|
---|
47 | General failure.
|
---|
48 |
|
---|
49 | =back
|
---|
50 |
|
---|
51 | For a complete list of TPM error codes please consult the include file
|
---|
52 | B<libtpms/tpm_error.h>
|
---|
53 |
|
---|
54 | =head1 EXAMPLE
|
---|
55 |
|
---|
56 | #include <stdio.h>
|
---|
57 |
|
---|
58 | #include <libtpms/tpm_types.h>
|
---|
59 | #include <libtpms/tpm_library.h>
|
---|
60 | #include <libtpms/tpm_error.h>
|
---|
61 |
|
---|
62 | int main(void) {
|
---|
63 | TPM_RESULT res;
|
---|
64 | unsigned char *respbuffer = NULL;
|
---|
65 | uint32_t resp_size = 0;
|
---|
66 | uint32_t respbufsize = 0;
|
---|
67 | unsigned char *command;
|
---|
68 | uint32_t command_size;
|
---|
69 |
|
---|
70 | [...]
|
---|
71 |
|
---|
72 | if (TPMLIB_MainInit() != TPM_SUCCESS) {
|
---|
73 | fprintf(stderr, "Could not start the TPM.\n");
|
---|
74 | return 1;
|
---|
75 | }
|
---|
76 |
|
---|
77 | [...]
|
---|
78 | /* build TPM command */
|
---|
79 | [...]
|
---|
80 |
|
---|
81 | res = TPMLIB_Process(&respbuffer, &resp_size,
|
---|
82 | &respbufsize,
|
---|
83 | command, command_size);
|
---|
84 | [...]
|
---|
85 |
|
---|
86 | TPMLIB_Terminate();
|
---|
87 |
|
---|
88 | return 0;
|
---|
89 | }
|
---|
90 |
|
---|
91 | =head1 SEE ALSO
|
---|
92 |
|
---|
93 | B<TPMLIB_Process>(3), B<TPMLIB_RegisterCallbacks>(3), B<TPMLIB_GetVersion>(3)
|
---|
94 | B<TPMLIB_GetTPMProperty>(3), B<TPMLIB_DecodeBlob>(3)
|
---|
95 |
|
---|
96 | =cut
|
---|