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
f2d4b3c0
Unverified
Commit
f2d4b3c0
authored
Jun 16, 2021
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3951 cleanup
parent
b128bca4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
25 deletions
+13
-25
SGXWalletServer.cpp
SGXWalletServer.cpp
+13
-25
No files found.
SGXWalletServer.cpp
View file @
f2d4b3c0
...
...
@@ -49,6 +49,12 @@
#include "Log.h"
#ifdef SGX_HW_SIM
#define NUM_THREADS 16
#else
#define NUM_THREADS 200
#endif
using
namespace
std
;
std
::
shared_timed_mutex
sgxInitMutex
;
...
...
@@ -111,20 +117,12 @@ void SGXWalletServer::printDB() {
LevelDB
::
getLevelDb
()
->
visitKeys
(
&
v
,
100000000
);
}
#ifdef SGX_HW_SIM
#define NUM_THREADS 16
#else
#define NUM_THREADS 200
#endif
bool
SGXWalletServer
::
verifyCert
(
string
&
_certFileName
)
{
string
rootCAPath
=
string
(
SGXDATA_FOLDER
)
+
"cert_data/rootCA.pem"
;
string
verifyCert
=
"cert/verify_client_cert "
+
rootCAPath
+
" "
+
_certFileName
;
return
system
(
verifyCert
.
c_str
())
==
0
;
}
void
SGXWalletServer
::
createCertsIfNeeded
()
{
string
rootCAPath
=
string
(
SGXDATA_FOLDER
)
+
"cert_data/rootCA.pem"
;
...
...
@@ -170,7 +168,6 @@ void SGXWalletServer::createCertsIfNeeded() {
}
}
void
SGXWalletServer
::
initHttpsServer
(
bool
_checkCerts
)
{
COUNT_STATISTICS
spdlog
::
info
(
"Entering {}"
,
__FUNCTION__
);
...
...
@@ -214,15 +211,15 @@ void SGXWalletServer::initHttpServer() { //without ssl
}
int
SGXWalletServer
::
exitServer
()
{
spdlog
::
info
(
"Stoping sgx server"
);
spdlog
::
info
(
"Stoping sgx server"
);
if
(
server
&&
!
server
->
StopListening
())
{
spdlog
::
error
(
"Sgx server could not be stopped. Will forcefully terminate the app"
);
}
else
{
spdlog
::
info
(
"Sgx server stopped"
);
}
if
(
server
&&
!
server
->
StopListening
())
{
spdlog
::
error
(
"Sgx server could not be stopped. Will forcefully terminate the app"
);
}
else
{
spdlog
::
info
(
"Sgx server stopped"
);
}
return
0
;
return
0
;
}
Json
::
Value
...
...
@@ -269,7 +266,6 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
RETURN_SUCCESS
(
result
);
}
map
<
string
,
string
>
SGXWalletServer
::
blsRequests
;
recursive_mutex
SGXWalletServer
::
blsRequestsLock
;
...
...
@@ -288,7 +284,6 @@ void SGXWalletServer::checkForDuplicate(map <string, string> &_map, recursive_mu
_map
[
_key
]
=
_value
;
}
Json
::
Value
SGXWalletServer
::
blsSignMessageHashImpl
(
const
string
&
_keyShareName
,
const
string
&
_messageHash
,
int
t
,
int
n
)
{
spdlog
::
trace
(
"Entering {}"
,
__FUNCTION__
);
...
...
@@ -305,10 +300,8 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
shared_ptr
<
string
>
value
=
nullptr
;
checkForDuplicate
(
blsRequests
,
blsRequestsLock
,
_keyShareName
,
_messageHash
);
try
{
if
(
!
checkName
(
_keyShareName
,
"BLS_KEY"
))
{
throw
SGXException
(
BLS_SIGN_INVALID_KS_NAME
,
string
(
__FUNCTION__
)
+
":Invalid BLSKey name"
);
...
...
@@ -342,9 +335,7 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
result
[
"signatureShare"
]
=
string
(
signature
.
data
());
RETURN_SUCCESS
(
result
);
}
Json
::
Value
SGXWalletServer
::
importECDSAKeyImpl
(
const
string
&
_keyShare
,
...
...
@@ -648,7 +639,6 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string
string
(
__FUNCTION__
)
+
":Error while creating BLS key share"
);
}
for
(
int
i
=
0
;
i
<
_n
;
i
++
)
{
string
name
=
_polyName
+
"_"
+
to_string
(
i
)
+
":"
;
LevelDB
::
getLevelDb
()
->
deleteDHDKGKey
(
name
);
...
...
@@ -978,7 +968,6 @@ SGXWalletServer::createBLSPrivateKeyV2Impl(const string &_blsKeyName, const stri
string
(
__FUNCTION__
)
+
":Error while creating BLS key share"
);
}
for
(
int
i
=
0
;
i
<
_n
;
i
++
)
{
string
name
=
_polyName
+
"_"
+
to_string
(
i
)
+
":"
;
LevelDB
::
getLevelDb
()
->
deleteDHDKGKey
(
name
);
...
...
@@ -987,7 +976,6 @@ SGXWalletServer::createBLSPrivateKeyV2Impl(const string &_blsKeyName, const stri
}
LevelDB
::
getLevelDb
()
->
deleteKey
(
_polyName
);
string
encryptedSecretShareName
=
"encryptedSecretShare:"
+
_polyName
;
LevelDB
::
getLevelDb
()
->
deleteKey
(
encryptedSecretShareName
);
...
...
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