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
9dc52fc1
Unverified
Commit
9dc52fc1
authored
Jul 31, 2020
by
Oleh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove locks
parent
12550f53
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
0 additions
and
35 deletions
+0
-35
CSRManagerServer.cpp
CSRManagerServer.cpp
+0
-2
Log.h
Log.h
+0
-5
SGXRegistrationServer.cpp
SGXRegistrationServer.cpp
+0
-2
SGXWalletServer.cpp
SGXWalletServer.cpp
+0
-19
SGXWalletServer.hpp
SGXWalletServer.hpp
+0
-7
No files found.
CSRManagerServer.cpp
View file @
9dc52fc1
...
...
@@ -106,12 +106,10 @@ Json::Value signByHashImpl(const string &hash, int status) {
}
Json
::
Value
CSRManagerServer
::
getUnsignedCSRs
()
{
LOCK
(
m
)
return
getUnsignedCSRsImpl
();
}
Json
::
Value
CSRManagerServer
::
signByHash
(
const
string
&
hash
,
int
status
)
{
LOCK
(
m
)
return
signByHashImpl
(
hash
,
status
);
}
...
...
Log.h
View file @
9dc52fc1
...
...
@@ -41,7 +41,6 @@
#include "common.h"
#include <mutex> // For std::unique_lock
#include <shared_mutex>
using
namespace
std
;
...
...
@@ -78,9 +77,5 @@ 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
SGXRegistrationServer.cpp
View file @
9dc52fc1
...
...
@@ -153,13 +153,11 @@ Json::Value getCertificateImpl(const string &hash) {
Json
::
Value
SGXRegistrationServer
::
SignCertificate
(
const
string
&
csr
)
{
spdlog
::
info
(
__FUNCTION__
);
LOCK
(
m
)
return
signCertificateImpl
(
csr
,
autoSign
);
}
Json
::
Value
SGXRegistrationServer
::
GetCertificate
(
const
string
&
hash
)
{
spdlog
::
info
(
__FUNCTION__
);
LOCK
(
m
)
return
getCertificateImpl
(
hash
);
}
...
...
SGXWalletServer.cpp
View file @
9dc52fc1
...
...
@@ -674,17 +674,14 @@ Json::Value SGXWalletServer::deleteBlsKeyImpl(const std::string& name) {
}
Json
::
Value
SGXWalletServer
::
generateDKGPoly
(
const
string
&
_polyName
,
int
_t
)
{
WRITE_LOCK
(
m
)
return
generateDKGPolyImpl
(
_polyName
,
_t
);
}
Json
::
Value
SGXWalletServer
::
getVerificationVector
(
const
string
&
_polynomeName
,
int
_t
,
int
_n
)
{
WRITE_LOCK
(
m
)
return
getVerificationVectorImpl
(
_polynomeName
,
_t
,
_n
);
}
Json
::
Value
SGXWalletServer
::
getSecretShare
(
const
string
&
_polyName
,
const
Json
::
Value
&
_publicKeys
,
int
t
,
int
n
)
{
WRITE_LOCK
(
m
)
return
getSecretShareImpl
(
_polyName
,
_publicKeys
,
t
,
n
);
}
...
...
@@ -692,39 +689,32 @@ Json::Value
SGXWalletServer
::
dkgVerification
(
const
string
&
_publicShares
,
const
string
&
ethKeyName
,
const
string
&
SecretShare
,
int
t
,
int
n
,
int
index
)
{
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
)
{
WRITE_LOCK
(
m
)
return
createBLSPrivateKeyImpl
(
blsKeyName
,
ethKeyName
,
polyName
,
SecretShare
,
t
,
n
);
}
Json
::
Value
SGXWalletServer
::
getBLSPublicKeyShare
(
const
string
&
blsKeyName
)
{
READ_LOCK
(
m
)
return
getBLSPublicKeyShareImpl
(
blsKeyName
);
}
Json
::
Value
SGXWalletServer
::
generateECDSAKey
()
{
WRITE_LOCK
(
m
)
return
generateECDSAKeyImpl
();
}
Json
::
Value
SGXWalletServer
::
renameECDSAKey
(
const
string
&
_keyName
,
const
string
&
_tmpKeyName
)
{
WRITE_LOCK
(
m
)
return
renameECDSAKeyImpl
(
_keyName
,
_tmpKeyName
);
}
Json
::
Value
SGXWalletServer
::
getPublicECDSAKey
(
const
string
&
_keyName
)
{
READ_LOCK
(
m
)
return
getPublicECDSAKeyImpl
(
_keyName
);
}
Json
::
Value
SGXWalletServer
::
ecdsaSignMessageHash
(
int
_base
,
const
string
&
_keyShareName
,
const
string
&
_messageHash
)
{
READ_LOCK
(
m
)
spdlog
::
debug
(
"MessageHash first {}"
,
_messageHash
);
return
ecdsaSignMessageHashImpl
(
_base
,
_keyShareName
,
_messageHash
);
}
...
...
@@ -732,48 +722,39 @@ 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
)
{
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
)
{
READ_LOCK
(
m
)
return
blsSignMessageHashImpl
(
_keyShareName
,
_messageHash
,
_t
,
_n
,
_signerIndex
);
}
Json
::
Value
SGXWalletServer
::
importECDSAKey
(
const
string
&
_key
,
const
string
&
_keyName
)
{
WRITE_LOCK
(
m
)
return
importECDSAKeyImpl
(
_key
,
_keyName
);
}
Json
::
Value
SGXWalletServer
::
complaintResponse
(
const
string
&
polyName
,
int
ind
)
{
WRITE_LOCK
(
m
)
return
complaintResponseImpl
(
polyName
,
ind
);
}
Json
::
Value
SGXWalletServer
::
multG2
(
const
string
&
x
)
{
WRITE_LOCK
(
m
)
return
multG2Impl
(
x
);
}
Json
::
Value
SGXWalletServer
::
isPolyExists
(
const
string
&
polyName
)
{
WRITE_LOCK
(
m
)
return
isPolyExistsImpl
(
polyName
);
}
Json
::
Value
SGXWalletServer
::
getServerStatus
()
{
READ_LOCK
(
m
)
return
getServerStatusImpl
();
}
Json
::
Value
SGXWalletServer
::
getServerVersion
()
{
READ_LOCK
(
m
)
return
getServerVersionImpl
();
}
Json
::
Value
SGXWalletServer
::
deleteBlsKey
(
const
std
::
string
&
name
)
{
READ_LOCK
(
m
)
return
deleteBlsKeyImpl
(
name
);
}
...
...
SGXWalletServer.hpp
View file @
9dc52fc1
...
...
@@ -24,13 +24,8 @@
#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>
#include "abstractstubserver.h"
...
...
@@ -42,8 +37,6 @@ using namespace std;
#define TOSTRING(x) STRINGIFY(x)
class
SGXWalletServer
:
public
AbstractStubServer
{
Lock
m
;
static
shared_ptr
<
SGXWalletServer
>
server
;
static
shared_ptr
<
HttpServer
>
httpServer
;
public
:
...
...
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