From c580a37221059b4c4d841208eeeca2311cf167b9 Mon Sep 17 00:00:00 2001 From: Yang Zhao Date: Sat, 10 Oct 2020 10:25:24 +0800 Subject: [PATCH 1/2] change tee to sworker --- README.md | 2 +- VERSION | 2 +- docs/API.md | 4 ++-- scripts/install.sh | 4 ++-- scripts/package.sh | 2 +- scripts/utils.sh | 6 +++--- src/Config.json | 4 ++-- src/Makefile | 4 ++-- src/app/App.cpp | 2 +- src/app/chain/Chain.cpp | 16 ++++++++-------- src/app/chain/Chain.h | 4 ++-- src/app/config/Config.cpp | 2 +- src/app/config/Config.h | 2 +- src/app/http/ApiHandler.h | 2 +- src/app/ocalls/OCalls.cpp | 4 ++-- src/app/process/Data.cpp | 12 ++++++------ src/app/process/Data.h | 4 ++-- src/app/process/EntryNetwork.cpp | 12 ++++++------ src/app/process/EntryNetwork.h | 2 +- src/app/process/Process.cpp | 8 ++++---- src/app/process/Srd.cpp | 6 +++--- src/app/process/WorkReport.cpp | 2 +- src/enclave/identity/Identity.cpp | 22 +++++++++++----------- src/enclave/identity/Identity.h | 2 +- src/enclave/include/Parameter.h | 2 +- src/enclave/storage/Storage.cpp | 2 +- src/enclave/utils/EUtils.h | 2 +- test/integration/build_test.sh | 4 ++-- test/integration/scripts/start_test.sh | 2 +- 29 files changed, 71 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index 450aab06..89edbcf8 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Please refer to [Crust sWorker docker mode](docs/Docker.md) In /opt/crust/crust-sworker/etc/Config.json file you can configure your sworker application. ``` { - "base_path" : "/opt/crust/crust-sworker/0.5.1/tee_base_path", # sWorker key information location, must be absolute path + "base_path" : "/opt/crust/crust-sworker/0.5.1/sworker_base_path", # sWorker key information location, must be absolute path "base_url": "http://127.0.0.1:12222/api/v0", # your sWorker node api address "srd_paths" : ["/data1", "/data2"], # If this item is not set, base_path will be used "srd_init_capacity" : 4, # srd initial disk storage in Gb diff --git a/VERSION b/VERSION index b8d4d2cd..c74766cf 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ 0.5.1 -TEE=0.5.1 +SWORKER=0.5.1 diff --git a/docs/API.md b/docs/API.md index 40e2a41f..09fe3006 100644 --- a/docs/API.md +++ b/docs/API.md @@ -23,7 +23,7 @@ Output: }, "srd" : { "detail" : { - "/opt/crust/crust-sworker/0.5.1/tee_base_path/test1" : { "assigned" : 57, "available" : 0, "total" : 457 } + "/opt/crust/crust-sworker/0.5.1/sworker_base_path/test1" : { "assigned" : 57, "available" : 0, "total" : 457 } }, "disk_reserved" : 50, "remaining_task" : 1, @@ -57,7 +57,7 @@ Output: "mrenclave" : "aad180124c8670b397a838f552a9136e7e3e7eba2f1c9c49ba16bf53c015b195", "pub_key" : "ad288767765f9402ed9a15ecba7fc56a5e39167f94eefe39c05f5f43862686c0b21328d489d3c7d0c4e19445d49a63c1cedbfad9e027166261ae04eb34868514", "version" : "0.5.1", - "tee_version" : "0.5.1" + "sworker_version" : "0.5.1" } ``` diff --git a/scripts/install.sh b/scripts/install.sh index e89f47d6..5504d899 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,5 +1,5 @@ #!/bin/bash -function checkOldCrustTee() +function checkOldCrustSworker() { verbose INFO "Checking old crust sworker..." h local ret=0 @@ -215,7 +215,7 @@ printf "%s%s\n\n" "$pad" '/____/ |__/|__/\____/_/ /_/|_|\___/_/ /_/_/ /_/__ verbose INFO "Version -----------------$newversion-------------------" # check previous crust-sworker -checkOldCrustTee +checkOldCrustSworker # Install Dependencies if [ "$DOCKERMODLE" == "0" ]; then diff --git a/scripts/package.sh b/scripts/package.sh index 5b77d6aa..6f3695c2 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -35,7 +35,7 @@ trap "success_exit" EXIT # Write version getVERSION > $instdir/VERSION -echo "TEE=$(getTEEVERSION)" >> $instdir/VERSION +echo "SWORKER=$(getSWORKERVERSION)" >> $instdir/VERSION newversion=$(cat $instdir/VERSION | head -n 1) verbose INFO "Start packaging sworker, version is $newversion..." diff --git a/scripts/utils.sh b/scripts/utils.sh index 2caecb1e..1b605282 100755 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -110,12 +110,12 @@ function getVERSION() } # Be careful about this function -function getTEEVERSION() +function getSWORKERVERSION() { local basedir=$(cd `dirname $0`;pwd) local srcdir=$(cd $basedir/../src;pwd) - local tee_para="$srcdir/enclave/include/Parameter.h" - echo $(cat $tee_para | grep "#define TEE_VERSION" | awk '{print $3}' | sed 's/"//g' 2>/dev/null) + local sworker_para="$srcdir/enclave/include/Parameter.h" + echo $(cat $sworker_para | grep "#define SWORKER_VERSION" | awk '{print $3}' | sed 's/"//g' 2>/dev/null) } # color diff --git a/src/Config.json b/src/Config.json index f4fb98da..2a8c7dd4 100644 --- a/src/Config.json +++ b/src/Config.json @@ -1,7 +1,7 @@ { - "base_path" : "/opt/crust/crust-sworker//tee_base_path", + "base_path" : "/opt/crust/crust-sworker//sworker_base_path", "base_url": "http://0.0.0.0:12222/api/v0", - "srd_paths" : ["/opt/crust/crust-sworker//tee_base_path/test1", "/opt/crust/crust-sworker//tee_base_path/test2"], + "srd_paths" : ["/opt/crust/crust-sworker//sworker_base_path/test1", "/opt/crust/crust-sworker//sworker_base_path/test2"], "srd_init_capacity" : 4, "karst_url": "ws://0.0.0.0:17000/api/v0/node/data", diff --git a/src/Makefile b/src/Makefile index 0e7269f0..1792befa 100644 --- a/src/Makefile +++ b/src/Makefile @@ -7,8 +7,8 @@ define setMaxThreadNum sed -i "/^#define ENC_MAX_THREAD_NUM/c #define ENC_MAX_THREAD_NUM $$max_thread_num" app/ecalls/ECalls.h; \ sed -i "/^#define ENC_MAX_THREAD_NUM/c #define ENC_MAX_THREAD_NUM $$max_thread_num" $$enclave_para; \ cat $$app_para | grep "#define VERSION" | awk '{print $$3}' | sed 's/"//g' > ../VERSION; \ - tee_version=$$(cat $$enclave_para | grep "#define TEE_VERSION" | awk '{print $$3}' | sed 's/"//g'); \ - echo "TEE=$$tee_version" >> ../VERSION + sworker_version=$$(cat $$enclave_para | grep "#define SWORKER_VERSION" | awk '{print $$3}' | sed 's/"//g'); \ + echo "SWORKER=$$sworker_version" >> ../VERSION endef ifneq ($(TFLAG), 1) diff --git a/src/app/App.cpp b/src/app/App.cpp index 445481b0..1cf3245d 100644 --- a/src/app/App.cpp +++ b/src/app/App.cpp @@ -40,7 +40,7 @@ int SGX_CDECL main(int argc, char *argv[]) else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0) { printf("Release version: %s\ - \nTEE version: %s\n", VERSION, TEE_VERSION); + \nSWorker version: %s\n", VERSION, SWORKER_VERSION); return 0; } else if (strcmp(argv[i], "--offline") == 0) diff --git a/src/app/chain/Chain.cpp b/src/app/chain/Chain.cpp index 45eee411..9c79acf5 100644 --- a/src/app/chain/Chain.cpp +++ b/src/app/chain/Chain.cpp @@ -202,15 +202,15 @@ bool Chain::wait_for_running(void) } /** - * @description: post tee identity to chain chain - * @param identity -> tee identity + * @description: post sworker identity to chain chain + * @param identity -> sworker identity * @return: success or fail */ -bool Chain::post_tee_identity(std::string identity) +bool Chain::post_sworker_identity(std::string identity) { for(int i = 0; i < 3; i++) { - std::string path = this->url + "/tee/identity"; + std::string path = this->url + "/swork/identity"; ApiHeaders headers = {{"password", this->password}, {"Content-Type", "application/json"}}; json::JSON obj = json::JSON::Load(identity); @@ -238,15 +238,15 @@ bool Chain::post_tee_identity(std::string identity) } /** - * @description: post tee work report to chain - * @param work_report -> tee work report + * @description: post swork work report to chain + * @param work_report -> swork work report * @return: success or fail */ -bool Chain::post_tee_work_report(std::string work_report) +bool Chain::post_sworker_work_report(std::string work_report) { for(int i = 0; i < 3; i++) { - std::string path = this->url + "/tee/workreport"; + std::string path = this->url + "/swork/workreport"; ApiHeaders headers = {{"password", this->password}, {"Content-Type", "application/json"}}; json::JSON obj = json::JSON::Load(work_report); diff --git a/src/app/chain/Chain.h b/src/app/chain/Chain.h index c911e466..48d4564b 100644 --- a/src/app/chain/Chain.h +++ b/src/app/chain/Chain.h @@ -29,8 +29,8 @@ class Chain static Chain *get_instance(); BlockHeader *get_block_header(void); std::string get_block_hash(size_t block_number); - bool post_tee_identity(std::string identity); - bool post_tee_work_report(std::string work_report); + bool post_sworker_identity(std::string identity); + bool post_sworker_work_report(std::string work_report); bool is_online(void); bool is_syncing(void); bool wait_for_running(void); diff --git a/src/app/config/Config.cpp b/src/app/config/Config.cpp index 49b576a1..69f4d252 100644 --- a/src/app/config/Config.cpp +++ b/src/app/config/Config.cpp @@ -80,7 +80,7 @@ void Config::show(void) printf(" 'srd path %d' : '%s',\n", i + 1, this->srd_paths[i].ToString().c_str()); } printf(" 'srd init capacity' : %lu,\n", this->srd_capacity); - printf(" 'tee base url' : '%s',\n", this->base_url.c_str()); + printf(" 'base url' : '%s',\n", this->base_url.c_str()); printf(" 'karst url' : '%s',\n", this->karst_url.c_str()); printf(" 'chain config' : {\n"); diff --git a/src/app/config/Config.h b/src/app/config/Config.h index 83c53aff..1122a762 100644 --- a/src/app/config/Config.h +++ b/src/app/config/Config.h @@ -25,7 +25,7 @@ class Config { public: // base information - std::string base_path; /* TEE base path */ + std::string base_path; /* sworker base path */ json::JSON srd_paths; /* Srd paths */ std::string srd_path; /* srd validation files base path */ std::string db_path; /* DB path */ diff --git a/src/app/http/ApiHandler.h b/src/app/http/ApiHandler.h index 94b7894f..74c58336 100644 --- a/src/app/http/ApiHandler.h +++ b/src/app/http/ApiHandler.h @@ -222,7 +222,7 @@ void ApiHandler::http_handler(beast::string_view /*doc_root*/, Ecall_id_get_info(global_eid); json::JSON id_json = json::JSON::Load(get_g_enclave_id_info()); id_json["version"] = VERSION; - id_json["tee_version"] = TEE_VERSION; + id_json["sworker_version"] = SWORKER_VERSION; res.body() = id_json.dump(); goto getcleanup; } diff --git a/src/app/ocalls/OCalls.cpp b/src/app/ocalls/OCalls.cpp index 21ea9802..bb56f4a0 100644 --- a/src/app/ocalls/OCalls.cpp +++ b/src/app/ocalls/OCalls.cpp @@ -684,12 +684,12 @@ void ocall_srd_change(long change) } /** - * @description: Store tee identity + * @description: Store sworker identity * @param id -> Pointer to identity */ void ocall_store_identity(const char *id) { - set_g_tee_identity(id); + set_g_sworker_identity(id); } /** diff --git a/src/app/process/Data.cpp b/src/app/process/Data.cpp index 71772915..a18d582f 100644 --- a/src/app/process/Data.cpp +++ b/src/app/process/Data.cpp @@ -1,7 +1,7 @@ #include "Data.h" -// Store TEE identity -std::string g_tee_identity = ""; +// Store sworker identity +std::string g_sworker_identity = ""; // Store order report std::string g_order_report = ""; // Store enclave identity information @@ -13,14 +13,14 @@ std::string g_enclave_workreport = ""; // New karst url std::string g_new_karst_url = ""; -std::string get_g_tee_identity() +std::string get_g_sworker_identity() { - return g_tee_identity; + return g_sworker_identity; } -void set_g_tee_identity(std::string identity) +void set_g_sworker_identity(std::string identity) { - g_tee_identity = identity; + g_sworker_identity = identity; } std::string get_g_order_report() diff --git a/src/app/process/Data.h b/src/app/process/Data.h index a500b817..7ed9d8bb 100644 --- a/src/app/process/Data.h +++ b/src/app/process/Data.h @@ -9,8 +9,8 @@ extern "C" { #endif -std::string get_g_tee_identity(); -void set_g_tee_identity(std::string identity); +std::string get_g_sworker_identity(); +void set_g_sworker_identity(std::string identity); std::string get_g_order_report(); void set_g_order_report(std::string order_report); std::string get_g_enclave_id_info(); diff --git a/src/app/process/EntryNetwork.cpp b/src/app/process/EntryNetwork.cpp index 8078bb5f..6dab1cf0 100644 --- a/src/app/process/EntryNetwork.cpp +++ b/src/app/process/EntryNetwork.cpp @@ -9,10 +9,10 @@ crust::Log *p_log = crust::Log::get_instance(); /** * @description: Entry network off-chain node sends quote to onchain node to verify identity * @param p_config -> configurations - * @param tee_identity_out -> tee identity result + * @param sworker_identity_out -> sworker identity result * @return: Success or failure */ -bool entry_network(Config *p_config, std::string &tee_identity_out) +bool entry_network(Config *p_config, std::string &sworker_identity_out) { sgx_quote_sign_type_t linkable = SGX_UNLINKABLE_SIGNATURE; sgx_status_t status, sgxrv; @@ -246,16 +246,16 @@ bool entry_network(Config *p_config, std::string &tee_identity_out) // Verify IAS report in enclave crust_status_t crust_status; - // Ecall_verify_iasreport will store tee identity to g_tee_identity by ocall - // You can get this identity by accessing g_tee_identity + // Ecall_verify_iasreport will store sworker identity to g_sworker_identity by ocall + // You can get this identity by accessing g_sworker_identity sgx_status_t status_ret = Ecall_verify_iasreport(global_eid, &crust_status, const_cast(ias_report.data()), ias_report.size()); if (SGX_SUCCESS == status_ret) { if (CRUST_SUCCESS == crust_status) { - json::JSON tmp_json = json::JSON::Load(get_g_tee_identity()); + json::JSON tmp_json = json::JSON::Load(get_g_sworker_identity()); tmp_json["account_id"] = p_config->chain_address; - tee_identity_out = tmp_json.dump(); + sworker_identity_out = tmp_json.dump(); entry_status = true; p_log->info("Verify IAS report in enclave successfully!\n"); } diff --git a/src/app/process/EntryNetwork.h b/src/app/process/EntryNetwork.h index 0bacacad..6ec56898 100644 --- a/src/app/process/EntryNetwork.h +++ b/src/app/process/EntryNetwork.h @@ -23,6 +23,6 @@ #define OPT_LINK 0x04 #define OPT_PUBKEY 0x08 -bool entry_network(Config *p_config, std::string &tee_identity_out); +bool entry_network(Config *p_config, std::string &sworker_identity_out); #endif /* !_CRUST_ENTRY_NETWORK_H_ */ diff --git a/src/app/process/Process.cpp b/src/app/process/Process.cpp index c1c1ba05..7bc109fd 100644 --- a/src/app/process/Process.cpp +++ b/src/app/process/Process.cpp @@ -164,7 +164,7 @@ int process_run() pid_t worker_pid = getpid(); sgx_status_t sgx_status = SGX_SUCCESS; crust_status_t crust_status = CRUST_SUCCESS; - std::string tee_identity_result = ""; + std::string sworker_identity_result = ""; int return_status = 1; p_log->info("WorkerPID = %d\n", worker_pid); @@ -219,12 +219,12 @@ int process_run() { // Entry network p_log->info("Entrying network...\n"); - if (!entry_network(p_config, tee_identity_result)) + if (!entry_network(p_config, sworker_identity_result)) { goto cleanup; return_status = -1; } - p_log->info("Entry network application successfully! TEE identity: %s\n", tee_identity_result.c_str()); + p_log->info("Entry network application successfully! SWORKER identity: %s\n", sworker_identity_result.c_str()); // Send identity to crust chain if (!crust::Chain::get_instance()->wait_for_running()) @@ -233,7 +233,7 @@ int process_run() goto cleanup; } - if (!crust::Chain::get_instance()->post_tee_identity(tee_identity_result)) + if (!crust::Chain::get_instance()->post_sworker_identity(sworker_identity_result)) { p_log->err("Send identity to crust chain failed!\n"); return_status = -1; diff --git a/src/app/process/Srd.cpp b/src/app/process/Srd.cpp index ae5eebaa..e80d333c 100644 --- a/src/app/process/Srd.cpp +++ b/src/app/process/Srd.cpp @@ -427,9 +427,9 @@ void set_reserved_space(size_t reserved) } /** - * @description: Get old TEE's reserved space from url - * @param url -> Indicates old TEE url - * @return: Old TEE srd reserved space + * @description: Get old sworker's reserved space from url + * @param url -> Indicates old sworker url + * @return: Old sworker srd reserved space */ long get_old_reserved_space(std::string url) { diff --git a/src/app/process/WorkReport.cpp b/src/app/process/WorkReport.cpp index f3ac9954..230d9328 100644 --- a/src/app/process/WorkReport.cpp +++ b/src/app/process/WorkReport.cpp @@ -90,7 +90,7 @@ void work_report_loop(void) remove_char(work_str, '\\'); remove_char(work_str, '\n'); remove_char(work_str, ' '); - if (!p_chain->post_tee_work_report(work_str)) + if (!p_chain->post_sworker_work_report(work_str)) { p_log->err("Send work report to crust chain failed!\n"); } diff --git a/src/enclave/identity/Identity.cpp b/src/enclave/identity/Identity.cpp index 02a6bd98..b18b0d97 100644 --- a/src/enclave/identity/Identity.cpp +++ b/src/enclave/identity/Identity.cpp @@ -589,7 +589,7 @@ crust_status_t id_verify_iasreport(char **IASReport, size_t size) goto cleanup; } - // Get tee identity and store it outside of tee + // Get sworker identity and store it outside of sworker id_json[IAS_CERT] = certchain_1; id_json[IAS_SIG] = ias_sig; id_json[IAS_ISV_BODY] = isv_body; @@ -758,7 +758,7 @@ void id_get_metadata(json::JSON &meta_json, bool locked /*=true*/) meta_json = json::JSON(); goto cleanup; } - meta_json = json::JSON::Load(p_data + strlen(TEE_PRIVATE_TAG), data_len); + meta_json = json::JSON::Load(p_data + strlen(SWORKER_PRIVATE_TAG), data_len); if (meta_json.size() == 0) { goto cleanup; @@ -814,7 +814,7 @@ crust_status_t id_metadata_set_by_new(json::JSON meta_json) } meta_str = meta_json_org.dump(); - meta_len = meta_str.size() + strlen(TEE_PRIVATE_TAG); + meta_len = meta_str.size() + strlen(SWORKER_PRIVATE_TAG); p_meta = (uint8_t*)enc_malloc(meta_len); if (p_meta == NULL) { @@ -822,8 +822,8 @@ crust_status_t id_metadata_set_by_new(json::JSON meta_json) goto cleanup; } memset(p_meta, 0, meta_len); - memcpy(p_meta, TEE_PRIVATE_TAG, strlen(TEE_PRIVATE_TAG)); - memcpy(p_meta + strlen(TEE_PRIVATE_TAG), meta_str.c_str(), meta_str.size()); + memcpy(p_meta, SWORKER_PRIVATE_TAG, strlen(SWORKER_PRIVATE_TAG)); + memcpy(p_meta + strlen(SWORKER_PRIVATE_TAG), meta_str.c_str(), meta_str.size()); crust_status = persist_set(ID_METADATA, p_meta, meta_len); free(p_meta); @@ -881,7 +881,7 @@ crust_status_t id_metadata_del_by_key(std::string key) p_obj.object->erase(key); meta_str = meta_json_org.dump(); - meta_len = meta_str.size() + strlen(TEE_PRIVATE_TAG); + meta_len = meta_str.size() + strlen(SWORKER_PRIVATE_TAG); p_meta = (uint8_t*)enc_malloc(meta_len); if (p_meta == NULL) { @@ -889,8 +889,8 @@ crust_status_t id_metadata_del_by_key(std::string key) goto cleanup; } memset(p_meta, 0, meta_len); - memcpy(p_meta, TEE_PRIVATE_TAG, strlen(TEE_PRIVATE_TAG)); - memcpy(p_meta + strlen(TEE_PRIVATE_TAG), meta_str.c_str(), meta_str.size()); + memcpy(p_meta, SWORKER_PRIVATE_TAG, strlen(SWORKER_PRIVATE_TAG)); + memcpy(p_meta + strlen(SWORKER_PRIVATE_TAG), meta_str.c_str(), meta_str.size()); crust_status = persist_set(ID_METADATA, p_meta, meta_len); free(p_meta); @@ -922,7 +922,7 @@ crust_status_t id_store_metadata() meta_len += it.second.size() * (64 + 3); } meta_len += wl->srd_path2hashs_m.size() * (128 + 4); - meta_len += strlen(TEE_PRIVATE_TAG) + 5 + meta_len += strlen(SWORKER_PRIVATE_TAG) + 5 + strlen(ID_WORKLOAD) + 5 + strlen(ID_KEY_PAIR) + 5 + strlen(ID_REPORT_SLOT) + 5 @@ -945,8 +945,8 @@ crust_status_t id_store_metadata() size_t offset = 0; // ----- Store metadata ----- // - memcpy(meta_buf, TEE_PRIVATE_TAG, strlen(TEE_PRIVATE_TAG)); - offset += strlen(TEE_PRIVATE_TAG); + memcpy(meta_buf, SWORKER_PRIVATE_TAG, strlen(SWORKER_PRIVATE_TAG)); + offset += strlen(SWORKER_PRIVATE_TAG); memcpy(meta_buf + offset, "{", 1); offset += 1; // Append srd diff --git a/src/enclave/identity/Identity.h b/src/enclave/identity/Identity.h index 0233a973..bc362dde 100644 --- a/src/enclave/identity/Identity.h +++ b/src/enclave/identity/Identity.h @@ -88,7 +88,7 @@ crust_status_t id_metadata_set_or_append(const char *key, T val, } std::string key_str(key); - std::string meta_str(TEE_PRIVATE_TAG); + std::string meta_str(SWORKER_PRIVATE_TAG); json::JSON meta_json; crust_status_t crust_status = CRUST_SUCCESS; id_get_metadata(meta_json, false); diff --git a/src/enclave/include/Parameter.h b/src/enclave/include/Parameter.h index d42dc61f..15acc323 100644 --- a/src/enclave/include/Parameter.h +++ b/src/enclave/include/Parameter.h @@ -1,7 +1,7 @@ #ifndef _ENCLAVE_RESOURCE_H_ #define _ENCLAVE_RESOURCE_H_ -#define TEE_VERSION "0.5.1" +#define SWORKER_VERSION "0.5.1" #define LEAF_SEPARATOR "+leaf+" diff --git a/src/enclave/storage/Storage.cpp b/src/enclave/storage/Storage.cpp index 9d45a3cc..c35fcf18 100644 --- a/src/enclave/storage/Storage.cpp +++ b/src/enclave/storage/Storage.cpp @@ -374,7 +374,7 @@ crust_status_t storage_unseal_file(char **files, size_t files_num, const char *p } // Check if data is private data - if (memcmp(p_decrypted_data, TEE_PRIVATE_TAG, strlen(TEE_PRIVATE_TAG)) == 0) + if (memcmp(p_decrypted_data, SWORKER_PRIVATE_TAG, strlen(SWORKER_PRIVATE_TAG)) == 0) { crust_status = CRUST_MALWARE_DATA_BLOCK; goto cleanup; diff --git a/src/enclave/utils/EUtils.h b/src/enclave/utils/EUtils.h index 7831d0c1..3e6d9e8c 100644 --- a/src/enclave/utils/EUtils.h +++ b/src/enclave/utils/EUtils.h @@ -17,7 +17,7 @@ namespace json } // Data tag to enclave only data -#define TEE_PRIVATE_TAG "&+CRUSTTEEPRIVATE+&" +#define SWORKER_PRIVATE_TAG "&+CRUSTSWORKERPRIVATE+&" /* The size of a srd disk leaf file */ #define SRD_RAND_DATA_LENGTH 1048576 diff --git a/test/integration/build_test.sh b/test/integration/build_test.sh index e76a5268..a42d0db9 100755 --- a/test/integration/build_test.sh +++ b/test/integration/build_test.sh @@ -528,8 +528,8 @@ function InstallAPP() cp $basedir/VERSION $testdir # Modify config file - sed -i -e "/\"base_path\" :/c \\\t\"base_path\" : \"$testdir/tee_base_path\"," \ - -e "/\"srd_paths\" :/c \\\t\"srd_paths\" : [\"$testdir/tee_base_path/srd\"]," $configfile + sed -i -e "/\"base_path\" :/c \\\t\"base_path\" : \"$testdir/sworker_base_path\"," \ + -e "/\"srd_paths\" :/c \\\t\"srd_paths\" : [\"$testdir/sworker_base_path/srd\"]," $configfile sed -i "s/\///g" $configfile } diff --git a/test/integration/scripts/start_test.sh b/test/integration/scripts/start_test.sh index baad3d9d..87088c34 100755 --- a/test/integration/scripts/start_test.sh +++ b/test/integration/scripts/start_test.sh @@ -113,7 +113,7 @@ fi ### Start crust-sworker cd $testdir -rm -rf tee_base_path +rm -rf sworker_base_path rm -rf files mkdir files verbose INFO "starting crust-sworker..." h From 441fcab1383cf1eec9c4dc31c54705766bff5f71 Mon Sep 17 00:00:00 2001 From: Yang Zhao Date: Sat, 10 Oct 2020 10:53:34 +0800 Subject: [PATCH 2/2] upgrade to 0.6.0 --- README.md | 4 ++-- VERSION | 4 ++-- docs/API.md | 6 +++--- src/app/chain/Chain.cpp | 4 ++-- src/app/include/Resource.h | 2 +- src/app/process/Process.cpp | 2 +- src/enclave/include/Parameter.h | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 89edbcf8..3facb041 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Please refer to [Crust sWorker docker mode](docs/Docker.md) In /opt/crust/crust-sworker/etc/Config.json file you can configure your sworker application. ``` { - "base_path" : "/opt/crust/crust-sworker/0.5.1/sworker_base_path", # sWorker key information location, must be absolute path + "base_path" : "/opt/crust/crust-sworker/0.6.0/sworker_base_path", # sWorker key information location, must be absolute path "base_url": "http://127.0.0.1:12222/api/v0", # your sWorker node api address "srd_paths" : ["/data1", "/data2"], # If this item is not set, base_path will be used "srd_init_capacity" : 4, # srd initial disk storage in Gb @@ -72,7 +72,7 @@ In /opt/crust/crust-sworker/etc/Config.json file you can configure your sworker ### Run ``` -/opt/crust/crust-sworker/0.5.1/bin/crust-sworker -c /opt/crust/crust-sworker/0.5.1/etc/Config.json +/opt/crust/crust-sworker/0.6.0/bin/crust-sworker -c /opt/crust/crust-sworker/0.6.0/etc/Config.json ``` ### Crust sWorker executable file diff --git a/VERSION b/VERSION index c74766cf..8bc27edd 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -0.5.1 -SWORKER=0.5.1 +0.6.0 +SWORKER=0.6.0 diff --git a/docs/API.md b/docs/API.md index 09fe3006..45bae027 100644 --- a/docs/API.md +++ b/docs/API.md @@ -23,7 +23,7 @@ Output: }, "srd" : { "detail" : { - "/opt/crust/crust-sworker/0.5.1/sworker_base_path/test1" : { "assigned" : 57, "available" : 0, "total" : 457 } + "/opt/crust/crust-sworker/0.6.0/sworker_base_path/test1" : { "assigned" : 57, "available" : 0, "total" : 457 } }, "disk_reserved" : 50, "remaining_task" : 1, @@ -56,8 +56,8 @@ Output: { "mrenclave" : "aad180124c8670b397a838f552a9136e7e3e7eba2f1c9c49ba16bf53c015b195", "pub_key" : "ad288767765f9402ed9a15ecba7fc56a5e39167f94eefe39c05f5f43862686c0b21328d489d3c7d0c4e19445d49a63c1cedbfad9e027166261ae04eb34868514", - "version" : "0.5.1", - "sworker_version" : "0.5.1" + "version" : "0.6.0", + "sworker_version" : "0.6.0" } ``` diff --git a/src/app/chain/Chain.cpp b/src/app/chain/Chain.cpp index 9c79acf5..34651c46 100644 --- a/src/app/chain/Chain.cpp +++ b/src/app/chain/Chain.cpp @@ -238,8 +238,8 @@ bool Chain::post_sworker_identity(std::string identity) } /** - * @description: post swork work report to chain - * @param work_report -> swork work report + * @description: post sworker work report to chain + * @param work_report -> sworker work report * @return: success or fail */ bool Chain::post_sworker_work_report(std::string work_report) diff --git a/src/app/include/Resource.h b/src/app/include/Resource.h index 7ae178c3..aa98ae59 100644 --- a/src/app/include/Resource.h +++ b/src/app/include/Resource.h @@ -1,4 +1,4 @@ -#define VERSION "0.5.1" +#define VERSION "0.6.0" #define CRUST_INST_DIR "/opt/crust/crust-sworker/" VERSION #define ENCLAVE_FILE_PATH CRUST_INST_DIR "/etc/enclave.signed.so" diff --git a/src/app/process/Process.cpp b/src/app/process/Process.cpp index 7bc109fd..50f0239f 100644 --- a/src/app/process/Process.cpp +++ b/src/app/process/Process.cpp @@ -224,7 +224,7 @@ int process_run() goto cleanup; return_status = -1; } - p_log->info("Entry network application successfully! SWORKER identity: %s\n", sworker_identity_result.c_str()); + p_log->info("Entry network application successfully! Identity: %s\n", sworker_identity_result.c_str()); // Send identity to crust chain if (!crust::Chain::get_instance()->wait_for_running()) diff --git a/src/enclave/include/Parameter.h b/src/enclave/include/Parameter.h index 767e9fdc..338521e6 100644 --- a/src/enclave/include/Parameter.h +++ b/src/enclave/include/Parameter.h @@ -1,7 +1,7 @@ #ifndef _ENCLAVE_RESOURCE_H_ #define _ENCLAVE_RESOURCE_H_ -#define SWORKER_VERSION "0.5.1" +#define SWORKER_VERSION "0.6.0" #define LEAF_SEPARATOR "+leaf+"