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
ec9ff9f4
Unverified
Commit
ec9ff9f4
authored
Aug 13, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3067-cleanup-sgx
parent
a0345282
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
10 deletions
+57
-10
testw.cpp
testw.cpp
+57
-10
No files found.
testw.cpp
View file @
ec9ff9f4
...
...
@@ -63,6 +63,9 @@
#include "TestUtils.h"
#include "testw.h"
#define PRINT_SRC_LINE cerr << "Executing line " << to_string(__LINE__) << endl;
using
namespace
jsonrpc
;
using
namespace
std
;
...
...
@@ -100,6 +103,9 @@ TEST_CASE_METHOD(TestFixture, "ECDSA keygen and signature test", "[ecdsa-key-sig
vector
<
char
>
pubKeyY
(
BUF_LEN
,
0
);
uint32_t
encLen
=
0
;
PRINT_SRC_LINE
auto
status
=
trustedGenerateEcdsaKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrivKey
.
data
(),
&
encLen
,
pubKeyX
.
data
(),
pubKeyY
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
...
...
@@ -132,6 +138,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES keygen and signature test", "[ecdsa-aes
vector
<
char
>
pubKeyY
(
BUF_LEN
,
0
);
uint32_t
encLen
=
0
;
PRINT_SRC_LINE
auto
status
=
trustedGenerateEcdsaKeyAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrivKey
.
data
(),
&
encLen
,
pubKeyX
.
data
(),
pubKeyY
.
data
());
...
...
@@ -145,6 +152,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES keygen and signature test", "[ecdsa-aes
for
(
int
i
=
0
;
i
<
50
;
i
++
)
{
PRINT_SRC_LINE
status
=
trustedEcdsaSignAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrivKey
.
data
(),
encLen
,
hex
.
data
(),
signatureR
.
data
(),
...
...
@@ -161,6 +169,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA key gen", "[ecdsa-key-gen]") {
vector
<
char
>
pubKeyX
(
BUF_LEN
,
0
);
vector
<
char
>
pubKeyY
(
BUF_LEN
,
0
);
uint32_t
encLen
=
0
;
PRINT_SRC_LINE
auto
status
=
trustedGenerateEcdsaKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrivKey
.
data
(),
&
encLen
,
pubKeyX
.
data
(),
pubKeyY
.
data
());
...
...
@@ -175,6 +184,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES key gen", "[ecdsa-aes-key-gen]") {
vector
<
char
>
pubKeyX
(
BUF_LEN
,
0
);
vector
<
char
>
pubKeyY
(
BUF_LEN
,
0
);
uint32_t
encLen
=
0
;
PRINT_SRC_LINE
auto
status
=
trustedGenerateEcdsaKeyAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrivKey
.
data
(),
&
encLen
,
pubKeyX
.
data
(),
pubKeyY
.
data
());
...
...
@@ -190,7 +200,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA get public key", "[ecdsa-get-pub-key]") {
vector
<
char
>
pubKeyX
(
BUF_LEN
,
0
);
vector
<
char
>
pubKeyY
(
BUF_LEN
,
0
);
uint32_t
encLen
=
0
;
PRINT_SRC_LINE
auto
status
=
trustedGenerateEcdsaKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encPrivKey
.
data
(),
&
encLen
,
pubKeyX
.
data
(),
pubKeyY
.
data
());
...
...
@@ -200,6 +210,8 @@ TEST_CASE_METHOD(TestFixture, "ECDSA get public key", "[ecdsa-get-pub-key]") {
vector
<
char
>
receivedPubKeyX
(
BUF_LEN
,
0
);
vector
<
char
>
receivedPubKeyY
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
status
=
trustedGetPublicEcdsaKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encPrivKey
.
data
(),
encLen
,
receivedPubKeyX
.
data
(),
receivedPubKeyY
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
...
...
@@ -214,6 +226,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES get public key", "[ecdsa-aes-get-pub-ke
vector
<
char
>
pubKeyY
(
BUF_LEN
,
0
);
uint32_t
encLen
=
0
;
PRINT_SRC_LINE
auto
status
=
trustedGenerateEcdsaKeyAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encPrivKey
.
data
(),
&
encLen
,
pubKeyX
.
data
(),
pubKeyY
.
data
());
...
...
@@ -223,6 +236,7 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES get public key", "[ecdsa-aes-get-pub-ke
vector
<
char
>
receivedPubKeyX
(
BUF_LEN
,
0
);
vector
<
char
>
receivedPubKeyY
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
status
=
trustedGetPublicEcdsaKeyAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encPrivKey
.
data
(),
encLen
,
receivedPubKeyX
.
data
(),
receivedPubKeyY
.
data
());
...
...
@@ -277,8 +291,9 @@ TEST_CASE_METHOD(TestFixture, "ECDSA key gen API", "[ecdsa-key-gen-api]") {
for
(
int
i
=
0
;
i
<=
20
;
i
++
)
{
try
{
PRINT_SRC_LINE
auto
keyName
=
genECDSAKeyAPI
(
c
);
PRINT_SRC_LINE
Json
::
Value
sig
=
c
.
ecdsaSignMessageHash
(
16
,
keyName
,
SAMPLE_HASH
);
REQUIRE
(
sig
[
"status"
].
asInt
()
==
0
);
Json
::
Value
getPubKey
=
c
.
getPublicECDSAKey
(
keyName
);
...
...
@@ -298,10 +313,12 @@ Json::Value sig = c.ecdsaSignMessageHash(10, keyName, SAMPLE_HASH);
for
(
int
i
=
0
;
i
<=
20
;
i
++
)
{
try
{
PRINT_SRC_LINE
auto
keyName
=
genECDSAKeyAPI
(
c
);
PRINT_SRC_LINE
Json
::
Value
sig
=
c
.
ecdsaSignMessageHash
(
10
,
keyName
,
SAMPLE_HASH
);
REQUIRE
(
sig
[
"status"
].
asInt
()
==
0
);
PRINT_SRC_LINE
Json
::
Value
getPubKey
=
c
.
getPublicECDSAKey
(
keyName
);
REQUIRE
(
getPubKey
[
"status"
].
asInt
()
==
0
);
}
catch
(
JsonRpcException
&
e
)
{
...
...
@@ -323,6 +340,7 @@ TEST_CASE_METHOD(TestFixture, "DKG gen test", "[dkg-gen]") {
int
errStatus
=
0
;
uint32_t
encLen
=
0
;
PRINT_SRC_LINE
auto
status
=
trustedGenDkgSecret
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
encLen
,
32
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
...
...
@@ -331,6 +349,7 @@ TEST_CASE_METHOD(TestFixture, "DKG gen test", "[dkg-gen]") {
vector
<
char
>
errMsg1
(
BUF_LEN
,
0
);
uint32_t
dec_len
;
PRINT_SRC_LINE
status
=
trustedDecryptDkgSecret
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
(
uint8_t
*
)
secret
.
data
(),
&
dec_len
);
...
...
@@ -345,6 +364,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES gen test", "[dkg-aes-gen]") {
int
errStatus
=
0
;
uint32_t
encLen
=
0
;
PRINT_SRC_LINE
auto
status
=
trustedGenDkgSecretAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
encLen
,
32
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
...
...
@@ -369,6 +389,7 @@ TEST_CASE_METHOD(TestFixture, "DKG public shares test", "[dkg-pub-shares]") {
unsigned
t
=
32
,
n
=
32
;
PRINT_SRC_LINE
auto
status
=
trustedGenDkgSecret
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
encLen
,
n
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
...
...
@@ -378,6 +399,7 @@ TEST_CASE_METHOD(TestFixture, "DKG public shares test", "[dkg-pub-shares]") {
char
colon
=
':'
;
vector
<
char
>
pubShares
(
10000
,
0
);
PRINT_SRC_LINE
status
=
trustedGetPublicShares
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
encLen
,
pubShares
.
data
(),
t
,
n
);
REQUIRE
(
status
==
SGX_SUCCESS
);
...
...
@@ -393,6 +415,7 @@ TEST_CASE_METHOD(TestFixture, "DKG public shares test", "[dkg-pub-shares]") {
vector
<
char
>
secret
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
status
=
trustedDecryptDkgSecret
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
(
uint8_t
*
)
secret
.
data
(),
&
encLen
);
REQUIRE
(
status
==
SGX_SUCCESS
);
...
...
@@ -417,7 +440,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES public shares test", "[dkg-aes-pub-shares
uint32_t
encLen
=
0
;
unsigned
t
=
32
,
n
=
32
;
PRINT_SRC_LINE
auto
status
=
trustedGenDkgSecretAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
encLen
,
n
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
...
...
@@ -426,7 +449,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES public shares test", "[dkg-aes-pub-shares
char
colon
=
':'
;
vector
<
char
>
pubShares
(
10000
,
0
);
PRINT_SRC_LINE
status
=
trustedGetPublicSharesAES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
encLen
,
pubShares
.
data
(),
t
,
n
);
REQUIRE
(
status
==
SGX_SUCCESS
);
...
...
@@ -441,7 +464,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES public shares test", "[dkg-aes-pub-shares
}
vector
<
char
>
secret
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
status
=
trustedDecryptDkgSecretAES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDKGSecret
.
data
(),
encLen
,
(
uint8_t
*
)
secret
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
...
...
@@ -470,6 +493,7 @@ TEST_CASE_METHOD(TestFixture, "DKG encrypted secret shares test", "[dkg-encr-ssh
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
PRINT_SRC_LINE
status
=
trustedSetEncryptedDkgPoly
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
());
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
...
...
@@ -479,6 +503,7 @@ TEST_CASE_METHOD(TestFixture, "DKG encrypted secret shares test", "[dkg-encr-ssh
string
pub_keyB
=
SAMPLE_PUBLIC_KEY_B
;
vector
<
char
>
s_shareG2
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
status
=
trustedGetEncryptedSecretShare
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPRDHKey
.
data
(),
&
encLen
,
result
.
data
(),
s_shareG2
.
data
(),
(
char
*
)
pub_keyB
.
data
(),
2
,
2
,
1
);
...
...
@@ -495,12 +520,14 @@ TEST_CASE_METHOD(TestFixture, "DKG AES encrypted secret shares test", "[dkg-aes-
uint32_t
encLen
=
0
;
vector
<
uint8_t
>
encryptedDKGSecret
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
auto
status
=
trustedGenDkgSecretAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
&
encLen
,
2
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
uint64_t
enc_len
=
encLen
;
PRINT_SRC_LINE
status
=
trustedSetEncryptedDkgPolyAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encryptedDKGSecret
.
data
(),
enc_len
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
...
...
@@ -510,6 +537,7 @@ TEST_CASE_METHOD(TestFixture, "DKG AES encrypted secret shares test", "[dkg-aes-
string
pub_keyB
=
SAMPLE_PUBLIC_KEY_B
;
vector
<
char
>
s_shareG2
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
status
=
trustedGetEncryptedSecretShareAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPRDHKey
.
data
(),
&
encLen
,
result
.
data
(),
s_shareG2
.
data
(),
...
...
@@ -550,6 +578,7 @@ TEST_CASE_METHOD(TestFixture, "DKG_BLS test", "[dkg-bls]") {
int
schainID
=
TestUtils
::
randGen
();
int
dkgID
=
TestUtils
::
randGen
();
PRINT_SRC_LINE
TestUtils
::
doDKG
(
c
,
4
,
1
,
ecdsaKeyNames
,
blsKeyNames
,
schainID
,
dkgID
);
REQUIRE
(
blsKeyNames
.
size
()
==
4
);
...
...
@@ -566,8 +595,9 @@ TEST_CASE_METHOD(TestFixture, "Delete Bls Key", "[delete-bls-key]") {
std
::
string
name
=
"BLS_KEY:SCHAIN_ID:123456789:NODE_ID:0:DKG_ID:0"
;
libff
::
alt_bn128_Fr
key
=
libff
::
alt_bn128_Fr
(
"6507625568967977077291849236396320012317305261598035438182864059942098934847"
);
std
::
string
key_str
=
TestUtils
::
stringFromFr
(
key
);
PRINT_SRC_LINE
c
.
importBLSKeyShare
(
key_str
,
name
,
1
,
2
,
1
);
PRINT_SRC_LINE
REQUIRE
(
c
.
deleteBlsKey
(
name
)[
"deleted"
]
==
true
);
}
...
...
@@ -609,7 +639,7 @@ TEST_CASE_METHOD(TestFixtureHTTPS, "Cert request sign", "[cert-sign]") {
auto
result
=
SGXRegistrationServer
::
getServer
()
->
SignCertificate
(
ss
.
str
());
REQUIRE
(
result
[
"status"
]
==
0
);
PRINT_SRC_LINE
result
=
SGXRegistrationServer
::
getServer
()
->
SignCertificate
(
"Haha"
);
REQUIRE
(
result
[
"status"
]
!=
0
);
...
...
@@ -621,6 +651,7 @@ TEST_CASE_METHOD(TestFixture, "DKG API test", "[dkg-api]") {
string
polyName
=
SAMPLE_POLY_NAME
;
PRINT_SRC_LINE
Json
::
Value
genPoly
=
c
.
generateDKGPoly
(
polyName
,
2
);
REQUIRE
(
genPoly
[
"status"
].
asInt
()
==
0
);
...
...
@@ -673,13 +704,16 @@ TEST_CASE_METHOD(TestFixture, "PolyExists test", "[dkg-poly-exists]") {
StubClient
c
(
client
,
JSONRPC_CLIENT_V2
);
string
polyName
=
SAMPLE_POLY_NAME
;
PRINT_SRC_LINE
Json
::
Value
genPoly
=
c
.
generateDKGPoly
(
polyName
,
2
);
REQUIRE
(
genPoly
[
"status"
]
==
0
);
PRINT_SRC_LINE
Json
::
Value
polyExists
=
c
.
isPolyExists
(
polyName
);
REQUIRE
(
polyExists
[
"status"
]
==
0
);
REQUIRE
(
polyExists
[
"IsExist"
].
asBool
());
PRINT_SRC_LINE
Json
::
Value
polyDoesNotExist
=
c
.
isPolyExists
(
"Vasya"
);
REQUIRE
(
!
polyDoesNotExist
[
"IsExist"
].
asBool
());
}
...
...
@@ -701,6 +735,7 @@ TEST_CASE_METHOD(TestFixture, "AES_DKG test", "[aes-dkg]") {
int
schainID
=
TestUtils
::
randGen
();
int
dkgID
=
TestUtils
::
randGen
();
for
(
uint8_t
i
=
0
;
i
<
n
;
i
++
)
{
PRINT_SRC_LINE
ethKeys
[
i
]
=
c
.
generateECDSAKey
();
REQUIRE
(
ethKeys
[
i
][
"status"
]
==
0
);
string
polyName
=
...
...
@@ -710,6 +745,7 @@ TEST_CASE_METHOD(TestFixture, "AES_DKG test", "[aes-dkg]") {
REQUIRE
(
response
[
"status"
]
==
0
);
polyNames
[
i
]
=
polyName
;
PRINT_SRC_LINE
verifVects
[
i
]
=
c
.
getVerificationVector
(
polyName
,
t
,
n
);
REQUIRE
(
verifVects
[
i
][
"status"
]
==
0
);
...
...
@@ -717,6 +753,7 @@ TEST_CASE_METHOD(TestFixture, "AES_DKG test", "[aes-dkg]") {
}
for
(
uint8_t
i
=
0
;
i
<
n
;
i
++
)
{
PRINT_SRC_LINE
secretShares
[
i
]
=
c
.
getSecretShare
(
polyNames
[
i
],
pubEthKeys
,
t
,
n
);
REQUIRE
(
secretShares
[
i
][
"status"
]
==
0
);
...
...
@@ -734,6 +771,7 @@ TEST_CASE_METHOD(TestFixture, "AES_DKG test", "[aes-dkg]") {
for
(
int
j
=
0
;
j
<
n
;
j
++
)
{
string
secretShare
=
secretShares
[
i
][
"secretShare"
].
asString
().
substr
(
192
*
j
,
192
);
secShares
[
i
]
+=
secretShares
[
j
][
"secretShare"
].
asString
().
substr
(
192
*
i
,
192
);
PRINT_SRC_LINE
Json
::
Value
verif
=
c
.
dkgVerification
(
pubShares
[
i
],
ethKeys
[
j
][
"keyName"
].
asString
(),
secretShare
,
t
,
n
,
j
);
REQUIRE
(
verif
[
"status"
]
==
0
);
bool
res
=
verif
[
"result"
].
asBool
();
...
...
@@ -765,6 +803,7 @@ TEST_CASE_METHOD(TestFixture, "AES_DKG test", "[aes-dkg]") {
n
);
REQUIRE
(
response
[
"status"
]
==
0
);
PRINT_SRC_LINE
pubBLSKeys
[
i
]
=
c
.
getBLSPublicKeyShare
(
blsName
);
REQUIRE
(
pubBLSKeys
[
i
][
"status"
]
==
0
);
...
...
@@ -781,6 +820,7 @@ TEST_CASE_METHOD(TestFixture, "AES_DKG test", "[aes-dkg]") {
pubKey_vect
.
push_back
(
pubBLSKeys
[
i
][
"blsPublicKeyShare"
][
j
].
asString
());
}
BLSPublicKeyShare
pubKey
(
make_shared
<
vector
<
string
>>
(
pubKey_vect
),
t
,
n
);
PRINT_SRC_LINE
REQUIRE
(
pubKey
.
VerifySigWithHelper
(
hash_arr
,
make_shared
<
BLSSigShare
>
(
sig
),
t
,
n
));
coeffs_pkeys_map
[
i
+
1
]
=
make_shared
<
BLSPublicKeyShare
>
(
pubKey
);
...
...
@@ -799,12 +839,14 @@ TEST_CASE_METHOD(TestFixture, "AES encrypt/decrypt", "[aes-encrypt-decrypt]") {
string
key
=
SAMPLE_AES_KEY
;
vector
<
uint8_t
>
encrypted_key
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
auto
status
=
trustedEncryptKeyAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
key
.
c_str
(),
encrypted_key
.
data
(),
&
encLen
);
REQUIRE
(
status
==
0
);
REQUIRE
(
errStatus
==
0
);
vector
<
char
>
decr_key
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
status
=
trustedDecryptKeyAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrypted_key
.
data
(),
encLen
,
decr_key
.
data
());
REQUIRE
(
status
==
0
);
...
...
@@ -819,12 +861,14 @@ TEST_CASE_METHOD(TestFixture, "SGX encrypt/decrypt", "[sgx-encrypt-decrypt]") {
string
key
=
SAMPLE_AES_KEY
;
vector
<
uint8_t
>
encrypted_key
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
auto
status
=
trustedEncryptKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
key
.
c_str
(),
encrypted_key
.
data
(),
&
encLen
);
REQUIRE
(
status
==
0
);
REQUIRE
(
errStatus
==
0
);
vector
<
char
>
decr_key
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
status
=
trustedDecryptKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrypted_key
.
data
(),
encLen
,
decr_key
.
data
());
REQUIRE
(
status
==
0
);
...
...
@@ -852,6 +896,7 @@ TEST_CASE_METHOD(TestFixture, "AES == NOT AES", "[aes-not-aes]") {
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encrPrivKey
(
BUF_LEN
,
0
);
uint32_t
enc_len
=
0
;
PRINT_SRC_LINE
trustedEncryptKey
(
eid
,
&
errStatus
,
errMsg
.
data
(),
key
.
c_str
(),
encrPrivKey
.
data
(),
&
enc_len
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
...
...
@@ -859,7 +904,7 @@ TEST_CASE_METHOD(TestFixture, "AES == NOT AES", "[aes-not-aes]") {
vector
<
char
>
signatureR
(
BUF_LEN
,
0
);
vector
<
char
>
signatureS
(
BUF_LEN
,
0
);
uint8_t
signatureV
=
0
;
PRINT_SRC_LINE
auto
status
=
trustedEcdsaSign
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrivKey
.
data
(),
enc_len
,
(
unsigned
char
*
)
hex
.
data
(),
signatureR
.
data
(),
...
...
@@ -880,6 +925,7 @@ TEST_CASE_METHOD(TestFixture, "AES == NOT AES", "[aes-not-aes]") {
vector
<
char
>
errMsgAES
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encrPrivKeyAES
(
BUF_LEN
,
0
);
uint32_t
enc_lenAES
=
0
;
PRINT_SRC_LINE
trustedEncryptKeyAES
(
eid
,
&
errStatusAES
,
errMsgAES
.
data
(),
key
.
c_str
(),
encrPrivKeyAES
.
data
(),
&
enc_lenAES
);
REQUIRE
(
errStatusAES
==
SGX_SUCCESS
);
...
...
@@ -887,7 +933,7 @@ TEST_CASE_METHOD(TestFixture, "AES == NOT AES", "[aes-not-aes]") {
vector
<
char
>
signatureRAES
(
BUF_LEN
,
0
);
vector
<
char
>
signatureSAES
(
BUF_LEN
,
0
);
uint8_t
signatureVAES
=
0
;
PRINT_SRC_LINE
status
=
trustedEcdsaSignAES
(
eid
,
&
errStatusAES
,
errMsgAES
.
data
(),
encrPrivKeyAES
.
data
(),
enc_lenAES
,
hex
.
data
(),
signatureRAES
.
data
(),
...
...
@@ -898,6 +944,7 @@ TEST_CASE_METHOD(TestFixture, "AES == NOT AES", "[aes-not-aes]") {
errMsgAES
.
clear
();
vector
<
char
>
receivedPubKeyXAES
(
BUF_LEN
,
0
);
vector
<
char
>
receivedPubKeyYAES
(
BUF_LEN
,
0
);
PRINT_SRC_LINE
status
=
trustedGetPublicEcdsaKeyAES
(
eid
,
&
errStatusAES
,
errMsgAES
.
data
(),
encrPrivKeyAES
.
data
(),
enc_lenAES
,
receivedPubKeyXAES
.
data
(),
receivedPubKeyYAES
.
data
());
...
...
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