tss2: rebase to v1331

Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
This commit is contained in:
Jerry Snitselaar 2019-05-30 13:56:40 -07:00
parent dacc203b89
commit 05f1b2cedf
7 changed files with 20 additions and 147 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/ibmtss713withman.tar /ibmtss713withman.tar
/ibmtss1027.tar.gz /ibmtss1027.tar.gz
/makeman.sh /makeman.sh
/ibmtss1331.tar.gz

View File

@ -1,28 +0,0 @@
From a73fda67a980fd8129ba3cc6158cd4f5d9be7562 Mon Sep 17 00:00:00 2001
From: Jerry Snitselaar <jsnitsel@redhat.com>
Date: Wed, 20 Jun 2018 11:01:21 -0700
Subject: [PATCH 1/3] ekutils: fix null check in convertPemToX509
assignment is to *x509, but check is against x509. Change check to *x509.
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
utils/ekutils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/ekutils.c b/utils/ekutils.c
index 5f27bd6..8887bd5 100644
--- a/utils/ekutils.c
+++ b/utils/ekutils.c
@@ -1144,7 +1144,7 @@ uint32_t convertPemToX509(X509 **x509, /* freed by caller */
/* convert the platform certificate from PEM to DER */
if (rc == 0) {
*x509 = PEM_read_X509(pemCertificateFile , NULL, NULL, NULL); /* freed @1 */
- if (x509 == NULL) {
+ if (*x509 == NULL) {
printf("convertPemToX509: Cannot parse PEM certificate file %s\n",
pemCertificateFilename);
rc = TSS_RC_FILE_READ;
--
2.17.0

View File

@ -1,30 +0,0 @@
From 29f30ccc4032949e54be1996c24a7752793c3603 Mon Sep 17 00:00:00 2001
From: Jerry Snitselaar <jsnitsel@redhat.com>
Date: Wed, 20 Jun 2018 11:03:06 -0700
Subject: [PATCH 2/3] ektuils: check return of X509_gmtime_adj for notAfter
adjustment
The is a check for arc == NULL, but arc doesn't get assigned the
return value from x509_gmtime_adj.
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
utils/ekutils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/ekutils.c b/utils/ekutils.c
index 8887bd5..36f8ece 100644
--- a/utils/ekutils.c
+++ b/utils/ekutils.c
@@ -1590,7 +1590,7 @@ TPM_RC startCertificate(X509 *x509Certificate, /* X509 certificate to be generat
if (rc == 0) {
/* can't fail, just returns a structure member */
ASN1_TIME *notAfter = X509_get_notAfter(x509Certificate);
- X509_gmtime_adj(notAfter, CERT_DURATION); /* set to duration */
+ arc = X509_gmtime_adj(notAfter, CERT_DURATION); /* set to duration */
if (arc == NULL) {
printf("startCertificate: Error setting notAfter time\n");
rc = TSS_RC_X509_ERROR;
--
2.17.0

View File

@ -1,28 +0,0 @@
From 108d9ba48ab922521b1124970156f2d2f59eea0b Mon Sep 17 00:00:00 2001
From: Jerry Snitselaar <jsnitsel@redhat.com>
Date: Thu, 21 Jun 2018 09:13:54 -0700
Subject: [PATCH 3/3] imalib: call memcmp with correct size
imaEvent digest is size of SHA1_DIGEST_SIZE, so call memcmp with that value.
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
utils/imalib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/imalib.c b/utils/imalib.c
index a7f42fc..42e2aa5 100644
--- a/utils/imalib.c
+++ b/utils/imalib.c
@@ -826,7 +826,7 @@ uint32_t IMA_Extend(TPMT_HA *imapcr,
}
}
if (rc == 0) {
- notAllZero = memcmp(imaEvent->digest, zeroDigest, digestSize);
+ notAllZero = memcmp(imaEvent->digest, zeroDigest, SHA1_DIGEST_SIZE);
imapcr->hashAlg = hashAlg;
if (notAllZero) {
#if 0
--
2.17.0

View File

@ -1,28 +0,0 @@
From e5ffbe2736f4ad4370fb44c216ecd6092a01003c Mon Sep 17 00:00:00 2001
From: Jerry Snitselaar <jsnitsel@redhat.com>
Date: Thu, 21 Jun 2018 13:00:51 -0700
Subject: [PATCH] certifycreation: Check that creation hash file name received
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
utils/certifycreation.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/utils/certifycreation.c b/utils/certifycreation.c
index 50e3718..4a6cd0a 100644
--- a/utils/certifycreation.c
+++ b/utils/certifycreation.c
@@ -298,6 +298,10 @@ int main(int argc, char *argv[])
printf("Missing ticket parameter -tk\n");
printUsage();
}
+ if (creationHashFilename == NULL) {
+ printf("Missing creation hash file parameter -ch\n");
+ printUsage();
+ }
if (rc == 0) {
/* Handle of key that will perform certifying */
in.objectHandle = objectHandle;
--
2.17.0

View File

@ -1 +1 @@
SHA512 (ibmtss1234.tar.gz) = 4e9de6b12dea7e839d206c948979d9eb99c000920bbee0839b22a55e925ddb4ace40d1b22b54bae7acfdbbc64bf5665066b4592ae9a96e85d16842fcf8892b92 SHA512 (ibmtss1331.tar.gz) = b1d41e0779f2ada6a61e38b8686b64272df5bf0c73b6fd8baac2d4ea9ae23e56910d95e6412683b44fc8bb7da7bc4a349709b02bf9b137498100b4d7288aca11

View File

@ -3,20 +3,18 @@
# #
%{!?__global_ldflags: %global __global_ldflags -Wl,-z,relro} %{!?__global_ldflags: %global __global_ldflags -Wl,-z,relro}
%global incname ibmtss
Name: tss2 Name: tss2
Version: 1234 Version: 1331
Release: 4%{?dist} Release: 1%{?dist}
Summary: IBM's TCG Software Stack (TSS) for TPM 2.0 and related utilities Summary: IBM's TCG Software Stack (TSS) for TPM 2.0 and related utilities
License: BSD License: BSD
URL: http://sourceforge.net/projects/ibmtpm20tss/ URL: http://sourceforge.net/projects/ibmtpm20tss/
Source0: https://sourceforge.net/projects/ibmtpm20tss/files/ibmtss%{version}.tar.gz Source0: https://sourceforge.net/projects/ibmtpm20tss/files/ibmtss%{version}.tar.gz
Patch1: 0001-ekutils-fix-null-check-in-convertPemToX509.patch Patch1: flags-fixup.patch
Patch2: 0002-ektuils-check-return-of-X509_gmtime_adj-for-notAfter.patch Patch2: hash_generate.patch
Patch3: 0003-imalib-call-memcmp-with-correct-size.patch
Patch4: 0004-certifycreation-Check-that-creation-hash-file-name-r.patch
Patch5: flags-fixup.patch
Patch6: hash_generate.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: help2man BuildRequires: help2man
@ -49,21 +47,6 @@ pushd utils
CCFLAGS="%{optflags}" \ CCFLAGS="%{optflags}" \
LNFLAGS="%{__global_ldflags}" \ LNFLAGS="%{__global_ldflags}" \
make -f makefile.fedora %{?_smp_mflags} make -f makefile.fedora %{?_smp_mflags}
# Generate man pages for extracted list of executables
mkdir -p man/man1
BIN_PREFIX=tss
man_exe=$(sed -n "s,^help2man.*/usr/bin/${BIN_PREFIX}\\([^ ]*\) .*\$,\\1,p" makeman.sh)
for f in $man_exe; do
# prefixed name
n=${BIN_PREFIX}$f
# extract description of binary
desc=$(sed -n -e "s,^help2man.* -n \"\\([^\"]*\\)\".*/usr/bin/$n .*\$,\\1,p" makeman.sh)
# temporarily link executable to prefixed name so man page is generated with correct name
ln -s $PWD/$f %{_tmppath}/$n
LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" help2man -h-h --version-string="v%{version}" -n "$desc" %{_tmppath}/$n > man/man1/$n.1
rm %{_tmppath}/$n
done
popd popd
%install %install
@ -71,7 +54,7 @@ popd
BIN_PREFIX=tss BIN_PREFIX=tss
mkdir -p %{buildroot}/%{_bindir} mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_libdir} mkdir -p %{buildroot}/%{_libdir}
mkdir -p %{buildroot}/%{_includedir}/%{name}/ mkdir -p %{buildroot}/%{_includedir}/%{incname}/
mkdir -p %{buildroot}/%{_mandir}/man1 mkdir -p %{buildroot}/%{_mandir}/man1
pushd utils pushd utils
# Pick out executables and copy with namespacing # Pick out executables and copy with namespacing
@ -80,18 +63,18 @@ for f in *; do
cp -p $f %{buildroot}/%{_bindir}/${BIN_PREFIX}$f cp -p $f %{buildroot}/%{_bindir}/${BIN_PREFIX}$f
fi; fi;
done done
cp -p *.so.0.1 %{buildroot}/%{_libdir} cp -p *.so.1.1 %{buildroot}/%{_libdir}
cp -p %{name}/*.h %{buildroot}/%{_includedir}/%{name}/ cp -p %{incname}/*.h %{buildroot}/%{_includedir}/%{incname}/
cp -p man/man1/tss*.1 %{buildroot}/%{_mandir}/man1/ cp -p man/man1/tss*.1 %{buildroot}/%{_mandir}/man1/
popd popd
# Make symbolic links to the shared lib # Make symbolic links to the shared lib
pushd %{buildroot}/%{_libdir} pushd %{buildroot}/%{_libdir}
rm -f libibmtss.so.0 rm -f libibmtss.so.1
ln -sf libibmtss.so.0.1 libibmtss.so.0 ln -sf libibmtss.so.1.1 libibmtss.so.1
rm -f libibmtss.so rm -f libibmtss.so
ln -sf libibmtss.so.0 libibmtss.so ln -sf libibmtss.so.1 libibmtss.so
popd popd
%ldconfig_scriptlets %ldconfig_scriptlets
@ -99,16 +82,19 @@ popd
%files %files
%license LICENSE %license LICENSE
%{_bindir}/tss* %{_bindir}/tss*
%{_libdir}/libibmtss.so.0 %{_libdir}/libibmtss.so.1
%{_libdir}/libibmtss.so.0.* %{_libdir}/libibmtss.so.1.*
%attr(0644, root, root) %{_mandir}/man1/tss*.1* %attr(0644, root, root) %{_mandir}/man1/tss*.1*
%files devel %files devel
%{_includedir}/%{name} %{_includedir}/%{incname}
%{_libdir}/libibmtss.so %{_libdir}/libibmtss.so
%doc ibmtss.doc %doc ibmtss.doc
%changelog %changelog
* Thu May 30 2019 Jerry Snitselaar <jsnitsel@redhat.com> - 1331-1
- Rebase to version 1331
* Tue May 28 2019 Jerry Snitselaar <jsnitsel@redhat.com> - 1234-4 * Tue May 28 2019 Jerry Snitselaar <jsnitsel@redhat.com> - 1234-4
- Fix covscan issues - Fix covscan issues
- Fix compile and linker flag issues - Fix compile and linker flag issues