libtpms/man/man3/TPM_Malloc.pod
Corey Bryant a0098eda2d Initial import of project
This is the initial import of the libtpms library.  The libtpms library
provides software emulation of a Trusted Platform Module (TPM).  It is
intended to be used by applications when a hardware TPM is not adequate.
For example, a hypervisor can use libtpms to emulate an independent TPM
for each of it's virtual machine guests.  The library provides a high-
level API for developers to integrate the emulated TPM support into
their application.

The code was originally written by Kenneth Goldman <kgoldman@us.ibm.com>
and Stefan Berger <stefanb@us.ibm.com>.

The code is licensed under the Modified BSD License.

Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
2013-10-31 15:33:22 -05:00

73 lines
1.8 KiB
Plaintext

=head1 NAME
TPM_Malloc - Allocate memory
TPM_Realloc - Reallocate memory
TPM_Free - Free memory
=head1 SYNOPSIS
B<#include <libtpms/tpm_types.h>>
B<#include <libtpms/tpm_memory.h>>
B<#include <libtpms/tpm_error.h>>
B<TPM_RESULT TPM_Malloc(unsigned char> **I<buffer>B<,
uint32_t> I<size>B<);>
B<TPM_RESULT TPM_Realloc(unsigned char> **I<buffer>B<,
uint32_t> I<size>B<);>
B<void TPM_Free(unsigned char> *I<buffer>B<);>
=head1 DESCRIPTION
The B<TPM_Malloc()> function is used to allocate a buffer of the given size.
The allocated buffer will be returned in the I<buffer> parameter.
The B<TPM_Realloc()> function is used to resize a buffer. The new size of
the buffer is given in the I<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 B<TPM_ALLOC_MAX> (64k) bytes. This size is sufficent
for all buffers needed by the TPM.
Upon successful completion, the functions return B<TPM_SUCCESS>. In case the
requested buffer exceeds the limit, B<TPM_SIZE> will be returned. See further
possible error codes below.
The B<TPM_Free()> function frees the memory previously allocated using
either B<TPM_Malloc()> or B<TPM_Realloc()>.
=head1 ERRORS
=over 4
=item B<TPM_SUCCESS>
The function completed sucessfully.
=item B<TPM_SIZE>
The size of the requested buffer exceeds the limit or the
system is out of memory.
=item B<TPM_FAIL>
Requested buffer is of size 0.
=back
For a complete list of TPM error codes please consult the include file
B<libtpms/tpm_error.h>
=head1 SEE ALSO
B<TPMLIB_MainInit>(3), B<TPMLIB_Terminate>(3)
B<TPMLIB_Process>(3), B<TPMLIB_RegisterCallbacks>(3), B<TPMLIB_GetVersion>(3)
=cut