Tss2_TctiLdr_Initialize(3)
π Tss2_TctiLdr_Initialize β Library Functions Manual β¨
okay bestie, gather round, because today we're talking about Tss2_TctiLdr_Initialize(3) from the Tss2_TctiLdr_Initialize(3) manual page, and honestly? it's giving "let me spin up a TCTI context for you" energy π«Ά
π NAME π
Tss2_TctiLdr_Initialize, Tss2_TctiLdr_Initialize_Ex β instantiate and initialize a TCTI context. that's it, that's the whole vibe. one job, and they ate π
β¨ SYNOPSIS β¨
#include <tss2/tss2_tctildr.h>
TSS2_RC Tss2_TctiLdr_Initialize (const char *nameConf, TSS2_TCTI_CONTEXT
**context);
TSS2_RC Tss2_TctiLdr_Initialize_Ex (const char *name, const char *conf,
TSS2_TCTI_CONTEXT **context);
two functions, both returning a TSS2_RC, both handing you back a context. iconic behavior, no notes πΈ
π DESCRIPTION π
so like, Tss2_TctiLdr_Initialize() and Tss2_TctiLdr_Initialize_Ex() are the girlies that initialize a TCTI context. and what's a TCTI context for, you ask? it's for communicating with the TPM2, or with some intermediate component in the TCG TPM2 software stack. that's the whole point, that's the mission π«‘
Tss2_TctiLdr_Initialize() takes one single string that encodes both the name of the TCTI library you wanna instantiate and its desired configuration, and it lives in the nameConf parameter. nameConf is a string made of two substrings: name and conf, respectively. these substrings get combined with name first, separated by a single ':' / colon character, like so: 'name:conf'. for the tea on how these strings are encoded, go read the section titled TCTI CONFIG (it's right below, bestie, I got you π). the context parameter is what returns a reference to the TCTI context that the function created.
Tss2_TctiLdr_Initialize_Ex() behaves identically to Tss2_TctiLdr_Initialize(), except β and this is the only plot twist β the TCTI name and the configuration get passed as separate strings. the encoding of those strings is described in section TCTI_CONFIG. yes it's spelled slightly differently there, no I did not do that, the original did π
π¦ TCTI CONFIG π¦
okay this is the part where it gets juicy. if the name string is NULL or the emptry string (yes, "emptry", that's canon, I don't make the rules), then the initialization functions will select a default TCTI appropriate for the platform. on Linux this means it first tries to load a library named libtss2-tcti-default.so. this is a placeholder for distros to provide a distro specific default. it is recommended that this be a symlink to another installed TCTI library. if attempts to load this shared object fail, the implementation will attempt known TCTIs in the following order:
libtss2-tcti-tabrmd.so.0libtss2-tcti-device.so.0libtss2-tcti-mssim.so.0
when the name string is neither NULL nor the empty string, the implementation will attempt to dlopen a library with the given name. and if that fails, the implementation assumes it's been passed a shortened name and will attempt to load libraries by name with the following permutations:
<name>libtss2-tcti-<name>.so.0libtss2-tcti-<name>.so
the config string is not interpreted by the TctiLdr init functions at all β it's passed unaltered to the initialization function for the selected TCTI. the format for this string is TCTI specific. so like, not our problem, respectfully π
the Tss2_TctiLdr_Initialize function is passed the name and conf strings as a single parameter. in this case the name and conf strings are concatinated with a single ':' / colon character separating them. (again: "concatinated". the original said it. I'm just the messenger π«Ά)
for a more thorough discussion of the TCTILDR API see the βTCG TSS 2.0 TPM Command Transmission Interface (TCTI) API Specificationβ. go read it, it's giving academic baddie π
π RETURN VALUE π
a successful call to this function will return TSS2_RC_SUCCESS. an unsuccessful call will produce a response code described in section ERRORS. that's the deal, take it or leave it β¨
π ERRORS π
TSS2_TCTI_RC_MEMORYis returned if memory allocation failsTSS2_TCTI_RC_NOT_SUPPORTEDis returned when the loader is unable to locate a TCTI library with the provided nameTSS2_TCTI_RC_IO_ERRORis returned if a failure occurs in the underlying library loading mechanismTSS2_TCTI_RC_BAD_REFERENCEis returned if thetctiContextparameter isNULL
bestie if you're seeingTSS2_TCTI_RC_BAD_REFERENCEyou literally passed aNULLcontext. we've all been there. no judgement. fix it though π
π EXAMPLE π
example code. look at her go:
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <tss2/tss2_tctildr.h>
TSS2_TCTI_CONTEXT *ctx = NULL;
TSS2_RC rc = Tss2_TctiLdr_Initialize (NULL, &ctx);
if (rc != TSS2_RC_SUCCESS) {
fprintf (stderr, "Initialization of default TCTI context failed with "
"response code: 0x%" PRIx32 "0, rc);
exit (EXIT_FAILURE);
}
exit (EXIT_SUCCESS);
(that's verbatim, quote marks and all, don't come for me π)
π AUTHOR π
TPM2 Software Project <https://github.com/tpm2-software/tpm2-tss>
π SEE ALSO π
Tss2_Tcti_Device_Init(3), Tss2_Tcti_Socket_Init(3), Tss2_TctiLdr_Initialize(3), Tss2_TctiLdr_Finalize(3), tcti-device(7), tcti-socket(7), tcti-tabrmd(7), tpm2-abrmd(8)
iykyk, go read all of them, slay π§
π§ COLOPHON π§
this page is part of release 4.2.0 of Open Source implementation of the TCG TPM2 Software Stack (TSS2). a description of the project, information about reporting bugs, and the latest version of this page can be found at https://github.com/tpm2-software/tpm2-tss/.
π LICENSE π
this work is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0). for more information visit https://creativecommons.org/licenses/by/4.0/
and that's the whole page, bestie!! π this lil masterpiece came to you from the TPM2 Software Stack, dated MARCH 2019, and it's page Tss2_TctiLdr_Initialize(3) β go forth and initialize your contexts, you main character πβ¨
π¦ where this page comes from
- nixpkgs unstable: tpm2-tss 4.2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms