VirtualBox

source: vbox/trunk/src/libs/libtpms-0.9.0/man/man3/TPMLIB_Process.pod@ 91612

最後變更 在這個檔案從91612是 91612,由 vboxsync 提交於 3 年 前

src/libs: Export libtpms-0.9.0, bugref:10078

檔案大小: 2.8 KB
 
1=head1 NAME
2
3TPMLIB_Process - process a TPM command
4
5=head1 LIBRARY
6
7TPM library (libtpms, -ltpms)
8
9=head1 SYNOPSIS
10
11B<#include <libtpms/tpm_library.h>>
12
13B<#include <libtpms/tpm_error.h>>
14
15B<TPM_RESULT TPMLIB_Process(unsigned char> **I<respbuffer>B<,
16 uint32_t> *I<resp_size>B<,
17 uint32_t> *I<respbufsize>B<,
18 unsigned char> *I<command>B<,
19 uint32_t> I<command_size>B<);>
20
21=head1 DESCRIPTION
22
23The B<TPMLIB_Process()> function is used to send TPM commands to the TPM
24and receive the results.
25
26The I<command> parameter provides the buffer for the TPM command and
27the I<command_size> the number of valid TPM command bytes within that buffer.
28
29The I<respbuffer> is a pointer to a buffer where the TPM will return its
30result. If no buffer is given (I<respbuffer> is NULL), the TPM will
31allocate a buffer. The parameter I<resp_size> returns the number of valid
32TPM response bytes in the buffer. The number of valid bytes in the response
33is guaranteed to not exceed the maximum I/O buffer size. Use the
34I<TPMLIB_GetTPMProperty()> API and parameter I<TPMPROP_TPM_BUFFER_MAX> for
35getting the maximum size.
36The user must indicate the size of a provided buffer with the I<respbufsize>
37parameter. If the buffer is not big enough for the response, the TPM will
38free the provided buffer and allocate one of sufficient size and adapt
39I<respbufsize>. The returned buffer is only subject to size restrictions
40as explained for I<TPM_Malloc()>.
41
42=head1 ERRORS
43
44=over 4
45
46=item B<TPM_SUCCESS>
47
48The function completed successfully.
49
50=item B<TPM_FAIL>
51
52General failure.
53
54=back
55
56For a complete list of TPM error codes please consult the include file
57B<libtpms/tpm_error.h>
58
59=head1 EXAMPLE
60
61 #include <stdio.h>
62
63 #include <libtpms/tpm_types.h>
64 #include <libtpms/tpm_library.h>
65 #include <libtpms/tpm_error.h>
66
67 static unsigned char TPM_Startup_ST_CLEAR[] = {
68 0x00, 0xC1, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x99,
69 0x00, TPM_ST_CLEAR
70 };
71
72 int main(void) {
73 TPM_RESULT res;
74 unsigned char *respbuffer = NULL;
75 uint32_t resp_size = 0;
76 uint32_t respbufsize = 0;
77 unsigned char *command;
78 uint32_t command_size;
79
80 [...]
81
82 if (TPMLIB_MainInit() != TPM_SUCCESS) {
83 fprintf(stderr, "Could not start the TPM.\n");
84 return 1;
85 }
86
87 [...]
88 /* build TPM command */
89 command = TPM_Startup_ST_CLEAR;
90 command_size = sizeof(TPM_Startup_ST_CLEAR);
91 [...]
92
93 res = TPMLIB_Process(&respbuffer, &resp_size,
94 &respbufsize,
95 command, command_size);
96 [...]
97
98 TPMLIB_Terminate();
99
100 return 0;
101 }
102
103=head1 SEE ALSO
104
105B<TPMLIB_MainInit>(3), B<TPMLIB_Terminate>(3), B<TPMLIB_RegisterCallbacks>(3)
106B<TPMLIB_GetTPMProperty>(3), B<TPMLIB_Malloc>(3), B<TPMLIB_Realloc>(3)
107
108=cut
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette