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
dcb4a1d4
Unverified
Commit
dcb4a1d4
authored
Sep 16, 2020
by
Stan Kladko
Committed by
GitHub
Sep 16, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into SKALE-3283-resubmit-to-intel
parents
29d45313
c9571c8d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
10 deletions
+45
-10
DKGCrypto.cpp
DKGCrypto.cpp
+4
-3
Makefile.am
Makefile.am
+1
-1
SGXWalletServer.cpp
SGXWalletServer.cpp
+31
-5
SGXWalletServer.hpp
SGXWalletServer.hpp
+2
-0
VERSION
VERSION
+1
-1
testw.cpp
testw.cpp
+6
-0
No files found.
DKGCrypto.cpp
View file @
dcb4a1d4
...
...
@@ -250,17 +250,18 @@ getSecretShares(const string &_polyName, const char *_encryptedPolyHex, const ve
spdlog
::
debug
(
"hexEncr DH Key: { }"
,
hexEncrKey
.
data
());
spdlog
::
debug
(
"name to write to db is {}"
,
dhKeyName
);
SGXWalletServer
::
writeDataToDB
(
dhKeyName
,
hexEncrKey
.
data
());
string
shareG2_name
=
"shareG2_"
+
_polyName
+
"_"
+
to_string
(
i
)
+
":"
;
spdlog
::
debug
(
"name to write to db is {}"
,
shareG2_name
);
spdlog
::
debug
(
"s_shareG2: {}"
,
sShareG2
.
data
());
SGXWalletServer
::
writeDataToDB
(
dhKeyName
,
hexEncrKey
.
data
());
SGXWalletServer
::
writeDataToDB
(
shareG2_name
,
sShareG2
.
data
());
}
string
encryptedSecretShareName
=
"encryptedSecretShare:"
+
_polyName
;
SGXWalletServer
::
writeDataToDB
(
encryptedSecretShareName
,
result
);
return
result
;
}
...
...
Makefile.am
View file @
dcb4a1d4
...
...
@@ -103,7 +103,7 @@ sgxwallet_LDADD=-l$(SGX_URTS_LIB) -l$(SGX_UAE_SERVICE_LIB) -LlibBLS/deps/deps_in
-l
:libbls.a
-l
:libleveldb.a
\
-l
:libff.a
-lgmp
-ldl
-l
:libsgx_capable.a
-l
:libsgx_tprotected_fs.a
\
-ljsonrpccpp-stub
-ljsonrpccpp-server
-ljsonrpccpp-client
-ljsonrpccpp-common
-ljsoncpp
-lmicrohttpd
\
-lboost_system
-lboost_thread
-lgnutls
-lgcrypt
-lcurl
-lssl
-lcrypto
-lz
-lpthread
-lstdc
++fs
-lboost_system
-lboost_thread
-lgnutls
-lgcrypt
-lcurl
-lssl
-lcrypto
-lz
-lpthread
-lstdc
++fs
testw_SOURCES
=
testw.cpp
$(COMMON_SRC)
...
...
SGXWalletServer.cpp
View file @
dcb4a1d4
...
...
@@ -406,7 +406,6 @@ Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const J
spdlog
::
info
(
"Entering {}"
,
__FUNCTION__
);
INIT_RESULT
(
result
);
result
[
"secretShare"
]
=
""
;
result
[
"SecretShare"
]
=
""
;
try
{
if
(
_pubKeys
.
size
()
!=
(
uint64_t
)
_n
)
{
...
...
@@ -429,9 +428,15 @@ Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const J
pubKeysStrs
.
push_back
(
_pubKeys
[
i
].
asString
());
}
string
s
=
getSecretShares
(
_polyName
,
encrPoly
->
c_str
(),
pubKeysStrs
,
_t
,
_n
);
result
[
"secretShare"
]
=
s
;
result
[
"SecretShare"
]
=
s
;
string
secret_share_name
=
"encryptedSecretShare:"
+
_polyName
;
shared_ptr
<
string
>
encryptedSecretShare
=
checkDataFromDb
(
secret_share_name
);
if
(
encryptedSecretShare
!=
nullptr
)
{
result
[
"secretShare"
]
=
*
encryptedSecretShare
.
get
();
}
else
{
string
s
=
getSecretShares
(
_polyName
,
encrPoly
->
c_str
(),
pubKeysStrs
,
_t
,
_n
);
result
[
"secretShare"
]
=
s
;
}
}
HANDLE_SGX_EXCEPTION
(
result
)
RETURN_SUCCESS
(
result
)
...
...
@@ -508,6 +513,9 @@ SGXWalletServer::createBLSPrivateKeyImpl(const string &_blsKeyName, const string
}
LevelDB
::
getLevelDb
()
->
deleteKey
(
_polyName
);
string
encryptedSecretShareName
=
"encryptedSecretShare:"
+
_polyName
;
LevelDB
::
getLevelDb
()
->
deleteKey
(
encryptedSecretShareName
);
}
HANDLE_SGX_EXCEPTION
(
result
)
RETURN_SUCCESS
(
result
);
...
...
@@ -594,6 +602,18 @@ Json::Value SGXWalletServer::complaintResponseImpl(const string &_polyName, int
result
[
"share*G2"
]
=
*
shareG2_ptr
;
result
[
"dhKey"
]
=
DHKey
;
// TODO: delete dh keys
// for (int i = 0; i < _n; i++) {
// string name = _polyName + "_" + to_string(i) + ":";
// LevelDB::getLevelDb()->deleteDHDKGKey(name);
// string shareG2_name = "shareG2_" + _polyName + "_" + to_string(i) + ":";
// LevelDB::getLevelDb()->deleteKey(shareG2_name);
// }
LevelDB
::
getLevelDb
()
->
deleteKey
(
_polyName
);
string
encryptedSecretShareName
=
"encryptedSecretShare:"
+
_polyName
;
LevelDB
::
getLevelDb
()
->
deleteKey
(
encryptedSecretShareName
);
}
HANDLE_SGX_EXCEPTION
(
result
)
RETURN_SUCCESS
(
result
);
...
...
@@ -742,7 +762,7 @@ Json::Value SGXWalletServer::deleteBlsKey(const string &name) {
}
shared_ptr
<
string
>
SGXWalletServer
::
readFromDb
(
const
string
&
name
,
const
string
&
prefix
)
{
auto
dataStr
=
LevelDB
::
getLevelDb
()
->
readString
(
prefix
+
name
);
auto
dataStr
=
checkDataFromDb
(
prefix
+
name
);
if
(
dataStr
==
nullptr
)
{
throw
SGXException
(
KEY_SHARE_DOES_NOT_EXIST
,
"Data with this name does not exist"
);
...
...
@@ -751,6 +771,12 @@ shared_ptr <string> SGXWalletServer::readFromDb(const string &name, const string
return
dataStr
;
}
shared_ptr
<
string
>
SGXWalletServer
::
checkDataFromDb
(
const
string
&
name
,
const
string
&
prefix
)
{
auto
dataStr
=
LevelDB
::
getLevelDb
()
->
readString
(
prefix
+
name
);
return
dataStr
;
}
void
SGXWalletServer
::
writeKeyShare
(
const
string
&
_keyShareName
,
const
string
&
_value
)
{
if
(
LevelDB
::
getLevelDb
()
->
readString
(
_keyShareName
)
!=
nullptr
)
{
throw
SGXException
(
KEY_SHARE_ALREADY_EXISTS
,
"Key share with this name already exists"
);
...
...
SGXWalletServer.hpp
View file @
dcb4a1d4
...
...
@@ -90,6 +90,8 @@ public:
static
shared_ptr
<
string
>
readFromDb
(
const
string
&
name
,
const
string
&
prefix
=
""
);
static
shared_ptr
<
string
>
checkDataFromDb
(
const
string
&
name
,
const
string
&
prefix
=
""
);
static
void
writeDataToDB
(
const
string
&
Name
,
const
string
&
value
);
static
void
writeKeyShare
(
const
string
&
_keyShareName
,
const
string
&
_value
);
...
...
VERSION
View file @
dcb4a1d4
1.58.4
\ No newline at end of file
1.58.5
\ No newline at end of file
testw.cpp
View file @
dcb4a1d4
...
...
@@ -552,7 +552,13 @@ TEST_CASE_METHOD(TestFixture, "DKG API test", "[dkg-api]") {
//wrong verif
Json
::
Value
Skeys
=
c
.
getSecretShare
(
polyName
,
publicKeys
,
2
,
2
);
REQUIRE_NOTHROW
(
c
.
getSecretShare
(
polyName
,
publicKeys
,
2
,
2
));
REQUIRE
(
Skeys
==
c
.
getSecretShare
(
polyName
,
publicKeys
,
2
,
2
));
Json
::
Value
verifVect
=
c
.
getVerificationVector
(
polyName
,
2
,
2
);
REQUIRE_NOTHROW
(
c
.
getVerificationVector
(
polyName
,
2
,
2
));
REQUIRE
(
verifVect
==
c
.
getVerificationVector
(
polyName
,
2
,
2
));
Json
::
Value
verificationWrongSkeys
=
c
.
dkgVerification
(
""
,
""
,
""
,
2
,
2
,
1
);
REQUIRE
(
verificationWrongSkeys
[
"status"
].
asInt
()
!=
0
);
}
...
...
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