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
e0b46c47
Unverified
Commit
e0b46c47
authored
Sep 10, 2019
by
kladkogex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes
parent
8f8f6a37
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
9 deletions
+10
-9
LevelDB.cpp
LevelDB.cpp
+1
-1
SGXWalletServer.cpp
SGXWalletServer.cpp
+5
-3
testw.cpp
testw.cpp
+4
-5
No files found.
LevelDB.cpp
View file @
e0b46c47
...
@@ -95,7 +95,7 @@ void LevelDB::writeByteArray(std::string &_key, const char *value,
...
@@ -95,7 +95,7 @@ void LevelDB::writeByteArray(std::string &_key, const char *value,
void
LevelDB
::
throwExceptionOnError
(
Status
_status
)
{
void
LevelDB
::
throwExceptionOnError
(
Status
_status
)
{
if
(
_status
.
IsNotFound
())
if
(
_status
.
IsNotFound
())
return
;
return
;
git
if
(
!
_status
.
ok
())
{
if
(
!
_status
.
ok
())
{
throw
RPCException
(
COULD_NOT_ACCESS_DATABASE
,
(
"Could not access database database:"
+
_status
.
ToString
()).
c_str
());
throw
RPCException
(
COULD_NOT_ACCESS_DATABASE
,
(
"Could not access database database:"
+
_status
.
ToString
()).
c_str
());
}
}
...
...
SGXWalletServer.cpp
View file @
e0b46c47
...
@@ -137,13 +137,15 @@ Json::Value blsSignMessageHashImpl(const std::string& keyShareName, const std::s
...
@@ -137,13 +137,15 @@ Json::Value blsSignMessageHashImpl(const std::string& keyShareName, const std::s
try
{
try
{
value
=
readKeyShare
(
keyShareName
);
value
=
readKeyShare
(
keyShareName
);
}
catch
(
RPCException
&
_e
)
{
}
catch
(
RPCException
_e
)
{
result
[
"status"
]
=
_e
.
status
;
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
result
[
"errorMessage"
]
=
_e
.
errString
;
return
result
;
return
result
;
}
catch
(...)
{
}
catch
(...)
{
std
::
exception_ptr
p
=
std
::
current_exception
();
printf
(
"Exception %s
\n
"
,
p
.
__cxa_exception_type
()
->
name
());
result
[
"status"
]
=
-
1
;
result
[
"status"
]
=
-
1
;
result
[
"errorMessage"
]
=
"Read key share has thrown exception"
;
result
[
"errorMessage"
]
=
"Read key share has thrown exception
:
"
;
return
result
;
return
result
;
}
}
...
@@ -244,7 +246,7 @@ shared_ptr<string> readKeyShare(const string& _keyShareName) {
...
@@ -244,7 +246,7 @@ shared_ptr<string> readKeyShare(const string& _keyShareName) {
auto
keyShareStr
=
levelDb
->
readString
(
"BLSKEYSHARE:"
+
_keyShareName
);
auto
keyShareStr
=
levelDb
->
readString
(
"BLSKEYSHARE:"
+
_keyShareName
);
if
(
keyShareStr
==
nullptr
)
{
if
(
keyShareStr
==
nullptr
)
{
throw
new
RPCException
(
KEY_SHARE_DOES_NOT_EXIST
,
"Key share with this name does not exists"
);
throw
RPCException
(
KEY_SHARE_DOES_NOT_EXIST
,
"Key share with this name does not exists"
);
}
}
return
keyShareStr
;
return
keyShareStr
;
...
...
testw.cpp
View file @
e0b46c47
...
@@ -65,8 +65,6 @@ sgx_enclave_id_t eid;
...
@@ -65,8 +65,6 @@ sgx_enclave_id_t eid;
sgx_status_t
status
;
sgx_status_t
status
;
int
updated
;
int
updated
;
#define TEST_BLS_KEY_SHARE "4160780231445160889237664391382223604184857153814275770598791864649971919844"
#define TEST_BLS_KEY_SHARE "4160780231445160889237664391382223604184857153814275770598791864649971919844"
#define TEST_BLS_KEY_NAME "SCHAIN:17:INDEX:5:KEY:1"
#define TEST_BLS_KEY_NAME "SCHAIN:17:INDEX:5:KEY:1"
...
@@ -183,14 +181,15 @@ TEST_CASE("Server BLS sign test", "[bls-server-sign]") {
...
@@ -183,14 +181,15 @@ TEST_CASE("Server BLS sign test", "[bls-server-sign]") {
init_all
();
init_all
();
char
*
encryptedKeyHex
=
encryptTestKey
(
);
auto
result
=
importBLSKeyShareImpl
(
1
,
TEST_BLS_KEY_SHARE
,
TEST_BLS_KEY_NAME
,
2
,
2
);
REQUIRE
(
encryptedKeyHex
!=
nullptr
);
REQUIRE
(
result
[
"status"
]
==
0
);
REQUIRE
(
result
[
"encryptedKeyShare"
]
!=
""
);
const
char
*
hexHash
=
"001122334455667788"
"001122334455667788"
"001122334455667788"
"001122334455667788"
;
const
char
*
hexHash
=
"001122334455667788"
"001122334455667788"
"001122334455667788"
"001122334455667788"
;
Json
::
Value
result
;
REQUIRE_NOTHROW
(
result
=
blsSignMessageHashImpl
(
TEST_BLS_KEY_NAME
,
hexHash
));
REQUIRE_NOTHROW
(
result
=
blsSignMessageHashImpl
(
TEST_BLS_KEY_NAME
,
hexHash
));
...
...
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