Unverified Commit 09386fd2 authored by kladko's avatar kladko

SKALE-2454-add-logs-to-enclave

parent a3130c56
...@@ -98,7 +98,7 @@ bool check_SEK(std::string SEK){ ...@@ -98,7 +98,7 @@ bool check_SEK(std::string SEK){
uint32_t l = len; uint32_t l = len;
std::cerr << " l is " << l << std::endl; std::cerr << " l is " << l << std::endl;
status = set_SEK_backup(eid, &err_status, errMsg.data(), encr_SEK.data(), &l, SEK.c_str() ); status = trustedSetSEK_backup(eid, &err_status, errMsg.data(), encr_SEK.data(), &l, SEK.c_str() );
if (status != SGX_SUCCESS){ if (status != SGX_SUCCESS){
cerr << "RPCException thrown with status " << status << endl; cerr << "RPCException thrown with status " << status << endl;
throw SGXException(status, errMsg.data()); throw SGXException(status, errMsg.data());
...@@ -133,7 +133,7 @@ void gen_SEK(){ ...@@ -133,7 +133,7 @@ void gen_SEK(){
char SEK[65]; char SEK[65];
memset(SEK, 0, 65); memset(SEK, 0, 65);
status = generate_SEK(eid, &err_status, errMsg.data(), encr_SEK.data(), &enc_len, SEK); status = trustedGenerateSEK(eid, &err_status, errMsg.data(), encr_SEK.data(), &enc_len, SEK);
if (status != SGX_SUCCESS || err_status != 0 ){ if (status != SGX_SUCCESS || err_status != 0 ){
throw SGXException(status, errMsg.data()) ; throw SGXException(status, errMsg.data()) ;
} }
...@@ -164,7 +164,7 @@ void gen_SEK(){ ...@@ -164,7 +164,7 @@ void gen_SEK(){
create_test_key(); create_test_key();
} }
void set_SEK(std::shared_ptr<std::string> hex_encr_SEK){ void trustedSetSEK(std::shared_ptr<std::string> hex_encr_SEK){
vector<char> errMsg(1024,0); vector<char> errMsg(1024,0);
int err_status = 0; int err_status = 0;
//vector<uint8_t> encr_SEK(1024, 0); //vector<uint8_t> encr_SEK(1024, 0);
...@@ -178,7 +178,7 @@ void set_SEK(std::shared_ptr<std::string> hex_encr_SEK){ ...@@ -178,7 +178,7 @@ void set_SEK(std::shared_ptr<std::string> hex_encr_SEK){
throw SGXException(INVALID_HEX, "Invalid encrypted SEK Hex"); throw SGXException(INVALID_HEX, "Invalid encrypted SEK Hex");
} }
status = set_SEK(eid, &err_status, errMsg.data(), encr_SEK, len ); status = trustedSetSEK(eid, &err_status, errMsg.data(), encr_SEK, len );
if ( status != SGX_SUCCESS || err_status != 0 ){ if ( status != SGX_SUCCESS || err_status != 0 ){
cerr << "RPCException thrown" << endl; cerr << "RPCException thrown" << endl;
throw SGXException(status, errMsg.data()) ; throw SGXException(status, errMsg.data()) ;
...@@ -210,7 +210,7 @@ void enter_SEK(){ ...@@ -210,7 +210,7 @@ void enter_SEK(){
// std::cerr << "your key is " << SEK << std::endl; // std::cerr << "your key is " << SEK << std::endl;
status = set_SEK_backup(eid, &err_status, errMsg.data(), encr_SEK.data(), &enc_len, SEK.c_str() ); status = trustedSetSEK_backup(eid, &err_status, errMsg.data(), encr_SEK.data(), &enc_len, SEK.c_str() );
if (status != SGX_SUCCESS){ if (status != SGX_SUCCESS){
cerr << "RPCException thrown with status " << status << endl; cerr << "RPCException thrown with status " << status << endl;
throw SGXException(status, errMsg.data()); throw SGXException(status, errMsg.data());
...@@ -231,7 +231,7 @@ void initSEK(){ ...@@ -231,7 +231,7 @@ void initSEK(){
gen_SEK(); gen_SEK();
} }
else{ else{
set_SEK(encr_SEK_ptr); trustedSetSEK(encr_SEK_ptr);
} }
} }
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
void gen_SEK(); void gen_SEK();
#ifdef __cplusplus #ifdef __cplusplus
void set_SEK(std::shared_ptr<std::string> hex_encr_SEK); void trustedSetSEK(std::shared_ptr<std::string> hex_encr_SEK);
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -703,7 +703,7 @@ void trustedGetEncryptedSecretShare(int *err_status, char *err_string, uint8_t * ...@@ -703,7 +703,7 @@ void trustedGetEncryptedSecretShare(int *err_status, char *err_string, uint8_t *
//free(cypher); //free(cypher);
} }
void complaint_response(int *err_status, char *err_string, uint8_t *encrypted_DHkey, uint8_t *encrypted_dkg_secret, void trustedComplaintResponse(int *err_status, char *err_string, uint8_t *encrypted_DHkey, uint8_t *encrypted_dkg_secret,
uint32_t *dec_len, uint32_t *dec_len,
char *DH_key, char *s_shareG2, uint8_t _t, uint8_t _n, uint8_t ind1) { char *DH_key, char *s_shareG2, uint8_t _t, uint8_t _n, uint8_t ind1) {
...@@ -926,7 +926,7 @@ void trustedGetBlsPubKey(int *err_status, char *err_string, uint8_t *encrypted_k ...@@ -926,7 +926,7 @@ void trustedGetBlsPubKey(int *err_status, char *err_string, uint8_t *encrypted_k
} }
} }
void generate_SEK(int *err_status, char *err_string, void trustedGenerateSEK(int *err_status, char *err_string,
uint8_t *encrypted_SEK, uint32_t *enc_len, char *SEK_hex) { uint8_t *encrypted_SEK, uint32_t *enc_len, char *SEK_hex) {
uint8_t SEK_raw[SGX_AESGCM_KEY_SIZE]; uint8_t SEK_raw[SGX_AESGCM_KEY_SIZE];
//unsigned char* rand_char = (unsigned char*)malloc(16); //unsigned char* rand_char = (unsigned char*)malloc(16);
...@@ -956,7 +956,7 @@ void generate_SEK(int *err_status, char *err_string, ...@@ -956,7 +956,7 @@ void generate_SEK(int *err_status, char *err_string,
//free(rand_char); //free(rand_char);
} }
void set_SEK(int *err_status, char *err_string, uint8_t *encrypted_SEK, uint64_t encr_len) { void trustedSetSEK(int *err_status, char *err_string, uint8_t *encrypted_SEK, uint64_t encr_len) {
//memset(AES_key, 0, SGX_AESGCM_KEY_SIZE); //memset(AES_key, 0, SGX_AESGCM_KEY_SIZE);
...@@ -976,7 +976,7 @@ void set_SEK(int *err_status, char *err_string, uint8_t *encrypted_SEK, uint64_t ...@@ -976,7 +976,7 @@ void set_SEK(int *err_status, char *err_string, uint8_t *encrypted_SEK, uint64_t
} }
void set_SEK_backup(int *err_status, char *err_string, void trustedSetSEK_backup(int *err_status, char *err_string,
uint8_t *encrypted_SEK, uint32_t *enc_len, const char *SEK_hex) { uint8_t *encrypted_SEK, uint32_t *enc_len, const char *SEK_hex) {
uint64_t len; uint64_t len;
......
...@@ -153,7 +153,7 @@ enclave { ...@@ -153,7 +153,7 @@ enclave {
uint64_t key_len, uint64_t key_len,
[out, count = 320] char* bls_pub_key); [out, count = 320] char* bls_pub_key);
public void complaint_response( public void trustedComplaintResponse(
[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_DHkey, [in, count = 1024] uint8_t *encrypted_DHkey,
...@@ -165,20 +165,20 @@ enclave { ...@@ -165,20 +165,20 @@ enclave {
uint8_t _n, uint8_t _n,
uint8_t ind1); uint8_t ind1);
public void generate_SEK( public void trustedGenerateSEK(
[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_SEK, [out, count = 1024] uint8_t *encrypted_SEK,
[user_check] uint32_t *enc_len, [user_check] uint32_t *enc_len,
[out, count = 65] char* hex_SEK); [out, count = 65] char* hex_SEK);
public void set_SEK( public void trustedSetSEK(
[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_SEK, [in, count = 1024] uint8_t *encrypted_SEK,
uint64_t encr_len); uint64_t encr_len);
public void set_SEK_backup( public void trustedSetSEK_backup(
[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_SEK, [out, count = 1024] uint8_t *encrypted_SEK,
......
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