SKALE-3951 remove extra params

parent 32063a16
......@@ -150,7 +150,7 @@ string gen_dkg_poly(int _t) {
return result;
}
vector <vector<string>> get_verif_vect(const string &encryptedPolyHex, int t, int n) {
vector <vector<string>> get_verif_vect(const string &encryptedPolyHex, int t) {
auto encryptedPolyHexPtr = encryptedPolyHex.c_str();
......@@ -174,7 +174,7 @@ vector <vector<string>> get_verif_vect(const string &encryptedPolyHex, int t, in
sgx_status_t status = SGX_SUCCESS;
status = trustedGetPublicShares(eid, &errStatus, errMsg.data(), encrDKGPoly.data(), encLen,
pubShares.data(), t, n);
pubShares.data(), t);
HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus, errMsg.data());
......@@ -189,7 +189,7 @@ vector <vector<string>> get_verif_vect(const string &encryptedPolyHex, int t, in
}
vector <vector<string>> getVerificationVectorMult(const std::string &encryptedPolyHex, int t, int n, size_t ind) {
auto verificationVector = get_verif_vect(encryptedPolyHex, t, n);
auto verificationVector = get_verif_vect(encryptedPolyHex, t);
vector <vector<string>> result(t);
......
......@@ -33,7 +33,7 @@ using namespace std;
string gen_dkg_poly( int _t);
vector <vector<string>> get_verif_vect(const string& encryptedPolyHex, int t, int n);
vector <vector<string>> get_verif_vect(const string& encryptedPolyHex, int t);
vector <vector<string>> getVerificationVectorMult(const std::string& encryptedPolyHex, int t, int n, size_t ind);
......
......@@ -501,7 +501,7 @@ Json::Value SGXWalletServer::generateDKGPolyImpl(const string &_polyName, int _t
RETURN_SUCCESS(result)
}
Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName, int _t, int _n) {
Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName, int _t) {
COUNT_STATISTICS
spdlog::info("Entering {}", __FUNCTION__);
INIT_RESULT(result)
......@@ -511,13 +511,13 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName,
if (!checkName(_polyName, "POLY")) {
throw SGXException(INVALID_DKG_GETVV_POLY_NAME, string(__FUNCTION__) + ":Invalid polynomial name");
}
if (!check_n_t(_t, _n)) {
throw SGXException(INVALID_DKG_GETVV_PARAMS, string(__FUNCTION__) + ":Invalid parameters n or t ");
if (_t <= 0) {
throw SGXException(INVALID_DKG_GETVV_PARAMS, string(__FUNCTION__) + ":Invalid t ");
}
shared_ptr <string> encrPoly = readFromDb(_polyName);
verifVector = get_verif_vect(*encrPoly, _t, _n);
verifVector = get_verif_vect(*encrPoly, _t);
for (int i = 0; i < _t; i++) {
vector <string> currentCoef = verifVector.at(i);
......@@ -1000,8 +1000,8 @@ Json::Value SGXWalletServer::generateDKGPoly(const string &_polyName, int _t) {
return generateDKGPolyImpl(_polyName, _t);
}
Json::Value SGXWalletServer::getVerificationVector(const string &_polynomeName, int _t, int _n) {
return getVerificationVectorImpl(_polynomeName, _t, _n);
Json::Value SGXWalletServer::getVerificationVector(const string &_polynomeName, int _t) {
return getVerificationVectorImpl(_polynomeName, _t);
}
Json::Value SGXWalletServer::getSecretShare(const string &_polyName, const Json::Value &_publicKeys, int t, int n) {
......
......@@ -82,7 +82,7 @@ public:
virtual Json::Value generateDKGPoly(const string &_polyName, int _t);
virtual Json::Value getVerificationVector(const string &_polynomeName, int _t, int _n);
virtual Json::Value getVerificationVector(const string &_polynomeName, int _t);
virtual Json::Value getSecretShare(const string &_polyName, const Json::Value &_publicKeys, int t, int n);
......@@ -140,7 +140,7 @@ public:
static Json::Value generateDKGPolyImpl(const string &_polyName, int _t);
static Json::Value getVerificationVectorImpl(const string &_polyName, int _t, int _n);
static Json::Value getVerificationVectorImpl(const string &_polyName, int _t);
static Json::Value getSecretShareImpl(const string &_polyName, const Json::Value &_pubKeys, int _t, int _n);
......
......@@ -197,7 +197,7 @@ void TestUtils::sendRPCRequest() {
polyNames[i] = polyName;
for (int i3 = 0; i3 <= testCount; i3++) {
verifVects[i] = c.getVerificationVector(polyName, t, n);
verifVects[i] = c.getVerificationVector(polyName, t);
CHECK_STATE(verifVects[i]["status"] == 0);
}
......@@ -317,7 +317,7 @@ void TestUtils::sendRPCRequestV2() {
auto response = c.generateDKGPoly(polyName, t);
CHECK_STATE(response["status"] == 0);
polyNames[i] = polyName;
verifVects[i] = c.getVerificationVector(polyName, t, n);
verifVects[i] = c.getVerificationVector(polyName, t);
CHECK_STATE(verifVects[i]["status"] == 0);
pubEthKeys.append(ethKeys[i]["publicKey"]);
......@@ -421,7 +421,7 @@ void TestUtils::sendRPCRequestZMQ() {
auto response = c.generateDKGPoly(polyName, t);
CHECK_STATE(response["status"] == 0);
polyNames[i] = polyName;
verifVects[i] = c.getVerificationVector(polyName, t, n);
verifVects[i] = c.getVerificationVector(polyName, t);
CHECK_STATE(verifVects[i]["status"] == 0);
pubEthKeys.append(ethKeys[i]["publicKey"]);
......@@ -519,7 +519,7 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
Json::Value response = c.generateDKGPoly(polyName, t);
CHECK_STATE(response["status"] == 0);
polyNames[i] = polyName;
verifVects[i] = c.getVerificationVector(polyName, t, n);
verifVects[i] = c.getVerificationVector(polyName, t);
CHECK_STATE(verifVects[i]["status"] == 0);
pubEthKeys.append(ethKeys[i]["publicKey"]);
}
......@@ -660,7 +660,7 @@ void TestUtils::doDKGV2(StubClient &c, int n, int t,
Json::Value response = c.generateDKGPoly(polyName, t);
CHECK_STATE(response["status"] == 0);
polyNames[i] = polyName;
verifVects[i] = c.getVerificationVector(polyName, t, n);
verifVects[i] = c.getVerificationVector(polyName, t);
CHECK_STATE(verifVects[i]["status"] == 0);
pubEthKeys.append(ethKeys[i]["publicKey"]);
}
......@@ -802,7 +802,7 @@ void TestUtils::doZMQBLS(shared_ptr<ZMQClient> _zmqClient, StubClient &c, int n,
Json::Value response = c.generateDKGPoly(polyName, t);
CHECK_STATE(response["status"] == 0);
polyNames[i] = polyName;
verifVects[i] = c.getVerificationVector(polyName, t, n);
verifVects[i] = c.getVerificationVector(polyName, t);
CHECK_STATE(verifVects[i]["status"] == 0);
pubEthKeys.append(ethKeys[i]["publicKey"]);
}
......
......@@ -45,7 +45,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
this->bindAndAddMethod(jsonrpc::Procedure("ecdsaSignMessageHash", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "base",jsonrpc::JSON_INTEGER,"keyName",jsonrpc::JSON_STRING,"messageHash",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::ecdsaSignMessageHashI);
this->bindAndAddMethod(jsonrpc::Procedure("generateDKGPoly", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "polyName",jsonrpc::JSON_STRING,"t",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::generateDKGPolyI);
this->bindAndAddMethod(jsonrpc::Procedure("getVerificationVector", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT,"polyName",jsonrpc::JSON_STRING, "t",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::getVerificationVectorI);
this->bindAndAddMethod(jsonrpc::Procedure("getVerificationVector", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "polyName", jsonrpc::JSON_STRING, "t", jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::getVerificationVectorI);
this->bindAndAddMethod(jsonrpc::Procedure("getSecretShare", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "polyName",jsonrpc::JSON_STRING,"publicKeys",jsonrpc::JSON_ARRAY, "n",jsonrpc::JSON_INTEGER,"t",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::getSecretShareI);
this->bindAndAddMethod(jsonrpc::Procedure("dkgVerification", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "publicShares",jsonrpc::JSON_STRING, "ethKeyName",jsonrpc::JSON_STRING, "secretShare",jsonrpc::JSON_STRING,"t",jsonrpc::JSON_INTEGER, "n",jsonrpc::JSON_INTEGER, "index",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::dkgVerificationI);
this->bindAndAddMethod(jsonrpc::Procedure("createBLSPrivateKey", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "blsKeyName",jsonrpc::JSON_STRING, "ethKeyName",jsonrpc::JSON_STRING, "polyName", jsonrpc::JSON_STRING, "secretShare",jsonrpc::JSON_STRING,"t", jsonrpc::JSON_INTEGER,"n",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::createBLSPrivateKeyI);
......@@ -97,7 +97,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
}
inline virtual void getVerificationVectorI(const Json::Value &request, Json::Value &response)
{
response = this->getVerificationVector(request["polyName"].asString(), request["t"].asInt(), request["n"].asInt());
response = this->getVerificationVector(request["polyName"].asString(), request["t"].asInt());
}
inline virtual void getSecretShareI(const Json::Value &request, Json::Value &response)
{
......@@ -169,7 +169,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
virtual Json::Value ecdsaSignMessageHash(int base, const std::string& keyName, const std::string& messageHash) = 0;
virtual Json::Value generateDKGPoly(const std::string& polyName, int t) = 0;
virtual Json::Value getVerificationVector(const std::string& polyName, int t, int n) = 0;
virtual Json::Value getVerificationVector(const std::string& polyName, int t) = 0;
virtual Json::Value getSecretShare(const std::string& polyName, const Json::Value& publicKeys, int t, int n) = 0;
virtual Json::Value dkgVerification( const std::string& publicShares, const std::string& ethKeyName, const std::string& SecretShare, int t, int n, int index) = 0;
virtual Json::Value createBLSPrivateKey(const std::string& blsKeyName, const std::string& ethKeyName, const std::string& polyName, const std::string& SecretShare, int t, int n) = 0;
......
......@@ -987,14 +987,14 @@ void trustedGetEncryptedSecretShareV2(int *errStatus, char *errString,
void trustedGetPublicShares(int *errStatus, char *errString, uint8_t *encrypted_dkg_secret, uint64_t enc_len,
char *public_shares,
unsigned _t, unsigned _n) {
unsigned _t) {
LOG_INFO(__FUNCTION__);
INIT_ERROR_STATE
CHECK_STATE(encrypted_dkg_secret);
CHECK_STATE(public_shares);
CHECK_STATE(_t <= _n && _n > 0)
CHECK_STATE(_t > 0)
SAFE_CHAR_BUF(decrypted_dkg_secret, DKG_MAX_SEALED_LEN);
......
......@@ -121,8 +121,7 @@ enclave {
[in, count = 3050] uint8_t* encrypted_dkg_secret,
uint64_t enc_len,
[out, count = 10000] char* public_shares,
unsigned _t,
unsigned _n);
unsigned _t);
public void trustedDkgVerify(
[out] int *errStatus,
......
......@@ -98,11 +98,10 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
}
Json::Value getVerificationVector(const std::string& polyName, int t, int n)
Json::Value getVerificationVector(const std::string& polyName, int t)
{
Json::Value p;
p["polyName"] = polyName;
p["n"] = n;
p["t"] = t;
Json::Value result = this->CallMethod("getVerificationVector",p);
if (result.isObject())
......
......@@ -336,7 +336,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES public shares test", "[dkg-aes-pub-shares
vector<char> pubShares(10000, 0);
PRINT_SRC_LINE
status = trustedGetPublicShares(eid, &errStatus, errMsg1.data(),
encryptedDKGSecret.data(), encLen, pubShares.data(), t, n);
encryptedDKGSecret.data(), encLen, pubShares.data(), t);
REQUIRE(status == SGX_SUCCESS);
REQUIRE(errStatus == SGX_SUCCESS);
......@@ -659,7 +659,7 @@ TEST_CASE_METHOD(TestFixture, "DKG API V2 test", "[dkg-api-v2]") {
Json::Value genPolyWrongName = c.generateDKGPoly("poly", 2);
REQUIRE(genPolyWrongName["status"].asInt() != 0);
Json::Value verifVectWrongName = c.getVerificationVector("poly", 2, 2);
Json::Value verifVectWrongName = c.getVerificationVector("poly", 2);
REQUIRE(verifVectWrongName["status"].asInt() != 0);
Json::Value secretSharesWrongName = c.getSecretShareV2("poly", publicKeys, 2, 2);
......@@ -669,14 +669,14 @@ TEST_CASE_METHOD(TestFixture, "DKG API V2 test", "[dkg-api-v2]") {
Json::Value genPolyWrong_t = c.generateDKGPoly(polyName, 33);
REQUIRE(genPolyWrong_t["status"].asInt() != 0);
Json::Value verifVectWrong_t = c.getVerificationVector(polyName, 1, 2);
Json::Value verifVectWrong_t = c.getVerificationVector(polyName, 1);
REQUIRE(verifVectWrong_t["status"].asInt() != 0);
Json::Value secretSharesWrong_t = c.getSecretShareV2(polyName, publicKeys, 3, 3);
REQUIRE(secretSharesWrong_t["status"].asInt() != 0);
// wrong_n
Json::Value verifVectWrong_n = c.getVerificationVector(polyName, 2, 1);
Json::Value verifVectWrong_n = c.getVerificationVector(polyName, 2);
REQUIRE(verifVectWrong_n["status"].asInt() != 0);
Json::Value publicKeys1;
......@@ -693,9 +693,9 @@ TEST_CASE_METHOD(TestFixture, "DKG API V2 test", "[dkg-api-v2]") {
REQUIRE_NOTHROW(c.getSecretShare(polyName, publicKeys, 2, 2));
REQUIRE(Skeys == c.getSecretShare(polyName, publicKeys, 2, 2));
Json::Value verifVect = c.getVerificationVector(polyName, 2, 2);
REQUIRE_NOTHROW(c.getVerificationVector(polyName, 2, 2));
REQUIRE(verifVect == c.getVerificationVector(polyName, 2, 2));
Json::Value verifVect = c.getVerificationVector(polyName, 2);
REQUIRE_NOTHROW(c.getVerificationVector(polyName, 2));
REQUIRE(verifVect == c.getVerificationVector(polyName, 2));
Json::Value verificationWrongSkeys = c.dkgVerificationV2("", "", "", 2, 2, 1);
REQUIRE(verificationWrongSkeys["status"].asInt() != 0);
......@@ -762,7 +762,7 @@ TEST_CASE_METHOD(TestFixture, "AES_DKG V2 test", "[aes-dkg-v2]") {
polyNames[i] = polyName;
PRINT_SRC_LINE
verifVects[i] = c.getVerificationVector(polyName, t, n);
verifVects[i] = c.getVerificationVector(polyName, t);
REQUIRE(verifVects[i]["status"] == 0);
pubEthKeys.append(ethKeys[i]["publicKey"]);
......
......@@ -86,8 +86,7 @@ Json::Value generateDKGPolyReqMessage::process() {
Json::Value getVerificationVectorReqMessage::process() {
auto polyName = getStringRapid("polyName");
auto t = getInt64Rapid("t");
auto n = getInt64Rapid("n");
auto result = SGXWalletServer::getVerificationVectorImpl(polyName, t, n);
auto result = SGXWalletServer::getVerificationVectorImpl(polyName, t);
result["type"] = ZMQMessage::GET_VV_RSP;
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