Unverified Commit 5b24c035 authored by kladko's avatar kladko

SKALE-2454-add-logs-to-enclave

parent 6b7165fb
...@@ -86,7 +86,7 @@ string gen_dkg_poly(int _t) { ...@@ -86,7 +86,7 @@ string gen_dkg_poly(int _t) {
if (!encryptKeys) if (!encryptKeys)
status = trustedGenDkgSecret(eid, &errStatus, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, _t); status = trustedGenDkgSecret(eid, &errStatus, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, _t);
else else
status = trustedGenDkgSecret_aes(eid, &errStatus, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, _t); status = trustedGenDkgSecretAES(eid, &errStatus, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, _t);
if (errStatus != 0) { if (errStatus != 0) {
throw SGXException(-666, errMsg.data()); throw SGXException(-666, errMsg.data());
} }
...@@ -139,7 +139,7 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n ...@@ -139,7 +139,7 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
n); n);
else { else {
status = trustedGetPublicShares_aes(eid, &errStatus, errMsg1.data(), encrDKGPoly.data(), encLen, status = trustedGetPublicSharesAES(eid, &errStatus, errMsg1.data(), encrDKGPoly.data(), encLen,
pubShares.data(), t, n); pubShares.data(), t, n);
} }
if (errStatus != 0) { if (errStatus != 0) {
...@@ -183,7 +183,7 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol ...@@ -183,7 +183,7 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
if (!encryptKeys) if (!encryptKeys)
status = trustedSetEncryptedDkgPoly(eid, &errStatus, errMsg1.data(), encrDKGPoly.data()); status = trustedSetEncryptedDkgPoly(eid, &errStatus, errMsg1.data(), encrDKGPoly.data());
else else
status = trustedSetEncryptedDkgPoly_aes(eid, &errStatus, errMsg1.data(), encrDKGPoly.data(), &encLen); status = trustedSetEncryptedDkgPolyAES(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());
...@@ -211,7 +211,7 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol ...@@ -211,7 +211,7 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
trustedGetEncryptedSecretShare(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
trustedGetEncryptedSecretShare_aes(eid, &errStatus, errMsg1.data(), encryptedSkey.data(), &decLen, trustedGetEncryptedSecretShareAES(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,7 +265,7 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr ...@@ -265,7 +265,7 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr
if (!encryptKeys) if (!encryptKeys)
trustedDkgVerify(eid, &errStatus, errMsg, pshares, encr_sshare, encr_key, decKeyLen, t, ind, &result); trustedDkgVerify(eid, &errStatus, errMsg, pshares, encr_sshare, encr_key, decKeyLen, t, ind, &result);
else else
trustedDkgVerify_aes(eid, &errStatus, errMsg, pshares, encr_sshare, encr_key, decKeyLen, t, ind, &result); trustedDkgVerifyAES(eid, &errStatus, errMsg, pshares, encr_sshare, encr_key, decKeyLen, t, ind, &result);
if (result == 2) { if (result == 2) {
throw SGXException(INVALID_HEX, "Invalid public shares"); throw SGXException(INVALID_HEX, "Invalid public shares");
......
...@@ -1348,7 +1348,7 @@ void trustedBlsSignMessageAES(int *errStatus, char *err_string, uint8_t *encrypt ...@@ -1348,7 +1348,7 @@ void trustedBlsSignMessageAES(int *errStatus, char *err_string, uint8_t *encrypt
} }
void void
trustedGenDkgSecret_aes(int *errStatus, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t *enc_len, size_t _t) { trustedGenDkgSecretAES(int *errStatus, 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 @@ trustedGenDkgSecret_aes(int *errStatus, char *err_string, uint8_t *encrypted_dkg ...@@ -1392,7 +1392,7 @@ trustedGenDkgSecret_aes(int *errStatus, char *err_string, uint8_t *encrypted_dkg
} }
void void
trustedDecryptDkgSecret_aes(int *errStatus, char *err_string, uint8_t *encrypted_dkg_secret, uint8_t *decrypted_dkg_secret, trustedDecryptDkgSecretAES(int *errStatus, 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 @@ trustedDecryptDkgSecret_aes(int *errStatus, char *err_string, uint8_t *encrypted ...@@ -1405,7 +1405,7 @@ trustedDecryptDkgSecret_aes(int *errStatus, char *err_string, uint8_t *encrypted
//*dec_len = decr_len; //*dec_len = decr_len;
} }
void trustedSetEncryptedDkgPoly_aes(int *errStatus, char *err_string, uint8_t *encrypted_poly, uint64_t *enc_len) { void trustedSetEncryptedDkgPolyAES(int *errStatus, 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 trustedSetEncryptedDkgPoly_aes(int *errStatus, char *err_string, uint8_t *e ...@@ -1416,7 +1416,7 @@ void trustedSetEncryptedDkgPoly_aes(int *errStatus, char *err_string, uint8_t *e
} }
} }
void trustedGetEncryptedSecretShare_aes(int *errStatus, char *err_string, uint8_t *encrypted_skey, uint32_t *dec_len, void trustedGetEncryptedSecretShareAES(int *errStatus, 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 trustedGetEncryptedSecretShare_aes(int *errStatus, char *err_string, uint8_ ...@@ -1440,7 +1440,7 @@ void trustedGetEncryptedSecretShare_aes(int *errStatus, char *err_string, uint8_
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 trustedGetEncryptedSecretShare_aes) with status %d", status); snprintf(err_string, BUF_LEN, "AES_decrypt failed (in trustedGetEncryptedSecretShareAES) with status %d", status);
*errStatus = status; *errStatus = status;
return; return;
} }
...@@ -1495,7 +1495,7 @@ void trustedGetEncryptedSecretShare_aes(int *errStatus, char *err_string, uint8_ ...@@ -1495,7 +1495,7 @@ void trustedGetEncryptedSecretShare_aes(int *errStatus, char *err_string, uint8_
} }
void trustedGetPublicShares_aes(int *errStatus, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t enc_len, void trustedGetPublicSharesAES(int *errStatus, 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 trustedGetPublicShares_aes(int *errStatus, char *err_string, uint8_t *encry ...@@ -1523,7 +1523,7 @@ void trustedGetPublicShares_aes(int *errStatus, char *err_string, uint8_t *encry
//free(decrypted_dkg_secret); //free(decrypted_dkg_secret);
} }
void trustedDkgVerify_aes(int *errStatus, char *err_string, const char *public_shares, const char *s_share, void trustedDkgVerifyAES(int *errStatus, 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 trustedDkgVerify_aes(int *errStatus, char *err_string, const char *public_s ...@@ -1533,7 +1533,7 @@ void trustedDkgVerify_aes(int *errStatus, char *err_string, const char *public_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 trustedDkgVerify_aes) with status %d", status); snprintf(err_string, BUF_LEN, "AES_decrypt failed (in trustedDkgVerifyAES) with status %d", status);
*errStatus = status; *errStatus = status;
return; return;
} }
......
...@@ -227,27 +227,27 @@ enclave { ...@@ -227,27 +227,27 @@ enclave {
[out, count = SMALL_BUF_SIZE] char* key ); [out, count = SMALL_BUF_SIZE] char* key );
public void trustedGenDkgSecret_aes ( public void trustedGenDkgSecretAES (
[user_check] int *errStatus, [user_check] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string, [out, count = SMALL_BUF_SIZE] 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 trustedDecryptDkgSecret_aes ( public void trustedDecryptDkgSecretAES (
[user_check] int *errStatus, [user_check] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string, [out, count = SMALL_BUF_SIZE] 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 trustedSetEncryptedDkgPoly_aes( public void trustedSetEncryptedDkgPolyAES(
[user_check] int *errStatus, [user_check] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string, [out, count = SMALL_BUF_SIZE] 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 trustedGetEncryptedSecretShare_aes( public void trustedGetEncryptedSecretShareAES(
[user_check]int *errStatus, [user_check]int *errStatus,
[out, count = SMALL_BUF_SIZE] char *err_string, [out, count = SMALL_BUF_SIZE] char *err_string,
[out, count = SMALL_BUF_SIZE] uint8_t *encrypted_skey, [out, count = SMALL_BUF_SIZE] 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 trustedGetPublicShares_aes( public void trustedGetPublicSharesAES(
[user_check] int *errStatus, [user_check] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string, [out, count = SMALL_BUF_SIZE] 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 trustedDkgVerify_aes( public void trustedDkgVerifyAES(
[user_check] int *errStatus, [user_check] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string, [out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = 8193] const char* public_shares, [in, count = 8193] const char* public_shares,
......
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