Unverified Commit d65cea62 authored by kladko's avatar kladko

SKALE-3151-cannot decrypt storage key

parent 1f6064e7
...@@ -266,7 +266,7 @@ void trustedSetSEK(int *errStatus, char *errString, uint8_t *encrypted_sek) { ...@@ -266,7 +266,7 @@ void trustedSetSEK(int *errStatus, char *errString, uint8_t *encrypted_sek) {
CHECK_STATE(encrypted_sek); CHECK_STATE(encrypted_sek);
SAFE_CHAR_BUF(aes_key_hex, BUF_LEN); SAFE_CHAR_BUF(aes_key_hex, BUF_LEN);
uint32_t dec_len; uint32_t dec_len = BUF_LEN;
sgx_status_t status = sgx_unseal_data( sgx_status_t status = sgx_unseal_data(
(const sgx_sealed_data_t *) encrypted_sek, NULL, 0, (const sgx_sealed_data_t *) encrypted_sek, NULL, 0,
...@@ -295,22 +295,12 @@ void trustedSetSEK_backup(int *errStatus, char *errString, ...@@ -295,22 +295,12 @@ void trustedSetSEK_backup(int *errStatus, char *errString,
uint64_t len; uint64_t len;
hex2carray(sek_hex, &len, (uint8_t *) AES_key); hex2carray(sek_hex, &len, (uint8_t *) AES_key);
uint32_t sealedLen = sgx_calc_sealed_data_size(0, strlen(sek_hex) + 1); sealHexSEK(errStatus, errString, encrypted_sek, enc_len, (char *)sek_hex);
if (errStatus != 0) {
sgx_attributes_t attribute_mask; LOG_ERROR("sealHexSEK failed");
attribute_mask.flags = 0xfffffffffffffff3; goto clean;
attribute_mask.xfrm = 0x0; }
sgx_misc_select_t misc = 0xF0000000;
sgx_status_t status = sgx_seal_data_ex(SGX_KEYPOLICY_MRENCLAVE,
attribute_mask, misc, 0, NULL, strlen(sek_hex) + 1, (uint8_t *) sek_hex, sealedLen,
(sgx_sealed_data_t *) encrypted_sek);
CHECK_STATUS2("seal SEK failed with status %d")
*enc_len = sealedLen;
SET_SUCCESS SET_SUCCESS
clean: clean:
...@@ -318,6 +308,8 @@ void trustedSetSEK_backup(int *errStatus, char *errString, ...@@ -318,6 +308,8 @@ void trustedSetSEK_backup(int *errStatus, char *errString,
LOG_INFO("SGX call completed"); LOG_INFO("SGX call completed");
} }
void trustedGenerateEcdsaKeyAES(int *errStatus, char *errString, void trustedGenerateEcdsaKeyAES(int *errStatus, char *errString,
uint8_t *encryptedPrivateKey, uint32_t *enc_len, char *pub_key_x, char *pub_key_y) { uint8_t *encryptedPrivateKey, uint32_t *enc_len, char *pub_key_x, char *pub_key_y) {
LOG_INFO(__FUNCTION__); LOG_INFO(__FUNCTION__);
......
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