Tss2_TctiLdr_Finalize(3)
β¨ Tss2_TctiLdr_Finalize(3) β¨
okay bestie, gather round π this one is from the Library Functions Manual, and it's the little cleanup queen of the TCTI loader world. she doesn't do much, but what she does is essential.
πΈ NAME πΈ
Tss2_TctiLdr_Finalize β the function that finalizes a TCTI context that was instantiated by the Tss2_TctiLdr_Initialize function. it's the goodbye hug. the closing tab. the "ok love u bye" π«Ά
π SYNOPSIS π
#include <tss2/tss2_tctildr.h>
TSS2_RC Tss2_TctiLdr_Finalize (TSS2_TCTI_CONTEXT **CONTEXT);
like yes, she's a function, and yes, she returns a TSS2_RC up there in the signature, but babe β read the RETURN VALUE section before you @ me π
π DESCRIPTION π
so. Tss2_TctiLdr_Finalize() destroys an instance of a TCTI context that got instantiated by the Tss2_TctLdr_Initialize() function. it also frees any resources associated with loading the required TCTI library β so like, not just the context itself, but the whole loading situation too. full cleanup. main character exit. β¨
the context parameter is a double pointer to a TCTI context. and here's the cute part: when it's successfully finalized, the provided reference gets set to NULL by the function. she doesn't leave dangling pointers behind, she's not messy like that π
heads up bestie: it's a double pointer (**CONTEXT) for a reason β she needs to reach back and null out your pointer for you. don't fight it, just pass the address. π«Ά
β RETURN VALUE β
This function returns no value. that's it. that's the whole section. she's too iconic to give you a return code, ngl π
π₯ EXAMPLE π₯
Example code. (yes the vibes are immaculate, no we did not write it, we're just passing it along fr fr)
#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, 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);
}
if (ctx != NULL)
Tss2_TctiLdr_Finalize (&ctx);
exit (EXIT_SUCCESS);
see how she checks if (ctx != NULL) first before finalizing? that's the vibe check β
only say bye if there's actually someone to say bye to.
π AUTHOR π
TPM2 Software Project <https://github.com/tpm2-software/tpm2-tss> β the legends themselves, no cap π«‘
π¦ 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)
go read the Initialize one too so you know what you're finalizing, iykyk π
π 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/> β share it, remix it, just credit the girlies π
okay that's the whole page, bestie!! this one shipped with the TPM2 Software Stack, dated MARCH 2019 (a vintage era, honestly), from release 4.2.0 of the Open Source implementation of the TCG TPM2 Software Stack (TSS2). now go NULL out those pointers responsibly. mwah πβ¨
π¦ where this page comes from
- arch rolling: tpm2-tss 4.2.0-2 Β· BSD-2-Clause
- nixos 26.05: tpm2-tss 4.2.0
- 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