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
890023df
Unverified
Commit
890023df
authored
Aug 26, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3170-backup-key
parent
0679dc88
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
15 deletions
+14
-15
secure_enclave.c
secure_enclave/secure_enclave.c
+14
-15
No files found.
secure_enclave/secure_enclave.c
View file @
890023df
...
...
@@ -113,21 +113,16 @@ void free_function(void *, size_t);
unsigned
char
*
globalRandom
;
#define CALL_ONCE
void
trustedEnclaveInit
(
uint32_t
_logLevel
)
{
bool
called
=
false
;
if
(
called
)
{
LOG_ERROR
(
__FUNCTION__
);
LOG_ERROR
(
"called twice. Aborting!"
);
abort
();
#define CALL_ONCE \
static bool called = false;\
if (called) { \
LOG_ERROR(__FUNCTION__); \
LOG_ERROR("called twice. Aborting!"); \
abort(); \
}
called
=
true
;
void
trustedEnclaveInit
(
uint32_t
_logLevel
)
{
CALL_ONCE
LOG_INFO
(
__FUNCTION__
);
globalLogLevel_
=
_logLevel
;
...
...
@@ -145,7 +140,7 @@ void trustedEnclaveInit(uint32_t _logLevel) {
globalRandom
=
calloc
(
32
,
1
);
auto
ret
=
sgx_read_rand
(
globalRandom
,
32
);
int
ret
=
sgx_read_rand
(
globalRandom
,
32
);
if
(
ret
!=
SGX_SUCCESS
)
{
...
...
@@ -215,7 +210,6 @@ void *reallocate_function(void *ptr, size_t osize, size_t nsize) {
}
void
get_global_random
(
unsigned
char
*
_randBuff
,
uint64_t
_size
)
{
char
errString
[
BUF_LEN
];
int
status
;
int
*
errStatus
=
&
status
;
...
...
@@ -238,6 +232,7 @@ void get_global_random(unsigned char *_randBuff, uint64_t _size) {
void
sealHexSEK
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_sek
,
uint32_t
*
enc_len
,
char
*
sek_hex
)
{
CALL_ONCE
LOG_INFO
(
__FUNCTION__
);
INIT_ERROR_STATE
...
...
@@ -284,9 +279,11 @@ void sealHexSEK(int *errStatus, char *errString,
void
trustedGenerateSEK
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_sek
,
uint32_t
*
enc_len
,
char
*
sek_hex
)
{
CALL_ONCE
LOG_INFO
(
__FUNCTION__
);
INIT_ERROR_STATE
CHECK_STATE
(
encrypted_sek
);
CHECK_STATE
(
sek_hex
);
...
...
@@ -309,6 +306,7 @@ void trustedGenerateSEK(int *errStatus, char *errString,
}
void
trustedSetSEK
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_sek
)
{
CALL_ONCE
LOG_INFO
(
__FUNCTION__
);
INIT_ERROR_STATE
CHECK_STATE
(
encrypted_sek
);
...
...
@@ -341,6 +339,7 @@ void trustedSetSEK(int *errStatus, char *errString, uint8_t *encrypted_sek) {
void
trustedSetSEK_backup
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_sek
,
uint32_t
*
enc_len
,
const
char
*
sek_hex
)
{
CALL_ONCE
LOG_INFO
(
__FUNCTION__
);
INIT_ERROR_STATE
...
...
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