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
df8ce3b6
Unverified
Commit
df8ce3b6
authored
4 years ago
by
Stan Kladko
Committed by
GitHub
4 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #113 from skalenetwork/SGX-2678-fix3
SKALE-2678-BLS-test-vectors
parents
eec3a72b
0355ff29
master
develop
1 merge request
!1
Develop
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
23 deletions
+33
-23
BLSCrypto.cpp
BLSCrypto.cpp
+0
-2
DockerfileBase
DockerfileBase
+1
-1
Log.h
Log.h
+5
-0
Makefile.am
Makefile.am
+1
-1
SGXWalletServer.cpp
SGXWalletServer.cpp
+18
-18
SGXWalletServer.hpp
SGXWalletServer.hpp
+6
-1
TestUtils.cpp
TestUtils.cpp
+1
-0
sgxwall.cpp
sgxwall.cpp
+1
-0
No files found.
BLSCrypto.cpp
View file @
df8ce3b6
...
...
@@ -257,8 +257,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
strncpy
(
_sig
,
sig
.
c_str
(),
BUF_LEN
);
printf
(
"_sig is: %s
\n
"
,
sig
.
c_str
());
//string sigShareStr = keyShare->signWithHelperSGXstr(hash, _signerIndex);
//strncpy(_sig, sigShareStr.c_str(), BUF_LEN);
...
...
This diff is collapsed.
Click to expand it.
DockerfileBase
View file @
df8ce3b6
...
...
@@ -12,7 +12,7 @@ RUN apt update && \
apt install -yq --no-install-recommends python-yaml vim \
telnet git ca-certificates build-essential ocaml ocamlbuild \
automake autoconf libtool wget python libssl-dev libssl-dev \
libcurl4-openssl-dev protobuf-compiler git libprotobuf-dev \
libcurl4-openssl-dev protobuf-compiler git libprotobuf-dev
libboost-all-dev
\
alien cmake debhelper uuid-dev libxml2-dev ccache vim libprotobuf10 \
yasm cmake flex bison libprocps-dev ccache autoconf texinfo libssl-dev \
libboost-all-dev libjsonrpccpp-dev libjsonrpccpp-tools && \
...
...
This diff is collapsed.
Click to expand it.
Log.h
View file @
df8ce3b6
...
...
@@ -41,6 +41,9 @@
#include "common.h"
#include <mutex> // For std::unique_lock
#include <shared_mutex>
using
namespace
std
;
...
...
@@ -75,6 +78,8 @@ public:
#define HANDLE_SGX_EXCEPTION(_RESULT_) catch (SGXException &__e) { Log::handleSGXException(_RESULT_, __e);} \
catch (exception &__e) {spdlog::error(__e.what()); _RESULT_["status"] = 1; _RESULT_["errorMessage"] = __e.what();}
#define READ_LOCK(__M__) ReadLock __rlock(__M__);
#define WRITE_LOCK(__M__) WriteLock __wlock(__M__);
#define LOCK(__M__) lock_guard<recursive_mutex> lock(__M__);
#endif
...
...
This diff is collapsed.
Click to expand it.
Makefile.am
View file @
df8ce3b6
...
...
@@ -105,7 +105,7 @@ sgxwallet_LDADD=-l$(SGX_URTS_LIB) -l$(SGX_UAE_SERVICE_LIB) -LlibBLS/deps/deps_in
-ljsonrpccpp-stub
-ljsonrpccpp-server
-ljsonrpccpp-client
-ljsonrpccpp-common
-ljsoncpp
-lmicrohttpd
\
intel-sgx-ssl/Linux/package/lib64/libsgx_usgxssl.a
\
intel-sgx-ssl/Linux/package/lib64/libsgx_tsgxssl_crypto.a
\
-lgnutls
-lgcrypt
-lcurl
-lssl
-lcrypto
-lz
-lpthread
-lboost_system
-lboost_thread
-lgnutls
-lgcrypt
-lcurl
-lssl
-lcrypto
-lz
-lpthread
testw_SOURCES
=
testw.cpp
$(COMMON_SRC)
...
...
This diff is collapsed.
Click to expand it.
SGXWalletServer.cpp
View file @
df8ce3b6
...
...
@@ -662,17 +662,17 @@ Json::Value SGXWalletServer::getServerVersionImpl() {
Json
::
Value
SGXWalletServer
::
generateDKGPoly
(
const
string
&
_polyName
,
int
_t
)
{
LOCK
(
m
)
WRITE_
LOCK
(
m
)
return
generateDKGPolyImpl
(
_polyName
,
_t
);
}
Json
::
Value
SGXWalletServer
::
getVerificationVector
(
const
string
&
_polynomeName
,
int
_t
,
int
_n
)
{
LOCK
(
m
)
WRITE_
LOCK
(
m
)
return
getVerificationVectorImpl
(
_polynomeName
,
_t
,
_n
);
}
Json
::
Value
SGXWalletServer
::
getSecretShare
(
const
string
&
_polyName
,
const
Json
::
Value
&
_publicKeys
,
int
t
,
int
n
)
{
LOCK
(
m
)
WRITE_
LOCK
(
m
)
return
getSecretShareImpl
(
_polyName
,
_publicKeys
,
t
,
n
);
}
...
...
@@ -680,41 +680,41 @@ Json::Value
SGXWalletServer
::
dkgVerification
(
const
string
&
_publicShares
,
const
string
&
ethKeyName
,
const
string
&
SecretShare
,
int
t
,
int
n
,
int
index
)
{
LOCK
(
m
)
WRITE_
LOCK
(
m
)
return
dkgVerificationImpl
(
_publicShares
,
ethKeyName
,
SecretShare
,
t
,
n
,
index
);
}
Json
::
Value
SGXWalletServer
::
createBLSPrivateKey
(
const
string
&
blsKeyName
,
const
string
&
ethKeyName
,
const
string
&
polyName
,
const
string
&
SecretShare
,
int
t
,
int
n
)
{
LOCK
(
m
)
WRITE_
LOCK
(
m
)
return
createBLSPrivateKeyImpl
(
blsKeyName
,
ethKeyName
,
polyName
,
SecretShare
,
t
,
n
);
}
Json
::
Value
SGXWalletServer
::
getBLSPublicKeyShare
(
const
string
&
blsKeyName
)
{
LOCK
(
m
)
READ_
LOCK
(
m
)
return
getBLSPublicKeyShareImpl
(
blsKeyName
);
}
Json
::
Value
SGXWalletServer
::
generateECDSAKey
()
{
LOCK
(
m
)
WRITE_
LOCK
(
m
)
return
generateECDSAKeyImpl
();
}
Json
::
Value
SGXWalletServer
::
renameECDSAKey
(
const
string
&
_keyName
,
const
string
&
_tmpKeyName
)
{
LOCK
(
m
)
WRITE_
LOCK
(
m
)
return
renameECDSAKeyImpl
(
_keyName
,
_tmpKeyName
);
}
Json
::
Value
SGXWalletServer
::
getPublicECDSAKey
(
const
string
&
_keyName
)
{
LOCK
(
m
)
READ_
LOCK
(
m
)
return
getPublicECDSAKeyImpl
(
_keyName
);
}
Json
::
Value
SGXWalletServer
::
ecdsaSignMessageHash
(
int
_base
,
const
string
&
_keyShareName
,
const
string
&
_messageHash
)
{
LOCK
(
m
)
READ_
LOCK
(
m
)
spdlog
::
debug
(
"MessageHash first {}"
,
_messageHash
);
return
ecdsaSignMessageHashImpl
(
_base
,
_keyShareName
,
_messageHash
);
}
...
...
@@ -723,43 +723,43 @@ Json::Value SGXWalletServer::ecdsaSignMessageHash(int _base, const string &_keyS
Json
::
Value
SGXWalletServer
::
importBLSKeyShare
(
const
string
&
_keyShare
,
const
string
&
_keyShareName
,
int
_t
,
int
_n
,
int
index
)
{
LOCK
(
m
)
WRITE_
LOCK
(
m
)
return
importBLSKeyShareImpl
(
_keyShare
,
_keyShareName
,
_t
,
_n
,
index
);
}
Json
::
Value
SGXWalletServer
::
blsSignMessageHash
(
const
string
&
_keyShareName
,
const
string
&
_messageHash
,
int
_t
,
int
_n
,
int
_signerIndex
)
{
LOCK
(
m
)
READ_
LOCK
(
m
)
return
blsSignMessageHashImpl
(
_keyShareName
,
_messageHash
,
_t
,
_n
,
_signerIndex
);
}
Json
::
Value
SGXWalletServer
::
importECDSAKey
(
const
string
&
_key
,
const
string
&
_keyName
)
{
LOCK
(
m
)
WRITE_
LOCK
(
m
)
return
importECDSAKeyImpl
(
_key
,
_keyName
);
}
Json
::
Value
SGXWalletServer
::
complaintResponse
(
const
string
&
polyName
,
int
ind
)
{
LOCK
(
m
)
WRITE_
LOCK
(
m
)
return
complaintResponseImpl
(
polyName
,
ind
);
}
Json
::
Value
SGXWalletServer
::
multG2
(
const
string
&
x
)
{
LOCK
(
m
)
WRITE_
LOCK
(
m
)
return
multG2Impl
(
x
);
}
Json
::
Value
SGXWalletServer
::
isPolyExists
(
const
string
&
polyName
)
{
LOCK
(
m
)
WRITE_
LOCK
(
m
)
return
isPolyExistsImpl
(
polyName
);
}
Json
::
Value
SGXWalletServer
::
getServerStatus
()
{
LOCK
(
m
)
READ_
LOCK
(
m
)
return
getServerStatusImpl
();
}
Json
::
Value
SGXWalletServer
::
getServerVersion
()
{
LOCK
(
m
)
READ_
LOCK
(
m
)
return
getServerVersionImpl
();
}
...
...
This diff is collapsed.
Click to expand it.
SGXWalletServer.hpp
View file @
df8ce3b6
...
...
@@ -24,7 +24,12 @@
#ifndef SGXWALLET_SGXWALLETSERVER_HPP
#define SGXWALLET_SGXWALLETSERVER_HPP
#include <boost/thread/locks.hpp>
#include <boost/thread/shared_mutex.hpp>
typedef
boost
::
shared_mutex
Lock
;
typedef
boost
::
unique_lock
<
Lock
>
WriteLock
;
typedef
boost
::
shared_lock
<
Lock
>
ReadLock
;
#include <jsonrpccpp/server/connectors/httpserver.h>
#include <mutex>
...
...
@@ -40,7 +45,7 @@ class SGXWalletServer : public AbstractStubServer {
recursive_mutex
m
;
Lock
m
;
static
shared_ptr
<
SGXWalletServer
>
server
;
static
shared_ptr
<
HttpServer
>
httpServer
;
...
...
This diff is collapsed.
Click to expand it.
TestUtils.cpp
View file @
df8ce3b6
...
...
@@ -376,6 +376,7 @@ void TestUtils::doDKG(StubClient &c, int n, int t,
CHECK_STATE
(
response
[
"status"
]
==
0
);
pubBLSKeys
[
i
]
=
c
.
getBLSPublicKeyShare
(
blsName
);
CHECK_STATE
(
pubBLSKeys
[
i
][
"status"
]
==
0
);
}
for
(
int
i
=
0
;
i
<
t
;
i
++
)
{
...
...
This diff is collapsed.
Click to expand it.
sgxwall.cpp
View file @
df8ce3b6
...
...
@@ -207,6 +207,7 @@ int main(int argc, char *argv[]) {
schainID
=
2
;
dkgID
=
2
;
TestUtils
::
doDKG
(
c
,
16
,
11
,
ecdsaKeyNames
,
blsKeyNames
,
schainID
,
dkgID
);
SGXWallet
::
serializeKeys
(
ecdsaKeyNames
,
blsKeyNames
,
"sgx_data/16node.json"
);
...
...
This diff is collapsed.
Click to expand it.
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