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
28716583
Unverified
Commit
28716583
authored
Sep 02, 2019
by
a72d9e2bad9edfd58d6c0248c12c953b71d409d2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes
parent
bfa691b4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
6 deletions
+10
-6
secure_enclave.c
secure_enclave/secure_enclave.c
+1
-1
secure_enclave.edl
secure_enclave/secure_enclave.edl
+1
-0
sgxd.c
sgxd.c
+8
-5
No files found.
secure_enclave/secure_enclave.c
View file @
28716583
...
@@ -118,7 +118,7 @@ void e_mpf_div(mpf_t *c_un, mpf_t *a_un, mpf_t *b_un) {}
...
@@ -118,7 +118,7 @@ void e_mpf_div(mpf_t *c_un, mpf_t *a_un, mpf_t *b_un) {}
void
encrypt_key
(
int
*
err_status
,
unsigned
char
*
key
,
void
encrypt_key
(
int
*
err_status
,
unsigned
char
*
err_string
,
unsigned
char
*
key
,
unsigned
char
*
encrypted_key
,
uint32_t
*
enc_len
)
{
unsigned
char
*
encrypted_key
,
uint32_t
*
enc_len
)
{
*
err_status
=
-
1
;
*
err_status
=
-
1
;
...
...
secure_enclave/secure_enclave.edl
View file @
28716583
...
@@ -23,6 +23,7 @@ enclave {
...
@@ -23,6 +23,7 @@ enclave {
public void encrypt_key (
public void encrypt_key (
[user_check] int *err_status,
[user_check] int *err_status,
[out, count = 1024] unsigned char* err_string,
[in, count = 128] unsigned char* key,
[in, count = 128] unsigned char* key,
[out, count = 1024] unsigned char* encrypted_key, [user_check] uint32_t *enc_len);
[out, count = 1024] unsigned char* encrypted_key, [user_check] uint32_t *enc_len);
...
...
sgxd.c
View file @
28716583
...
@@ -170,9 +170,11 @@ int main(int argc, char *argv[]) {
...
@@ -170,9 +170,11 @@ int main(int argc, char *argv[]) {
const
char
*
key
=
"4160780231445160889237664391382223604184857153814275770598"
const
char
*
key
=
"4160780231445160889237664391382223604184857153814275770598"
"791864649971919844"
;
"791864649971919844"
;
char
keyArray
[
128
]
;
unsigned
char
*
keyArray
=
calloc
(
128
,
1
)
;
unsigned
char
encryptedKey
[
1024
];
unsigned
char
*
encryptedKey
=
calloc
(
1024
,
1
);
unsigned
char
*
errMsg
=
calloc
(
1024
,
1
);
strncpy
(
keyArray
,
key
,
128
);
strncpy
(
keyArray
,
key
,
128
);
...
@@ -180,14 +182,15 @@ int main(int argc, char *argv[]) {
...
@@ -180,14 +182,15 @@ int main(int argc, char *argv[]) {
int
enc_len
=
0
;
int
enc_len
=
0
;
status
=
encrypt_key
(
eid
,
&
err_status
,
keyArray
,
encryptedKey
,
&
enc_len
);
status
=
encrypt_key
(
eid
,
&
err_status
,
errMsg
,
keyArray
,
encryptedKey
,
&
enc_len
);
if
(
status
!=
SGX_SUCCESS
)
{
if
(
status
!=
SGX_SUCCESS
)
{
gmp_printf
(
stderr
,
"ECALL encrypt_key: 0x%04x
\n
"
,
status
);
gmp_printf
(
"ECALL encrypt_key: 0x%04x
\n
"
,
status
);
return
1
;
return
1
;
}
}
gmp_printf
(
"Encrypt key completed with status: %d
\n
"
,
err_status
);
gmp_printf
(
"Encrypt key completed with status: %d %s
\n
"
,
err_status
,
errMsg
);
unsigned
char
*
result
=
carray2Hex
(
encryptedKey
,
enc_len
);
unsigned
char
*
result
=
carray2Hex
(
encryptedKey
,
enc_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