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
056c1b73
Unverified
Commit
056c1b73
authored
Feb 15, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2167 Adding tests
parent
f0f84a0f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
11 deletions
+16
-11
DKGCrypto.cpp
DKGCrypto.cpp
+3
-3
Makefile.am
Makefile.am
+2
-2
SEKManager.cpp
SEKManager.cpp
+5
-1
SGXWalletServer.cpp
SGXWalletServer.cpp
+3
-3
testw.cpp
testw.cpp
+3
-2
No files found.
DKGCrypto.cpp
View file @
056c1b73
...
...
@@ -146,7 +146,8 @@ vector <vector<string>> get_verif_vect(const char* encryptedPolyHex, int t, int
// printf(" %d ", encr_dkg_poly[i] );
}
uint32_t
len
;
uint32_t
len
=
0
;
if
(
!
is_aes
)
status
=
get_public_shares
(
eid
,
&
err_status
,
errMsg1
,
encr_dkg_poly
,
len
,
public_shares
,
t
,
n
);
else
{
...
...
@@ -170,7 +171,7 @@ vector <vector<string>> get_verif_vect(const char* encryptedPolyHex, int t, int
vector
<
string
>
G2_strings
=
SplitString
(
public_shares
,
','
);
vector
<
vector
<
string
>>
pub_shares_vect
;
for
(
in
t
i
=
0
;
i
<
G2_strings
.
size
();
i
++
){
for
(
uint64_
t
i
=
0
;
i
<
G2_strings
.
size
();
i
++
){
vector
<
string
>
koef_str
=
SplitString
(
G2_strings
.
at
(
i
).
c_str
(),
':'
);
pub_shares_vect
.
push_back
(
koef_str
);
}
...
...
@@ -382,7 +383,6 @@ vector<string> GetBLSPubKey(const char * encryptedKeyHex){
int
err_status
=
0
;
uint64_t
dec_key_len
;
uint8_t
encr_bls_key
[
BUF_LEN
];
uint8_t
encr_key
[
BUF_LEN
];
if
(
!
hex2carray
(
encryptedKeyHex
,
&
dec_key_len
,
encr_key
)){
throw
RPCException
(
INVALID_HEX
,
"Invalid encryptedKeyHex"
);
...
...
Makefile.am
View file @
056c1b73
...
...
@@ -44,8 +44,8 @@ secure_enclave.edl: secure_enclave/secure_enclave.edl
##
#AM_CPPFLAGS += -g -Og
AM_CFLAGS
=
-g
-Og
-rdynamic
-Wl
,--no-as-needed
-lSegFault
-fsanitize
=
address
AM_CXXFLAGS
=
${
AM_CPPFLAGS
}
-rdynamic
-Wl
,--no-as-needed
-lSegFault
-fsanitize
=
address
AM_CFLAGS
=
-g
-Og
-rdynamic
-Wl
,--no-as-needed
-lSegFault
AM_CXXFLAGS
=
${
AM_CPPFLAGS
}
-rdynamic
-Wl
,--no-as-needed
-lSegFault
AM_CPPFLAGS
+=
-Wall
-DSKALE_SGX
=
1
-DBINARY_OUTPUT
=
1
-Ileveldb
/include
-IlibBLS
/bls
-IlibBLS
/libff
-IlibBLS
-fno-builtin-memset
$(GMP_CPPFLAGS)
-I
.
-I
./libBLS/deps/deps_inst/x86_or_x64/include
...
...
SEKManager.cpp
View file @
056c1b73
...
...
@@ -154,7 +154,11 @@ void gen_SEK(){
std
::
getline
(
std
::
cin
,
buffer
);
}
while
(
case_insensitive_match
(
confirm_str
,
buffer
));
//(strcmp(confirm_str.c_str(), buffer.c_str()) != 0);
}
system
(
"reset"
);
if
(
system
(
"reset"
)
!=
0
)
{
cerr
<<
"Could not execute reset"
<<
endl
;
}
LevelDB
::
getLevelDb
()
->
writeDataUnique
(
"SEK"
,
hexEncrKey
.
data
());
create_test_key
();
...
...
SGXWalletServer.cpp
View file @
056c1b73
...
...
@@ -493,7 +493,7 @@ Json::Value getSecretShareImpl(const string& polyName, const Json::Value& public
result
[
"errorMessage"
]
=
""
;
try
{
if
(
publicKeys
.
size
()
!=
n
){
if
(
publicKeys
.
size
()
!=
(
uint64_t
)
n
){
throw
RPCException
(
INVALID_DKG_PARAMS
,
"wrong number of public keys"
);
}
if
(
!
checkName
(
polyName
,
"POLY"
)){
...
...
@@ -549,7 +549,7 @@ Json::Value dkgVerificationImpl(const string& publicShares, const string& ethKey
if
(
!
checkHex
(
SecretShare
,
SECRET_SHARE_NUM_BYTES
)){
throw
RPCException
(
INVALID_HEX
,
"Invalid Secret share"
);
}
if
(
publicShares
.
length
()
!=
256
*
t
){
if
(
publicShares
.
length
()
!=
(
uint64_t
)
256
*
t
){
throw
RPCException
(
INVALID_DKG_PARAMS
,
"Invalid length of public shares"
);
}
...
...
@@ -579,7 +579,7 @@ Json::Value createBLSPrivateKeyImpl(const string & blsKeyName, const string& eth
try
{
if
(
SecretShare
.
length
()
!=
n
*
192
){
if
(
SecretShare
.
length
()
!=
(
uint64_t
)
n
*
192
){
spdlog
::
info
(
"wrong length of secret shares - {}"
,
SecretShare
.
length
());
spdlog
::
info
(
"secret shares - {}"
,
SecretShare
);
throw
RPCException
(
INVALID_SECRET_SHARES_LENGTH
,
"Invalid secret share length"
);
...
...
testw.cpp
View file @
056c1b73
...
...
@@ -124,8 +124,9 @@ TEST_CASE("BLS key encrypt", "[bls-key-encrypt]") {
DEBUG_PRINT
=
1
;
is_sgx_https
=
0
;
init_all
(
false
,
false
,
init_SEK
);
auto
key
=
shared_ptr
<
char
>
(
encryptTestKey
()
);
auto
key
=
encryptTestKey
(
);
REQUIRE
(
key
!=
nullptr
);
free
(
key
);
}
...
...
@@ -146,7 +147,6 @@ TEST_CASE("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") {
char
*
encryptedKey
=
encryptTestKey
();
REQUIRE
(
encryptedKey
!=
nullptr
);
char
*
plaintextKey
=
decryptBLSKeyShareFromHex
(
&
errStatus
,
errMsg
.
data
(),
encryptedKey
);
free
(
encryptedKey
);
REQUIRE
(
errStatus
==
0
);
...
...
@@ -155,6 +155,7 @@ TEST_CASE("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") {
printf
(
"Decrypt key completed with status: %d %s
\n
"
,
errStatus
,
errMsg
.
data
());
printf
(
"Decrypted key len %d
\n
"
,
(
int
)
strlen
(
plaintextKey
));
printf
(
"Decrypted key: %s
\n
"
,
plaintextKey
);
free
(
plaintextKey
);
sgx_destroy_enclave
(
eid
);
...
...
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