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
ce9fdbe2
Unverified
Commit
ce9fdbe2
authored
4 years ago
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed DHDkg.c
parent
c26f01d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
10 deletions
+27
-10
DHDkg.c
secure_enclave/DHDkg.c
+27
-10
No files found.
secure_enclave/DHDkg.c
View file @
ce9fdbe2
...
...
@@ -199,22 +199,37 @@ void xor_encrypt(char *key, char *message, char *cypher) {
}
void
xor_decrypt
(
char
*
key
,
char
*
cypher
,
char
*
message
)
{
uint8_t
msg_bin
[
33
];
uint8_t
*
key_bin
=
(
uint8_t
*
)
calloc
(
33
,
1
);
if
(
!
cypher
)
{
LOG_ERROR
(
"xor_encrypt: null cypher"
);
goto
clean
;
}
if
(
!
key
)
{
LOG_ERROR
(
"xor_encrypt: null key"
);
goto
clean
;
}
if
(
!
message
)
{
LOG_ERROR
(
"xor_encrypt: null message"
);
goto
clean
;
}
SAFE_CHAR_BUF
(
msg_bin
,
33
);
SAFE_CHAR_BUF
(
key_bin
,
33
)
uint64_t
key_length
;
if
(
!
hex2carray
(
key
,
&
key_length
,
key_bin
))
{
message
=
NULL
;
free
(
key_bin
);
return
;
goto
clean
;
}
uint64_t
cypher_length
;
uint8_t
cypher_bin
[
33
];
SAFE_CHAR_BUF
(
cypher_bin
,
33
);
if
(
!
hex2carray
(
cypher
,
&
cypher_length
,
cypher_bin
))
{
message
=
NULL
;
free
(
key_bin
);
return
;
goto
clean
;
}
for
(
int
i
=
0
;
i
<
32
;
i
++
)
{
...
...
@@ -223,5 +238,7 @@ void xor_decrypt(char *key, char *cypher, char *message) {
carray2Hex
(
msg_bin
,
32
,
message
);
free
(
key_bin
);
clean:
;
}
This diff is collapsed.
Click to expand it.
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