From 8bb6847aec4de4bcae96c0c13fcd7501deaa5159 Mon Sep 17 00:00:00 2001 From: Oleh Date: Fri, 2 Oct 2020 13:48:33 +0300 Subject: [PATCH 01/13] SKALE-3334 add verificationVectorMult to response --- DKGCrypto.cpp | 28 ++++++++++++++++++++++++++-- DKGCrypto.h | 2 ++ SGXWalletServer.cpp | 13 ++++++++++++- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/DKGCrypto.cpp b/DKGCrypto.cpp index c92ddc53..7321e755 100644 --- a/DKGCrypto.cpp +++ b/DKGCrypto.cpp @@ -182,15 +182,39 @@ vector > get_verif_vect(const char *encryptedPolyHex, int t, int HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus, errMsg.data()); vector g2Strings = splitString(pubShares.data(), ','); - vector > pubSharesVect; + vector > pubSharesVect(t); for (uint64_t i = 0; i < g2Strings.size(); i++) { vector coeffStr = splitString(g2Strings.at(i).c_str(), ':'); - pubSharesVect.push_back(coeffStr); + pubSharesVect[i] = coeffStr; } return pubSharesVect; } +vector > getVerificationVectorMult(const std::string& encryptedPolyHex, int t, int n, size_t ind) { + auto verificationVector = get_verif_vect(encryptedPolyHex.c_str(), t, n); + + vector> result(t); + + for (size_t i = 0; i < t; ++i) { + libff::alt_bn128_G2 current_coefficient; + current_coefficient.X.c0 = libff::alt_bn128_Fq(verificationVector[i][0]); + current_coefficient.X.c1 = libff::alt_bn128_Fq(verificationVector[i][1]); + current_coefficient.Y.c0 = libff::alt_bn128_Fq(verificationVector[i][2]); + current_coefficient.Y.c1 = libff::alt_bn128_Fq(verificationVector[i][3]); + current_coefficient.Z = libff::alt_bn128_Fq2::one(); + + current_coefficient = current_coefficient * libff::power(libff::alt_bn128_Fr(ind + 1), i); + current_coefficient.to_affine_coordinates(); + + auto g2_str = convertG2ToString(current_coefficient); + + result[i] = splitString(g2_str.c_str(), ':'); + } + + return result; +} + string getSecretShares(const string &_polyName, const char *_encryptedPolyHex, const vector &_publicKeys, int _t, diff --git a/DKGCrypto.h b/DKGCrypto.h index 5ec9eb61..83b31162 100644 --- a/DKGCrypto.h +++ b/DKGCrypto.h @@ -35,6 +35,8 @@ string gen_dkg_poly( int _t); vector > get_verif_vect(const char* encryptedPolyHex, int t, int n); +vector > getVerificationVectorMult(const std::string& encryptedPolyHex, int t, int n, size_t ind); + vector splitString(const char* coeffs, const char symbol); string getSecretShares(const string& _polyName, const char* _encryptedPolyHex, const vector& _publicKeys, int _t, int _n); diff --git a/SGXWalletServer.cpp b/SGXWalletServer.cpp index 8c87ae7c..26b547de 100644 --- a/SGXWalletServer.cpp +++ b/SGXWalletServer.cpp @@ -388,7 +388,7 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName, shared_ptr encrPoly = readFromDb(_polyName); - verifVector = get_verif_vect(encrPoly->c_str(), _t, _n); + verifVector = get_verif_vect(encrPoly.get(), _t, _n); for (int i = 0; i < _t; i++) { vector currentCoef = verifVector.at(i); @@ -603,6 +603,17 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int result["share*G2"] = *shareG2_ptr; result["dhKey"] = DHKey; + shared_ptr encrPoly = readFromDb(_polyName); + + verificationVectorMult = getVerificationVectorMult(encrPoly->c_str(), _t, _n, ind); + + for (int i = 0; i < _t; i++) { + vector currentCoef = verifVector.at(i); + for (int j = 0; j < 4; j++) { + result["verificationVectorMult"][i][j] = currentCoef.at(j); + } + } + // TODO: delete dh keys // for (int i = 0; i < _n; i++) { // string name = _polyName + "_" + to_string(i) + ":"; From 1c1c6383b6b03871b4831487db6d405e08717081 Mon Sep 17 00:00:00 2001 From: Oleh Date: Fri, 2 Oct 2020 13:55:51 +0300 Subject: [PATCH 02/13] SKALE-3334 fix build --- SGXWalletServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SGXWalletServer.cpp b/SGXWalletServer.cpp index 26b547de..5d0a6973 100644 --- a/SGXWalletServer.cpp +++ b/SGXWalletServer.cpp @@ -605,7 +605,7 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int shared_ptr encrPoly = readFromDb(_polyName); - verificationVectorMult = getVerificationVectorMult(encrPoly->c_str(), _t, _n, ind); + verificationVectorMult = getVerificationVectorMult(encrPoly->c_str(), _t, _n, _ind); for (int i = 0; i < _t; i++) { vector currentCoef = verifVector.at(i); From 091f6851915ec4786dbfc26b621ed632f24c71ed Mon Sep 17 00:00:00 2001 From: Oleh Date: Fri, 2 Oct 2020 14:06:58 +0300 Subject: [PATCH 03/13] SKALE-3334 fix complaintResponse function --- SGXWalletServer.cpp | 19 +++++++++---------- SGXWalletServer.hpp | 2 +- abstractstubserver.h | 6 +++--- stubclient.h | 4 +++- testw.cpp | 2 +- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/SGXWalletServer.cpp b/SGXWalletServer.cpp index 5d0a6973..d79cffe5 100644 --- a/SGXWalletServer.cpp +++ b/SGXWalletServer.cpp @@ -586,7 +586,7 @@ Json::Value SGXWalletServer::calculateAllBLSPublicKeysImpl(const Json::Value& pu RETURN_SUCCESS(result); } -Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int _ind) { +Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int _t, int _n, int _ind) { spdlog::info("Entering {}", __FUNCTION__); INIT_RESULT(result) @@ -614,13 +614,12 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int } } -// TODO: delete dh keys -// for (int i = 0; i < _n; i++) { -// string name = _polyName + "_" + to_string(i) + ":"; -// LevelDB::getLevelDb()->deleteDHDKGKey(name); -// string shareG2_name = "shareG2_" + _polyName + "_" + to_string(i) + ":"; -// LevelDB::getLevelDb()->deleteKey(shareG2_name); -// } + for (int i = 0; i < _n; i++) { + string name = _polyName + "_" + to_string(i) + ":"; + LevelDB::getLevelDb()->deleteDHDKGKey(name); + string shareG2_name = "shareG2_" + _polyName + "_" + to_string(i) + ":"; + LevelDB::getLevelDb()->deleteKey(shareG2_name); + } LevelDB::getLevelDb()->deleteKey(_polyName); string encryptedSecretShareName = "encryptedSecretShare:" + _polyName; @@ -748,8 +747,8 @@ Json::Value SGXWalletServer::blsSignMessageHash(const string &_keyShareName, con return blsSignMessageHashImpl(_keyShareName, _messageHash, _t, _n); } -Json::Value SGXWalletServer::complaintResponse(const string &polyName, int ind) { - return complaintResponseImpl(polyName, ind); +Json::Value SGXWalletServer::complaintResponse(const string &polyName, int t, int n, int ind) { + return complaintResponseImpl(polyName, t, n, ind); } Json::Value SGXWalletServer::multG2(const string &x) { diff --git a/SGXWalletServer.hpp b/SGXWalletServer.hpp index 816cfab0..8b3fc87c 100644 --- a/SGXWalletServer.hpp +++ b/SGXWalletServer.hpp @@ -76,7 +76,7 @@ class SGXWalletServer : public AbstractStubServer { virtual Json::Value calculateAllBLSPublicKeys(const Json::Value& publicShares, int t, int n); - virtual Json::Value complaintResponse(const string &polyName, int ind); + virtual Json::Value complaintResponse(const string &polyName, int t, int n, int ind); virtual Json::Value multG2(const string &x); diff --git a/abstractstubserver.h b/abstractstubserver.h index ce43bfa2..580b8445 100644 --- a/abstractstubserver.h +++ b/abstractstubserver.h @@ -50,7 +50,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer 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); this->bindAndAddMethod(jsonrpc::Procedure("getBLSPublicKeyShare", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "blsKeyName",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::getBLSPublicKeyShareI); this->bindAndAddMethod(jsonrpc::Procedure("calculateAllBLSPublicKeys", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "publicShares", jsonrpc::JSON_ARRAY, "n", jsonrpc::JSON_INTEGER, "t", jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::calculateAllBLSPublicKeysI); - this->bindAndAddMethod(jsonrpc::Procedure("complaintResponse", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "polyName",jsonrpc::JSON_STRING,"ind",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::complaintResponseI); + this->bindAndAddMethod(jsonrpc::Procedure("complaintResponse", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "polyName",jsonrpc::JSON_STRING,"t",jsonrpc::JSON_INTEGER, "n",jsonrpc::JSON_INTEGER, "ind",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::complaintResponseI); this->bindAndAddMethod(jsonrpc::Procedure("multG2", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "x",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::multG2I); this->bindAndAddMethod(jsonrpc::Procedure("isPolyExists", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_OBJECT, "polyName",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::isPolyExistsI); @@ -111,7 +111,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer } inline virtual void complaintResponseI(const Json::Value &request, Json::Value &response) { - response = this->complaintResponse( request["polyName"].asString(), request["ind"].asInt()); + response = this->complaintResponse( request["polyName"].asString(), request["t"].asInt(), request["n"].asInt(), request["ind"].asInt()); } inline virtual void multG2I(const Json::Value &request, Json::Value &response) { @@ -152,7 +152,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer 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; virtual Json::Value getBLSPublicKeyShare(const std::string & blsKeyName) = 0; virtual Json::Value calculateAllBLSPublicKeys(const Json::Value& publicShares, int t, int n) = 0; - virtual Json::Value complaintResponse(const std::string& polyName, int ind) = 0; + virtual Json::Value complaintResponse(const std::string& polyName, int t, int n, int ind) = 0; virtual Json::Value multG2(const std::string & x) = 0; virtual Json::Value isPolyExists(const std::string& polyName) = 0; diff --git a/stubclient.h b/stubclient.h index 632a2b9b..7bcad015 100644 --- a/stubclient.h +++ b/stubclient.h @@ -171,10 +171,12 @@ class StubClient : public jsonrpc::Client throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - Json::Value complaintResponse(const std::string& polyName, int ind) + Json::Value complaintResponse(const std::string& polyName, int t, int n,int ind) { Json::Value p; p["polyName"] = polyName; + p["t"] = t; + p["n"] = n; p["ind"] = ind; Json::Value result = this->CallMethod("complaintResponse",p); if (result.isObject()) diff --git a/testw.cpp b/testw.cpp index f4175aa8..95666a63 100644 --- a/testw.cpp +++ b/testw.cpp @@ -643,7 +643,7 @@ TEST_CASE_METHOD(TestFixture, "AES_DKG test", "[aes-dkg]") { REQUIRE(res); } - Json::Value complaintResponse = c.complaintResponse(polyNames[1], 0); + Json::Value complaintResponse = c.complaintResponse(polyNames[1], t, n, 0); REQUIRE(complaintResponse["status"] == 0); BLSSigShareSet sigShareSet(t, n); From f7d61fc7fd29499fb0be6acd0681c81a256dc2ad Mon Sep 17 00:00:00 2001 From: Oleh Date: Fri, 2 Oct 2020 14:12:17 +0300 Subject: [PATCH 04/13] SKALE-3334 fix complaintResponse function --- SGXWalletServer.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SGXWalletServer.hpp b/SGXWalletServer.hpp index 8b3fc87c..f7b801d6 100644 --- a/SGXWalletServer.hpp +++ b/SGXWalletServer.hpp @@ -126,7 +126,7 @@ class SGXWalletServer : public AbstractStubServer { static Json::Value calculateAllBLSPublicKeysImpl(const Json::Value& publicShares, int t, int n); - static Json::Value complaintResponseImpl(const string &_polyName, int _ind); + static Json::Value complaintResponseImpl(const string &_polyName, int t, int n, int _ind); static Json::Value multG2Impl(const string &_x); From 148ff3c6d58140d5ad157ded4a467add18eb2875 Mon Sep 17 00:00:00 2001 From: Oleh Date: Fri, 2 Oct 2020 14:19:08 +0300 Subject: [PATCH 05/13] SKALE-3334 fix build --- SGXWalletServer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SGXWalletServer.cpp b/SGXWalletServer.cpp index d79cffe5..d652e16d 100644 --- a/SGXWalletServer.cpp +++ b/SGXWalletServer.cpp @@ -605,10 +605,10 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int shared_ptr encrPoly = readFromDb(_polyName); - verificationVectorMult = getVerificationVectorMult(encrPoly->c_str(), _t, _n, _ind); + auto verificationVectorMult = getVerificationVectorMult(encrPoly->c_str(), _t, _n, _ind); for (int i = 0; i < _t; i++) { - vector currentCoef = verifVector.at(i); + vector currentCoef = verificationVectorMult.at(i); for (int j = 0; j < 4; j++) { result["verificationVectorMult"][i][j] = currentCoef.at(j); } From a4e82cef3bba2cb2d9de9d6ef8fec4d07339829d Mon Sep 17 00:00:00 2001 From: Oleh Date: Fri, 2 Oct 2020 14:24:25 +0300 Subject: [PATCH 06/13] SKALE-3334 fix build --- SGXWalletServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SGXWalletServer.cpp b/SGXWalletServer.cpp index d652e16d..b42ae897 100644 --- a/SGXWalletServer.cpp +++ b/SGXWalletServer.cpp @@ -388,7 +388,7 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName, shared_ptr encrPoly = readFromDb(_polyName); - verifVector = get_verif_vect(encrPoly.get(), _t, _n); + verifVector = get_verif_vect(encrPoly.get().c_str(), _t, _n); for (int i = 0; i < _t; i++) { vector currentCoef = verifVector.at(i); From bae4d97d8492048a1b780057df074181c07b9c0e Mon Sep 17 00:00:00 2001 From: Oleh Date: Fri, 2 Oct 2020 14:29:35 +0300 Subject: [PATCH 07/13] SKALE-3334 fix build --- SGXWalletServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SGXWalletServer.cpp b/SGXWalletServer.cpp index b42ae897..cc4dec99 100644 --- a/SGXWalletServer.cpp +++ b/SGXWalletServer.cpp @@ -388,7 +388,7 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName, shared_ptr encrPoly = readFromDb(_polyName); - verifVector = get_verif_vect(encrPoly.get().c_str(), _t, _n); + verifVector = get_verif_vect((encrPoly.get()).c_str(), _t, _n); for (int i = 0; i < _t; i++) { vector currentCoef = verifVector.at(i); From b770b5cdbd6eb6ad7687bfc5740461cef98f6360 Mon Sep 17 00:00:00 2001 From: Oleh Date: Fri, 2 Oct 2020 14:35:45 +0300 Subject: [PATCH 08/13] SKALE-3334 fix build --- DKGCrypto.cpp | 6 +++--- DKGCrypto.h | 2 +- SGXWalletServer.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DKGCrypto.cpp b/DKGCrypto.cpp index 7321e755..e1d6ee6a 100644 --- a/DKGCrypto.cpp +++ b/DKGCrypto.cpp @@ -152,7 +152,7 @@ string gen_dkg_poly(int _t) { return result; } -vector > get_verif_vect(const char *encryptedPolyHex, int t, int n) { +vector > get_verif_vect(const string& encryptedPolyHex, int t, int n) { CHECK_STATE(encryptedPolyHex); @@ -166,7 +166,7 @@ vector > get_verif_vect(const char *encryptedPolyHex, int t, int vector encrDKGPoly(2 * BUF_LEN, 0); - if (!hex2carray(encryptedPolyHex, &encLen, encrDKGPoly.data(), 6100)) { + if (!hex2carray(encryptedPolyHex.c_str(), &encLen, encrDKGPoly.data(), 6100)) { throw SGXException(INVALID_HEX, "Invalid encryptedPolyHex"); } @@ -192,7 +192,7 @@ vector > get_verif_vect(const char *encryptedPolyHex, int t, int } vector > getVerificationVectorMult(const std::string& encryptedPolyHex, int t, int n, size_t ind) { - auto verificationVector = get_verif_vect(encryptedPolyHex.c_str(), t, n); + auto verificationVector = get_verif_vect(encryptedPolyHex, t, n); vector> result(t); diff --git a/DKGCrypto.h b/DKGCrypto.h index 83b31162..1dcd032b 100644 --- a/DKGCrypto.h +++ b/DKGCrypto.h @@ -33,7 +33,7 @@ using namespace std; string gen_dkg_poly( int _t); -vector > get_verif_vect(const char* encryptedPolyHex, int t, int n); +vector > get_verif_vect(const string& encryptedPolyHex, int t, int n); vector > getVerificationVectorMult(const std::string& encryptedPolyHex, int t, int n, size_t ind); diff --git a/SGXWalletServer.cpp b/SGXWalletServer.cpp index cc4dec99..d652e16d 100644 --- a/SGXWalletServer.cpp +++ b/SGXWalletServer.cpp @@ -388,7 +388,7 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName, shared_ptr encrPoly = readFromDb(_polyName); - verifVector = get_verif_vect((encrPoly.get()).c_str(), _t, _n); + verifVector = get_verif_vect(encrPoly.get(), _t, _n); for (int i = 0; i < _t; i++) { vector currentCoef = verifVector.at(i); From bf2380f9d60db5b3cd735cf25cbb5dccbc2bd0ff Mon Sep 17 00:00:00 2001 From: Oleh Date: Fri, 2 Oct 2020 14:40:56 +0300 Subject: [PATCH 09/13] SKALE-3334 fix build --- SGXWalletServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SGXWalletServer.cpp b/SGXWalletServer.cpp index d652e16d..65816398 100644 --- a/SGXWalletServer.cpp +++ b/SGXWalletServer.cpp @@ -388,7 +388,7 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName, shared_ptr encrPoly = readFromDb(_polyName); - verifVector = get_verif_vect(encrPoly.get(), _t, _n); + verifVector = get_verif_vect(*encrPoly, _t, _n); for (int i = 0; i < _t; i++) { vector currentCoef = verifVector.at(i); From 2d00a928820923f674ff1fac888f40b772238cfd Mon Sep 17 00:00:00 2001 From: Oleh Date: Fri, 2 Oct 2020 14:48:41 +0300 Subject: [PATCH 10/13] SKALE-3334 fix build --- DKGCrypto.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DKGCrypto.cpp b/DKGCrypto.cpp index e1d6ee6a..618c422c 100644 --- a/DKGCrypto.cpp +++ b/DKGCrypto.cpp @@ -154,7 +154,9 @@ string gen_dkg_poly(int _t) { vector > get_verif_vect(const string& encryptedPolyHex, int t, int n) { - CHECK_STATE(encryptedPolyHex); + auto encryptedPolyHexPtr = encryptedPolyHex.c_str() + + CHECK_STATE(encryptedPolyHexPtr); vector errMsg(BUF_LEN, 0); @@ -166,7 +168,7 @@ vector > get_verif_vect(const string& encryptedPolyHex, int t, in vector encrDKGPoly(2 * BUF_LEN, 0); - if (!hex2carray(encryptedPolyHex.c_str(), &encLen, encrDKGPoly.data(), 6100)) { + if (!hex2carray(encryptedPolyHexPtr, &encLen, encrDKGPoly.data(), 6100)) { throw SGXException(INVALID_HEX, "Invalid encryptedPolyHex"); } From 9d288bf0b4125e8f82d6bfe9d624120e82ca4c86 Mon Sep 17 00:00:00 2001 From: Oleh Date: Fri, 2 Oct 2020 14:56:31 +0300 Subject: [PATCH 11/13] SKALE-3334 fix build --- DKGCrypto.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DKGCrypto.cpp b/DKGCrypto.cpp index 618c422c..40587dfd 100644 --- a/DKGCrypto.cpp +++ b/DKGCrypto.cpp @@ -154,7 +154,7 @@ string gen_dkg_poly(int _t) { vector > get_verif_vect(const string& encryptedPolyHex, int t, int n) { - auto encryptedPolyHexPtr = encryptedPolyHex.c_str() + auto encryptedPolyHexPtr = encryptedPolyHex.c_str(); CHECK_STATE(encryptedPolyHexPtr); From 4eda352ef0487c71e160f0bfb8853952738a3aa8 Mon Sep 17 00:00:00 2001 From: Oleh Date: Fri, 2 Oct 2020 15:03:42 +0300 Subject: [PATCH 12/13] SKALE-3334 fix build --- DKGCrypto.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DKGCrypto.cpp b/DKGCrypto.cpp index 40587dfd..2f73cbff 100644 --- a/DKGCrypto.cpp +++ b/DKGCrypto.cpp @@ -206,7 +206,7 @@ vector > getVerificationVectorMult(const std::string& encryptedPo current_coefficient.Y.c1 = libff::alt_bn128_Fq(verificationVector[i][3]); current_coefficient.Z = libff::alt_bn128_Fq2::one(); - current_coefficient = current_coefficient * libff::power(libff::alt_bn128_Fr(ind + 1), i); + current_coefficient = libff::power(libff::alt_bn128_Fr(ind + 1), i) * current_coefficient; current_coefficient.to_affine_coordinates(); auto g2_str = convertG2ToString(current_coefficient); From 3229806547676ae4a2c36ea25b9d935f4bf6f179 Mon Sep 17 00:00:00 2001 From: Oleh Date: Fri, 2 Oct 2020 15:10:22 +0300 Subject: [PATCH 13/13] SKALE-3334 fix build --- DKGCrypto.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DKGCrypto.cpp b/DKGCrypto.cpp index 2f73cbff..7d37afc0 100644 --- a/DKGCrypto.cpp +++ b/DKGCrypto.cpp @@ -200,10 +200,10 @@ vector > getVerificationVectorMult(const std::string& encryptedPo for (size_t i = 0; i < t; ++i) { libff::alt_bn128_G2 current_coefficient; - current_coefficient.X.c0 = libff::alt_bn128_Fq(verificationVector[i][0]); - current_coefficient.X.c1 = libff::alt_bn128_Fq(verificationVector[i][1]); - current_coefficient.Y.c0 = libff::alt_bn128_Fq(verificationVector[i][2]); - current_coefficient.Y.c1 = libff::alt_bn128_Fq(verificationVector[i][3]); + current_coefficient.X.c0 = libff::alt_bn128_Fq(verificationVector[i][0].c_str()); + current_coefficient.X.c1 = libff::alt_bn128_Fq(verificationVector[i][1].c_str()); + current_coefficient.Y.c0 = libff::alt_bn128_Fq(verificationVector[i][2].c_str()); + current_coefficient.Y.c1 = libff::alt_bn128_Fq(verificationVector[i][3].c_str()); current_coefficient.Z = libff::alt_bn128_Fq2::one(); current_coefficient = libff::power(libff::alt_bn128_Fr(ind + 1), i) * current_coefficient;