1Tss2_Tcti_Mssim_Init(3)       TPM2 Software Stack      Tss2_Tcti_Mssim_Init(3)
2
3
4

NAME

6       Tss2_Tcti_Mssim_Init  -  Initialization  function for the Microsoft TPM
7       simulator TCTI library.
8

SYNOPSIS

10       #include <tcti/tcti_mssim.h>
11
12       TSS2_RC Tss2_Tcti_Mssim_Init  (TSS2_TCTI_CONTEXT  *tctiContext,  size_t
13       *contextSize, const char *conf);
14
15       The  Tss2_Tcti_Mssim_Init() function initializes a TCTI context used to
16       communicate with the Microsoft TPM2 simulator.
17

DESCRIPTION

19       Tss2_Tcti_Mssim_Init()  attempts  to  initialize  a  caller   allocated
20       tcti_context  of  size  size using caller provided configuration string
21       conf . Since the tcti_context must be a caller  allocated  buffer,  the
22       caller  needs to know the buffer size required by the TCTI library. The
23       minimum size of this context can be discovered by  providing  NULL  for
24       the  tcti_context  and  a  non- NULL size parameter. The initialization
25       function will then populate the size parameter with the minimum size of
26       the tcti_context buffer. The caller must then allocate a buffer of this
27       size (or larger) and call Tss2_Tcti_Mssim_Init () again  providing  the
28       newly  allocated  tcti_context and the size of this context in the size
29       parameter. This pattern is common to all TCTI initialization functions.
30       We  provide an example of this pattern using the Tss2_Tcti_Mssim_Init()
31       function in the section titled EXAMPLE.
32
33       The conf parameter is a C string used to configure  the  TCTI  context.
34       This configuration string is a series of key / value pairs that specify
35       the host and port used to connect to an instance of the Microsoft  TPM2
36       simulator.  The  keys  and  values  are separated by the '=' character,
37       while each key / value pair is separated by the ',' character.
38
39       The only keys supported in the conf string are host and port.  The host
40       may  be an IPv4 address, an IPv6 address, or a host name. The port must
41       be a valid uint16_t in string form. If a NULL conf string  is  provided
42       by  the  caller then the default of "host=localhost,port=2321" is used.
43       If either host or port are omitted then their respective default  value
44       will be used.
45
46       Once initialized, the TCTI context returned exposes the Trusted Comput‐
47       ing Group (TCG) defined API for the lowest level communication with the
48       TPM.  Using this API the caller can exchange (send / receive) TPM2 com‐
49       mand and response buffers with the Microsoft TPM simulator.  In  nearly
50       all  cases  however,  the  caller  will initialize a context using this
51       function before passing the context to a higher level API like the Sys‐
52       tem API (SAPI), and then never touch it again.
53
54       For  a  more  thorough  discussion  of the TCTI API see the “TSS System
55       Level API and TPM Command Transmission Interface Specification” as pub‐
56       lished                   by                   the                  TCG:
57       https://trustedcomputinggroup.org/tss-system-level-api-tpm-command-transmission-interface-specification/
58

RETURN VALUE

60       A  successful  call  to Tss2_Tcti_Mssim_Init() will return TSS2_RC_SUC‐
61       CESS.  An unsuccessful call will produce a response code  described  in
62       section ERRORS.
63

ERRORS

65       TSS2_TCTI_RC_BAD_VALUE  is  returned  if  both the tcti_context and the
66       size parameters are NULL, or if the config parameter is NULL.
67

EXAMPLE

69       TCTI initialization fragment:
70
71       #include <inttypes.h>
72       #include <stdlib.h>
73       #include <stdio.h>
74       #include <tcti/tcti_mssim.h>
75
76       TSS2_RC rc;
77       TSS2_TCTI_CONTEXT *tcti_context;
78       size_t size;
79       const char *conf = "host=localhost,port=2321"
80
81       rc = Tss2_Tcti_Mssim_Init (NULL, &size, NULL);
82       if (rc != TSS2_RC_SUCCESS) {
83           fprintf (stderr, "Failed to get allocation size for mssim TCTI "
84                    " context: 0x%" PRIx32 "0, rc);
85           exit (EXIT_FAILURE);
86       }
87       tcti_context = calloc (1, size);
88       if (tcti_context == NULL) {
89           fprintf (stderr, "Allocation for TCTI context failed: %s0,
90                    strerror (errno));
91           exit (EXIT_FAILURE);
92       }
93       rc = Tss2_Tcti_Mssim_Init (&tcti_context, &size, conf);
94       if (rc != TSS2_RC_SUCCESS) {
95           fprintf (stderr, "Failed to initialize mssim TCTI context: "
96                    "0x%" PRIx32 "0, rc);
97           free (tcti_context);
98           exit (EXIT_FAILURE);
99       }
100

AUTHOR

102       Philip Tricca <philip.b.tricca@intel.com>
103

SEE ALSO

105       Tss2_Tcti_Device_Init(3),   Tss2_Tcti_Socket_Init(3),   tcti-device(7),
106       tcti-socket(7), tcti-tabrmd(7), tpm2-abrmd(8)
107

COLOPHON

109       This page is part of release 2.2.3 of Intel's implementation of the TCG
110       TPM2 Software Stack (TSS2). A description of the  project,  information
111       about  reporting bugs, and the latest version of this page can be found
112       at https://github.com/01org/tpm2-tss/.
113
114
115
116Intel                              JUNE 2017           Tss2_Tcti_Mssim_Init(3)
Impressum