Unverified Commit 4a53d7a3 authored by kladko's avatar kladko

SKALE-3067-cleanup-sgx

parent 6abbcc3e
...@@ -426,6 +426,8 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName, ...@@ -426,6 +426,8 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName,
Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const Json::Value &_pubKeys, int _t, int _n) { Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const Json::Value &_pubKeys, int _t, int _n) {
INIT_RESULT(result); INIT_RESULT(result);
result["secretShare"] = "";
result["SecretShare"] = "";
try { try {
if (_pubKeys.size() != (uint64_t) _n) { if (_pubKeys.size() != (uint64_t) _n) {
...@@ -450,14 +452,10 @@ Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const J ...@@ -450,14 +452,10 @@ Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const J
string s = trustedGetSecretShares(_polyName, encrPoly->c_str(), pubKeysStrs, _t, _n); string s = trustedGetSecretShares(_polyName, encrPoly->c_str(), pubKeysStrs, _t, _n);
result["secretShare"] = s; result["secretShare"] = s;
} catch (SGXException &_e) { result["SecretShare"] = s;
result["status"] = _e.status; } HANDLE_SGX_EXCEPTION(result)
result["errorMessage"] = _e.errString;
result["secretShare"] = "";
result["SecretShare"] = "";
}
return result; RETURN_SUCCESS(result)
} }
Json::Value SGXWalletServer::dkgVerificationImpl(const string &_publicShares, const string &_ethKeyName, Json::Value SGXWalletServer::dkgVerificationImpl(const string &_publicShares, const string &_ethKeyName,
...@@ -500,8 +498,6 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string ...@@ -500,8 +498,6 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string
try { try {
if (_secretShare.length() != (uint64_t) _n * 192) { if (_secretShare.length() != (uint64_t) _n * 192) {
spdlog::error("Invalid secret share length - {}", _secretShare.length());
spdlog::error("Secret share - {}", _secretShare);
throw SGXException(INVALID_SECRET_SHARES_LENGTH, "Invalid secret share length"); throw SGXException(INVALID_SECRET_SHARES_LENGTH, "Invalid secret share length");
} }
if (!checkECDSAKeyName(_ethKeyName)) { if (!checkECDSAKeyName(_ethKeyName)) {
...@@ -539,7 +535,7 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string ...@@ -539,7 +535,7 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string
} HANDLE_SGX_EXCEPTION(result) } HANDLE_SGX_EXCEPTION(result)
return result; RETURN_SUCCESS(result);
} }
Json::Value SGXWalletServer::getBLSPublicKeyShareImpl(const string &_blsKeyName) { Json::Value SGXWalletServer::getBLSPublicKeyShareImpl(const string &_blsKeyName) {
...@@ -550,8 +546,6 @@ Json::Value SGXWalletServer::getBLSPublicKeyShareImpl(const string &_blsKeyName) ...@@ -550,8 +546,6 @@ Json::Value SGXWalletServer::getBLSPublicKeyShareImpl(const string &_blsKeyName)
throw SGXException(INVALID_BLS_NAME, "Invalid BLSKey name"); throw SGXException(INVALID_BLS_NAME, "Invalid BLSKey name");
} }
shared_ptr <string> encryptedKeyHex_ptr = readFromDb(_blsKeyName); shared_ptr <string> encryptedKeyHex_ptr = readFromDb(_blsKeyName);
spdlog::debug("encr_bls_key_share is {}", *encryptedKeyHex_ptr);
spdlog::debug("length is {}", encryptedKeyHex_ptr->length());
vector <string> public_key_vect = GetBLSPubKey(encryptedKeyHex_ptr->c_str()); vector <string> public_key_vect = GetBLSPubKey(encryptedKeyHex_ptr->c_str());
for (uint8_t i = 0; i < 4; i++) { for (uint8_t i = 0; i < 4; i++) {
...@@ -578,7 +572,7 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int ...@@ -578,7 +572,7 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int
result["dhKey"] = DHKey; result["dhKey"] = DHKey;
} HANDLE_SGX_EXCEPTION(result) } HANDLE_SGX_EXCEPTION(result)
return result; RETURN_SUCCESS(result);
} }
Json::Value SGXWalletServer::multG2Impl(const string &_x) { Json::Value SGXWalletServer::multG2Impl(const string &_x) {
...@@ -591,7 +585,7 @@ Json::Value SGXWalletServer::multG2Impl(const string &_x) { ...@@ -591,7 +585,7 @@ Json::Value SGXWalletServer::multG2Impl(const string &_x) {
} }
} HANDLE_SGX_EXCEPTION(result) } HANDLE_SGX_EXCEPTION(result)
return result; RETURN_SUCCESS(result);
} }
Json::Value SGXWalletServer::isPolyExistsImpl(const string &_polyName) { Json::Value SGXWalletServer::isPolyExistsImpl(const string &_polyName) {
...@@ -607,18 +601,18 @@ Json::Value SGXWalletServer::isPolyExistsImpl(const string &_polyName) { ...@@ -607,18 +601,18 @@ Json::Value SGXWalletServer::isPolyExistsImpl(const string &_polyName) {
} }
} HANDLE_SGX_EXCEPTION(result) } HANDLE_SGX_EXCEPTION(result)
return result; RETURN_SUCCESS(result);
} }
Json::Value SGXWalletServer::getServerStatusImpl() { Json::Value SGXWalletServer::getServerStatusImpl() {
INIT_RESULT(result) INIT_RESULT(result)
return result; RETURN_SUCCESS(result)
} }
Json::Value SGXWalletServer::getServerVersionImpl() { Json::Value SGXWalletServer::getServerVersionImpl() {
INIT_RESULT(result) INIT_RESULT(result)
result["version"] = TOSTRING(SGXWALLET_VERSION); result["version"] = TOSTRING(SGXWALLET_VERSION);
return result; RETURN_SUCCESS(result)
} }
Json::Value SGXWalletServer::deleteBlsKeyImpl(const std::string& name) { Json::Value SGXWalletServer::deleteBlsKeyImpl(const std::string& name) {
......
...@@ -184,7 +184,6 @@ void TestUtils::sendRPCRequest() { ...@@ -184,7 +184,6 @@ void TestUtils::sendRPCRequest() {
string polyName = string polyName =
"POLY:SCHAIN_ID:" + to_string(schainID) + ":NODE_ID:" + to_string(i) + ":DKG_ID:" + to_string(dkgID); "POLY:SCHAIN_ID:" + to_string(schainID) + ":NODE_ID:" + to_string(i) + ":DKG_ID:" + to_string(dkgID);
auto response = c.generateDKGPoly(polyName, t); auto response = c.generateDKGPoly(polyName, t);
cerr << response << endl;
CHECK_STATE(response["status"] == 0); CHECK_STATE(response["status"] == 0);
polyNames[i] = polyName; polyNames[i] = polyName;
verifVects[i] = c.getVerificationVector(polyName, t, n); verifVects[i] = c.getVerificationVector(polyName, t, n);
......
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