1TSS2_TCTI_TABRMD_INIT(3) TPM2 Software Stack TSS2_TCTI_TABRMD_INIT(3)
2
3
4
6 Tss2_Tcti_Tabrmd_Init - Initialization function for the tpm2-abrmd TCTI
7 library.
8
10 The Tss2_Tcti_Tabrmd_Init() function is used to initialize a TCTI con‐
11 text for communication with the tpm2-abrmd(8).
12
13 #include <tcti/tcti-tabrmd.h>
14
15 TSS2_RC Tss2_Tcti_Tabrmd_Init (TSS2_TCTI_CONTEXT *tcti_context, size_t
16 *size, const char *conf);
17
18
20 Tss2_Tcti_Tabrmd_Init() attempts to initialize a caller allocated
21 tcti_context of size size with configuration specified in the configu‐
22 ration string conf. . Since the tcti_context must be a caller allo‐
23 cated buffer, the caller needs to know the size required by the TCTI
24 library. The minimum size of this context can be discovered by provid‐
25 ing NULL for the tcti_context and a non- NULL size parameter. The ini‐
26 tialization function will then populate the size parameter with the
27 minimum size of the tcti_context buffer. The caller my then allocate a
28 buffer of this size (or larger) and call tss2_Tcti_Tabrmd_Init () again
29 providing the newly allocated tcti_context and the size of this context
30 in the size parameter. This pattern is common to all TCTI initializa‐
31 tion functions. We provide an example of this pattern using the
32 Tss2_Tcti_Tabrmd_Init() function in the section titled EXAMPLE.
33
34 The conf parameter is a string of key / value pairs describing the
35 desired connection properties for the TCTI. If the caller provides a
36 NULL conf string then defaults that correspond to the defaults for the
37 tpm2-abrmd (8) will be used. This is the same as providing the conf
38 string: "bus_name=com.intel.tss2.Tabrmd,bus_type=system". Keys and val‐
39 ues are separated by the '=' character while each key / value pair is
40 separated by the ',' character. The supported keys and values are:
41
42 · bus_name - the dbus name owned by the daemon. See the tpm2-abrmd (8)
43 --dbus-name option.
44
45 · bus_type - the bus type used for the connection with the daemon. The
46 value associated with this key may be either "system" or "session".
47
48Once initialized, the TCTI context returned exposes the Trusted Computing
49Group (TCG) defined API for the lowest level communication with the TPM.
50Using this API the caller can exchange (send / receive) TPM2 command and
51response buffers with the tpm2-abrmd (8). In nearly all cases however, the
52caller will initialize a context using this function before passing the con‐
53text to a higher level API like the System API (SAPI), and then never touch it
54again.
55
56For a more thorough discussion of the TCTI API see the “TSS System Level API
57and TPM Command Transmission Interface Specification” specification as pub‐
58lished by the TCG:
59https://trustedcomputinggroup.org/tss-system-level-api-tpm-command-transmission-interface-specification/
60
61
62
64 A successful call to Tss2_Tcti_Tabrmd_Init() will return TSS2_RC_SUC‐
65 CESS. An unsuccessful call will produce a response code described in
66 section ERRORS.
67
69 TSS2_TCTI_RC_BAD_VALUE is returned if the size parameter is NULL.
70
71 TSS2_TCTI_RC_NO_CONNECTION is returned when communication with the
72 tpm2-abrmd (8) fails.
73
74 TSS2_TCTI_RC_GENERAL_FAILURE is returned for all other errors.
75
76
78 #include <inttypes.h>
79 #include <stdlib.h>
80 #include <stdio.h>
81 #include <tcti/tcti-tabrmd.h>
82
83 TSS2_RC rc;
84 TSS2_TCTI_CONTEXT *tcti_context;
85 size_t size;
86
87 rc = tss2_tcti_tabrmd_init (NULL, &size, NULL,
88 if (rc != TSS2_RC_SUCCESS) {
89 fprintf (stderr, "Failed to get allocation size for tabrmd TCTI "
90 " context: 0x%" PRIx32 "0, rc);
91 exit (EXIT_FAILURE);
92 }
93 tcti_context = calloc (1, size);
94 if (tcti_context == NULL) {
95 fprintf (stderr, "Allocation for TCTI context failed: %s0,
96 strerror (errno));
97 exit (EXIT_FAILURE);
98 }
99 rc = tss2_tcti_tabrmd_init (tcti_context, &size, NULL);
100 if (rc != TSS2_RC_SUCCESS) {
101 fprintf (stderr, "Failed to initialize tabrmd TCTI context: "
102 "0x%" PRIx32 "0, rc);
103 free (tcti_context);
104 exit (EXIT_FAILURE);
105 }
106 exit (EXIT_SUCCESS);
107
109 Philip Tricca <philip.b.tricca@intel.com>
110
112 tcti-tabrmd(7), tpm2-abrmd(8)
113
115 This page is part of the 2.0.0 release of Intel's TPM2 Access Broker &
116 Resource Management Daemon. A description of the project, information
117 about reporting bugs, and the latest version of this page can be found
118 at https://github.com/01org/tpm2-abrmd/.
119
120
121
122Intel APRIL 2018 TSS2_TCTI_TABRMD_INIT(3)