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
83409277
Unverified
Commit
83409277
authored
Apr 17, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2454-add-logs-to-enclave
parent
ceaea2e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
EnclaveCommon.cpp
secure_enclave/EnclaveCommon.cpp
+1
-1
EnclaveCommon.h
secure_enclave/EnclaveCommon.h
+1
-1
secure_enclave.c
secure_enclave/secure_enclave.c
+9
-7
No files found.
secure_enclave/EnclaveCommon.cpp
View file @
83409277
...
@@ -99,7 +99,7 @@ libff::alt_bn128_Fr *keyFromString(const char *_keyStringHex) {
...
@@ -99,7 +99,7 @@ libff::alt_bn128_Fr *keyFromString(const char *_keyStringHex) {
int
inited
=
0
;
int
inited
=
0
;
void
init
()
{
void
enclave_
init
()
{
if
(
inited
==
1
)
if
(
inited
==
1
)
return
;
return
;
inited
=
1
;
inited
=
1
;
...
...
secure_enclave/EnclaveCommon.h
View file @
83409277
...
@@ -49,7 +49,7 @@ EXTERNC bool hex2carray(const char * _hex, uint64_t *_bin_len,
...
@@ -49,7 +49,7 @@ EXTERNC bool hex2carray(const char * _hex, uint64_t *_bin_len,
uint8_t
*
_bin
);
uint8_t
*
_bin
);
EXTERNC
bool
hex2carray2
(
const
char
*
_hex
,
uint64_t
*
_bin_len
,
EXTERNC
bool
hex2carray2
(
const
char
*
_hex
,
uint64_t
*
_bin_len
,
uint8_t
*
_bin
,
const
int
_max_length
);
uint8_t
*
_bin
,
const
int
_max_length
);
EXTERNC
void
init
();
EXTERNC
void
enclave_
init
();
EXTERNC
void
LOG_INFO
(
char
*
msg
);
EXTERNC
void
LOG_INFO
(
char
*
msg
);
...
...
secure_enclave/secure_enclave.c
View file @
83409277
...
@@ -72,13 +72,18 @@ void *reallocate_function(void *, size_t, size_t);
...
@@ -72,13 +72,18 @@ void *reallocate_function(void *, size_t, size_t);
void
free_function
(
void
*
,
size_t
);
void
free_function
(
void
*
,
size_t
);
void
trustedEnclaveInit
(
uint32_t
_logLevel
)
{
void
trustedEnclaveInit
(
uint32_t
_logLevel
)
{
oc_printf
(
"Initing tgmp library
\n
"
);
oc_printf
(
"Initing enclave: library
\n
"
);
oc_realloc_func
=
&
reallocate_function
;
oc_realloc_func
=
&
reallocate_function
;
oc_free_func
=
&
free_function
;
oc_free_func
=
&
free_function
;
mp_get_memory_functions
(
NULL
,
&
gmp_realloc_func
,
&
gmp_free_func
);
mp_get_memory_functions
(
NULL
,
&
gmp_realloc_func
,
&
gmp_free_func
);
mp_set_memory_functions
(
NULL
,
oc_realloc_func
,
oc_free_func
);
mp_set_memory_functions
(
NULL
,
oc_realloc_func
,
oc_free_func
);
enclave_init
();
}
}
void
free_function
(
void
*
ptr
,
size_t
sz
)
{
void
free_function
(
void
*
ptr
,
size_t
sz
)
{
...
@@ -375,7 +380,7 @@ void trustedEcdsaSign(int *errStatus, char *err_string, uint8_t *encrypted_key,
...
@@ -375,7 +380,7 @@ void trustedEcdsaSign(int *errStatus, char *err_string, uint8_t *encrypted_key,
void
trustedEncryptKey
(
int
*
errStatus
,
char
*
err_string
,
char
*
key
,
void
trustedEncryptKey
(
int
*
errStatus
,
char
*
err_string
,
char
*
key
,
uint8_t
*
encrypted_key
,
uint32_t
*
enc_len
)
{
uint8_t
*
encrypted_key
,
uint32_t
*
enc_len
)
{
//init();
*
errStatus
=
UNKNOWN_ERROR
;
*
errStatus
=
UNKNOWN_ERROR
;
...
@@ -441,7 +446,7 @@ void trustedEncryptKey(int *errStatus, char *err_string, char *key,
...
@@ -441,7 +446,7 @@ void trustedEncryptKey(int *errStatus, char *err_string, char *key,
void
trustedDecryptKey
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_key
,
void
trustedDecryptKey
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_key
,
uint32_t
enc_len
,
char
*
key
)
{
uint32_t
enc_len
,
char
*
key
)
{
init
();
uint32_t
decLen
;
uint32_t
decLen
;
...
@@ -500,7 +505,6 @@ void trustedBlsSignMessage(int *errStatus, char *err_string, uint8_t *encrypted_
...
@@ -500,7 +505,6 @@ void trustedBlsSignMessage(int *errStatus, char *err_string, uint8_t *encrypted_
char
*
sig
=
(
char
*
)
calloc
(
BUF_LEN
,
1
);
char
*
sig
=
(
char
*
)
calloc
(
BUF_LEN
,
1
);
// char sig[2 * BUF_LEN];
// char sig[2 * BUF_LEN];
init
();
trustedDecryptKey
(
errStatus
,
err_string
,
encrypted_key
,
enc_len
,
key
);
trustedDecryptKey
(
errStatus
,
err_string
,
encrypted_key
,
enc_len
,
key
);
...
@@ -1271,8 +1275,6 @@ void trustedEncryptKeyAES(int *errStatus, char *err_string, const char *key,
...
@@ -1271,8 +1275,6 @@ void trustedEncryptKeyAES(int *errStatus, char *err_string, const char *key,
void
trustedDecryptKeyAES
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_key
,
void
trustedDecryptKeyAES
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_key
,
uint32_t
enc_len
,
char
*
key
)
{
uint32_t
enc_len
,
char
*
key
)
{
init
();
uint32_t
decLen
;
uint32_t
decLen
;
*
errStatus
=
-
9
;
*
errStatus
=
-
9
;
...
@@ -1319,7 +1321,7 @@ void trustedBlsSignMessageAES(int *errStatus, char *err_string, uint8_t *encrypt
...
@@ -1319,7 +1321,7 @@ void trustedBlsSignMessageAES(int *errStatus, char *err_string, uint8_t *encrypt
memset
(
sig
,
0
,
BUF_LEN
);
memset
(
sig
,
0
,
BUF_LEN
);
//char* sig = (char*) calloc(BUF_LEN, 1);
//char* sig = (char*) calloc(BUF_LEN, 1);
init
();
enclave_
init
();
int
stat
=
AES_decrypt
(
encrypted_key
,
enc_len
,
key
);
int
stat
=
AES_decrypt
(
encrypted_key
,
enc_len
,
key
);
...
...
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