!179 fix spec error and the null pointer judgment

From: @zhengxiaoxiaoGitee 
Reviewed-by: @houmingyong 
Signed-off-by: @houmingyong
This commit is contained in:
openeuler-ci-bot 2024-06-03 15:00:47 +00:00 committed by Gitee
commit 91e48f1cae
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 35 additions and 12 deletions

View File

@ -3,12 +3,13 @@ From: houmingyong <houmingyong@huawei.com>
Date: Tue, 28 May 2024 10:25:41 +0800
Subject: [PATCH] init attestation
The current patch incorporates the following four commit points:
The current patch incorporates the following commit points:
Reference: https://gitee.com/openeuler/secGear/commit/d06b6beab9ae13898870297e8ef2ae806cd8d6d0
https://gitee.com/openeuler/secGear/commit/b90e039631f1031a485ef038174c0bef831223a5
https://gitee.com/openeuler/secGear/commit/dad056809c5e94b50c47063d728d5f1e47800512
https://gitee.com/openeuler/secGear/commit/ce4c7b6a8c013cd208004a3cec13a15fff100b1a
https://gitee.com/openeuler/secGear/commit/8e02b257d9bec81bc557d6431e90448522ad6270
Conflict:no
---
.../attestation/attestation-agent/Cargo.toml | 30 ++
@ -18,7 +19,7 @@ Conflict:no
.../attestation-agent/agent/src/agent.rs | 144 +++++++
.../agent/src/bin/aa-test/main.rs | 68 ++++
.../agent/src/bin/generate-headers/main.rs | 4 +
.../attestation-agent/agent/src/lib.rs | 53 +++
.../attestation-agent/agent/src/lib.rs | 84 ++++
.../attestation-agent/attester/Cargo.toml | 24 ++
.../attester/src/itrustee/itrustee.rs | 51 +++
.../attester/src/itrustee/mod.rs | 130 ++++++
@ -32,7 +33,7 @@ Conflict:no
.../verifier/src/itrustee/mod.rs | 58 +++
.../attestation-service/verifier/src/lib.rs | 51 +++
.../verifier/src/virtcca/mod.rs | 373 ++++++++++++++++++
21 files changed, 1474 insertions(+)
21 files changed, 1505 insertions(+)
create mode 100644 service/attestation/attestation-agent/Cargo.toml
create mode 100644 service/attestation/attestation-agent/README.md
create mode 100644 service/attestation/attestation-agent/agent/Cargo.toml
@ -394,7 +395,7 @@ new file mode 100644
index 0000000..0f1efc2
--- /dev/null
+++ b/service/attestation/attestation-agent/agent/src/lib.rs
@@ -0,0 +1,53 @@
@@ -0,0 +1,72 @@
+use agent::*;
+pub mod agent;
+
@ -404,10 +405,19 @@ index 0000000..0f1efc2
+use attester::EvidenceRequest;
+
+#[ffi_export]
+pub fn get_reprot(c_uuid: &repr_c::String, c_challenge: &repr_c::Vec<u8>) -> repr_c::Vec<u8> {
+ let input = EvidenceRequest {
+ uuid: c_uuid.clone().to_string(),
+ challenge: c_challenge.clone().to_vec(),
+pub fn get_reprot(c_uuid: Option<&repr_c::String>, c_challenge: Option<&repr_c::Vec<u8>>) -> repr_c::Vec<u8> {
+ let uuid = match c_uuid {
+ None => {println!("uuid is null"); return Vec::new().into();},
+ Some(uuid) => uuid.clone().to_string(),
+ };
+ let challenge = match c_challenge {
+ None => {println!("challenge is null"); return Vec::new().into();},
+ Some(cha) => cha.clone().to_vec(),
+ };
+
+ let input: EvidenceRequest = EvidenceRequest {
+ uuid: uuid,
+ challenge: challenge,
+ };
+
+ let fut = async {
@ -425,9 +435,19 @@ index 0000000..0f1efc2
+}
+
+#[ffi_export]
+pub fn verify_report(c_challenge: &repr_c::Vec<u8>, report: &repr_c::Vec<u8>) -> safer_ffi::libc::c_int {
+pub fn verify_report(c_challenge: Option<&repr_c::Vec<u8>>, report: Option<&repr_c::Vec<u8>>) -> safer_ffi::libc::c_int {
+ let challenge = match c_challenge {
+ None => {println!("challenge is null"); return 1;},
+ Some(cha) => cha.clone().to_vec(),
+ };
+
+ let report = match report {
+ None => {println!("report is null"); return 1;},
+ Some(report) => report.clone().to_vec(),
+ };
+
+ let fut = async {agent::AttestationAgent::default().verify_evidence(
+ &c_challenge.clone().to_vec(), &report.clone().to_vec()).await};
+ &challenge, &report).await};
+ let ret = block_on(fut);
+ if ret.is_err() {
+ println!("verfiy report failed");

View File

@ -1,6 +1,6 @@
Name: secGear
Version: 0.1.0
Release: 36
Release: 37
Summary: secGear is an SDK to develop confidential computing apps based on hardware enclave features
@ -162,7 +162,7 @@ replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
EOF
cargo build --features virtcca --lib --release
%{_cargo} build --features virtcca,no_as --lib --release
%endif
%install
@ -251,6 +251,9 @@ popd
systemctl restart rsyslog
%changelog
* Mon Jun 3 2024 zhengxiaoxiao <zhengxiaoxiao2@huawei.com> - 0.1.0-37
- fix spec error and the null pointer judgment
* Tue May 28 2024 zhengxiaoxiao <zhengxiaoxiao2@huawei.com> - 0.1.0-36
- add init-attestation.patch