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
5b24c035
Unverified
Commit
5b24c035
authored
Apr 17, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2454-add-logs-to-enclave
parent
6b7165fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
19 deletions
+19
-19
DKGCrypto.cpp
DKGCrypto.cpp
+5
-5
secure_enclave.c
secure_enclave/secure_enclave.c
+8
-8
secure_enclave.edl
secure_enclave/secure_enclave.edl
+6
-6
No files found.
DKGCrypto.cpp
View file @
5b24c035
...
...
@@ -86,7 +86,7 @@ string gen_dkg_poly(int _t) {
if
(
!
encryptKeys
)
status
=
trustedGenDkgSecret
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
else
status
=
trustedGenDkgSecret
_aes
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
status
=
trustedGenDkgSecret
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
if
(
errStatus
!=
0
)
{
throw
SGXException
(
-
666
,
errMsg
.
data
());
}
...
...
@@ -139,7 +139,7 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
n
);
else
{
status
=
trustedGetPublicShares
_aes
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
encLen
,
status
=
trustedGetPublicShares
AES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
encLen
,
pubShares
.
data
(),
t
,
n
);
}
if
(
errStatus
!=
0
)
{
...
...
@@ -183,7 +183,7 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
if
(
!
encryptKeys
)
status
=
trustedSetEncryptedDkgPoly
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
());
else
status
=
trustedSetEncryptedDkgPoly
_aes
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
&
encLen
);
status
=
trustedSetEncryptedDkgPoly
AES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
&
encLen
);
if
(
status
!=
SGX_SUCCESS
||
errStatus
!=
0
)
{
throw
SGXException
(
-
666
,
errMsg1
.
data
());
...
...
@@ -211,7 +211,7 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
trustedGetEncryptedSecretShare
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedSkey
.
data
(),
&
decLen
,
currentShare
.
data
(),
sShareG2
.
data
(),
pubKeyB
.
data
(),
_t
,
_n
,
i
+
1
);
else
trustedGetEncryptedSecretShare
_aes
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedSkey
.
data
(),
&
decLen
,
trustedGetEncryptedSecretShare
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,7 +265,7 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr
if
(
!
encryptKeys
)
trustedDkgVerify
(
eid
,
&
errStatus
,
errMsg
,
pshares
,
encr_sshare
,
encr_key
,
decKeyLen
,
t
,
ind
,
&
result
);
else
trustedDkgVerify
_aes
(
eid
,
&
errStatus
,
errMsg
,
pshares
,
encr_sshare
,
encr_key
,
decKeyLen
,
t
,
ind
,
&
result
);
trustedDkgVerify
AES
(
eid
,
&
errStatus
,
errMsg
,
pshares
,
encr_sshare
,
encr_key
,
decKeyLen
,
t
,
ind
,
&
result
);
if
(
result
==
2
)
{
throw
SGXException
(
INVALID_HEX
,
"Invalid public shares"
);
...
...
secure_enclave/secure_enclave.c
View file @
5b24c035
...
...
@@ -1348,7 +1348,7 @@ void trustedBlsSignMessageAES(int *errStatus, char *err_string, uint8_t *encrypt
}
void
trustedGenDkgSecret
_aes
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_dkg_secret
,
uint32_t
*
enc_len
,
size_t
_t
)
{
trustedGenDkgSecret
AES
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_dkg_secret
,
uint32_t
*
enc_len
,
size_t
_t
)
{
char
dkg_secret
[
DKG_BUFER_LENGTH
];
// = (char*)calloc(DKG_BUFER_LENGTH, 1);
memset
(
dkg_secret
,
0
,
DKG_BUFER_LENGTH
);
...
...
@@ -1392,7 +1392,7 @@ trustedGenDkgSecret_aes(int *errStatus, char *err_string, uint8_t *encrypted_dkg
}
void
trustedDecryptDkgSecret
_aes
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_dkg_secret
,
uint8_t
*
decrypted_dkg_secret
,
trustedDecryptDkgSecret
AES
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_dkg_secret
,
uint8_t
*
decrypted_dkg_secret
,
uint32_t
*
dec_len
)
{
int
status
=
AES_decrypt
(
encrypted_dkg_secret
,
dec_len
,
decrypted_dkg_secret
);
...
...
@@ -1405,7 +1405,7 @@ trustedDecryptDkgSecret_aes(int *errStatus, char *err_string, uint8_t *encrypted
//*dec_len = decr_len;
}
void
trustedSetEncryptedDkgPoly
_aes
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_poly
,
uint64_t
*
enc_len
)
{
void
trustedSetEncryptedDkgPoly
AES
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_poly
,
uint64_t
*
enc_len
)
{
memset
(
decryptedDkgPoly
,
0
,
DKG_BUFER_LENGTH
);
int
status
=
AES_decrypt
(
encrypted_poly
,
*
enc_len
,
decryptedDkgPoly
);
...
...
@@ -1416,7 +1416,7 @@ void trustedSetEncryptedDkgPoly_aes(int *errStatus, char *err_string, uint8_t *e
}
}
void
trustedGetEncryptedSecretShare
_aes
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_skey
,
uint32_t
*
dec_len
,
void
trustedGetEncryptedSecretShare
AES
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_skey
,
uint32_t
*
dec_len
,
char
*
result_str
,
char
*
s_shareG2
,
char
*
pub_keyB
,
uint8_t
_t
,
uint8_t
_n
,
uint8_t
ind
)
{
char
skey
[
ECDSA_SKEY_LEN
];
...
...
@@ -1440,7 +1440,7 @@ void trustedGetEncryptedSecretShare_aes(int *errStatus, char *err_string, uint8_
skey
[
ECDSA_SKEY_LEN
-
1
]
=
0
;
if
(
status
!=
SGX_SUCCESS
)
{
snprintf
(
err_string
,
BUF_LEN
,
"AES_decrypt failed (in trustedGetEncryptedSecretShare
_aes
) with status %d"
,
status
);
snprintf
(
err_string
,
BUF_LEN
,
"AES_decrypt failed (in trustedGetEncryptedSecretShare
AES
) with status %d"
,
status
);
*
errStatus
=
status
;
return
;
}
...
...
@@ -1495,7 +1495,7 @@ void trustedGetEncryptedSecretShare_aes(int *errStatus, char *err_string, uint8_
}
void
trustedGetPublicShares
_aes
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_dkg_secret
,
uint32_t
enc_len
,
void
trustedGetPublicShares
AES
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_dkg_secret
,
uint32_t
enc_len
,
char
*
public_shares
,
unsigned
_t
,
unsigned
_n
)
{
...
...
@@ -1523,7 +1523,7 @@ void trustedGetPublicShares_aes(int *errStatus, char *err_string, uint8_t *encry
//free(decrypted_dkg_secret);
}
void
trustedDkgVerify
_aes
(
int
*
errStatus
,
char
*
err_string
,
const
char
*
public_shares
,
const
char
*
s_share
,
void
trustedDkgVerify
AES
(
int
*
errStatus
,
char
*
err_string
,
const
char
*
public_shares
,
const
char
*
s_share
,
uint8_t
*
encrypted_key
,
uint64_t
enc_len
,
unsigned
_t
,
int
_ind
,
int
*
result
)
{
//uint32_t dec_len = 625;
...
...
@@ -1533,7 +1533,7 @@ void trustedDkgVerify_aes(int *errStatus, char *err_string, const char *public_s
//skey[ECDSA_SKEY_LEN - 1] = 0;
if
(
status
!=
SGX_SUCCESS
)
{
snprintf
(
err_string
,
BUF_LEN
,
"AES_decrypt failed (in trustedDkgVerify
_aes
) with status %d"
,
status
);
snprintf
(
err_string
,
BUF_LEN
,
"AES_decrypt failed (in trustedDkgVerify
AES
) with status %d"
,
status
);
*
errStatus
=
status
;
return
;
}
...
...
secure_enclave/secure_enclave.edl
View file @
5b24c035
...
...
@@ -227,27 +227,27 @@ enclave {
[out, count = SMALL_BUF_SIZE] char* key );
public void trustedGenDkgSecret
_aes
(
public void trustedGenDkgSecret
AES
(
[user_check] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = 3050] uint8_t* encrypted_dkg_secret,
[user_check] uint32_t * enc_len,
size_t _t);
public void trustedDecryptDkgSecret
_aes
(
public void trustedDecryptDkgSecret
AES
(
[user_check] int *errStatus,
[out, count = SMALL_BUF_SIZE] 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 trustedSetEncryptedDkgPoly
_aes
(
public void trustedSetEncryptedDkgPoly
AES
(
[user_check] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = 3050] uint8_t* encrypted_poly,
[user_check] uint64_t* enc_len);
public void trustedGetEncryptedSecretShare
_aes
(
public void trustedGetEncryptedSecretShare
AES
(
[user_check]int *errStatus,
[out, count = SMALL_BUF_SIZE] char *err_string,
[out, count = SMALL_BUF_SIZE] uint8_t *encrypted_skey,
...
...
@@ -259,7 +259,7 @@ enclave {
uint8_t _n,
uint8_t ind);
public void trustedGetPublicShares
_aes
(
public void trustedGetPublicShares
AES
(
[user_check] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = 3050] uint8_t* encrypted_dkg_secret,
...
...
@@ -268,7 +268,7 @@ enclave {
unsigned _t,
unsigned _n);
public void trustedDkgVerify
_aes
(
public void trustedDkgVerify
AES
(
[user_check] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = 8193] const char* public_shares,
...
...
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