[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.7] stubdom/vtpm: fix memcmp in TPM_ChangeAuthAsymFinish



commit 9c8275944829c55af3dc708712ca5c120b1bb328
Author:     Olaf Hering <olaf@xxxxxxxxx>
AuthorDate: Mon Jun 18 14:55:36 2018 +0200
Commit:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
CommitDate: Wed Nov 7 10:49:17 2018 +0000

    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@xxxxxxxxx>
    Reviewed-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
    (cherry picked from commit 22bf5be3237cb482a2ffd772ffd20ce37285eebf)
    (cherry picked from commit dea9fc0e02d92f5e6d46680aa0a52fa758eca9c4)
    (cherry picked from commit e907460fd61c350487ffee5d8aa375bef56bc81c)
    Conflicts:
            stubdom/Makefile
    Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    
    (cherry picked from commit f13983db120f5e56dfefbee5d56678d2d43e2914)
    (cherry picked from commit d6798ce35707a485d9c132319d70dd654620e5e5)
---
 stubdom/Makefile                            |  1 +
 stubdom/vtpm_TPM_ChangeAuthAsymFinish.patch | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 2044d76ed6..4d52ea274d 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -221,6 +221,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 $@
diff --git a/stubdom/vtpm_TPM_ChangeAuthAsymFinish.patch 
b/stubdom/vtpm_TPM_ChangeAuthAsymFinish.patch
new file mode 100644
index 0000000000..10b89a4c3a
--- /dev/null
+++ b/stubdom/vtpm_TPM_ChangeAuthAsymFinish.patch
@@ -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;
+   }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.7

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.