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
83b5c23e
Unverified
Commit
83b5c23e
authored
Sep 10, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3039
parent
3e81244d
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
67 additions
and
66 deletions
+67
-66
BLSCrypto.cpp
BLSCrypto.cpp
+2
-2
BLSPrivateKeyShareSGX.cpp
BLSPrivateKeyShareSGX.cpp
+1
-1
DKGCrypto.cpp
DKGCrypto.cpp
+8
-8
DKGCrypto.h
DKGCrypto.h
+1
-1
ECDSACrypto.cpp
ECDSACrypto.cpp
+3
-3
SEKManager.cpp
SEKManager.cpp
+3
-3
start.sh
docker/start.sh
+2
-1
secure_enclave.c
secure_enclave/secure_enclave.c
+17
-17
secure_enclave.edl
secure_enclave/secure_enclave.edl
+15
-15
testw.cpp
testw.cpp
+15
-15
No files found.
BLSCrypto.cpp
View file @
83b5c23e
...
@@ -217,7 +217,7 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
...
@@ -217,7 +217,7 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
RESTART_BEGIN
RESTART_BEGIN
status
=
trustedBlsSignMessage
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedKey
,
status
=
trustedBlsSignMessage
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedKey
,
sz
,
xStrArg
,
yStrArg
,
signature
);
sz
,
xStrArg
,
yStrArg
,
signature
);
RESTART_END
RESTART_END
...
@@ -259,7 +259,7 @@ string encryptBLSKeyShare2Hex(int *errStatus, char *err_string, const char *_key
...
@@ -259,7 +259,7 @@ string encryptBLSKeyShare2Hex(int *errStatus, char *err_string, const char *_key
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
RESTART_BEGIN
RESTART_BEGIN
status
=
trustedEncryptKey
AES
(
eid
,
errStatus
,
errMsg
.
data
(),
keyArray
->
data
(),
encryptedKey
->
data
(),
status
=
trustedEncryptKey
(
eid
,
errStatus
,
errMsg
.
data
(),
keyArray
->
data
(),
encryptedKey
->
data
(),
&
encryptedLen
);
&
encryptedLen
);
RESTART_END_POINTER
RESTART_END_POINTER
...
...
BLSPrivateKeyShareSGX.cpp
View file @
83b5c23e
...
@@ -150,7 +150,7 @@ string BLSPrivateKeyShareSGX::signWithHelperSGXstr(
...
@@ -150,7 +150,7 @@ string BLSPrivateKeyShareSGX::signWithHelperSGXstr(
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
RESTART_BEGIN
RESTART_BEGIN
status
=
trustedBlsSignMessage
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedKey
,
status
=
trustedBlsSignMessage
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedKey
,
encryptedKeyHex
->
size
()
/
2
,
xStrArg
,
yStrArg
,
signature
);
encryptedKeyHex
->
size
()
/
2
,
xStrArg
,
yStrArg
,
signature
);
RESTART_END
RESTART_END
...
...
DKGCrypto.cpp
View file @
83b5c23e
...
@@ -136,7 +136,7 @@ string gen_dkg_poly(int _t) {
...
@@ -136,7 +136,7 @@ string gen_dkg_poly(int _t) {
RESTART_BEGIN
RESTART_BEGIN
status
=
trustedGenDkgSecret
AES
(
status
=
trustedGenDkgSecret
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
eid
,
&
errStatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
RESTART_END
RESTART_END
...
@@ -175,7 +175,7 @@ vector <vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int
...
@@ -175,7 +175,7 @@ vector <vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int
RESTART_BEGIN
RESTART_BEGIN
status
=
trustedGetPublicShares
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrDKGPoly
.
data
(),
encLen
,
status
=
trustedGetPublicShares
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrDKGPoly
.
data
(),
encLen
,
pubShares
.
data
(),
t
,
n
);
pubShares
.
data
(),
t
,
n
);
RESTART_END
RESTART_END
...
@@ -213,7 +213,7 @@ getSecretShares(const string &_polyName, const char *_encryptedPolyHex, const ve
...
@@ -213,7 +213,7 @@ getSecretShares(const string &_polyName, const char *_encryptedPolyHex, const ve
READ_LOCK
(
initMutex
);
READ_LOCK
(
initMutex
);
status
=
trustedSetEncryptedDkgPoly
AES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
encLen
);
status
=
trustedSetEncryptedDkgPoly
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
encLen
);
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg1
.
data
());
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg1
.
data
());
...
@@ -234,7 +234,7 @@ getSecretShares(const string &_polyName, const char *_encryptedPolyHex, const ve
...
@@ -234,7 +234,7 @@ getSecretShares(const string &_polyName, const char *_encryptedPolyHex, const ve
spdlog
::
debug
(
"pubKeyB is {}"
,
pub_keyB
);
spdlog
::
debug
(
"pubKeyB is {}"
,
pub_keyB
);
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
status
=
trustedGetEncryptedSecretShare
AES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedSkey
.
data
(),
&
decLen
,
status
=
trustedGetEncryptedSecretShare
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedSkey
.
data
(),
&
decLen
,
currentShare
.
data
(),
sShareG2
.
data
(),
pubKeyB
.
data
(),
_t
,
_n
,
currentShare
.
data
(),
sShareG2
.
data
(),
pubKeyB
.
data
(),
_t
,
_n
,
i
+
1
);
i
+
1
);
...
@@ -287,7 +287,7 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr
...
@@ -287,7 +287,7 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
RESTART_BEGIN
RESTART_BEGIN
status
=
trustedDkgVerify
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
pshares
,
encr_sshare
,
encr_key
,
decKeyLen
,
t
,
status
=
trustedDkgVerify
(
eid
,
&
errStatus
,
errMsg
.
data
(),
pshares
,
encr_sshare
,
encr_key
,
decKeyLen
,
t
,
ind
,
&
result
);
ind
,
&
result
);
RESTART_END
RESTART_END
...
@@ -318,7 +318,7 @@ bool createBLSShare(const string &blsKeyName, const char *s_shares, const char *
...
@@ -318,7 +318,7 @@ bool createBLSShare(const string &blsKeyName, const char *s_shares, const char *
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
RESTART_BEGIN
RESTART_BEGIN
status
=
trustedCreateBlsKey
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
s_shares
,
encr_key
,
decKeyLen
,
encr_bls_key
,
status
=
trustedCreateBlsKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
s_shares
,
encr_key
,
decKeyLen
,
encr_bls_key
,
&
enc_bls_len
);
&
enc_bls_len
);
RESTART_END
RESTART_END
...
@@ -354,7 +354,7 @@ vector <string> getBLSPubKey(const char *encryptedKeyHex) {
...
@@ -354,7 +354,7 @@ vector <string> getBLSPubKey(const char *encryptedKeyHex) {
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
RESTART_BEGIN
RESTART_BEGIN
status
=
trustedGetBlsPubKey
AES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrKey
,
decKeyLen
,
pubKey
);
status
=
trustedGetBlsPubKey
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrKey
,
decKeyLen
,
pubKey
);
RESTART_END
RESTART_END
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg1
.
data
());
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg1
.
data
());
...
@@ -440,7 +440,7 @@ string decryptDHKey(const string &polyName, int ind) {
...
@@ -440,7 +440,7 @@ string decryptDHKey(const string &polyName, int ind) {
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
RESTART_BEGIN
RESTART_BEGIN
status
=
trustedDecryptKey
AES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDHKey
,
dhEncLen
,
DHKey
);
status
=
trustedDecryptKey
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDHKey
,
dhEncLen
,
DHKey
);
RESTART_END
RESTART_END
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg1
.
data
());
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg1
.
data
());
...
...
DKGCrypto.h
View file @
83b5c23e
...
@@ -55,6 +55,6 @@ string convertG2ToString(const libff::alt_bn128_G2& elem, int base = 10, const s
...
@@ -55,6 +55,6 @@ string convertG2ToString(const libff::alt_bn128_G2& elem, int base = 10, const s
vector
<
string
>
calculateAllBlsPublicKeys
(
const
vector
<
string
>&
public_shares
);
vector
<
string
>
calculateAllBlsPublicKeys
(
const
vector
<
string
>&
public_shares
);
bool
Testc
reateBLSShare
(
const
char
*
s_shares
);
bool
testC
reateBLSShare
(
const
char
*
s_shares
);
#endif //SGXD_DKGCRYPTO_H
#endif //SGXD_DKGCRYPTO_H
ECDSACrypto.cpp
View file @
83b5c23e
...
@@ -60,7 +60,7 @@ vector <string> genECDSAKey() {
...
@@ -60,7 +60,7 @@ vector <string> genECDSAKey() {
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
RESTART_BEGIN
RESTART_BEGIN
status
=
trustedGenerateEcdsaKey
AES
(
eid
,
&
errStatus
,
status
=
trustedGenerateEcdsaKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encr_pr_key
.
data
(),
&
enc_len
,
errMsg
.
data
(),
encr_pr_key
.
data
(),
&
enc_len
,
pub_key_x
.
data
(),
pub_key_y
.
data
());
pub_key_x
.
data
(),
pub_key_y
.
data
());
RESTART_END
RESTART_END
...
@@ -107,7 +107,7 @@ string getECDSAPubKey(const std::string& _encryptedKeyHex) {
...
@@ -107,7 +107,7 @@ string getECDSAPubKey(const std::string& _encryptedKeyHex) {
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
RESTART_BEGIN
RESTART_BEGIN
status
=
trustedGetPublicEcdsaKey
AES
(
eid
,
&
errStatus
,
status
=
trustedGetPublicEcdsaKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrKey
.
data
(),
enc_len
,
pubKeyX
.
data
(),
pubKeyY
.
data
());
errMsg
.
data
(),
encrPrKey
.
data
(),
enc_len
,
pubKeyX
.
data
(),
pubKeyY
.
data
());
RESTART_END
RESTART_END
...
@@ -196,7 +196,7 @@ vector <string> ecdsaSignHash(const std::string& encryptedKeyHex, const char *ha
...
@@ -196,7 +196,7 @@ vector <string> ecdsaSignHash(const std::string& encryptedKeyHex, const char *ha
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
RESTART_BEGIN
RESTART_BEGIN
status
=
trustedEcdsaSign
AES
(
eid
,
&
errStatus
,
status
=
trustedEcdsaSign
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedKey
.
data
(),
decLen
,
hashHex
,
errMsg
.
data
(),
encryptedKey
.
data
(),
decLen
,
hashHex
,
signatureR
.
data
(),
signatureR
.
data
(),
signatureS
.
data
(),
&
signatureV
,
base
);
signatureS
.
data
(),
&
signatureV
,
base
);
...
...
SEKManager.cpp
View file @
83b5c23e
...
@@ -66,7 +66,7 @@ void create_test_key() {
...
@@ -66,7 +66,7 @@ void create_test_key() {
{
{
READ_LOCK
(
initMutex
);
READ_LOCK
(
initMutex
);
status
=
trustedEncryptKey
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
key
.
c_str
(),
encrypted_key
,
&
enc_len
);
status
=
trustedEncryptKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
key
.
c_str
(),
encrypted_key
,
&
enc_len
);
}
}
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg
.
data
());
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg
.
data
());
...
@@ -99,7 +99,7 @@ void validate_SEK() {
...
@@ -99,7 +99,7 @@ void validate_SEK() {
{
{
READ_LOCK
(
initMutex
);
READ_LOCK
(
initMutex
);
status
=
trustedDecryptKey
AES
(
eid
,
&
err_status
,
errMsg
.
data
(),
encr_test_key
.
data
(),
len
,
decr_key
.
data
());
status
=
trustedDecryptKey
(
eid
,
&
err_status
,
errMsg
.
data
(),
encr_test_key
.
data
(),
len
,
decr_key
.
data
());
}
}
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
err_status
,
errMsg
.
data
());
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
err_status
,
errMsg
.
data
());
...
@@ -129,7 +129,7 @@ shared_ptr <vector<uint8_t>> check_and_set_SEK(const string &SEK) {
...
@@ -129,7 +129,7 @@ shared_ptr <vector<uint8_t>> check_and_set_SEK(const string &SEK) {
{
{
READ_LOCK
(
initMutex
);
READ_LOCK
(
initMutex
);
status
=
trustedSetSEK
_b
ackup
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_SEK
->
data
(),
&
l
,
status
=
trustedSetSEK
B
ackup
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_SEK
->
data
(),
&
l
,
SEK
.
c_str
());
SEK
.
c_str
());
}
}
...
...
docker/start.sh
View file @
83b5c23e
...
@@ -43,9 +43,10 @@ fi
...
@@ -43,9 +43,10 @@ fi
if
[[
"
$1
"
==
"-t"
]]
;
then
if
[[
"
$1
"
==
"-t"
]]
;
then
echo
"Test run requested"
echo
"Test run requested"
##sleep 0
sleep
5
./testw.py
./testw.py
else
else
sleep
3
./sgxwallet
$1
$2
$3
$4
$5
./sgxwallet
$1
$2
$3
$4
$5
fi
fi
secure_enclave/secure_enclave.c
View file @
83b5c23e
...
@@ -339,7 +339,7 @@ void trustedSetSEK(int *errStatus, char *errString, uint8_t *encrypted_sek) {
...
@@ -339,7 +339,7 @@ void trustedSetSEK(int *errStatus, char *errString, uint8_t *encrypted_sek) {
LOG_INFO
(
"SGX call completed"
);
LOG_INFO
(
"SGX call completed"
);
}
}
void
trustedSetSEK
_b
ackup
(
int
*
errStatus
,
char
*
errString
,
void
trustedSetSEK
B
ackup
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_sek
,
uint64_t
*
enc_len
,
const
char
*
sek_hex
)
{
uint8_t
*
encrypted_sek
,
uint64_t
*
enc_len
,
const
char
*
sek_hex
)
{
CALL_ONCE
CALL_ONCE
LOG_INFO
(
__FUNCTION__
);
LOG_INFO
(
__FUNCTION__
);
...
@@ -368,7 +368,7 @@ void trustedSetSEK_backup(int *errStatus, char *errString,
...
@@ -368,7 +368,7 @@ void trustedSetSEK_backup(int *errStatus, char *errString,
void
trustedGenerateEcdsaKey
AES
(
int
*
errStatus
,
char
*
errString
,
void
trustedGenerateEcdsaKey
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encryptedPrivateKey
,
uint64_t
*
enc_len
,
char
*
pub_key_x
,
char
*
pub_key_y
)
{
uint8_t
*
encryptedPrivateKey
,
uint64_t
*
enc_len
,
char
*
pub_key_x
,
char
*
pub_key_y
)
{
LOG_INFO
(
__FUNCTION__
);
LOG_INFO
(
__FUNCTION__
);
INIT_ERROR_STATE
INIT_ERROR_STATE
...
@@ -439,7 +439,7 @@ void trustedGenerateEcdsaKeyAES(int *errStatus, char *errString,
...
@@ -439,7 +439,7 @@ void trustedGenerateEcdsaKeyAES(int *errStatus, char *errString,
LOG_INFO
(
"SGX call completed"
);
LOG_INFO
(
"SGX call completed"
);
}
}
void
trustedGetPublicEcdsaKey
AES
(
int
*
errStatus
,
char
*
errString
,
void
trustedGetPublicEcdsaKey
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encryptedPrivateKey
,
uint64_t
enc_len
,
char
*
pub_key_x
,
char
*
pub_key_y
)
{
uint8_t
*
encryptedPrivateKey
,
uint64_t
enc_len
,
char
*
pub_key_x
,
char
*
pub_key_y
)
{
LOG_DEBUG
(
__FUNCTION__
);
LOG_DEBUG
(
__FUNCTION__
);
INIT_ERROR_STATE
INIT_ERROR_STATE
...
@@ -520,7 +520,7 @@ void trustedGetPublicEcdsaKeyAES(int *errStatus, char *errString,
...
@@ -520,7 +520,7 @@ void trustedGetPublicEcdsaKeyAES(int *errStatus, char *errString,
static
uint64_t
sigCounter
=
0
;
static
uint64_t
sigCounter
=
0
;
void
trustedEcdsaSign
AES
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encryptedPrivateKey
,
uint64_t
enc_len
,
void
trustedEcdsaSign
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encryptedPrivateKey
,
uint64_t
enc_len
,
const
char
*
hash
,
char
*
sigR
,
char
*
sigS
,
uint8_t
*
sig_v
,
int
base
)
{
const
char
*
hash
,
char
*
sigR
,
char
*
sigS
,
uint8_t
*
sig_v
,
int
base
)
{
LOG_DEBUG
(
__FUNCTION__
);
LOG_DEBUG
(
__FUNCTION__
);
...
@@ -609,7 +609,7 @@ void trustedEcdsaSignAES(int *errStatus, char *errString, uint8_t *encryptedPriv
...
@@ -609,7 +609,7 @@ void trustedEcdsaSignAES(int *errStatus, char *errString, uint8_t *encryptedPriv
}
}
void
trustedDecryptKey
AES
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encryptedPrivateKey
,
void
trustedDecryptKey
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encryptedPrivateKey
,
uint64_t
enc_len
,
char
*
key
)
{
uint64_t
enc_len
,
char
*
key
)
{
LOG_DEBUG
(
__FUNCTION__
);
LOG_DEBUG
(
__FUNCTION__
);
...
@@ -654,7 +654,7 @@ void trustedDecryptKeyAES(int *errStatus, char *errString, uint8_t *encryptedPri
...
@@ -654,7 +654,7 @@ void trustedDecryptKeyAES(int *errStatus, char *errString, uint8_t *encryptedPri
}
}
void
trustedEncryptKey
AES
(
int
*
errStatus
,
char
*
errString
,
const
char
*
key
,
void
trustedEncryptKey
(
int
*
errStatus
,
char
*
errString
,
const
char
*
key
,
uint8_t
*
encryptedPrivateKey
,
uint64_t
*
enc_len
)
{
uint8_t
*
encryptedPrivateKey
,
uint64_t
*
enc_len
)
{
LOG_INFO
(
__FUNCTION__
);
LOG_INFO
(
__FUNCTION__
);
...
@@ -707,7 +707,7 @@ void trustedEncryptKeyAES(int *errStatus, char *errString, const char *key,
...
@@ -707,7 +707,7 @@ void trustedEncryptKeyAES(int *errStatus, char *errString, const char *key,
}
}
void
trustedBlsSignMessage
AES
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encryptedPrivateKey
,
void
trustedBlsSignMessage
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encryptedPrivateKey
,
uint64_t
enc_len
,
char
*
_hashX
,
uint64_t
enc_len
,
char
*
_hashX
,
char
*
_hashY
,
char
*
signature
)
{
char
*
_hashY
,
char
*
signature
)
{
LOG_DEBUG
(
__FUNCTION__
);
LOG_DEBUG
(
__FUNCTION__
);
...
@@ -753,7 +753,7 @@ void trustedBlsSignMessageAES(int *errStatus, char *errString, uint8_t *encrypte
...
@@ -753,7 +753,7 @@ void trustedBlsSignMessageAES(int *errStatus, char *errString, uint8_t *encrypte
}
}
void
void
trustedGenDkgSecret
AES
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_dkg_secret
,
uint64_t
*
enc_len
,
size_t
_t
)
{
trustedGenDkgSecret
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_dkg_secret
,
uint64_t
*
enc_len
,
size_t
_t
)
{
LOG_INFO
(
__FUNCTION__
);
LOG_INFO
(
__FUNCTION__
);
INIT_ERROR_STATE
INIT_ERROR_STATE
...
@@ -798,7 +798,7 @@ trustedGenDkgSecretAES(int *errStatus, char *errString, uint8_t *encrypted_dkg_s
...
@@ -798,7 +798,7 @@ trustedGenDkgSecretAES(int *errStatus, char *errString, uint8_t *encrypted_dkg_s
}
}
void
void
trustedDecryptDkgSecret
AES
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_dkg_secret
,
trustedDecryptDkgSecret
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_dkg_secret
,
uint64_t
enc_len
,
uint64_t
enc_len
,
uint8_t
*
decrypted_dkg_secret
)
{
uint8_t
*
decrypted_dkg_secret
)
{
LOG_INFO
(
__FUNCTION__
);
LOG_INFO
(
__FUNCTION__
);
...
@@ -824,7 +824,7 @@ trustedDecryptDkgSecretAES(int *errStatus, char *errString, uint8_t *encrypted_d
...
@@ -824,7 +824,7 @@ trustedDecryptDkgSecretAES(int *errStatus, char *errString, uint8_t *encrypted_d
}
}
void
trustedSetEncryptedDkgPoly
AES
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_poly
,
uint64_t
enc_len
)
{
void
trustedSetEncryptedDkgPoly
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_poly
,
uint64_t
enc_len
)
{
LOG_INFO
(
__FUNCTION__
);
LOG_INFO
(
__FUNCTION__
);
INIT_ERROR_STATE
INIT_ERROR_STATE
...
@@ -847,7 +847,7 @@ void trustedSetEncryptedDkgPolyAES(int *errStatus, char *errString, uint8_t *enc
...
@@ -847,7 +847,7 @@ void trustedSetEncryptedDkgPolyAES(int *errStatus, char *errString, uint8_t *enc
LOG_INFO
(
"SGX call completed"
);
LOG_INFO
(
"SGX call completed"
);
}
}
void
trustedGetEncryptedSecretShare
AES
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_skey
,
uint64_t
*
dec_len
,
void
trustedGetEncryptedSecretShare
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_skey
,
uint64_t
*
dec_len
,
char
*
result_str
,
char
*
s_shareG2
,
char
*
pub_keyB
,
uint8_t
_t
,
uint8_t
_n
,
char
*
result_str
,
char
*
s_shareG2
,
char
*
pub_keyB
,
uint8_t
_t
,
uint8_t
_n
,
uint8_t
ind
)
{
uint8_t
ind
)
{
...
@@ -868,9 +868,9 @@ void trustedGetEncryptedSecretShareAES(int *errStatus, char *errString, uint8_t
...
@@ -868,9 +868,9 @@ void trustedGetEncryptedSecretShareAES(int *errStatus, char *errString, uint8_t
SAFE_CHAR_BUF
(
pub_key_x
,
BUF_LEN
);
SAFE_CHAR_BUF
(
pub_key_y
,
BUF_LEN
);
SAFE_CHAR_BUF
(
pub_key_x
,
BUF_LEN
);
SAFE_CHAR_BUF
(
pub_key_y
,
BUF_LEN
);
trustedGenerateEcdsaKey
AES
(
&
status
,
errString
,
encrypted_skey
,
&
enc_len
,
pub_key_x
,
pub_key_y
);
trustedGenerateEcdsaKey
(
&
status
,
errString
,
encrypted_skey
,
&
enc_len
,
pub_key_x
,
pub_key_y
);
CHECK_STATUS
(
"trustedGenerateEcdsaKey
AES
failed"
);
CHECK_STATUS
(
"trustedGenerateEcdsaKey failed"
);
uint8_t
type
=
0
;
uint8_t
type
=
0
;
uint8_t
exportable
=
0
;
uint8_t
exportable
=
0
;
...
@@ -915,7 +915,7 @@ void trustedGetEncryptedSecretShareAES(int *errStatus, char *errString, uint8_t
...
@@ -915,7 +915,7 @@ void trustedGetEncryptedSecretShareAES(int *errStatus, char *errString, uint8_t
LOG_INFO
(
"SGX call completed"
);
LOG_INFO
(
"SGX call completed"
);
}
}
void
trustedGetPublicShares
AES
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_dkg_secret
,
uint64_t
enc_len
,
void
trustedGetPublicShares
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_dkg_secret
,
uint64_t
enc_len
,
char
*
public_shares
,
char
*
public_shares
,
unsigned
_t
,
unsigned
_n
)
{
unsigned
_t
,
unsigned
_n
)
{
LOG_INFO
(
__FUNCTION__
);
LOG_INFO
(
__FUNCTION__
);
...
@@ -946,7 +946,7 @@ void trustedGetPublicSharesAES(int *errStatus, char *errString, uint8_t *encrypt
...
@@ -946,7 +946,7 @@ void trustedGetPublicSharesAES(int *errStatus, char *errString, uint8_t *encrypt
LOG_INFO
(
"SGX call completed"
);
LOG_INFO
(
"SGX call completed"
);
}
}
void
trustedDkgVerify
AES
(
int
*
errStatus
,
char
*
errString
,
const
char
*
public_shares
,
const
char
*
s_share
,
void
trustedDkgVerify
(
int
*
errStatus
,
char
*
errString
,
const
char
*
public_shares
,
const
char
*
s_share
,
uint8_t
*
encryptedPrivateKey
,
uint64_t
enc_len
,
unsigned
_t
,
int
_ind
,
int
*
result
)
{
uint8_t
*
encryptedPrivateKey
,
uint64_t
enc_len
,
unsigned
_t
,
int
_ind
,
int
*
result
)
{
LOG_INFO
(
__FUNCTION__
);
LOG_INFO
(
__FUNCTION__
);
...
@@ -999,7 +999,7 @@ void trustedDkgVerifyAES(int *errStatus, char *errString, const char *public_sha
...
@@ -999,7 +999,7 @@ void trustedDkgVerifyAES(int *errStatus, char *errString, const char *public_sha
LOG_INFO
(
"SGX call completed"
);
LOG_INFO
(
"SGX call completed"
);
}
}
void
trustedCreateBlsKey
AES
(
int
*
errStatus
,
char
*
errString
,
const
char
*
s_shares
,
void
trustedCreateBlsKey
(
int
*
errStatus
,
char
*
errString
,
const
char
*
s_shares
,
uint8_t
*
encryptedPrivateKey
,
uint64_t
key_len
,
uint8_t
*
encr_bls_key
,
uint8_t
*
encryptedPrivateKey
,
uint64_t
key_len
,
uint8_t
*
encr_bls_key
,
uint64_t
*
enc_bls_key_len
)
{
uint64_t
*
enc_bls_key_len
)
{
...
@@ -1104,7 +1104,7 @@ void trustedCreateBlsKeyAES(int *errStatus, char *errString, const char *s_share
...
@@ -1104,7 +1104,7 @@ void trustedCreateBlsKeyAES(int *errStatus, char *errString, const char *s_share
}
}
void
void
trustedGetBlsPubKey
AES
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encryptedPrivateKey
,
uint64_t
key_len
,
trustedGetBlsPubKey
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encryptedPrivateKey
,
uint64_t
key_len
,
char
*
bls_pub_key
)
{
char
*
bls_pub_key
)
{
LOG_DEBUG
(
__FUNCTION__
);
LOG_DEBUG
(
__FUNCTION__
);
...
...
secure_enclave/secure_enclave.edl
View file @
83b5c23e
...
@@ -26,14 +26,14 @@ enclave {
...
@@ -26,14 +26,14 @@ enclave {
[out, count = SMALL_BUF_SIZE] char *err_string,
[out, count = SMALL_BUF_SIZE] char *err_string,
[in, count = SMALL_BUF_SIZE] uint8_t *encrypted_SEK);
[in, count = SMALL_BUF_SIZE] uint8_t *encrypted_SEK);
public void trustedSetSEK
_b
ackup(
public void trustedSetSEK
B
ackup(
[out] int *errStatus,
[out] int *errStatus,
[out, count = SMALL_BUF_SIZE] char *err_string,
[out, count = SMALL_BUF_SIZE] char *err_string,
[out, count = SMALL_BUF_SIZE] uint8_t *encrypted_SEK,
[out, count = SMALL_BUF_SIZE] uint8_t *encrypted_SEK,
[out] uint64_t *enc_len,
[out] uint64_t *enc_len,
[in, string] const char* SEK_hex);
[in, string] const char* SEK_hex);
public void trustedGenerateEcdsaKey
AES
(
public void trustedGenerateEcdsaKey (
[out] int *errStatus,
[out] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
[out, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
...
@@ -41,7 +41,7 @@ enclave {
...
@@ -41,7 +41,7 @@ enclave {
[out, count = SMALL_BUF_SIZE] char * pub_key_x,
[out, count = SMALL_BUF_SIZE] char * pub_key_x,
[out, count = SMALL_BUF_SIZE] char * pub_key_y);
[out, count = SMALL_BUF_SIZE] char * pub_key_y);
public void trustedGetPublicEcdsaKey
AES
(
public void trustedGetPublicEcdsaKey(
[out] int *errStatus,
[out] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
[in, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
...
@@ -49,7 +49,7 @@ enclave {
...
@@ -49,7 +49,7 @@ enclave {
[out, count = SMALL_BUF_SIZE] char * pub_key_x,
[out, count = SMALL_BUF_SIZE] char * pub_key_x,
[out, count = SMALL_BUF_SIZE] char * pub_key_y);
[out, count = SMALL_BUF_SIZE] char * pub_key_y);
public void trustedEcdsaSign
AES
(
public void trustedEcdsaSign(
[out] int *errStatus,
[out] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
[in, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
...
@@ -60,27 +60,27 @@ enclave {
...
@@ -60,27 +60,27 @@ enclave {
[out] uint8_t* sig_v,
[out] uint8_t* sig_v,
int base);
int base);
public void trustedEncryptKey
AES
(
public void trustedEncryptKey (
[out] int *errStatus,
[out] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = SMALL_BUF_SIZE] const char* key,
[in, count = SMALL_BUF_SIZE] const char* key,
[out, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
[out, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
[out] uint64_t *enc_len);
[out] uint64_t *enc_len);
public void trustedDecryptKey
AES
(
public void trustedDecryptKey (
[out] int *errStatus,
[out] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
[in, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
uint64_t enc_len,
uint64_t enc_len,
[out, count = SMALL_BUF_SIZE] char* key );
[out, count = SMALL_BUF_SIZE] char* key );
public void trustedGenDkgSecret
AES
(
public void trustedGenDkgSecret (
[out] int *errStatus,
[out] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = 3072] uint8_t* encrypted_dkg_secret,
[out, count = 3072] uint8_t* encrypted_dkg_secret,
[out] uint64_t * enc_len, size_t _t);
[out] uint64_t * enc_len, size_t _t);
public void trustedDecryptDkgSecret
AES
(
public void trustedDecryptDkgSecret (
[out] int *errStatus,
[out] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = 3050] uint8_t* encrypted_dkg_secret,
[in, count = 3050] uint8_t* encrypted_dkg_secret,
...
@@ -88,13 +88,13 @@ enclave {
...
@@ -88,13 +88,13 @@ enclave {
[out, count = 3072] uint8_t* decrypted_dkg_secret
[out, count = 3072] uint8_t* decrypted_dkg_secret
);
);
public void trustedSetEncryptedDkgPoly
AES
(
public void trustedSetEncryptedDkgPoly(
[out] int *errStatus,
[out] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = 3050] uint8_t* encrypted_poly,
[in, count = 3050] uint8_t* encrypted_poly,
uint64_t enc_len);
uint64_t enc_len);
public void trustedGetEncryptedSecretShare
AES
(
public void trustedGetEncryptedSecretShare(
[out]int *errStatus,
[out]int *errStatus,
[out, count = SMALL_BUF_SIZE] char *err_string,
[out, count = SMALL_BUF_SIZE] char *err_string,
[out, count = SMALL_BUF_SIZE] uint8_t *encrypted_skey,
[out, count = SMALL_BUF_SIZE] uint8_t *encrypted_skey,
...
@@ -106,7 +106,7 @@ enclave {
...
@@ -106,7 +106,7 @@ enclave {
uint8_t _n,
uint8_t _n,
uint8_t ind);
uint8_t ind);
public void trustedGetPublicShares
AES
(
public void trustedGetPublicShares(
[out] int *errStatus,
[out] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = 3050] uint8_t* encrypted_dkg_secret,
[in, count = 3050] uint8_t* encrypted_dkg_secret,
...
@@ -115,7 +115,7 @@ enclave {
...
@@ -115,7 +115,7 @@ enclave {
unsigned _t,
unsigned _t,
unsigned _n);
unsigned _n);
public void trustedDkgVerify
AES
(
public void trustedDkgVerify(
[out] int *errStatus,
[out] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, string] const char* public_shares,
[in, string] const char* public_shares,
...
@@ -126,7 +126,7 @@ enclave {
...
@@ -126,7 +126,7 @@ enclave {
int _ind,
int _ind,
[out] int* result);
[out] int* result);
public void trustedCreateBlsKey
AES
(
public void trustedCreateBlsKey(
[out]int *errStatus,
[out]int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = 6145] const char* s_shares,
[in, count = 6145] const char* s_shares,
...
@@ -135,7 +135,7 @@ enclave {
...
@@ -135,7 +135,7 @@ enclave {
[out, count = SMALL_BUF_SIZE] uint8_t * encr_bls_key,
[out, count = SMALL_BUF_SIZE] uint8_t * encr_bls_key,
[out] uint64_t *enc_bls_key_len);
[out] uint64_t *enc_bls_key_len);
public void trustedBlsSignMessage
AES
(
public void trustedBlsSignMessage (
[out] int *errStatus,
[out] int *errStatus,
[out, count = TINY_BUF_SIZE] char* err_string,
[out, count = TINY_BUF_SIZE] char* err_string,
[in, count = TINY_BUF_SIZE] uint8_t* encrypted_key,
[in, count = TINY_BUF_SIZE] uint8_t* encrypted_key,
...
@@ -144,7 +144,7 @@ enclave {
...
@@ -144,7 +144,7 @@ enclave {
[in, string] char* hashY,
[in, string] char* hashY,
[out, count = SMALL_BUF_SIZE] char* signature);
[out, count = SMALL_BUF_SIZE] char* signature);
public void trustedGetBlsPubKey
AES
(
public void trustedGetBlsPubKey(
[out]int *errStatus,
[out]int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
[in, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
...
...
testw.cpp
View file @
83b5c23e
...
@@ -129,7 +129,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES keygen and signature test", "[ecdsa-aes
...
@@ -129,7 +129,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES keygen and signature test", "[ecdsa-aes
uint64_t
encLen
=
0
;
uint64_t
encLen
=
0
;
PRINT_SRC_LINE
PRINT_SRC_LINE
auto
status
=
trustedGenerateEcdsaKey
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrivKey
.
data
(),
&
encLen
,
auto
status
=
trustedGenerateEcdsaKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrivKey
.
data
(),
&
encLen
,
pubKeyX
.
data
(),
pubKeyX
.
data
(),
pubKeyY
.
data
());
pubKeyY
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
...
@@ -143,7 +143,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES keygen and signature test", "[ecdsa-aes
...
@@ -143,7 +143,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES keygen and signature test", "[ecdsa-aes
for
(
int
i
=
0
;
i
<
50
;
i
++
)
{
for
(
int
i
=
0
;
i
<
50
;
i
++
)
{
PRINT_SRC_LINE
PRINT_SRC_LINE
status
=
trustedEcdsaSign
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrivKey
.
data
(),
encLen
,
status
=
trustedEcdsaSign
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrivKey
.
data
(),
encLen
,
hex
.
data
(),
hex
.
data
(),
signatureR
.
data
(),
signatureR
.
data
(),
signatureS
.
data
(),
&
signatureV
,
16
);
signatureS
.
data
(),
&
signatureV
,
16
);
...
@@ -162,7 +162,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES key gen", "[ecdsa-aes-key-gen]") {
...
@@ -162,7 +162,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES key gen", "[ecdsa-aes-key-gen]") {
vector
<
char
>
pubKeyY
(
BUF_LEN
,
0
);
vector
<
char
>
pubKeyY
(
BUF_LEN
,
0
);
uint64_t
encLen
=
0
;
uint64_t
encLen
=
0
;
PRINT_SRC_LINE
PRINT_SRC_LINE
auto
status
=
trustedGenerateEcdsaKey
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrivKey
.
data
(),
&
encLen
,
auto
status
=
trustedGenerateEcdsaKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrivKey
.
data
(),
&
encLen
,
pubKeyX
.
data
(),
pubKeyX
.
data
(),
pubKeyY
.
data
());
pubKeyY
.
data
());
...
@@ -181,7 +181,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES get public key", "[ecdsa-aes-get-pub-ke
...
@@ -181,7 +181,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES get public key", "[ecdsa-aes-get-pub-ke
uint64_t
encLen
=
0
;
uint64_t
encLen
=
0
;
PRINT_SRC_LINE
PRINT_SRC_LINE
auto
status
=
trustedGenerateEcdsaKey
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encPrivKey
.
data
(),
&
encLen
,
pubKeyX
.
data
(),
auto
status
=
trustedGenerateEcdsaKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encPrivKey
.
data
(),
&
encLen
,
pubKeyX
.
data
(),
pubKeyY
.
data
());
pubKeyY
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
...
@@ -191,7 +191,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES get public key", "[ecdsa-aes-get-pub-ke
...
@@ -191,7 +191,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES get public key", "[ecdsa-aes-get-pub-ke
vector
<
char
>
receivedPubKeyY
(
BUF_LEN
,
0
);
vector
<
char
>
receivedPubKeyY
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
PRINT_SRC_LINE
status
=
trustedGetPublicEcdsaKey
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encPrivKey
.
data
(),
encLen
,
status
=
trustedGetPublicEcdsaKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encPrivKey
.
data
(),
encLen
,
receivedPubKeyX
.
data
(),
receivedPubKeyX
.
data
(),
receivedPubKeyY
.
data
());
receivedPubKeyY
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
...
@@ -295,14 +295,14 @@ TEST_CASE_METHOD(TestFixture, "DKG AES gen test", "[dkg-aes-gen]") {
...
@@ -295,14 +295,14 @@ TEST_CASE_METHOD(TestFixture, "DKG AES gen test", "[dkg-aes-gen]") {
uint64_t
encLen
=
0
;
uint64_t
encLen
=
0
;
PRINT_SRC_LINE
PRINT_SRC_LINE
auto
status
=
trustedGenDkgSecret
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
encLen
,
32
);
auto
status
=
trustedGenDkgSecret
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
encLen
,
32
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
vector
<
char
>
secret
(
BUF_LEN
,
0
);
vector
<
char
>
secret
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg1
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg1
(
BUF_LEN
,
0
);
status
=
trustedDecryptDkgSecret
AES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
status
=
trustedDecryptDkgSecret
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
encLen
,
(
uint8_t
*
)
secret
.
data
());
encLen
,
(
uint8_t
*
)
secret
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
...
@@ -319,7 +319,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES public shares test", "[dkg-aes-pub-shares
...
@@ -319,7 +319,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES public shares test", "[dkg-aes-pub-shares
unsigned
t
=
32
,
n
=
32
;
unsigned
t
=
32
,
n
=
32
;
PRINT_SRC_LINE
PRINT_SRC_LINE
auto
status
=
trustedGenDkgSecret
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
encLen
,
n
);
auto
status
=
trustedGenDkgSecret
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
encLen
,
n
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
...
@@ -328,7 +328,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES public shares test", "[dkg-aes-pub-shares
...
@@ -328,7 +328,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES public shares test", "[dkg-aes-pub-shares
char
colon
=
':'
;
char
colon
=
':'
;
vector
<
char
>
pubShares
(
10000
,
0
);
vector
<
char
>
pubShares
(
10000
,
0
);
PRINT_SRC_LINE
PRINT_SRC_LINE
status
=
trustedGetPublicShares
AES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
status
=
trustedGetPublicShares
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
encLen
,
pubShares
.
data
(),
t
,
n
);
encryptedDKGSecret
.
data
(),
encLen
,
pubShares
.
data
(),
t
,
n
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
...
@@ -343,7 +343,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES public shares test", "[dkg-aes-pub-shares
...
@@ -343,7 +343,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES public shares test", "[dkg-aes-pub-shares
vector
<
char
>
secret
(
BUF_LEN
,
0
);
vector
<
char
>
secret
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
PRINT_SRC_LINE
status
=
trustedDecryptDkgSecret
AES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
encLen
,
status
=
trustedDecryptDkgSecret
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
encLen
,
(
uint8_t
*
)
secret
.
data
());
(
uint8_t
*
)
secret
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
...
@@ -368,14 +368,14 @@ TEST_CASE_METHOD(TestFixture, "DKG AES encrypted secret shares test", "[dkg-aes-
...
@@ -368,14 +368,14 @@ TEST_CASE_METHOD(TestFixture, "DKG AES encrypted secret shares test", "[dkg-aes-
vector
<
uint8_t
>
encryptedDKGSecret
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encryptedDKGSecret
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
PRINT_SRC_LINE
auto
status
=
trustedGenDkgSecret
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
encLen
,
2
);
auto
status
=
trustedGenDkgSecret
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
encLen
,
2
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
uint64_t
enc_len
=
encLen
;
uint64_t
enc_len
=
encLen
;
PRINT_SRC_LINE
PRINT_SRC_LINE
status
=
trustedSetEncryptedDkgPoly
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
enc_len
);
status
=
trustedSetEncryptedDkgPoly
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
enc_len
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
...
@@ -385,7 +385,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES encrypted secret shares test", "[dkg-aes-
...
@@ -385,7 +385,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES encrypted secret shares test", "[dkg-aes-
vector
<
char
>
s_shareG2
(
BUF_LEN
,
0
);
vector
<
char
>
s_shareG2
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
PRINT_SRC_LINE
status
=
trustedGetEncryptedSecretShare
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPRDHKey
.
data
(),
&
encLen
,
status
=
trustedGetEncryptedSecretShare
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPRDHKey
.
data
(),
&
encLen
,
result
.
data
(),
result
.
data
(),
s_shareG2
.
data
(),
s_shareG2
.
data
(),
(
char
*
)
pub_keyB
.
data
(),
2
,
2
,
1
);
(
char
*
)
pub_keyB
.
data
(),
2
,
2
,
1
);
...
@@ -700,14 +700,14 @@ TEST_CASE_METHOD(TestFixture, "AES encrypt/decrypt", "[aes-encrypt-decrypt]") {
...
@@ -700,14 +700,14 @@ TEST_CASE_METHOD(TestFixture, "AES encrypt/decrypt", "[aes-encrypt-decrypt]") {
vector
<
uint8_t
>
encrypted_key
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encrypted_key
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
PRINT_SRC_LINE
auto
status
=
trustedEncryptKey
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
key
.
c_str
(),
encrypted_key
.
data
(),
&
encLen
);
auto
status
=
trustedEncryptKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
key
.
c_str
(),
encrypted_key
.
data
(),
&
encLen
);
REQUIRE
(
status
==
0
);
REQUIRE
(
status
==
0
);
REQUIRE
(
errStatus
==
0
);
REQUIRE
(
errStatus
==
0
);
vector
<
char
>
decr_key
(
BUF_LEN
,
0
);
vector
<
char
>
decr_key
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
PRINT_SRC_LINE
status
=
trustedDecryptKey
AES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrypted_key
.
data
(),
encLen
,
decr_key
.
data
());
status
=
trustedDecryptKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrypted_key
.
data
(),
encLen
,
decr_key
.
data
());
REQUIRE
(
status
==
0
);
REQUIRE
(
status
==
0
);
REQUIRE
(
errStatus
==
0
);
REQUIRE
(
errStatus
==
0
);
...
...
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