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
e63a90f2
Unverified
Commit
e63a90f2
authored
Feb 01, 2021
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug/SKALE-3751-enable-zeromq
parent
61ce445b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
61 additions
and
21 deletions
+61
-21
SGXWalletServer.cpp
SGXWalletServer.cpp
+17
-5
SGXWalletServer.hpp
SGXWalletServer.hpp
+2
-0
ServerInit.cpp
ServerInit.cpp
+13
-6
ServerInit.h
ServerInit.h
+1
-1
ZMQServer.cpp
ZMQServer.cpp
+4
-2
sgxwall.cpp
sgxwall.cpp
+1
-1
testw.cpp
testw.cpp
+21
-5
testw.h
testw.h
+1
-0
testw.py
testw.py
+1
-1
No files found.
SGXWalletServer.cpp
View file @
e63a90f2
...
...
@@ -125,11 +125,7 @@ bool SGXWalletServer::verifyCert(string &_certFileName) {
}
int
SGXWalletServer
::
initHttpsServer
(
bool
_checkCerts
)
{
COUNT_STATISTICS
spdlog
::
info
(
"Entering {}"
,
__FUNCTION__
);
spdlog
::
info
(
"Initing server, number of threads: {}"
,
NUM_THREADS
);
void
SGXWalletServer
::
createCertsIfNeeded
()
{
string
rootCAPath
=
string
(
SGXDATA_FOLDER
)
+
"cert_data/rootCA.pem"
;
string
keyCAPath
=
string
(
SGXDATA_FOLDER
)
+
"cert_data/rootCA.key"
;
...
...
@@ -172,6 +168,22 @@ int SGXWalletServer::initHttpsServer(bool _checkCerts) {
spdlog
::
info
(
"SERVER CERTIFICATE VERIFICATION FAILED"
);
exit
(
-
12
);
}
}
int
SGXWalletServer
::
initHttpsServer
(
bool
_checkCerts
)
{
COUNT_STATISTICS
spdlog
::
info
(
"Entering {}"
,
__FUNCTION__
);
spdlog
::
info
(
"Initing server, number of threads: {}"
,
NUM_THREADS
);
string
certPath
=
string
(
SGXDATA_FOLDER
)
+
"cert_data/SGXServerCert.crt"
;
string
keyPath
=
string
(
SGXDATA_FOLDER
)
+
"cert_data/SGXServerCert.key"
;
string
rootCAPath
=
string
(
SGXDATA_FOLDER
)
+
"cert_data/rootCA.pem"
;
string
keyCAPath
=
string
(
SGXDATA_FOLDER
)
+
"cert_data/rootCA.key"
;
httpServer
=
make_shared
<
HttpServer
>
(
BASE_PORT
,
certPath
,
keyPath
,
rootCAPath
,
_checkCerts
,
NUM_THREADS
);
...
...
SGXWalletServer.hpp
View file @
e63a90f2
...
...
@@ -181,6 +181,8 @@ public:
static
int
initHttpServer
();
static
int
initHttpsServer
(
bool
_checkCerts
);
static
void
createCertsIfNeeded
();
};
#endif //SGXWALLET_SGXWALLETSERVER_HPP
ServerInit.cpp
View file @
e63a90f2
...
...
@@ -166,7 +166,8 @@ uint64_t initEnclave() {
}
void
initAll
(
uint32_t
_logLevel
,
bool
_checkCert
,
bool
_autoSign
,
bool
_generateTestKeys
)
{
void
initAll
(
uint32_t
_logLevel
,
bool
_checkCert
,
bool
_checkZMQSig
,
bool
_autoSign
,
bool
_generateTestKeys
)
{
static
atomic
<
bool
>
sgxServerInited
(
false
);
...
...
@@ -200,17 +201,23 @@ void initAll(uint32_t _logLevel, bool _checkCert, bool _autoSign, bool _generate
initUserSpace
();
initSEK
();
SGXWalletServer
::
createCertsIfNeeded
();
if
(
useHTTPS
)
{
spdlog
::
info
(
"Initing JSON-RPC server over HTTPS"
);
spdlog
::
info
(
"Check client cert: {}"
,
_checkCert
);
SGXWalletServer
::
initHttpsServer
(
_checkCert
);
SGXRegistrationServer
::
initRegistrationServer
(
_autoSign
);
CSRManagerServer
::
initCSRManagerServer
();
ZMQServer
::
initZMQServer
(
_checkCert
);
spdlog
::
info
(
"Inited JSON-RPC server over HTTPS"
);
}
else
{
spdlog
::
info
(
"Initing JSON-RPC server over HTTP"
);
SGXWalletServer
::
initHttpServer
();
ZMQServer
::
initZMQServer
(
false
);
spdlog
::
info
(
"Inited JSON-RPC server over HTTP"
);
}
SGXInfoServer
::
initInfoServer
(
_logLevel
,
_checkCert
,
_autoSign
,
_generateTestKeys
);
SGXRegistrationServer
::
initRegistrationServer
(
_autoSign
);
CSRManagerServer
::
initCSRManagerServer
();
ZMQServer
::
initZMQServer
(
_checkZMQSig
);
SGXInfoServer
::
initInfoServer
(
_logLevel
,
_checkCert
,
_autoSign
,
_generateTestKeys
);
sgxServerInited
=
true
;
}
catch
(
SGXException
&
_e
)
{
spdlog
::
error
(
_e
.
getMessage
());
...
...
ServerInit.h
View file @
e63a90f2
...
...
@@ -32,7 +32,7 @@
#define EXTERNC
#endif
EXTERNC
void
initAll
(
uint32_t
_logLevel
,
bool
_checkCert
,
bool
_autoSign
,
bool
_generateTestKeys
);
EXTERNC
void
initAll
(
uint32_t
_logLevel
,
bool
_checkCert
,
bool
_
checkZMQSig
,
bool
_
autoSign
,
bool
_generateTestKeys
);
EXTERNC
void
initUserSpace
();
...
...
ZMQServer.cpp
View file @
e63a90f2
...
...
@@ -168,12 +168,14 @@ void ZMQServer::initZMQServer(bool _checkSignature) {
CHECK_STATE
(
!
initedServer
)
initedServer
=
true
;
spdlog
::
info
(
"Initing zmq server
..."
);
spdlog
::
info
(
"Initing zmq server
. checkSignature is set to {}"
,
_checkSignature
);
string
rootCAPath
=
""
;
if
(
_checkSignature
)
{
string
rootCAPath
=
string
(
SGXDATA_FOLDER
)
+
"cert_data/rootCA.pem"
;
rootCAPath
=
string
(
SGXDATA_FOLDER
)
+
"cert_data/rootCA.pem"
;
spdlog
::
info
(
"Reading root CA from {}"
,
rootCAPath
);
CHECK_STATE
(
access
(
rootCAPath
.
c_str
(),
F_OK
)
==
0
);
};
...
...
sgxwall.cpp
View file @
e63a90f2
...
...
@@ -174,7 +174,7 @@ int main(int argc, char *argv[]) {
enclaveLogLevel
=
L_TRACE
;
}
initAll
(
enclaveLogLevel
,
checkClientCertOption
,
autoSignClientCertOption
,
generateTestKeys
);
initAll
(
enclaveLogLevel
,
checkClientCertOption
,
checkClientCertOption
,
autoSignClientCertOption
,
generateTestKeys
);
ifstream
is
(
"sgx_data/4node.json"
);
...
...
testw.cpp
View file @
e63a90f2
...
...
@@ -74,7 +74,7 @@ public:
TestFixture
()
{
TestUtils
::
resetDB
();
setOptions
(
L_INFO
,
false
,
true
);
initAll
(
L_INFO
,
false
,
true
,
false
);
initAll
(
L_INFO
,
false
,
false
,
true
,
false
);
}
~
TestFixture
()
{
...
...
@@ -88,7 +88,7 @@ public:
TestFixtureHTTPS
()
{
TestUtils
::
resetDB
();
setOptions
(
L_INFO
,
true
,
true
);
initAll
(
L_INFO
,
false
,
true
,
false
);
initAll
(
L_INFO
,
false
,
true
,
true
,
false
);
}
~
TestFixtureHTTPS
()
{
...
...
@@ -97,11 +97,27 @@ public:
}
};
class
TestFixtureZMQSign
{
public
:
TestFixtureZMQSign
()
{
TestUtils
::
resetDB
();
setOptions
(
L_INFO
,
false
,
true
);
initAll
(
L_INFO
,
false
,
true
,
true
,
false
);
}
~
TestFixtureZMQSign
()
{
ZMQServer
::
exitZMQServer
();
TestUtils
::
destroyEnclave
();
}
};
class
TestFixtureNoResetFromBackup
{
public
:
TestFixtureNoResetFromBackup
()
{
setFullOptions
(
L_INFO
,
false
,
true
,
true
);
initAll
(
L_INFO
,
false
,
true
,
false
);
initAll
(
L_INFO
,
false
,
false
,
true
,
false
);
}
~
TestFixtureNoResetFromBackup
()
{
...
...
@@ -115,7 +131,7 @@ class TestFixtureNoReset {
public
:
TestFixtureNoReset
()
{
setOptions
(
L_INFO
,
false
,
true
);
initAll
(
L_INFO
,
false
,
true
,
false
);
initAll
(
L_INFO
,
false
,
false
,
true
,
false
);
}
~
TestFixtureNoReset
()
{
...
...
@@ -930,7 +946,7 @@ TEST_CASE_METHOD(TestFixtureNoReset, "Second run", "[second-run]") {
}
TEST_CASE_METHOD
(
TestFixture
,
"ZMQ-ecdsa"
,
"[zmq-ecdsa]"
)
{
TEST_CASE_METHOD
(
TestFixture
ZMQSign
,
"ZMQ-ecdsa"
,
"[zmq-ecdsa]"
)
{
HttpClient
htp
(
RPC_ENDPOINT
);
StubClient
c
(
htp
,
JSONRPC_CLIENT_V2
);
...
...
testw.h
View file @
e63a90f2
...
...
@@ -33,6 +33,7 @@
#define SAMPLE_POLY_NAME "POLY:SCHAIN_ID:1:NODE_ID:1:DKG_ID:1"
#define RPC_ENDPOINT "http://localhost:1029"
#define RPC_ENDPOINT_HTTPS "https://localhost:1026"
#define ZMQ_IP "127.0.0.1"
#define ZMQ_PORT 1031
...
...
testw.py
View file @
e63a90f2
...
...
@@ -28,7 +28,7 @@ username = getpass.getuser()
topDir
=
os
.
getcwd
()
+
"/sgxwallet"
print
(
"Top directory is:"
+
topDir
)
testList
=
[
"[zmq-ecdsa
-run
]"
,
testList
=
[
"[zmq-ecdsa]"
,
"[first-run]"
,
"[second-run]"
,
"[many-threads-crypto]"
,
...
...
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