Unverified Commit f0f84a0f authored by kladko's avatar kladko

SKALE-2077 Fixed Naming

parent f2b8271f
...@@ -12,7 +12,7 @@ class StubClient : public jsonrpc::Client ...@@ -12,7 +12,7 @@ class StubClient : public jsonrpc::Client
public: public:
StubClient(jsonrpc::IClientConnector &conn, jsonrpc::clientVersion_t type = jsonrpc::JSONRPC_CLIENT_V2) : jsonrpc::Client(conn, type) {} StubClient(jsonrpc::IClientConnector &conn, jsonrpc::clientVersion_t type = jsonrpc::JSONRPC_CLIENT_V2) : jsonrpc::Client(conn, type) {}
Json::Value importBLSKeyShare(const std::string& keyShare, const std::string& keyShareName, int t, int n, int index) throw (jsonrpc::JsonRpcException) Json::Value importBLSKeyShare(const std::string& keyShare, const std::string& keyShareName, int t, int n, int index)
{ {
Json::Value p; Json::Value p;
p["index"] = index; p["index"] = index;
...@@ -27,7 +27,7 @@ class StubClient : public jsonrpc::Client ...@@ -27,7 +27,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash, int t, int n, int signerIndex) throw (jsonrpc::JsonRpcException) Json::Value blsSignMessageHash(const std::string& keyShareName, const std::string& messageHash, int t, int n, int signerIndex)
{ {
Json::Value p; Json::Value p;
p["keyShareName"] = keyShareName; p["keyShareName"] = keyShareName;
...@@ -42,7 +42,7 @@ class StubClient : public jsonrpc::Client ...@@ -42,7 +42,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value importECDSAKey(const std::string& key, const std::string& keyName) throw (jsonrpc::JsonRpcException) Json::Value importECDSAKey(const std::string& key, const std::string& keyName)
{ {
Json::Value p; Json::Value p;
p["key"] = key; p["key"] = key;
...@@ -54,7 +54,7 @@ class StubClient : public jsonrpc::Client ...@@ -54,7 +54,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value generateECDSAKey() throw (jsonrpc::JsonRpcException) Json::Value generateECDSAKey()
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p = Json::nullValue;
...@@ -65,7 +65,7 @@ class StubClient : public jsonrpc::Client ...@@ -65,7 +65,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value renameECDSAKey(const std::string& KeyName, const std::string& tempKeyName) throw (jsonrpc::JsonRpcException) Json::Value renameECDSAKey(const std::string& KeyName, const std::string& tempKeyName)
{ {
Json::Value p; Json::Value p;
p["keyName"] = KeyName; p["keyName"] = KeyName;
...@@ -77,7 +77,7 @@ class StubClient : public jsonrpc::Client ...@@ -77,7 +77,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value getPublicECDSAKey(const std::string& keyName) throw (jsonrpc::JsonRpcException) Json::Value getPublicECDSAKey(const std::string& keyName)
{ {
Json::Value p; Json::Value p;
p["keyName"] = keyName; p["keyName"] = keyName;
...@@ -88,7 +88,7 @@ class StubClient : public jsonrpc::Client ...@@ -88,7 +88,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value ecdsaSignMessageHash(int base, const std::string& keyName, const std::string& messageHash) throw (jsonrpc::JsonRpcException) Json::Value ecdsaSignMessageHash(int base, const std::string& keyName, const std::string& messageHash)
{ {
Json::Value p; Json::Value p;
p["base"] = base; p["base"] = base;
...@@ -101,7 +101,7 @@ class StubClient : public jsonrpc::Client ...@@ -101,7 +101,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value generateDKGPoly(const std::string& polyName, int t) throw (jsonrpc::JsonRpcException) Json::Value generateDKGPoly(const std::string& polyName, int t)
{ {
Json::Value p; Json::Value p;
p["polyName"] = polyName; p["polyName"] = polyName;
...@@ -113,7 +113,7 @@ class StubClient : public jsonrpc::Client ...@@ -113,7 +113,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value getVerificationVector(const std::string& polyName, int t, int n) throw (jsonrpc::JsonRpcException) Json::Value getVerificationVector(const std::string& polyName, int t, int n)
{ {
Json::Value p; Json::Value p;
p["polyName"] = polyName; p["polyName"] = polyName;
...@@ -126,7 +126,7 @@ class StubClient : public jsonrpc::Client ...@@ -126,7 +126,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value getSecretShare(const std::string& polyName, const Json::Value& publicKeys, int t, int n) throw (jsonrpc::JsonRpcException) Json::Value getSecretShare(const std::string& polyName, const Json::Value& publicKeys, int t, int n)
{ {
Json::Value p; Json::Value p;
p["polyName"] = polyName; p["polyName"] = polyName;
...@@ -140,7 +140,7 @@ class StubClient : public jsonrpc::Client ...@@ -140,7 +140,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value dkgVerification(const std::string& publicShares, const std::string& ethKeyName, const std::string& SecretShare, int t, int n, int index) throw (jsonrpc::JsonRpcException) Json::Value dkgVerification(const std::string& publicShares, const std::string& ethKeyName, const std::string& SecretShare, int t, int n, int index)
{ {
Json::Value p; Json::Value p;
p["ethKeyName"] = ethKeyName; p["ethKeyName"] = ethKeyName;
...@@ -156,7 +156,7 @@ class StubClient : public jsonrpc::Client ...@@ -156,7 +156,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value createBLSPrivateKey(const std::string & blsKeyName, const std::string& ethKeyName, const std::string& polyName, const std::string& SecretShare, int t, int n) throw (jsonrpc::JsonRpcException) Json::Value createBLSPrivateKey(const std::string & blsKeyName, const std::string& ethKeyName, const std::string& polyName, const std::string& SecretShare, int t, int n)
{ {
Json::Value p; Json::Value p;
p["blsKeyName"] = blsKeyName; p["blsKeyName"] = blsKeyName;
...@@ -172,7 +172,7 @@ class StubClient : public jsonrpc::Client ...@@ -172,7 +172,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value getBLSPublicKeyShare(const std::string & blsKeyName) throw (jsonrpc::JsonRpcException) Json::Value getBLSPublicKeyShare(const std::string & blsKeyName)
{ {
Json::Value p; Json::Value p;
p["blsKeyName"] = blsKeyName; p["blsKeyName"] = blsKeyName;
...@@ -184,7 +184,7 @@ class StubClient : public jsonrpc::Client ...@@ -184,7 +184,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value complaintResponse(const std::string& polyName, int ind) throw (jsonrpc::JsonRpcException) Json::Value complaintResponse(const std::string& polyName, int ind)
{ {
Json::Value p; Json::Value p;
p["polyName"] = polyName; p["polyName"] = polyName;
...@@ -196,7 +196,7 @@ class StubClient : public jsonrpc::Client ...@@ -196,7 +196,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value multG2(const std::string & x) throw (jsonrpc::JsonRpcException) Json::Value multG2(const std::string & x)
{ {
Json::Value p; Json::Value p;
p["x"] = x; p["x"] = x;
...@@ -208,7 +208,7 @@ class StubClient : public jsonrpc::Client ...@@ -208,7 +208,7 @@ class StubClient : public jsonrpc::Client
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
} }
Json::Value isPolyExists(const std::string & polyName) throw (jsonrpc::JsonRpcException) Json::Value isPolyExists(const std::string & polyName)
{ {
Json::Value p; Json::Value p;
p["polyName"] = polyName; p["polyName"] = polyName;
...@@ -223,7 +223,7 @@ class StubClient : public jsonrpc::Client ...@@ -223,7 +223,7 @@ class StubClient : public jsonrpc::Client
////CSRManagerServer ////CSRManagerServer
Json::Value getUnsignedCSRs() throw (jsonrpc::JsonRpcException) Json::Value getUnsignedCSRs()
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p = Json::nullValue;
...@@ -236,7 +236,7 @@ class StubClient : public jsonrpc::Client ...@@ -236,7 +236,7 @@ class StubClient : public jsonrpc::Client
Json::Value signByHash(const std::string& hash, int status) throw (jsonrpc::JsonRpcException) Json::Value signByHash(const std::string& hash, int status)
{ {
Json::Value p; Json::Value p;
p["hash"] = hash; p["hash"] = hash;
...@@ -249,7 +249,7 @@ class StubClient : public jsonrpc::Client ...@@ -249,7 +249,7 @@ class StubClient : public jsonrpc::Client
} }
Json::Value getServerStatus() throw (jsonrpc::JsonRpcException) Json::Value getServerStatus()
{ {
Json::Value p; Json::Value p;
p = Json::nullValue; p = Json::nullValue;
......
...@@ -124,9 +124,8 @@ TEST_CASE("BLS key encrypt", "[bls-key-encrypt]") { ...@@ -124,9 +124,8 @@ TEST_CASE("BLS key encrypt", "[bls-key-encrypt]") {
DEBUG_PRINT = 1; DEBUG_PRINT = 1;
is_sgx_https = 0; is_sgx_https = 0;
init_all(false, false, init_SEK); init_all(false, false, init_SEK);
char *key = encryptTestKey(); auto key = shared_ptr<char>(encryptTestKey());
REQUIRE(key != nullptr); REQUIRE(key != nullptr);
/*free*/(key);
} }
...@@ -137,6 +136,7 @@ TEST_CASE("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") { ...@@ -137,6 +136,7 @@ TEST_CASE("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") {
is_sgx_https = 0; is_sgx_https = 0;
init_all(false, false, init_SEK); init_all(false, false, init_SEK);
//init_enclave(); //init_enclave();
int errStatus = -1; int errStatus = -1;
...@@ -152,7 +152,7 @@ TEST_CASE("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") { ...@@ -152,7 +152,7 @@ TEST_CASE("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") {
REQUIRE(errStatus == 0); REQUIRE(errStatus == 0);
REQUIRE(strcmp(plaintextKey, TEST_BLS_KEY_SHARE) == 0); REQUIRE(strcmp(plaintextKey, TEST_BLS_KEY_SHARE) == 0);
printf("Decrypt key completed with status: %d %s \n", errStatus, errMsg); printf("Decrypt key completed with status: %d %s \n", errStatus, errMsg.data());
printf("Decrypted key len %d\n", (int) strlen(plaintextKey)); printf("Decrypted key len %d\n", (int) strlen(plaintextKey));
printf("Decrypted key: %s\n", plaintextKey); printf("Decrypted key: %s\n", plaintextKey);
...@@ -189,7 +189,7 @@ TEST_CASE("DKG gen test", "[dkg-gen]") { ...@@ -189,7 +189,7 @@ TEST_CASE("DKG gen test", "[dkg-gen]") {
printf("\ndecrypt_dkg_secret completed with status: %d %s \n", err_status, errMsg1.data()); printf("\ndecrypt_dkg_secret completed with status: %d %s \n", err_status, errMsg1.data());
printf("decrypted secret %s \n\n", secret.data()); printf("decrypted secret %s \n\n", secret.data());
printf("secret length %d \n", strlen(secret.data())); printf("secret length %d \n", (int) strlen(secret.data()));
printf("decr length %d \n", dec_len); printf("decr length %d \n", dec_len);
sgx_destroy_enclave(eid); sgx_destroy_enclave(eid);
...@@ -276,14 +276,14 @@ TEST_CASE("DKG public shares test", "[dkg-pub_shares]") { ...@@ -276,14 +276,14 @@ TEST_CASE("DKG public shares test", "[dkg-pub_shares]") {
encrypted_dkg_secret.data(), enc_len, public_shares.data(), t, n); encrypted_dkg_secret.data(), enc_len, public_shares.data(), t, n);
REQUIRE(status == SGX_SUCCESS); REQUIRE(status == SGX_SUCCESS);
printf("\nget_public_shares status: %d error %s \n\n", err_status, errMsg1.data()); printf("\nget_public_shares status: %d error %s \n\n", err_status, errMsg1.data());
printf(" LEN: %d \n", strlen(public_shares.data())); printf(" LEN: %d \n", (int) strlen(public_shares.data()));
printf(" result: %s \n", public_shares.data()); printf(" result: %s \n", public_shares.data());
vector<string> G2_strings = SplitString(public_shares.data(), ','); vector<string> G2_strings = SplitString(public_shares.data(), ',');
vector<libff::alt_bn128_G2> pub_shares_G2; vector<libff::alt_bn128_G2> pub_shares_G2;
for (int i = 0; i < G2_strings.size(); i++) { for (u_int64_t i = 0; i < G2_strings.size(); i++) {
vector<string> koef_str = SplitString(G2_strings.at(i).c_str(), ':'); vector<string> koef_str = SplitString(G2_strings.at(i).c_str(), ':');
libff::alt_bn128_G2 el = VectStringToG2(koef_str); //libff::alt_bn128_G2 el = VectStringToG2(koef_str);
//cerr << "pub_share G2 " << i+1 << " : " << endl; //cerr << "pub_share G2 " << i+1 << " : " << endl;
//el.print_coordinates(); //el.print_coordinates();
pub_shares_G2.push_back(VectStringToG2(koef_str)); pub_shares_G2.push_back(VectStringToG2(koef_str));
...@@ -422,7 +422,7 @@ TEST_CASE("ECDSA keygen and signature test", "[ecdsa_test]") { ...@@ -422,7 +422,7 @@ TEST_CASE("ECDSA keygen and signature test", "[ecdsa_test]") {
string hex = "3F891FDA3704F0368DAB65FA81EBE616F4AA2A0854995DA4DC0B59D2CADBD64F"; string hex = "3F891FDA3704F0368DAB65FA81EBE616F4AA2A0854995DA4DC0B59D2CADBD64F";
// char* hex = "0x09c6137b97cdf159b9950f1492ee059d1e2b10eaf7d51f3a97d61f2eee2e81db"; // char* hex = "0x09c6137b97cdf159b9950f1492ee059d1e2b10eaf7d51f3a97d61f2eee2e81db";
printf("hash length %d ", hex.size()); printf("hash length %d ", (int) hex.size());
vector<char> signature_r(1024, 0); vector<char> signature_r(1024, 0);
vector<char> signature_s(1024, 0); vector<char> signature_s(1024, 0);
uint8_t signature_v = 0; uint8_t signature_v = 0;
...@@ -488,8 +488,8 @@ TEST_CASE("get public ECDSA key", "[get_pub_ecdsa_key_test]") { ...@@ -488,8 +488,8 @@ TEST_CASE("get public ECDSA key", "[get_pub_ecdsa_key_test]") {
printf("\nerrMsg %s\n", errMsg.data()); printf("\nerrMsg %s\n", errMsg.data());
REQUIRE(status == SGX_SUCCESS); REQUIRE(status == SGX_SUCCESS);
printf("\nwas pub_key_x %s length %d: \n", pub_key_x.data(), strlen(pub_key_x.data())); printf("\nwas pub_key_x %s length %d: \n", pub_key_x.data(), (int) strlen(pub_key_x.data()));
printf("\nwas pub_key_y %s length %d: \n", pub_key_y.data(), strlen(pub_key_y.data())); printf("\nwas pub_key_y %s length %d: \n", pub_key_y.data(), (int) strlen(pub_key_y.data()));
/*printf("\nencr priv_key %s: \n"); /*printf("\nencr priv_key %s: \n");
for ( int i = 0; i < 1024 ; i++) for ( int i = 0; i < 1024 ; i++)
......
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