SKALE-2977 clean up

parent c53e67de
......@@ -198,6 +198,9 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
strncpy(xStrArg, xStr->c_str(), BUF_LEN);
strncpy(yStrArg, yStr->c_str(), BUF_LEN);
delete xStr;
delete yStr;
size_t sz = 0;
uint8_t encryptedKey[BUF_LEN];
......@@ -206,8 +209,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
if (!result) {
cerr << "Invalid hex encrypted key" << endl;
delete xStr;
delete yStr;
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid hex encrypted key"));
}
......@@ -219,15 +220,11 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
if (status != SGX_SUCCESS) {
cerr << "SGX enclave call to trustedBlsSignMessage failed with status:" << status << std::endl;
delete xStr;
delete yStr;
BOOST_THROW_EXCEPTION(runtime_error("SGX enclave call to trustedBlsSignMessage failed"));
}
if (errStatus != 0) {
cerr << "SGX enclave call to trustedBlsSignMessage failed with errStatus:" << errStatus << std::endl;
delete xStr;
delete yStr;
BOOST_THROW_EXCEPTION(runtime_error("SGX enclave call to trustedBlsSignMessage failed"));
}
......@@ -240,9 +237,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
strncpy(_sig, sig.c_str(), BUF_LEN);
delete xStr;
delete yStr;
return true;
}
......
......@@ -236,13 +236,11 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
exception_ptr p = current_exception();
printf("Exception %s \n", p.__cxa_exception_type()->name());
result["status"] = -1;
result["errorMessage"] = "Read key share has thrown exception:";
result["errorMessage"] = "Read key share has thrown exception";
return result;
}
try {
static std::mutex g_mtx;
std::lock_guard<std::mutex> lock(g_mtx);
if (!bls_sign(value->c_str(), _messageHash.c_str(), t, n, _signerIndex, &signature.front())) {
result["status"] = -1;
result["errorMessage"] = "Could not sign";
......
......@@ -43,8 +43,6 @@ EXTERNC bool hex2carray2(const char * _hex, uint64_t *_bin_len,
uint8_t* _bin, const int _max_length );
EXTERNC void enclave_init();
void get_global_random(unsigned char* _randBuff, uint64_t size);
EXTERNC void LOG_INFO(const char* msg);
......
......@@ -1262,7 +1262,7 @@ void trustedDecryptKeyAES(int *errStatus, char *errString, uint8_t *encryptedPri
}
*errStatus = 0;
memcpy(errString, AES_key, 1024);
memcpy(errString, AES_key, BUF_LEN);
}
void trustedBlsSignMessageAES(int *errStatus, char *errString, uint8_t *encryptedPrivateKey,
......
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