table of contents
TPM_Malloc(3) | TPM_Malloc(3) |
NAME¶
TPM_Malloc - Allocate memory
TPM_Realloc - Reallocate memory
TPM_Free - Free memory
SYNOPSIS¶
#include <libtpms/tpm_types.h>
#include <libtpms/tpm_memory.h>
#include <libtpms/tpm_error.h>
TPM_RESULT TPM_Malloc(unsigned char **buffer,
uint32_t size);
TPM_RESULT TPM_Realloc(unsigned char
**buffer,
uint32_t size);
void TPM_Free(unsigned char *buffer);
DESCRIPTION¶
The TPM_Malloc() function is used to allocate a buffer of the given size. The allocated buffer will be returned in the buffer parameter.
The TPM_Realloc() function is used to resize a buffer. The new size of the buffer is given in the size parameter. The reallocated buffer will contain the data from the original buffer.
Both functions have the restriction that the buffer they can allocate is limited to TPM_ALLOC_MAX (64k) bytes. This size is sufficient for all buffers needed by the TPM.
Upon successful completion, the functions return TPM_SUCCESS. In case the requested buffer exceeds the limit, TPM_SIZE will be returned. See further possible error codes below.
The TPM_Free() function frees the memory previously allocated using either TPM_Malloc() or TPM_Realloc().
ERRORS¶
- TPM_SUCCESS
- The function completed successfully.
- TPM_SIZE
- The size of the requested buffer exceeds the limit or the system is out of memory.
- TPM_FAIL
- Requested buffer is of size 0.
For a complete list of TPM error codes please consult the include file libtpms/tpm_error.h
SEE ALSO¶
TPMLIB_MainInit(3), TPMLIB_Terminate(3) TPMLIB_Process(3), TPMLIB_RegisterCallbacks(3), TPMLIB_GetVersion(3)
2024-12-06 | libtpms |