Tss2_TctiLdr_GetInfo(3)

πŸ’– Tss2_TctiLdr_GetInfo(3) πŸ’–

okay bestie, welcome to the Library Functions Manual corner of the internet, where we ask the TctiLdr library politely (or not so politely) to hand over the TSS2_TCTI_INFO struct for a TCTI library. this is Tss2_TctiLdr_GetInfo, and she is iconic. let's get into it πŸ¦‹


✨ NAME ✨

Tss2_TctiLdr_GetInfo β€” query the TctiLdr library for the TSS2_TCTI_INFO structure that's associated with a TCTI library. that's the whole gig. she's a looker-upper πŸ’…


🌸 SYNOPSIS 🌸

#include <tss2/tss2_tctildr.h>

TSS2_RC Tss2_TctiLdr_GetInfo (constchar *name", TSS2_TCTI_INFO **info);
yes babe, that really is how it's printed, character for character. i don't make the rules, i just serve the vibes ✨

πŸŽ€ DESCRIPTION πŸŽ€

so Tss2_TctiLdr_GetInfo() tries to instantiate a TSS2_TCTI_INFO structure that fits the TCTI library tied to the name you hand her. and heads up: the TSS2_TCTI_INFO* reference she gives back? you have to free it yourself with the Tss2_TctiLdr_FreeInfo () function. no ghosting, no leaking, we are responsible queens 🫢

the name parameter is a C string. if that string is NULL, the library picks a default TCTI for you β€” and it's literally the same TCTI library that gets used to initialize the context returned by Tss2_TctiLdr_Initialize when you pass it a NULL name. consistency, we love to see it. if name is non-NULL, then Tss2_TctiLdr_GetInfo () uses the exact same algorithm to map that string to the name of an installed TCTI library as Tss2_TctiLdr_Initialize () does. same brain, same algorithm 🧚

the info parameter is a reference to a TSS2_TCTI_INFO*. the reference that comes back is allocated by the function, and yeah β€” the caller has to free it. that's you. that's your job now. main character responsibility 😭


⭐ RETURN VALUE ⭐

a successful call returns TSS2_RC_SUCCESS. an unsuccessful call returns a response code, and those are all listed right below in ERRORS. no mystery, no cliffhanger 🌈


πŸ’€ ERRORS πŸ’€

  • TSS2_TCTI_RC_MEMORY β€” comes back if memory allocation fails. the malloc said no πŸ’€
  • TSS2_TCTI_RC_NOT_SUPPORTED β€” comes back when the loader literally cannot locate a TCTI library with the name you provided. she looked everywhere bestie πŸ™ˆ
  • TSS2_TCTI_RC_IO_ERROR β€” comes back if something goes wrong down in the underlying library loading mechanism. it's giving plumbing problems πŸ”₯
  • TSS2_TCTI_RC_BAD_REFERENCE β€” comes back if the info parameter is NULL. bestie. you have to actually give her somewhere to put it 😭

πŸ“ EXAMPLE πŸ“

example code. yes, verbatim, every character, we do not touch the sacred text ✨

#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>

#include <tss2/tss2_tctildr.h>

TSS2_TCTI_INFO *info = NULL;
TSS2_RC rc = Tss2_TctiLdr_GetInfo (NULL, &info);
if (rc != TSS2_RC_SUCCESS) {
    fprintf (stderr, "Initialization of default TCTI context failed with "
             "response code: 0x%" PRIx32 "0, rc);
    exit (EXIT_FAILURE);
}

if (info != NULL) {
    Tss2_TctiLdr_FreeInfo (info);
    info = NULL;
}

exit (EXIT_SUCCESS);

see how she frees the info and then nulls it out? that's the self-care we're talking about πŸ‘‘


πŸ‘‘ AUTHOR πŸ‘‘

TPM2 Software Project <https://github.com/tpm2-software/tpm2-tss>

the icons who wrote her πŸ’œ


🌈 SEE ALSO 🌈

the whole friend group, go say hi 🫢


🧚 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, info about reporting bugs, and the latest version of this page all live 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 β€” brought to you by the TPM2 Software Stack, dated JUNE 2019. she's been slaying since 2019 and she will keep slaying. mwah πŸ’…πŸ’–

πŸ“¦ where this page comes from