summaryrefslogtreecommitdiffstats
path: root/tpm2d
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2023-09-28 06:26:52 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2023-10-06 02:52:26 +0200
commit8d0819346db8943b519ea7685569382c56776d15 (patch)
treeca9a4c03ad098a95c3dfd0d20bfd60a12305fea0 /tpm2d
parentagent: fix tpm2d keytotpm handling (diff)
downloadgnupg2-8d0819346db8943b519ea7685569382c56776d15.tar.xz
gnupg2-8d0819346db8943b519ea7685569382c56776d15.zip
tpm2d: Check SWTPM environment variable for swtpm support.
* tpm2d/intel-tss.h (TSS_Create): Check SWTPM. -- Cherry-picked from master commit of: 1da40db03eba4aa056f7cdf8ef90292272a4147d Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'tpm2d')
-rw-r--r--tpm2d/intel-tss.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/tpm2d/intel-tss.h b/tpm2d/intel-tss.h
index 615f81e2f..53da5cee2 100644
--- a/tpm2d/intel-tss.h
+++ b/tpm2d/intel-tss.h
@@ -285,9 +285,15 @@ TSS_Create(TSS_CONTEXT **tssContext)
*/
if (intType)
{
- if (strcmp("socsim", intType) == 0) {
- tctildr = "mssim";
- }
+ if (strcmp("socsim", intType) == 0)
+ {
+ char *swtpm = getenv("SWTPM");
+
+ if (!swtpm || strlen(swtpm) == 0)
+ tctildr = "mssim";
+ else
+ tctildr = "swtpm";
+ }
else if (strcmp("dev", intType) == 0)
{
tctildr = "device";