Unverified Commit 4a103ecf authored by kladko's avatar kladko

SKALE-2454-add-logs-to-enclave

parent 2f267c40
......@@ -162,7 +162,7 @@ bool sign(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, size_t
if (!hex2carray(_hashHex, &binLen, hash->data())) {
throw SGXException(INVALID_HEX, "Invalid hash");
}
// assert(binLen == hash->size());
......@@ -203,7 +203,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
if (!hex2carray(_hashHex, &binLen, hash->data())) {
throw SGXException(INVALID_HEX, "Invalid hash");
}
// assert(binLen == hash->size());
......
......@@ -77,21 +77,21 @@ string ConvertToString(T field_elem, int base = 10) {
string gen_dkg_poly(int _t) {
vector<char> errMsg(1024, 0);
int err_status = 0;
int errStatus = 0;
vector<uint8_t> encrypted_dkg_secret(BUF_LEN, 0);
uint32_t enc_len = 0;
if (!encryptKeys)
status = trustedGenDkgSecret(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, _t);
status = trustedGenDkgSecret(eid, &errStatus, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, _t);
else
status = trustedGenDkgSecret_aes(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, _t);
if (err_status != 0) {
status = trustedGenDkgSecret_aes(eid, &errStatus, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, _t);
if (errStatus != 0) {
throw SGXException(-666, errMsg.data());
}
spdlog::debug("trustedGenDkgSecret, status {}", err_status, " err msg ", errMsg.data());
spdlog::debug("trustedGenDkgSecret, status {}", errStatus, " err msg ", errMsg.data());
spdlog::debug("in DKGCrypto encr len is {}", enc_len);
uint64_t length = DKG_MAX_SEALED_LEN;
......@@ -99,11 +99,8 @@ string gen_dkg_poly(int _t) {
length = enc_len;
}
//vector<char> hexEncrPoly(DKG_MAX_SEALED_LEN * 2 + 1, 0);//(4*BUF_LEN, 1);
vector<char> hexEncrPoly(2 * length + 1, 0);
assert(encrypted_dkg_secret.size() >= length);
//carray2Hex(encrypted_dkg_secret.data(), DKG_MAX_SEALED_LEN, hexEncrPoly.data());
CHECK_STATE(encrypted_dkg_secret.size() >= length);
carray2Hex(encrypted_dkg_secret.data(), length, hexEncrPoly.data());
string result(hexEncrPoly.data());
......@@ -138,10 +135,12 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
uint32_t len = 0;
if (!encryptKeys)
status = trustedGetPublicShares(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 {
status = trustedGetPublicShares_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) {
throw SGXException(-666, errMsg1.data());
......@@ -164,8 +163,9 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
return pubSharesVect;
}
string trustedGetSecretShares(const string &_polyName, const char *_encryptedPolyHex, const vector<string> &_publicKeys, int _t,
int _n) {
string trustedGetSecretShares(const string &_polyName, const char *_encryptedPolyHex, const vector<string> &_publicKeys,
int _t,
int _n) {
vector<char> errMsg1(BUF_LEN, 0);
vector<char> hexEncrKey(BUF_LEN, 0);
......@@ -173,14 +173,13 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
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)) {
throw SGXException(INVALID_HEX, "Invalid encryptedPolyHex");
}
if (!encryptKeys)
status = trustedSetEncryptedDkgPoly(eid, &errStatus, errMsg1.data(), encrDKGPoly.data());
else
......@@ -194,13 +193,13 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
for (int i = 0; i < _n; i++) {
vector<uint8_t > encryptedSkey(BUF_LEN, 0);
vector<uint8_t> encryptedSkey(BUF_LEN, 0);
uint32_t decLen;
vector<char> currentShare(193, 0);
vector<char> sShareG2(320, 0);
string pub_keyB = _publicKeys.at(i);
vector<char> pubKeyB(129,0);
vector<char> pubKeyB(129, 0);
strncpy(pubKeyB.data(), pub_keyB.c_str(), 128);
pubKeyB.at(128) = 0;
......@@ -210,10 +209,10 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
if (!encryptKeys)
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
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) {
throw SGXException(-666, errMsg1.data());
}
......@@ -245,9 +244,8 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
bool
verifyShares(const char *publicShares, const char *encr_sshare, const char *encryptedKeyHex, int t, int n, int ind) {
//char* errMsg1 = (char*) calloc(1024,1);
char errMsg1[BUF_LEN];
int err_status = 0;
char errMsg[BUF_LEN];
int errStatus = 0;
uint64_t decKeyLen;
uint8_t encr_key[BUF_LEN];
......@@ -265,19 +263,17 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr
if (!encryptKeys)
trustedDkgVerify(eid, &err_status, errMsg1, pshares, encr_sshare, encr_key, decKeyLen, t, ind, &result);
trustedDkgVerify(eid, &errStatus, errMsg, pshares, encr_sshare, encr_key, decKeyLen, t, ind, &result);
else
trustedDkgVerify_aes(eid, &err_status, errMsg1, pshares, encr_sshare, encr_key, decKeyLen, t, ind, &result);
trustedDkgVerify_aes(eid, &errStatus, errMsg, pshares, encr_sshare, encr_key, decKeyLen, t, ind, &result);
if (result == 2) {
throw SGXException(INVALID_HEX, "Invalid public shares");
}
spdlog::debug("errMsg1: {}", errMsg1);
spdlog::debug("errMsg1: {}", errMsg);
spdlog::debug("result is: {}", result);
//free(errMsg1);
return result;
}
......@@ -286,8 +282,8 @@ bool CreateBLSShare(const string &blsKeyName, const char *s_shares, const char *
spdlog::debug("ENTER CreateBLSShare");
// char* errMsg1 = (char*) calloc(1024,1);
char errMsg1[BUF_LEN];
int err_status = 0;
char errMsg[BUF_LEN];
int errStatus = 0;
uint64_t decKeyLen;
uint8_t encr_bls_key[BUF_LEN];
......@@ -302,14 +298,14 @@ bool CreateBLSShare(const string &blsKeyName, const char *s_shares, const char *
if (!encryptKeys)
trustedCreateBlsKey(eid, &err_status, errMsg1, s_shares, encr_key, decKeyLen, encr_bls_key, &enc_bls_len);
trustedCreateBlsKey(eid, &errStatus, errMsg, s_shares, encr_key, decKeyLen, encr_bls_key, &enc_bls_len);
else
trustedCreateBlsKey_aes(eid, &err_status, errMsg1, s_shares, encr_key, decKeyLen, encr_bls_key, &enc_bls_len);
trustedCreateBlsKey_aes(eid, &errStatus, errMsg, s_shares, encr_key, decKeyLen, encr_bls_key, &enc_bls_len);
if (err_status != 0) {
if (errStatus != 0) {
spdlog::error(errMsg1);
spdlog::error("status {}", err_status);
spdlog::error(errMsg);
spdlog::error("status {}", errStatus);
throw SGXException(ERROR_IN_ENCLAVE, "Create BLS private key failed in enclave");
} else {
......@@ -361,7 +357,7 @@ vector<string> GetBLSPubKey(const char *encryptedKeyHex) {
string decryptDHKey(const string &polyName, int ind) {
vector<char> errMsg1(1024, 0);
int err_status = 0;
int errStatus = 0;
string DH_key_name = polyName + "_" + to_string(ind) + ":";
shared_ptr<string> hexEncrKeyPtr = SGXWalletServer::readFromDb(DH_key_name, "DKG_DH_KEY_");
......@@ -382,11 +378,11 @@ string decryptDHKey(const string &polyName, int ind) {
char DHKey[ECDSA_SKEY_LEN];
if (!encryptKeys)
decrypt_key(eid, &err_status, errMsg1.data(), encryptedDHKey, dhEncLen, DHKey);
decrypt_key(eid, &errStatus, errMsg1.data(), encryptedDHKey, dhEncLen, DHKey);
else
decrypt_key_aes(eid, &err_status, errMsg1.data(), encryptedDHKey, dhEncLen, DHKey);
if (err_status != 0) {
throw SGXException(/*ERROR_IN_ENCLAVE*/ err_status, "decrypt key failed in enclave");
decrypt_key_aes(eid, &errStatus, errMsg1.data(), encryptedDHKey, dhEncLen, DHKey);
if (errStatus != 0) {
throw SGXException(/*ERROR_IN_ENCLAVE*/ errStatus, "decrypt key failed in enclave");
}
return DHKey;
......
......@@ -45,18 +45,18 @@ string concatPubKeyWith0x(char *pub_key_x, char *pub_key_y) {
std::vector<std::string> genECDSAKey() {
char *errMsg = (char *) calloc(1024, 1);
int err_status = 0;
int errStatus = 0;
uint8_t *encr_pr_key = (uint8_t *) calloc(1024, 1);
char *pub_key_x = (char *) calloc(1024, 1);
char *pub_key_y = (char *) calloc(1024, 1);
uint32_t enc_len = 0;
if (!encryptKeys)
status = trustedGenerateEcdsaKey(eid, &err_status, errMsg, encr_pr_key, &enc_len, pub_key_x, pub_key_y);
status = trustedGenerateEcdsaKey(eid, &errStatus, errMsg, encr_pr_key, &enc_len, pub_key_x, pub_key_y);
else
status = trustedGenerateEcdsaKey_aes(eid, &err_status, errMsg, encr_pr_key, &enc_len, pub_key_x, pub_key_y);
status = trustedGenerateEcdsaKey_aes(eid, &errStatus, errMsg, encr_pr_key, &enc_len, pub_key_x, pub_key_y);
if (status != SGX_SUCCESS || err_status != 0) {
if (status != SGX_SUCCESS || errStatus != 0) {
spdlog::error("RPCException thrown with status {}", status);
throw SGXException(status, errMsg);
}
......@@ -106,7 +106,7 @@ std::string getECDSAPubKey(const char *_encryptedKeyHex) {
vector<char> pubKeyY(BUF_LEN, 0);
vector<uint8_t> encrPrKey(BUF_LEN, 0);
int err_status = 0;
int errStatus = 0;
uint64_t enc_len = 0;
if (!hex2carray(_encryptedKeyHex, &enc_len, encrPrKey.data())) {
......@@ -114,11 +114,11 @@ std::string getECDSAPubKey(const char *_encryptedKeyHex) {
}
if (!encryptKeys)
status = trustedGetPublicEcdsaKey(eid, &err_status, errMsg.data(), encrPrKey.data(), enc_len, pubKeyX.data(),
status = trustedGetPublicEcdsaKey(eid, &errStatus, errMsg.data(), encrPrKey.data(), enc_len, pubKeyX.data(),
pubKeyY.data());
else status = trustedGetPublicEcdsaKey_aes(eid, &err_status,
else status = trustedGetPublicEcdsaKey_aes(eid, &errStatus,
errMsg.data(), encrPrKey.data(), enc_len, pubKeyX.data(), pubKeyY.data());
if (err_status != 0) {
if (errStatus != 0) {
throw SGXException(-666, errMsg.data());
}
string pubKey = string(pubKeyX.data()) + string(pubKeyY.data());//concatPubKeyWith0x(pub_key_x, pub_key_y);//
......@@ -127,7 +127,7 @@ std::string getECDSAPubKey(const char *_encryptedKeyHex) {
spdlog::debug("pubkey is {}", pubKey);
spdlog::debug("pubkey length is {}", pubKey.length());
spdlog::debug("err str is {}", errMsg.data());
spdlog::debug("err status is {}", err_status);
spdlog::debug("err status is {}", errStatus);
return pubKey;
......@@ -137,7 +137,7 @@ vector<string> ecdsaSignHash(const char *encryptedKeyHex, const char *hashHex, i
vector<string> signature_vect(3);
char *errMsg = (char *) calloc(1024, 1);
int err_status = 0;
int errStatus = 0;
char *signature_r = (char *) calloc(1024, 1);
char *signature_s = (char *) calloc(1024, 1);
uint8_t signature_v = 0;
......@@ -156,12 +156,12 @@ vector<string> ecdsaSignHash(const char *encryptedKeyHex, const char *hashHex, i
if (!encryptKeys)
status = trustedEcdsaSign(eid, &err_status, errMsg, encr_key, ECDSA_ENCR_LEN, (unsigned char *) hashHex, signature_r,
status = trustedEcdsaSign(eid, &errStatus, errMsg, encr_key, ECDSA_ENCR_LEN, (unsigned char *) hashHex, signature_r,
signature_s, &signature_v, base);
else
status = trustedEcdsaSignAES(eid, &err_status, errMsg, encr_key, dec_len, (unsigned char *) hashHex, signature_r,
status = trustedEcdsaSignAES(eid, &errStatus, errMsg, encr_key, dec_len, (unsigned char *) hashHex, signature_r,
signature_s, &signature_v, base);
if (err_status != 0) {
if (errStatus != 0) {
throw SGXException(-666, errMsg);
}
......
......@@ -102,7 +102,7 @@ void init() {
libff::init_alt_bn128_params();
}
void checkKey(int *err_status, char *err_string, const char *_keyString) {
void checkKey(int *errStatus, char *err_string, const char *_keyString) {
uint64_t keyLen = strnlen(_keyString, MAX_KEY_LENGTH);
......@@ -114,7 +114,7 @@ void checkKey(int *err_status, char *err_string, const char *_keyString) {
}
*err_status = -2;
*errStatus = -2;
if (_keyString == nullptr) {
......@@ -122,7 +122,7 @@ void checkKey(int *err_status, char *err_string, const char *_keyString) {
return;
}
*err_status = -3;
*errStatus = -3;
//check that key is padded with 0s
......@@ -145,7 +145,7 @@ void checkKey(int *err_status, char *err_string, const char *_keyString) {
// throw std::exception();
// }
*err_status = 0;
*errStatus = 0;
// return;
}
......
......@@ -34,9 +34,9 @@
//#include <stdint.h>
EXTERNC void checkKey(int *err_status, char *err_string, const char* _keyString);
EXTERNC void checkKey(int *errStatus, char *err_string, const char* _keyString);
EXTERNC void check_key(int *err_status, char *err_string, const char* _keyString);
EXTERNC void check_key(int *errStatus, char *err_string, const char* _keyString);
......
This diff is collapsed.
This diff is collapsed.
......@@ -182,24 +182,24 @@ TEST_CASE("DKG gen test", "[dkg-gen]") {
vector<uint8_t> encryptedDKGSecret(BUF_LEN, 0);
vector<char> errMsg(BUF_LEN, 0);
int err_status = 0;
int errStatus = 0;
uint32_t enc_len = 0;
status = trustedGenDkgSecret(eid, &err_status, errMsg.data(), encryptedDKGSecret.data(), &enc_len, 32);
status = trustedGenDkgSecret(eid, &errStatus, errMsg.data(), encryptedDKGSecret.data(), &enc_len, 32);
REQUIRE(status == SGX_SUCCESS);
// printf("trustedGenDkgSecret completed with status: %d %s \n", err_status, errMsg.data());
// printf("trustedGenDkgSecret completed with status: %d %s \n", errStatus, errMsg.data());
// printf("\n Length: %d \n", enc_len);
vector<char> secret(BUF_LEN, 0);
vector<char> errMsg1(BUF_LEN, 0);
uint32_t dec_len;
status = trustedDecryptDkgSecret(eid, &err_status, errMsg1.data(), encryptedDKGSecret.data(),
status = trustedDecryptDkgSecret(eid, &errStatus, errMsg1.data(), encryptedDKGSecret.data(),
(uint8_t *) secret.data(), &dec_len);
REQUIRE(status == SGX_SUCCESS);
// printf("\ntrustedDecryptDkgSecret completed with status: %d %s \n", err_status, errMsg1.data());
// printf("\ntrustedDecryptDkgSecret completed with status: %d %s \n", errStatus, errMsg1.data());
// printf("decrypted secret %s \n\n", secret.data());
// printf("secret length %d \n", (int) strlen(secret.data()));
// printf("decr length %d \n", dec_len);
......@@ -272,14 +272,14 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
vector<uint8_t> encrypted_dkg_secret(BUF_LEN, 0);
vector<char> errMsg(BUF_LEN, 0);
int err_status = 0;
int errStatus = 0;
uint32_t enc_len = 0;
unsigned t = 32, n = 32;
status = trustedGenDkgSecret(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, n);
status = trustedGenDkgSecret(eid, &errStatus, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, n);
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", errStatus, errMsg);
vector<char> errMsg1(BUF_LEN, 0);
......@@ -287,10 +287,10 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
char colon = ':';
vector<char> public_shares(10000, 0);
status = trustedGetPublicShares(eid, &err_status, errMsg1.data(),
status = trustedGetPublicShares(eid, &errStatus, errMsg1.data(),
encrypted_dkg_secret.data(), enc_len, public_shares.data(), t, n);
REQUIRE(status == SGX_SUCCESS);
// printf("\ntrustedGetPublicShares status: %d error %s \n\n", err_status, errMsg1.data());
// printf("\ntrustedGetPublicShares status: %d error %s \n\n", errStatus, errMsg1.data());
// printf(" LEN: %d \n", (int) strlen(public_shares.data()));
// printf(" result: %s \n", public_shares.data());
......@@ -306,10 +306,10 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
vector<char> secret(BUF_LEN, 0);
status = trustedDecryptDkgSecret(eid, &err_status, errMsg1.data(), encrypted_dkg_secret.data(),
status = trustedDecryptDkgSecret(eid, &errStatus, errMsg1.data(), encrypted_dkg_secret.data(),
(uint8_t *) secret.data(), &enc_len);
REQUIRE(status == SGX_SUCCESS);
//printf("\ntrustedDecryptDkgSecret completed with status: %d %s \n", err_status, errMsg1.data());
//printf("\ntrustedDecryptDkgSecret completed with status: %d %s \n", errStatus, errMsg1.data());
signatures::Dkg dkg_obj(t, n);
......@@ -345,15 +345,15 @@ TEST_CASE("DKG encrypted secret shares test", "[dkg-encr-sshares]") {
vector<char> errMsg(BUF_LEN, 0);
vector<char> result(BUF_LEN, 0);
int err_status = 0;
int errStatus = 0;
uint32_t enc_len = 0;
vector<uint8_t> encrypted_dkg_secret(BUF_LEN, 0);
status = trustedGenDkgSecret(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, 2);
status = trustedGenDkgSecret(eid, &errStatus, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, 2);
REQUIRE(status == SGX_SUCCESS);
// cerr << " poly generated" << endl;
status = trustedSetEncryptedDkgPoly(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data());
status = trustedSetEncryptedDkgPoly(eid, &errStatus, errMsg.data(), encrypted_dkg_secret.data());
REQUIRE(status == SGX_SUCCESS);
// cerr << " poly set" << endl;
......@@ -362,7 +362,7 @@ TEST_CASE("DKG encrypted secret shares test", "[dkg-encr-sshares]") {
string pub_keyB = "c0152c48bf640449236036075d65898fded1e242c00acb45519ad5f788ea7cbf9a5df1559e7fc87932eee5478b1b9023de19df654395574a690843988c3ff475";
vector<char> s_shareG2(BUF_LEN, 0);
status = trustedGetEncryptedSecretShare(eid, &err_status, errMsg.data(), encrPRDHKey.data(), &enc_len, result.data(),
status = trustedGetEncryptedSecretShare(eid, &errStatus, errMsg.data(), encrPRDHKey.data(), &enc_len, result.data(),
s_shareG2.data(),
(char *) pub_keyB.data(), 2, 2, 1);
......@@ -382,16 +382,16 @@ TEST_CASE("DKG verification test", "[dkg-verify]") {
vector<char> errMsg(BUF_LEN, 0);
vector<char> result(BUF_LEN, 0);
int err_status = 0;
int errStatus = 0;
uint32_t enc_len = 0;
vector<uint8_t> encrypted_dkg_secret(BUF_LEN, 0);
status = trustedGenDkgSecret(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, 2);
status = trustedGenDkgSecret(eid, &errStatus, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, 2);
REQUIRE(status == SGX_SUCCESS);
// cerr << " poly generated" << endl;
status = trustedSetEncryptedDkgPoly(eid, &err_status, errMsg.data(), encrypted_dkg_secret.data());
status = trustedSetEncryptedDkgPoly(eid, &errStatus, errMsg.data(), encrypted_dkg_secret.data());
REQUIRE(status == SGX_SUCCESS);
// cerr << " poly set" << endl;
......@@ -401,11 +401,11 @@ TEST_CASE("DKG verification test", "[dkg-verify]") {
vector<char> s_shareG2(BUF_LEN, 0);
status = trustedGetEncryptedSecretShare(eid, &err_status, errMsg.data(), encrPrDHKey.data(), &enc_len, result.data(),
status = trustedGetEncryptedSecretShare(eid, &errStatus, errMsg.data(), encrPrDHKey.data(), &enc_len, result.data(),
s_shareG2.data(),
(char *) pub_keyB.data(), 2, 2, 1);
REQUIRE(status == SGX_SUCCESS);
// printf(" trustedGetEncryptedSecretShare completed with status: %d %s \n", err_status, errMsg.data());
// printf(" trustedGetEncryptedSecretShare completed with status: %d %s \n", errStatus, errMsg.data());
// cerr << "secret share is " << result.data() << endl;
......@@ -421,7 +421,7 @@ TEST_CASE("ECDSA keygen and signature test", "[ecdsa]") {
vector<char> errMsg(BUF_LEN, 0);
int err_status = 0;
int errStatus = 0;
vector<uint8_t> encr_pr_key(BUF_LEN, 0);
vector<char> pub_key_x(BUF_LEN, 0);
vector<char> pub_key_y(BUF_LEN, 0);
......@@ -430,7 +430,7 @@ TEST_CASE("ECDSA keygen and signature test", "[ecdsa]") {
//printf("before %p\n", pub_key_x);
status = trustedGenerateEcdsaKey(eid, &err_status, errMsg.data(), encr_pr_key.data(), &enc_len, pub_key_x.data(),
status = trustedGenerateEcdsaKey(eid, &errStatus, errMsg.data(), encr_pr_key.data(), &enc_len, pub_key_x.data(),
pub_key_y.data());
// printf("\nerrMsg %s\n", errMsg.data());
REQUIRE(status == SGX_SUCCESS);
......@@ -444,7 +444,7 @@ TEST_CASE("ECDSA keygen and signature test", "[ecdsa]") {
vector<char> signature_s(BUF_LEN, 0);
uint8_t signature_v = 0;
status = trustedEcdsaSign(eid, &err_status, errMsg.data(), encr_pr_key.data(), enc_len, (unsigned char *) hex.data(),
status = trustedEcdsaSign(eid, &errStatus, errMsg.data(), encr_pr_key.data(), enc_len, (unsigned char *) hex.data(),
signature_r.data(),
signature_s.data(), &signature_v, 16);
REQUIRE(status == SGX_SUCCESS);
......@@ -464,13 +464,13 @@ TEST_CASE("Test test", "[test]") {
initAll(false, true);
vector<char> errMsg(BUF_LEN, 0);
int err_status = 0;
int errStatus = 0;
vector<uint8_t> encr_pr_key(BUF_LEN, 0);
vector<char> pub_key_x(BUF_LEN, 0);
vector<char> pub_key_y(BUF_LEN, 0);
uint32_t enc_len = 0;
status = trustedGenerateEcdsaKey(eid, &err_status, errMsg.data(), encr_pr_key.data(), &enc_len, pub_key_x.data(),
status = trustedGenerateEcdsaKey(eid, &errStatus, errMsg.data(), encr_pr_key.data(), &enc_len, pub_key_x.data(),
pub_key_y.data());
REQUIRE(status == SGX_SUCCESS);
......
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