From 59163a2b72736eb9794931f1a782008c8d4b2da2 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Wed, 23 Feb 2022 19:48:52 +0100 Subject: tpm2: dynamically load tss2 libraries as needed libtss2-esys links to OpenSSL or mbed TLS for cryptography, which may cause packaging issues. This instead dlopen's tss2 libraries as needed so non-TPM applications continue working without loading multiple crypto libraries. Signed-off-by: Daiki Ueno --- configure.ac | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 351cf4593e..c50015fbbd 100644 --- a/configure.ac +++ b/configure.ac @@ -882,6 +882,8 @@ AM_CONDITIONAL(P11KIT_0_23_11_API, $PKG_CONFIG --atleast-version=0.23.11 p11-kit AM_CONDITIONAL(ENABLE_PKCS11, test "$with_p11_kit" != "no") +need_ltlibdl=no + AC_ARG_WITH(tpm2, AS_HELP_STRING([--without-tpm2], [Disable TPM2 support.]), @@ -892,6 +894,8 @@ if test "$with_tpm2" != "no"; then if test "$have_tpm2" = "yes"; then tss2lib="tss2-esys tss2-mu tss2-tctildr" AC_DEFINE([HAVE_TSS2], 1, [Have TSS2]) + with_tpm2=yes + need_ltlibdl=yes elif test "$with_tpm2" = "yes"; then AC_MSG_ERROR([[ *** @@ -920,7 +924,8 @@ if test "$with_tpm" != "no"; then AC_SUBST([TSS_LIBS], [-ltspi]) AC_SUBST([TSS_CFLAGS], []) AC_DEFINE([HAVE_TROUSERS], 1, [Enable TPM]) - with_tpm=yes], + with_tpm=yes, + need_ltlibdl=yes], [AC_MSG_RESULT(no) AC_MSG_WARN([[ *** @@ -957,6 +962,9 @@ fi AC_DEFINE_UNQUOTED([TROUSERS_LIB], ["$ac_trousers_lib"], [the location of the trousers library]) AC_SUBST(TROUSERS_LIB) + +AM_CONDITIONAL(NEED_LTLIBDL, test "$need_ltlibdl" = yes) + # For minitasn1. AC_CHECK_SIZEOF(unsigned long int, 4) AC_CHECK_SIZEOF(unsigned int, 4) @@ -1389,7 +1397,7 @@ AC_MSG_NOTICE([External hardware support: Random gen. variant: $rnd_variant PKCS#11 support: $with_p11_kit TPM support: $with_tpm - TPM2 support: $have_tpm2 + TPM2 support: $with_tpm2 KTLS support: $enable_ktls ]) -- cgit v1.2.1