68 lines
2.3 KiB
Diff
68 lines
2.3 KiB
Diff
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
|
|
|