diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-05-30 11:44:06 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-05-30 11:44:06 +0100 |
commit | f516638b7fe9592837389826a6152a7e1b251c54 (patch) | |
tree | 8bfecb640b7b6403d7a3d662d923eed630033da7 /dev-libs/libtpms | |
parent | 1a61119f9f7b057830e2ce0563f913ec86f282ad (diff) |
gentoo resync : 30.05.2020
Diffstat (limited to 'dev-libs/libtpms')
6 files changed, 352 insertions, 1 deletions
diff --git a/dev-libs/libtpms/Manifest b/dev-libs/libtpms/Manifest index f7e44913d30c..7389e68702e9 100644 --- a/dev-libs/libtpms/Manifest +++ b/dev-libs/libtpms/Manifest @@ -1,3 +1,7 @@ +AUX libtpms-0.7.0-tpm12-Fix-potential-buffer-overflow-in-filename-creation.patch 4565 BLAKE2B a0df14afa6d95e36f75d9c74ddff9fed42a54ef3c0320e095f47cb7c1fbd4d29bfee870779aaa19a64663f18227877c79a47469c44338d6db528725ea0eb1e69 SHA512 f8a5fc3810e96bca2c9a4221f01b66177657f294bbf1537643551a1a6c0a816ef865e23030913196667dc21b10423c0cced2eba3e6667acdc6312a9376c27884 +AUX libtpms-0.7.0-tpm12-Initialize-a-few-variables-for-x86-gcc-O3.patch 6793 BLAKE2B 5462fc0a5ebe83a3c560519cb821b90b7c6b490c6a8046ea131cdbb5a65068b63d1edde55c5f80a967492a2615c07d049e496afbeb2a348a4186de885b65293a SHA512 8e570a081f24c19afb65d04b17c07680967453d29697b7fd3af72dff1bdf99e92f03e19b290db992859a7bd6665651c0bc90117656d016266fd289aa2afd6db8 +AUX libtpms-0.7.0-tpm12-Initialize-some-variables-for-gcc.patch 3972 BLAKE2B f2f0e3a93c36adaa9e8cef7bb6e6ee723408acd26046a7bb4d0ffb1361502aa7c6a3316e2d8df5225ab0651e1aac0e84e03186bc0aa83c98d21d8f0be220a30d SHA512 36975108af1f1a5914e6b35bff00f7ed63e5b349cf7433687d23faa87bf1072ffa779c35313feaba50c6758fee6d66ccdc2f151ecdb50cf4606fbedd518308a9 +AUX libtpms-0.7.0-tpm2-Fix-a-gcc-10.1.0-complaint.patch 2324 BLAKE2B 2d132eecdd410889ebf2452f83b24a6f9a8df53769d63cfcb0a4b5ab62d2cbd096b82208e73691d030a07968937c899e1dc606a492ceb68d4739a3a204c8808a SHA512 0f290bf4cd2a83176158bf0c67d1be6ea405cb7133ea2d83c5b86b05370b208e6266a050d49c4e5954e8da76eb4d15f24b8238625483d5f4c0d6a20061febf79 DIST libtpms-0.7.0.tar.gz 1203837 BLAKE2B ca5a3b78dc63c09c4ff084124838fedeb5be0580f709ad6165680159ba7ba4b1f751b9fbc67f6b5a8f39b82bdd420afb47087412a47b72cbe5b418a97a4860fe SHA512 92d1eb5d1a1cae08e97cceaca56fc9bc6d43c54a93edae2accf19807a4e93e19d88064a0b11db796c79d32c821e6b320ebbacb65cd20da3e5b1205f3b861cef2 -EBUILD libtpms-0.7.0-r1.ebuild 663 BLAKE2B fede09b0b2dc21512c6b36c29764d38d3171887ff58ca893c52f21c7ae8734c598ba0e6b12f550becc154a59181d86f86c9207c40accfa56f9cbd971140364e8 SHA512 653431c4728c6efa1f0e0449f2ae41b5791806afc00e8f53e31b0460b4fc947498c245d928c30705c2b2911206dfa06da4877b425a4561fbbcd602051cd0d398 +EBUILD libtpms-0.7.0-r1.ebuild 958 BLAKE2B 0fcfec0ab17ca845399bc857776e2ef6bf4e9f47dc23e90aa80792d0a70f09fdc4dc7047ffb2a7662002554f93c4e0e6d18fbd0d0e5fce7338e3ad4ce7c94ab3 SHA512 8b079683c1a0aef0f925bf3199e0d464b0e83f62f6c9c26187a02e14614e6e142ff6e637da99d0468ed5470291ffa8ca3c57351433fd325130478c0951f58834 MISC metadata.xml 370 BLAKE2B eb4d1a4a8e56cbdcb5b7f86029feb6e2151967f7b4801fbb3a8c2de35840969a4987ca2aada95792cb35ab03702715b1f66fe966c176969de743c64775bed0cb SHA512 5a2f5a0089bb0c54dd36821005a65cbe8c4fd05f1d7e0367eaff02031a39c749e005e5432da334081304af8c55b330b549821819455f1f0919d4525a254ca5c6 diff --git a/dev-libs/libtpms/files/libtpms-0.7.0-tpm12-Fix-potential-buffer-overflow-in-filename-creation.patch b/dev-libs/libtpms/files/libtpms-0.7.0-tpm12-Fix-potential-buffer-overflow-in-filename-creation.patch new file mode 100644 index 000000000000..9e7af9e88ed3 --- /dev/null +++ b/dev-libs/libtpms/files/libtpms-0.7.0-tpm12-Fix-potential-buffer-overflow-in-filename-creation.patch @@ -0,0 +1,105 @@ +From 1cdd950e7342240ed8edc695372365cf57fbc6cb Mon Sep 17 00:00:00 2001 +From: Stefan Berger <stefanb@linux.vnet.ibm.com> +Date: Thu, 17 Oct 2019 10:19:23 -0400 +Subject: [PATCH 2/2] tpm12: Fix potential buffer overflow in filename creation + +Fix a potential buffer overflow bug in the creation of filenames +that were using sprintf() rather than snprintf(). The buffer overflow +could occurr if the buffer is longer than 4096 bytes. The state path +may alone be 4096 bytes and could possibly trigger the overflow. + +Swtpm for example is not affected from this since it uses the callbacks +that are invoked before the faulty function is called. + +Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> +--- + src/tpm12/tpm_nvfile.c | 43 ++++++++++++++++++++++++++++++++---------- + 1 file changed, 33 insertions(+), 10 deletions(-) + +diff --git a/src/tpm12/tpm_nvfile.c b/src/tpm12/tpm_nvfile.c +index c8e7bcf..0268bd0 100644 +--- a/src/tpm12/tpm_nvfile.c ++++ b/src/tpm12/tpm_nvfile.c +@@ -70,7 +70,8 @@ + + /* local prototypes */ + +-static void TPM_NVRAM_GetFilenameForName(char *filename, ++static TPM_RESULT TPM_NVRAM_GetFilenameForName(char *filename, ++ size_t filename_len, + uint32_t tpm_number, + const char *name); + +@@ -189,7 +190,10 @@ TPM_RESULT TPM_NVRAM_LoadData(unsigned char **data, /* freed by caller */ + /* open the file */ + if (rc == 0) { + /* map name to the rooted filename */ +- TPM_NVRAM_GetFilenameForName(filename, tpm_number, name); ++ rc = TPM_NVRAM_GetFilenameForName(filename, sizeof(filename), ++ tpm_number, name); ++ } ++ if (rc == 0) { + printf(" TPM_NVRAM_LoadData: Opening file %s\n", filename); + file = fopen(filename, "rb"); /* closed @1 */ + if (file == NULL) { /* if failure, determine cause */ +@@ -297,7 +301,10 @@ TPM_RESULT TPM_NVRAM_StoreData(const unsigned char *data, + printf(" TPM_NVRAM_StoreData: To name %s\n", name); + if (rc == 0) { + /* map name to the rooted filename */ +- TPM_NVRAM_GetFilenameForName(filename, tpm_number, name); ++ rc = TPM_NVRAM_GetFilenameForName(filename, sizeof(filename), ++ tpm_number, name); ++ } ++ if (rc == 0) { + /* open the file */ + printf(" TPM_NVRAM_StoreData: Opening file %s\n", filename); + file = fopen(filename, "wb"); /* closed @1 */ +@@ -339,14 +346,27 @@ TPM_RESULT TPM_NVRAM_StoreData(const unsigned char *data, + state_directory/tpm_number.name + */ + +-static void TPM_NVRAM_GetFilenameForName(char *filename, /* output: rooted filename */ +- uint32_t tpm_number, +- const char *name) /* input: abstract name */ ++static TPM_RESULT TPM_NVRAM_GetFilenameForName(char *filename, /* output: rooted filename */ ++ size_t filename_len, ++ uint32_t tpm_number, ++ const char *name) /* input: abstract name */ + { ++ int n; ++ TPM_RESULT rc = TPM_FAIL; ++ + printf(" TPM_NVRAM_GetFilenameForName: For name %s\n", name); +- sprintf(filename, "%s/%02lx.%s", state_directory, (unsigned long)tpm_number, name); +- printf(" TPM_NVRAM_GetFilenameForName: File name %s\n", filename); +- return; ++ n = snprintf(filename, filename_len, ++ "%s/%02lx.%s", state_directory, (unsigned long)tpm_number, ++ name); ++ if (n < 0) { ++ printf(" TPM_NVRAM_GetFilenameForName: Error (fatal), snprintf failed\n"); ++ } else if ((size_t)n >= filename_len) { ++ printf(" TPM_NVRAM_GetFilenameForName: Error (fatal), buffer too small\n"); ++ } else { ++ printf(" TPM_NVRAM_GetFilenameForName: File name %s\n", filename); ++ rc = TPM_SUCCESS; ++ } ++ return rc; + } + + /* TPM_NVRAM_DeleteName() deletes the 'name' from NVRAM +@@ -380,7 +400,10 @@ TPM_RESULT TPM_NVRAM_DeleteName(uint32_t tpm_number, + + printf(" TPM_NVRAM_DeleteName: Name %s\n", name); + /* map name to the rooted filename */ +- TPM_NVRAM_GetFilenameForName(filename, tpm_number, name); ++ if (rc == 0) { ++ rc = TPM_NVRAM_GetFilenameForName(filename, sizeof(filename), ++ tpm_number, name); ++ } + if (rc == 0) { + irc = remove(filename); + if ((irc != 0) && /* if the remove failed */ +-- +2.26.2 + diff --git a/dev-libs/libtpms/files/libtpms-0.7.0-tpm12-Initialize-a-few-variables-for-x86-gcc-O3.patch b/dev-libs/libtpms/files/libtpms-0.7.0-tpm12-Initialize-a-few-variables-for-x86-gcc-O3.patch new file mode 100644 index 000000000000..e1c79875a02d --- /dev/null +++ b/dev-libs/libtpms/files/libtpms-0.7.0-tpm12-Initialize-a-few-variables-for-x86-gcc-O3.patch @@ -0,0 +1,108 @@ +From 464083396ae1d242fb2a26c1ab6e39971e82f47e Mon Sep 17 00:00:00 2001 +From: Stefan Berger <stefanb@linux.ibm.com> +Date: Fri, 17 Jan 2020 19:01:24 +0000 +Subject: [PATCH 3/3] tpm12: Initialize a few variables for x86 gcc -O3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609 + +The above gcc on x86 with -O3 reports the following false positives: + + gcc -DHAVE_CONFIG_H -I. -I.. -include tpm_library_conf.h -I../include/libtpms -I../include/libtpms -fstack-protector-strong -DTPM_V12 -DTPM_PCCLIENT -DTPM_VOLATILE_LOAD -DTPM_ENABLE_ACTIVATE -DTPM_AES -DTPM_LIBTPMS_CALLBACKS -DTPM_NV_DISK -DTPM_POSIX -DTPM_NOMAINTENANCE_COMMANDS -O3 -DUSE_OPENSSL_FUNCTIONS_SYMMETRIC=1 -DUSE_OPENSSL_FUNCTIONS_EC=1 -DUSE_OPENSSL_FUNCTIONS_ECDSA=0 -DUSE_OPENSSL_FUNCTIONS_RSA=0 -Wall -Werror -Wreturn-type -Wsign-compare -Wno-self-assign -MT tpm12/libtpms_tpm12_la-tpm_nvram.lo -MD -MP -MF tpm12/.deps/libtpms_tpm12_la-tpm_nvram.Tpo -c tpm12/tpm_nvram.c -o tpm12/libtpms_tpm12_la-tpm_nvram.o +tpm12/tpm_nvram.c: In function ‘TPM_Process_NVReadValue’: +tpm12/tpm_nvram.c:1539:38: error: ‘isGPIO’ may be used uninitialized in this function [-Werror=maybe-uninitialized] + if ((returnCode == TPM_SUCCESS) && !isGPIO) { + ^ +tpm12/tpm_nvram.c: In function ‘TPM_Process_NVWriteValue’: +tpm12/tpm_nvram.c:2323:6: error: ‘isGPIO’ may be used uninitialized in this function [-Werror=maybe-uninitialized] + if (!isGPIO) { + ^ + +gcc -DHAVE_CONFIG_H -I. -I.. -include tpm_library_conf.h -I../include/libtpms -I../include/libtpms -fstack-protector-strong -DTPM_V12 -DTPM_PCCLIENT -DTPM_VOLATILE_LOAD -DTPM_ENABLE_ACTIVATE -DTPM_AES -DTPM_LIBTPMS_CALLBACKS -DTPM_NV_DISK -DTPM_POSIX -DTPM_NOMAINTENANCE_COMMANDS -O3 -DUSE_OPENSSL_FUNCTIONS_SYMMETRIC=1 -DUSE_OPENSSL_FUNCTIONS_EC=1 -DUSE_OPENSSL_FUNCTIONS_ECDSA=0 -DUSE_OPENSSL_FUNCTIONS_RSA=0 -Wall -Werror -Wreturn-type -Wsign-compare -Wno-self-assign -MT tpm12/libtpms_tpm12_la-tpm_process.lo -MD -MP -MF tpm12/.deps/libtpms_tpm12_la-tpm_process.Tpo -c tpm12/tpm_process.c -o tpm12/libtpms_tpm12_la-tpm_process.o +tpm12/tpm_process.c: In function ‘TPM_Process_GetCapabilitySigned’: +tpm12/tpm_process.c:5089:19: error: ‘transportEncrypt’ may be used uninitialized in this function [-Werror=maybe-uninitialized] + returnCode = TPM_ProcessAudit(tpm_state, + ^ +tpm12/tpm_process.c: In function ‘TPM_Process_SetCapability’: +tpm12/tpm_process.c:5309:19: error: ‘transportEncrypt’ may be used uninitialized in this function [-Werror=maybe-uninitialized] + returnCode = TPM_ProcessAudit(tpm_state, + ^ +tpm12/tpm_process.c: At top level: + +gcc -DHAVE_CONFIG_H -I. -I.. -include tpm_library_conf.h -I../include/libtpms -I../include/libtpms -fstack-protector-strong -DTPM_V12 -DTPM_PCCLIENT -DTPM_VOLATILE_LOAD -DTPM_ENABLE_ACTIVATE -DTPM_AES -DTPM_LIBTPMS_CALLBACKS -DTPM_NV_DISK -DTPM_POSIX -DTPM_NOMAINTENANCE_COMMANDS -O3 -DUSE_OPENSSL_FUNCTIONS_SYMMETRIC=1 -DUSE_OPENSSL_FUNCTIONS_EC=1 -DUSE_OPENSSL_FUNCTIONS_ECDSA=0 -DUSE_OPENSSL_FUNCTIONS_RSA=0 -Wall -Werror -Wreturn-type -Wsign-compare -Wno-self-assign -MT tpm12/libtpms_tpm12_la-tpm_transport.lo -MD -MP -MF tpm12/.deps/libtpms_tpm12_la-tpm_transport.Tpo -c tpm12/tpm_transport.c -o tpm12/libtpms_tpm12_la-tpm_transport.o +tpm12/tpm_transport.c: In function ‘TPM_Process_ReleaseTransportSigned’: +tpm12/tpm_transport.c:2810:42: error: ‘t1TpmTransportInternal’ may be used uninitialized in this function [-Werror=maybe-uninitialized] + returnCode = TPM_TransportLogOut_Extend(t1TpmTransportInternal->transDigest, + ^ + +This patch initializes the variables. + +Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> +--- + src/tpm12/tpm_nvram.c | 4 ++-- + src/tpm12/tpm_process.c | 4 ++-- + src/tpm12/tpm_transport.c | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/tpm12/tpm_nvram.c b/src/tpm12/tpm_nvram.c +index 1b9c005..620944e 100644 +--- a/src/tpm12/tpm_nvram.c ++++ b/src/tpm12/tpm_nvram.c +@@ -1288,7 +1288,7 @@ TPM_RESULT TPM_Process_NVReadValue(tpm_state_t *tpm_state, + TPM_BOOL ignore_auth = FALSE; + TPM_BOOL dir = FALSE; + TPM_BOOL physicalPresence; +- TPM_BOOL isGPIO; ++ TPM_BOOL isGPIO = FALSE; + BYTE *gpioData = NULL; + TPM_NV_DATA_SENSITIVE *d1NvdataSensitive; + uint32_t s1Last; +@@ -2000,7 +2000,7 @@ TPM_RESULT TPM_Process_NVWriteValue(tpm_state_t *tpm_state, + TPM_NV_DATA_SENSITIVE *d1NvdataSensitive; + uint32_t s1Last; + TPM_BOOL physicalPresence; +- TPM_BOOL isGPIO; ++ TPM_BOOL isGPIO = FALSE; + uint32_t nv1 = tpm_state->tpm_permanent_data.noOwnerNVWrite; + /* temp for noOwnerNVWrite, initialize to + silence compiler */ +diff --git a/src/tpm12/tpm_process.c b/src/tpm12/tpm_process.c +index d6a3b8e..c433621 100644 +--- a/src/tpm12/tpm_process.c ++++ b/src/tpm12/tpm_process.c +@@ -4844,7 +4844,7 @@ TPM_RESULT TPM_Process_GetCapabilitySigned(tpm_state_t *tpm_state, + unsigned char * inParamEnd; /* ending point of inParam's */ + TPM_DIGEST inParamDigest; + TPM_BOOL auditStatus; /* audit the ordinal */ +- TPM_BOOL transportEncrypt; /* wrapped in encrypted transport session */ ++ TPM_BOOL transportEncrypt = FALSE;/* wrapped in encrypted transport session */ + TPM_BOOL authHandleValid = FALSE; + TPM_AUTH_SESSION_DATA *auth_session_data; /* session data for authHandle */ + TPM_SECRET *hmacKey; +@@ -5144,7 +5144,7 @@ TPM_RESULT TPM_Process_SetCapability(tpm_state_t *tpm_state, + unsigned char * inParamEnd; /* ending point of inParam's */ + TPM_DIGEST inParamDigest; + TPM_BOOL auditStatus; /* audit the ordinal */ +- TPM_BOOL transportEncrypt; /* wrapped in encrypted transport session */ ++ TPM_BOOL transportEncrypt = FALSE;/* wrapped in encrypted transport session */ + TPM_BOOL authHandleValid = FALSE; + TPM_AUTH_SESSION_DATA *auth_session_data; /* session data for authHandle */ + TPM_SECRET *hmacKey; +diff --git a/src/tpm12/tpm_transport.c b/src/tpm12/tpm_transport.c +index 2261670..7b9c520 100644 +--- a/src/tpm12/tpm_transport.c ++++ b/src/tpm12/tpm_transport.c +@@ -2599,7 +2599,7 @@ TPM_RESULT TPM_Process_ReleaseTransportSigned(tpm_state_t *tpm_state, + TPM_BOOL authHandleValid = FALSE; + TPM_BOOL transHandleValid = FALSE; + TPM_AUTH_SESSION_DATA *auth_session_data = NULL; /* session data for authHandle */ +- TPM_TRANSPORT_INTERNAL *t1TpmTransportInternal; ++ TPM_TRANSPORT_INTERNAL *t1TpmTransportInternal = NULL; + TPM_SECRET *hmacKey; + TPM_KEY *sigKey = NULL; /* the key specified by keyHandle */ + TPM_BOOL parentPCRStatus; +-- +2.26.2 + diff --git a/dev-libs/libtpms/files/libtpms-0.7.0-tpm12-Initialize-some-variables-for-gcc.patch b/dev-libs/libtpms/files/libtpms-0.7.0-tpm12-Initialize-some-variables-for-gcc.patch new file mode 100644 index 000000000000..309c78b3d1eb --- /dev/null +++ b/dev-libs/libtpms/files/libtpms-0.7.0-tpm12-Initialize-some-variables-for-gcc.patch @@ -0,0 +1,74 @@ +From aab357515eda564500290a4b3f542d2b4609af4f Mon Sep 17 00:00:00 2001 +From: Stefan Berger <stefanb@linux.ibm.com> +Date: Tue, 14 Jan 2020 18:05:06 -0500 +Subject: [PATCH] tpm12: Initialize some variables for gcc ppc64el compiler +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +gcc (Ubuntu 9.2.1-21ubuntu1) 9.2.1 20191130 + +The gcc compiler on Ubuntu Focal reports several false positives for +potentially uninitialized variables: + +tpm12/tpm_session.c: In function ‘TPM_Process_SaveContext’: +tpm12/tpm_session.c:3229:19: error: ‘tpm_auth_session_data’ may be used uninitialized in this function [-Werror=maybe-uninitialized] + 3229 | returnCode = TPM_AuthSessionData_Store(&r1ContextSensitive, tpm_auth_session_data); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +tpm12/tpm_delegate.c: In function ‘TPM_Process_DelegateManage’: +tpm12/tpm_delegate.c:1787:49: error: ‘familyRow’ may be used uninitialized in this function [-Werror=maybe-uninitialized] + 1787 | if ((opCode != TPM_FAMILY_CREATE) && (familyRow->flags & TPM_DELEGATE_ADMIN_LOCK)) { + | ~~~~~~~~~^~~~~~~ +tpm12/tpm_delegate.c: In function ‘TPM_Process_DelegateUpdateVerification’: +tpm12/tpm_delegate.c:3575:48: error: ‘d1DelegateTableRow’ may be used uninitialized in this function [-Werror=maybe-uninitialized] + 3575 | d1DelegateTableRow->pub.verificationCount = familyRow->verificationCount; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +All of the variables are initialize under the same condition as they are +accessed. + +Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> +--- + src/tpm12/tpm_delegate.c | 4 ++-- + src/tpm12/tpm_session.c | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/tpm12/tpm_delegate.c b/src/tpm12/tpm_delegate.c +index 51d12f3..37ebc02 100644 +--- a/src/tpm12/tpm_delegate.c ++++ b/src/tpm12/tpm_delegate.c +@@ -1629,7 +1629,7 @@ TPM_RESULT TPM_Process_DelegateManage(tpm_state_t *tpm_state, + TPM_SECRET *hmacKey; + TPM_SECRET savedAuth; /* saved copy for response */ + TPM_DELEGATE_PUBLIC *delegatePublic; /* from DSAP session */ +- TPM_FAMILY_TABLE_ENTRY *familyRow; /* family table row containing familyID */ ++ TPM_FAMILY_TABLE_ENTRY *familyRow = NULL; /* family table row containing familyID */ + uint32_t nv1 = tpm_state->tpm_permanent_data.noOwnerNVWrite; + /* temp for noOwnerNVWrite, initialize to + silence compiler */ +@@ -3360,7 +3360,7 @@ TPM_RESULT TPM_Process_DelegateUpdateVerification(tpm_state_t *tpm_state, + TPM_DELEGATE_INDEX d1DelegateIndex; + TPM_DELEGATE_OWNER_BLOB d1DelegateOwnerBlob; + TPM_DELEGATE_KEY_BLOB d1DelegateKeyBlob; +- TPM_DELEGATE_TABLE_ROW *d1DelegateTableRow; ++ TPM_DELEGATE_TABLE_ROW *d1DelegateTableRow = NULL; + TPM_FAMILY_ID familyID = 0; + TPM_FAMILY_TABLE_ENTRY *familyRow; /* family table row containing familyID */ + TPM_DELEGATE_PUBLIC *delegatePublic; /* from DSAP session */ +diff --git a/src/tpm12/tpm_session.c b/src/tpm12/tpm_session.c +index 5e7b708..15b977f 100644 +--- a/src/tpm12/tpm_session.c ++++ b/src/tpm12/tpm_session.c +@@ -3044,7 +3044,7 @@ TPM_RESULT TPM_Process_SaveContext(tpm_state_t *tpm_state, + TPM_STORE_BUFFER b1_sbuffer; /* serialization of b1 */ + TPM_STCLEAR_DATA *v1StClearData = NULL; + TPM_KEY_HANDLE_ENTRY *tpm_key_handle_entry; /* key table entry for the handle */ +- TPM_AUTH_SESSION_DATA *tpm_auth_session_data; /* session table entry for the handle */ ++ TPM_AUTH_SESSION_DATA *tpm_auth_session_data = NULL; /* session table entry for the handle */ + TPM_TRANSPORT_INTERNAL *tpm_transport_internal; /* transport table entry for the handle */ + TPM_DAA_SESSION_DATA *tpm_daa_session_data; /* daa session table entry for the handle */ + TPM_NONCE *n1ContextNonce = NULL; +-- +2.26.2 + diff --git a/dev-libs/libtpms/files/libtpms-0.7.0-tpm2-Fix-a-gcc-10.1.0-complaint.patch b/dev-libs/libtpms/files/libtpms-0.7.0-tpm2-Fix-a-gcc-10.1.0-complaint.patch new file mode 100644 index 000000000000..539ddb243d07 --- /dev/null +++ b/dev-libs/libtpms/files/libtpms-0.7.0-tpm2-Fix-a-gcc-10.1.0-complaint.patch @@ -0,0 +1,53 @@ +From f3f78c72a5b6ef42119188ac5af73bb3a0a8bbba Mon Sep 17 00:00:00 2001 +From: Stefan Berger <stefanb@linux.vnet.ibm.com> +Date: Tue, 12 May 2020 13:41:53 -0400 +Subject: [PATCH] tpm2: Fix a gcc 10.1.0 complaint + +This PR addresses issue 133: https://github.com/stefanberger/libtpms/issues/133 + +bin/sh ../libtool --tag=CC --mode=compile x86_64-pc-linux-gnu-gcc \ + -DHAVE_CONFIG_H -I. -I.. -include tpm_library_conf.h \ + -I../include/libtpms -I../include/libtpms -fstack-protector-strong \ + -D_POSIX_ -DTPM_POSIX -DTPM_LIBTPMS_CALLBACKS -I ./tpm2 \ + -I ./tpm2/crypto -I ./tpm2/crypto/openssl -g -O2 \ + -DUSE_OPENSSL_FUNCTIONS_SYMMETRIC=1 -DUSE_OPENSSL_FUNCTIONS_EC=1 \ + -DUSE_OPENSSL_FUNCTIONS_ECDSA=1 -DUSE_OPENSSL_FUNCTIONS_RSA=1 \ + -Wall -Werror -Wreturn-type -Wsign-compare -Wno-self-assign \ + -c -o tpm2/libtpms_tpm2_la-NVDynamic.lo `test -f 'tpm2/NVDynamic.c' \ + || echo './'`tpm2/NVDynamic.c +libtool: compile: x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. \ + -I.. -include tpm_library_conf.h -I../include/libtpms \ + -I../include/libtpms -fstack-protector-strong -D_POSIX_ -DTPM_POSIX \ + -DTPM_LIBTPMS_CALLBACKS -I ./tpm2 -I ./tpm2/crypto \ + -I ./tpm2/crypto/openssl -g -O2 -DUSE_OPENSSL_FUNCTIONS_SYMMETRIC=1 \ + -DUSE_OPENSSL_FUNCTIONS_EC=1 -DUSE_OPENSSL_FUNCTIONS_ECDSA=1 \ + -DUSE_OPENSSL_FUNCTIONS_RSA=1 -Wall -Werror -Wreturn-type -Wsign-compare \ + -Wno-self-assign -c tpm2/NVDynamic.c -fPIC -DPIC \ + -o tpm2/.libs/libtpms_tpm2_la-NVDynamic.o +tpm2/NVDynamic.c: In function ?NvNextByType?: +tpm2/NVDynamic.c:126:10: error: ?nvHandle? may be used uninitialized in this function [-Werror=maybe-uninitialized] + 126 | *handle = nvHandle; + | ~~~~~~~~^~~~~~~~~~ +tpm2/NVDynamic.c: At top level: + +Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> +--- + src/tpm2/NVDynamic.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/tpm2/NVDynamic.c b/src/tpm2/NVDynamic.c +index 32f46bb..4381658 100644 +--- a/src/tpm2/NVDynamic.c ++++ b/src/tpm2/NVDynamic.c +@@ -114,7 +114,7 @@ NvNextByType( + ) + { + NV_REF addr; +- TPM_HANDLE nvHandle; ++ TPM_HANDLE nvHandle = 0; // libtpms changed: gcc 10.1.0 complaint + while((addr = NvNext(iter, &nvHandle)) != 0) + { + // addr: the address of the location containing the handle of the value +-- +2.26.2 + diff --git a/dev-libs/libtpms/libtpms-0.7.0-r1.ebuild b/dev-libs/libtpms/libtpms-0.7.0-r1.ebuild index b13d07d50237..a64f5e30012b 100644 --- a/dev-libs/libtpms/libtpms-0.7.0-r1.ebuild +++ b/dev-libs/libtpms/libtpms-0.7.0-r1.ebuild @@ -17,6 +17,13 @@ DEPEND=" !libressl? ( dev-libs/openssl:0= ) libressl? ( dev-libs/libressl:0= )" RDEPEND="${DEPEND}" +PATCHES=( + "${FILESDIR}/${P}-tpm12-Initialize-some-variables-for-gcc.patch" + "${FILESDIR}/${P}-tpm12-Fix-potential-buffer-overflow-in-filename-creation.patch" + "${FILESDIR}/${P}-tpm12-Initialize-a-few-variables-for-x86-gcc-O3.patch" + "${FILESDIR}/${P}-tpm2-Fix-a-gcc-10.1.0-complaint.patch" + ) + src_prepare() { default eautoreconf |