TSS2_TCTI_TABRMD_INIT(3)

πŸ“¦
version 3.0.0 Β· 3 versions
, in alpine 3.24, arch rolling, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– TSS2_TCTI_TABRMD_INIT πŸ’–

okay bestie, gather round, because this one is literally the page for Tss2_Tcti_Tabrmd_Init β€” the initialization function for the tpm2-abrmd TCTI library, straight out of the TPM2 Software Stack manual. it's giving "hello, let me set up your whole connection to the daemon" energy and we're obsessed πŸ’…


✨ SYNOPSIS ✨

so Tss2_Tcti_Tabrmd_Init() is the function you call to spin up a TCTI context that talks to tpm2-abrmd(8). it's the intro, the meet-cute, the "hey let's be mutuals" of your TPM journey πŸ¦‹

first, the include β€” don't forget it, she's required:

#include <tcti/tcti-tabrmd.h>

and here's the signature, character for character, no cap:

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

🌸 DESCRIPTION 🌸

Tss2_Tcti_Tabrmd_Init() tries to initialize a caller allocated tcti_context of size size, using the configuration specified in the configuration string conf.

now, plot twist: since the tcti_context has to be a buffer you the caller allocated, you gotta know how big the TCTI library needs it to be. and here's the cute two-step β€” the minimum size of this context can be discovered by passing 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. then the caller may allocate a buffer of this size (or larger πŸ’) and call tss2_Tcti_Tabrmd_Init () again, handing over the newly allocated tcti_context and the size of this context in the size parameter.

this pattern? common to all TCTI initialization functions. it's a whole family tradition fr fr. we give you an example of this pattern using Tss2_Tcti_Tabrmd_Init() down in the section titled EXAMPLE, so don't stress 🌈

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. set it and forget it, main character energy πŸ’…

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. yeah, go read it, it's right there.


😭 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 🧚

here's the whole glow-up in code, copied exactly, no edits, bestie:

#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 "0, rc);
    exit (EXIT_FAILURE);
}
tcti_context = calloc (1, size);
if (tcti_context == NULL) {
    fprintf (stderr, "Allocation for TCTI context failed: %s0,
             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 "0, rc);
    free (tcti_context);
    exit (EXIT_FAILURE);
}
exit (EXIT_SUCCESS);

πŸ’œ AUTHOR πŸ’œ

Philip Tricca <philip.b.tricca@intel.com> β€” shoutout to the icon who wrote this πŸŽ€


🌈 SEE ALSO 🌈

iykyk, go read those next.


πŸŽ€ COLOPHON πŸŽ€

this page is part of the 3.0.0 release of Intel's TPM2 Access Broker & Resource Management Daemon. a description of the project, information about reporting bugs, and the latest version of this page can be found at https://github.com/01org/tpm2-abrmd/.

and that's the whole thing, bestie β€” dated APRIL 2018, from the fine folks at Intel, and she's serving TSS2_TCTI_TABRMD_INIT(3) realness. slay, periodt πŸ’…βœ¨πŸ¦‹