SKALE-2002 clean up

parent fb830e75
...@@ -104,15 +104,12 @@ string gen_dkg_poly(int _t) { ...@@ -104,15 +104,12 @@ string gen_dkg_poly(int _t) {
} }
vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n) { vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n) {
vector<char> errMsg1(BUF_LEN, 0); vector<char> errMsg1(BUF_LEN, 0);
int errStatus = 0; int errStatus = 0;
spdlog::debug("got encr poly size {}", char_traits<char>::length(encryptedPolyHex)); spdlog::debug("got encr poly size {}", char_traits<char>::length(encryptedPolyHex));
vector<char> pubShares(10000, 0); vector<char> pubShares(10000, 0);
uint64_t encLen = 0; uint64_t encLen = 0;
...@@ -152,13 +149,11 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n ...@@ -152,13 +149,11 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
string trustedGetSecretShares(const string &_polyName, const char *_encryptedPolyHex, const vector<string> &_publicKeys, string trustedGetSecretShares(const string &_polyName, const char *_encryptedPolyHex, const vector<string> &_publicKeys,
int _t, int _t,
int _n) { int _n) {
vector<char> errMsg1(BUF_LEN, 0); vector<char> errMsg1(BUF_LEN, 0);
vector<char> hexEncrKey(BUF_LEN, 0); vector<char> hexEncrKey(BUF_LEN, 0);
int errStatus = 0; int errStatus = 0;
uint64_t encLen = 0; uint64_t encLen = 0;
vector<uint8_t> encrDKGPoly(BUF_LEN, 0); vector<uint8_t> encrDKGPoly(BUF_LEN, 0);
if (!hex2carray2(_encryptedPolyHex, &encLen, encrDKGPoly.data(), 6100)) { if (!hex2carray2(_encryptedPolyHex, &encLen, encrDKGPoly.data(), 6100)) {
...@@ -173,7 +168,6 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol ...@@ -173,7 +168,6 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
string result; string result;
for (int i = 0; i < _n; i++) { for (int i = 0; i < _n; i++) {
vector<uint8_t> encryptedSkey(BUF_LEN, 0); vector<uint8_t> encryptedSkey(BUF_LEN, 0);
uint32_t decLen; uint32_t decLen;
...@@ -252,10 +246,8 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr ...@@ -252,10 +246,8 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr
} }
bool CreateBLSShare(const string &blsKeyName, const char *s_shares, const char *encryptedKeyHex) { bool CreateBLSShare(const string &blsKeyName, const char *s_shares, const char *encryptedKeyHex) {
spdlog::debug("ENTER CreateBLSShare"); spdlog::debug("ENTER CreateBLSShare");
// char* errMsg1 = (char*) calloc(1024,1);
char errMsg[BUF_LEN]; char errMsg[BUF_LEN];
int errStatus = 0; int errStatus = 0;
...@@ -278,21 +270,17 @@ bool CreateBLSShare(const string &blsKeyName, const char *s_shares, const char * ...@@ -278,21 +270,17 @@ bool CreateBLSShare(const string &blsKeyName, const char *s_shares, const char *
spdlog::error("status {}", errStatus); spdlog::error("status {}", errStatus);
throw SGXException(ERROR_IN_ENCLAVE, "Create BLS private key failed in enclave"); throw SGXException(ERROR_IN_ENCLAVE, "Create BLS private key failed in enclave");
} else { } else {
char hexBLSKey[2 * BUF_LEN]; char hexBLSKey[2 * BUF_LEN];
carray2Hex(encr_bls_key, enc_bls_len, hexBLSKey); carray2Hex(encr_bls_key, enc_bls_len, hexBLSKey);
SGXWalletServer::writeDataToDB(blsKeyName, hexBLSKey); SGXWalletServer::writeDataToDB(blsKeyName, hexBLSKey);
return true; return true;
} }
} }
vector<string> GetBLSPubKey(const char *encryptedKeyHex) { vector<string> GetBLSPubKey(const char *encryptedKeyHex) {
char errMsg1[BUF_LEN]; char errMsg1[BUF_LEN];
int errStatus = 0; int errStatus = 0;
...@@ -323,7 +311,6 @@ vector<string> GetBLSPubKey(const char *encryptedKeyHex) { ...@@ -323,7 +311,6 @@ vector<string> GetBLSPubKey(const char *encryptedKeyHex) {
} }
string decryptDHKey(const string &polyName, int ind) { string decryptDHKey(const string &polyName, int ind) {
vector<char> errMsg1(1024, 0); vector<char> errMsg1(1024, 0);
int errStatus = 0; int errStatus = 0;
...@@ -342,7 +329,6 @@ string decryptDHKey(const string &polyName, int ind) { ...@@ -342,7 +329,6 @@ string decryptDHKey(const string &polyName, int ind) {
spdlog::debug("encr DH key length is {}", dhEncLen); spdlog::debug("encr DH key length is {}", dhEncLen);
spdlog::debug("hex encr DH key length is {}", hexEncrKeyPtr->length()); spdlog::debug("hex encr DH key length is {}", hexEncrKeyPtr->length());
char DHKey[ECDSA_SKEY_LEN]; char DHKey[ECDSA_SKEY_LEN];
trustedDecryptKeyAES(eid, &errStatus, errMsg1.data(), encryptedDHKey, dhEncLen, DHKey); trustedDecryptKeyAES(eid, &errStatus, errMsg1.data(), encryptedDHKey, dhEncLen, DHKey);
......
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