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
edc8247f
Unverified
Commit
edc8247f
authored
Dec 09, 2019
by
svetaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-1775 Fix undefined reference in sgx_tgmp.h
parent
8aabe34e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
54 deletions
+51
-54
DKGCrypto.cpp
DKGCrypto.cpp
+4
-2
SGXWalletServer.cpp
SGXWalletServer.cpp
+37
-35
secure_enclave.c
secure_enclave/secure_enclave.c
+0
-2
sgx_tgmp.h
sgx_tgmp.h
+6
-1
sgxwallet_common.h
sgxwallet_common.h
+2
-1
testw.cpp
testw.cpp
+2
-13
No files found.
DKGCrypto.cpp
View file @
edc8247f
...
...
@@ -339,8 +339,10 @@ bool TestCreateBLSShare( const char * s_shares) {
create_bls_key
(
eid
,
&
err_status
,
errMsg1
,
s_shares
,
encr_key
,
dec_key_len
,
encr_bls_key
,
&
enc_bls_len
);
if
(
err_status
!=
0
){
std
::
cerr
<<
"something went wrong in enclave"
<<
std
::
endl
;
std
::
cerr
<<
"err msg is "
<<
errMsg1
<<
std
::
endl
;
if
(
err_status
!=
0
){
std
::
cerr
<<
"something went wrong in enclave "
<<
"status is"
<<
err_status
<<
std
::
endl
;
}
}
...
...
SGXWalletServer.cpp
View file @
edc8247f
...
...
@@ -73,41 +73,29 @@ void debug_print(){
levelDb
->
visitKeys
(
&
v
,
100000000
);
}
//int init_server() {
// std::string certPath = "cert/SGXServerCertificate.crt";
// std::string keyPath = "cert/SGXServerCertificate.key";
//
// if (access(certPath.c_str(), F_OK) != 0){ //(!boost::filesystem::exists(certPath) ){
// std::cerr << "NO!!! " << std::endl;
// std::cerr << "CERTIFICATE IS GOING TO BE CREATED" << std::endl;
//
// std::string genCert = "cd cert && ./self-signed-tls -c=US -s=California -l=San-Francisco -o=\"Skale Labs\" -u=\"Department of Software Engineering\" -n=\"SGXServerCertificate\" -e=info@skalelabs.com";
//
// if (system(genCert.c_str()) == 0){
// std::cerr << "CERTIFICATE IS SUCCESSFULLY GENERATED" << std::endl;
// }
// else{
// std::cerr << "CERTIFICATE GENERATION FAILED" << std::endl;
// exit(-1);
// }
// }
//
// hs = new HttpServer(1026, certPath, keyPath, 1);
// s = new SGXWalletServer(*hs,
// JSONRPC_SERVER_V2); // hybrid server (json-rpc 1.0 & 2.0)
//
// if (!s->StartListening()) {
// cerr << "Server could not start listening" << endl;
// exit(-1);
// }
// return 0;
//}
int
init_server
()
{
std
::
string
certPath
=
"cert/SGXServerCertificate.crt"
;
std
::
string
keyPath
=
"cert/SGXServerCertificate.key"
;
int
init_server
()
{
//without ssl
if
(
access
(
certPath
.
c_str
(),
F_OK
)
!=
0
){
//(!boost::filesystem::exists(certPath) ){
std
::
cerr
<<
"NO!!! "
<<
std
::
endl
;
std
::
cerr
<<
"CERTIFICATE IS GOING TO BE CREATED"
<<
std
::
endl
;
hs
=
new
HttpServer
(
1027
,
""
,
""
,
1
);
std
::
string
genCert
=
"cd cert && ./self-signed-tls -c=US -s=California -l=San-Francisco -o=
\"
Skale Labs
\"
-u=
\"
Department of Software Engineering
\"
-n=
\"
SGXServerCertificate
\"
-e=info@skalelabs.com"
;
if
(
system
(
genCert
.
c_str
())
==
0
){
std
::
cerr
<<
"CERTIFICATE IS SUCCESSFULLY GENERATED"
<<
std
::
endl
;
}
else
{
std
::
cerr
<<
"CERTIFICATE GENERATION FAILED"
<<
std
::
endl
;
exit
(
-
1
);
}
}
hs
=
new
HttpServer
(
1026
,
certPath
,
keyPath
,
10
);
s
=
new
SGXWalletServer
(
*
hs
,
JSONRPC_SERVER_V2
);
// hybrid server (json-rpc 1.0 & 2.0)
JSONRPC_SERVER_V2
);
// hybrid server (json-rpc 1.0 & 2.0)
if
(
!
s
->
StartListening
())
{
cerr
<<
"Server could not start listening"
<<
endl
;
exit
(
-
1
);
...
...
@@ -115,6 +103,18 @@ int init_server() { //without ssl
return
0
;
}
//int init_server() { //without ssl
//
// hs = new HttpServer(1027, "", "", 1);
// s = new SGXWalletServer(*hs,
// JSONRPC_SERVER_V2); // hybrid server (json-rpc 1.0 & 2.0)
// if (!s->StartListening()) {
// cerr << "Server could not start listening" << endl;
// exit(-1);
// }
// return 0;
//}
Json
::
Value
importBLSKeyShareImpl
(
const
std
::
string
&
_keyShare
,
const
std
::
string
&
_keyShareName
,
int
t
,
int
n
,
int
index
)
{
Json
::
Value
result
;
...
...
@@ -532,8 +532,10 @@ Json::Value CreateBLSPrivateKeyImpl(const std::string & BLSKeyName, const std::s
if
(
SecretShare
.
length
()
!=
n
*
192
){
std
::
cerr
<<
"wrong length of secret shares - "
<<
SecretShare
.
length
()
<<
std
::
endl
;
result
[
"errorMessage"
]
=
"wrong length of secret shares"
;
return
result
;
std
::
cerr
<<
"secret shares - "
<<
SecretShare
<<
std
::
endl
;
//result["errorMessage"] = "wrong length of secret shares";
//return result;
throw
RPCException
(
INVALID_SECRET_SHARES_LENGTH
,
"Invalid secret share length"
);
}
if
(
!
checkECDSAKeyName
(
EthKeyName
)){
throw
RPCException
(
INVALID_ECDSA_KEY_NAME
,
"Invalid ECDSA key name"
);
...
...
@@ -598,7 +600,7 @@ Json::Value GetBLSPublicKeyShareImpl(const std::string & BLSKeyName){
result
[
"errorMessage"
]
=
_e
.
errString
;
}
//
debug_print();
debug_print
();
return
result
;
}
...
...
secure_enclave/secure_enclave.c
View file @
edc8247f
...
...
@@ -828,8 +828,6 @@ void create_bls_key(int *err_status, char* err_string, const char* s_shares,
}
*
enc_bls_key_len
=
sealedLen
;
//snprintf(err_string, BUF_LEN,"encr_share is %s", encr_sshare);
//snprintf(err_string, BUF_LEN,"common_key is %s", common_key);
// mpz_t s;
// mpz_init(s);
...
...
sgx_tgmp.h
View file @
edc8247f
...
...
@@ -1047,7 +1047,12 @@ __GMP_DECLSPEC void mpz_set_q (mpz_ptr, mpq_srcptr);
__GMP_DECLSPEC
void
mpz_set_si
(
mpz_ptr
,
signed
long
int
);
#define mpz_set_str __gmpz_set_str
__GMP_DECLSPEC
int
mpz_set_str
(
mpz_ptr
,
const
char
*
,
int
);
#if defined (__cplusplus)
extern
"C"
{
__GMP_DECLSPEC
int
mpz_set_str
(
mpz_ptr
,
const
char
*
,
int
);
}
#endif
#define mpz_set_ui __gmpz_set_ui
#if defined (__cplusplus)
...
...
sgxwallet_common.h
View file @
edc8247f
...
...
@@ -50,13 +50,14 @@
#define INVALID_POLY_NAME -11
#define INVALID_DKG_PARAMS -12
#define INVALID_SECRET_SHARES_LENGTH -13
#define INVALID_ECDSA_KEY_NAME -20
#define INVALID_HEX -21
#define SGX_ENCLAVE_ERROR -666;
#define WALLETDB_NAME "
test_sgxwallet1.db"//"sgxwallet.db"////////
//
#define WALLETDB_NAME "
sgxwallet.db"//"test_sgxwallet1.db"
//
#define ENCLAVE_NAME "secure_enclave.signed.so"
...
...
testw.cpp
View file @
edc8247f
...
...
@@ -780,8 +780,8 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") {
pubShares
[
i
]
+=
ConvertDecToHex
(
pubShare
);
}
}
std
::
cerr
<<
"i is "
<<
i
<<
" pubShares[i] = "
<<
pubShares
[
i
]
<<
std
::
endl
;
std
::
cerr
<<
"length is"
<<
pubShares
[
i
].
length
()
<<
std
::
endl
;
//
std::cerr << "i is " << i << " pubShares[i] = " << pubShares[i] << std::endl;
//
std::cerr << "length is" << pubShares[i].length() << std::endl;
}
Json
::
Value
ComplaintResponse
=
c
.
ComplaintResponse
(
poly_names
[
1
],
0
);
...
...
@@ -855,17 +855,6 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") {
}
TEST_CASE
(
"create_bls_key_share"
,
"[create_bls_key]"
)
{
init_enclave
();
std
::
string
SecrShare
=
"937c9c846a6fa7fd1984fe82e739ae37fcaa555c1dc0e8597c9f81b6a12f232ffdf8101e91bd658fa1cea6fdd75adb8542951ce3d251cdaa78f43493dad730b59d32d2e872b36aa70cdce544b550ebe96994de860b6f6ebb7d0b4d4e6724b4bf7232f27fdfe521f3c7997dbb1c15452b7f196bd119d915ce76af3d1a008e1810086ff076abe442563ae9b8938d483ae581f4de2ee54298b3078289bbd85250c8df956450d32f671e4a8ec1e584119753ff171e80a61465246bfd291e8dac3d"
;
bool
res
=
TestCreateBLSShare
(
SecrShare
.
c_str
());
REQUIRE
(
res
);
sgx_destroy_enclave
(
eid
);
}
TEST_CASE
(
"API test"
,
"[api_test]"
)
{
//std::cerr << __GNUC__ << std::endl;
...
...
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