intel / intel/confidential-computing.sgx.sdk

sgx_rijndael128GCM_encrypt does not encrypt

Open
#114 7 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C++
Stars
2
Forks
3
PR merge metrics
No merged PRs in 30d

Description

I am trying to use sgx_rijndael128GCM_encrypt to encrypt some data but the buffer remains empty. I dont know why or what i am doing wrong. This is the code I am using, if there is any errors please mention them. As far as I think, there will be some changes in line 2, where i am calculating aesgcm_len or maybe i am using the wrong key. But if the key is wrong then it should show some errors. Please guide me. Thank you in advance
`
uint8_t *plaintext = (uint8_t *)item->certificate;

size_t aesgcm_len =4 + ((((double)sizee)/16))*16 +16;

item->encrypteee = (uint8_t*)malloc(aesgcm_len);

sgx_aes_gcm_128bit_tag_t mac;

const sgx_aes_gcm_128bit_key_t aes_key= { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf };

//sgx_read_rand((unsigned char *) &aes_key, sizeof(sgx_aes_gcm_128bit_key_t));

uint8_t iv[12];

memset(iv,0,12);

((int*)item->encrypteee)[0]=sizee;

sgx_status_t res;

res= sgx_rijndael128GCM_encrypt(&aes_key, plaintext, sizee, (uint8_t*)item->encrypteee+4,iv,12 ,NULL,0,&mac);

if (res != SGX_SUCCESS) {

//printf("encryption error");

free(wallet);

return ERR_FAIL_UNSEAL;

}

`

Contributor guide

Open the contributing guide

Research direction

Start with the sgx_rijndael128GCM_encrypt call and the surrounding aesgcm_len, output-buffer allocation, key, IV, and return-status handling shown in the issue. Reproduce the empty-buffer behavior and determine whether the reported result is caused by the buffer-length calculation, key usage, or another API error; done means documenting a verified cause and correction.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp
Domain
cryptography, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.