---
name: "Tss2_TctiLdr_Initialize"
section: "3"
platform: "linux"
package: "tpm2-tss"
version: "4.2.0-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Tss2_TctiLdr_Initialize"
---

# Tss2\_TctiLdr\_Initialize(3)

Instantiate and initialize a TCTI context.

## NAME

Tss2\_TctiLdr\_Initialize, Tss2\_TctiLdr\_Initialize\_Ex - Instantiate and initialize a TCTI context.

## 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***);**

## DESCRIPTION

The **Tss2\_TctiLdr\_Initialize**() and **Tss2\_TctiLdr\_Initialize\_Ex**() functions initialize a TCTI context used to communicate with the TPM2 or some intermediate component in the TCG TPM2 software stack.

**Tss2\_TctiLdr\_Initialize**() takes a single string that encodes both the name of the TCTI library the caller wishes to instantiate and its desired configuration in the *nameConf* parameter. *nameConf* is a string comprised of two substrings: *name* and *conf* parameters respectively. These substrings are combined with *name* first, separated by a single ':' / colon character: 'name:conf'. Consult the section titled TCTI CONFIG for information about the encoding of these strings. The *context* parameter is used to return a reference to the TCTI context created by the function.

**Tss2\_TctiLdr\_Initialize\_Ex**() behaves identically to the **Tss2\_TctiLdr\_Initialize**() function with the exception that the TCTI name and configuration are passed as separate strings. The encoding of these strings is described in section TCTI\_CONFIG.

## TCTI CONFIG

If the *name* string is NULL or the emptry string then the initialization functions will select a default TCTI appropriate for the platform. On Linux this means first trying 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 fails the implementation will attempt known TCTIs in the following order:

- •

  libtss2-tcti-tabrmd.so.0

- •

  libtss2-tcti-device.so.0

- •

  libtss2-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. If this fails then the implementation assumes it has been passed a shortened name and will attempt to load libraries by name with the following permutations:

- •

  \<name\>

- •

  libtss2-tcti-\<name\>.so.0

- •

  libtss2-tcti-\<name\>.so

The *config* string is not interpreted by the TctiLdr init functions and is passed unaltered to the initialization function for the selected TCTI. The format for this string is TCTI specific.

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.

For a more thorough discussion of the TCTILDR API see the “TCG TSS 2.0 TPM Command Transmission Interface (TCTI) API Specification”.

## 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.**

## ERRORS

**TSS2\_TCTI\_RC\_MEMORY** is returned if memory allocation fails

**TSS2\_TCTI\_RC\_NOT\_SUPPORTED** is returned when the loader is unable to locate a TCTI library with the provided *name*

**TSS2\_TCTI\_RC\_IO\_ERROR** is returned if a failure occurs in the underlying library loading mechanism

**TSS2\_TCTI\_RC\_BAD\_REFERENCE** is returned if the *tctiContext* parameter is NULL

## EXAMPLE

Example code.

```
#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);
```

## AUTHOR

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

## SEE ALSO

[**Tss2\_Tcti\_Device\_Init**(3)](/Tss2_Tcti_Device_Init/3.md), **Tss2\_Tcti\_Socket\_Init**(3), [**Tss2\_TctiLdr\_Initialize**(3)](/Tss2_TctiLdr_Initialize/3.md), [**Tss2\_TctiLdr\_Finalize**(3)](/Tss2_TctiLdr_Finalize/3.md), **tcti-device**(7), **tcti-socket**(7), **tcti-tabrmd**(7), [**tpm2-abrmd**(8)](/tpm2-abrmd/8.md)

## 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/
