SKALE-2002 add backup logic to init proccess

parent 07c553db
......@@ -209,8 +209,7 @@ void enter_SEK(){
// if (DEBUG_PRINT)
// std::cerr << "your key is " << SEK << std::endl;
status = trustedSetSEK_backup(eid, &err_status, errMsg.data(), encr_SEK.data(), &enc_len, SEK.c_str() );
status = trustedSetSEK_backup(eid, &err_status, errMsg.data(), encr_SEK.data(), &enc_len, SEK.c_str());
if (status != SGX_SUCCESS){
cerr << "RPCException thrown with status " << status << endl;
throw SGXException(status, errMsg.data());
......@@ -226,13 +225,16 @@ void enter_SEK(){
void initSEK(){
std::shared_ptr<std::string> encr_SEK_ptr = LevelDB::getLevelDb()->readString("SEK");
if (encr_SEK_ptr == nullptr){
spdlog::error("SEK was not created yet. Going to create SEK");
gen_SEK();
}
else{
trustedSetSEK(encr_SEK_ptr);
if (encryptKeys) {
enter_SEK();
} else {
if (encr_SEK_ptr == nullptr) {
spdlog::error("SEK was not created yet. Going to create SEK");
gen_SEK();
} else {
trustedSetSEK(encr_SEK_ptr);
}
}
}
//a002e7ca685d46a32771d16fe2518e58
\ No newline at end of file
//a002e7ca685d46a32771d16fe2518e58
......@@ -118,7 +118,7 @@ int main(int argc, char *argv[]) {
encryptKeysOption = false;
break;
case 'b':
encryptKeysOption = false;
encryptKeysOption = true;
break;
case 'y':
autoconfirmOption = true;
......@@ -132,8 +132,6 @@ int main(int argc, char *argv[]) {
setFullOptions(printDebugInfoOption, printTraceInfoOption, useHTTPSOption, autoconfirmOption, encryptKeysOption);
uint32_t enclaveLogLevel = L_INFO;
if (printTraceInfoOption) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment