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
1c5b7a55
Unverified
Commit
1c5b7a55
authored
Jun 08, 2021
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3951 remove extra params
parent
32063a16
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
34 additions
and
37 deletions
+34
-37
DKGCrypto.cpp
DKGCrypto.cpp
+3
-3
DKGCrypto.h
DKGCrypto.h
+1
-1
SGXWalletServer.cpp
SGXWalletServer.cpp
+6
-6
SGXWalletServer.hpp
SGXWalletServer.hpp
+2
-2
TestUtils.cpp
TestUtils.cpp
+6
-6
abstractstubserver.h
abstractstubserver.h
+3
-3
secure_enclave.c
secure_enclave/secure_enclave.c
+2
-2
secure_enclave.edl
secure_enclave/secure_enclave.edl
+1
-2
stubclient.h
stubclient.h
+1
-2
testw.cpp
testw.cpp
+8
-8
ReqMessage.cpp
zmq_src/ReqMessage.cpp
+1
-2
No files found.
DKGCrypto.cpp
View file @
1c5b7a55
...
@@ -150,7 +150,7 @@ string gen_dkg_poly(int _t) {
...
@@ -150,7 +150,7 @@ string gen_dkg_poly(int _t) {
return
result
;
return
result
;
}
}
vector
<
vector
<
string
>>
get_verif_vect
(
const
string
&
encryptedPolyHex
,
int
t
,
int
n
)
{
vector
<
vector
<
string
>>
get_verif_vect
(
const
string
&
encryptedPolyHex
,
int
t
)
{
auto
encryptedPolyHexPtr
=
encryptedPolyHex
.
c_str
();
auto
encryptedPolyHexPtr
=
encryptedPolyHex
.
c_str
();
...
@@ -174,7 +174,7 @@ vector <vector<string>> get_verif_vect(const string &encryptedPolyHex, int t, in
...
@@ -174,7 +174,7 @@ vector <vector<string>> get_verif_vect(const string &encryptedPolyHex, int t, in
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
status
=
trustedGetPublicShares
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrDKGPoly
.
data
(),
encLen
,
status
=
trustedGetPublicShares
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrDKGPoly
.
data
(),
encLen
,
pubShares
.
data
(),
t
,
n
);
pubShares
.
data
(),
t
);
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg
.
data
());
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg
.
data
());
...
@@ -189,7 +189,7 @@ vector <vector<string>> get_verif_vect(const string &encryptedPolyHex, int t, in
...
@@ -189,7 +189,7 @@ vector <vector<string>> get_verif_vect(const string &encryptedPolyHex, int t, in
}
}
vector
<
vector
<
string
>>
getVerificationVectorMult
(
const
std
::
string
&
encryptedPolyHex
,
int
t
,
int
n
,
size_t
ind
)
{
vector
<
vector
<
string
>>
getVerificationVectorMult
(
const
std
::
string
&
encryptedPolyHex
,
int
t
,
int
n
,
size_t
ind
)
{
auto
verificationVector
=
get_verif_vect
(
encryptedPolyHex
,
t
,
n
);
auto
verificationVector
=
get_verif_vect
(
encryptedPolyHex
,
t
);
vector
<
vector
<
string
>>
result
(
t
);
vector
<
vector
<
string
>>
result
(
t
);
...
...
DKGCrypto.h
View file @
1c5b7a55
...
@@ -33,7 +33,7 @@ using namespace std;
...
@@ -33,7 +33,7 @@ using namespace std;
string
gen_dkg_poly
(
int
_t
);
string
gen_dkg_poly
(
int
_t
);
vector
<
vector
<
string
>>
get_verif_vect
(
const
string
&
encryptedPolyHex
,
int
t
,
int
n
);
vector
<
vector
<
string
>>
get_verif_vect
(
const
string
&
encryptedPolyHex
,
int
t
);
vector
<
vector
<
string
>>
getVerificationVectorMult
(
const
std
::
string
&
encryptedPolyHex
,
int
t
,
int
n
,
size_t
ind
);
vector
<
vector
<
string
>>
getVerificationVectorMult
(
const
std
::
string
&
encryptedPolyHex
,
int
t
,
int
n
,
size_t
ind
);
...
...
SGXWalletServer.cpp
View file @
1c5b7a55
...
@@ -501,7 +501,7 @@ Json::Value SGXWalletServer::generateDKGPolyImpl(const string &_polyName, int _t
...
@@ -501,7 +501,7 @@ Json::Value SGXWalletServer::generateDKGPolyImpl(const string &_polyName, int _t
RETURN_SUCCESS
(
result
)
RETURN_SUCCESS
(
result
)
}
}
Json
::
Value
SGXWalletServer
::
getVerificationVectorImpl
(
const
string
&
_polyName
,
int
_t
,
int
_n
)
{
Json
::
Value
SGXWalletServer
::
getVerificationVectorImpl
(
const
string
&
_polyName
,
int
_t
)
{
COUNT_STATISTICS
COUNT_STATISTICS
spdlog
::
info
(
"Entering {}"
,
__FUNCTION__
);
spdlog
::
info
(
"Entering {}"
,
__FUNCTION__
);
INIT_RESULT
(
result
)
INIT_RESULT
(
result
)
...
@@ -511,13 +511,13 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName,
...
@@ -511,13 +511,13 @@ Json::Value SGXWalletServer::getVerificationVectorImpl(const string &_polyName,
if
(
!
checkName
(
_polyName
,
"POLY"
))
{
if
(
!
checkName
(
_polyName
,
"POLY"
))
{
throw
SGXException
(
INVALID_DKG_GETVV_POLY_NAME
,
string
(
__FUNCTION__
)
+
":Invalid polynomial name"
);
throw
SGXException
(
INVALID_DKG_GETVV_POLY_NAME
,
string
(
__FUNCTION__
)
+
":Invalid polynomial name"
);
}
}
if
(
!
check_n_t
(
_t
,
_n
)
)
{
if
(
_t
<=
0
)
{
throw
SGXException
(
INVALID_DKG_GETVV_PARAMS
,
string
(
__FUNCTION__
)
+
":Invalid
parameters n or
t "
);
throw
SGXException
(
INVALID_DKG_GETVV_PARAMS
,
string
(
__FUNCTION__
)
+
":Invalid t "
);
}
}
shared_ptr
<
string
>
encrPoly
=
readFromDb
(
_polyName
);
shared_ptr
<
string
>
encrPoly
=
readFromDb
(
_polyName
);
verifVector
=
get_verif_vect
(
*
encrPoly
,
_t
,
_n
);
verifVector
=
get_verif_vect
(
*
encrPoly
,
_t
);
for
(
int
i
=
0
;
i
<
_t
;
i
++
)
{
for
(
int
i
=
0
;
i
<
_t
;
i
++
)
{
vector
<
string
>
currentCoef
=
verifVector
.
at
(
i
);
vector
<
string
>
currentCoef
=
verifVector
.
at
(
i
);
...
@@ -1000,8 +1000,8 @@ Json::Value SGXWalletServer::generateDKGPoly(const string &_polyName, int _t) {
...
@@ -1000,8 +1000,8 @@ Json::Value SGXWalletServer::generateDKGPoly(const string &_polyName, int _t) {
return
generateDKGPolyImpl
(
_polyName
,
_t
);
return
generateDKGPolyImpl
(
_polyName
,
_t
);
}
}
Json
::
Value
SGXWalletServer
::
getVerificationVector
(
const
string
&
_polynomeName
,
int
_t
,
int
_n
)
{
Json
::
Value
SGXWalletServer
::
getVerificationVector
(
const
string
&
_polynomeName
,
int
_t
)
{
return
getVerificationVectorImpl
(
_polynomeName
,
_t
,
_n
);
return
getVerificationVectorImpl
(
_polynomeName
,
_t
);
}
}
Json
::
Value
SGXWalletServer
::
getSecretShare
(
const
string
&
_polyName
,
const
Json
::
Value
&
_publicKeys
,
int
t
,
int
n
)
{
Json
::
Value
SGXWalletServer
::
getSecretShare
(
const
string
&
_polyName
,
const
Json
::
Value
&
_publicKeys
,
int
t
,
int
n
)
{
...
...
SGXWalletServer.hpp
View file @
1c5b7a55
...
@@ -82,7 +82,7 @@ public:
...
@@ -82,7 +82,7 @@ public:
virtual
Json
::
Value
generateDKGPoly
(
const
string
&
_polyName
,
int
_t
);
virtual
Json
::
Value
generateDKGPoly
(
const
string
&
_polyName
,
int
_t
);
virtual
Json
::
Value
getVerificationVector
(
const
string
&
_polynomeName
,
int
_t
,
int
_n
);
virtual
Json
::
Value
getVerificationVector
(
const
string
&
_polynomeName
,
int
_t
);
virtual
Json
::
Value
getSecretShare
(
const
string
&
_polyName
,
const
Json
::
Value
&
_publicKeys
,
int
t
,
int
n
);
virtual
Json
::
Value
getSecretShare
(
const
string
&
_polyName
,
const
Json
::
Value
&
_publicKeys
,
int
t
,
int
n
);
...
@@ -140,7 +140,7 @@ public:
...
@@ -140,7 +140,7 @@ public:
static
Json
::
Value
generateDKGPolyImpl
(
const
string
&
_polyName
,
int
_t
);
static
Json
::
Value
generateDKGPolyImpl
(
const
string
&
_polyName
,
int
_t
);
static
Json
::
Value
getVerificationVectorImpl
(
const
string
&
_polyName
,
int
_t
,
int
_n
);
static
Json
::
Value
getVerificationVectorImpl
(
const
string
&
_polyName
,
int
_t
);
static
Json
::
Value
getSecretShareImpl
(
const
string
&
_polyName
,
const
Json
::
Value
&
_pubKeys
,
int
_t
,
int
_n
);
static
Json
::
Value
getSecretShareImpl
(
const
string
&
_polyName
,
const
Json
::
Value
&
_pubKeys
,
int
_t
,
int
_n
);
...
...
TestUtils.cpp
View file @
1c5b7a55
...
@@ -197,7 +197,7 @@ void TestUtils::sendRPCRequest() {
...
@@ -197,7 +197,7 @@ void TestUtils::sendRPCRequest() {
polyNames
[
i
]
=
polyName
;
polyNames
[
i
]
=
polyName
;
for
(
int
i3
=
0
;
i3
<=
testCount
;
i3
++
)
{
for
(
int
i3
=
0
;
i3
<=
testCount
;
i3
++
)
{
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
,
n
);
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
);
CHECK_STATE
(
verifVects
[
i
][
"status"
]
==
0
);
CHECK_STATE
(
verifVects
[
i
][
"status"
]
==
0
);
}
}
...
@@ -317,7 +317,7 @@ void TestUtils::sendRPCRequestV2() {
...
@@ -317,7 +317,7 @@ void TestUtils::sendRPCRequestV2() {
auto
response
=
c
.
generateDKGPoly
(
polyName
,
t
);
auto
response
=
c
.
generateDKGPoly
(
polyName
,
t
);
CHECK_STATE
(
response
[
"status"
]
==
0
);
CHECK_STATE
(
response
[
"status"
]
==
0
);
polyNames
[
i
]
=
polyName
;
polyNames
[
i
]
=
polyName
;
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
,
n
);
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
);
CHECK_STATE
(
verifVects
[
i
][
"status"
]
==
0
);
CHECK_STATE
(
verifVects
[
i
][
"status"
]
==
0
);
pubEthKeys
.
append
(
ethKeys
[
i
][
"publicKey"
]);
pubEthKeys
.
append
(
ethKeys
[
i
][
"publicKey"
]);
...
@@ -421,7 +421,7 @@ void TestUtils::sendRPCRequestZMQ() {
...
@@ -421,7 +421,7 @@ void TestUtils::sendRPCRequestZMQ() {
auto
response
=
c
.
generateDKGPoly
(
polyName
,
t
);
auto
response
=
c
.
generateDKGPoly
(
polyName
,
t
);
CHECK_STATE
(
response
[
"status"
]
==
0
);
CHECK_STATE
(
response
[
"status"
]
==
0
);
polyNames
[
i
]
=
polyName
;
polyNames
[
i
]
=
polyName
;
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
,
n
);
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
);
CHECK_STATE
(
verifVects
[
i
][
"status"
]
==
0
);
CHECK_STATE
(
verifVects
[
i
][
"status"
]
==
0
);
pubEthKeys
.
append
(
ethKeys
[
i
][
"publicKey"
]);
pubEthKeys
.
append
(
ethKeys
[
i
][
"publicKey"
]);
...
@@ -519,7 +519,7 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
...
@@ -519,7 +519,7 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
Json
::
Value
response
=
c
.
generateDKGPoly
(
polyName
,
t
);
Json
::
Value
response
=
c
.
generateDKGPoly
(
polyName
,
t
);
CHECK_STATE
(
response
[
"status"
]
==
0
);
CHECK_STATE
(
response
[
"status"
]
==
0
);
polyNames
[
i
]
=
polyName
;
polyNames
[
i
]
=
polyName
;
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
,
n
);
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
);
CHECK_STATE
(
verifVects
[
i
][
"status"
]
==
0
);
CHECK_STATE
(
verifVects
[
i
][
"status"
]
==
0
);
pubEthKeys
.
append
(
ethKeys
[
i
][
"publicKey"
]);
pubEthKeys
.
append
(
ethKeys
[
i
][
"publicKey"
]);
}
}
...
@@ -660,7 +660,7 @@ void TestUtils::doDKGV2(StubClient &c, int n, int t,
...
@@ -660,7 +660,7 @@ void TestUtils::doDKGV2(StubClient &c, int n, int t,
Json
::
Value
response
=
c
.
generateDKGPoly
(
polyName
,
t
);
Json
::
Value
response
=
c
.
generateDKGPoly
(
polyName
,
t
);
CHECK_STATE
(
response
[
"status"
]
==
0
);
CHECK_STATE
(
response
[
"status"
]
==
0
);
polyNames
[
i
]
=
polyName
;
polyNames
[
i
]
=
polyName
;
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
,
n
);
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
);
CHECK_STATE
(
verifVects
[
i
][
"status"
]
==
0
);
CHECK_STATE
(
verifVects
[
i
][
"status"
]
==
0
);
pubEthKeys
.
append
(
ethKeys
[
i
][
"publicKey"
]);
pubEthKeys
.
append
(
ethKeys
[
i
][
"publicKey"
]);
}
}
...
@@ -802,7 +802,7 @@ void TestUtils::doZMQBLS(shared_ptr<ZMQClient> _zmqClient, StubClient &c, int n,
...
@@ -802,7 +802,7 @@ void TestUtils::doZMQBLS(shared_ptr<ZMQClient> _zmqClient, StubClient &c, int n,
Json
::
Value
response
=
c
.
generateDKGPoly
(
polyName
,
t
);
Json
::
Value
response
=
c
.
generateDKGPoly
(
polyName
,
t
);
CHECK_STATE
(
response
[
"status"
]
==
0
);
CHECK_STATE
(
response
[
"status"
]
==
0
);
polyNames
[
i
]
=
polyName
;
polyNames
[
i
]
=
polyName
;
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
,
n
);
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
);
CHECK_STATE
(
verifVects
[
i
][
"status"
]
==
0
);
CHECK_STATE
(
verifVects
[
i
][
"status"
]
==
0
);
pubEthKeys
.
append
(
ethKeys
[
i
][
"publicKey"
]);
pubEthKeys
.
append
(
ethKeys
[
i
][
"publicKey"
]);
}
}
...
...
abstractstubserver.h
View file @
1c5b7a55
...
@@ -45,7 +45,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
...
@@ -45,7 +45,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"ecdsaSignMessageHash"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"base"
,
jsonrpc
::
JSON_INTEGER
,
"keyName"
,
jsonrpc
::
JSON_STRING
,
"messageHash"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
ecdsaSignMessageHashI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"ecdsaSignMessageHash"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"base"
,
jsonrpc
::
JSON_INTEGER
,
"keyName"
,
jsonrpc
::
JSON_STRING
,
"messageHash"
,
jsonrpc
::
JSON_STRING
,
NULL
),
&
AbstractStubServer
::
ecdsaSignMessageHashI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"generateDKGPoly"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"polyName"
,
jsonrpc
::
JSON_STRING
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
generateDKGPolyI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"generateDKGPoly"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"polyName"
,
jsonrpc
::
JSON_STRING
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
generateDKGPolyI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"getVerificationVector"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"polyName"
,
jsonrpc
::
JSON_STRING
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
getVerificationVectorI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"getVerificationVector"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"polyName"
,
jsonrpc
::
JSON_STRING
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
getVerificationVectorI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"getSecretShare"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"polyName"
,
jsonrpc
::
JSON_STRING
,
"publicKeys"
,
jsonrpc
::
JSON_ARRAY
,
"n"
,
jsonrpc
::
JSON_INTEGER
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
getSecretShareI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"getSecretShare"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"polyName"
,
jsonrpc
::
JSON_STRING
,
"publicKeys"
,
jsonrpc
::
JSON_ARRAY
,
"n"
,
jsonrpc
::
JSON_INTEGER
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
getSecretShareI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"dkgVerification"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"publicShares"
,
jsonrpc
::
JSON_STRING
,
"ethKeyName"
,
jsonrpc
::
JSON_STRING
,
"secretShare"
,
jsonrpc
::
JSON_STRING
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
"n"
,
jsonrpc
::
JSON_INTEGER
,
"index"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
dkgVerificationI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"dkgVerification"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"publicShares"
,
jsonrpc
::
JSON_STRING
,
"ethKeyName"
,
jsonrpc
::
JSON_STRING
,
"secretShare"
,
jsonrpc
::
JSON_STRING
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
"n"
,
jsonrpc
::
JSON_INTEGER
,
"index"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
dkgVerificationI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"createBLSPrivateKey"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"blsKeyName"
,
jsonrpc
::
JSON_STRING
,
"ethKeyName"
,
jsonrpc
::
JSON_STRING
,
"polyName"
,
jsonrpc
::
JSON_STRING
,
"secretShare"
,
jsonrpc
::
JSON_STRING
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
"n"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
createBLSPrivateKeyI
);
this
->
bindAndAddMethod
(
jsonrpc
::
Procedure
(
"createBLSPrivateKey"
,
jsonrpc
::
PARAMS_BY_NAME
,
jsonrpc
::
JSON_OBJECT
,
"blsKeyName"
,
jsonrpc
::
JSON_STRING
,
"ethKeyName"
,
jsonrpc
::
JSON_STRING
,
"polyName"
,
jsonrpc
::
JSON_STRING
,
"secretShare"
,
jsonrpc
::
JSON_STRING
,
"t"
,
jsonrpc
::
JSON_INTEGER
,
"n"
,
jsonrpc
::
JSON_INTEGER
,
NULL
),
&
AbstractStubServer
::
createBLSPrivateKeyI
);
...
@@ -97,7 +97,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
...
@@ -97,7 +97,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
}
}
inline
virtual
void
getVerificationVectorI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
inline
virtual
void
getVerificationVectorI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
{
response
=
this
->
getVerificationVector
(
request
[
"polyName"
].
asString
(),
request
[
"t"
].
asInt
()
,
request
[
"n"
].
asInt
()
);
response
=
this
->
getVerificationVector
(
request
[
"polyName"
].
asString
(),
request
[
"t"
].
asInt
());
}
}
inline
virtual
void
getSecretShareI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
inline
virtual
void
getSecretShareI
(
const
Json
::
Value
&
request
,
Json
::
Value
&
response
)
{
{
...
@@ -169,7 +169,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
...
@@ -169,7 +169,7 @@ class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
virtual
Json
::
Value
ecdsaSignMessageHash
(
int
base
,
const
std
::
string
&
keyName
,
const
std
::
string
&
messageHash
)
=
0
;
virtual
Json
::
Value
ecdsaSignMessageHash
(
int
base
,
const
std
::
string
&
keyName
,
const
std
::
string
&
messageHash
)
=
0
;
virtual
Json
::
Value
generateDKGPoly
(
const
std
::
string
&
polyName
,
int
t
)
=
0
;
virtual
Json
::
Value
generateDKGPoly
(
const
std
::
string
&
polyName
,
int
t
)
=
0
;
virtual
Json
::
Value
getVerificationVector
(
const
std
::
string
&
polyName
,
int
t
,
int
n
)
=
0
;
virtual
Json
::
Value
getVerificationVector
(
const
std
::
string
&
polyName
,
int
t
)
=
0
;
virtual
Json
::
Value
getSecretShare
(
const
std
::
string
&
polyName
,
const
Json
::
Value
&
publicKeys
,
int
t
,
int
n
)
=
0
;
virtual
Json
::
Value
getSecretShare
(
const
std
::
string
&
polyName
,
const
Json
::
Value
&
publicKeys
,
int
t
,
int
n
)
=
0
;
virtual
Json
::
Value
dkgVerification
(
const
std
::
string
&
publicShares
,
const
std
::
string
&
ethKeyName
,
const
std
::
string
&
SecretShare
,
int
t
,
int
n
,
int
index
)
=
0
;
virtual
Json
::
Value
dkgVerification
(
const
std
::
string
&
publicShares
,
const
std
::
string
&
ethKeyName
,
const
std
::
string
&
SecretShare
,
int
t
,
int
n
,
int
index
)
=
0
;
virtual
Json
::
Value
createBLSPrivateKey
(
const
std
::
string
&
blsKeyName
,
const
std
::
string
&
ethKeyName
,
const
std
::
string
&
polyName
,
const
std
::
string
&
SecretShare
,
int
t
,
int
n
)
=
0
;
virtual
Json
::
Value
createBLSPrivateKey
(
const
std
::
string
&
blsKeyName
,
const
std
::
string
&
ethKeyName
,
const
std
::
string
&
polyName
,
const
std
::
string
&
SecretShare
,
int
t
,
int
n
)
=
0
;
...
...
secure_enclave/secure_enclave.c
View file @
1c5b7a55
...
@@ -987,14 +987,14 @@ void trustedGetEncryptedSecretShareV2(int *errStatus, char *errString,
...
@@ -987,14 +987,14 @@ void trustedGetEncryptedSecretShareV2(int *errStatus, char *errString,
void
trustedGetPublicShares
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_dkg_secret
,
uint64_t
enc_len
,
void
trustedGetPublicShares
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_dkg_secret
,
uint64_t
enc_len
,
char
*
public_shares
,
char
*
public_shares
,
unsigned
_t
,
unsigned
_n
)
{
unsigned
_t
)
{
LOG_INFO
(
__FUNCTION__
);
LOG_INFO
(
__FUNCTION__
);
INIT_ERROR_STATE
INIT_ERROR_STATE
CHECK_STATE
(
encrypted_dkg_secret
);
CHECK_STATE
(
encrypted_dkg_secret
);
CHECK_STATE
(
public_shares
);
CHECK_STATE
(
public_shares
);
CHECK_STATE
(
_t
<=
_n
&&
_n
>
0
)
CHECK_STATE
(
_t
>
0
)
SAFE_CHAR_BUF
(
decrypted_dkg_secret
,
DKG_MAX_SEALED_LEN
);
SAFE_CHAR_BUF
(
decrypted_dkg_secret
,
DKG_MAX_SEALED_LEN
);
...
...
secure_enclave/secure_enclave.edl
View file @
1c5b7a55
...
@@ -121,8 +121,7 @@ enclave {
...
@@ -121,8 +121,7 @@ enclave {
[in, count = 3050] uint8_t* encrypted_dkg_secret,
[in, count = 3050] uint8_t* encrypted_dkg_secret,
uint64_t enc_len,
uint64_t enc_len,
[out, count = 10000] char* public_shares,
[out, count = 10000] char* public_shares,
unsigned _t,
unsigned _t);
unsigned _n);
public void trustedDkgVerify(
public void trustedDkgVerify(
[out] int *errStatus,
[out] int *errStatus,
...
...
stubclient.h
View file @
1c5b7a55
...
@@ -98,11 +98,10 @@ class StubClient : public jsonrpc::Client
...
@@ -98,11 +98,10 @@ class StubClient : public jsonrpc::Client
throw
jsonrpc
::
JsonRpcException
(
jsonrpc
::
Errors
::
ERROR_CLIENT_INVALID_RESPONSE
,
result
.
toStyledString
());
throw
jsonrpc
::
JsonRpcException
(
jsonrpc
::
Errors
::
ERROR_CLIENT_INVALID_RESPONSE
,
result
.
toStyledString
());
}
}
Json
::
Value
getVerificationVector
(
const
std
::
string
&
polyName
,
int
t
,
int
n
)
Json
::
Value
getVerificationVector
(
const
std
::
string
&
polyName
,
int
t
)
{
{
Json
::
Value
p
;
Json
::
Value
p
;
p
[
"polyName"
]
=
polyName
;
p
[
"polyName"
]
=
polyName
;
p
[
"n"
]
=
n
;
p
[
"t"
]
=
t
;
p
[
"t"
]
=
t
;
Json
::
Value
result
=
this
->
CallMethod
(
"getVerificationVector"
,
p
);
Json
::
Value
result
=
this
->
CallMethod
(
"getVerificationVector"
,
p
);
if
(
result
.
isObject
())
if
(
result
.
isObject
())
...
...
testw.cpp
View file @
1c5b7a55
...
@@ -336,7 +336,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES public shares test", "[dkg-aes-pub-shares
...
@@ -336,7 +336,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES public shares test", "[dkg-aes-pub-shares
vector
<
char
>
pubShares
(
10000
,
0
);
vector
<
char
>
pubShares
(
10000
,
0
);
PRINT_SRC_LINE
PRINT_SRC_LINE
status
=
trustedGetPublicShares
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
status
=
trustedGetPublicShares
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
encLen
,
pubShares
.
data
(),
t
,
n
);
encryptedDKGSecret
.
data
(),
encLen
,
pubShares
.
data
(),
t
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
...
@@ -659,7 +659,7 @@ TEST_CASE_METHOD(TestFixture, "DKG API V2 test", "[dkg-api-v2]") {
...
@@ -659,7 +659,7 @@ TEST_CASE_METHOD(TestFixture, "DKG API V2 test", "[dkg-api-v2]") {
Json
::
Value
genPolyWrongName
=
c
.
generateDKGPoly
(
"poly"
,
2
);
Json
::
Value
genPolyWrongName
=
c
.
generateDKGPoly
(
"poly"
,
2
);
REQUIRE
(
genPolyWrongName
[
"status"
].
asInt
()
!=
0
);
REQUIRE
(
genPolyWrongName
[
"status"
].
asInt
()
!=
0
);
Json
::
Value
verifVectWrongName
=
c
.
getVerificationVector
(
"poly"
,
2
,
2
);
Json
::
Value
verifVectWrongName
=
c
.
getVerificationVector
(
"poly"
,
2
);
REQUIRE
(
verifVectWrongName
[
"status"
].
asInt
()
!=
0
);
REQUIRE
(
verifVectWrongName
[
"status"
].
asInt
()
!=
0
);
Json
::
Value
secretSharesWrongName
=
c
.
getSecretShareV2
(
"poly"
,
publicKeys
,
2
,
2
);
Json
::
Value
secretSharesWrongName
=
c
.
getSecretShareV2
(
"poly"
,
publicKeys
,
2
,
2
);
...
@@ -669,14 +669,14 @@ TEST_CASE_METHOD(TestFixture, "DKG API V2 test", "[dkg-api-v2]") {
...
@@ -669,14 +669,14 @@ TEST_CASE_METHOD(TestFixture, "DKG API V2 test", "[dkg-api-v2]") {
Json
::
Value
genPolyWrong_t
=
c
.
generateDKGPoly
(
polyName
,
33
);
Json
::
Value
genPolyWrong_t
=
c
.
generateDKGPoly
(
polyName
,
33
);
REQUIRE
(
genPolyWrong_t
[
"status"
].
asInt
()
!=
0
);
REQUIRE
(
genPolyWrong_t
[
"status"
].
asInt
()
!=
0
);
Json
::
Value
verifVectWrong_t
=
c
.
getVerificationVector
(
polyName
,
1
,
2
);
Json
::
Value
verifVectWrong_t
=
c
.
getVerificationVector
(
polyName
,
1
);
REQUIRE
(
verifVectWrong_t
[
"status"
].
asInt
()
!=
0
);
REQUIRE
(
verifVectWrong_t
[
"status"
].
asInt
()
!=
0
);
Json
::
Value
secretSharesWrong_t
=
c
.
getSecretShareV2
(
polyName
,
publicKeys
,
3
,
3
);
Json
::
Value
secretSharesWrong_t
=
c
.
getSecretShareV2
(
polyName
,
publicKeys
,
3
,
3
);
REQUIRE
(
secretSharesWrong_t
[
"status"
].
asInt
()
!=
0
);
REQUIRE
(
secretSharesWrong_t
[
"status"
].
asInt
()
!=
0
);
// wrong_n
// wrong_n
Json
::
Value
verifVectWrong_n
=
c
.
getVerificationVector
(
polyName
,
2
,
1
);
Json
::
Value
verifVectWrong_n
=
c
.
getVerificationVector
(
polyName
,
2
);
REQUIRE
(
verifVectWrong_n
[
"status"
].
asInt
()
!=
0
);
REQUIRE
(
verifVectWrong_n
[
"status"
].
asInt
()
!=
0
);
Json
::
Value
publicKeys1
;
Json
::
Value
publicKeys1
;
...
@@ -693,9 +693,9 @@ TEST_CASE_METHOD(TestFixture, "DKG API V2 test", "[dkg-api-v2]") {
...
@@ -693,9 +693,9 @@ TEST_CASE_METHOD(TestFixture, "DKG API V2 test", "[dkg-api-v2]") {
REQUIRE_NOTHROW
(
c
.
getSecretShare
(
polyName
,
publicKeys
,
2
,
2
));
REQUIRE_NOTHROW
(
c
.
getSecretShare
(
polyName
,
publicKeys
,
2
,
2
));
REQUIRE
(
Skeys
==
c
.
getSecretShare
(
polyName
,
publicKeys
,
2
,
2
));
REQUIRE
(
Skeys
==
c
.
getSecretShare
(
polyName
,
publicKeys
,
2
,
2
));
Json
::
Value
verifVect
=
c
.
getVerificationVector
(
polyName
,
2
,
2
);
Json
::
Value
verifVect
=
c
.
getVerificationVector
(
polyName
,
2
);
REQUIRE_NOTHROW
(
c
.
getVerificationVector
(
polyName
,
2
,
2
));
REQUIRE_NOTHROW
(
c
.
getVerificationVector
(
polyName
,
2
));
REQUIRE
(
verifVect
==
c
.
getVerificationVector
(
polyName
,
2
,
2
));
REQUIRE
(
verifVect
==
c
.
getVerificationVector
(
polyName
,
2
));
Json
::
Value
verificationWrongSkeys
=
c
.
dkgVerificationV2
(
""
,
""
,
""
,
2
,
2
,
1
);
Json
::
Value
verificationWrongSkeys
=
c
.
dkgVerificationV2
(
""
,
""
,
""
,
2
,
2
,
1
);
REQUIRE
(
verificationWrongSkeys
[
"status"
].
asInt
()
!=
0
);
REQUIRE
(
verificationWrongSkeys
[
"status"
].
asInt
()
!=
0
);
...
@@ -762,7 +762,7 @@ TEST_CASE_METHOD(TestFixture, "AES_DKG V2 test", "[aes-dkg-v2]") {
...
@@ -762,7 +762,7 @@ TEST_CASE_METHOD(TestFixture, "AES_DKG V2 test", "[aes-dkg-v2]") {
polyNames
[
i
]
=
polyName
;
polyNames
[
i
]
=
polyName
;
PRINT_SRC_LINE
PRINT_SRC_LINE
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
,
n
);
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
);
REQUIRE
(
verifVects
[
i
][
"status"
]
==
0
);
REQUIRE
(
verifVects
[
i
][
"status"
]
==
0
);
pubEthKeys
.
append
(
ethKeys
[
i
][
"publicKey"
]);
pubEthKeys
.
append
(
ethKeys
[
i
][
"publicKey"
]);
...
...
zmq_src/ReqMessage.cpp
View file @
1c5b7a55
...
@@ -86,8 +86,7 @@ Json::Value generateDKGPolyReqMessage::process() {
...
@@ -86,8 +86,7 @@ Json::Value generateDKGPolyReqMessage::process() {
Json
::
Value
getVerificationVectorReqMessage
::
process
()
{
Json
::
Value
getVerificationVectorReqMessage
::
process
()
{
auto
polyName
=
getStringRapid
(
"polyName"
);
auto
polyName
=
getStringRapid
(
"polyName"
);
auto
t
=
getInt64Rapid
(
"t"
);
auto
t
=
getInt64Rapid
(
"t"
);
auto
n
=
getInt64Rapid
(
"n"
);
auto
result
=
SGXWalletServer
::
getVerificationVectorImpl
(
polyName
,
t
);
auto
result
=
SGXWalletServer
::
getVerificationVectorImpl
(
polyName
,
t
,
n
);
result
[
"type"
]
=
ZMQMessage
::
GET_VV_RSP
;
result
[
"type"
]
=
ZMQMessage
::
GET_VV_RSP
;
return
result
;
return
result
;
}
}
...
...
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