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
f9e85374
Unverified
Commit
f9e85374
authored
Feb 10, 2021
by
Stan Kladko
Committed by
GitHub
Feb 10, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into SKALE-3751-enable-zeromq
parents
28e2d0d6
c4e2b3b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
5 deletions
+18
-5
SGXWalletServer.cpp
SGXWalletServer.cpp
+6
-3
DHDkg.c
secure_enclave/DHDkg.c
+7
-1
testw.cpp
testw.cpp
+5
-1
No files found.
SGXWalletServer.cpp
View file @
f9e85374
...
...
@@ -1094,7 +1094,9 @@ shared_ptr <string> SGXWalletServer::readFromDb(const string &name, const string
auto
dataStr
=
checkDataFromDb
(
prefix
+
name
);
if
(
dataStr
==
nullptr
)
{
throw
SGXException
(
KEY_SHARE_DOES_NOT_EXIST
,
string
(
__FUNCTION__
)
+
":Data with this name does not exist"
);
throw
SGXException
(
KEY_SHARE_DOES_NOT_EXIST
,
string
(
__FUNCTION__
)
+
":Data with this name does not exist: "
+
prefix
+
name
);
}
return
dataStr
;
...
...
@@ -1108,7 +1110,8 @@ shared_ptr <string> SGXWalletServer::checkDataFromDb(const string &name, const s
void
SGXWalletServer
::
writeKeyShare
(
const
string
&
_keyShareName
,
const
string
&
_value
)
{
if
(
LevelDB
::
getLevelDb
()
->
readString
(
_keyShareName
)
!=
nullptr
)
{
throw
SGXException
(
KEY_SHARE_ALREADY_EXISTS
,
string
(
__FUNCTION__
)
+
":Key share with this name already exists"
);
throw
SGXException
(
KEY_SHARE_ALREADY_EXISTS
,
string
(
__FUNCTION__
)
+
":Key share with this name already exists"
+
_keyShareName
);
}
LevelDB
::
getLevelDb
()
->
writeString
(
_keyShareName
,
_value
);
...
...
@@ -1117,7 +1120,7 @@ void SGXWalletServer::writeKeyShare(const string &_keyShareName, const string &_
void
SGXWalletServer
::
writeDataToDB
(
const
string
&
name
,
const
string
&
value
)
{
if
(
LevelDB
::
getLevelDb
()
->
readString
(
name
)
!=
nullptr
)
{
throw
SGXException
(
KEY_NAME_ALREADY_EXISTS
,
string
(
__FUNCTION__
)
+
":Name already exists"
);
throw
SGXException
(
KEY_NAME_ALREADY_EXISTS
,
string
(
__FUNCTION__
)
+
":Name already exists"
+
name
);
}
LevelDB
::
getLevelDb
()
->
writeString
(
name
,
value
);
}
secure_enclave/DHDkg.c
View file @
f9e85374
...
...
@@ -345,7 +345,13 @@ int hash_key(char* key, char* hashed_key) {
return
ret
;
}
ret
=
sgx_sha256_msg
((
uint8_t
*
)
key
,
ECDSA_SKEY_LEN
-
1
,
(
uint8_t
*
)
hashed_key
);
uint8_t
key_to_hash
[
33
];
uint64_t
len
;
if
(
!
hex2carray
(
key
,
&
len
,
key_to_hash
))
{
return
ret
;
}
ret
=
sgx_sha256_msg
(
key_to_hash
,
ECDSA_BIN_LEN
-
1
,
(
uint8_t
*
)
hashed_key
);
return
ret
;
}
testw.cpp
View file @
f9e85374
...
...
@@ -784,7 +784,11 @@ TEST_CASE_METHOD(TestFixture, "AES_DKG V2 test", "[aes-dkg-v2]") {
SAFE_CHAR_BUF
(
common_key
,
BUF_LEN
);
REQUIRE
(
sessionKeyRecoverDH
(
dhKey
.
c_str
(),
encr_sshare
,
common_key
)
==
0
);
auto
hashed_key
=
cryptlite
::
sha256
::
hash_hex
(
string
(
common_key
,
64
));
uint8_t
key_to_hash
[
33
];
uint64_t
len
;
REQUIRE
(
hex2carray
(
common_key
,
&
len
,
key_to_hash
,
64
)
);
auto
hashed_key
=
cryptlite
::
sha256
::
hash_hex
(
string
((
char
*
)
key_to_hash
,
32
));
SAFE_CHAR_BUF
(
derived_key
,
33
)
...
...
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