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
73eea1be
Unverified
Commit
73eea1be
authored
Apr 17, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2454-add-logs-to-enclave
parent
f9174183
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
17 deletions
+16
-17
ServerInit.cpp
ServerInit.cpp
+6
-7
secure_enclave.c
secure_enclave/secure_enclave.c
+9
-9
secure_enclave.edl
secure_enclave/secure_enclave.edl
+1
-1
No files found.
ServerInit.cpp
View file @
73eea1be
...
...
@@ -85,24 +85,23 @@ void initEnclave() {
if
(
status
!=
SGX_SUCCESS
)
{
if
(
status
==
SGX_ERROR_ENCLAVE_FILE_ACCESS
)
{
fprintf
(
stderr
,
"sgx_create_enclave: %s: file not found
\n
"
,
ENCLAVE_NAME
);
fprintf
(
stderr
,
"Did you forget to set LD_LIBRARY_PATH?
\n
"
);
spdlog
::
error
(
"sgx_create_enclave: {}: file not found
"
,
ENCLAVE_NAME
);
spdlog
::
error
(
"Did you forget to set LD_LIBRARY_PATH?
"
);
}
else
{
spdlog
::
error
(
"sgx_create_enclave_search failed"
);
fprintf
(
stderr
,
"%s: 0x%04x
\n
"
,
ENCLAVE_NAME
,
status
);
spdlog
::
error
(
"sgx_create_enclave_search failed {} {}"
,
ENCLAVE_NAME
,
status
);
}
exit
(
1
);
}
spdlog
::
info
(
"Enclave created and started successfully"
);
status
=
t
gmp_init
(
eid
);
status
=
t
rusted_enclave_init
(
eid
,
0
);
if
(
status
!=
SGX_SUCCESS
)
{
fprintf
(
stderr
,
"ECALL tgmp_init: 0x%04x
\n
"
,
status
);
spdlog
::
error
(
"trusted_enclave_init failed: {}
"
,
status
);
exit
(
1
);
}
spdlog
::
info
(
"Enclave libtgmp library initialized successfully"
);
spdlog
::
info
(
"Enclave libtgmp library
and logging
initialized successfully"
);
}
...
...
secure_enclave/secure_enclave.c
View file @
73eea1be
...
...
@@ -56,7 +56,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//#include "../sgxwallet_common.h"
#include "enclave_common.h"
uint8_t
Decrypted_dkg_p
oly
[
DKG_BUFER_LENGTH
];
uint8_t
decryptedDkgP
oly
[
DKG_BUFER_LENGTH
];
void
*
(
*
gmp_realloc_func
)(
void
*
,
size_t
,
size_t
);
...
...
@@ -72,7 +72,7 @@ void *reallocate_function(void *, size_t, size_t);
void
free_function
(
void
*
,
size_t
);
void
t
gmp_init
(
)
{
void
t
rusted_enclave_init
(
uint32_t
_logLevel
)
{
oc_printf
(
"Initing tgmp library
\n
"
);
oc_realloc_func
=
&
reallocate_function
;
oc_free_func
=
&
free_function
;
...
...
@@ -614,10 +614,10 @@ void get_public_shares(int *err_status, char *err_string, uint8_t *encrypted_dkg
void
set_encrypted_dkg_poly
(
int
*
err_status
,
char
*
err_string
,
uint8_t
*
encrypted_poly
)
{
memset
(
Decrypted_dkg_p
oly
,
0
,
DKG_BUFER_LENGTH
);
memset
(
decryptedDkgP
oly
,
0
,
DKG_BUFER_LENGTH
);
uint32_t
decr_len
;
sgx_status_t
status
=
sgx_unseal_data
(
(
const
sgx_sealed_data_t
*
)
encrypted_poly
,
NULL
,
0
,
Decrypted_dkg_p
oly
,
&
decr_len
);
(
const
sgx_sealed_data_t
*
)
encrypted_poly
,
NULL
,
0
,
decryptedDkgP
oly
,
&
decr_len
);
if
(
status
!=
SGX_SUCCESS
)
{
*
err_status
=
-
1
;
...
...
@@ -666,7 +666,7 @@ void get_encr_sshare(int *err_status, char *err_string, uint8_t *encrypted_skey,
char
*
s_share
[
ECDSA_SKEY_LEN
];
//= (char *)malloc(65);
//char s_share[65];
if
(
calc_secret_share
(
Decrypted_dkg_p
oly
,
s_share
,
_t
,
_n
,
ind
)
!=
0
)
{
if
(
calc_secret_share
(
decryptedDkgP
oly
,
s_share
,
_t
,
_n
,
ind
)
!=
0
)
{
*
err_status
=
-
1
;
snprintf
(
err_string
,
BUF_LEN
,
"
\n
t does not match poly degree
\n
"
);
return
;
...
...
@@ -1406,8 +1406,8 @@ decrypt_dkg_secret_aes(int *err_status, char *err_string, uint8_t *encrypted_dkg
}
void
set_encrypted_dkg_poly_aes
(
int
*
err_status
,
char
*
err_string
,
uint8_t
*
encrypted_poly
,
uint64_t
*
enc_len
)
{
memset
(
Decrypted_dkg_p
oly
,
0
,
DKG_BUFER_LENGTH
);
int
status
=
AES_decrypt
(
encrypted_poly
,
*
enc_len
,
Decrypted_dkg_p
oly
);
memset
(
decryptedDkgP
oly
,
0
,
DKG_BUFER_LENGTH
);
int
status
=
AES_decrypt
(
encrypted_poly
,
*
enc_len
,
decryptedDkgP
oly
);
if
(
status
!=
SGX_SUCCESS
)
{
*
err_status
=
-
1
;
...
...
@@ -1456,10 +1456,10 @@ void get_encr_sshare_aes(int *err_status, char *err_string, uint8_t *encrypted_s
char
*
s_share
[
ECDSA_SKEY_LEN
];
//= (char *)malloc(65);
//char s_share[65];
if
(
calc_secret_share
(
Decrypted_dkg_p
oly
,
s_share
,
_t
,
_n
,
ind
)
!=
0
)
{
if
(
calc_secret_share
(
decryptedDkgP
oly
,
s_share
,
_t
,
_n
,
ind
)
!=
0
)
{
*
err_status
=
-
1
;
// snprintf(err_string, BUF_LEN,"t does not match poly degree");
snprintf
(
err_string
,
BUF_LEN
,
Decrypted_dkg_p
oly
);
snprintf
(
err_string
,
BUF_LEN
,
decryptedDkgP
oly
);
return
;
}
snprintf
(
err_string
+
88
,
BUF_LEN
,
"
\n
secret share is %s"
,
s_share
);
...
...
secure_enclave/secure_enclave.edl
View file @
73eea1be
...
...
@@ -10,7 +10,7 @@ enclave {
include "sgx_tgmp.h"
public void t
gmp_init(
);
public void t
rusted_enclave_init(uint32_t _logLevel
);
public void e_mpz_add(
[user_check] mpz_t *c, [user_check] mpz_t *a, [user_check] mpz_t *b
...
...
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