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
dec8f187
Unverified
Commit
dec8f187
authored
Aug 03, 2020
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2977 clean up
parent
c53e67de
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
16 deletions
+6
-16
BLSCrypto.cpp
BLSCrypto.cpp
+3
-9
SGXWalletServer.cpp
SGXWalletServer.cpp
+1
-3
EnclaveCommon.cpp
secure_enclave/EnclaveCommon.cpp
+1
-1
EnclaveCommon.h
secure_enclave/EnclaveCommon.h
+0
-2
secure_enclave.c
secure_enclave/secure_enclave.c
+1
-1
No files found.
BLSCrypto.cpp
View file @
dec8f187
...
@@ -198,6 +198,9 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
...
@@ -198,6 +198,9 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
strncpy
(
xStrArg
,
xStr
->
c_str
(),
BUF_LEN
);
strncpy
(
xStrArg
,
xStr
->
c_str
(),
BUF_LEN
);
strncpy
(
yStrArg
,
yStr
->
c_str
(),
BUF_LEN
);
strncpy
(
yStrArg
,
yStr
->
c_str
(),
BUF_LEN
);
delete
xStr
;
delete
yStr
;
size_t
sz
=
0
;
size_t
sz
=
0
;
uint8_t
encryptedKey
[
BUF_LEN
];
uint8_t
encryptedKey
[
BUF_LEN
];
...
@@ -206,8 +209,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
...
@@ -206,8 +209,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
if
(
!
result
)
{
if
(
!
result
)
{
cerr
<<
"Invalid hex encrypted key"
<<
endl
;
cerr
<<
"Invalid hex encrypted key"
<<
endl
;
delete
xStr
;
delete
yStr
;
BOOST_THROW_EXCEPTION
(
std
::
invalid_argument
(
"Invalid hex encrypted key"
));
BOOST_THROW_EXCEPTION
(
std
::
invalid_argument
(
"Invalid hex encrypted key"
));
}
}
...
@@ -219,15 +220,11 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
...
@@ -219,15 +220,11 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
if
(
status
!=
SGX_SUCCESS
)
{
if
(
status
!=
SGX_SUCCESS
)
{
cerr
<<
"SGX enclave call to trustedBlsSignMessage failed with status:"
<<
status
<<
std
::
endl
;
cerr
<<
"SGX enclave call to trustedBlsSignMessage failed with status:"
<<
status
<<
std
::
endl
;
delete
xStr
;
delete
yStr
;
BOOST_THROW_EXCEPTION
(
runtime_error
(
"SGX enclave call to trustedBlsSignMessage failed"
));
BOOST_THROW_EXCEPTION
(
runtime_error
(
"SGX enclave call to trustedBlsSignMessage failed"
));
}
}
if
(
errStatus
!=
0
)
{
if
(
errStatus
!=
0
)
{
cerr
<<
"SGX enclave call to trustedBlsSignMessage failed with errStatus:"
<<
errStatus
<<
std
::
endl
;
cerr
<<
"SGX enclave call to trustedBlsSignMessage failed with errStatus:"
<<
errStatus
<<
std
::
endl
;
delete
xStr
;
delete
yStr
;
BOOST_THROW_EXCEPTION
(
runtime_error
(
"SGX enclave call to trustedBlsSignMessage failed"
));
BOOST_THROW_EXCEPTION
(
runtime_error
(
"SGX enclave call to trustedBlsSignMessage failed"
));
}
}
...
@@ -240,9 +237,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
...
@@ -240,9 +237,6 @@ bool sign_aes(const char *_encryptedKeyHex, const char *_hashHex, size_t _t, siz
strncpy
(
_sig
,
sig
.
c_str
(),
BUF_LEN
);
strncpy
(
_sig
,
sig
.
c_str
(),
BUF_LEN
);
delete
xStr
;
delete
yStr
;
return
true
;
return
true
;
}
}
...
...
SGXWalletServer.cpp
View file @
dec8f187
...
@@ -236,13 +236,11 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
...
@@ -236,13 +236,11 @@ SGXWalletServer::blsSignMessageHashImpl(const string &_keyShareName, const strin
exception_ptr
p
=
current_exception
();
exception_ptr
p
=
current_exception
();
printf
(
"Exception %s
\n
"
,
p
.
__cxa_exception_type
()
->
name
());
printf
(
"Exception %s
\n
"
,
p
.
__cxa_exception_type
()
->
name
());
result
[
"status"
]
=
-
1
;
result
[
"status"
]
=
-
1
;
result
[
"errorMessage"
]
=
"Read key share has thrown exception
:
"
;
result
[
"errorMessage"
]
=
"Read key share has thrown exception"
;
return
result
;
return
result
;
}
}
try
{
try
{
static
std
::
mutex
g_mtx
;
std
::
lock_guard
<
std
::
mutex
>
lock
(
g_mtx
);
if
(
!
bls_sign
(
value
->
c_str
(),
_messageHash
.
c_str
(),
t
,
n
,
_signerIndex
,
&
signature
.
front
()))
{
if
(
!
bls_sign
(
value
->
c_str
(),
_messageHash
.
c_str
(),
t
,
n
,
_signerIndex
,
&
signature
.
front
()))
{
result
[
"status"
]
=
-
1
;
result
[
"status"
]
=
-
1
;
result
[
"errorMessage"
]
=
"Could not sign"
;
result
[
"errorMessage"
]
=
"Could not sign"
;
...
...
secure_enclave/EnclaveCommon.cpp
View file @
dec8f187
...
@@ -130,7 +130,7 @@ bool enclave_sign(const char *_keyString, const char *_hashXString, const char *
...
@@ -130,7 +130,7 @@ bool enclave_sign(const char *_keyString, const char *_hashXString, const char *
return
true
;
return
true
;
}
}
void
carray2Hex
(
const
unsigned
char
*
d
,
int
_len
,
char
*
_hexArray
)
{
void
carray2Hex
(
const
unsigned
char
*
d
,
int
_len
,
char
*
_hexArray
)
{
char
hexval
[
16
]
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
char
hexval
[
16
]
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
};
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
};
...
...
secure_enclave/EnclaveCommon.h
View file @
dec8f187
...
@@ -43,8 +43,6 @@ EXTERNC bool hex2carray2(const char * _hex, uint64_t *_bin_len,
...
@@ -43,8 +43,6 @@ EXTERNC bool hex2carray2(const char * _hex, uint64_t *_bin_len,
uint8_t
*
_bin
,
const
int
_max_length
);
uint8_t
*
_bin
,
const
int
_max_length
);
EXTERNC
void
enclave_init
();
EXTERNC
void
enclave_init
();
void
get_global_random
(
unsigned
char
*
_randBuff
,
uint64_t
size
);
void
get_global_random
(
unsigned
char
*
_randBuff
,
uint64_t
size
);
EXTERNC
void
LOG_INFO
(
const
char
*
msg
);
EXTERNC
void
LOG_INFO
(
const
char
*
msg
);
...
...
secure_enclave/secure_enclave.c
View file @
dec8f187
...
@@ -1262,7 +1262,7 @@ void trustedDecryptKeyAES(int *errStatus, char *errString, uint8_t *encryptedPri
...
@@ -1262,7 +1262,7 @@ void trustedDecryptKeyAES(int *errStatus, char *errString, uint8_t *encryptedPri
}
}
*
errStatus
=
0
;
*
errStatus
=
0
;
memcpy
(
errString
,
AES_key
,
1024
);
memcpy
(
errString
,
AES_key
,
BUF_LEN
);
}
}
void
trustedBlsSignMessageAES
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encryptedPrivateKey
,
void
trustedBlsSignMessageAES
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encryptedPrivateKey
,
...
...
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