Unverified Commit 755819ae authored by kladko's avatar kladko

Seal/unseal fails

parent aa034c4c
...@@ -36,6 +36,10 @@ public: ...@@ -36,6 +36,10 @@ public:
SGXException(int32_t _status, const char* _errString) : status(_status), errString(_errString) {} SGXException(int32_t _status, const char* _errString) : status(_status), errString(_errString) {}
std::string getMessage() {
return "SGXException:status:" + std::to_string(status) + ":" + errString;
}
}; };
#endif //SGXD_RPCEXCEPTION_H #endif //SGXD_RPCEXCEPTION_H
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#include "CSRManagerServer.h" #include "CSRManagerServer.h"
#include "BLSCrypto.h" #include "BLSCrypto.h"
#include "ServerInit.h" #include "ServerInit.h"
#include "SGXException.h"
#include "SGXWalletServer.hpp" #include "SGXWalletServer.hpp"
void initUserSpace() { void initUserSpace() {
...@@ -104,9 +105,18 @@ void initEnclave(uint32_t _logLevel) { ...@@ -104,9 +105,18 @@ void initEnclave(uint32_t _logLevel) {
spdlog::info("Enclave libtgmp library and logging initialized successfully"); spdlog::info("Enclave libtgmp library and logging initialized successfully");
} }
void initAll(uint32_t _logLevel, bool _checkCert, bool _autoSign) { void initAll(uint32_t _logLevel, bool _checkCert, bool _autoSign) {
static atomic<int> sgxServerInited(0); static atomic<bool> sgxServerInited(false);
static mutex initMutex;
lock_guard <mutex> lock(initMutex);
if (sgxServerInited)
return;
try {
cout << "Running sgxwallet version:" << SGXWalletServer::getVersion() << endl; cout << "Running sgxwallet version:" << SGXWalletServer::getVersion() << endl;
...@@ -123,4 +133,15 @@ void initAll(uint32_t _logLevel, bool _checkCert, bool _autoSign) { ...@@ -123,4 +133,15 @@ void initAll(uint32_t _logLevel, bool _checkCert, bool _autoSign) {
} else { } else {
SGXWalletServer::initHttpServer(); SGXWalletServer::initHttpServer();
} }
} sgxServerInited = true;
} catch (SGXException &_e) {
spdlog::error(_e.getMessage());
} catch (exception &_e) {
spdlog::error(_e.what());
}
catch (...) {
exception_ptr p = current_exception();
printf("Exception %s \n", p.__cxa_exception_type()->name());
spdlog::error("Unknown exception");
}
};
...@@ -229,14 +229,9 @@ void trustedGenerateSEK(int *errStatus, char *errString, ...@@ -229,14 +229,9 @@ void trustedGenerateSEK(int *errStatus, char *errString,
SAFE_CHAR_BUF(errS, BUF_LEN); SAFE_CHAR_BUF(errS, BUF_LEN);
sprintf(errS, "status $d", status); return;
LOG_ERROR(errS);
CHECK_STATUS("seal/unseal SEK failed after SEK generation in unseal");
// CHECK_STATUS("seal/unseal SEK failed after SEK generation in unseal");
*enc_len = sealedLen; *enc_len = sealedLen;
......
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