1 Star 0 Fork 36

xuraoqing/src-secGear

forked from src-openEuler/secGear 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0072-use-memset-instead-of-explicit_bzero.patch 2.27 KB
一键复制 编辑 原始数据 按行查看 历史
houmingyong 提交于 2024-06-20 19:42 . synchoronous features
From 248f56df792c14421074a6049ac668464070a574 Mon Sep 17 00:00:00 2001
From: zhengxiaoxiao <zhengxiaoxiao2@huawei.com>
Date: Tue, 12 Mar 2024 16:53:22 +0800
Subject: [PATCH] use memset instead of explicit_bzero
Reference: https://gitee.com/openeuler/secGear/commit/248f56df792c14421074a6049ac668464070a574
Conflict: NA
---
src/enclave_src/gp/itrustee/itrustee_seal_data.c | 8 ++++----
src/host_src/enclave.c | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/enclave_src/gp/itrustee/itrustee_seal_data.c b/src/enclave_src/gp/itrustee/itrustee_seal_data.c
index cae1734..b074d6f 100644
--- a/src/enclave_src/gp/itrustee/itrustee_seal_data.c
+++ b/src/enclave_src/gp/itrustee/itrustee_seal_data.c
@@ -139,13 +139,13 @@ TEE_Result itrustee_seal_data(uint8_t *seal_data, uint32_t seal_data_len, void *
result = data_copy(tmp_sealed_data, salt, nonce, mac_data, mac_data_len);
error0:
- explicit_bzero(nonce, SEAL_DATA_NONCE_LEN);
+ memset(nonce, 0, SEAL_DATA_NONCE_LEN);
TEE_Free(nonce);
error1:
- explicit_bzero(salt, SEAL_KEY_SALT_LEN);
+ memset(salt, 0, SEAL_KEY_SALT_LEN);
TEE_Free(salt);
error2:
- explicit_bzero(key_buf, SEAL_KEY_LEN);
+ memset(key_buf, 0, SEAL_KEY_LEN);
TEE_Free(key_buf);
return result;
}
@@ -251,7 +251,7 @@ TEE_Result itrustee_unseal_data(void *sealed_data, uint8_t *decrypted_data, uint
}
done:
- explicit_bzero(key_buf, SEAL_KEY_LEN);
+ memset(key_buf, 0, SEAL_KEY_LEN);
TEE_Free(key_buf);
return result;
}
diff --git a/src/host_src/enclave.c b/src/host_src/enclave.c
index d8b7d35..f13feec 100644
--- a/src/host_src/enclave.c
+++ b/src/host_src/enclave.c
@@ -70,7 +70,7 @@ static void error_handle(cc_enclave_t *enclave, void *handle, p_tee_registered r
if (enclave) {
pthread_rwlock_destroy(&enclave->rwlock);
- explicit_bzero(enclave, sizeof(cc_enclave_t));
+ memset(enclave, 0, sizeof(cc_enclave_t));
}
}
@@ -310,7 +310,7 @@ cc_enclave_result_t cc_enclave_destroy(cc_enclave_t *context)
}
pthread_rwlock_unlock(&context->rwlock);
pthread_rwlock_destroy(&context->rwlock);
- explicit_bzero(context, sizeof(cc_enclave_t));
+ memset(context, 0, sizeof(cc_enclave_t));
return CC_SUCCESS;
}
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xuraoqing/src-secGear.git
git@gitee.com:xuraoqing/src-secGear.git
xuraoqing
src-secGear
src-secGear
master

搜索帮助