stubdom/vtpm: fix memcmp in TPM_ChangeAuthAsymFinish

gcc8 spotted this error:
error: 'memcmp' reading 20 bytes from a region of size 8 [-Werror=stringop-overflow=]

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
(cherry picked from commit 22bf5be323)
(cherry picked from commit dea9fc0e02)
(cherry picked from commit e907460fd6)
Conflicts:
	stubdom/Makefile
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>

(cherry picked from commit f13983db12)
This commit is contained in:
Olaf Hering authored and Ian Jackson committed 2018-11-07 10:48:55 +00:00
1 parent d792e577dc
commit d6798ce357
2 files changed
+13

No files matched your search

+1
View File
@@ -223,6 +223,7 @@ tpm_emulator-$(XEN_TARGET_ARCH): tpm_emulator-$(TPMEMU_VERSION).tar.gz
patch -d $@ -p1 < vtpm-deepquote.patch
patch -d $@ -p1 < vtpm-deepquote-anyloc.patch
patch -d $@ -p1 < vtpm-cmake-Wextra.patch
patch -d $@ -p1 < vtpm_TPM_ChangeAuthAsymFinish.patch
mkdir $@/build
cd $@/build; CC=${CC} $(CMAKE) .. -DCMAKE_C_FLAGS:STRING="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-declaration-after-statement"
touch $@
@@ -0,0 +1,12 @@
error: 'memcmp' reading 20 bytes from a region of size 8 [-Werror=stringop-overflow=]
--- a/tpm/tpm_deprecated.c
+++ b/tpm/tpm_deprecated.c
@@ -434,7 +434,7 @@ TPM_RESULT TPM_ChangeAuthAsymFinish(TPM_
tpm_hmac_final(&hmac_ctx, b1.digest);
/* 6. The TPM SHALL compare b1 with newAuthLink. The TPM SHALL
indicate a failure if the values do not match. */
- if (memcmp(&b1, &newAuthLink, sizeof(TPM_HMAC))) {
+ if (memcmp(&b1, newAuthLink, sizeof(TPM_HMAC))) {
debug("TPM_ChangeAuthAsymFinish(): newAuthLink value does not match.");
return TPM_FAIL;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.