TSS2_TCTI_TABRMD_INIT(3)

NAME
Tss2_Tcti_Tabrmd_Init - Initialization function for the tpm2-abrmd TCTI library.

SYNOPSIS
The Tss2_Tcti_Tabrmd_Init() function is used to initialize a TCTI context for communication with the tpm2-abrmd(8).

#include <tcti/tcti-tabrmd.h>

TSS2_RC Tss2_Tcti_Tabrmd_Init (TSS2_TCTI_CONTEXT *tcti_context, size_t *size, const char *conf);

DESCRIPTION
Tss2_Tcti_Tabrmd_Init() attempts to initialize a caller allocated tcti_context of size size with configuration specified in the configuration string conf. . Since the tcti_context must be a caller allocated buffer, the caller needs to know the size required by the TCTI library. The minimum size of this context can be discovered by providing NULL for the tcti_context and a non- NULL size parameter. The initialization function will then populate the size parameter with the minimum size of the tcti_context buffer. The caller my then allocate a buffer of this size (or larger) and call tss2_Tcti_Tabrmd_Init () again providing the newly allocated tcti_context and the size of this context in the size parameter. This pattern is common to all TCTI initialization functions. We provide an example of this pattern using the Tss2_Tcti_Tabrmd_Init() function in the section titled EXAMPLE.

The conf parameter is a string of key / value pairs describing the desired connection properties for the TCTI. If the caller provides a NULL conf string then defaults that correspond to the defaults for the tpm2-abrmd (8) will be used. This is the same as providing the conf string: "bus_name=com.intel.tss2.Tabrmd,bus_type=system". Keys and values are separated by the '=' character while each key / value pair is separated by the ',' character. The supported keys and values are:

•   bus_name - the dbus name owned by the daemon. See the tpm2-abrmd (8) --dbus-name option.

•   bus_type - the bus type used for the connection with the daemon. The value associated with this key may be either "system" or "session".

Once initialized, the TCTI context returned exposes the Trusted Computing Group (TCG) defined API for the lowest level communication with the TPM. Using this API the caller can exchange (send / receive) TPM2 command and response buffers with the tpm2-abrmd (8). In nearly all cases however, the caller will initialize a context using this function before passing the context to a higher level API like the System API (SAPI), and then never touch it again.

For a more thorough discussion of the TCTI API see the “TSS System Level API and TPM Command Transmission Interface Specification” specification as published by the TCG: https://trustedcomputinggroup.org/tss-system-level-api-tpm-command-transmission-interface-specification/

RETURN VALUE
A successful call to Tss2_Tcti_Tabrmd_Init() will return TSS2_RC_SUCCESS. An unsuccessful call will produce a response code described in section ERRORS.

ERRORS
TSS2_TCTI_RC_BAD_VALUE is returned if the size parameter is NULL.

TSS2_TCTI_RC_NO_CONNECTION is returned when communication with the tpm2-abrmd (8) fails.

TSS2_TCTI_RC_GENERAL_FAILURE is returned for all other errors.

EXAMPLE
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <tcti/tcti-tabrmd.h>
TSS2_RC rc;
TSS2_TCTI_CONTEXT *tcti_context;
size_t size;
rc = tss2_tcti_tabrmd_init (NULL, &size, NULL,
if (rc != TSS2_RC_SUCCESS) {
    fprintf (stderr, "Failed to get allocation size for tabrmd TCTI "
             " context: 0x%" PRIx32 ", rc);
    exit (EXIT_FAILURE);
}
tcti_context = calloc (1, size);
if (tcti_context == NULL) {
    fprintf (stderr, "Allocation for TCTI context failed: %s,
             strerror (errno));
    exit (EXIT_FAILURE);
}
rc = tss2_tcti_tabrmd_init (tcti_context, &size, NULL);
if (rc != TSS2_RC_SUCCESS) {
    fprintf (stderr, "Failed to initialize tabrmd TCTI context: "
             "0x%" PRIx32 ", rc);
    free (tcti_context);
    exit (EXIT_FAILURE);
}
exit (EXIT_SUCCESS);

AUTHOR
Philip Tricca <philip.b.tricca@intel.com>

SEE ALSO
tcti-tabrmd(7), tpm2-abrmd(8)