secGear/0068-bugfix-when-input-empty-hash.patch
2023-09-18 11:13:44 +08:00

28 lines
1.2 KiB
Diff

From 5df0040e56c697ffc4797c798dcbafde796ff5e5 Mon Sep 17 00:00:00 2001
From: houmingyong <houmingyong@huawei.com>
Date: Sat, 3 Jun 2023 16:05:25 +0800
Subject: [PATCH] bugfix when input empty hash
---
component/local_attest/gp_local_attest.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/component/local_attest/gp_local_attest.c b/component/local_attest/gp_local_attest.c
index 7f75147..53dc5d9 100644
--- a/component/local_attest/gp_local_attest.c
+++ b/component/local_attest/gp_local_attest.c
@@ -59,8 +59,8 @@ static cc_enclave_result_t gp_compare_hash(gp_basevalue_t *basevalue, char *ta_i
PrintInfo(PRINT_STRACE, "heximg:%s, hexmem:%s", heximg, hexmem);
PrintInfo(PRINT_STRACE, "img_hash:%s, mem_hash:%s", basevalue->img_hash, basevalue->mem_hash);
- if (memcmp(heximg, basevalue->img_hash, strlen(basevalue->img_hash)) != 0 ||
- memcmp(hexmem, basevalue->mem_hash, strlen(basevalue->mem_hash)) != 0) {
+ if (memcmp(heximg, basevalue->img_hash, strlen(heximg)) != 0 ||
+ memcmp(hexmem, basevalue->mem_hash, strlen(hexmem)) != 0) {
PrintInfo(PRINT_ERROR, "verify local report hash failed!\n");
return CC_ERROR_LOCAL_REPORT_HASH_MISMATCH;
}
--
2.33.0