Fixes

parent bfa691b4
...@@ -118,7 +118,7 @@ void e_mpf_div(mpf_t *c_un, mpf_t *a_un, mpf_t *b_un) {} ...@@ -118,7 +118,7 @@ void e_mpf_div(mpf_t *c_un, mpf_t *a_un, mpf_t *b_un) {}
void encrypt_key(int *err_status, unsigned char *key, void encrypt_key(int *err_status, unsigned char *err_string, unsigned char *key,
unsigned char *encrypted_key, uint32_t *enc_len) { unsigned char *encrypted_key, uint32_t *enc_len) {
*err_status = -1; *err_status = -1;
......
...@@ -23,6 +23,7 @@ enclave { ...@@ -23,6 +23,7 @@ enclave {
public void encrypt_key ( public void encrypt_key (
[user_check] int *err_status, [user_check] int *err_status,
[out, count = 1024] unsigned char* err_string,
[in, count = 128] unsigned char* key, [in, count = 128] unsigned char* key,
[out, count = 1024] unsigned char* encrypted_key, [user_check] uint32_t *enc_len); [out, count = 1024] unsigned char* encrypted_key, [user_check] uint32_t *enc_len);
......
...@@ -170,9 +170,11 @@ int main(int argc, char *argv[]) { ...@@ -170,9 +170,11 @@ int main(int argc, char *argv[]) {
const char *key = "4160780231445160889237664391382223604184857153814275770598" const char *key = "4160780231445160889237664391382223604184857153814275770598"
"791864649971919844"; "791864649971919844";
char keyArray[128]; unsigned char* keyArray = calloc(128, 1);
unsigned char encryptedKey[1024]; unsigned char* encryptedKey = calloc(1024, 1);
unsigned char* errMsg = calloc(1024,1);
strncpy(keyArray, key, 128); strncpy(keyArray, key, 128);
...@@ -180,14 +182,15 @@ int main(int argc, char *argv[]) { ...@@ -180,14 +182,15 @@ int main(int argc, char *argv[]) {
int enc_len = 0; int enc_len = 0;
status = encrypt_key(eid, &err_status, keyArray, encryptedKey, &enc_len); status = encrypt_key(eid, &err_status, errMsg, keyArray, encryptedKey, &enc_len);
if (status != SGX_SUCCESS) { if (status != SGX_SUCCESS) {
gmp_printf(stderr, "ECALL encrypt_key: 0x%04x\n", status); gmp_printf("ECALL encrypt_key: 0x%04x\n", status);
return 1; return 1;
} }
gmp_printf("Encrypt key completed with status: %d \n", err_status);
gmp_printf("Encrypt key completed with status: %d %s \n", err_status, errMsg);
unsigned char *result = carray2Hex(encryptedKey, enc_len); unsigned char *result = carray2Hex(encryptedKey, enc_len);
......
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