Unverified Commit a3130c56 authored by kladko's avatar kladko

SKALE-2454-add-logs-to-enclave

parent 53fefaa7
...@@ -84,14 +84,14 @@ string gen_dkg_poly(int _t) { ...@@ -84,14 +84,14 @@ string gen_dkg_poly(int _t) {
uint32_t enc_len = 0; uint32_t enc_len = 0;
if (!encryptKeys) if (!encryptKeys)
status = gen_dkg_secret(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, _t); status = trustedGenDkgSecret(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, _t);
else else
status = gen_dkg_secret_aes(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, _t); status = trustedGenDkgSecret_aes(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, _t);
if (err_status != 0) { if (err_status != 0) {
throw SGXException(-666, errMsg.data()); throw SGXException(-666, errMsg.data());
} }
spdlog::debug("gen_dkg_secret, status {}", err_status, " err msg ", errMsg.data()); spdlog::debug("trustedGenDkgSecret, status {}", err_status, " err msg ", errMsg.data());
spdlog::debug("in DKGCrypto encr len is {}", enc_len); spdlog::debug("in DKGCrypto encr len is {}", enc_len);
uint64_t length = DKG_MAX_SEALED_LEN; uint64_t length = DKG_MAX_SEALED_LEN;
...@@ -138,10 +138,10 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n ...@@ -138,10 +138,10 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
uint32_t len = 0; uint32_t len = 0;
if (!encryptKeys) if (!encryptKeys)
status = get_public_shares(eid, &errStatus, errMsg1.data(), encrDKGPoly.data(), len, pubShares.data(), t, n); status = trustedGetPublicShares(eid, &errStatus, errMsg1.data(), encrDKGPoly.data(), len, pubShares.data(), t, n);
else { else {
status = get_public_shares_aes(eid, &errStatus, errMsg1.data(), encrDKGPoly.data(), encLen, pubShares.data(), t, n); status = trustedGetPublicShares_aes(eid, &errStatus, errMsg1.data(), encrDKGPoly.data(), encLen, pubShares.data(), t, n);
} }
if (errStatus != 0) { if (errStatus != 0) {
throw SGXException(-666, errMsg1.data()); throw SGXException(-666, errMsg1.data());
...@@ -152,7 +152,7 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n ...@@ -152,7 +152,7 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
spdlog::debug("public_shares:"); spdlog::debug("public_shares:");
spdlog::debug("{}", pubShares.data());; spdlog::debug("{}", pubShares.data());;
spdlog::debug("get_public_shares status: {}", errStatus); spdlog::debug("trustedGetPublicShares status: {}", errStatus);
vector<string> g2Strings = splitString(pubShares.data(), ','); vector<string> g2Strings = splitString(pubShares.data(), ',');
vector<vector<string>> pubSharesVect; vector<vector<string>> pubSharesVect;
...@@ -164,7 +164,7 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n ...@@ -164,7 +164,7 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
return pubSharesVect; return pubSharesVect;
} }
string get_secret_shares(const string &_polyName, const char *_encryptedPolyHex, const vector<string> &_publicKeys, int _t, string trustedGetSecretShares(const string &_polyName, const char *_encryptedPolyHex, const vector<string> &_publicKeys, int _t,
int _n) { int _n) {
vector<char> errMsg1(BUF_LEN, 0); vector<char> errMsg1(BUF_LEN, 0);
...@@ -182,9 +182,9 @@ string get_secret_shares(const string &_polyName, const char *_encryptedPolyHex, ...@@ -182,9 +182,9 @@ string get_secret_shares(const string &_polyName, const char *_encryptedPolyHex,
if (!encryptKeys) if (!encryptKeys)
status = set_encrypted_dkg_poly(eid, &errStatus, errMsg1.data(), encrDKGPoly.data()); status = trustedSetEncryptedDkgPoly(eid, &errStatus, errMsg1.data(), encrDKGPoly.data());
else else
status = set_encrypted_dkg_poly_aes(eid, &errStatus, errMsg1.data(), encrDKGPoly.data(), &encLen); status = trustedSetEncryptedDkgPoly_aes(eid, &errStatus, errMsg1.data(), encrDKGPoly.data(), &encLen);
if (status != SGX_SUCCESS || errStatus != 0) { if (status != SGX_SUCCESS || errStatus != 0) {
throw SGXException(-666, errMsg1.data()); throw SGXException(-666, errMsg1.data());
...@@ -209,10 +209,10 @@ string get_secret_shares(const string &_polyName, const char *_encryptedPolyHex, ...@@ -209,10 +209,10 @@ string get_secret_shares(const string &_polyName, const char *_encryptedPolyHex,
if (!encryptKeys) if (!encryptKeys)
get_encr_sshare(eid, &errStatus, errMsg1.data(), encryptedSkey.data(), &decLen, trustedGetEncryptedSecretShare(eid, &errStatus, errMsg1.data(), encryptedSkey.data(), &decLen,
currentShare.data(), sShareG2.data(), pubKeyB.data(), _t, _n, i + 1); currentShare.data(), sShareG2.data(), pubKeyB.data(), _t, _n, i + 1);
else else
get_encr_sshare_aes(eid, &errStatus, errMsg1.data(), encryptedSkey.data(), &decLen, trustedGetEncryptedSecretShare_aes(eid, &errStatus, errMsg1.data(), encryptedSkey.data(), &decLen,
currentShare.data(), sShareG2.data(), pubKeyB.data(), _t, _n, i + 1); currentShare.data(), sShareG2.data(), pubKeyB.data(), _t, _n, i + 1);
if (errStatus != 0) { if (errStatus != 0) {
throw SGXException(-666, errMsg1.data()); throw SGXException(-666, errMsg1.data());
...@@ -265,9 +265,9 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr ...@@ -265,9 +265,9 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr
if (!encryptKeys) if (!encryptKeys)
dkg_verification(eid, &err_status, errMsg1, pshares, encr_sshare, encr_key, dec_key_len, t, ind, &result); trustedDkgVerify(eid, &err_status, errMsg1, pshares, encr_sshare, encr_key, dec_key_len, t, ind, &result);
else else
dkg_verification_aes(eid, &err_status, errMsg1, pshares, encr_sshare, encr_key, dec_key_len, t, ind, &result); trustedDkgVerify_aes(eid, &err_status, errMsg1, pshares, encr_sshare, encr_key, dec_key_len, t, ind, &result);
if (result == 2) { if (result == 2) {
throw SGXException(INVALID_HEX, "Invalid public shares"); throw SGXException(INVALID_HEX, "Invalid public shares");
...@@ -302,9 +302,9 @@ bool CreateBLSShare(const string &blsKeyName, const char *s_shares, const char * ...@@ -302,9 +302,9 @@ bool CreateBLSShare(const string &blsKeyName, const char *s_shares, const char *
if (!encryptKeys) if (!encryptKeys)
create_bls_key(eid, &err_status, errMsg1, s_shares, encr_key, dec_key_len, encr_bls_key, &enc_bls_len); trustedCreateBlsKey(eid, &err_status, errMsg1, s_shares, encr_key, dec_key_len, encr_bls_key, &enc_bls_len);
else else
create_bls_key_aes(eid, &err_status, errMsg1, s_shares, encr_key, dec_key_len, encr_bls_key, &enc_bls_len); trustedCreateBlsKey_aes(eid, &err_status, errMsg1, s_shares, encr_key, dec_key_len, encr_bls_key, &enc_bls_len);
if (err_status != 0) { if (err_status != 0) {
...@@ -341,9 +341,9 @@ vector<string> GetBLSPubKey(const char *encryptedKeyHex) { ...@@ -341,9 +341,9 @@ vector<string> GetBLSPubKey(const char *encryptedKeyHex) {
spdlog::debug("dec_key_len is {}", dec_key_len); spdlog::debug("dec_key_len is {}", dec_key_len);
if (!encryptKeys) if (!encryptKeys)
get_bls_pub_key(eid, &err_status, errMsg1, encr_key, dec_key_len, pub_key); trustedGetBlsPubKey(eid, &err_status, errMsg1, encr_key, dec_key_len, pub_key);
else else
get_bls_pub_key_aes(eid, &err_status, errMsg1, encr_key, dec_key_len, pub_key); trustedGetBlsPubKey_aes(eid, &err_status, errMsg1, encr_key, dec_key_len, pub_key);
if (err_status != 0) { if (err_status != 0) {
spdlog::error(string(errMsg1) + " . Status is {}", err_status); spdlog::error(string(errMsg1) + " . Status is {}", err_status);
throw SGXException(ERROR_IN_ENCLAVE, "Failed to get BLS public key in enclave"); throw SGXException(ERROR_IN_ENCLAVE, "Failed to get BLS public key in enclave");
......
...@@ -33,7 +33,7 @@ std::vector <std::vector<std::string>> get_verif_vect(const char* encryptedPolyH ...@@ -33,7 +33,7 @@ std::vector <std::vector<std::string>> get_verif_vect(const char* encryptedPolyH
std::vector<std::string> splitString(const char* koefs, const char symbol); std::vector<std::string> splitString(const char* koefs, const char symbol);
std::string get_secret_shares(const std::string& _polyName, const char* _encryptedPolyHex, const std::vector<std::string>& _publicKeys, int _t, int _n); std::string trustedGetSecretShares(const std::string& _polyName, const char* _encryptedPolyHex, const std::vector<std::string>& _publicKeys, int _t, int _n);
bool verifyShares(const char* publicShares, const char* encr_sshare, const char * encryptedKeyHex, int t, int n, int ind); bool verifyShares(const char* publicShares, const char* encr_sshare, const char * encryptedKeyHex, int t, int n, int ind);
......
...@@ -517,7 +517,7 @@ Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const J ...@@ -517,7 +517,7 @@ Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const J
pubKeysStrs.push_back(_pubKeys[i].asString()); pubKeysStrs.push_back(_pubKeys[i].asString());
} }
string s = get_secret_shares(_polyName, encr_poly_ptr->c_str(), pubKeysStrs, _t, _n); string s = trustedGetSecretShares(_polyName, encr_poly_ptr->c_str(), pubKeysStrs, _t, _n);
//cerr << "result is " << s << endl; //cerr << "result is " << s << endl;
result["secretShare"] = s; result["secretShare"] = s;
......
...@@ -521,7 +521,7 @@ void trustedBlsSignMessage(int *err_status, char *err_string, uint8_t *encrypted ...@@ -521,7 +521,7 @@ void trustedBlsSignMessage(int *err_status, char *err_string, uint8_t *encrypted
free(sig); free(sig);
} }
void gen_dkg_secret(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t *enc_len, size_t _t) { void trustedGenDkgSecret(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t *enc_len, size_t _t) {
char dkg_secret[DKG_BUFER_LENGTH]; //= (char*)malloc(DKG_BUFER_LENGTH); char dkg_secret[DKG_BUFER_LENGTH]; //= (char*)malloc(DKG_BUFER_LENGTH);
...@@ -548,7 +548,7 @@ void gen_dkg_secret(int *err_status, char *err_string, uint8_t *encrypted_dkg_se ...@@ -548,7 +548,7 @@ void gen_dkg_secret(int *err_status, char *err_string, uint8_t *encrypted_dkg_se
//free(dkg_secret); //free(dkg_secret);
} }
void decrypt_dkg_secret(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint8_t *decrypted_dkg_secret, void trustedDecryptDkgSecret(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint8_t *decrypted_dkg_secret,
uint32_t *dec_len) { uint32_t *dec_len) {
//uint32_t dec_size = DKG_BUFER_LENGTH;//sgx_get_encrypt_txt_len( ( sgx_sealed_data_t *)encrypted_dkg_secret); //uint32_t dec_size = DKG_BUFER_LENGTH;//sgx_get_encrypt_txt_len( ( sgx_sealed_data_t *)encrypted_dkg_secret);
...@@ -565,7 +565,7 @@ void decrypt_dkg_secret(int *err_status, char *err_string, uint8_t *encrypted_dk ...@@ -565,7 +565,7 @@ void decrypt_dkg_secret(int *err_status, char *err_string, uint8_t *encrypted_dk
*dec_len = decr_len; *dec_len = decr_len;
} }
void get_secret_shares(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t *dec_len, void trustedGetSecretShares(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t *dec_len,
char *secret_shares, char *secret_shares,
unsigned _t, unsigned _n) { unsigned _t, unsigned _n) {
...@@ -574,7 +574,7 @@ void get_secret_shares(int *err_status, char *err_string, uint8_t *encrypted_dkg ...@@ -574,7 +574,7 @@ void get_secret_shares(int *err_status, char *err_string, uint8_t *encrypted_dkg
//char decrypted_dkg_secret[DKG_MAX_SEALED_LEN]; //char decrypted_dkg_secret[DKG_MAX_SEALED_LEN];
uint32_t decr_len; uint32_t decr_len;
//uint32_t* decr_len_test = (char*)malloc(1); //uint32_t* decr_len_test = (char*)malloc(1);
decrypt_dkg_secret(err_status, err_string, encrypted_dkg_secret, (uint8_t *) decrypted_dkg_secret, &decr_len); trustedDecryptDkgSecret(err_status, err_string, encrypted_dkg_secret, (uint8_t *) decrypted_dkg_secret, &decr_len);
//sgx_status_t status = sgx_unseal_data( //sgx_status_t status = sgx_unseal_data(
// (const sgx_sealed_data_t *)encrypted_dkg_secret, NULL, 0, (uint8_t*)decrypted_dkg_secret, &decr_len); // (const sgx_sealed_data_t *)encrypted_dkg_secret, NULL, 0, (uint8_t*)decrypted_dkg_secret, &decr_len);
...@@ -590,16 +590,16 @@ void get_secret_shares(int *err_status, char *err_string, uint8_t *encrypted_dkg ...@@ -590,16 +590,16 @@ void get_secret_shares(int *err_status, char *err_string, uint8_t *encrypted_dkg
//free(decrypted_dkg_secret); //free(decrypted_dkg_secret);
} }
void get_public_shares(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t enc_len, void trustedGetPublicShares(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t enc_len,
char *public_shares, char *public_shares,
unsigned _t, unsigned _n) { unsigned _t, unsigned _n) {
//char decrypted_dkg_secret[DKG_MAX_SEALED_LEN * 2]; //= (char*)malloc(DKG_MAX_SEALED_LEN); //char decrypted_dkg_secret[DKG_MAX_SEALED_LEN * 2]; //= (char*)malloc(DKG_MAX_SEALED_LEN);
char *decrypted_dkg_secret = (char *) malloc(DKG_MAX_SEALED_LEN); char *decrypted_dkg_secret = (char *) malloc(DKG_MAX_SEALED_LEN);
uint32_t decr_len; uint32_t decr_len;
decrypt_dkg_secret(err_status, err_string, (uint8_t *) encrypted_dkg_secret, decrypted_dkg_secret, &decr_len); trustedDecryptDkgSecret(err_status, err_string, (uint8_t *) encrypted_dkg_secret, decrypted_dkg_secret, &decr_len);
if (*err_status != 0) { if (*err_status != 0) {
snprintf(err_string, BUF_LEN, "decrypt_dkg_secret failed with status %d", *err_status); snprintf(err_string, BUF_LEN, "trustedDecryptDkgSecret failed with status %d", *err_status);
return; return;
} }
//strncpy(err_string, decrypted_dkg_secret, 1024); //strncpy(err_string, decrypted_dkg_secret, 1024);
...@@ -613,7 +613,7 @@ void get_public_shares(int *err_status, char *err_string, uint8_t *encrypted_dkg ...@@ -613,7 +613,7 @@ void get_public_shares(int *err_status, char *err_string, uint8_t *encrypted_dkg
} }
void set_encrypted_dkg_poly(int *err_status, char *err_string, uint8_t *encrypted_poly) { void trustedSetEncryptedDkgPoly(int *err_status, char *err_string, uint8_t *encrypted_poly) {
memset(decryptedDkgPoly, 0, DKG_BUFER_LENGTH); memset(decryptedDkgPoly, 0, DKG_BUFER_LENGTH);
uint32_t decr_len; uint32_t decr_len;
sgx_status_t status = sgx_unseal_data( sgx_status_t status = sgx_unseal_data(
...@@ -627,7 +627,7 @@ void set_encrypted_dkg_poly(int *err_status, char *err_string, uint8_t *encrypte ...@@ -627,7 +627,7 @@ void set_encrypted_dkg_poly(int *err_status, char *err_string, uint8_t *encrypte
} }
void get_encr_sshare(int *err_status, char *err_string, uint8_t *encrypted_skey, uint32_t *dec_len, void trustedGetEncryptedSecretShare(int *err_status, char *err_string, uint8_t *encrypted_skey, uint32_t *dec_len,
char *result_str, char *s_shareG2, char *pub_keyB, uint8_t _t, uint8_t _n, uint8_t ind) { char *result_str, char *s_shareG2, char *pub_keyB, uint8_t _t, uint8_t _n, uint8_t ind) {
char skey[ECDSA_SKEY_LEN]; char skey[ECDSA_SKEY_LEN];
...@@ -718,7 +718,7 @@ void complaint_response(int *err_status, char *err_string, uint8_t *encrypted_DH ...@@ -718,7 +718,7 @@ void complaint_response(int *err_status, char *err_string, uint8_t *encrypted_DH
char decrypted_dkg_secret[DKG_BUFER_LENGTH]; //= (char*)malloc(DKG_BUFER_LENGTH); char decrypted_dkg_secret[DKG_BUFER_LENGTH]; //= (char*)malloc(DKG_BUFER_LENGTH);
uint32_t decr_len; uint32_t decr_len;
decrypt_dkg_secret(err_status, err_string, encrypted_dkg_secret, (uint8_t *) decrypted_dkg_secret, &decr_len); trustedDecryptDkgSecret(err_status, err_string, encrypted_dkg_secret, (uint8_t *) decrypted_dkg_secret, &decr_len);
if (*err_status != 0) { if (*err_status != 0) {
snprintf(err_string, BUF_LEN, "sgx_unseal_data - encrypted_dkg_secret failed with status %d", *err_status); snprintf(err_string, BUF_LEN, "sgx_unseal_data - encrypted_dkg_secret failed with status %d", *err_status);
return; return;
...@@ -733,7 +733,7 @@ void complaint_response(int *err_status, char *err_string, uint8_t *encrypted_DH ...@@ -733,7 +733,7 @@ void complaint_response(int *err_status, char *err_string, uint8_t *encrypted_DH
// free(decrypted_dkg_secret); // free(decrypted_dkg_secret);
} }
void dkg_verification(int *err_status, char *err_string, const char *public_shares, const char *s_share, void trustedDkgVerify(int *err_status, char *err_string, const char *public_shares, const char *s_share,
uint8_t *encrypted_key, uint64_t key_len, unsigned _t, int _ind, int *result) { uint8_t *encrypted_key, uint64_t key_len, unsigned _t, int _ind, int *result) {
//uint32_t dec_len = 625; //uint32_t dec_len = 625;
...@@ -791,7 +791,7 @@ void dkg_verification(int *err_status, char *err_string, const char *public_shar ...@@ -791,7 +791,7 @@ void dkg_verification(int *err_status, char *err_string, const char *public_shar
} }
void create_bls_key(int *err_status, char *err_string, const char *s_shares, void trustedCreateBlsKey(int *err_status, char *err_string, const char *s_shares,
uint8_t *encrypted_key, uint64_t key_len, uint8_t *encr_bls_key, uint32_t *enc_bls_key_len) { uint8_t *encrypted_key, uint64_t key_len, uint8_t *encr_bls_key, uint32_t *enc_bls_key_len) {
char skey[ECDSA_SKEY_LEN]; char skey[ECDSA_SKEY_LEN];
...@@ -905,7 +905,7 @@ void create_bls_key(int *err_status, char *err_string, const char *s_shares, ...@@ -905,7 +905,7 @@ void create_bls_key(int *err_status, char *err_string, const char *s_shares,
mpz_clear(q); mpz_clear(q);
} }
void get_bls_pub_key(int *err_status, char *err_string, uint8_t *encrypted_key, uint64_t key_len, char *bls_pub_key) { void trustedGetBlsPubKey(int *err_status, char *err_string, uint8_t *encrypted_key, uint64_t key_len, char *bls_pub_key) {
char skey_hex[ECDSA_SKEY_LEN]; char skey_hex[ECDSA_SKEY_LEN];
...@@ -1348,7 +1348,7 @@ void trustedBlsSignMessage_aes(int *err_status, char *err_string, uint8_t *encry ...@@ -1348,7 +1348,7 @@ void trustedBlsSignMessage_aes(int *err_status, char *err_string, uint8_t *encry
} }
void void
gen_dkg_secret_aes(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t *enc_len, size_t _t) { trustedGenDkgSecret_aes(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t *enc_len, size_t _t) {
char dkg_secret[DKG_BUFER_LENGTH];// = (char*)calloc(DKG_BUFER_LENGTH, 1); char dkg_secret[DKG_BUFER_LENGTH];// = (char*)calloc(DKG_BUFER_LENGTH, 1);
memset(dkg_secret, 0, DKG_BUFER_LENGTH); memset(dkg_secret, 0, DKG_BUFER_LENGTH);
...@@ -1392,7 +1392,7 @@ gen_dkg_secret_aes(int *err_status, char *err_string, uint8_t *encrypted_dkg_sec ...@@ -1392,7 +1392,7 @@ gen_dkg_secret_aes(int *err_status, char *err_string, uint8_t *encrypted_dkg_sec
} }
void void
decrypt_dkg_secret_aes(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint8_t *decrypted_dkg_secret, trustedDecryptDkgSecret_aes(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint8_t *decrypted_dkg_secret,
uint32_t *dec_len) { uint32_t *dec_len) {
int status = AES_decrypt(encrypted_dkg_secret, dec_len, decrypted_dkg_secret); int status = AES_decrypt(encrypted_dkg_secret, dec_len, decrypted_dkg_secret);
...@@ -1405,7 +1405,7 @@ decrypt_dkg_secret_aes(int *err_status, char *err_string, uint8_t *encrypted_dkg ...@@ -1405,7 +1405,7 @@ decrypt_dkg_secret_aes(int *err_status, char *err_string, uint8_t *encrypted_dkg
//*dec_len = decr_len; //*dec_len = decr_len;
} }
void set_encrypted_dkg_poly_aes(int *err_status, char *err_string, uint8_t *encrypted_poly, uint64_t *enc_len) { void trustedSetEncryptedDkgPoly_aes(int *err_status, char *err_string, uint8_t *encrypted_poly, uint64_t *enc_len) {
memset(decryptedDkgPoly, 0, DKG_BUFER_LENGTH); memset(decryptedDkgPoly, 0, DKG_BUFER_LENGTH);
int status = AES_decrypt(encrypted_poly, *enc_len, decryptedDkgPoly); int status = AES_decrypt(encrypted_poly, *enc_len, decryptedDkgPoly);
...@@ -1416,7 +1416,7 @@ void set_encrypted_dkg_poly_aes(int *err_status, char *err_string, uint8_t *encr ...@@ -1416,7 +1416,7 @@ void set_encrypted_dkg_poly_aes(int *err_status, char *err_string, uint8_t *encr
} }
} }
void get_encr_sshare_aes(int *err_status, char *err_string, uint8_t *encrypted_skey, uint32_t *dec_len, void trustedGetEncryptedSecretShare_aes(int *err_status, char *err_string, uint8_t *encrypted_skey, uint32_t *dec_len,
char *result_str, char *s_shareG2, char *pub_keyB, uint8_t _t, uint8_t _n, uint8_t ind) { char *result_str, char *s_shareG2, char *pub_keyB, uint8_t _t, uint8_t _n, uint8_t ind) {
char skey[ECDSA_SKEY_LEN]; char skey[ECDSA_SKEY_LEN];
...@@ -1440,7 +1440,7 @@ void get_encr_sshare_aes(int *err_status, char *err_string, uint8_t *encrypted_s ...@@ -1440,7 +1440,7 @@ void get_encr_sshare_aes(int *err_status, char *err_string, uint8_t *encrypted_s
skey[ECDSA_SKEY_LEN - 1] = 0; skey[ECDSA_SKEY_LEN - 1] = 0;
if (status != SGX_SUCCESS) { if (status != SGX_SUCCESS) {
snprintf(err_string, BUF_LEN, "AES_decrypt failed (in get_encr_sshare_aes) with status %d", status); snprintf(err_string, BUF_LEN, "AES_decrypt failed (in trustedGetEncryptedSecretShare_aes) with status %d", status);
*err_status = status; *err_status = status;
return; return;
} }
...@@ -1495,7 +1495,7 @@ void get_encr_sshare_aes(int *err_status, char *err_string, uint8_t *encrypted_s ...@@ -1495,7 +1495,7 @@ void get_encr_sshare_aes(int *err_status, char *err_string, uint8_t *encrypted_s
} }
void get_public_shares_aes(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t enc_len, void trustedGetPublicShares_aes(int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t enc_len,
char *public_shares, char *public_shares,
unsigned _t, unsigned _n) { unsigned _t, unsigned _n) {
...@@ -1523,7 +1523,7 @@ void get_public_shares_aes(int *err_status, char *err_string, uint8_t *encrypted ...@@ -1523,7 +1523,7 @@ void get_public_shares_aes(int *err_status, char *err_string, uint8_t *encrypted
//free(decrypted_dkg_secret); //free(decrypted_dkg_secret);
} }
void dkg_verification_aes(int *err_status, char *err_string, const char *public_shares, const char *s_share, void trustedDkgVerify_aes(int *err_status, char *err_string, const char *public_shares, const char *s_share,
uint8_t *encrypted_key, uint64_t enc_len, unsigned _t, int _ind, int *result) { uint8_t *encrypted_key, uint64_t enc_len, unsigned _t, int _ind, int *result) {
//uint32_t dec_len = 625; //uint32_t dec_len = 625;
...@@ -1533,7 +1533,7 @@ void dkg_verification_aes(int *err_status, char *err_string, const char *public_ ...@@ -1533,7 +1533,7 @@ void dkg_verification_aes(int *err_status, char *err_string, const char *public_
//skey[ECDSA_SKEY_LEN - 1] = 0; //skey[ECDSA_SKEY_LEN - 1] = 0;
if (status != SGX_SUCCESS) { if (status != SGX_SUCCESS) {
snprintf(err_string, BUF_LEN, "AES_decrypt failed (in dkg_verification_aes) with status %d", status); snprintf(err_string, BUF_LEN, "AES_decrypt failed (in trustedDkgVerify_aes) with status %d", status);
*err_status = status; *err_status = status;
return; return;
} }
...@@ -1587,7 +1587,7 @@ void dkg_verification_aes(int *err_status, char *err_string, const char *public_ ...@@ -1587,7 +1587,7 @@ void dkg_verification_aes(int *err_status, char *err_string, const char *public_
} }
void create_bls_key_aes(int *err_status, char *err_string, const char *s_shares, void trustedCreateBlsKey_aes(int *err_status, char *err_string, const char *s_shares,
uint8_t *encrypted_key, uint64_t key_len, uint8_t *encr_bls_key, uint32_t *enc_bls_key_len) { uint8_t *encrypted_key, uint64_t key_len, uint8_t *encr_bls_key, uint32_t *enc_bls_key_len) {
char skey[ECDSA_SKEY_LEN]; char skey[ECDSA_SKEY_LEN];
...@@ -1694,7 +1694,7 @@ void create_bls_key_aes(int *err_status, char *err_string, const char *s_shares, ...@@ -1694,7 +1694,7 @@ void create_bls_key_aes(int *err_status, char *err_string, const char *s_shares,
} }
void void
get_bls_pub_key_aes(int *err_status, char *err_string, uint8_t *encrypted_key, uint64_t key_len, char *bls_pub_key) { trustedGetBlsPubKey_aes(int *err_status, char *err_string, uint8_t *encrypted_key, uint64_t key_len, char *bls_pub_key) {
char skey_hex[ECDSA_SKEY_LEN]; char skey_hex[ECDSA_SKEY_LEN];
......
...@@ -67,21 +67,21 @@ enclave { ...@@ -67,21 +67,21 @@ enclave {
[in, count = 1024] char* hashY , [in, count = 1024] char* hashY ,
[out, count = 1024] char* signature); [out, count = 1024] char* signature);
public void gen_dkg_secret ( public void trustedGenDkgSecret (
[user_check] int *err_status, [user_check] int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[out, count = 3050] uint8_t* encrypted_dkg_secret, [out, count = 3050] uint8_t* encrypted_dkg_secret,
[user_check] uint32_t * enc_len, [user_check] uint32_t * enc_len,
size_t _t); size_t _t);
public void decrypt_dkg_secret ( public void trustedDecryptDkgSecret (
[user_check] int *err_status, [user_check] int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_dkg_secret, [in, count = 3050] uint8_t* encrypted_dkg_secret,
[out, count = 2490] uint8_t* decrypted_dkg_secret, [out, count = 2490] uint8_t* decrypted_dkg_secret,
[user_check] uint32_t* dec_len); [user_check] uint32_t* dec_len);
public void get_secret_shares ( public void trustedGetSecretShares (
[user_check] int *err_status, [user_check] int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_dkg_secret, [in, count = 3050] uint8_t* encrypted_dkg_secret,
...@@ -90,7 +90,7 @@ enclave { ...@@ -90,7 +90,7 @@ enclave {
unsigned _t, unsigned _t,
unsigned _n); unsigned _n);
public void get_public_shares ( public void trustedGetPublicShares (
[user_check] int *err_status, [user_check] int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_dkg_secret, [in, count = 3050] uint8_t* encrypted_dkg_secret,
...@@ -110,11 +110,11 @@ enclave { ...@@ -110,11 +110,11 @@ enclave {
[user_check] uint8_t* sig_v, [user_check] uint8_t* sig_v,
int base); int base);
public void set_encrypted_dkg_poly( [user_check] int *err_status, public void trustedSetEncryptedDkgPoly( [user_check] int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_poly); [in, count = 3050] uint8_t* encrypted_poly);
public void get_encr_sshare( public void trustedGetEncryptedSecretShare(
[user_check]int *err_status, [user_check]int *err_status,
[out, count = 1024] char *err_string, [out, count = 1024] char *err_string,
[out, count = 1024] uint8_t *encrypted_skey, [out, count = 1024] uint8_t *encrypted_skey,
...@@ -126,7 +126,7 @@ enclave { ...@@ -126,7 +126,7 @@ enclave {
uint8_t _n, uint8_t _n,
uint8_t ind); uint8_t ind);
public void dkg_verification( public void trustedDkgVerify(
[user_check] int *err_status, [user_check] int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[in, count = 8193] const char* public_shares, [in, count = 8193] const char* public_shares,
...@@ -137,7 +137,7 @@ enclave { ...@@ -137,7 +137,7 @@ enclave {
int _ind, int _ind,
[user_check] int* result); [user_check] int* result);
public void create_bls_key( public void trustedCreateBlsKey(
[user_check]int *err_status, [user_check]int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[in, count = 6145] const char* s_shares, [in, count = 6145] const char* s_shares,
...@@ -146,7 +146,7 @@ enclave { ...@@ -146,7 +146,7 @@ enclave {
[out, count = 1024] uint8_t * encr_bls_key, [out, count = 1024] uint8_t * encr_bls_key,
[user_check] uint32_t *enc_bls_key_len); [user_check] uint32_t *enc_bls_key_len);
public void get_bls_pub_key( public void trustedGetBlsPubKey(
[user_check]int *err_status, [user_check]int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[in, count = 1024] uint8_t* encrypted_key, [in, count = 1024] uint8_t* encrypted_key,
...@@ -227,27 +227,27 @@ enclave { ...@@ -227,27 +227,27 @@ enclave {
[out, count = 1024] char* key ); [out, count = 1024] char* key );
public void gen_dkg_secret_aes ( public void trustedGenDkgSecret_aes (
[user_check] int *err_status, [user_check] int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[out, count = 3050] uint8_t* encrypted_dkg_secret, [out, count = 3050] uint8_t* encrypted_dkg_secret,
[user_check] uint32_t * enc_len, [user_check] uint32_t * enc_len,
size_t _t); size_t _t);
public void decrypt_dkg_secret_aes ( public void trustedDecryptDkgSecret_aes (
[user_check] int *err_status, [user_check] int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_dkg_secret, [in, count = 3050] uint8_t* encrypted_dkg_secret,
[out, count = 2490] uint8_t* decrypted_dkg_secret, [out, count = 2490] uint8_t* decrypted_dkg_secret,
[user_check] uint32_t* dec_len); [user_check] uint32_t* dec_len);
public void set_encrypted_dkg_poly_aes( public void trustedSetEncryptedDkgPoly_aes(
[user_check] int *err_status, [user_check] int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_poly, [in, count = 3050] uint8_t* encrypted_poly,
[user_check] uint64_t* enc_len); [user_check] uint64_t* enc_len);
public void get_encr_sshare_aes( public void trustedGetEncryptedSecretShare_aes(
[user_check]int *err_status, [user_check]int *err_status,
[out, count = 1024] char *err_string, [out, count = 1024] char *err_string,
[out, count = 1024] uint8_t *encrypted_skey, [out, count = 1024] uint8_t *encrypted_skey,
...@@ -259,7 +259,7 @@ enclave { ...@@ -259,7 +259,7 @@ enclave {
uint8_t _n, uint8_t _n,
uint8_t ind); uint8_t ind);
public void get_public_shares_aes ( public void trustedGetPublicShares_aes (
[user_check] int *err_status, [user_check] int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_dkg_secret, [in, count = 3050] uint8_t* encrypted_dkg_secret,
...@@ -268,7 +268,7 @@ enclave { ...@@ -268,7 +268,7 @@ enclave {
unsigned _t, unsigned _t,
unsigned _n); unsigned _n);
public void dkg_verification_aes( public void trustedDkgVerify_aes(
[user_check] int *err_status, [user_check] int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[in, count = 8193] const char* public_shares, [in, count = 8193] const char* public_shares,
...@@ -280,7 +280,7 @@ enclave { ...@@ -280,7 +280,7 @@ enclave {
[user_check] int* result); [user_check] int* result);
public void create_bls_key_aes( public void trustedCreateBlsKey_aes(
[user_check]int *err_status, [user_check]int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[in, count = 6145] const char* s_shares, [in, count = 6145] const char* s_shares,
...@@ -298,7 +298,7 @@ enclave { ...@@ -298,7 +298,7 @@ enclave {
[in, count = 1024] char* hashY , [in, count = 1024] char* hashY ,
[out, count = 1024] char* signature); [out, count = 1024] char* signature);
public void get_bls_pub_key_aes( public void trustedGetBlsPubKey_aes(
[user_check]int *err_status, [user_check]int *err_status,
[out, count = 1024] char* err_string, [out, count = 1024] char* err_string,
[in, count = 1024] uint8_t* encrypted_key, [in, count = 1024] uint8_t* encrypted_key,
......
...@@ -5472,10 +5472,10 @@ void trustedGenerateEcdsaKey(int* err_status, char* err_string, uint8_t* encrypt ...@@ -5472,10 +5472,10 @@ void trustedGenerateEcdsaKey(int* err_status, char* err_string, uint8_t* encrypt
void encrypt_key(int* err_status, char* err_string, char* key, uint8_t* encrypted_key, uint32_t* enc_len); void encrypt_key(int* err_status, char* err_string, char* key, uint8_t* encrypted_key, uint32_t* enc_len);
void decrypt_key(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t enc_len, char* key); void decrypt_key(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t enc_len, char* key);
void trustedBlsSignMessage(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t enc_len, char* hashX, char* hashY, char* signature); void trustedBlsSignMessage(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t enc_len, char* hashX, char* hashY, char* signature);
void gen_dkg_secret(int* err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint32_t* enc_len, size_t _t); void trustedGenDkgSecret(int* err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint32_t* enc_len, size_t _t);
void decrypt_dkg_secret(int* err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint8_t* decrypted_dkg_secret, uint32_t enc_len); void trustedDecryptDkgSecret(int* err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint8_t* decrypted_dkg_secret, uint32_t enc_len);
void get_secret_shares(int* err_status, char* err_string, uint8_t* decrypted_dkg_secret, uint32_t enc_len, char* secret_shares, unsigned int _t, unsigned int _n); void trustedGetSecretShares(int* err_status, char* err_string, uint8_t* decrypted_dkg_secret, uint32_t enc_len, char* secret_shares, unsigned int _t, unsigned int _n);
void get_public_shares(int* err_status, char* err_string, uint8_t* decrypted_dkg_secret, uint32_t enc_len, char* public_shares, unsigned int _t, unsigned int _n); void trustedGetPublicShares(int* err_status, char* err_string, uint8_t* decrypted_dkg_secret, uint32_t enc_len, char* public_shares, unsigned int _t, unsigned int _n);
void ecdsa_sign1(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t dec_len, unsigned char* hash, char* signature, int test_len); void ecdsa_sign1(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t dec_len, unsigned char* hash, char* signature, int test_len);
sgx_status_t oc_realloc(uint64_t* retval, void* optr, size_t osz, size_t nsz); sgx_status_t oc_realloc(uint64_t* retval, void* optr, size_t osz, size_t nsz);
...@@ -6887,7 +6887,7 @@ void trustedBlsSignMessage(int *err_status, char *err_string, uint8_t *encrypted ...@@ -6887,7 +6887,7 @@ void trustedBlsSignMessage(int *err_status, char *err_string, uint8_t *encrypted
} }
void gen_dkg_secret (int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t* enc_len, size_t _t){ void trustedGenDkgSecret (int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t* enc_len, size_t _t){
char* dkg_secret = (char*)malloc(1250); char* dkg_secret = (char*)malloc(1250);
...@@ -6905,7 +6905,7 @@ void gen_dkg_secret (int *err_status, char *err_string, uint8_t *encrypted_dkg_s ...@@ -6905,7 +6905,7 @@ void gen_dkg_secret (int *err_status, char *err_string, uint8_t *encrypted_dkg_s
free(dkg_secret); free(dkg_secret);
} }
void decrypt_dkg_secret (int *err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint8_t* decrypted_dkg_secret, uint32_t enc_len){ void trustedDecryptDkgSecret (int *err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint8_t* decrypted_dkg_secret, uint32_t enc_len){
...@@ -6918,17 +6918,17 @@ void decrypt_dkg_secret (int *err_status, char* err_string, uint8_t* encrypted_d ...@@ -6918,17 +6918,17 @@ void decrypt_dkg_secret (int *err_status, char* err_string, uint8_t* encrypted_d
} }
} }
void get_secret_shares(int *err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint32_t enc_len, char* secret_shares, void trustedGetSecretShares(int *err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint32_t enc_len, char* secret_shares,
unsigned _t, unsigned _n){ unsigned _t, unsigned _n){
char* decrypted_dkg_secret = (char*)malloc(2000); char* decrypted_dkg_secret = (char*)malloc(2000);
decrypt_dkg_secret(err_status, err_string, (uint8_t*)encrypted_dkg_secret, decrypted_dkg_secret, enc_len); trustedDecryptDkgSecret(err_status, err_string, (uint8_t*)encrypted_dkg_secret, decrypted_dkg_secret, enc_len);
calc_secret_shares(decrypted_dkg_secret, secret_shares, _t, _n); calc_secret_shares(decrypted_dkg_secret, secret_shares, _t, _n);
} }
void get_public_shares(int *err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint32_t enc_len, char* public_shares, void trustedGetPublicShares(int *err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint32_t enc_len, char* public_shares,
unsigned _t, unsigned _n){ unsigned _t, unsigned _n){
char* decrypted_dkg_secret = (char*)malloc(2000); char* decrypted_dkg_secret = (char*)malloc(2000);
decrypt_dkg_secret(err_status, err_string, (uint8_t*)encrypted_dkg_secret, decrypted_dkg_secret, enc_len); trustedDecryptDkgSecret(err_status, err_string, (uint8_t*)encrypted_dkg_secret, decrypted_dkg_secret, enc_len);
calc_public_shares(decrypted_dkg_secret, public_shares, _t); calc_public_shares(decrypted_dkg_secret, public_shares, _t);
} }
......
...@@ -185,21 +185,21 @@ TEST_CASE("DKG gen test", "[dkg-gen]") { ...@@ -185,21 +185,21 @@ TEST_CASE("DKG gen test", "[dkg-gen]") {
int err_status = 0; int err_status = 0;
uint32_t enc_len = 0; uint32_t enc_len = 0;
status = gen_dkg_secret(eid, &err_status, errMsg.data(), encryptedDKGSecret.data(), &enc_len, 32); status = trustedGenDkgSecret(eid, &err_status, errMsg.data(), encryptedDKGSecret.data(), &enc_len, 32);
REQUIRE(status == SGX_SUCCESS); REQUIRE(status == SGX_SUCCESS);
// printf("gen_dkg_secret completed with status: %d %s \n", err_status, errMsg.data()); // printf("trustedGenDkgSecret completed with status: %d %s \n", err_status, errMsg.data());
// printf("\n Length: %d \n", enc_len); // printf("\n Length: %d \n", enc_len);
vector<char> secret(BUF_LEN, 0); vector<char> secret(BUF_LEN, 0);
vector<char> errMsg1(BUF_LEN, 0); vector<char> errMsg1(BUF_LEN, 0);
uint32_t dec_len; uint32_t dec_len;
status = decrypt_dkg_secret(eid, &err_status, errMsg1.data(), encryptedDKGSecret.data(), status = trustedDecryptDkgSecret(eid, &err_status, errMsg1.data(), encryptedDKGSecret.data(),
(uint8_t *) secret.data(), &dec_len); (uint8_t *) secret.data(), &dec_len);
REQUIRE(status == SGX_SUCCESS); REQUIRE(status == SGX_SUCCESS);
// printf("\ndecrypt_dkg_secret completed with status: %d %s \n", err_status, errMsg1.data()); // printf("\ntrustedDecryptDkgSecret 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", (int) 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);
...@@ -277,7 +277,7 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") { ...@@ -277,7 +277,7 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
unsigned t = 32, n = 32; unsigned t = 32, n = 32;
status = gen_dkg_secret(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, n); status = trustedGenDkgSecret(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, n);
REQUIRE(status == SGX_SUCCESS); REQUIRE(status == SGX_SUCCESS);
//printf("gen_dkg_public completed with status: %d %s \n", err_status, errMsg); //printf("gen_dkg_public completed with status: %d %s \n", err_status, errMsg);
...@@ -287,10 +287,10 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") { ...@@ -287,10 +287,10 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
char colon = ':'; char colon = ':';
vector<char> public_shares(10000, 0); vector<char> public_shares(10000, 0);
status = get_public_shares(eid, &err_status, errMsg1.data(), status = trustedGetPublicShares(eid, &err_status, errMsg1.data(),
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("\ntrustedGetPublicShares status: %d error %s \n\n", err_status, errMsg1.data());
// printf(" LEN: %d \n", (int) 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());
...@@ -306,10 +306,10 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") { ...@@ -306,10 +306,10 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
vector<char> secret(BUF_LEN, 0); vector<char> secret(BUF_LEN, 0);
status = decrypt_dkg_secret(eid, &err_status, errMsg1.data(), encrypted_dkg_secret.data(), status = trustedDecryptDkgSecret(eid, &err_status, errMsg1.data(), encrypted_dkg_secret.data(),
(uint8_t *) secret.data(), &enc_len); (uint8_t *) secret.data(), &enc_len);
REQUIRE(status == SGX_SUCCESS); REQUIRE(status == SGX_SUCCESS);
//printf("\ndecrypt_dkg_secret completed with status: %d %s \n", err_status, errMsg1.data()); //printf("\ntrustedDecryptDkgSecret completed with status: %d %s \n", err_status, errMsg1.data());
signatures::Dkg dkg_obj(t, n); signatures::Dkg dkg_obj(t, n);
...@@ -349,11 +349,11 @@ TEST_CASE("DKG encrypted secret shares test", "[dkg-encr-sshares]") { ...@@ -349,11 +349,11 @@ TEST_CASE("DKG encrypted secret shares test", "[dkg-encr-sshares]") {
uint32_t enc_len = 0; uint32_t enc_len = 0;
vector<uint8_t> encrypted_dkg_secret(BUF_LEN, 0); vector<uint8_t> encrypted_dkg_secret(BUF_LEN, 0);
status = gen_dkg_secret(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, 2); status = trustedGenDkgSecret(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, 2);
REQUIRE(status == SGX_SUCCESS); REQUIRE(status == SGX_SUCCESS);
// cerr << " poly generated" << endl; // cerr << " poly generated" << endl;
status = set_encrypted_dkg_poly(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data()); status = trustedSetEncryptedDkgPoly(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data());
REQUIRE(status == SGX_SUCCESS); REQUIRE(status == SGX_SUCCESS);
// cerr << " poly set" << endl; // cerr << " poly set" << endl;
...@@ -362,7 +362,7 @@ TEST_CASE("DKG encrypted secret shares test", "[dkg-encr-sshares]") { ...@@ -362,7 +362,7 @@ TEST_CASE("DKG encrypted secret shares test", "[dkg-encr-sshares]") {
string pub_keyB = "c0152c48bf640449236036075d65898fded1e242c00acb45519ad5f788ea7cbf9a5df1559e7fc87932eee5478b1b9023de19df654395574a690843988c3ff475"; string pub_keyB = "c0152c48bf640449236036075d65898fded1e242c00acb45519ad5f788ea7cbf9a5df1559e7fc87932eee5478b1b9023de19df654395574a690843988c3ff475";
vector<char> s_shareG2(BUF_LEN, 0); vector<char> s_shareG2(BUF_LEN, 0);
status = get_encr_sshare(eid, &err_status, errMsg.data(), encrPRDHKey.data(), &enc_len, result.data(), status = trustedGetEncryptedSecretShare(eid, &err_status, errMsg.data(), encrPRDHKey.data(), &enc_len, result.data(),
s_shareG2.data(), s_shareG2.data(),
(char *) pub_keyB.data(), 2, 2, 1); (char *) pub_keyB.data(), 2, 2, 1);
...@@ -387,11 +387,11 @@ TEST_CASE("DKG verification test", "[dkg-verify]") { ...@@ -387,11 +387,11 @@ TEST_CASE("DKG verification test", "[dkg-verify]") {
vector<uint8_t> encrypted_dkg_secret(BUF_LEN, 0); vector<uint8_t> encrypted_dkg_secret(BUF_LEN, 0);
status = gen_dkg_secret(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, 2); status = trustedGenDkgSecret(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, 2);
REQUIRE(status == SGX_SUCCESS); REQUIRE(status == SGX_SUCCESS);
// cerr << " poly generated" << endl; // cerr << " poly generated" << endl;
status = set_encrypted_dkg_poly(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data()); status = trustedSetEncryptedDkgPoly(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data());
REQUIRE(status == SGX_SUCCESS); REQUIRE(status == SGX_SUCCESS);
// cerr << " poly set" << endl; // cerr << " poly set" << endl;
...@@ -401,11 +401,11 @@ TEST_CASE("DKG verification test", "[dkg-verify]") { ...@@ -401,11 +401,11 @@ TEST_CASE("DKG verification test", "[dkg-verify]") {
vector<char> s_shareG2(BUF_LEN, 0); vector<char> s_shareG2(BUF_LEN, 0);
status = get_encr_sshare(eid, &err_status, errMsg.data(), encrPrDHKey.data(), &enc_len, result.data(), status = trustedGetEncryptedSecretShare(eid, &err_status, errMsg.data(), encrPrDHKey.data(), &enc_len, result.data(),
s_shareG2.data(), s_shareG2.data(),
(char *) pub_keyB.data(), 2, 2, 1); (char *) pub_keyB.data(), 2, 2, 1);
REQUIRE(status == SGX_SUCCESS); REQUIRE(status == SGX_SUCCESS);
// printf(" get_encr_sshare completed with status: %d %s \n", err_status, errMsg.data()); // printf(" trustedGetEncryptedSecretShare completed with status: %d %s \n", err_status, errMsg.data());
// cerr << "secret share is " << result.data() << endl; // cerr << "secret share is " << result.data() << endl;
......
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