You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by ms...@apache.org on 2020/09/08 23:48:09 UTC

[incubator-teaclave] branch master updated: Print out error message instead of logging for the sgx tool (#416)

This is an automated email from the ASF dual-hosted git repository.

mssun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git


The following commit(s) were added to refs/heads/master by this push:
     new 4c6205f  Print out error message instead of logging for the sgx tool (#416)
4c6205f is described below

commit 4c6205f902d2a840ed9feabe52738dd52eb09048
Author: Mingshen Sun <bo...@mssun.me>
AuthorDate: Tue Sep 8 16:48:01 2020 -0700

    Print out error message instead of logging for the sgx tool (#416)
---
 cmake/scripts/gen_enclave_sig.sh |  4 +++-
 tool/app/src/main.rs             | 14 ++++++--------
 tool/enclave/src/lib.rs          |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/cmake/scripts/gen_enclave_sig.sh b/cmake/scripts/gen_enclave_sig.sh
index 6fe2670..753de14 100755
--- a/cmake/scripts/gen_enclave_sig.sh
+++ b/cmake/scripts/gen_enclave_sig.sh
@@ -23,7 +23,9 @@ for var in "${REQUIRED_ENVS[@]}"; do
     [ -z "${!var}" ] && echo "Please set ${var}" && exit -1
 done
 
-cd ${TEACLAVE_OUT_DIR} && cat *_enclave_info.toml > ${TEACLAVE_SERVICE_INSTALL_DIR}/enclave_info.toml
+if ls "${TEACLAVE_OUT_DIR}"/*_enclave_info.toml > /dev/null 2>&1; then
+    cat ${TEACLAVE_OUT_DIR}/*_enclave_info.toml > ${TEACLAVE_SERVICE_INSTALL_DIR}/enclave_info.toml
+fi
 
 AUDITOR_PATHS=$(find ${TEACLAVE_AUDITORS_DIR} -mindepth 1 -maxdepth 1 -type d)
 for auditor_path in ${AUDITOR_PATHS}; do
diff --git a/tool/app/src/main.rs b/tool/app/src/main.rs
index e76376c..6183de3 100644
--- a/tool/app/src/main.rs
+++ b/tool/app/src/main.rs
@@ -15,8 +15,8 @@
 // specific language governing permissions and limitations
 // under the License.
 
+use anyhow::anyhow;
 use anyhow::Result;
-use log::error;
 use std::process;
 use structopt::StructOpt;
 use teaclave_binder::proto::{ECallCommand, RawJsonInput, RawJsonOutput};
@@ -36,21 +36,19 @@ fn attestation(opt: &AttestationOpt) -> anyhow::Result<()> {
     Ok(())
 }
 
-fn start_enclave_unit_test_driver(tee: &TeeBinder, opt: &AttestationOpt) -> anyhow::Result<()> {
+fn start_enclave_remote_attestation(tee: &TeeBinder, opt: &AttestationOpt) -> anyhow::Result<()> {
     let cmd = ECallCommand::Raw;
     let json = serde_json::to_string(opt)?;
     let input = RawJsonInput::new(json);
     match tee.invoke::<RawJsonInput, TeeServiceResult<RawJsonOutput>>(cmd, input) {
-        Err(e) => error!("{:?}", e),
-        Ok(Err(e)) => error!("{:?}", e),
-        _ => (),
+        Err(e) => Err(anyhow!("{:?}", e)),
+        Ok(Err(e)) => Err(anyhow!("{:?}", e)),
+        _ => Ok(()),
     }
-
-    Ok(())
 }
 
 fn run(tee: &TeeBinder, opt: &AttestationOpt) -> anyhow::Result<()> {
-    start_enclave_unit_test_driver(tee, opt)?;
+    start_enclave_remote_attestation(tee, opt)?;
 
     Ok(())
 }
diff --git a/tool/enclave/src/lib.rs b/tool/enclave/src/lib.rs
index 4fb13f3..80f8bdf 100644
--- a/tool/enclave/src/lib.rs
+++ b/tool/enclave/src/lib.rs
@@ -67,7 +67,7 @@ fn attestation(raw_json_input: &RawJsonInput) -> anyhow::Result<()> {
 }
 
 #[handle_ecall]
-fn handle_run_test(input: &RawJsonInput) -> TeeServiceResult<RawJsonOutput> {
+fn handle_remote_attestation(input: &RawJsonInput) -> TeeServiceResult<RawJsonOutput> {
     match attestation(input) {
         Ok(_) => Ok(RawJsonOutput::default()),
         Err(e) => {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org