1 //**********************************************************************;
2 // Copyright (c) 2018, Intel Corporation
3 // All rights reserved.
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
8 // 1. Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
11 // 2. Redistributions in binary form must reproduce the above copyright notice,
12 // this list of conditions and the following disclaimer in the documentation
13 // and/or other materials provided with the distribution.
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25 // THE POSSIBILITY OF SUCH DAMAGE.
26 //**********************************************************************;
28 #include <tss2/tss2_sys.h>
30 #ifndef LIB_TPM2_TCTI_LDR_H_
31 #define LIB_TPM2_TCTI_LDR_H_
34 * Loads a TCTI from a friendly name, library name, or path.
36 * friendly: path = tabrmd
37 * library name: path = libtss2-tcti-mssim.so
38 * full path: path = /home/user/lib/libtss2-tcti-custom.so
40 * The path/library to load.
42 * The tcti option configs.
44 * A tcti context on success or NULL on failure.
46 TSS2_TCTI_CONTEXT *tpm2_tcti_ldr_load(const char *path, const char *opts);
49 * Returns the loaded TCTIs information structure,
50 * which contains the initialization routine, description
51 * and help string amongst other things.
53 * NULL if no TCTI is loaded, else the info structure pointer.
55 const TSS2_TCTI_INFO *tpm2_tcti_ldr_getinfo(void);
58 * Given a tcti name, like mssim, tells you if the
59 * library is present using dlopen(3).
61 * The friendly name of the tcti.
63 * True if present, false otherwise.
65 bool tpm2_tcti_ldr_is_tcti_present(const char *name);
68 * Unloads the tcti loaded via tpm2_tcti_ldr_load();
70 void tpm2_tcti_ldr_unload(void);
72 #endif /* LIB_TPM2_TCTI_LDR_H_ */