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
a3130c56
Unverified
Commit
a3130c56
authored
Apr 17, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2454-add-logs-to-enclave
parent
53fefaa7
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
85 additions
and
85 deletions
+85
-85
DKGCrypto.cpp
DKGCrypto.cpp
+17
-17
DKGCrypto.h
DKGCrypto.h
+1
-1
SGXWalletServer.cpp
SGXWalletServer.cpp
+1
-1
secure_enclave.c
secure_enclave/secure_enclave.c
+23
-23
secure_enclave.edl
secure_enclave/secure_enclave.edl
+17
-17
secure_enclave.i
secure_enclave/secure_enclave.i
+10
-10
testw.cpp
testw.cpp
+16
-16
No files found.
DKGCrypto.cpp
View file @
a3130c56
...
...
@@ -84,14 +84,14 @@ string gen_dkg_poly(int _t) {
uint32_t
enc_len
=
0
;
if
(
!
encryptKeys
)
status
=
gen_dkg_s
ecret
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
status
=
trustedGenDkgS
ecret
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
else
status
=
gen_dkg_s
ecret_aes
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
status
=
trustedGenDkgS
ecret_aes
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
if
(
err_status
!=
0
)
{
throw
SGXException
(
-
666
,
errMsg
.
data
());
}
spdlog
::
debug
(
"
gen_dkg_s
ecret, status {}"
,
err_status
,
" err msg "
,
errMsg
.
data
());
spdlog
::
debug
(
"
trustedGenDkgS
ecret, status {}"
,
err_status
,
" err msg "
,
errMsg
.
data
());
spdlog
::
debug
(
"in DKGCrypto encr len is {}"
,
enc_len
);
uint64_t
length
=
DKG_MAX_SEALED_LEN
;
...
...
@@ -138,10 +138,10 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
uint32_t
len
=
0
;
if
(
!
encryptKeys
)
status
=
get_public_s
hares
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
len
,
pubShares
.
data
(),
t
,
n
);
status
=
trustedGetPublicS
hares
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
len
,
pubShares
.
data
(),
t
,
n
);
else
{
status
=
get_public_s
hares_aes
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
encLen
,
pubShares
.
data
(),
t
,
n
);
status
=
trustedGetPublicS
hares_aes
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
encLen
,
pubShares
.
data
(),
t
,
n
);
}
if
(
errStatus
!=
0
)
{
throw
SGXException
(
-
666
,
errMsg1
.
data
());
...
...
@@ -152,7 +152,7 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
spdlog
::
debug
(
"public_shares:"
);
spdlog
::
debug
(
"{}"
,
pubShares
.
data
());;
spdlog
::
debug
(
"
get_public_s
hares status: {}"
,
errStatus
);
spdlog
::
debug
(
"
trustedGetPublicS
hares status: {}"
,
errStatus
);
vector
<
string
>
g2Strings
=
splitString
(
pubShares
.
data
(),
','
);
vector
<
vector
<
string
>>
pubSharesVect
;
...
...
@@ -164,7 +164,7 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
return
pubSharesVect
;
}
string
get_secret_s
hares
(
const
string
&
_polyName
,
const
char
*
_encryptedPolyHex
,
const
vector
<
string
>
&
_publicKeys
,
int
_t
,
string
trustedGetSecretS
hares
(
const
string
&
_polyName
,
const
char
*
_encryptedPolyHex
,
const
vector
<
string
>
&
_publicKeys
,
int
_t
,
int
_n
)
{
vector
<
char
>
errMsg1
(
BUF_LEN
,
0
);
...
...
@@ -182,9 +182,9 @@ string get_secret_shares(const string &_polyName, const char *_encryptedPolyHex,
if
(
!
encryptKeys
)
status
=
set_encrypted_dkg_p
oly
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
());
status
=
trustedSetEncryptedDkgP
oly
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
());
else
status
=
set_encrypted_dkg_p
oly_aes
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
&
encLen
);
status
=
trustedSetEncryptedDkgP
oly_aes
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
&
encLen
);
if
(
status
!=
SGX_SUCCESS
||
errStatus
!=
0
)
{
throw
SGXException
(
-
666
,
errMsg1
.
data
());
...
...
@@ -209,10 +209,10 @@ string get_secret_shares(const string &_polyName, const char *_encryptedPolyHex,
if
(
!
encryptKeys
)
get_encr_ss
hare
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedSkey
.
data
(),
&
decLen
,
trustedGetEncryptedSecretS
hare
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedSkey
.
data
(),
&
decLen
,
currentShare
.
data
(),
sShareG2
.
data
(),
pubKeyB
.
data
(),
_t
,
_n
,
i
+
1
);
else
get_encr_ss
hare_aes
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedSkey
.
data
(),
&
decLen
,
trustedGetEncryptedSecretS
hare_aes
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedSkey
.
data
(),
&
decLen
,
currentShare
.
data
(),
sShareG2
.
data
(),
pubKeyB
.
data
(),
_t
,
_n
,
i
+
1
);
if
(
errStatus
!=
0
)
{
throw
SGXException
(
-
666
,
errMsg1
.
data
());
...
...
@@ -265,9 +265,9 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr
if
(
!
encryptKeys
)
dkg_verification
(
eid
,
&
err_status
,
errMsg1
,
pshares
,
encr_sshare
,
encr_key
,
dec_key_len
,
t
,
ind
,
&
result
);
trustedDkgVerify
(
eid
,
&
err_status
,
errMsg1
,
pshares
,
encr_sshare
,
encr_key
,
dec_key_len
,
t
,
ind
,
&
result
);
else
dkg_verification
_aes
(
eid
,
&
err_status
,
errMsg1
,
pshares
,
encr_sshare
,
encr_key
,
dec_key_len
,
t
,
ind
,
&
result
);
trustedDkgVerify
_aes
(
eid
,
&
err_status
,
errMsg1
,
pshares
,
encr_sshare
,
encr_key
,
dec_key_len
,
t
,
ind
,
&
result
);
if
(
result
==
2
)
{
throw
SGXException
(
INVALID_HEX
,
"Invalid public shares"
);
...
...
@@ -302,9 +302,9 @@ bool CreateBLSShare(const string &blsKeyName, const char *s_shares, const char *
if
(
!
encryptKeys
)
create_bls_k
ey
(
eid
,
&
err_status
,
errMsg1
,
s_shares
,
encr_key
,
dec_key_len
,
encr_bls_key
,
&
enc_bls_len
);
trustedCreateBlsK
ey
(
eid
,
&
err_status
,
errMsg1
,
s_shares
,
encr_key
,
dec_key_len
,
encr_bls_key
,
&
enc_bls_len
);
else
create_bls_k
ey_aes
(
eid
,
&
err_status
,
errMsg1
,
s_shares
,
encr_key
,
dec_key_len
,
encr_bls_key
,
&
enc_bls_len
);
trustedCreateBlsK
ey_aes
(
eid
,
&
err_status
,
errMsg1
,
s_shares
,
encr_key
,
dec_key_len
,
encr_bls_key
,
&
enc_bls_len
);
if
(
err_status
!=
0
)
{
...
...
@@ -341,9 +341,9 @@ vector<string> GetBLSPubKey(const char *encryptedKeyHex) {
spdlog
::
debug
(
"dec_key_len is {}"
,
dec_key_len
);
if
(
!
encryptKeys
)
get_bls_pub_k
ey
(
eid
,
&
err_status
,
errMsg1
,
encr_key
,
dec_key_len
,
pub_key
);
trustedGetBlsPubK
ey
(
eid
,
&
err_status
,
errMsg1
,
encr_key
,
dec_key_len
,
pub_key
);
else
get_bls_pub_k
ey_aes
(
eid
,
&
err_status
,
errMsg1
,
encr_key
,
dec_key_len
,
pub_key
);
trustedGetBlsPubK
ey_aes
(
eid
,
&
err_status
,
errMsg1
,
encr_key
,
dec_key_len
,
pub_key
);
if
(
err_status
!=
0
)
{
spdlog
::
error
(
string
(
errMsg1
)
+
" . Status is {}"
,
err_status
);
throw
SGXException
(
ERROR_IN_ENCLAVE
,
"Failed to get BLS public key in enclave"
);
...
...
DKGCrypto.h
View file @
a3130c56
...
...
@@ -33,7 +33,7 @@ std::vector <std::vector<std::string>> get_verif_vect(const char* encryptedPolyH
std
::
vector
<
std
::
string
>
splitString
(
const
char
*
koefs
,
const
char
symbol
);
std
::
string
get_secret_s
hares
(
const
std
::
string
&
_polyName
,
const
char
*
_encryptedPolyHex
,
const
std
::
vector
<
std
::
string
>&
_publicKeys
,
int
_t
,
int
_n
);
std
::
string
trustedGetSecretS
hares
(
const
std
::
string
&
_polyName
,
const
char
*
_encryptedPolyHex
,
const
std
::
vector
<
std
::
string
>&
_publicKeys
,
int
_t
,
int
_n
);
bool
verifyShares
(
const
char
*
publicShares
,
const
char
*
encr_sshare
,
const
char
*
encryptedKeyHex
,
int
t
,
int
n
,
int
ind
);
...
...
SGXWalletServer.cpp
View file @
a3130c56
...
...
@@ -517,7 +517,7 @@ Json::Value SGXWalletServer::getSecretShareImpl(const string &_polyName, const J
pubKeysStrs
.
push_back
(
_pubKeys
[
i
].
asString
());
}
string
s
=
get_secret_s
hares
(
_polyName
,
encr_poly_ptr
->
c_str
(),
pubKeysStrs
,
_t
,
_n
);
string
s
=
trustedGetSecretS
hares
(
_polyName
,
encr_poly_ptr
->
c_str
(),
pubKeysStrs
,
_t
,
_n
);
//cerr << "result is " << s << endl;
result
[
"secretShare"
]
=
s
;
...
...
secure_enclave/secure_enclave.c
View file @
a3130c56
This diff is collapsed.
Click to expand it.
secure_enclave/secure_enclave.edl
View file @
a3130c56
...
...
@@ -67,21 +67,21 @@ enclave {
[in, count = 1024] char* hashY ,
[out, count = 1024] char* signature);
public void
gen_dkg_s
ecret (
public void
trustedGenDkgS
ecret (
[user_check] int *err_status,
[out, count = 1024] char* err_string,
[out, count = 3050] uint8_t* encrypted_dkg_secret,
[user_check] uint32_t * enc_len,
size_t _t);
public void
decrypt_dkg_s
ecret (
public void
trustedDecryptDkgS
ecret (
[user_check] int *err_status,
[out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_dkg_secret,
[out, count = 2490] uint8_t* decrypted_dkg_secret,
[user_check] uint32_t* dec_len);
public void
get_secret_s
hares (
public void
trustedGetSecretS
hares (
[user_check] int *err_status,
[out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_dkg_secret,
...
...
@@ -90,7 +90,7 @@ enclave {
unsigned _t,
unsigned _n);
public void
get_public_s
hares (
public void
trustedGetPublicS
hares (
[user_check] int *err_status,
[out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_dkg_secret,
...
...
@@ -110,11 +110,11 @@ enclave {
[user_check] uint8_t* sig_v,
int base);
public void
set_encrypted_dkg_p
oly( [user_check] int *err_status,
public void
trustedSetEncryptedDkgP
oly( [user_check] int *err_status,
[out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_poly);
public void
get_encr_ss
hare(
public void
trustedGetEncryptedSecretS
hare(
[user_check]int *err_status,
[out, count = 1024] char *err_string,
[out, count = 1024] uint8_t *encrypted_skey,
...
...
@@ -126,7 +126,7 @@ enclave {
uint8_t _n,
uint8_t ind);
public void
dkg_verification
(
public void
trustedDkgVerify
(
[user_check] int *err_status,
[out, count = 1024] char* err_string,
[in, count = 8193] const char* public_shares,
...
...
@@ -137,7 +137,7 @@ enclave {
int _ind,
[user_check] int* result);
public void
create_bls_k
ey(
public void
trustedCreateBlsK
ey(
[user_check]int *err_status,
[out, count = 1024] char* err_string,
[in, count = 6145] const char* s_shares,
...
...
@@ -146,7 +146,7 @@ enclave {
[out, count = 1024] uint8_t * encr_bls_key,
[user_check] uint32_t *enc_bls_key_len);
public void
get_bls_pub_k
ey(
public void
trustedGetBlsPubK
ey(
[user_check]int *err_status,
[out, count = 1024] char* err_string,
[in, count = 1024] uint8_t* encrypted_key,
...
...
@@ -227,27 +227,27 @@ enclave {
[out, count = 1024] char* key );
public void
gen_dkg_s
ecret_aes (
public void
trustedGenDkgS
ecret_aes (
[user_check] int *err_status,
[out, count = 1024] char* err_string,
[out, count = 3050] uint8_t* encrypted_dkg_secret,
[user_check] uint32_t * enc_len,
size_t _t);
public void
decrypt_dkg_s
ecret_aes (
public void
trustedDecryptDkgS
ecret_aes (
[user_check] int *err_status,
[out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_dkg_secret,
[out, count = 2490] uint8_t* decrypted_dkg_secret,
[user_check] uint32_t* dec_len);
public void
set_encrypted_dkg_p
oly_aes(
public void
trustedSetEncryptedDkgP
oly_aes(
[user_check] int *err_status,
[out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_poly,
[user_check] uint64_t* enc_len);
public void
get_encr_ss
hare_aes(
public void
trustedGetEncryptedSecretS
hare_aes(
[user_check]int *err_status,
[out, count = 1024] char *err_string,
[out, count = 1024] uint8_t *encrypted_skey,
...
...
@@ -259,7 +259,7 @@ enclave {
uint8_t _n,
uint8_t ind);
public void
get_public_s
hares_aes (
public void
trustedGetPublicS
hares_aes (
[user_check] int *err_status,
[out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_dkg_secret,
...
...
@@ -268,7 +268,7 @@ enclave {
unsigned _t,
unsigned _n);
public void
dkg_verification
_aes(
public void
trustedDkgVerify
_aes(
[user_check] int *err_status,
[out, count = 1024] char* err_string,
[in, count = 8193] const char* public_shares,
...
...
@@ -280,7 +280,7 @@ enclave {
[user_check] int* result);
public void
create_bls_k
ey_aes(
public void
trustedCreateBlsK
ey_aes(
[user_check]int *err_status,
[out, count = 1024] char* err_string,
[in, count = 6145] const char* s_shares,
...
...
@@ -298,7 +298,7 @@ enclave {
[in, count = 1024] char* hashY ,
[out, count = 1024] char* signature);
public void
get_bls_pub_k
ey_aes(
public void
trustedGetBlsPubK
ey_aes(
[user_check]int *err_status,
[out, count = 1024] char* err_string,
[in, count = 1024] uint8_t* encrypted_key,
...
...
secure_enclave/secure_enclave.i
View file @
a3130c56
...
...
@@ -5472,10 +5472,10 @@ void trustedGenerateEcdsaKey(int* err_status, char* err_string, uint8_t* encrypt
void encrypt_key(int* err_status, char* err_string, char* key, uint8_t* encrypted_key, uint32_t* enc_len);
void decrypt_key(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t enc_len, char* key);
void trustedBlsSignMessage(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t enc_len, char* hashX, char* hashY, char* signature);
void
gen_dkg_s
ecret(int* err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint32_t* enc_len, size_t _t);
void
decrypt_dkg_s
ecret(int* err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint8_t* decrypted_dkg_secret, uint32_t enc_len);
void
get_secret_s
hares(int* err_status, char* err_string, uint8_t* decrypted_dkg_secret, uint32_t enc_len, char* secret_shares, unsigned int _t, unsigned int _n);
void
get_public_s
hares(int* err_status, char* err_string, uint8_t* decrypted_dkg_secret, uint32_t enc_len, char* public_shares, unsigned int _t, unsigned int _n);
void
trustedGenDkgS
ecret(int* err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint32_t* enc_len, size_t _t);
void
trustedDecryptDkgS
ecret(int* err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint8_t* decrypted_dkg_secret, uint32_t enc_len);
void
trustedGetSecretS
hares(int* err_status, char* err_string, uint8_t* decrypted_dkg_secret, uint32_t enc_len, char* secret_shares, unsigned int _t, unsigned int _n);
void
trustedGetPublicS
hares(int* err_status, char* err_string, uint8_t* decrypted_dkg_secret, uint32_t enc_len, char* public_shares, unsigned int _t, unsigned int _n);
void ecdsa_sign1(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t dec_len, unsigned char* hash, char* signature, int test_len);
sgx_status_t oc_realloc(uint64_t* retval, void* optr, size_t osz, size_t nsz);
...
...
@@ -6887,7 +6887,7 @@ void trustedBlsSignMessage(int *err_status, char *err_string, uint8_t *encrypted
}
void
gen_dkg_s
ecret (int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t* enc_len, size_t _t){
void
trustedGenDkgS
ecret (int *err_status, char *err_string, uint8_t *encrypted_dkg_secret, uint32_t* enc_len, size_t _t){
char* dkg_secret = (char*)malloc(1250);
...
...
@@ -6905,7 +6905,7 @@ void gen_dkg_secret (int *err_status, char *err_string, uint8_t *encrypted_dkg_s
free(dkg_secret);
}
void
decrypt_dkg_s
ecret (int *err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint8_t* decrypted_dkg_secret, uint32_t enc_len){
void
trustedDecryptDkgS
ecret (int *err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint8_t* decrypted_dkg_secret, uint32_t enc_len){
...
...
@@ -6918,17 +6918,17 @@ void decrypt_dkg_secret (int *err_status, char* err_string, uint8_t* encrypted_d
}
}
void
get_secret_s
hares(int *err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint32_t enc_len, char* secret_shares,
void
trustedGetSecretS
hares(int *err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint32_t enc_len, char* secret_shares,
unsigned _t, unsigned _n){
char* decrypted_dkg_secret = (char*)malloc(2000);
decrypt_dkg_s
ecret(err_status, err_string, (uint8_t*)encrypted_dkg_secret, decrypted_dkg_secret, enc_len);
trustedDecryptDkgS
ecret(err_status, err_string, (uint8_t*)encrypted_dkg_secret, decrypted_dkg_secret, enc_len);
calc_secret_shares(decrypted_dkg_secret, secret_shares, _t, _n);
}
void
get_public_s
hares(int *err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint32_t enc_len, char* public_shares,
void
trustedGetPublicS
hares(int *err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint32_t enc_len, char* public_shares,
unsigned _t, unsigned _n){
char* decrypted_dkg_secret = (char*)malloc(2000);
decrypt_dkg_s
ecret(err_status, err_string, (uint8_t*)encrypted_dkg_secret, decrypted_dkg_secret, enc_len);
trustedDecryptDkgS
ecret(err_status, err_string, (uint8_t*)encrypted_dkg_secret, decrypted_dkg_secret, enc_len);
calc_public_shares(decrypted_dkg_secret, public_shares, _t);
}
...
...
testw.cpp
View file @
a3130c56
...
...
@@ -185,21 +185,21 @@ TEST_CASE("DKG gen test", "[dkg-gen]") {
int
err_status
=
0
;
uint32_t
enc_len
=
0
;
status
=
gen_dkg_s
ecret
(
eid
,
&
err_status
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
enc_len
,
32
);
status
=
trustedGenDkgS
ecret
(
eid
,
&
err_status
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
enc_len
,
32
);
REQUIRE
(
status
==
SGX_SUCCESS
);
// printf("
gen_dkg_s
ecret completed with status: %d %s \n", err_status, errMsg.data());
// printf("
trustedGenDkgS
ecret completed with status: %d %s \n", err_status, errMsg.data());
// printf("\n Length: %d \n", enc_len);
vector
<
char
>
secret
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg1
(
BUF_LEN
,
0
);
uint32_t
dec_len
;
status
=
decrypt_dkg_s
ecret
(
eid
,
&
err_status
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
status
=
trustedDecryptDkgS
ecret
(
eid
,
&
err_status
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
(
uint8_t
*
)
secret
.
data
(),
&
dec_len
);
REQUIRE
(
status
==
SGX_SUCCESS
);
// printf("\n
decrypt_dkg_s
ecret completed with status: %d %s \n", err_status, errMsg1.data());
// printf("\n
trustedDecryptDkgS
ecret completed with status: %d %s \n", err_status, errMsg1.data());
// printf("decrypted secret %s \n\n", secret.data());
// printf("secret length %d \n", (int) strlen(secret.data()));
// printf("decr length %d \n", dec_len);
...
...
@@ -277,7 +277,7 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
unsigned
t
=
32
,
n
=
32
;
status
=
gen_dkg_s
ecret
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
n
);
status
=
trustedGenDkgS
ecret
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
n
);
REQUIRE
(
status
==
SGX_SUCCESS
);
//printf("gen_dkg_public completed with status: %d %s \n", err_status, errMsg);
...
...
@@ -287,10 +287,10 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
char
colon
=
':'
;
vector
<
char
>
public_shares
(
10000
,
0
);
status
=
get_public_s
hares
(
eid
,
&
err_status
,
errMsg1
.
data
(),
status
=
trustedGetPublicS
hares
(
eid
,
&
err_status
,
errMsg1
.
data
(),
encrypted_dkg_secret
.
data
(),
enc_len
,
public_shares
.
data
(),
t
,
n
);
REQUIRE
(
status
==
SGX_SUCCESS
);
// printf("\n
get_public_s
hares status: %d error %s \n\n", err_status, errMsg1.data());
// printf("\n
trustedGetPublicS
hares status: %d error %s \n\n", err_status, errMsg1.data());
// printf(" LEN: %d \n", (int) strlen(public_shares.data()));
// printf(" result: %s \n", public_shares.data());
...
...
@@ -306,10 +306,10 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
vector
<
char
>
secret
(
BUF_LEN
,
0
);
status
=
decrypt_dkg_s
ecret
(
eid
,
&
err_status
,
errMsg1
.
data
(),
encrypted_dkg_secret
.
data
(),
status
=
trustedDecryptDkgS
ecret
(
eid
,
&
err_status
,
errMsg1
.
data
(),
encrypted_dkg_secret
.
data
(),
(
uint8_t
*
)
secret
.
data
(),
&
enc_len
);
REQUIRE
(
status
==
SGX_SUCCESS
);
//printf("\n
decrypt_dkg_s
ecret completed with status: %d %s \n", err_status, errMsg1.data());
//printf("\n
trustedDecryptDkgS
ecret completed with status: %d %s \n", err_status, errMsg1.data());
signatures
::
Dkg
dkg_obj
(
t
,
n
);
...
...
@@ -349,11 +349,11 @@ TEST_CASE("DKG encrypted secret shares test", "[dkg-encr-sshares]") {
uint32_t
enc_len
=
0
;
vector
<
uint8_t
>
encrypted_dkg_secret
(
BUF_LEN
,
0
);
status
=
gen_dkg_s
ecret
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
2
);
status
=
trustedGenDkgS
ecret
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
2
);
REQUIRE
(
status
==
SGX_SUCCESS
);
// cerr << " poly generated" << endl;
status
=
set_encrypted_dkg_p
oly
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
());
status
=
trustedSetEncryptedDkgP
oly
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
// cerr << " poly set" << endl;
...
...
@@ -362,7 +362,7 @@ TEST_CASE("DKG encrypted secret shares test", "[dkg-encr-sshares]") {
string
pub_keyB
=
"c0152c48bf640449236036075d65898fded1e242c00acb45519ad5f788ea7cbf9a5df1559e7fc87932eee5478b1b9023de19df654395574a690843988c3ff475"
;
vector
<
char
>
s_shareG2
(
BUF_LEN
,
0
);
status
=
get_encr_ss
hare
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrPRDHKey
.
data
(),
&
enc_len
,
result
.
data
(),
status
=
trustedGetEncryptedSecretS
hare
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrPRDHKey
.
data
(),
&
enc_len
,
result
.
data
(),
s_shareG2
.
data
(),
(
char
*
)
pub_keyB
.
data
(),
2
,
2
,
1
);
...
...
@@ -387,11 +387,11 @@ TEST_CASE("DKG verification test", "[dkg-verify]") {
vector
<
uint8_t
>
encrypted_dkg_secret
(
BUF_LEN
,
0
);
status
=
gen_dkg_s
ecret
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
2
);
status
=
trustedGenDkgS
ecret
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
2
);
REQUIRE
(
status
==
SGX_SUCCESS
);
// cerr << " poly generated" << endl;
status
=
set_encrypted_dkg_p
oly
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
());
status
=
trustedSetEncryptedDkgP
oly
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
// cerr << " poly set" << endl;
...
...
@@ -401,11 +401,11 @@ TEST_CASE("DKG verification test", "[dkg-verify]") {
vector
<
char
>
s_shareG2
(
BUF_LEN
,
0
);
status
=
get_encr_ss
hare
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrPrDHKey
.
data
(),
&
enc_len
,
result
.
data
(),
status
=
trustedGetEncryptedSecretS
hare
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrPrDHKey
.
data
(),
&
enc_len
,
result
.
data
(),
s_shareG2
.
data
(),
(
char
*
)
pub_keyB
.
data
(),
2
,
2
,
1
);
REQUIRE
(
status
==
SGX_SUCCESS
);
// printf("
get_encr_ss
hare completed with status: %d %s \n", err_status, errMsg.data());
// printf("
trustedGetEncryptedSecretS
hare completed with status: %d %s \n", err_status, errMsg.data());
// cerr << "secret share is " << result.data() << endl;
...
...
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