Build of libtpms 0.8.5
This commit is contained in:
parent
0844981e0a
commit
0a9913bbf9
1
.gitignore
vendored
1
.gitignore
vendored
@ -23,3 +23,4 @@
|
||||
/libtpms-20210301.tar.xz
|
||||
/libtpms-20210601.tar.xz
|
||||
/libtpms-20210624.tar.xz
|
||||
/libtpms-20210901.tar.xz
|
||||
|
@ -1,34 +0,0 @@
|
||||
From 33a03986e0a09dde439985e0312d1c8fb3743aab Mon Sep 17 00:00:00 2001
|
||||
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
|
||||
Date: Thu, 22 Jul 2021 21:23:58 -0400
|
||||
Subject: [PATCH 1/2] tpm2: Initialize a whole OBJECT before using it
|
||||
|
||||
Initialize a whole OBJECT before using it. This is necessary since
|
||||
an OBJECT may also be used as a HASH_OBJECT via the ANY_OBJECT
|
||||
union and that HASH_OBJECT can leave bad size inidicators in TPM2B
|
||||
buffer in the OBJECT. To get rid of this problem we reset the whole
|
||||
OBJECT to 0 before using it. This is as if the memory for the
|
||||
OBJECT was just initialized.
|
||||
|
||||
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
|
||||
---
|
||||
src/tpm2/Object.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/tpm2/Object.c b/src/tpm2/Object.c
|
||||
index 8e8b3ee..8406d8f 100644
|
||||
--- a/src/tpm2/Object.c
|
||||
+++ b/src/tpm2/Object.c
|
||||
@@ -276,7 +276,8 @@ FindEmptyObjectSlot(
|
||||
if(handle)
|
||||
*handle = i + TRANSIENT_FIRST;
|
||||
// Initialize the object attributes
|
||||
- MemorySet(&object->attributes, 0, sizeof(OBJECT_ATTRIBUTES));
|
||||
+ // MemorySet(&object->attributes, 0, sizeof(OBJECT_ATTRIBUTES));
|
||||
+ MemorySet(object, 0, sizeof(*object)); // libtpms added: Initialize the whole object
|
||||
return object;
|
||||
}
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,56 +0,0 @@
|
||||
From aaef222e8682cc2e0f9ea7124220c5fe44fab62b Mon Sep 17 00:00:00 2001
|
||||
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
|
||||
Date: Fri, 23 Jul 2021 13:29:00 -0400
|
||||
Subject: [PATCH 2/2] tpm2: NVMarshal: Handle index orderly RAM without 0-sized
|
||||
terminating node
|
||||
|
||||
The NVRAM entries in s_indexOrderlyRam array do not need to contain a
|
||||
0-sized terminating node. Instead, the entries may fill up this 512
|
||||
byte array so that no NV_RAM_HEADER structure fits anymore. The fact
|
||||
that no more NV_RAM_HEADER structure fits is also an indicator for the
|
||||
last entry. We need to account for this in the code marshalling and
|
||||
unmarshalling the entries so that we stop marshalling the entries
|
||||
then and similarly stop unmarshalling.
|
||||
|
||||
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
|
||||
---
|
||||
src/tpm2/NVMarshal.c | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/src/tpm2/NVMarshal.c b/src/tpm2/NVMarshal.c
|
||||
index f8a3798..935a76c 100644
|
||||
--- a/src/tpm2/NVMarshal.c
|
||||
+++ b/src/tpm2/NVMarshal.c
|
||||
@@ -4244,6 +4244,12 @@ INDEX_ORDERLY_RAM_Marshal(void *array, size_t array_size,
|
||||
datasize, buffer, size);
|
||||
}
|
||||
offset += nrh.size;
|
||||
+ if (offset + sizeof(NV_RAM_HEADER) > array_size) {
|
||||
+ /* nothing will fit anymore and there won't be a 0-sized
|
||||
+ * terminating node (@1).
|
||||
+ */
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
written += BLOCK_SKIP_WRITE_PUSH(TRUE, buffer, size);
|
||||
@@ -4286,6 +4292,16 @@ INDEX_ORDERLY_RAM_Unmarshal(void *array, size_t array_size,
|
||||
*/
|
||||
nrhp = array + offset;
|
||||
|
||||
+ if (offset + sizeof(NV_RAM_HEADER) > sourceside_size) {
|
||||
+ /* this case can occur with the previous entry filling up the
|
||||
+ * space; in this case there will not be a 0-sized terminating
|
||||
+ * node (see @1 above). We clear the rest of our space.
|
||||
+ */
|
||||
+ if (array_size > offset)
|
||||
+ memset(nrhp, 0, array_size - offset);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
/* write the NVRAM header;
|
||||
nrh->size holds the complete size including data;
|
||||
nrh->size = 0 indicates the end */
|
||||
--
|
||||
2.31.1
|
||||
|
16
libtpms.spec
16
libtpms.spec
@ -1,18 +1,15 @@
|
||||
%global gitdate 20210624
|
||||
%global gitversion a594c4692a
|
||||
%global gitdate 20210901
|
||||
%global gitversion 18ba4c0206
|
||||
|
||||
Name: libtpms
|
||||
Version: 0.8.4
|
||||
Release: 1.%{gitdate}git%{gitversion}%{?dist}.0
|
||||
Version: 0.8.5
|
||||
Release: 0.%{gitdate}git%{gitversion}%{?dist}.0
|
||||
|
||||
Summary: Library providing Trusted Platform Module (TPM) functionality
|
||||
License: BSD
|
||||
Url: http://github.com/stefanberger/libtpms
|
||||
Source0: libtpms-%{gitdate}.tar.xz
|
||||
|
||||
Patch0001: 0001-tpm2-Initialize-a-whole-OBJECT-before-using-it.patch
|
||||
Patch0002: 0002-tpm2-NVMarshal-Handle-index-orderly-RAM-without-0-si.patch
|
||||
|
||||
BuildRequires: openssl-devel
|
||||
BuildRequires: pkgconfig gawk sed
|
||||
BuildRequires: automake autoconf libtool bash coreutils gcc-c++
|
||||
@ -31,8 +28,6 @@ Libtpms header files and documentation.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{gitdate}
|
||||
%patch0001 -p1
|
||||
%patch0002 -p1
|
||||
%build
|
||||
NOCONFIGURE=1 sh autogen.sh
|
||||
%configure --disable-static --with-tpm2 --with-openssl
|
||||
@ -60,6 +55,9 @@ find %{buildroot} -type f -name '*.la' | xargs rm -f -- || :
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%changelog
|
||||
* Wed Sep 01 2021 Stefan Berger <stefanb@linux.ibm.com> - 0.8.5-1.20210901git18ba4c0206
|
||||
- Build of libtpms 0.8.5
|
||||
|
||||
* Wed Aug 11 2021 Stefan Berger <stefanb@linux.ibm.com> - 0.8.4-1.20210625gita594c4692a
|
||||
- Applied patches resolving issues solved in upcoming 0.8.5
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (libtpms-20210624.tar.xz) = 9ce76c303048fe3d1f3c93baf0b487271f76cf3e31c072b8020c74eb5d2bed44ba841b3540470a3ce6a7b9119d7d9613faec0938c7f9d72b1a43774b965eff1a
|
||||
SHA512 (libtpms-20210901.tar.xz) = 1d7e7664f02a6259af763999eeb510f61d5150b1ff6a5737e3e91f68e97e2072987a7ff8928de2a96a9aa8dcf6302e6999dfd9f470388a128a4869e502e41ba1
|
||||
|
Loading…
Reference in New Issue
Block a user