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
dc13eb58
Unverified
Commit
dc13eb58
authored
Jul 12, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2895-fix-build-and-docs
parent
dfdbd7e8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
3 deletions
+22
-3
EnclaveCommon.h
secure_enclave/EnclaveCommon.h
+7
-0
Signature.c
secure_enclave/Signature.c
+3
-3
secure_enclave.c
secure_enclave/secure_enclave.c
+12
-0
No files found.
secure_enclave/EnclaveCommon.h
View file @
dc13eb58
...
...
@@ -43,6 +43,10 @@ EXTERNC bool hex2carray2(const char * _hex, uint64_t *_bin_len,
uint8_t
*
_bin
,
const
int
_max_length
);
EXTERNC
void
enclave_init
();
void
get_global_random
(
unsigned
char
*
_randBuff
);
EXTERNC
void
LOG_INFO
(
char
*
msg
);
EXTERNC
void
LOG_WARN
(
char
*
_msg
);
EXTERNC
void
LOG_ERROR
(
char
*
_msg
);
...
...
@@ -51,4 +55,7 @@ EXTERNC void LOG_TRACE(char* _msg);
extern
uint32_t
globalLogLevel_
;
extern
unsigned
char
*
globalRandom
;
#endif //SGXWALLET_ENCLAVECOMMON_H
secure_enclave/Signature.c
View file @
dc13eb58
...
...
@@ -103,15 +103,15 @@ void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_para
unsigned
char
*
rand_char
=
(
unsigned
char
*
)
calloc
(
32
,
1
);
sgx_read_rand
(
rand_char
,
32
);
get_global_random
(
rand_char
);
gmp_randstate_t
r_state
;
signature_sign_start:
//Set k
sgx_read_rand
(
rand_char
,
32
);
;
get_global_random
(
rand_char
);
mpz_import
(
seed
,
32
,
1
,
sizeof
(
rand_char
[
0
]),
0
,
0
,
rand_char
);
mpz_mod
(
k
,
seed
,
curve
->
p
);
...
...
secure_enclave/secure_enclave.c
View file @
dc13eb58
...
...
@@ -69,6 +69,8 @@ void *reallocate_function(void *, size_t, size_t);
void
free_function
(
void
*
,
size_t
);
unsigned
char
*
globalRandom
;
void
trustedEnclaveInit
(
uint32_t
_logLevel
)
{
LOG_DEBUG
(
__FUNCTION__
);
...
...
@@ -80,6 +82,11 @@ void trustedEnclaveInit(uint32_t _logLevel) {
mp_get_memory_functions
(
NULL
,
&
gmp_realloc_func
,
&
gmp_free_func
);
mp_set_memory_functions
(
NULL
,
oc_realloc_func
,
oc_free_func
);
globalRandom
=
(
unsigned
char
*
)
calloc
(
32
,
1
);
sgx_read_rand
(
globalRandom
,
32
);
enclave_init
();
LOG_DEBUG
(
"SUCCESS"
);
...
...
@@ -121,6 +128,11 @@ void *reallocate_function(void *ptr, size_t osize, size_t nsize) {
return
(
void
*
)
nptr
;
}
void
get_global_random
(
unsigned
char
*
_randBuff
)
{
memcpy
(
_randBuff
,
globalRandom
,
32
);
}
void
trustedEMpzAdd
(
mpz_t
*
c_un
,
mpz_t
*
a_un
,
mpz_t
*
b_un
)
{}
void
trustedEMpzMul
(
mpz_t
*
c_un
,
mpz_t
*
a_un
,
mpz_t
*
b_un
)
{}
...
...
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