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
6b72d7ca
Unverified
Commit
6b72d7ca
authored
Aug 24, 2020
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3007 add extra checks
parent
6ec88c9c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
SGXWalletServer.cpp
SGXWalletServer.cpp
+4
-3
SGXWalletServer.hpp
SGXWalletServer.hpp
+1
-1
No files found.
SGXWalletServer.cpp
View file @
6b72d7ca
...
@@ -193,7 +193,7 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
...
@@ -193,7 +193,7 @@ SGXWalletServer::importBLSKeyShareImpl(const string &_keyShare, const string &_k
result
[
"encryptedKeyShare"
]
=
encryptedKeyShareHex
;
result
[
"encryptedKeyShare"
]
=
encryptedKeyShareHex
;
writeKeyShare
(
_keyShareName
,
encryptedKeyShareHex
,
n
,
t
);
writeKeyShare
(
_keyShareName
,
encryptedKeyShareHex
);
}
HANDLE_SGX_EXCEPTION
(
result
)
}
HANDLE_SGX_EXCEPTION
(
result
)
RETURN_SUCCESS
(
result
);
RETURN_SUCCESS
(
result
);
...
@@ -459,7 +459,7 @@ Json::Value SGXWalletServer::dkgVerificationImpl(const string &_publicShares, co
...
@@ -459,7 +459,7 @@ Json::Value SGXWalletServer::dkgVerificationImpl(const string &_publicShares, co
if
(
!
checkECDSAKeyName
(
_ethKeyName
))
{
if
(
!
checkECDSAKeyName
(
_ethKeyName
))
{
throw
SGXException
(
INVALID_ECDSA_KEY_NAME
,
"Invalid ECDSA key name"
);
throw
SGXException
(
INVALID_ECDSA_KEY_NAME
,
"Invalid ECDSA key name"
);
}
}
if
(
!
check_n_t
(
_t
,
_n
)
||
_index
>
_n
||
_index
<
0
)
{
if
(
!
check_n_t
(
_t
,
_n
)
||
_index
>
=
_n
||
_index
<
0
)
{
throw
SGXException
(
INVALID_DKG_PARAMS
,
"Invalid DKG parameters: n or t "
);
throw
SGXException
(
INVALID_DKG_PARAMS
,
"Invalid DKG parameters: n or t "
);
}
}
if
(
!
checkHex
(
_secretShare
,
SECRET_SHARE_NUM_BYTES
))
{
if
(
!
checkHex
(
_secretShare
,
SECRET_SHARE_NUM_BYTES
))
{
...
@@ -549,6 +549,7 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int
...
@@ -549,6 +549,7 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int
if
(
!
checkName
(
_polyName
,
"POLY"
))
{
if
(
!
checkName
(
_polyName
,
"POLY"
))
{
throw
SGXException
(
INVALID_POLY_NAME
,
"Invalid polynomial name"
);
throw
SGXException
(
INVALID_POLY_NAME
,
"Invalid polynomial name"
);
}
}
string
shareG2_name
=
"shareG2_"
+
_polyName
+
"_"
+
to_string
(
_ind
)
+
":"
;
string
shareG2_name
=
"shareG2_"
+
_polyName
+
"_"
+
to_string
(
_ind
)
+
":"
;
shared_ptr
<
string
>
shareG2_ptr
=
readFromDb
(
shareG2_name
);
shared_ptr
<
string
>
shareG2_ptr
=
readFromDb
(
shareG2_name
);
...
@@ -715,7 +716,7 @@ shared_ptr <string> SGXWalletServer::readFromDb(const string &name, const string
...
@@ -715,7 +716,7 @@ shared_ptr <string> SGXWalletServer::readFromDb(const string &name, const string
return
dataStr
;
return
dataStr
;
}
}
void
SGXWalletServer
::
writeKeyShare
(
const
string
&
_keyShareName
,
const
string
&
_value
,
int
_n
,
int
_t
)
{
void
SGXWalletServer
::
writeKeyShare
(
const
string
&
_keyShareName
,
const
string
&
_value
)
{
if
(
LevelDB
::
getLevelDb
()
->
readString
(
_keyShareName
)
!=
nullptr
)
{
if
(
LevelDB
::
getLevelDb
()
->
readString
(
_keyShareName
)
!=
nullptr
)
{
throw
SGXException
(
KEY_SHARE_ALREADY_EXISTS
,
"Key share with this name already exists"
);
throw
SGXException
(
KEY_SHARE_ALREADY_EXISTS
,
"Key share with this name already exists"
);
}
}
...
...
SGXWalletServer.hpp
View file @
6b72d7ca
...
@@ -94,7 +94,7 @@ public:
...
@@ -94,7 +94,7 @@ public:
static
void
writeDataToDB
(
const
string
&
Name
,
const
string
&
value
);
static
void
writeDataToDB
(
const
string
&
Name
,
const
string
&
value
);
static
void
writeKeyShare
(
const
string
&
_keyShareName
,
const
string
&
_value
,
int
_n
,
int
_t
);
static
void
writeKeyShare
(
const
string
&
_keyShareName
,
const
string
&
_value
);
static
Json
::
Value
static
Json
::
Value
importBLSKeyShareImpl
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
,
int
t
,
int
n
);
importBLSKeyShareImpl
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
,
int
t
,
int
n
);
...
...
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