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
7bf12c7d
Unverified
Commit
7bf12c7d
authored
Aug 27, 2019
by
a72d9e2bad9edfd58d6c0248c12c953b71d409d2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added gmp
parent
ba3c11cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
5 deletions
+34
-5
sgxd.c
sgxd.c
+34
-5
No files found.
sgxd.c
View file @
7bf12c7d
...
...
@@ -42,7 +42,35 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define ENCLAVE_NAME "secure_enclave.signed.so"
void
usage
();
unsigned
char
*
carray2Hex
(
const
uint8_t
*
d
,
int
_len
)
{
unsigned
char
*
hex
=
malloc
(
2
*
_len
);
static
char
hexval
[
16
]
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
};
for
(
int
j
=
0
;
j
<
_len
;
j
++
)
{
hex
[
j
*
2
]
=
hexval
[((
d
[
j
]
>>
4
)
&
0xF
)];
hex
[
j
*
2
+
1
]
=
hexval
[(
d
[
j
])
&
0x0F
];
}
return
hex
;
}
int
char2int
(
char
_input
)
{
if
(
_input
>=
'0'
&&
_input
<=
'9'
)
return
_input
-
'0'
;
if
(
_input
>=
'A'
&&
_input
<=
'F'
)
return
_input
-
'A'
+
10
;
if
(
_input
>=
'a'
&&
_input
<=
'f'
)
return
_input
-
'a'
+
10
;
return
-
1
;
}
void
usage
()
{
fprintf
(
stderr
,
"usage: sgxd
\n
"
);
...
...
@@ -139,14 +167,15 @@ int main (int argc, char *argv[])
gmp_printf
(
"Encrypt key completed with status: %d
\n
"
,
err_status
);
gmp_printf
(
"Result:"
);
unsigned
char
*
result
=
carray2Hex
(
encryptedKey
,
enc_len
);
for
(
int
i
=
0
;
i
<
enc_len
;
i
++
)
{
gmp_printf
(
"%d"
,
encryptedKey
[
i
]);
}
gmp_printf
(
"Result: %s"
,
result
);
gmp_printf
(
"
\n
Length: %d
\n
"
,
enc_len
);
return
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