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
d7432fd5
Unverified
Commit
d7432fd5
authored
Jan 24, 2020
by
svetaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-1887 Add flag not to use AES in ECDSA procedures
parent
c11762aa
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
23 additions
and
19 deletions
+23
-19
ECDSACrypto.cpp
ECDSACrypto.cpp
+11
-7
SGXRegistrationServer.cpp
SGXRegistrationServer.cpp
+1
-0
ServerInit.cpp
ServerInit.cpp
+3
-1
secure_enclave.c
secure_enclave/secure_enclave.c
+1
-1
secure_enclave.edl
secure_enclave/secure_enclave.edl
+1
-8
sgxwallet.c
sgxwallet.c
+3
-1
sgxwallet_common.h
sgxwallet_common.h
+1
-0
testw.cpp
testw.cpp
+2
-1
No files found.
ECDSACrypto.cpp
View file @
d7432fd5
...
...
@@ -51,8 +51,10 @@ std::vector<std::string> gen_ecdsa_key(){
char
*
pub_key_y
=
(
char
*
)
calloc
(
1024
,
1
);
uint32_t
enc_len
=
0
;
//status = generate_ecdsa_key(eid, &err_status, errMsg, encr_pr_key, &enc_len, pub_key_x, pub_key_y );
status
=
generate_ecdsa_key_aes
(
eid
,
&
err_status
,
errMsg
,
encr_pr_key
,
&
enc_len
,
pub_key_x
,
pub_key_y
);
if
(
!
is_aes
)
status
=
generate_ecdsa_key
(
eid
,
&
err_status
,
errMsg
,
encr_pr_key
,
&
enc_len
,
pub_key_x
,
pub_key_y
);
else
status
=
generate_ecdsa_key_aes
(
eid
,
&
err_status
,
errMsg
,
encr_pr_key
,
&
enc_len
,
pub_key_x
,
pub_key_y
);
if
(
err_status
!=
0
){
std
::
cerr
<<
"RPCException thrown"
<<
std
::
endl
;
throw
RPCException
(
-
666
,
errMsg
)
;
...
...
@@ -65,7 +67,7 @@ std::vector<std::string> gen_ecdsa_key(){
// for(int i = 0 ; i < 1024; i++)
// std::cerr << (int)encr_pr_key[i] << " " ;
}
char
*
hexEncrKey
=
(
char
*
)
calloc
(
BUF_LEN
,
1
);
char
*
hexEncrKey
=
(
char
*
)
calloc
(
BUF_LEN
*
2
,
1
);
carray2Hex
(
encr_pr_key
,
enc_len
,
hexEncrKey
);
keys
.
at
(
0
)
=
hexEncrKey
;
keys
.
at
(
1
)
=
std
::
string
(
pub_key_x
)
+
std
::
string
(
pub_key_y
);
//concatPubKeyWith0x(pub_key_x, pub_key_y);//
...
...
@@ -119,8 +121,9 @@ std::string get_ecdsa_pubkey(const char* encryptedKeyHex){
throw
RPCException
(
INVALID_HEX
,
"Invalid encryptedKeyHex"
);
}
//status = get_public_ecdsa_key(eid, &err_status, errMsg, encr_pr_key, enc_len, pub_key_x, pub_key_y );
status
=
get_public_ecdsa_key_aes
(
eid
,
&
err_status
,
errMsg
,
encr_pr_key
,
enc_len
,
pub_key_x
,
pub_key_y
);
if
(
!
is_aes
)
status
=
get_public_ecdsa_key
(
eid
,
&
err_status
,
errMsg
,
encr_pr_key
,
enc_len
,
pub_key_x
,
pub_key_y
);
else
status
=
get_public_ecdsa_key_aes
(
eid
,
&
err_status
,
errMsg
,
encr_pr_key
,
enc_len
,
pub_key_x
,
pub_key_y
);
if
(
err_status
!=
0
){
throw
RPCException
(
-
666
,
errMsg
)
;
}
...
...
@@ -164,8 +167,9 @@ std::vector<std::string> ecdsa_sign_hash(const char* encryptedKeyHex, const char
spdlog
::
info
(
"encrypted len: {}"
,
dec_len
);
}
//status = ecdsa_sign1(eid, &err_status, errMsg, encr_key, ECDSA_ENCR_LEN, (unsigned char*)hashHex, signature_r, signature_s, &signature_v, base );
status
=
ecdsa_sign_aes
(
eid
,
&
err_status
,
errMsg
,
encr_key
,
dec_len
,
(
unsigned
char
*
)
hashHex
,
signature_r
,
signature_s
,
&
signature_v
,
base
);
if
(
!
is_aes
)
status
=
ecdsa_sign1
(
eid
,
&
err_status
,
errMsg
,
encr_key
,
ECDSA_ENCR_LEN
,
(
unsigned
char
*
)
hashHex
,
signature_r
,
signature_s
,
&
signature_v
,
base
);
else
status
=
ecdsa_sign_aes
(
eid
,
&
err_status
,
errMsg
,
encr_key
,
dec_len
,
(
unsigned
char
*
)
hashHex
,
signature_r
,
signature_s
,
&
signature_v
,
base
);
if
(
err_status
!=
0
){
throw
RPCException
(
-
666
,
errMsg
)
;
}
...
...
SGXRegistrationServer.cpp
View file @
d7432fd5
...
...
@@ -47,6 +47,7 @@
int
DEBUG_PRINT
=
0
;
int
is_sgx_https
=
1
;
int
is_aes
=
0
;
SGXRegistrationServer
*
regs
=
nullptr
;
HttpServer
*
hs2
=
nullptr
;
...
...
ServerInit.cpp
View file @
d7432fd5
...
...
@@ -153,6 +153,8 @@ void init_all(bool check_cert, bool sign_automatically) {
if
(
sgxServerInited
==
1
)
return
;
init_daemon
();
sgxServerInited
=
1
;
if
(
is_sgx_https
)
{
...
...
@@ -165,5 +167,5 @@ void init_all(bool check_cert, bool sign_automatically) {
}
init_enclave
();
//std::cerr << "enclave inited" << std::endl;
init_daemon
();
}
secure_enclave/secure_enclave.c
View file @
d7432fd5
...
...
@@ -1248,7 +1248,7 @@ void decrypt_key_aes(int *err_status, char *err_string, uint8_t *encrypted_key,
}
void
bls_sign_message_
aes
(
int
*
err_status
,
char
*
err_string
,
uint8_t
*
encrypted_key
,
void
bls_sign_message_
test
(
int
*
err_status
,
char
*
err_string
,
uint8_t
*
encrypted_key
,
uint32_t
enc_len
,
char
*
_hashX
,
char
*
_hashY
,
char
*
signature
)
{
...
...
secure_enclave/secure_enclave.edl
View file @
d7432fd5
...
...
@@ -213,14 +213,7 @@ enclave {
uint32_t enc_len,
[out, count = 1024] char* key );
public void bls_sign_message_aes (
[user_check] int *err_status,
[out, count = 1024] char* err_string,
[in, count = 1024] uint8_t* encrypted_key,
uint32_t enc_len,
[in, count = 1024] char* hashX ,
[in, count = 1024] char* hashY ,
[out, count = 1024] char* signature);
};
...
...
sgxwallet.c
View file @
d7432fd5
...
...
@@ -62,7 +62,7 @@ int main(int argc, char *argv[]) {
exit
(
1
);
}
while
((
opt
=
getopt
(
argc
,
argv
,
"cshd0"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"cshd0
a
"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'h'
:
if
(
strlen
(
argv
[
1
])
==
2
)
{
...
...
@@ -87,6 +87,8 @@ int main(int argc, char *argv[]) {
case
'0'
:
is_sgx_https
=
0
;
break
;
case
'a'
:
is_aes
=
1
;
case
'?'
:
// fprintf(stderr, "unknown flag\n");
exit
(
1
);
default:
...
...
sgxwallet_common.h
View file @
d7432fd5
...
...
@@ -37,6 +37,7 @@
extern
int
DEBUG_PRINT
;
extern
int
is_sgx_https
;
extern
int
is_aes
;
#define BUF_LEN 1024
...
...
testw.cpp
View file @
d7432fd5
...
...
@@ -763,7 +763,7 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") {
reset_db
();
int
n
=
4
,
t
=
4
;
int
n
=
16
,
t
=
16
;
Json
::
Value
EthKeys
[
n
];
Json
::
Value
VerifVects
[
n
];
Json
::
Value
pubEthKeys
;
...
...
@@ -1071,6 +1071,7 @@ TEST_CASE("ManySimultaneousThreads", "[many_threads_test]") {
TEST_CASE
(
"ecdsa API test"
,
"[ecdsa_api_test]"
)
{
DEBUG_PRINT
=
1
;
is_sgx_https
=
0
;
is_aes
=
0
;
cerr
<<
"ecdsa_api_test started"
<<
endl
;
init_all
(
false
,
false
);
...
...
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