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
4a103ecf
Unverified
Commit
4a103ecf
authored
Apr 17, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2454-add-logs-to-enclave
parent
2f267c40
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
253 additions
and
258 deletions
+253
-258
BLSCrypto.cpp
BLSCrypto.cpp
+1
-2
DKGCrypto.cpp
DKGCrypto.cpp
+35
-39
ECDSACrypto.cpp
ECDSACrypto.cpp
+13
-13
BLSEnclave.cpp
secure_enclave/BLSEnclave.cpp
+4
-4
BLSEnclave.h
secure_enclave/BLSEnclave.h
+2
-2
secure_enclave.c
secure_enclave/secure_enclave.c
+139
-139
secure_enclave.edl
secure_enclave/secure_enclave.edl
+33
-33
testw.cpp
testw.cpp
+26
-26
No files found.
BLSCrypto.cpp
View file @
4a103ecf
...
@@ -162,7 +162,7 @@ bool sign(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, size_t
...
@@ -162,7 +162,7 @@ bool sign(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, size_t
if
(
!
hex2carray
(
_hashHex
,
&
binLen
,
hash
->
data
()))
{
if
(
!
hex2carray
(
_hashHex
,
&
binLen
,
hash
->
data
()))
{
throw
SGXException
(
INVALID_HEX
,
"Invalid hash"
);
throw
SGXException
(
INVALID_HEX
,
"Invalid hash"
);
}
}
// assert(binLen == hash->size());
...
@@ -203,7 +203,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
...
@@ -203,7 +203,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
if
(
!
hex2carray
(
_hashHex
,
&
binLen
,
hash
->
data
()))
{
if
(
!
hex2carray
(
_hashHex
,
&
binLen
,
hash
->
data
()))
{
throw
SGXException
(
INVALID_HEX
,
"Invalid hash"
);
throw
SGXException
(
INVALID_HEX
,
"Invalid hash"
);
}
}
// assert(binLen == hash->size());
...
...
DKGCrypto.cpp
View file @
4a103ecf
...
@@ -77,21 +77,21 @@ string ConvertToString(T field_elem, int base = 10) {
...
@@ -77,21 +77,21 @@ string ConvertToString(T field_elem, int base = 10) {
string
gen_dkg_poly
(
int
_t
)
{
string
gen_dkg_poly
(
int
_t
)
{
vector
<
char
>
errMsg
(
1024
,
0
);
vector
<
char
>
errMsg
(
1024
,
0
);
int
err
_s
tatus
=
0
;
int
err
S
tatus
=
0
;
vector
<
uint8_t
>
encrypted_dkg_secret
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encrypted_dkg_secret
(
BUF_LEN
,
0
);
uint32_t
enc_len
=
0
;
uint32_t
enc_len
=
0
;
if
(
!
encryptKeys
)
if
(
!
encryptKeys
)
status
=
trustedGenDkgSecret
(
eid
,
&
err
_s
tatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
status
=
trustedGenDkgSecret
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
else
else
status
=
trustedGenDkgSecret_aes
(
eid
,
&
err
_s
tatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
status
=
trustedGenDkgSecret_aes
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
if
(
err
_s
tatus
!=
0
)
{
if
(
err
S
tatus
!=
0
)
{
throw
SGXException
(
-
666
,
errMsg
.
data
());
throw
SGXException
(
-
666
,
errMsg
.
data
());
}
}
spdlog
::
debug
(
"trustedGenDkgSecret, status {}"
,
err
_s
tatus
,
" err msg "
,
errMsg
.
data
());
spdlog
::
debug
(
"trustedGenDkgSecret, status {}"
,
err
S
tatus
,
" err msg "
,
errMsg
.
data
());
spdlog
::
debug
(
"in DKGCrypto encr len is {}"
,
enc_len
);
spdlog
::
debug
(
"in DKGCrypto encr len is {}"
,
enc_len
);
uint64_t
length
=
DKG_MAX_SEALED_LEN
;
uint64_t
length
=
DKG_MAX_SEALED_LEN
;
...
@@ -99,11 +99,8 @@ string gen_dkg_poly(int _t) {
...
@@ -99,11 +99,8 @@ string gen_dkg_poly(int _t) {
length
=
enc_len
;
length
=
enc_len
;
}
}
//vector<char> hexEncrPoly(DKG_MAX_SEALED_LEN * 2 + 1, 0);//(4*BUF_LEN, 1);
vector
<
char
>
hexEncrPoly
(
2
*
length
+
1
,
0
);
vector
<
char
>
hexEncrPoly
(
2
*
length
+
1
,
0
);
assert
(
encrypted_dkg_secret
.
size
()
>=
length
);
CHECK_STATE
(
encrypted_dkg_secret
.
size
()
>=
length
);
//carray2Hex(encrypted_dkg_secret.data(), DKG_MAX_SEALED_LEN, hexEncrPoly.data());
carray2Hex
(
encrypted_dkg_secret
.
data
(),
length
,
hexEncrPoly
.
data
());
carray2Hex
(
encrypted_dkg_secret
.
data
(),
length
,
hexEncrPoly
.
data
());
string
result
(
hexEncrPoly
.
data
());
string
result
(
hexEncrPoly
.
data
());
...
@@ -138,10 +135,12 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
...
@@ -138,10 +135,12 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
uint32_t
len
=
0
;
uint32_t
len
=
0
;
if
(
!
encryptKeys
)
if
(
!
encryptKeys
)
status
=
trustedGetPublicShares
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
len
,
pubShares
.
data
(),
t
,
n
);
status
=
trustedGetPublicShares
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
len
,
pubShares
.
data
(),
t
,
n
);
else
{
else
{
status
=
trustedGetPublicShares_aes
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
encLen
,
pubShares
.
data
(),
t
,
n
);
status
=
trustedGetPublicShares_aes
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
(),
encLen
,
pubShares
.
data
(),
t
,
n
);
}
}
if
(
errStatus
!=
0
)
{
if
(
errStatus
!=
0
)
{
throw
SGXException
(
-
666
,
errMsg1
.
data
());
throw
SGXException
(
-
666
,
errMsg1
.
data
());
...
@@ -164,7 +163,8 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
...
@@ -164,7 +163,8 @@ vector<vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int n
return
pubSharesVect
;
return
pubSharesVect
;
}
}
string
trustedGetSecretShares
(
const
string
&
_polyName
,
const
char
*
_encryptedPolyHex
,
const
vector
<
string
>
&
_publicKeys
,
int
_t
,
string
trustedGetSecretShares
(
const
string
&
_polyName
,
const
char
*
_encryptedPolyHex
,
const
vector
<
string
>
&
_publicKeys
,
int
_t
,
int
_n
)
{
int
_n
)
{
vector
<
char
>
errMsg1
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg1
(
BUF_LEN
,
0
);
...
@@ -173,14 +173,13 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
...
@@ -173,14 +173,13 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
uint64_t
encLen
=
0
;
uint64_t
encLen
=
0
;
vector
<
uint8_t
>
encrDKGPoly
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encrDKGPoly
(
BUF_LEN
,
0
);
if
(
!
hex2carray2
(
_encryptedPolyHex
,
&
encLen
,
encrDKGPoly
.
data
(),
6100
))
{
if
(
!
hex2carray2
(
_encryptedPolyHex
,
&
encLen
,
encrDKGPoly
.
data
(),
6100
))
{
throw
SGXException
(
INVALID_HEX
,
"Invalid encryptedPolyHex"
);
throw
SGXException
(
INVALID_HEX
,
"Invalid encryptedPolyHex"
);
}
}
if
(
!
encryptKeys
)
if
(
!
encryptKeys
)
status
=
trustedSetEncryptedDkgPoly
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
());
status
=
trustedSetEncryptedDkgPoly
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrDKGPoly
.
data
());
else
else
...
@@ -194,13 +193,13 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
...
@@ -194,13 +193,13 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
for
(
int
i
=
0
;
i
<
_n
;
i
++
)
{
for
(
int
i
=
0
;
i
<
_n
;
i
++
)
{
vector
<
uint8_t
>
encryptedSkey
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encryptedSkey
(
BUF_LEN
,
0
);
uint32_t
decLen
;
uint32_t
decLen
;
vector
<
char
>
currentShare
(
193
,
0
);
vector
<
char
>
currentShare
(
193
,
0
);
vector
<
char
>
sShareG2
(
320
,
0
);
vector
<
char
>
sShareG2
(
320
,
0
);
string
pub_keyB
=
_publicKeys
.
at
(
i
);
string
pub_keyB
=
_publicKeys
.
at
(
i
);
vector
<
char
>
pubKeyB
(
129
,
0
);
vector
<
char
>
pubKeyB
(
129
,
0
);
strncpy
(
pubKeyB
.
data
(),
pub_keyB
.
c_str
(),
128
);
strncpy
(
pubKeyB
.
data
(),
pub_keyB
.
c_str
(),
128
);
pubKeyB
.
at
(
128
)
=
0
;
pubKeyB
.
at
(
128
)
=
0
;
...
@@ -245,9 +244,8 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
...
@@ -245,9 +244,8 @@ string trustedGetSecretShares(const string &_polyName, const char *_encryptedPol
bool
bool
verifyShares
(
const
char
*
publicShares
,
const
char
*
encr_sshare
,
const
char
*
encryptedKeyHex
,
int
t
,
int
n
,
int
ind
)
{
verifyShares
(
const
char
*
publicShares
,
const
char
*
encr_sshare
,
const
char
*
encryptedKeyHex
,
int
t
,
int
n
,
int
ind
)
{
//char* errMsg1 = (char*) calloc(1024,1);
char
errMsg
[
BUF_LEN
];
char
errMsg1
[
BUF_LEN
];
int
errStatus
=
0
;
int
err_status
=
0
;
uint64_t
decKeyLen
;
uint64_t
decKeyLen
;
uint8_t
encr_key
[
BUF_LEN
];
uint8_t
encr_key
[
BUF_LEN
];
...
@@ -265,19 +263,17 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr
...
@@ -265,19 +263,17 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr
if
(
!
encryptKeys
)
if
(
!
encryptKeys
)
trustedDkgVerify
(
eid
,
&
err
_status
,
errMsg1
,
pshares
,
encr_sshare
,
encr_key
,
decKeyLen
,
t
,
ind
,
&
result
);
trustedDkgVerify
(
eid
,
&
err
Status
,
errMsg
,
pshares
,
encr_sshare
,
encr_key
,
decKeyLen
,
t
,
ind
,
&
result
);
else
else
trustedDkgVerify_aes
(
eid
,
&
err
_status
,
errMsg1
,
pshares
,
encr_sshare
,
encr_key
,
decKeyLen
,
t
,
ind
,
&
result
);
trustedDkgVerify_aes
(
eid
,
&
err
Status
,
errMsg
,
pshares
,
encr_sshare
,
encr_key
,
decKeyLen
,
t
,
ind
,
&
result
);
if
(
result
==
2
)
{
if
(
result
==
2
)
{
throw
SGXException
(
INVALID_HEX
,
"Invalid public shares"
);
throw
SGXException
(
INVALID_HEX
,
"Invalid public shares"
);
}
}
spdlog
::
debug
(
"errMsg1: {}"
,
errMsg
1
);
spdlog
::
debug
(
"errMsg1: {}"
,
errMsg
);
spdlog
::
debug
(
"result is: {}"
,
result
);
spdlog
::
debug
(
"result is: {}"
,
result
);
//free(errMsg1);
return
result
;
return
result
;
}
}
...
@@ -286,8 +282,8 @@ bool CreateBLSShare(const string &blsKeyName, const char *s_shares, const char *
...
@@ -286,8 +282,8 @@ bool CreateBLSShare(const string &blsKeyName, const char *s_shares, const char *
spdlog
::
debug
(
"ENTER CreateBLSShare"
);
spdlog
::
debug
(
"ENTER CreateBLSShare"
);
// char* errMsg1 = (char*) calloc(1024,1);
// char* errMsg1 = (char*) calloc(1024,1);
char
errMsg
1
[
BUF_LEN
];
char
errMsg
[
BUF_LEN
];
int
err
_s
tatus
=
0
;
int
err
S
tatus
=
0
;
uint64_t
decKeyLen
;
uint64_t
decKeyLen
;
uint8_t
encr_bls_key
[
BUF_LEN
];
uint8_t
encr_bls_key
[
BUF_LEN
];
...
@@ -302,14 +298,14 @@ bool CreateBLSShare(const string &blsKeyName, const char *s_shares, const char *
...
@@ -302,14 +298,14 @@ bool CreateBLSShare(const string &blsKeyName, const char *s_shares, const char *
if
(
!
encryptKeys
)
if
(
!
encryptKeys
)
trustedCreateBlsKey
(
eid
,
&
err
_status
,
errMsg1
,
s_shares
,
encr_key
,
decKeyLen
,
encr_bls_key
,
&
enc_bls_len
);
trustedCreateBlsKey
(
eid
,
&
err
Status
,
errMsg
,
s_shares
,
encr_key
,
decKeyLen
,
encr_bls_key
,
&
enc_bls_len
);
else
else
trustedCreateBlsKey_aes
(
eid
,
&
err
_status
,
errMsg1
,
s_shares
,
encr_key
,
decKeyLen
,
encr_bls_key
,
&
enc_bls_len
);
trustedCreateBlsKey_aes
(
eid
,
&
err
Status
,
errMsg
,
s_shares
,
encr_key
,
decKeyLen
,
encr_bls_key
,
&
enc_bls_len
);
if
(
err
_s
tatus
!=
0
)
{
if
(
err
S
tatus
!=
0
)
{
spdlog
::
error
(
errMsg
1
);
spdlog
::
error
(
errMsg
);
spdlog
::
error
(
"status {}"
,
err
_s
tatus
);
spdlog
::
error
(
"status {}"
,
err
S
tatus
);
throw
SGXException
(
ERROR_IN_ENCLAVE
,
"Create BLS private key failed in enclave"
);
throw
SGXException
(
ERROR_IN_ENCLAVE
,
"Create BLS private key failed in enclave"
);
}
else
{
}
else
{
...
@@ -361,7 +357,7 @@ vector<string> GetBLSPubKey(const char *encryptedKeyHex) {
...
@@ -361,7 +357,7 @@ vector<string> GetBLSPubKey(const char *encryptedKeyHex) {
string
decryptDHKey
(
const
string
&
polyName
,
int
ind
)
{
string
decryptDHKey
(
const
string
&
polyName
,
int
ind
)
{
vector
<
char
>
errMsg1
(
1024
,
0
);
vector
<
char
>
errMsg1
(
1024
,
0
);
int
err
_s
tatus
=
0
;
int
err
S
tatus
=
0
;
string
DH_key_name
=
polyName
+
"_"
+
to_string
(
ind
)
+
":"
;
string
DH_key_name
=
polyName
+
"_"
+
to_string
(
ind
)
+
":"
;
shared_ptr
<
string
>
hexEncrKeyPtr
=
SGXWalletServer
::
readFromDb
(
DH_key_name
,
"DKG_DH_KEY_"
);
shared_ptr
<
string
>
hexEncrKeyPtr
=
SGXWalletServer
::
readFromDb
(
DH_key_name
,
"DKG_DH_KEY_"
);
...
@@ -382,11 +378,11 @@ string decryptDHKey(const string &polyName, int ind) {
...
@@ -382,11 +378,11 @@ string decryptDHKey(const string &polyName, int ind) {
char
DHKey
[
ECDSA_SKEY_LEN
];
char
DHKey
[
ECDSA_SKEY_LEN
];
if
(
!
encryptKeys
)
if
(
!
encryptKeys
)
decrypt_key
(
eid
,
&
err
_s
tatus
,
errMsg1
.
data
(),
encryptedDHKey
,
dhEncLen
,
DHKey
);
decrypt_key
(
eid
,
&
err
S
tatus
,
errMsg1
.
data
(),
encryptedDHKey
,
dhEncLen
,
DHKey
);
else
else
decrypt_key_aes
(
eid
,
&
err
_s
tatus
,
errMsg1
.
data
(),
encryptedDHKey
,
dhEncLen
,
DHKey
);
decrypt_key_aes
(
eid
,
&
err
S
tatus
,
errMsg1
.
data
(),
encryptedDHKey
,
dhEncLen
,
DHKey
);
if
(
err
_s
tatus
!=
0
)
{
if
(
err
S
tatus
!=
0
)
{
throw
SGXException
(
/*ERROR_IN_ENCLAVE*/
err
_s
tatus
,
"decrypt key failed in enclave"
);
throw
SGXException
(
/*ERROR_IN_ENCLAVE*/
err
S
tatus
,
"decrypt key failed in enclave"
);
}
}
return
DHKey
;
return
DHKey
;
...
...
ECDSACrypto.cpp
View file @
4a103ecf
...
@@ -45,18 +45,18 @@ string concatPubKeyWith0x(char *pub_key_x, char *pub_key_y) {
...
@@ -45,18 +45,18 @@ string concatPubKeyWith0x(char *pub_key_x, char *pub_key_y) {
std
::
vector
<
std
::
string
>
genECDSAKey
()
{
std
::
vector
<
std
::
string
>
genECDSAKey
()
{
char
*
errMsg
=
(
char
*
)
calloc
(
1024
,
1
);
char
*
errMsg
=
(
char
*
)
calloc
(
1024
,
1
);
int
err
_s
tatus
=
0
;
int
err
S
tatus
=
0
;
uint8_t
*
encr_pr_key
=
(
uint8_t
*
)
calloc
(
1024
,
1
);
uint8_t
*
encr_pr_key
=
(
uint8_t
*
)
calloc
(
1024
,
1
);
char
*
pub_key_x
=
(
char
*
)
calloc
(
1024
,
1
);
char
*
pub_key_x
=
(
char
*
)
calloc
(
1024
,
1
);
char
*
pub_key_y
=
(
char
*
)
calloc
(
1024
,
1
);
char
*
pub_key_y
=
(
char
*
)
calloc
(
1024
,
1
);
uint32_t
enc_len
=
0
;
uint32_t
enc_len
=
0
;
if
(
!
encryptKeys
)
if
(
!
encryptKeys
)
status
=
trustedGenerateEcdsaKey
(
eid
,
&
err
_s
tatus
,
errMsg
,
encr_pr_key
,
&
enc_len
,
pub_key_x
,
pub_key_y
);
status
=
trustedGenerateEcdsaKey
(
eid
,
&
err
S
tatus
,
errMsg
,
encr_pr_key
,
&
enc_len
,
pub_key_x
,
pub_key_y
);
else
else
status
=
trustedGenerateEcdsaKey_aes
(
eid
,
&
err
_s
tatus
,
errMsg
,
encr_pr_key
,
&
enc_len
,
pub_key_x
,
pub_key_y
);
status
=
trustedGenerateEcdsaKey_aes
(
eid
,
&
err
S
tatus
,
errMsg
,
encr_pr_key
,
&
enc_len
,
pub_key_x
,
pub_key_y
);
if
(
status
!=
SGX_SUCCESS
||
err
_s
tatus
!=
0
)
{
if
(
status
!=
SGX_SUCCESS
||
err
S
tatus
!=
0
)
{
spdlog
::
error
(
"RPCException thrown with status {}"
,
status
);
spdlog
::
error
(
"RPCException thrown with status {}"
,
status
);
throw
SGXException
(
status
,
errMsg
);
throw
SGXException
(
status
,
errMsg
);
}
}
...
@@ -106,7 +106,7 @@ std::string getECDSAPubKey(const char *_encryptedKeyHex) {
...
@@ -106,7 +106,7 @@ std::string getECDSAPubKey(const char *_encryptedKeyHex) {
vector
<
char
>
pubKeyY
(
BUF_LEN
,
0
);
vector
<
char
>
pubKeyY
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encrPrKey
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encrPrKey
(
BUF_LEN
,
0
);
int
err
_s
tatus
=
0
;
int
err
S
tatus
=
0
;
uint64_t
enc_len
=
0
;
uint64_t
enc_len
=
0
;
if
(
!
hex2carray
(
_encryptedKeyHex
,
&
enc_len
,
encrPrKey
.
data
()))
{
if
(
!
hex2carray
(
_encryptedKeyHex
,
&
enc_len
,
encrPrKey
.
data
()))
{
...
@@ -114,11 +114,11 @@ std::string getECDSAPubKey(const char *_encryptedKeyHex) {
...
@@ -114,11 +114,11 @@ std::string getECDSAPubKey(const char *_encryptedKeyHex) {
}
}
if
(
!
encryptKeys
)
if
(
!
encryptKeys
)
status
=
trustedGetPublicEcdsaKey
(
eid
,
&
err
_s
tatus
,
errMsg
.
data
(),
encrPrKey
.
data
(),
enc_len
,
pubKeyX
.
data
(),
status
=
trustedGetPublicEcdsaKey
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encrPrKey
.
data
(),
enc_len
,
pubKeyX
.
data
(),
pubKeyY
.
data
());
pubKeyY
.
data
());
else
status
=
trustedGetPublicEcdsaKey_aes
(
eid
,
&
err
_s
tatus
,
else
status
=
trustedGetPublicEcdsaKey_aes
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encrPrKey
.
data
(),
enc_len
,
pubKeyX
.
data
(),
pubKeyY
.
data
());
errMsg
.
data
(),
encrPrKey
.
data
(),
enc_len
,
pubKeyX
.
data
(),
pubKeyY
.
data
());
if
(
err
_s
tatus
!=
0
)
{
if
(
err
S
tatus
!=
0
)
{
throw
SGXException
(
-
666
,
errMsg
.
data
());
throw
SGXException
(
-
666
,
errMsg
.
data
());
}
}
string
pubKey
=
string
(
pubKeyX
.
data
())
+
string
(
pubKeyY
.
data
());
//concatPubKeyWith0x(pub_key_x, pub_key_y);//
string
pubKey
=
string
(
pubKeyX
.
data
())
+
string
(
pubKeyY
.
data
());
//concatPubKeyWith0x(pub_key_x, pub_key_y);//
...
@@ -127,7 +127,7 @@ std::string getECDSAPubKey(const char *_encryptedKeyHex) {
...
@@ -127,7 +127,7 @@ std::string getECDSAPubKey(const char *_encryptedKeyHex) {
spdlog
::
debug
(
"pubkey is {}"
,
pubKey
);
spdlog
::
debug
(
"pubkey is {}"
,
pubKey
);
spdlog
::
debug
(
"pubkey length is {}"
,
pubKey
.
length
());
spdlog
::
debug
(
"pubkey length is {}"
,
pubKey
.
length
());
spdlog
::
debug
(
"err str is {}"
,
errMsg
.
data
());
spdlog
::
debug
(
"err str is {}"
,
errMsg
.
data
());
spdlog
::
debug
(
"err status is {}"
,
err
_s
tatus
);
spdlog
::
debug
(
"err status is {}"
,
err
S
tatus
);
return
pubKey
;
return
pubKey
;
...
@@ -137,7 +137,7 @@ vector<string> ecdsaSignHash(const char *encryptedKeyHex, const char *hashHex, i
...
@@ -137,7 +137,7 @@ vector<string> ecdsaSignHash(const char *encryptedKeyHex, const char *hashHex, i
vector
<
string
>
signature_vect
(
3
);
vector
<
string
>
signature_vect
(
3
);
char
*
errMsg
=
(
char
*
)
calloc
(
1024
,
1
);
char
*
errMsg
=
(
char
*
)
calloc
(
1024
,
1
);
int
err
_s
tatus
=
0
;
int
err
S
tatus
=
0
;
char
*
signature_r
=
(
char
*
)
calloc
(
1024
,
1
);
char
*
signature_r
=
(
char
*
)
calloc
(
1024
,
1
);
char
*
signature_s
=
(
char
*
)
calloc
(
1024
,
1
);
char
*
signature_s
=
(
char
*
)
calloc
(
1024
,
1
);
uint8_t
signature_v
=
0
;
uint8_t
signature_v
=
0
;
...
@@ -156,12 +156,12 @@ vector<string> ecdsaSignHash(const char *encryptedKeyHex, const char *hashHex, i
...
@@ -156,12 +156,12 @@ vector<string> ecdsaSignHash(const char *encryptedKeyHex, const char *hashHex, i
if
(
!
encryptKeys
)
if
(
!
encryptKeys
)
status
=
trustedEcdsaSign
(
eid
,
&
err
_s
tatus
,
errMsg
,
encr_key
,
ECDSA_ENCR_LEN
,
(
unsigned
char
*
)
hashHex
,
signature_r
,
status
=
trustedEcdsaSign
(
eid
,
&
err
S
tatus
,
errMsg
,
encr_key
,
ECDSA_ENCR_LEN
,
(
unsigned
char
*
)
hashHex
,
signature_r
,
signature_s
,
&
signature_v
,
base
);
signature_s
,
&
signature_v
,
base
);
else
else
status
=
trustedEcdsaSignAES
(
eid
,
&
err
_s
tatus
,
errMsg
,
encr_key
,
dec_len
,
(
unsigned
char
*
)
hashHex
,
signature_r
,
status
=
trustedEcdsaSignAES
(
eid
,
&
err
S
tatus
,
errMsg
,
encr_key
,
dec_len
,
(
unsigned
char
*
)
hashHex
,
signature_r
,
signature_s
,
&
signature_v
,
base
);
signature_s
,
&
signature_v
,
base
);
if
(
err
_s
tatus
!=
0
)
{
if
(
err
S
tatus
!=
0
)
{
throw
SGXException
(
-
666
,
errMsg
);
throw
SGXException
(
-
666
,
errMsg
);
}
}
...
...
secure_enclave/BLSEnclave.cpp
View file @
4a103ecf
...
@@ -102,7 +102,7 @@ void init() {
...
@@ -102,7 +102,7 @@ void init() {
libff
::
init_alt_bn128_params
();
libff
::
init_alt_bn128_params
();
}
}
void
checkKey
(
int
*
err
_s
tatus
,
char
*
err_string
,
const
char
*
_keyString
)
{
void
checkKey
(
int
*
err
S
tatus
,
char
*
err_string
,
const
char
*
_keyString
)
{
uint64_t
keyLen
=
strnlen
(
_keyString
,
MAX_KEY_LENGTH
);
uint64_t
keyLen
=
strnlen
(
_keyString
,
MAX_KEY_LENGTH
);
...
@@ -114,7 +114,7 @@ void checkKey(int *err_status, char *err_string, const char *_keyString) {
...
@@ -114,7 +114,7 @@ void checkKey(int *err_status, char *err_string, const char *_keyString) {
}
}
*
err
_s
tatus
=
-
2
;
*
err
S
tatus
=
-
2
;
if
(
_keyString
==
nullptr
)
{
if
(
_keyString
==
nullptr
)
{
...
@@ -122,7 +122,7 @@ void checkKey(int *err_status, char *err_string, const char *_keyString) {
...
@@ -122,7 +122,7 @@ void checkKey(int *err_status, char *err_string, const char *_keyString) {
return
;
return
;
}
}
*
err
_s
tatus
=
-
3
;
*
err
S
tatus
=
-
3
;
//check that key is padded with 0s
//check that key is padded with 0s
...
@@ -145,7 +145,7 @@ void checkKey(int *err_status, char *err_string, const char *_keyString) {
...
@@ -145,7 +145,7 @@ void checkKey(int *err_status, char *err_string, const char *_keyString) {
// throw std::exception();
// throw std::exception();
// }
// }
*
err
_s
tatus
=
0
;
*
err
S
tatus
=
0
;
// return;
// return;
}
}
...
...
secure_enclave/BLSEnclave.h
View file @
4a103ecf
...
@@ -34,9 +34,9 @@
...
@@ -34,9 +34,9 @@
//#include <stdint.h>
//#include <stdint.h>
EXTERNC
void
checkKey
(
int
*
err
_s
tatus
,
char
*
err_string
,
const
char
*
_keyString
);
EXTERNC
void
checkKey
(
int
*
err
S
tatus
,
char
*
err_string
,
const
char
*
_keyString
);
EXTERNC
void
check_key
(
int
*
err
_s
tatus
,
char
*
err_string
,
const
char
*
_keyString
);
EXTERNC
void
check_key
(
int
*
err
S
tatus
,
char
*
err_string
,
const
char
*
_keyString
);
...
...
secure_enclave/secure_enclave.c
View file @
4a103ecf
This diff is collapsed.
Click to expand it.
secure_enclave/secure_enclave.edl
View file @
4a103ecf
This diff is collapsed.
Click to expand it.
testw.cpp
View file @
4a103ecf
...
@@ -182,24 +182,24 @@ TEST_CASE("DKG gen test", "[dkg-gen]") {
...
@@ -182,24 +182,24 @@ TEST_CASE("DKG gen test", "[dkg-gen]") {
vector
<
uint8_t
>
encryptedDKGSecret
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encryptedDKGSecret
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
int
err
_s
tatus
=
0
;
int
err
S
tatus
=
0
;
uint32_t
enc_len
=
0
;
uint32_t
enc_len
=
0
;
status
=
trustedGenDkgSecret
(
eid
,
&
err
_s
tatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
enc_len
,
32
);
status
=
trustedGenDkgSecret
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
enc_len
,
32
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
// printf("trustedGenDkgSecret completed with status: %d %s \n", err
_s
tatus, errMsg.data());
// printf("trustedGenDkgSecret completed with status: %d %s \n", err
S
tatus, errMsg.data());
// printf("\n Length: %d \n", enc_len);
// printf("\n Length: %d \n", enc_len);
vector
<
char
>
secret
(
BUF_LEN
,
0
);
vector
<
char
>
secret
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg1
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg1
(
BUF_LEN
,
0
);
uint32_t
dec_len
;
uint32_t
dec_len
;
status
=
trustedDecryptDkgSecret
(
eid
,
&
err
_s
tatus
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
status
=
trustedDecryptDkgSecret
(
eid
,
&
err
S
tatus
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
(
uint8_t
*
)
secret
.
data
(),
&
dec_len
);
(
uint8_t
*
)
secret
.
data
(),
&
dec_len
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
// printf("\ntrustedDecryptDkgSecret completed with status: %d %s \n", err
_s
tatus, errMsg1.data());
// printf("\ntrustedDecryptDkgSecret completed with status: %d %s \n", err
S
tatus, errMsg1.data());
// printf("decrypted secret %s \n\n", secret.data());
// printf("decrypted secret %s \n\n", secret.data());
// printf("secret length %d \n", (int) strlen(secret.data()));
// printf("secret length %d \n", (int) strlen(secret.data()));
// printf("decr length %d \n", dec_len);
// printf("decr length %d \n", dec_len);
...
@@ -272,14 +272,14 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
...
@@ -272,14 +272,14 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
vector
<
uint8_t
>
encrypted_dkg_secret
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encrypted_dkg_secret
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
int
err
_s
tatus
=
0
;
int
err
S
tatus
=
0
;
uint32_t
enc_len
=
0
;
uint32_t
enc_len
=
0
;
unsigned
t
=
32
,
n
=
32
;
unsigned
t
=
32
,
n
=
32
;
status
=
trustedGenDkgSecret
(
eid
,
&
err
_s
tatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
n
);
status
=
trustedGenDkgSecret
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
n
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
//printf("gen_dkg_public completed with status: %d %s \n", err
_s
tatus, errMsg);
//printf("gen_dkg_public completed with status: %d %s \n", err
S
tatus, errMsg);
vector
<
char
>
errMsg1
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg1
(
BUF_LEN
,
0
);
...
@@ -287,10 +287,10 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
...
@@ -287,10 +287,10 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
char
colon
=
':'
;
char
colon
=
':'
;
vector
<
char
>
public_shares
(
10000
,
0
);
vector
<
char
>
public_shares
(
10000
,
0
);
status
=
trustedGetPublicShares
(
eid
,
&
err
_s
tatus
,
errMsg1
.
data
(),
status
=
trustedGetPublicShares
(
eid
,
&
err
S
tatus
,
errMsg1
.
data
(),
encrypted_dkg_secret
.
data
(),
enc_len
,
public_shares
.
data
(),
t
,
n
);
encrypted_dkg_secret
.
data
(),
enc_len
,
public_shares
.
data
(),
t
,
n
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
// printf("\ntrustedGetPublicShares status: %d error %s \n\n", err
_s
tatus, errMsg1.data());
// printf("\ntrustedGetPublicShares status: %d error %s \n\n", err
S
tatus, errMsg1.data());
// printf(" LEN: %d \n", (int) strlen(public_shares.data()));
// printf(" LEN: %d \n", (int) strlen(public_shares.data()));
// printf(" result: %s \n", public_shares.data());
// printf(" result: %s \n", public_shares.data());
...
@@ -306,10 +306,10 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
...
@@ -306,10 +306,10 @@ TEST_CASE("DKG public shares test", "[dkg-pub-shares]") {
vector
<
char
>
secret
(
BUF_LEN
,
0
);
vector
<
char
>
secret
(
BUF_LEN
,
0
);
status
=
trustedDecryptDkgSecret
(
eid
,
&
err
_s
tatus
,
errMsg1
.
data
(),
encrypted_dkg_secret
.
data
(),
status
=
trustedDecryptDkgSecret
(
eid
,
&
err
S
tatus
,
errMsg1
.
data
(),
encrypted_dkg_secret
.
data
(),
(
uint8_t
*
)
secret
.
data
(),
&
enc_len
);
(
uint8_t
*
)
secret
.
data
(),
&
enc_len
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
//printf("\ntrustedDecryptDkgSecret completed with status: %d %s \n", err
_s
tatus, errMsg1.data());
//printf("\ntrustedDecryptDkgSecret completed with status: %d %s \n", err
S
tatus, errMsg1.data());
signatures
::
Dkg
dkg_obj
(
t
,
n
);
signatures
::
Dkg
dkg_obj
(
t
,
n
);
...
@@ -345,15 +345,15 @@ TEST_CASE("DKG encrypted secret shares test", "[dkg-encr-sshares]") {
...
@@ -345,15 +345,15 @@ TEST_CASE("DKG encrypted secret shares test", "[dkg-encr-sshares]") {
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
vector
<
char
>
result
(
BUF_LEN
,
0
);
vector
<
char
>
result
(
BUF_LEN
,
0
);
int
err
_s
tatus
=
0
;
int
err
S
tatus
=
0
;
uint32_t
enc_len
=
0
;
uint32_t
enc_len
=
0
;
vector
<
uint8_t
>
encrypted_dkg_secret
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encrypted_dkg_secret
(
BUF_LEN
,
0
);
status
=
trustedGenDkgSecret
(
eid
,
&
err
_s
tatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
2
);
status
=
trustedGenDkgSecret
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
2
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
// cerr << " poly generated" << endl;
// cerr << " poly generated" << endl;
status
=
trustedSetEncryptedDkgPoly
(
eid
,
&
err
_s
tatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
());
status
=
trustedSetEncryptedDkgPoly
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
// cerr << " poly set" << endl;
// cerr << " poly set" << endl;
...
@@ -362,7 +362,7 @@ TEST_CASE("DKG encrypted secret shares test", "[dkg-encr-sshares]") {
...
@@ -362,7 +362,7 @@ TEST_CASE("DKG encrypted secret shares test", "[dkg-encr-sshares]") {
string
pub_keyB
=
"c0152c48bf640449236036075d65898fded1e242c00acb45519ad5f788ea7cbf9a5df1559e7fc87932eee5478b1b9023de19df654395574a690843988c3ff475"
;
string
pub_keyB
=
"c0152c48bf640449236036075d65898fded1e242c00acb45519ad5f788ea7cbf9a5df1559e7fc87932eee5478b1b9023de19df654395574a690843988c3ff475"
;
vector
<
char
>
s_shareG2
(
BUF_LEN
,
0
);
vector
<
char
>
s_shareG2
(
BUF_LEN
,
0
);
status
=
trustedGetEncryptedSecretShare
(
eid
,
&
err
_s
tatus
,
errMsg
.
data
(),
encrPRDHKey
.
data
(),
&
enc_len
,
result
.
data
(),
status
=
trustedGetEncryptedSecretShare
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encrPRDHKey
.
data
(),
&
enc_len
,
result
.
data
(),
s_shareG2
.
data
(),
s_shareG2
.
data
(),
(
char
*
)
pub_keyB
.
data
(),
2
,
2
,
1
);
(
char
*
)
pub_keyB
.
data
(),
2
,
2
,
1
);
...
@@ -382,16 +382,16 @@ TEST_CASE("DKG verification test", "[dkg-verify]") {
...
@@ -382,16 +382,16 @@ TEST_CASE("DKG verification test", "[dkg-verify]") {
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
vector
<
char
>
result
(
BUF_LEN
,
0
);
vector
<
char
>
result
(
BUF_LEN
,
0
);
int
err
_s
tatus
=
0
;
int
err
S
tatus
=
0
;
uint32_t
enc_len
=
0
;
uint32_t
enc_len
=
0
;
vector
<
uint8_t
>
encrypted_dkg_secret
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encrypted_dkg_secret
(
BUF_LEN
,
0
);
status
=
trustedGenDkgSecret
(
eid
,
&
err
_s
tatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
2
);
status
=
trustedGenDkgSecret
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
2
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
// cerr << " poly generated" << endl;
// cerr << " poly generated" << endl;
status
=
trustedSetEncryptedDkgPoly
(
eid
,
&
err
_s
tatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
());
status
=
trustedSetEncryptedDkgPoly
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
// cerr << " poly set" << endl;
// cerr << " poly set" << endl;
...
@@ -401,11 +401,11 @@ TEST_CASE("DKG verification test", "[dkg-verify]") {
...
@@ -401,11 +401,11 @@ TEST_CASE("DKG verification test", "[dkg-verify]") {
vector
<
char
>
s_shareG2
(
BUF_LEN
,
0
);
vector
<
char
>
s_shareG2
(
BUF_LEN
,
0
);
status
=
trustedGetEncryptedSecretShare
(
eid
,
&
err
_s
tatus
,
errMsg
.
data
(),
encrPrDHKey
.
data
(),
&
enc_len
,
result
.
data
(),
status
=
trustedGetEncryptedSecretShare
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encrPrDHKey
.
data
(),
&
enc_len
,
result
.
data
(),
s_shareG2
.
data
(),
s_shareG2
.
data
(),
(
char
*
)
pub_keyB
.
data
(),
2
,
2
,
1
);
(
char
*
)
pub_keyB
.
data
(),
2
,
2
,
1
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
// printf(" trustedGetEncryptedSecretShare completed with status: %d %s \n", err
_s
tatus, errMsg.data());
// printf(" trustedGetEncryptedSecretShare completed with status: %d %s \n", err
S
tatus, errMsg.data());
// cerr << "secret share is " << result.data() << endl;
// cerr << "secret share is " << result.data() << endl;
...
@@ -421,7 +421,7 @@ TEST_CASE("ECDSA keygen and signature test", "[ecdsa]") {
...
@@ -421,7 +421,7 @@ TEST_CASE("ECDSA keygen and signature test", "[ecdsa]") {
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
int
err
_s
tatus
=
0
;
int
err
S
tatus
=
0
;
vector
<
uint8_t
>
encr_pr_key
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encr_pr_key
(
BUF_LEN
,
0
);
vector
<
char
>
pub_key_x
(
BUF_LEN
,
0
);
vector
<
char
>
pub_key_x
(
BUF_LEN
,
0
);
vector
<
char
>
pub_key_y
(
BUF_LEN
,
0
);
vector
<
char
>
pub_key_y
(
BUF_LEN
,
0
);
...
@@ -430,7 +430,7 @@ TEST_CASE("ECDSA keygen and signature test", "[ecdsa]") {
...
@@ -430,7 +430,7 @@ TEST_CASE("ECDSA keygen and signature test", "[ecdsa]") {
//printf("before %p\n", pub_key_x);
//printf("before %p\n", pub_key_x);
status
=
trustedGenerateEcdsaKey
(
eid
,
&
err
_s
tatus
,
errMsg
.
data
(),
encr_pr_key
.
data
(),
&
enc_len
,
pub_key_x
.
data
(),
status
=
trustedGenerateEcdsaKey
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encr_pr_key
.
data
(),
&
enc_len
,
pub_key_x
.
data
(),
pub_key_y
.
data
());
pub_key_y
.
data
());
// printf("\nerrMsg %s\n", errMsg.data());
// printf("\nerrMsg %s\n", errMsg.data());
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
...
@@ -444,7 +444,7 @@ TEST_CASE("ECDSA keygen and signature test", "[ecdsa]") {
...
@@ -444,7 +444,7 @@ TEST_CASE("ECDSA keygen and signature test", "[ecdsa]") {
vector
<
char
>
signature_s
(
BUF_LEN
,
0
);
vector
<
char
>
signature_s
(
BUF_LEN
,
0
);
uint8_t
signature_v
=
0
;
uint8_t
signature_v
=
0
;
status
=
trustedEcdsaSign
(
eid
,
&
err
_s
tatus
,
errMsg
.
data
(),
encr_pr_key
.
data
(),
enc_len
,
(
unsigned
char
*
)
hex
.
data
(),
status
=
trustedEcdsaSign
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encr_pr_key
.
data
(),
enc_len
,
(
unsigned
char
*
)
hex
.
data
(),
signature_r
.
data
(),
signature_r
.
data
(),
signature_s
.
data
(),
&
signature_v
,
16
);
signature_s
.
data
(),
&
signature_v
,
16
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
...
@@ -464,13 +464,13 @@ TEST_CASE("Test test", "[test]") {
...
@@ -464,13 +464,13 @@ TEST_CASE("Test test", "[test]") {
initAll
(
false
,
true
);
initAll
(
false
,
true
);
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
int
err
_s
tatus
=
0
;
int
err
S
tatus
=
0
;
vector
<
uint8_t
>
encr_pr_key
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encr_pr_key
(
BUF_LEN
,
0
);
vector
<
char
>
pub_key_x
(
BUF_LEN
,
0
);
vector
<
char
>
pub_key_x
(
BUF_LEN
,
0
);
vector
<
char
>
pub_key_y
(
BUF_LEN
,
0
);
vector
<
char
>
pub_key_y
(
BUF_LEN
,
0
);
uint32_t
enc_len
=
0
;
uint32_t
enc_len
=
0
;
status
=
trustedGenerateEcdsaKey
(
eid
,
&
err
_s
tatus
,
errMsg
.
data
(),
encr_pr_key
.
data
(),
&
enc_len
,
pub_key_x
.
data
(),
status
=
trustedGenerateEcdsaKey
(
eid
,
&
err
S
tatus
,
errMsg
.
data
(),
encr_pr_key
.
data
(),
&
enc_len
,
pub_key_x
.
data
(),
pub_key_y
.
data
());
pub_key_y
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
...
...
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