Unverified Commit 8d448910 authored by kladko's avatar kladko

SKALE-3205

parent 5dbec9eb
...@@ -57,6 +57,8 @@ ...@@ -57,6 +57,8 @@
#include "SGXException.h" #include "SGXException.h"
#include "SGXWalletServer.hpp" #include "SGXWalletServer.hpp"
uint32_t enclaveLogLevel = 0;
void initUserSpace() { void initUserSpace() {
libff::inhibit_profiling_counters = true; libff::inhibit_profiling_counters = true;
...@@ -110,7 +112,7 @@ void initEnclave() { ...@@ -110,7 +112,7 @@ void initEnclave() {
spdlog::info("Enclave created and started successfully"); spdlog::info("Enclave created and started successfully");
status = trustedEnclaveInit(eid, logLevel); status = trustedEnclaveInit(eid, enclaveLogLevel);
} }
if (status != SGX_SUCCESS) { if (status != SGX_SUCCESS) {
...@@ -122,10 +124,13 @@ void initEnclave() { ...@@ -122,10 +124,13 @@ void initEnclave() {
} }
void initAll(uint32_t _logLevel, bool _checkCert, bool _autoSign) { void initAll(uint32_t _logLevel, bool _checkCert, bool _autoSign) {
static atomic<bool> sgxServerInited(false); static atomic<bool> sgxServerInited(false);
static mutex initMutex; static mutex initMutex;
enclaveLogLevel = _logLevel;
lock_guard <mutex> lock(initMutex); lock_guard <mutex> lock(initMutex);
...@@ -138,7 +143,8 @@ void initAll(uint32_t _logLevel, bool _checkCert, bool _autoSign) { ...@@ -138,7 +143,8 @@ void initAll(uint32_t _logLevel, bool _checkCert, bool _autoSign) {
CHECK_STATE(sgxServerInited != 1) CHECK_STATE(sgxServerInited != 1)
sgxServerInited = 1; sgxServerInited = 1;
initEnclave(_logLevel);
initEnclave();
initUserSpace(); initUserSpace();
initSEK(); initSEK();
......
...@@ -36,7 +36,7 @@ EXTERNC void initAll(uint32_t _logLevel, bool _checkCert, bool _autoSign); ...@@ -36,7 +36,7 @@ EXTERNC void initAll(uint32_t _logLevel, bool _checkCert, bool _autoSign);
EXTERNC void initUserSpace(); EXTERNC void initUserSpace();
EXTERNC void initEnclave(uint32_t _logLevel); EXTERNC void initEnclave();
......
...@@ -111,4 +111,5 @@ extern uint64_t initTime; ...@@ -111,4 +111,5 @@ extern uint64_t initTime;
#define WRITE_LOCK(__X__) std::unique_lock<std::shared_timed_mutex> __LOCK__(__X__); #define WRITE_LOCK(__X__) std::unique_lock<std::shared_timed_mutex> __LOCK__(__X__);
#endif //SGXWALLET_COMMON_H #endif //SGXWALLET_COMMON_H
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