Unverified Commit 16e1dd98 authored by kladko's avatar kladko

SKALE-3067-cleanup-sgx

parent c5084a4b
...@@ -187,10 +187,7 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k ...@@ -187,10 +187,7 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
result["encryptedKeyShare"] = encryptedKeyShareHex; result["encryptedKeyShare"] = encryptedKeyShareHex;
writeKeyShare(_keyShareName, encryptedKeyShareHex, _index, n, t); writeKeyShare(_keyShareName, encryptedKeyShareHex, _index, n, t);
} catch (SGXException &_e) { } HANDLE_SGX_EXCEPTION(result)
result["status"] = _e.status;
result["errorMessage"] = _e.errString;
}
RETURN_SUCCESS(result); RETURN_SUCCESS(result);
} }
...@@ -394,6 +391,7 @@ Json::Value SGXWalletServer::generateDKGPolyImpl(const string &_polyName, int _t ...@@ -394,6 +391,7 @@ Json::Value SGXWalletServer::generateDKGPolyImpl(const string &_polyName, int _t
Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName, int _t, int _n) { Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName, int _t, int _n) {
INIT_RESULT(result) INIT_RESULT(result)
result["verificationVector"] = "";
vector <vector<string>> verifVector; vector <vector<string>> verifVector;
try { try {
...@@ -414,12 +412,7 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName, ...@@ -414,12 +412,7 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName,
result["verificationVector"][i][j] = currentCoef.at(j); result["verificationVector"][i][j] = currentCoef.at(j);
} }
} }
} catch (SGXException &_e) { } HANDLE_SGX_EXCEPTION(result)
cerr << " err str " << _e.errString << endl;
result["status"] = _e.status;
result["errorMessage"] = _e.errString;
result["verificationVector"] = "";
}
return result; return result;
} }
...@@ -427,6 +420,9 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName, ...@@ -427,6 +420,9 @@ 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) {
throw SGXException(INVALID_DKG_PARAMS, "invalid number of public keys"); throw SGXException(INVALID_DKG_PARAMS, "invalid number of public keys");
...@@ -450,12 +446,7 @@ Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const J ...@@ -450,12 +446,7 @@ 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) { } HANDLE_SGX_EXCEPTION(result);
result["status"] = _e.status;
result["errorMessage"] = _e.errString;
result["secretShare"] = "";
result["SecretShare"] = "";
}
return result; return result;
} }
...@@ -463,7 +454,9 @@ Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const J ...@@ -463,7 +454,9 @@ Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const J
Json::Value SGXWalletServer::dkgVerificationImpl(const string &_publicShares, const string &_ethKeyName, Json::Value SGXWalletServer::dkgVerificationImpl(const string &_publicShares, const string &_ethKeyName,
const string &_secretShare, int _t, int _n, int _index) { const string &_secretShare, int _t, int _n, int _index) {
INIT_RESULT(result) INIT_RESULT(result)
result["result"] = true;
result["result"] = false;
try { try {
if (!checkECDSAKeyName(_ethKeyName)) { if (!checkECDSAKeyName(_ethKeyName)) {
...@@ -484,12 +477,9 @@ Json::Value SGXWalletServer::dkgVerificationImpl(const string &_publicShares, co ...@@ -484,12 +477,9 @@ Json::Value SGXWalletServer::dkgVerificationImpl(const string &_publicShares, co
if (!verifyShares(_publicShares.c_str(), _secretShare.c_str(), encryptedKeyHex_ptr->c_str(), _t, _n, _index)) { if (!verifyShares(_publicShares.c_str(), _secretShare.c_str(), encryptedKeyHex_ptr->c_str(), _t, _n, _index)) {
result["result"] = false; result["result"] = false;
} }
} catch (SGXException &_e) { } HANDLE_SGX_EXCEPTION(result)
result["status"] = _e.status;
result["errorMessage"] = _e.errString;
result["result"] = false;
}
result["result"] = true;
return result; return result;
} }
......
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