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
1e558175
Unverified
Commit
1e558175
authored
Jul 28, 2020
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2977 clean up
parent
8a5f3dd0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
23 deletions
+20
-23
ECDSAImpl.c
ECDSAImpl.c
+5
-0
LevelDB.cpp
LevelDB.cpp
+8
-9
Makefile.am
Makefile.am
+3
-2
SGXWalletServer.cpp
SGXWalletServer.cpp
+4
-12
No files found.
ECDSAImpl.c
0 → 100644
View file @
1e558175
#include "secure_enclave/Point.c"
#include "secure_enclave/DomainParameters.c"
#include "secure_enclave/NumberTheory.c"
#include "secure_enclave/Signature.c"
#include "secure_enclave/Curves.c"
LevelDB.cpp
View file @
1e558175
...
...
@@ -21,13 +21,11 @@
@date 2019
*/
#include <stdexcept>
#include <memory>
#include <string>
#include <iostream>
#include "leveldb/db.h"
#include "sgxwallet_common.h"
...
...
@@ -53,9 +51,10 @@ std::shared_ptr<string> LevelDB::readString(const string &_key) {
throw
SGXException
(
NULL_DATABASE
,
"Null db"
);
}
spdlog
::
debug
(
"key to read from db: {}"
,
_key
);
spdlog
::
debug
(
"key to read from db: {}"
,
_key
);
auto
status
=
db
->
Get
(
readOptions
,
_key
,
&*
result
);
auto
status
=
db
->
Get
(
readOptions
,
_key
,
result
.
get
());
spdlog
::
debug
(
"SUCCESS READING"
);
throwExceptionOnError
(
status
);
...
...
@@ -73,11 +72,11 @@ void LevelDB::writeString(const string &_key, const string &_value) {
throwExceptionOnError
(
status
);
spdlog
::
debug
(
"written key: {}"
,
_key
);
spdlog
::
debug
(
"written key: {}"
,
_key
);
}
void
LevelDB
::
deleteDHDKGKey
(
const
string
&
_key
)
{
void
LevelDB
::
deleteDHDKGKey
(
const
string
&
_key
)
{
std
::
lock_guard
<
std
::
recursive_mutex
>
lock
(
mutex
);
string
full_key
=
"DKG_DH_KEY_"
+
_key
;
...
...
@@ -86,7 +85,7 @@ void LevelDB::deleteDHDKGKey (const string &_key) {
throwExceptionOnError
(
status
);
spdlog
::
debug
(
"key deleted: {}"
,
full_key
);
spdlog
::
debug
(
"key deleted: {}"
,
full_key
);
}
void
LevelDB
::
deleteTempNEK
(
const
string
&
_key
)
{
...
...
@@ -101,7 +100,7 @@ void LevelDB::deleteTempNEK(const string &_key) {
throwExceptionOnError
(
status
);
s
td
::
cerr
<<
"key deleted "
<<
_key
<<
std
::
endl
;
s
pdlog
::
debug
(
"key deleted: {}"
,
_key
)
;
}
void
LevelDB
::
deleteKey
(
const
string
&
_key
)
{
...
...
@@ -111,7 +110,7 @@ void LevelDB::deleteKey(const string &_key) {
throwExceptionOnError
(
status
);
spdlog
::
debug
(
"key deleted: {}"
,
_key
);
spdlog
::
debug
(
"key deleted: {}"
,
_key
);
}
...
...
Makefile.am
View file @
1e558175
...
...
@@ -66,10 +66,11 @@ bin_PROGRAMS = sgxwallet testw cert_util
## have to be explicitly listed.
COMMON_SRC
=
InvalidStateException.cpp Exception.cpp InvalidArgumentException.cpp Log.cpp
\
SGXWalletServer.cpp SGXRegistrationServer.cpp CSRManagerServer.cpp BLSCrypto.cpp ECDSACrypto.cpp
\
SGXWalletServer.cpp SGXRegistrationServer.cpp CSRManagerServer.cpp BLSCrypto.cpp
\
ECDSACrypto.cpp
\
DKGCrypto.cpp ServerInit.cpp BLSPrivateKeyShareSGX.cpp LevelDB.cpp ServerDataChecker.cpp SEKManager.cpp
\
third_party/intel/sgx_stub.c third_party/intel/sgx_detect_linux.c third_party/intel/create_enclave.c third_party/intel/oc_alloc.c
\
TestUtils.cpp sgxwallet.c
ECDSAImpl.c
TestUtils.cpp sgxwallet.c
COMMON_ENCLAVE_SRC
=
secure_enclave_u.c secure_enclave_u.h
sgxwallet_SOURCES
=
sgxwall.cpp
$(COMMON_SRC)
...
...
SGXWalletServer.cpp
View file @
1e558175
...
...
@@ -353,7 +353,7 @@ Json::Value SGXWalletServer::ecdsaSignMessageHashImpl(int _base, const string &_
throw
SGXException
(
-
22
,
"Invalid base"
);
}
shared_ptr
<
string
>
encryptedKey
=
readFromDb
(
_keyName
,
""
);
shared_ptr
<
string
>
encryptedKey
=
readFromDb
(
_keyName
);
signatureVector
=
ecdsaSignHash
(
encryptedKey
->
c_str
(),
hashTmp
.
c_str
(),
_base
);
if
(
signatureVector
.
size
()
!=
3
)
{
...
...
@@ -795,17 +795,9 @@ void SGXWalletServer::writeKeyShare(const string &_keyShareName, const string &_
LevelDB
::
getLevelDb
()
->
writeString
(
_keyShareName
,
_value
);
}
void
SGXWalletServer
::
writeDataToDB
(
const
string
&
Name
,
const
string
&
value
)
{
Json
::
Value
val
;
Json
::
FastWriter
writer
;
val
[
"value"
]
=
value
;
writer
.
write
(
val
);
auto
key
=
Name
;
if
(
LevelDB
::
getLevelDb
()
->
readString
(
Name
)
!=
nullptr
)
{
spdlog
::
info
(
"name {}"
,
Name
,
" already exists"
);
void
SGXWalletServer
::
writeDataToDB
(
const
string
&
key
,
const
string
&
value
)
{
if
(
LevelDB
::
getLevelDb
()
->
readString
(
key
)
!=
nullptr
)
{
spdlog
::
info
(
"name {}"
,
key
,
" already exists"
);
throw
SGXException
(
KEY_SHARE_ALREADY_EXISTS
,
"Key share already exists"
);
}
...
...
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