mirror of
https://github.com/stefanberger/libtpms
synced 2025-12-31 02:55:54 +00:00
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>
93 lines
1.9 KiB
Plaintext
93 lines
1.9 KiB
Plaintext
=head1 NAME
|
|
|
|
TPMLIB_MainInit - Initialize the TPM
|
|
|
|
TPMLIB_Terminate - Terminate the TPM
|
|
|
|
=head1 LIBRARY
|
|
|
|
TPM library (libtpms, -ltpms)
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
B<#include <libtpms/tpm_types.h>>
|
|
|
|
B<#include <libtpms/tpm_library.h>>
|
|
|
|
B<#include <libtpms/tpm_error.h>>
|
|
|
|
B<TPM_RESULT TPMLIB_MainInit(void);>
|
|
|
|
B<TPM_RESULT TPMLIB_Terminate(void);>
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
The B<TPMLIB_MainInit()> and B<TPMLIB_Terminate()> functions are used
|
|
to initialize and terminate the TPM respectively. The B<TPMLIB_MainInit()>
|
|
function must be called before the TPM processes any TPM command.
|
|
The B<TPMLIB_Terminate()> function is called to free all the internal
|
|
resources (memory allocations) the TPM has used and must be called after
|
|
the last TPM command was processed by the TPM. The B<TPMLIB_MainInit()>
|
|
function can then be called again.
|
|
|
|
=head1 ERRORS
|
|
|
|
=over 4
|
|
|
|
=item B<TPM_SUCCESS>
|
|
|
|
The function completed sucessfully.
|
|
|
|
=item B<TPM_FAIL>
|
|
|
|
General failure.
|
|
|
|
=back
|
|
|
|
For a complete list of TPM error codes please consult the include file
|
|
B<libtpms/tpm_error.h>
|
|
|
|
=head1 EXAMPLE
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <libtpms/tpm_types.h>
|
|
#include <libtpms/tpm_library.h>
|
|
#include <libtpms/tpm_error.h>
|
|
|
|
int main(void) {
|
|
TPM_RESULT res;
|
|
unsigned char *respbuffer = NULL;
|
|
uint32_t resp_size = 0;
|
|
uint32_t respbufsize = 0;
|
|
unsigned char *command;
|
|
uint32_t command_size;
|
|
|
|
[...]
|
|
|
|
if (TPMLIB_MainInit() != TPM_SUCCESS) {
|
|
fprintf(stderr, "Could not start the TPM.\n");
|
|
return 1;
|
|
}
|
|
|
|
[...]
|
|
/* build TPM command */
|
|
[...]
|
|
|
|
res = TPMLIB_Process(&respbuffer, &resp_size,
|
|
&respbufsize,
|
|
command, command_size);
|
|
[...]
|
|
|
|
TPMLIB_Terminate();
|
|
|
|
return 0;
|
|
}
|
|
|
|
=head1 SEE ALSO
|
|
|
|
B<TPMLIB_Process>(3), B<TPMLIB_RegisterCallbacks>(3), B<TPMLIB_GetVersion>(3)
|
|
B<TPMLIB_GetTPMProperty>(3), B<TPMLIB_DecodeBlob>(3)
|
|
|
|
=cut
|