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
1390120c
Unverified
Commit
1390120c
authored
Jun 09, 2020
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2002 fix bug with key length
parent
0ec01653
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
secure_enclave.c
secure_enclave/secure_enclave.c
+13
-2
No files found.
secure_enclave/secure_enclave.c
View file @
1390120c
...
...
@@ -971,7 +971,14 @@ void trustedGenerateEcdsaKeyAES(int *errStatus, char *errString,
}
strncpy
(
pub_key_y
+
n_zeroes
,
arr_y
,
1024
-
n_zeroes
);
char
skey_str
[
mpz_sizeinbase
(
skey
,
ECDSA_SKEY_BASE
)
+
2
];
mpz_get_str
(
skey_str
,
ECDSA_SKEY_BASE
,
skey
);
//mpz_get_str(skey_str, ECDSA_SKEY_BASE, skey);
char
arr_skey_str
[
mpz_sizeinbase
(
skey
,
ECDSA_SKEY_BASE
)
+
2
];
mpz_get_str
(
arr_skey_str
,
ECDSA_SKEY_BASE
,
skey
);
n_zeroes
=
64
-
strlen
(
arr_skey_str
);
for
(
int
i
=
0
;
i
<
n_zeroes
;
i
++
)
{
skey_str
[
i
]
=
'0'
;
}
strncpy
(
skey_str
+
n_zeroes
,
arr_skey_str
,
65
-
n_zeroes
);
snprintf
(
errString
,
BUF_LEN
,
"skey is %s len %d
\n
"
,
skey_str
,
strlen
(
skey_str
));
int
stat
=
AES_encrypt
(
skey_str
,
encryptedPrivateKey
);
...
...
@@ -992,7 +999,7 @@ void trustedGenerateEcdsaKeyAES(int *errStatus, char *errString,
stat
=
AES_decrypt
(
encryptedPrivateKey
,
*
enc_len
,
skey_str
);
if
(
stat
!=
0
)
{
snprintf
(
errString
+
19
+
strlen
(
skey_str
),
BUF_LEN
,
"ecdsa private key decr failed with status %d"
,
stat
);
errStatus
=
stat
;
*
errStatus
=
stat
;
return
;
}
...
...
@@ -1529,7 +1536,10 @@ void trustedCreateBlsKeyAES(int *errStatus, char *errString, const char *s_share
if
(
common_key
==
NULL
)
{
*
errStatus
=
1
;
snprintf
(
errString
,
BUF_LEN
,
"invalid common_key"
);
LOG_ERROR
(
errString
);
mpz_clear
(
sum
);
return
;
}
...
...
@@ -1539,6 +1549,7 @@ void trustedCreateBlsKeyAES(int *errStatus, char *errString, const char *s_share
*
errStatus
=
1
;
snprintf
(
errString
,
BUF_LEN
,
"invalid common_key"
);
LOG_ERROR
(
common_key
);
LOG_ERROR
(
errString
);
mpz_clear
(
sum
);
...
...
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