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
8bb6847a
Unverified
Commit
8bb6847a
authored
Oct 02, 2020
by
Oleh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3334 add verificationVectorMult to response
parent
e075e5eb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
3 deletions
+40
-3
DKGCrypto.cpp
DKGCrypto.cpp
+26
-2
DKGCrypto.h
DKGCrypto.h
+2
-0
SGXWalletServer.cpp
SGXWalletServer.cpp
+12
-1
No files found.
DKGCrypto.cpp
View file @
8bb6847a
...
...
@@ -182,15 +182,39 @@ vector <vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg
.
data
());
vector
<
string
>
g2Strings
=
splitString
(
pubShares
.
data
(),
','
);
vector
<
vector
<
string
>>
pubSharesVect
;
vector
<
vector
<
string
>>
pubSharesVect
(
t
)
;
for
(
uint64_t
i
=
0
;
i
<
g2Strings
.
size
();
i
++
)
{
vector
<
string
>
coeffStr
=
splitString
(
g2Strings
.
at
(
i
).
c_str
(),
':'
);
pubSharesVect
.
push_back
(
coeffStr
)
;
pubSharesVect
[
i
]
=
coeffStr
;
}
return
pubSharesVect
;
}
vector
<
vector
<
string
>>
getVerificationVectorMult
(
const
std
::
string
&
encryptedPolyHex
,
int
t
,
int
n
,
size_t
ind
)
{
auto
verificationVector
=
get_verif_vect
(
encryptedPolyHex
.
c_str
(),
t
,
n
);
vector
<
vector
<
string
>>
result
(
t
);
for
(
size_t
i
=
0
;
i
<
t
;
++
i
)
{
libff
::
alt_bn128_G2
current_coefficient
;
current_coefficient
.
X
.
c0
=
libff
::
alt_bn128_Fq
(
verificationVector
[
i
][
0
]);
current_coefficient
.
X
.
c1
=
libff
::
alt_bn128_Fq
(
verificationVector
[
i
][
1
]);
current_coefficient
.
Y
.
c0
=
libff
::
alt_bn128_Fq
(
verificationVector
[
i
][
2
]);
current_coefficient
.
Y
.
c1
=
libff
::
alt_bn128_Fq
(
verificationVector
[
i
][
3
]);
current_coefficient
.
Z
=
libff
::
alt_bn128_Fq2
::
one
();
current_coefficient
=
current_coefficient
*
libff
::
power
(
libff
::
alt_bn128_Fr
(
ind
+
1
),
i
);
current_coefficient
.
to_affine_coordinates
();
auto
g2_str
=
convertG2ToString
(
current_coefficient
);
result
[
i
]
=
splitString
(
g2_str
.
c_str
(),
':'
);
}
return
result
;
}
string
getSecretShares
(
const
string
&
_polyName
,
const
char
*
_encryptedPolyHex
,
const
vector
<
string
>
&
_publicKeys
,
int
_t
,
...
...
DKGCrypto.h
View file @
8bb6847a
...
...
@@ -35,6 +35,8 @@ string gen_dkg_poly( int _t);
vector
<
vector
<
string
>>
get_verif_vect
(
const
char
*
encryptedPolyHex
,
int
t
,
int
n
);
vector
<
vector
<
string
>>
getVerificationVectorMult
(
const
std
::
string
&
encryptedPolyHex
,
int
t
,
int
n
,
size_t
ind
);
vector
<
string
>
splitString
(
const
char
*
coeffs
,
const
char
symbol
);
string
getSecretShares
(
const
string
&
_polyName
,
const
char
*
_encryptedPolyHex
,
const
vector
<
string
>&
_publicKeys
,
int
_t
,
int
_n
);
...
...
SGXWalletServer.cpp
View file @
8bb6847a
...
...
@@ -388,7 +388,7 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName,
shared_ptr
<
string
>
encrPoly
=
readFromDb
(
_polyName
);
verifVector
=
get_verif_vect
(
encrPoly
->
c_str
(),
_t
,
_n
);
verifVector
=
get_verif_vect
(
encrPoly
.
get
(),
_t
,
_n
);
for
(
int
i
=
0
;
i
<
_t
;
i
++
)
{
vector
<
string
>
currentCoef
=
verifVector
.
at
(
i
);
...
...
@@ -603,6 +603,17 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int
result
[
"share*G2"
]
=
*
shareG2_ptr
;
result
[
"dhKey"
]
=
DHKey
;
shared_ptr
<
string
>
encrPoly
=
readFromDb
(
_polyName
);
verificationVectorMult
=
getVerificationVectorMult
(
encrPoly
->
c_str
(),
_t
,
_n
,
ind
);
for
(
int
i
=
0
;
i
<
_t
;
i
++
)
{
vector
<
string
>
currentCoef
=
verifVector
.
at
(
i
);
for
(
int
j
=
0
;
j
<
4
;
j
++
)
{
result
[
"verificationVectorMult"
][
i
][
j
]
=
currentCoef
.
at
(
j
);
}
}
// TODO: delete dh keys
// for (int i = 0; i < _n; i++) {
// string name = _polyName + "_" + to_string(i) + ":";
...
...
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