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
1d19ed56
Unverified
Commit
1d19ed56
authored
Aug 25, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3159-test-fails
parent
0c572006
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
6 deletions
+32
-6
EnclaveCommon.cpp
secure_enclave/EnclaveCommon.cpp
+16
-3
secure_enclave.c
secure_enclave/secure_enclave.c
+16
-3
No files found.
secure_enclave/EnclaveCommon.cpp
View file @
1d19ed56
...
...
@@ -161,14 +161,27 @@ int inited = 0;
domain_parameters
curve
;
#include "mutex"
mutex
m
;
void
enclave_init
()
{
LOG_INFO
(
__FUNCTION__
);
if
(
inited
==
1
)
return
;
inited
=
1
;
libff
::
init_alt_bn128_params
();
curve
=
domain_parameters_init
();
domain_parameters_load_curve
(
curve
,
secp256k1
);
LOG_INFO
(
"Initing libff"
);
try
{
libff
::
init_alt_bn128_params
();
curve
=
domain_parameters_init
();
domain_parameters_load_curve
(
curve
,
secp256k1
);
}
catch
(
exception
&
e
)
{
LOG_ERROR
(
"Exception in libff init"
);
LOG_ERROR
(
e
.
what
());
}
LOG_INFO
(
"Inited libff"
);
}
bool
enclave_sign
(
const
char
*
_keyString
,
const
char
*
_hashXString
,
const
char
*
_hashYString
,
...
...
secure_enclave/secure_enclave.c
View file @
1d19ed56
...
...
@@ -113,20 +113,33 @@ void free_function(void *, size_t);
unsigned
char
*
globalRandom
;
void
trustedEnclaveInit
(
uint32_t
_logLevel
)
{
LOG_
DEBUG
(
__FUNCTION__
);
LOG_
INFO
(
__FUNCTION__
);
globalLogLevel_
=
_logLevel
;
oc_realloc_func
=
&
reallocate_function
;
oc_free_func
=
&
free_function
;
LOG_INFO
(
"Setting memory functions"
);
mp_get_memory_functions
(
NULL
,
&
gmp_realloc_func
,
&
gmp_free_func
);
mp_set_memory_functions
(
NULL
,
oc_realloc_func
,
oc_free_func
);
LOG_INFO
(
"Reading random"
);
SAFE_CHAR_BUF
(
globalRandom
,
32
);
auto
ret
=
sgx_read_rand
(
globalRandom
,
32
);
if
(
ret
!=
SGX_SUCCESS
)
{
LOG_ERROR
(
"sgx_read_rand failed. Aboring enclave."
);
abort
();
}
globalRandom
=
(
unsigned
char
*
)
calloc
(
32
,
1
);
sgx_read_rand
(
globalRandom
,
32
);
LOG_INFO
(
"Calling enclave init"
);
enclave_init
();
...
...
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