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
342f9590
Unverified
Commit
342f9590
authored
Sep 08, 2019
by
kladkogex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added init enclave
parent
bf17b94d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
39 deletions
+41
-39
BLSCrypto.cpp
BLSCrypto.cpp
+0
-39
ServerInit.cpp
ServerInit.cpp
+41
-0
No files found.
BLSCrypto.cpp
View file @
342f9590
...
...
@@ -29,45 +29,6 @@
#include "ServerInit.h"
void
init_enclave
()
{
eid
=
0
;
updated
=
0
;
unsigned
long
support
;
#ifndef SGX_HW_SIM
support
=
get_sgx_support
();
if
(
!
SGX_OK
(
support
))
{
sgx_support_perror
(
support
);
exit
(
1
);
}
#endif
status
=
sgx_create_enclave_search
(
ENCLAVE_NAME
,
SGX_DEBUG_FLAG
,
&
token
,
&
updated
,
&
eid
,
0
);
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
"
);
}
else
{
fprintf
(
stderr
,
"%s: 0x%04x
\n
"
,
ENCLAVE_NAME
,
status
);
}
exit
(
1
);
}
fprintf
(
stderr
,
"Enclave launched
\n
"
);
status
=
tgmp_init
(
eid
);
if
(
status
!=
SGX_SUCCESS
)
{
fprintf
(
stderr
,
"ECALL tgmp_init: 0x%04x
\n
"
,
status
);
exit
(
1
);
}
fprintf
(
stderr
,
"libtgmp initialized
\n
"
);
}
int
char2int
(
char
_input
)
{
if
(
_input
>=
'0'
&&
_input
<=
'9'
)
...
...
ServerInit.cpp
View file @
342f9590
...
...
@@ -48,3 +48,44 @@ void init_daemon() {
leveldb
::
Status
status
=
leveldb
::
DB
::
Open
(
options
,
"./keysdb"
,
&
db
);
}
void
init_enclave
()
{
eid
=
0
;
updated
=
0
;
unsigned
long
support
;
#ifndef SGX_HW_SIM
support
=
get_sgx_support
();
if
(
!
SGX_OK
(
support
))
{
sgx_support_perror
(
support
);
exit
(
1
);
}
#endif
status
=
sgx_create_enclave_search
(
ENCLAVE_NAME
,
SGX_DEBUG_FLAG
,
&
token
,
&
updated
,
&
eid
,
0
);
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
"
);
}
else
{
fprintf
(
stderr
,
"%s: 0x%04x
\n
"
,
ENCLAVE_NAME
,
status
);
}
exit
(
1
);
}
fprintf
(
stderr
,
"Enclave launched
\n
"
);
status
=
tgmp_init
(
eid
);
if
(
status
!=
SGX_SUCCESS
)
{
fprintf
(
stderr
,
"ECALL tgmp_init: 0x%04x
\n
"
,
status
);
exit
(
1
);
}
fprintf
(
stderr
,
"libtgmp initialized
\n
"
);
}
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