Skip to content

Commit

Permalink
tcti-start-sim: add tcti to start simulator (mssim/swtpm)
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Holland <johannes.holland@infineon.de>
  • Loading branch information
Johannes Holland committed Aug 1, 2024
1 parent cd60b3b commit 49f88a3
Show file tree
Hide file tree
Showing 7 changed files with 1,008 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,24 @@ src_tss2_tcti_libtss2_tcti_swtpm_la_SOURCES = \
endif # ENABLE_TCTI_SWTPM
EXTRA_DIST += lib/tss2-tcti-swtpm.map lib/tss2-tcti-swtpm.def src/tss2-tcti/tss2-tcti-swtpm.vcxproj

# tcti library for swtpm
#if ENABLE_TCTI_START_SIM
libtss2_tcti_start_sim = src/tss2-tcti/libtss2-tcti-start-sim.la
tss2_HEADERS += $(srcdir)/include/tss2/tss2_tcti_start_sim.h
lib_LTLIBRARIES += $(libtss2_tcti_start_sim)
pkgconfig_DATA += lib/tss2-tcti-start-sim.pc

if HAVE_LD_VERSION_SCRIPT
src_tss2_tcti_libtss2_tcti_start_sim_la_LDFLAGS = -Wl,--version-script=$(srcdir)/lib/tss2-tcti-start-sim.map
endif # HAVE_LD_VERSION_SCRIPT
src_tss2_tcti_libtss2_tcti_start_sim_la_LIBADD = $(libtss2_mu) $(libutil) $(libutilio)
src_tss2_tcti_libtss2_tcti_start_sim_la_SOURCES = \
src/tss2-tcti/tcti-common.c \
src/tss2-tcti/tcti-start-sim.c \
src/tss2-tcti/tcti-start-sim.h
#endif # ENABLE_TCTI_START_SIM
EXTRA_DIST += lib/tss2-tcti-start-sim.map lib/tss2-tcti-start-sim.def src/tss2-tcti/tss2-tcti-start-sim.vcxproj

# tcti library for Microsoft TPM2 simulator
if ENABLE_TCTI_MSSIM
libtss2_tcti_mssim = src/tss2-tcti/libtss2-tcti-mssim.la
Expand Down
8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ AC_ARG_ENABLE([tcti-swtpm],
AM_CONDITIONAL([ENABLE_TCTI_SWTPM], [test "x$enable_tcti_swtpm" != xno])
AS_IF([test "x$enable_tcti_swtpm" = "xyes"], [AC_DEFINE([TCTI_SWTPM],[1], [TCTI FOR SWTPM])])

AC_ARG_ENABLE([tcti-start-sim],
[AS_HELP_STRING([--disable-tcti-start-sim],
[don't build the tcti-start-sim module])],,
[enable_tcti_start_sim=yes])
AM_CONDITIONAL([ENABLE_TCTI_START_SIM], [test "x$enable_tcti_start_sim" != xno])
AS_IF([test "x$enable_tcti_start_sim" = "xyes"], [AC_DEFINE([TCTI_START_SIM],[1], [TCTI FOR STARTING THE SIMULATOR])])

AC_ARG_ENABLE([tcti-pcap],
[AS_HELP_STRING([--disable-tcti-pcap],
[don't build the tcti-pcap module])],,
Expand Down Expand Up @@ -456,6 +463,7 @@ AM_CONDITIONAL([DEVICEMANDATORY],[test "x$enable_device_mandatory" = "xyes"])
# enable integration tests and check for simulator binary
#

# TODO migrate and remove --with-device
AC_ARG_WITH([integrationtcti],
[AS_HELP_STRING([--with-integrationtcti=<tcti>],[TCTI used for testing])],
[AS_IF([test x"$with_device_set" = "xyes"],
Expand Down
24 changes: 24 additions & 0 deletions include/tss2/tss2_tcti_start_sim.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
* Copyright (c) 2024, Infineon Technologies AG
* All rights reserved.
*/
#ifndef TSS2_TCTI_START_SIM_H
#define TSS2_TCTI_START_SIM_H

#include "tss2_tcti.h"

#ifdef __cplusplus
extern "C" {
#endif

TSS2_RC Tss2_Tcti_Start_Sim_Init (
TSS2_TCTI_CONTEXT *tctiContext,
size_t *size,
const char *conf);

#ifdef __cplusplus
}
#endif

#endif /* TSS2_TCTI_START_SIM_H */
8 changes: 8 additions & 0 deletions lib/tss2-tcti-start-sim.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
global:
Tss2_Tcti_Info;
Tss2_Tcti_Start_Sim_Init;
Tss2_Tcti_Start_Sim_Reset;
local:
*;
};
12 changes: 12 additions & 0 deletions lib/tss2-tcti-start-sim.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: tss2-tcti-start-sim
Description: TCTI library for starting a TPM simulator process.
URL: https://github.com/tpm2-software/tpm2-tss
Version: @VERSION@
Requires.private: tss2-mu
Cflags: -I${includedir} -I${includedir}/tss2
Libs: -ltss2-tcti-start-sim -L${libdir}
Loading

0 comments on commit 49f88a3

Please sign in to comment.