Fix broken -T option when passing additional arguments

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2019-01-07 11:41:15 +01:00
parent 384f3d9cf4
commit fcd4476d71
No known key found for this signature in database
GPG Key ID: C751E590D63F3D69
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From 2565cf6c5cc7a0af7f426b7c9b03ac2f7c76005a Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Mon, 7 Jan 2019 11:31:50 +0100
Subject: [PATCH] options: fix broken -T option when passing additional
arguments
The commit 175e47711c7 ("lib/tpm2_options: restore TCTI configuration
environment variables") restored how the TCTI configuration was setup
for the 3.X releases, but this broke the -T,--tcti option since was
ignored.
Commit 554a13f45c0 ("options: fix broken -T option") partially fixed
this, but only when additional TCTI arguments were not used.
For example when specifying the -T device:/dev/tpmrm0 TCTI option:
$ tpm2_pcrlist -T device:/dev/tpmrm0
...
ERROR: Could not dlopen library: "device:/dev/tpmrm0"
ERROR: Could not load tcti, got: "device:/dev/tpmrm0"
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
lib/tpm2_options.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tpm2_options.c b/lib/tpm2_options.c
index 006c46e4944..1d1093aa74d 100644
--- a/lib/tpm2_options.c
+++ b/lib/tpm2_options.c
@@ -291,7 +291,7 @@ static tcti_conf tcti_get_config(const char *optstr) {
}
}
} else {
- conf.name = strdup(optstr);
+ parse_env_tcti(optstr, &conf);
}
if (!conf.name) {
--
2.19.2

View File

@ -1,6 +1,6 @@
Name: tpm2-tools
Version: 3.1.3
Release: 2%{?dist}
Release: 3%{?dist}
Summary: A TPM2.0 testing tool build upon TPM2.0-TSS
License: BSD
@ -10,6 +10,7 @@ Source0: https://github.com/tpm2-software/tpm2-tools/releases/download/%{version
Patch0: tpm2_rsaencrypt-fix-example-in-man-page.patch
Patch1: tpm2_getmanufc-fix-OSSL-build-warnings.patch
Patch2: options-fix-broken-T-option.patch
Patch3: options-fix-broken-T-option-when-passing-additional-.patch
BuildRequires: gcc-c++
BuildRequires: libtool
@ -49,6 +50,9 @@ tpm2-tools is a batch of testing tools for tpm2.0. It is based on tpm2-tss.
%{_mandir}/man1/tpm2_*.1.gz
%changelog
* Mon Jan 7 2019 Javier Martinez Canillas <javierm@redhat.com> - 3.1.3-3
- Fix broken -T option when passing additional arguments
* Mon Jan 7 2019 Javier Martinez Canillas <javierm@redhat.com> - 3.1.3-2
- Fix broken -T option and a couple of minor fixes
- Add pandoc BuildRequires