Tss2\_TctiLdr\_Initialize(3) Library Functions Manual Tss2\_TctiLdr\_Initialize(3)

# [NAME](#NAME)

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

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;tss2/tss2\_tctildr.h&gt;**

**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](#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](#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:

•

&lt;name&gt;

•

libtss2-tcti-&lt;name&gt;.so.0

•

libtss2-tcti-&lt;name&gt;.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](#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](#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)

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](#AUTHOR)

TPM2 Software Project &lt;https://github.com/tpm2-software/tpm2-tss&gt;

# [SEE ALSO](#SEE_ALSO)

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

# [COLOPHON](#COLOPHON)

This page is part of release 4.2.1 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](#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/

MARCH 2019 TPM2 Software Stack

---

Document: Tss2_TctiLdr_Initialize(3) from tpm2-tss 4.2.1-r0 (Chainguard OS)
Source: https://github.com/tpm2-software/tpm2-tss
