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
1fa379be
Unverified
Commit
1fa379be
authored
Mar 20, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2345 Cleaning testst
parent
4ccc28e7
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
162 additions
and
166 deletions
+162
-166
SGXRegistrationServer.cpp
SGXRegistrationServer.cpp
+4
-4
ServerInit.cpp
ServerInit.cpp
+4
-6
sgxwallet.c
sgxwallet.c
+21
-11
sgxwallet_common.h
sgxwallet_common.h
+17
-1
testw.cpp
testw.cpp
+116
-144
No files found.
SGXRegistrationServer.cpp
View file @
1fa379be
...
@@ -46,10 +46,10 @@
...
@@ -46,10 +46,10 @@
#include "spdlog/spdlog.h"
#include "spdlog/spdlog.h"
#include "common.h"
#include "common.h"
int
printDebugInfo
=
0
;
int
printDebugInfo
=
-
1
;
int
useHTTPS
=
1
;
int
useHTTPS
=
-
1
;
int
encryptKeys
=
0
;
int
encryptKeys
=
-
1
;
bool
autoconfirm
=
false
;
int
autoconfirm
=
-
1
;
SGXRegistrationServer
*
registrationServer
=
nullptr
;
SGXRegistrationServer
*
registrationServer
=
nullptr
;
HttpServer
*
httpServer2
=
nullptr
;
HttpServer
*
httpServer2
=
nullptr
;
...
...
ServerInit.cpp
View file @
1fa379be
...
@@ -86,7 +86,6 @@ void initEnclave() {
...
@@ -86,7 +86,6 @@ void initEnclave() {
updated
=
0
;
updated
=
0
;
#ifndef SGX_HW_SIM
#ifndef SGX_HW_SIM
unsigned
long
support
;
unsigned
long
support
;
support
=
get_sgx_support
();
support
=
get_sgx_support
();
...
@@ -108,13 +107,14 @@ void initEnclave() {
...
@@ -108,13 +107,14 @@ void initEnclave() {
fprintf
(
stderr
,
"sgx_create_enclave: %s: file not found
\n
"
,
ENCLAVE_NAME
);
fprintf
(
stderr
,
"sgx_create_enclave: %s: file not found
\n
"
,
ENCLAVE_NAME
);
fprintf
(
stderr
,
"Did you forget to set LD_LIBRARY_PATH?
\n
"
);
fprintf
(
stderr
,
"Did you forget to set LD_LIBRARY_PATH?
\n
"
);
}
else
{
}
else
{
spdlog
::
error
(
"sgx_create_enclave_search failed"
);
fprintf
(
stderr
,
"%s: 0x%04x
\n
"
,
ENCLAVE_NAME
,
status
);
fprintf
(
stderr
,
"%s: 0x%04x
\n
"
,
ENCLAVE_NAME
,
status
);
}
}
exit
(
1
);
exit
(
1
);
}
}
//fprintf(stderr, "Enclave launched\n");
//fprintf(stderr, "Enclave launched\n");
spdlog
::
info
(
"Enclave launched
"
);
spdlog
::
error
(
"Enclave created and started successfully
"
);
status
=
tgmp_init
(
eid
);
status
=
tgmp_init
(
eid
);
if
(
status
!=
SGX_SUCCESS
)
{
if
(
status
!=
SGX_SUCCESS
)
{
...
@@ -122,10 +122,8 @@ void initEnclave() {
...
@@ -122,10 +122,8 @@ void initEnclave() {
exit
(
1
);
exit
(
1
);
}
}
if
(
printDebugInfo
)
{
spdlog
::
info
(
"Enclave libtgmp library initialized successfully"
);
spdlog
::
info
(
"libtgmp initialized"
);
//fprintf(stderr, "libtgmp initialized\n");
}
}
}
...
...
sgxwallet.c
View file @
1fa379be
...
@@ -65,18 +65,25 @@ void printUsage() {
...
@@ -65,18 +65,25 @@ void printUsage() {
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
bool
encryptKeysOption
=
false
;
bool
useHTTPSOption
=
true
;
bool
printDebugInfoOption
=
false
;
bool
autoconfirmOption
=
false
;
bool
checkClientCertOption
=
true
;
bool
autoSignClientCertOption
=
false
;
void
(
*
SEK_initializer
)();
void
(
*
SEK_initializer
)();
SEK_initializer
=
init_SEK
;
SEK_initializer
=
init_SEK
;
bool
checkClientCert
=
true
;
bool
sign_automatically
=
false
;
int
opt
;
int
opt
;
if
(
argc
>
1
&&
strlen
(
argv
[
1
])
==
1
)
{
if
(
argc
>
1
&&
strlen
(
argv
[
1
])
==
1
)
{
fprintf
(
stderr
,
"option is too short %s
\n
"
,
argv
[
1
]
);
printUsage
(
);
exit
(
1
);
exit
(
1
);
}
}
encryptKeys
=
0
;
while
((
opt
=
getopt
(
argc
,
argv
,
"cshd0aby"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"cshd0aby"
))
!=
-
1
)
{
switch
(
opt
)
{
switch
(
opt
)
{
...
@@ -90,25 +97,25 @@ int main(int argc, char *argv[]) {
...
@@ -90,25 +97,25 @@ int main(int argc, char *argv[]) {
exit
(
1
);
exit
(
1
);
}
}
case
'c'
:
case
'c'
:
checkClientCert
=
false
;
checkClientCert
Option
=
false
;
break
;
break
;
case
's'
:
case
's'
:
sign_automatically
=
true
;
autoSignClientCertOption
=
true
;
break
;
break
;
case
'd'
:
case
'd'
:
printDebugInfo
=
1
;
printDebugInfo
Option
=
true
;
break
;
break
;
case
'0'
:
case
'0'
:
useHTTPS
=
0
;
useHTTPS
Option
=
false
;
break
;
break
;
case
'a'
:
case
'a'
:
encryptKeys
=
0
;
encryptKeys
Option
=
false
;
break
;
break
;
case
'b'
:
case
'b'
:
SEK_initializer
=
enter_SEK
;
SEK_initializer
=
enter_SEK
;
break
;
break
;
case
'y'
:
case
'y'
:
autoconfirm
=
true
;
autoconfirm
Option
=
true
;
break
;
break
;
case
'?'
:
case
'?'
:
printUsage
();
printUsage
();
...
@@ -117,7 +124,10 @@ int main(int argc, char *argv[]) {
...
@@ -117,7 +124,10 @@ int main(int argc, char *argv[]) {
break
;
break
;
}
}
}
}
initAll
(
checkClientCert
,
sign_automatically
,
SEK_initializer
);
setFullOptions
(
printDebugInfoOption
,
useHTTPSOption
,
autoconfirmOption
,
encryptKeysOption
);
initAll
(
checkClientCertOption
,
autoSignClientCertOption
,
SEK_initializer
);
while
(
true
)
{
while
(
true
)
{
sleep
(
10
);
sleep
(
10
);
...
...
sgxwallet_common.h
View file @
1fa379be
...
@@ -39,7 +39,23 @@
...
@@ -39,7 +39,23 @@
extern
int
printDebugInfo
;
extern
int
printDebugInfo
;
extern
int
useHTTPS
;
extern
int
useHTTPS
;
extern
int
encryptKeys
;
extern
int
encryptKeys
;
extern
bool
autoconfirm
;
extern
int
autoconfirm
;
inline
void
setFullOptions
(
int
_printDebugInfo
,
int
_useHTTPS
,
int
_autoconfirm
,
int
_encryptKeys
)
{
printDebugInfo
=
_printDebugInfo
;
useHTTPS
=
_useHTTPS
;
autoconfirm
=
_autoconfirm
;
encryptKeys
=
_encryptKeys
;
}
inline
void
setOptions
(
int
_printDebugInfo
,
int
_useHTTPS
,
int
_autoconfirm
)
{
setFullOptions
(
_printDebugInfo
,
_useHTTPS
,
_autoconfirm
,
false
);
}
#define BUF_LEN 1024
#define BUF_LEN 1024
...
...
testw.cpp
View file @
1fa379be
This diff is collapsed.
Click to expand it.
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