Unverified Commit 24667d66 authored by kladko's avatar kladko

SKALE-3205

parent 178b5ed5
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "BLSCrypto.h" #include "BLSCrypto.h"
#include "SEKManager.h"
#include "ECDSACrypto.h" #include "ECDSACrypto.h"
void fillRandomBuffer(vector<unsigned char> &_buffer) { void fillRandomBuffer(vector<unsigned char> &_buffer) {
...@@ -58,12 +59,11 @@ vector <string> genECDSAKey() { ...@@ -58,12 +59,11 @@ vector <string> genECDSAKey() {
sgx_status_t status = SGX_SUCCESS; sgx_status_t status = SGX_SUCCESS;
{ RESTART_BEGIN
READ_LOCK(initMutex);
status = trustedGenerateEcdsaKeyAES(eid, &errStatus, status = trustedGenerateEcdsaKeyAES(eid, &errStatus,
errMsg.data(), encr_pr_key.data(), &enc_len, errMsg.data(), encr_pr_key.data(), &enc_len,
pub_key_x.data(), pub_key_y.data()); pub_key_x.data(), pub_key_y.data());
} RESTART_END
HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus,errMsg.data()); HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus,errMsg.data());
...@@ -106,11 +106,10 @@ string getECDSAPubKey(const std::string& _encryptedKeyHex) { ...@@ -106,11 +106,10 @@ string getECDSAPubKey(const std::string& _encryptedKeyHex) {
sgx_status_t status = SGX_SUCCESS; sgx_status_t status = SGX_SUCCESS;
{ RESTART_BEGIN
READ_LOCK(initMutex);
status = trustedGetPublicEcdsaKeyAES(eid, &errStatus, status = trustedGetPublicEcdsaKeyAES(eid, &errStatus,
errMsg.data(), encrPrKey.data(), enc_len, pubKeyX.data(), pubKeyY.data()); errMsg.data(), encrPrKey.data(), enc_len, pubKeyX.data(), pubKeyY.data());
} RESTART_END
HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus, errMsg.data()) HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus, errMsg.data())
...@@ -196,13 +195,12 @@ vector <string> ecdsaSignHash(const std::string& encryptedKeyHex, const char *ha ...@@ -196,13 +195,12 @@ vector <string> ecdsaSignHash(const std::string& encryptedKeyHex, const char *ha
sgx_status_t status = SGX_SUCCESS; sgx_status_t status = SGX_SUCCESS;
{ RESTART_BEGIN
READ_LOCK(initMutex);
status = trustedEcdsaSignAES(eid, &errStatus, status = trustedEcdsaSignAES(eid, &errStatus,
errMsg.data(), encryptedKey.data(), decLen, hashHex, errMsg.data(), encryptedKey.data(), decLen, hashHex,
signatureR.data(), signatureR.data(),
signatureS.data(), &signatureV, base); signatureS.data(), &signatureV, base);
} RESTART_END
HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus, errMsg.data()); HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus, errMsg.data());
......
...@@ -124,7 +124,7 @@ spdlog::error(__FUNCTION__); \ ...@@ -124,7 +124,7 @@ spdlog::error(__FUNCTION__); \
spdlog::error("Restarting sgx ..."); \ spdlog::error("Restarting sgx ..."); \
reinitEnclave(); \ reinitEnclave(); \
} \ } \
} while (__ATTEMPTS__ < 2); } while (status != SGX_SUCCESS && __ATTEMPTS__ < 2);
......
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