Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sgxwallet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董子豪
sgxwallet
Commits
d65cea62
Unverified
Commit
d65cea62
authored
Aug 21, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3151-cannot decrypt storage key
parent
1f6064e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
16 deletions
+8
-16
secure_enclave.c
secure_enclave/secure_enclave.c
+8
-16
No files found.
secure_enclave/secure_enclave.c
View file @
d65cea62
...
@@ -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__
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment