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
0ec01653
Unverified
Commit
0ec01653
authored
Jun 09, 2020
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2002 refactoring
parent
50bc1bab
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
7 deletions
+9
-7
DKGCrypto.cpp
DKGCrypto.cpp
+0
-1
ECDSACrypto.cpp
ECDSACrypto.cpp
+0
-1
SGXWalletServer.cpp
SGXWalletServer.cpp
+2
-2
DHDkg.c
secure_enclave/DHDkg.c
+1
-1
testw.cpp
testw.cpp
+6
-2
No files found.
DKGCrypto.cpp
View file @
0ec01653
...
...
@@ -265,7 +265,6 @@ bool CreateBLSShare(const string &blsKeyName, const char *s_shares, const char *
trustedCreateBlsKeyAES
(
eid
,
&
errStatus
,
errMsg
,
s_shares
,
encr_key
,
decKeyLen
,
encr_bls_key
,
&
enc_bls_len
);
if
(
errStatus
!=
0
)
{
spdlog
::
error
(
errMsg
);
spdlog
::
error
(
"status {}"
,
errStatus
);
throw
SGXException
(
ERROR_IN_ENCLAVE
,
"Create BLS private key failed in enclave"
);
...
...
ECDSACrypto.cpp
View file @
0ec01653
...
...
@@ -82,7 +82,6 @@ vector <string> genECDSAKey() {
keys
.
at
(
0
)
=
hexEncrKey
.
data
();
keys
.
at
(
1
)
=
string
(
pub_key_x
.
data
())
+
string
(
pub_key_y
.
data
());
vector
<
unsigned
char
>
randBuffer
(
32
,
0
);
fillRandomBuffer
(
randBuffer
);
...
...
SGXWalletServer.cpp
View file @
0ec01653
...
...
@@ -557,11 +557,11 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string
if
(
!
check_n_t
(
_t
,
_n
))
{
throw
SGXException
(
INVALID_DKG_PARAMS
,
"Invalid DKG parameters: n or t "
);
}
vector
<
string
>
sshares_vect
;
vector
<
string
>
sshares_vect
;
spdlog
::
debug
(
"secret shares from json are - {}"
,
_secretShare
);
shared_ptr
<
string
>
encryptedKeyHex_ptr
=
readFromDb
(
_ethKeyName
);
shared_ptr
<
string
>
encryptedKeyHex_ptr
=
readFromDb
(
_ethKeyName
);
bool
res
=
CreateBLSShare
(
_blsKeyName
,
_secretShare
.
c_str
(),
encryptedKeyHex_ptr
->
c_str
());
if
(
res
)
{
...
...
secure_enclave/DHDkg.c
View file @
0ec01653
...
...
@@ -90,7 +90,7 @@ void session_key_recover(const char *skey_str, const char* sshare, char* common_
mpz_t
skey
;
mpz_init
(
skey
);
if
(
mpz_set_str
(
skey
,
skey_str
,
16
)
==
-
1
){
if
(
mpz_set_str
(
skey
,
skey_str
,
16
)
==
-
1
)
{
common_key
=
NULL
;
mpz_clear
(
skey
);
...
...
testw.cpp
View file @
0ec01653
...
...
@@ -201,9 +201,11 @@ void sendRPCRequest() {
int
dkgID
=
randGen
();
for
(
uint8_t
i
=
0
;
i
<
n
;
i
++
)
{
ethKeys
[
i
]
=
c
.
generateECDSAKey
();
REQUIRE
(
ethKeys
[
i
][
"status"
]
==
0
);
string
polyName
=
"POLY:SCHAIN_ID:"
+
to_string
(
schainID
)
+
":NODE_ID:"
+
to_string
(
i
)
+
":DKG_ID:"
+
to_string
(
dkgID
);
c
.
generateDKGPoly
(
polyName
,
t
);
auto
response
=
c
.
generateDKGPoly
(
polyName
,
t
);
REQUIRE
(
response
[
"status"
]
==
0
);
polyNames
[
i
]
=
polyName
;
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
,
n
);
REQUIRE
(
verifVects
[
i
][
"status"
]
==
0
);
...
...
@@ -230,6 +232,7 @@ void sendRPCRequest() {
string
secretShare
=
secretShares
[
i
][
"secretShare"
].
asString
().
substr
(
192
*
j
,
192
);
secShares
[
i
]
+=
secretShares
[
j
][
"secretShare"
].
asString
().
substr
(
192
*
i
,
192
);
Json
::
Value
verif
=
c
.
dkgVerification
(
pubShares
[
i
],
ethKeys
[
j
][
"keyName"
].
asString
(),
secretShare
,
t
,
n
,
j
);
REQUIRE
(
verif
[
"status"
]
==
0
);
k
++
;
}
...
...
@@ -251,7 +254,8 @@ void sendRPCRequest() {
string
blsName
=
"BLS_KEY"
+
polyNames
[
i
].
substr
(
4
);
string
secretShare
=
secretShares
[
i
][
"secretShare"
].
asString
();
c
.
createBLSPrivateKey
(
blsName
,
ethKeys
[
i
][
"keyName"
].
asString
(),
polyNames
[
i
],
secShares
[
i
],
t
,
n
);
auto
response
=
c
.
createBLSPrivateKey
(
blsName
,
ethKeys
[
i
][
"keyName"
].
asString
(),
polyNames
[
i
],
secShares
[
i
],
t
,
n
);
REQUIRE
(
response
[
"status"
]
==
0
);
pubBLSKeys
[
i
]
=
c
.
getBLSPublicKeyShare
(
blsName
);
string
hash
=
SAMPLE_HASH
;
...
...
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