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
0a88d362
Unverified
Commit
0a88d362
authored
Sep 09, 2019
by
kladkogex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing
parent
a24a27f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
26 deletions
+25
-26
testw.cpp
testw.cpp
+25
-26
No files found.
testw.cpp
View file @
0a88d362
...
...
@@ -60,7 +60,7 @@ sgx_status_t status;
int
updated
;
TEST_CASE
(
"BLS key encrypt
/decrypt
"
,
"[bls-key-encrypt-decrypt]"
)
{
TEST_CASE
(
"BLS key encrypt"
,
"[bls-key-encrypt-decrypt]"
)
{
{
...
...
@@ -70,46 +70,45 @@ TEST_CASE("BLS key encrypt/decrypt", "[bls-key-encrypt-decrypt]") {
"791864649971919844"
;
char
*
keyArray
=
(
char
*
)
calloc
(
128
,
1
);
uint8_t
*
encryptedKey
=
(
uint8_t
*
)
calloc
(
1024
,
1
);
char
*
errMsg
=
(
char
*
)
calloc
(
1024
,
1
);
strncpy
((
char
*
)
keyArray
,
(
char
*
)
key
,
128
);
int
err
_s
tatus
=
0
;
int
err
S
tatus
=
0
;
unsigned
int
enc
_l
en
=
0
;
unsigned
int
enc
ryptedL
en
=
0
;
status
=
encrypt_key
(
eid
,
&
err
_status
,
errMsg
,
keyArray
,
encryptedKey
,
&
enc_l
en
);
status
=
encrypt_key
(
eid
,
&
err
Status
,
errMsg
,
keyArray
,
encryptedKey
,
&
encryptedL
en
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
err_status
==
0
);
REQUIRE
(
errStatus
==
0
);
printf
(
"Encrypt key completed with status: %d %s
\n
"
,
err
_s
tatus
,
errMsg
);
printf
(
" Encrypted key len %d
\n
"
,
enc
_l
en
);
printf
(
"Encrypt key completed with status: %d %s
\n
"
,
err
S
tatus
,
errMsg
);
printf
(
" Encrypted key len %d
\n
"
,
enc
ryptedL
en
);
char
result
[
2
*
BUF_LEN
];
carray2Hex
(
encryptedKey
,
enc
_l
en
,
result
);
carray2Hex
(
encryptedKey
,
enc
ryptedL
en
,
result
);
uint64_t
dec
_l
en
=
0
;
uint64_t
dec
odedL
en
=
0
;
uint8_t
bin
[
BUF_LEN
];
uint8_t
decoded
[
BUF_LEN
];
REQUIRE
(
hex2carray
(
result
,
&
dec
_len
,
bin
));
REQUIRE
(
hex2carray
(
result
,
&
dec
odedLen
,
decoded
));
for
(
uint64_t
i
=
0
;
i
<
dec
_l
en
;
i
++
)
{
REQUIRE
(
bin
[
i
]
==
encryptedKey
[
i
]);
for
(
uint64_t
i
=
0
;
i
<
dec
odedL
en
;
i
++
)
{
REQUIRE
(
decoded
[
i
]
==
encryptedKey
[
i
]);
}
REQUIRE
(
dec
_len
==
enc_l
en
);
REQUIRE
(
dec
odedLen
==
encryptedL
en
);
gmp_printf
(
"Result: %s"
,
result
);
gmp_printf
(
"
\n
Length: %d
\n
"
,
enc
_l
en
);
gmp_printf
(
"
\n
Length: %d
\n
"
,
enc
ryptedL
en
);
}
}
...
...
@@ -134,23 +133,23 @@ TEST_CASE("BLS sign test", "[bls-sign]") {
strncpy
((
char
*
)
keyArray
,
(
char
*
)
key
,
128
);
int
err
_s
tatus
=
0
;
int
err
S
tatus
=
0
;
unsigned
int
enc
_l
en
=
0
;
unsigned
int
enc
ryptedL
en
=
0
;
status
=
encrypt_key
(
eid
,
&
err
_status
,
errMsg
,
keyArray
,
encryptedKey
,
&
enc_l
en
);
status
=
encrypt_key
(
eid
,
&
err
Status
,
errMsg
,
keyArray
,
encryptedKey
,
&
encryptedL
en
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
err
_s
tatus
==
0
);
REQUIRE
(
err
S
tatus
==
0
);
printf
(
"Encrypt key completed with status: %d %s
\n
"
,
err
_s
tatus
,
errMsg
);
printf
(
" Encrypted key len %d
\n
"
,
enc
_l
en
);
printf
(
"Encrypt key completed with status: %d %s
\n
"
,
err
S
tatus
,
errMsg
);
printf
(
" Encrypted key len %d
\n
"
,
enc
ryptedL
en
);
char
result
[
2
*
BUF_LEN
];
carray2Hex
(
encryptedKey
,
enc
_l
en
,
result
carray2Hex
(
encryptedKey
,
enc
ryptedL
en
,
result
);
uint64_t
dec_len
=
0
;
...
...
@@ -164,11 +163,11 @@ TEST_CASE("BLS sign test", "[bls-sign]") {
REQUIRE
(
bin
[
i
]
==
encryptedKey
[
i
]);
}
REQUIRE
(
dec_len
==
enc
_l
en
);
REQUIRE
(
dec_len
==
enc
ryptedL
en
);
gmp_printf
(
"Result: %s"
,
result
);
gmp_printf
(
"
\n
Length: %d
\n
"
,
enc
_l
en
);
gmp_printf
(
"
\n
Length: %d
\n
"
,
enc
ryptedL
en
);
char
sig
[
BUF_LEN
];
...
...
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