1TSS2_TCTI_TABRMD_INIT(3) TPM2 Software Stack TSS2_TCTI_TABRMD_INIT(3)
2
3
4
6 tss2_tcti_tabrmd_init, tss2_tcti_tabrmd_init_full - Initialization
7 functions for the tpm2-abrmd TCTI library.
8
10 The tss2_tcti_tabrmd_init() and tss2_tcti_tabrmd_init_full() functions
11 are used to initialize a TCTI context for communication with the
12 tpm2-abrmd(8).
13
14 #include <tcti/tcti-tabrmd.h>
15
16 TSS2_RC tss2_tcti_tabrmd_init (TSS2_TCTI_CONTEXT *tcti_context, size_t
17 *size);
18
19 TSS2_RC tss2_tcti_tabrmd_init_full (TSS2_TCTI_CONTEXT *tcti_context,
20 size_t *size, GBusTypebus_type, const char*bus_name);
21
22
24 tss2_tcti_tabrmd_init() attempts to initialize a caller allocated
25 tcti_context of size size . Since the tcti_context must be a caller
26 allocated buffer, the caller needs to know the size required by the
27 TCTI library. The minimum size of this context can be discovered by
28 providing NULL for the tcti_context and a non- NULL size parameter. The
29 initialization function will then populate the size parameter with the
30 minimum size of the tcti_context buffer. The caller my then allocate a
31 buffer of this size (or larger) and call tss2_tcti_tabrmd_init () again
32 providing the newly allocated tcti_context and the size of this context
33 in the size parameter.
34
35 This patterm is common to all TCTI initialization functions. We provide
36 an example of this pattern using the tss2_tcti_tabrmd_init() function
37 in the section titled EXAMPLE.
38
39 Once initialized, the TCTI context returned exposes the Trusted Comput‐
40 ing Group (TCG) defined API for the lowest level communication with the
41 TPM. Using this API the caller can exchange (send / receive) TPM2 com‐
42 mand and respons buffers with the tpm2-abrmd (8). In nearly all cases
43 however, the caller will initialize a context using this funnction
44 before passing the context to a higher level API like the System API
45 (SAPI), and then never touch it again.
46
47 For a more thorough discussion of the TCTI API see the “TSS System
48 Level API and TPM Command Transmission Interface Specification” speci‐
49 fication as published by the TCG:
50 https://trustedcomputinggroup.org/tss-system-level-api-tpm-command-transmission-interface-specification/
51
52 tss2_tcti_tabrmd_init_full () behaves in the same way as
53 tss2_tcti_tabrmd_init () but allows for greater flexibility through two
54 additional parameters: The bus_type and bus_name parameters may be used
55 to select which D-Bus bus type and name used to connect to an instance
56 of the tpm2-abrmd (8) daemon.
57
58
60 A successful call to tss2_tcti_tabrmd_init() and
61 tss2_tcti_tabrmd_init_full() will return TSS2_RC_SUCCESS. An unsuc‐
62 cessful call will produce a response code described in section ERRORS.
63
65 TSS2_TCTI_RC_BAD_VALUE is returned if both the tcti_context and the
66 size parameters are NULL, or the bus_name is NULL, or the bus_type is
67 not a supported type (G_BUS_TYPE_SYSTEM OR G_BUS_TYPE_SESSION).
68
69 All errors caused by communication failures with the tpm2-abrmd (8) are
70 treated as fatal errors and will call the calling application to termi‐
71 nate.
72
73
75 #include <inttypes.h>
76 #include <stdlib.h>
77 #include <stdio.h>
78 #include <tcti/tcti-tabrmd.h>
79
80 TSS2_RC rc;
81 TSS2_TCTI_CONTEXT *tcti_context;
82 size_t size;
83
84 rc = tss2_tcti_tabrmd_init (NULL, &size);
85 if (rc != TSS2_RC_SUCCESS) {
86 fprintf (stderr, "Failed to get allocation size for tabrmd TCTI "
87 " context: 0x%" PRIx32 "0, rc);
88 exit (EXIT_FAILURE);
89 }
90 tcti_context = calloc (1, size);
91 if (tcti_context == NULL) {
92 fprintf (stderr, "Allocation for TCTI context failed: %s0,
93 strerror (errno));
94 exit (EXIT_FAILURE);
95 }
96 rc = tss2_tcti_tabrmd_init (tcti_context, &size);
97 if (rc != TSS2_RC_SUCCESS) {
98 fprintf (stderr, "Failed to initialize tabrmd TCTI context: "
99 "0x%" PRIx32 "0, rc);
100 free (tcti_context);
101 exit (EXIT_FAILURE);
102 }
103 exit (EXIT_SUCCESS);
104
106 Philip Tricca <philip.b.tricca@intel.com>
107
109 tcti-tabrmd(7), tpm2-abrmd(8)
110
112 This page is part of the 1.1.0 release of Intel's TPM2 Access Broker &
113 Resource Management Daemon. A description of the project, information
114 about reporting bugs, and the latest version of this page can be found
115 at https://github.com/01org/tpm2-abrmd/.
116
117
118
119Intel MAY 2017 TSS2_TCTI_TABRMD_INIT(3)