TPM_Malloc - Allocate memory
TPM_Realloc - Reallocate memory
TPM_Free - Free memory
TPM_RESULT TPM_Malloc(unsigned char **buffer,
TPM_RESULT TPM_Realloc(unsigned char
void TPM_Free(unsigned char *buffer);
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().
- The function completed successfully.
- The size of the requested buffer exceeds the limit or the system is out of memory.
- Requested buffer is of size 0.
For a complete list of TPM error codes please consult the include file libtpms/tpm_error.h