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
18c63687
Unverified
Commit
18c63687
authored
Aug 12, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3067-cleanup-sgx
parent
1ccc35ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
56 deletions
+23
-56
Log.h
Log.h
+7
-1
SGXWalletServer.cpp
SGXWalletServer.cpp
+16
-55
No files found.
Log.h
View file @
18c63687
...
@@ -76,7 +76,7 @@ public:
...
@@ -76,7 +76,7 @@ public:
#define INIT_RESULT(__RESULT__) Json::Value __RESULT__; \
#define INIT_RESULT(__RESULT__) Json::Value __RESULT__; \
int errStatus = UNKNOWN_ERROR; string errMsg(BUF_LEN, '\0');__RESULT__["status"] = 0; __RESULT__["errorMessage"] = \
int errStatus = UNKNOWN_ERROR; string errMsg(BUF_LEN, '\0');__RESULT__["status"] = 0; __RESULT__["errorMessage"] = \
"Server error. Please see server log.";
"Server error. Please see server log.";
#define RESULT_SUCCESS(__RESULT__) ; __RESULT__["status"] = 0; __RESULT__["errorMessage"] = "";
#define HANDLE_SGX_EXCEPTION(__RESULT__) \
#define HANDLE_SGX_EXCEPTION(__RESULT__) \
catch (SGXException& _e) { \
catch (SGXException& _e) { \
__RESULT__["status"] = _e.status; \
__RESULT__["status"] = _e.status; \
...
@@ -92,5 +92,11 @@ public:
...
@@ -92,5 +92,11 @@ public:
__RESULT__["errorMessage"] = "Unknown exception"; \
__RESULT__["errorMessage"] = "Unknown exception"; \
return __RESULT__; \
return __RESULT__; \
}
}
#define RETURN_SUCCESS(__RESULT__) \
__RESULT__["status"] = 0; \
__RESULT__["errorMessage"] = ""; \
return __RESULT__;
#endif
#endif
SGXWalletServer.cpp
View file @
18c63687
...
@@ -189,10 +189,7 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
...
@@ -189,10 +189,7 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
result
[
"status"
]
=
0
;
RETURN_SUCCESS
(
result
)
result
[
"errorMessage"
]
=
""
;
return
result
;
}
}
Json
::
Value
Json
::
Value
...
@@ -250,20 +247,16 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
...
@@ -250,20 +247,16 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
result
[
"signatureShare"
]
=
string
(
signature
.
data
());
result
[
"signatureShare"
]
=
string
(
signature
.
data
());
result
[
"status"
]
=
0
;
RETURN_SUCCESS
(
result
)
result
[
"errorMessage"
]
=
""
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
importECDSAKeyImpl
(
const
string
&
_key
,
const
string
&
_keyName
)
{
Json
::
Value
SGXWalletServer
::
importECDSAKeyImpl
(
const
string
&
_key
,
const
string
&
_keyName
)
{
INIT_RESULT
(
result
);
INIT_RESULT
(
result
);
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
result
[
"encryptedKey"
]
=
""
;
result
[
"encryptedKey"
]
=
""
;
return
result
;
RETURN_SUCCESS
(
result
)
}
}
Json
::
Value
SGXWalletServer
::
generateECDSAKeyImpl
()
{
Json
::
Value
SGXWalletServer
::
generateECDSAKeyImpl
()
{
...
@@ -295,10 +288,7 @@ Json::Value SGXWalletServer::generateECDSAKeyImpl() {
...
@@ -295,10 +288,7 @@ Json::Value SGXWalletServer::generateECDSAKeyImpl() {
result
[
"keyName"
]
=
keyName
;
result
[
"keyName"
]
=
keyName
;
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
result
[
"status"
]
=
0
;
RETURN_SUCCESS
(
result
)
result
[
"errorMessage"
]
=
""
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
renameECDSAKeyImpl
(
const
string
&
_keyName
,
const
string
&
_tempKeyName
)
{
Json
::
Value
SGXWalletServer
::
renameECDSAKeyImpl
(
const
string
&
_keyName
,
const
string
&
_tempKeyName
)
{
...
@@ -326,9 +316,7 @@ Json::Value SGXWalletServer::renameECDSAKeyImpl(const string &_keyName, const st
...
@@ -326,9 +316,7 @@ Json::Value SGXWalletServer::renameECDSAKeyImpl(const string &_keyName, const st
LevelDB
::
getLevelDb
()
->
deleteTempNEK
(
_tempKeyName
);
LevelDB
::
getLevelDb
()
->
deleteTempNEK
(
_tempKeyName
);
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
result
[
"status"
]
=
0
;
RETURN_SUCCESS
(
result
)
result
[
"errorMessage"
]
=
""
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
ecdsaSignMessageHashImpl
(
int
_base
,
const
string
&
_keyName
,
const
string
&
_messageHash
)
{
Json
::
Value
SGXWalletServer
::
ecdsaSignMessageHashImpl
(
int
_base
,
const
string
&
_keyName
,
const
string
&
_messageHash
)
{
...
@@ -370,10 +358,7 @@ Json::Value SGXWalletServer::ecdsaSignMessageHashImpl(int _base, const string &_
...
@@ -370,10 +358,7 @@ Json::Value SGXWalletServer::ecdsaSignMessageHashImpl(int _base, const string &_
result
[
"signature_s"
]
=
signatureVector
.
at
(
2
);
result
[
"signature_s"
]
=
signatureVector
.
at
(
2
);
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
result
[
"status"
]
=
0
;
RETURN_SUCCESS
(
result
)
result
[
"errorMessage"
]
=
""
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
getPublicECDSAKeyImpl
(
const
string
&
_keyName
)
{
Json
::
Value
SGXWalletServer
::
getPublicECDSAKeyImpl
(
const
string
&
_keyName
)
{
...
@@ -397,10 +382,7 @@ Json::Value SGXWalletServer::getPublicECDSAKeyImpl(const string &_keyName) {
...
@@ -397,10 +382,7 @@ Json::Value SGXWalletServer::getPublicECDSAKeyImpl(const string &_keyName) {
result
[
"publicKey"
]
=
publicKey
;
result
[
"publicKey"
]
=
publicKey
;
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
result
[
"status"
]
=
0
;
RETURN_SUCCESS
(
result
)
result
[
"errorMessage"
]
=
""
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
generateDKGPolyImpl
(
const
string
&
_polyName
,
int
_t
)
{
Json
::
Value
SGXWalletServer
::
generateDKGPolyImpl
(
const
string
&
_polyName
,
int
_t
)
{
...
@@ -420,10 +402,7 @@ Json::Value SGXWalletServer::generateDKGPolyImpl(const string &_polyName, int _t
...
@@ -420,10 +402,7 @@ Json::Value SGXWalletServer::generateDKGPolyImpl(const string &_polyName, int _t
writeDataToDB
(
_polyName
,
encrPolyHex
);
writeDataToDB
(
_polyName
,
encrPolyHex
);
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
result
[
"status"
]
=
0
;
RETURN_SUCCESS
(
result
)
result
[
"errorMessage"
]
=
""
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
getVerificationVectorImpl
(
const
string
&
_polyName
,
int
_t
,
int
_n
)
{
Json
::
Value
SGXWalletServer
::
getVerificationVectorImpl
(
const
string
&
_polyName
,
int
_t
,
int
_n
)
{
...
@@ -459,8 +438,6 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName,
...
@@ -459,8 +438,6 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName,
result
[
"verificationVector"
]
=
""
;
result
[
"verificationVector"
]
=
""
;
}
}
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
return
result
;
return
result
;
}
}
...
@@ -497,10 +474,7 @@ Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const J
...
@@ -497,10 +474,7 @@ Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const J
result
[
"secretShare"
]
=
s
;
result
[
"secretShare"
]
=
s
;
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
result
[
"status"
]
=
0
;
RETURN_SUCCESS
(
result
)
result
[
"errorMessage"
]
=
""
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
dkgVerificationImpl
(
const
string
&
_publicShares
,
const
string
&
_ethKeyName
,
Json
::
Value
SGXWalletServer
::
dkgVerificationImpl
(
const
string
&
_publicShares
,
const
string
&
_ethKeyName
,
...
@@ -534,9 +508,7 @@ Json::Value SGXWalletServer::dkgVerificationImpl(const string &_publicShares, co
...
@@ -534,9 +508,7 @@ Json::Value SGXWalletServer::dkgVerificationImpl(const string &_publicShares, co
result
[
"result"
]
=
true
;
result
[
"result"
]
=
true
;
result
[
"errorMessage"
]
=
""
;
RETURN_SUCCESS
(
result
)
result
[
"status"
]
=
0
;
return
result
;
}
}
Json
::
Value
Json
::
Value
...
@@ -589,9 +561,7 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string
...
@@ -589,9 +561,7 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
result
[
"status"
]
=
0
;
RETURN_SUCCESS
(
result
)
result
[
"errorMessage"
]
=
""
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
getBLSPublicKeyShareImpl
(
const
string
&
_blsKeyName
)
{
Json
::
Value
SGXWalletServer
::
getBLSPublicKeyShareImpl
(
const
string
&
_blsKeyName
)
{
...
@@ -611,9 +581,7 @@ Json::Value SGXWalletServer::getBLSPublicKeyShareImpl(const string &_blsKeyName)
...
@@ -611,9 +581,7 @@ Json::Value SGXWalletServer::getBLSPublicKeyShareImpl(const string &_blsKeyName)
}
}
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
result
[
"errorMessage"
]
=
""
;
RETURN_SUCCESS
(
result
)
result
[
"status"
]
=
0
;
return
result
;
}
}
...
@@ -633,10 +601,7 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int
...
@@ -633,10 +601,7 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int
result
[
"dhKey"
]
=
DHKey
;
result
[
"dhKey"
]
=
DHKey
;
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
result
[
"errorMessage"
]
=
""
;
RETURN_SUCCESS
(
result
)
result
[
"status"
]
=
0
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
multG2Impl
(
const
string
&
_x
)
{
Json
::
Value
SGXWalletServer
::
multG2Impl
(
const
string
&
_x
)
{
...
@@ -675,10 +640,7 @@ Json::Value SGXWalletServer::isPolyExistsImpl(const string &_polyName) {
...
@@ -675,10 +640,7 @@ Json::Value SGXWalletServer::isPolyExistsImpl(const string &_polyName) {
Json
::
Value
SGXWalletServer
::
getServerStatusImpl
()
{
Json
::
Value
SGXWalletServer
::
getServerStatusImpl
()
{
INIT_RESULT
(
result
)
INIT_RESULT
(
result
)
result
[
"status"
]
=
0
;
RETURN_SUCCESS
(
result
)
result
[
"errorMessage"
]
=
""
;
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
getServerVersionImpl
()
{
Json
::
Value
SGXWalletServer
::
getServerVersionImpl
()
{
...
@@ -709,9 +671,8 @@ Json::Value SGXWalletServer::deleteBlsKeyImpl(const std::string& name) {
...
@@ -709,9 +671,8 @@ Json::Value SGXWalletServer::deleteBlsKeyImpl(const std::string& name) {
throw
SGXException
(
INVALID_BLS_NAME
,
error_msg
.
c_str
());
throw
SGXException
(
INVALID_BLS_NAME
,
error_msg
.
c_str
());
}
}
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
RETURN_SUCCESS
(
result
)
return
result
;
}
}
Json
::
Value
SGXWalletServer
::
generateDKGPoly
(
const
string
&
_polyName
,
int
_t
)
{
Json
::
Value
SGXWalletServer
::
generateDKGPoly
(
const
string
&
_polyName
,
int
_t
)
{
...
...
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