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
55e6ef9f
Unverified
Commit
55e6ef9f
authored
Aug 12, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3067-cleanup-sgx
parent
20362fb3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
13 deletions
+29
-13
Log.h
Log.h
+2
-1
SGXWalletServer.cpp
SGXWalletServer.cpp
+27
-12
No files found.
Log.h
View file @
55e6ef9f
...
...
@@ -73,7 +73,8 @@ public:
static
void
handleSGXException
(
Json
::
Value
&
_result
,
SGXException
&
_e
);
};
#define INIT_RESULT(__RESULT__) Json::Value __RESULT__; __RESULT__["status"] = 0; __RESULT__["errorMessage"] = \
#define INIT_RESULT(__RESULT__) Json::Value __RESULT__; \
int errStatus = UNKNOWN_ERROR; string errMsg(BUF_LEN, '\0');__RESULT__["status"] = 0; __RESULT__["errorMessage"] = \
"Server error. Please see server log.";
#define RESULT_SUCCESS(__RESULT__) ; __RESULT__["status"] = 0; __RESULT__["errorMessage"] = "";
#define HANDLE_SGX_EXCEPTION(_RESULT_) catch (SGXException &__e) { Log::handleSGXException(_RESULT_, __e);} \
...
...
SGXWalletServer.cpp
View file @
55e6ef9f
...
...
@@ -166,10 +166,8 @@ int SGXWalletServer::initHttpServer() { //without ssl
Json
::
Value
SGXWalletServer
::
importBLSKeyShareImpl
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
,
int
t
,
int
n
,
int
_index
)
{
Json
::
Value
result
;
INIT_RESULT
(
result
)
;
int
errStatus
=
UNKNOWN_ERROR
;
string
errMsg
(
BUF_LEN
,
'\0'
);
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
...
...
@@ -196,15 +194,20 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
result
[
"errorMessage"
]
=
_e
.
errString
;
}
result
[
"status"
]
=
errStatus
;
result
[
"errorMessage"
]
=
errMsg
;
return
result
;
}
Json
::
Value
SGXWalletServer
::
blsSignMessageHashImpl
(
const
string
&
_keyShareName
,
const
string
&
_messageHash
,
int
t
,
int
n
,
int
_signerIndex
)
{
Json
::
Value
result
;
result
[
"status"
]
=
-
1
;
result
[
"errorMessage"
]
=
"Unknown server error"
;
INIT_RESULT
(
result
)
;
result
[
"signatureShare"
]
=
""
;
string
signature
(
BUF_LEN
,
'\0'
);
...
...
@@ -260,7 +263,9 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
}
Json
::
Value
SGXWalletServer
::
importECDSAKeyImpl
(
const
string
&
_key
,
const
string
&
_keyName
)
{
Json
::
Value
result
;
INIT_RESULT
(
result
);
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
result
[
"encryptedKey"
]
=
""
;
...
...
@@ -268,7 +273,9 @@ Json::Value SGXWalletServer::importECDSAKeyImpl(const string &_key, const string
}
Json
::
Value
SGXWalletServer
::
generateECDSAKeyImpl
()
{
Json
::
Value
result
;
INIT_RESULT
(
result
);
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
result
[
"encryptedKey"
]
=
""
;
...
...
@@ -300,6 +307,7 @@ Json::Value SGXWalletServer::generateECDSAKeyImpl() {
Json
::
Value
SGXWalletServer
::
renameECDSAKeyImpl
(
const
string
&
_keyName
,
const
string
&
_tempKeyName
)
{
INIT_RESULT
(
result
)
result
[
"encryptedKey"
]
=
""
;
try
{
...
...
@@ -415,7 +423,9 @@ Json::Value SGXWalletServer::generateDKGPolyImpl(const string &_polyName, int _t
}
Json
::
Value
SGXWalletServer
::
getVerificationVectorImpl
(
const
string
&
_polyName
,
int
_t
,
int
_n
)
{
Json
::
Value
result
;
INIT_RESULT
(
result
);
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
...
...
@@ -449,7 +459,9 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName,
}
Json
::
Value
SGXWalletServer
::
getSecretShareImpl
(
const
string
&
_polyName
,
const
Json
::
Value
&
_pubKeys
,
int
_t
,
int
_n
)
{
Json
::
Value
result
;
INIT_RESULT
(
result
);
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
...
...
@@ -488,7 +500,8 @@ Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const J
Json
::
Value
SGXWalletServer
::
dkgVerificationImpl
(
const
string
&
_publicShares
,
const
string
&
_ethKeyName
,
const
string
&
_secretShare
,
int
_t
,
int
_n
,
int
_index
)
{
Json
::
Value
result
;
INIT_RESULT
(
result
)
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
result
[
"result"
]
=
true
;
...
...
@@ -524,7 +537,9 @@ Json::Value SGXWalletServer::dkgVerificationImpl(const string &_publicShares, co
Json
::
Value
SGXWalletServer
::
createBLSPrivateKeyImpl
(
const
string
&
_blsKeyName
,
const
string
&
_ethKeyName
,
const
string
&
_polyName
,
const
string
&
_secretShare
,
int
_t
,
int
_n
)
{
Json
::
Value
result
;
INIT_RESULT
(
result
)
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
...
...
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