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
36ad7ae1
Unverified
Commit
36ad7ae1
authored
Jun 17, 2020
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2748 refactoring
parent
5b71e0f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
ECDSACrypto.cpp
ECDSACrypto.cpp
+12
-4
secure_enclave.c
secure_enclave/secure_enclave.c
+1
-1
No files found.
ECDSACrypto.cpp
View file @
36ad7ae1
...
...
@@ -114,6 +114,11 @@ string getECDSAPubKey(const char *_encryptedKeyHex) {
if
(
errStatus
!=
0
)
{
throw
SGXException
(
-
666
,
errMsg
.
data
());
}
if
(
status
!=
SGX_SUCCESS
)
{
spdlog
::
error
(
"failed to get ECDSA public key {}"
,
status
);
throw
SGXException
(
666
,
"failed to get ECDSA public key"
);
}
string
pubKey
=
string
(
pubKeyX
.
data
())
+
string
(
pubKeyY
.
data
());
//concatPubKeyWith0x(pub_key_x, pub_key_y);//
...
...
@@ -131,8 +136,8 @@ bool verifyECDSASig(string& pubKeyStr, const char *hashHex, const char *signatur
signature
sig
=
signature_init
();
auto
r
=
pubKeyStr
.
substr
(
0
,
64
);
auto
s
=
pubKeyStr
.
substr
(
64
,
128
);
auto
x
=
pubKeyStr
.
substr
(
0
,
64
);
auto
y
=
pubKeyStr
.
substr
(
64
,
128
);
domain_parameters
curve
=
domain_parameters_init
();
domain_parameters_load_curve
(
curve
,
secp256k1
);
point
publicKey
=
point_init
();
...
...
@@ -144,9 +149,12 @@ bool verifyECDSASig(string& pubKeyStr, const char *hashHex, const char *signatur
goto
clean
;
}
signature_set_str
(
sig
,
signatureR
,
signatureS
,
16
);
if
(
signature_set_str
(
sig
,
signatureR
,
signatureS
,
16
)
!=
0
)
{
spdlog
::
error
(
"Failed to set str signature"
);
goto
clean
;
}
point_set_hex
(
publicKey
,
r
.
c_str
(),
s
.
c_str
());
point_set_hex
(
publicKey
,
x
.
c_str
(),
y
.
c_str
());
if
(
!
signature_verify
(
msgMpz
,
sig
,
publicKey
,
curve
))
{
spdlog
::
error
(
"ECDSA sig not verified"
);
goto
clean
;
...
...
secure_enclave/secure_enclave.c
View file @
36ad7ae1
...
...
@@ -361,7 +361,7 @@ void trustedEcdsaSign(int *errStatus, char *errString, uint8_t *encryptedPrivate
if
(
!
signature_verify
(
msgMpz
,
sign
,
publicKey
,
curve
))
{
*
errStatus
=
2
;
snprintf
(
errString
,
BUF_LEN
,
"ECDSA sig not verified"
);
snprintf
(
errString
,
BUF_LEN
,
"ECDSA sig
nature is
not verified"
);
LOG_WARN
(
errString
);
goto
clean
;
}
...
...
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