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 Sep 6, 2024
1 parent 7a98d4a commit 81494ba
Show file tree
Hide file tree
Showing 8 changed files with 1,046 additions and 1 deletion.
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_tctildr) $(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

# tcti library for Microsoft TPM2 simulator
if ENABLE_TCTI_MSSIM
libtss2_tcti_mssim = src/tss2-tcti/libtss2-tcti-mssim.la
Expand Down
10 changes: 9 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) #Backward compatible setti

AC_CONFIG_HEADERS([config.h])

AC_CONFIG_FILES([Makefile Doxyfile lib/tss2-sys.pc lib/tss2-esys.pc lib/tss2-mu.pc lib/tss2-tcti-device.pc lib/tss2-tcti-mssim.pc lib/tss2-tcti-swtpm.pc lib/tss2-tcti-pcap.pc lib/tss2-tcti-libtpms.pc lib/tss2-rc.pc lib/tss2-tctildr.pc lib/tss2-fapi.pc lib/tss2-tcti-cmd.pc lib/tss2-policy.pc lib/tss2-tcti-spi-helper.pc lib/tss2-tcti-spi-ltt2go.pc lib/tss2-tcti-spidev.pc lib/tss2-tcti-spi-ftdi.pc lib/tss2-tcti-i2c-helper.pc lib/tss2-tcti-i2c-ftdi.pc])
AC_CONFIG_FILES([Makefile Doxyfile lib/tss2-sys.pc lib/tss2-esys.pc lib/tss2-mu.pc lib/tss2-tcti-device.pc lib/tss2-tcti-mssim.pc lib/tss2-tcti-swtpm.pc lib/tss2-tcti-pcap.pc lib/tss2-tcti-libtpms.pc lib/tss2-tcti-start-sim.pc lib/tss2-rc.pc lib/tss2-tctildr.pc lib/tss2-fapi.pc lib/tss2-tcti-cmd.pc lib/tss2-policy.pc lib/tss2-tcti-spi-helper.pc lib/tss2-tcti-spi-ltt2go.pc lib/tss2-tcti-spidev.pc lib/tss2-tcti-spi-ftdi.pc lib/tss2-tcti-i2c-helper.pc lib/tss2-tcti-i2c-ftdi.pc])

# propagate configure arguments to distcheck
AC_SUBST([DISTCHECK_CONFIGURE_FLAGS],[$ac_configure_args])
Expand Down 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 */
4 changes: 4 additions & 0 deletions lib/tss2-tcti-start-sim.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
LIBRARY tss2-tcti-start-sim
EXPORTS
Tss2_Tcti_Info
Tss2_Tcti_Start_Sim_Init
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-tctildr
Cflags: -I${includedir} -I${includedir}/tss2
Libs: -ltss2-tcti-start-sim -L${libdir}
Loading

0 comments on commit 81494ba

Please sign in to comment.