1 | =head1 NAME
|
---|
2 |
|
---|
3 | TPM_Malloc - Allocate memory
|
---|
4 |
|
---|
5 | TPM_Realloc - Reallocate memory
|
---|
6 |
|
---|
7 | TPM_Free - Free memory
|
---|
8 |
|
---|
9 | =head1 SYNOPSIS
|
---|
10 |
|
---|
11 | B<#include <libtpms/tpm_types.h>>
|
---|
12 |
|
---|
13 | B<#include <libtpms/tpm_memory.h>>
|
---|
14 |
|
---|
15 | B<#include <libtpms/tpm_error.h>>
|
---|
16 |
|
---|
17 | B<TPM_RESULT TPM_Malloc(unsigned char> **I<buffer>B<,
|
---|
18 | uint32_t> I<size>B<);>
|
---|
19 |
|
---|
20 | B<TPM_RESULT TPM_Realloc(unsigned char> **I<buffer>B<,
|
---|
21 | uint32_t> I<size>B<);>
|
---|
22 |
|
---|
23 | B<void TPM_Free(unsigned char> *I<buffer>B<);>
|
---|
24 |
|
---|
25 | =head1 DESCRIPTION
|
---|
26 |
|
---|
27 | The B<TPM_Malloc()> function is used to allocate a buffer of the given size.
|
---|
28 | The allocated buffer will be returned in the I<buffer> parameter.
|
---|
29 |
|
---|
30 | The B<TPM_Realloc()> function is used to resize a buffer. The new size of
|
---|
31 | the buffer is given in the I<size> parameter. The reallocated buffer will
|
---|
32 | contain the data from the original buffer.
|
---|
33 |
|
---|
34 | Both functions have the restriction that the buffer they can allocate
|
---|
35 | is limited to B<TPM_ALLOC_MAX> (64k) bytes. This size is sufficient
|
---|
36 | for all buffers needed by the TPM.
|
---|
37 |
|
---|
38 | Upon successful completion, the functions return B<TPM_SUCCESS>. In case the
|
---|
39 | requested buffer exceeds the limit, B<TPM_SIZE> will be returned. See further
|
---|
40 | possible error codes below.
|
---|
41 |
|
---|
42 | The B<TPM_Free()> function frees the memory previously allocated using
|
---|
43 | either B<TPM_Malloc()> or B<TPM_Realloc()>.
|
---|
44 |
|
---|
45 | =head1 ERRORS
|
---|
46 |
|
---|
47 | =over 4
|
---|
48 |
|
---|
49 | =item B<TPM_SUCCESS>
|
---|
50 |
|
---|
51 | The function completed successfully.
|
---|
52 |
|
---|
53 | =item B<TPM_SIZE>
|
---|
54 |
|
---|
55 | The size of the requested buffer exceeds the limit or the
|
---|
56 | system is out of memory.
|
---|
57 |
|
---|
58 | =item B<TPM_FAIL>
|
---|
59 |
|
---|
60 | Requested buffer is of size 0.
|
---|
61 |
|
---|
62 | =back
|
---|
63 |
|
---|
64 | For a complete list of TPM error codes please consult the include file
|
---|
65 | B<libtpms/tpm_error.h>
|
---|
66 |
|
---|
67 | =head1 SEE ALSO
|
---|
68 |
|
---|
69 | B<TPMLIB_MainInit>(3), B<TPMLIB_Terminate>(3)
|
---|
70 | B<TPMLIB_Process>(3), B<TPMLIB_RegisterCallbacks>(3), B<TPMLIB_GetVersion>(3)
|
---|
71 |
|
---|
72 | =cut
|
---|