SKALE-2977 clean up

parent e5ffa2e9
...@@ -134,6 +134,9 @@ std::string BLSPrivateKeyShareSGX::signWithHelperSGXstr( ...@@ -134,6 +134,9 @@ std::string BLSPrivateKeyShareSGX::signWithHelperSGXstr(
strncpy(xStrArg, xStr->c_str(), BUF_LEN); strncpy(xStrArg, xStr->c_str(), BUF_LEN);
strncpy(yStrArg, yStr->c_str(), BUF_LEN); strncpy(yStrArg, yStr->c_str(), BUF_LEN);
delete xStr;
delete yStr;
size_t sz = 0; size_t sz = 0;
uint8_t encryptedKey[BUF_LEN]; uint8_t encryptedKey[BUF_LEN];
...@@ -142,8 +145,6 @@ std::string BLSPrivateKeyShareSGX::signWithHelperSGXstr( ...@@ -142,8 +145,6 @@ std::string BLSPrivateKeyShareSGX::signWithHelperSGXstr(
if (!result) { if (!result) {
cerr << "Invalid hex encrypted key" << endl; cerr << "Invalid hex encrypted key" << endl;
delete xStr;
delete yStr;
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid hex encrypted key")); BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid hex encrypted key"));
} }
...@@ -157,22 +158,16 @@ std::string BLSPrivateKeyShareSGX::signWithHelperSGXstr( ...@@ -157,22 +158,16 @@ std::string BLSPrivateKeyShareSGX::signWithHelperSGXstr(
if (status != SGX_SUCCESS) { if (status != SGX_SUCCESS) {
gmp_printf("SGX enclave call to trustedBlsSignMessage failed: 0x%04x\n", status); gmp_printf("SGX enclave call to trustedBlsSignMessage failed: 0x%04x\n", status);
delete xStr;
delete yStr;
BOOST_THROW_EXCEPTION(runtime_error("SGX enclave call to trustedBlsSignMessage failed")); BOOST_THROW_EXCEPTION(runtime_error("SGX enclave call to trustedBlsSignMessage failed"));
} }
if (errStatus != 0) { if (errStatus != 0) {
delete xStr;
delete yStr;
BOOST_THROW_EXCEPTION(runtime_error("Enclave trustedBlsSignMessage failed:" + to_string(errStatus) + ":" + errMsg )); BOOST_THROW_EXCEPTION(runtime_error("Enclave trustedBlsSignMessage failed:" + to_string(errStatus) + ":" + errMsg ));
} }
int sigLen; int sigLen;
if ((sigLen = strnlen(signature, 10)) < 10) { if ((sigLen = strnlen(signature, 10)) < 10) {
delete xStr;
delete yStr;
BOOST_THROW_EXCEPTION(runtime_error("Signature is too short:" + to_string(sigLen))); BOOST_THROW_EXCEPTION(runtime_error("Signature is too short:" + to_string(sigLen)));
} }
...@@ -184,9 +179,6 @@ std::string BLSPrivateKeyShareSGX::signWithHelperSGXstr( ...@@ -184,9 +179,6 @@ std::string BLSPrivateKeyShareSGX::signWithHelperSGXstr(
sig.append(":"); sig.append(":");
sig.append(hint); sig.append(hint);
delete xStr;
delete yStr;
return sig; return sig;
} }
......
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