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
c27a793d
Unverified
Commit
c27a793d
authored
Apr 17, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2454-add-logs-to-enclave
parent
d5725597
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
18 deletions
+18
-18
BLSCrypto.cpp
BLSCrypto.cpp
+2
-2
DKGCrypto.cpp
DKGCrypto.cpp
+1
-1
secure_enclave.c
secure_enclave/secure_enclave.c
+6
-6
secure_enclave.edl
secure_enclave/secure_enclave.edl
+2
-2
secure_enclave.i
secure_enclave/secure_enclave.i
+7
-7
No files found.
BLSCrypto.cpp
View file @
c27a793d
...
@@ -320,7 +320,7 @@ char *encryptBLSKeyShare2Hex(int *errStatus, char *err_string, const char *_key)
...
@@ -320,7 +320,7 @@ char *encryptBLSKeyShare2Hex(int *errStatus, char *err_string, const char *_key)
unsigned
int
encryptedLen
=
0
;
unsigned
int
encryptedLen
=
0
;
//status =
encrypt_k
ey(eid, errStatus, errMsg, keyArray, encryptedKey, &encryptedLen);
//status =
trustedEncryptK
ey(eid, errStatus, errMsg, keyArray, encryptedKey, &encryptedLen);
status
=
trustedEncryptKeyAES
(
eid
,
errStatus
,
errMsg
->
data
(),
keyArray
->
data
(),
encryptedKey
->
data
(),
&
encryptedLen
);
status
=
trustedEncryptKeyAES
(
eid
,
errStatus
,
errMsg
->
data
(),
keyArray
->
data
(),
encryptedKey
->
data
(),
&
encryptedLen
);
spdlog
::
debug
(
"errStatus is {}"
,
*
errStatus
);
spdlog
::
debug
(
"errStatus is {}"
,
*
errStatus
);
...
@@ -360,7 +360,7 @@ char *decryptBLSKeyShareFromHex(int *errStatus, char *errMsg, const char *_encry
...
@@ -360,7 +360,7 @@ char *decryptBLSKeyShareFromHex(int *errStatus, char *errMsg, const char *_encry
char
*
plaintextKey
=
(
char
*
)
calloc
(
BUF_LEN
,
1
);
char
*
plaintextKey
=
(
char
*
)
calloc
(
BUF_LEN
,
1
);
//status =
decrypt_k
ey(eid, errStatus, errMsg, decoded, decodedLen, plaintextKey);
//status =
trustedDecryptK
ey(eid, errStatus, errMsg, decoded, decodedLen, plaintextKey);
status
=
trustedDecryptKeyAES
(
eid
,
errStatus
,
errMsg
,
decoded
,
decodedLen
,
plaintextKey
);
status
=
trustedDecryptKeyAES
(
eid
,
errStatus
,
errMsg
,
decoded
,
decodedLen
,
plaintextKey
);
if
(
status
!=
SGX_SUCCESS
)
{
if
(
status
!=
SGX_SUCCESS
)
{
...
...
DKGCrypto.cpp
View file @
c27a793d
...
@@ -378,7 +378,7 @@ string decryptDHKey(const string &polyName, int ind) {
...
@@ -378,7 +378,7 @@ string decryptDHKey(const string &polyName, int ind) {
char
DHKey
[
ECDSA_SKEY_LEN
];
char
DHKey
[
ECDSA_SKEY_LEN
];
if
(
!
encryptKeys
)
if
(
!
encryptKeys
)
decrypt_k
ey
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDHKey
,
dhEncLen
,
DHKey
);
trustedDecryptK
ey
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDHKey
,
dhEncLen
,
DHKey
);
else
else
trustedDecryptKeyAES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDHKey
,
dhEncLen
,
DHKey
);
trustedDecryptKeyAES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDHKey
,
dhEncLen
,
DHKey
);
if
(
errStatus
!=
0
)
{
if
(
errStatus
!=
0
)
{
...
...
secure_enclave/secure_enclave.c
View file @
c27a793d
...
@@ -371,7 +371,7 @@ void trustedEcdsaSign(int *errStatus, char *err_string, uint8_t *encrypted_key,
...
@@ -371,7 +371,7 @@ void trustedEcdsaSign(int *errStatus, char *err_string, uint8_t *encrypted_key,
}
}
void
encrypt_k
ey
(
int
*
errStatus
,
char
*
err_string
,
char
*
key
,
void
trustedEncryptK
ey
(
int
*
errStatus
,
char
*
err_string
,
char
*
key
,
uint8_t
*
encrypted_key
,
uint32_t
*
enc_len
)
{
uint8_t
*
encrypted_key
,
uint32_t
*
enc_len
)
{
//init();
//init();
...
@@ -412,10 +412,10 @@ void encrypt_key(int *errStatus, char *err_string, char *key,
...
@@ -412,10 +412,10 @@ void encrypt_key(int *errStatus, char *err_string, char *key,
char
decryptedKey
[
BUF_LEN
];
char
decryptedKey
[
BUF_LEN
];
memset
(
decryptedKey
,
0
,
BUF_LEN
);
memset
(
decryptedKey
,
0
,
BUF_LEN
);
decrypt_k
ey
(
errStatus
,
err_string
,
encrypted_key
,
sealedLen
,
decryptedKey
);
trustedDecryptK
ey
(
errStatus
,
err_string
,
encrypted_key
,
sealedLen
,
decryptedKey
);
if
(
*
errStatus
!=
0
)
{
if
(
*
errStatus
!=
0
)
{
snprintf
(
err_string
+
strlen
(
err_string
),
BUF_LEN
,
":
decrypt_k
ey failed"
);
snprintf
(
err_string
+
strlen
(
err_string
),
BUF_LEN
,
":
trustedDecryptK
ey failed"
);
return
;
return
;
}
}
...
@@ -437,7 +437,7 @@ void encrypt_key(int *errStatus, char *err_string, char *key,
...
@@ -437,7 +437,7 @@ void encrypt_key(int *errStatus, char *err_string, char *key,
*
errStatus
=
0
;
*
errStatus
=
0
;
}
}
void
decrypt_k
ey
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_key
,
void
trustedDecryptK
ey
(
int
*
errStatus
,
char
*
err_string
,
uint8_t
*
encrypted_key
,
uint32_t
enc_len
,
char
*
key
)
{
uint32_t
enc_len
,
char
*
key
)
{
init
();
init
();
...
@@ -502,7 +502,7 @@ void trustedBlsSignMessage(int *errStatus, char *err_string, uint8_t *encrypted_
...
@@ -502,7 +502,7 @@ void trustedBlsSignMessage(int *errStatus, char *err_string, uint8_t *encrypted_
init
();
init
();
decrypt_k
ey
(
errStatus
,
err_string
,
encrypted_key
,
enc_len
,
key
);
trustedDecryptK
ey
(
errStatus
,
err_string
,
encrypted_key
,
enc_len
,
key
);
if
(
*
errStatus
!=
0
)
{
if
(
*
errStatus
!=
0
)
{
strncpy
(
signature
,
err_string
,
BUF_LEN
);
strncpy
(
signature
,
err_string
,
BUF_LEN
);
...
@@ -1252,7 +1252,7 @@ void trustedEncryptKeyAES(int *errStatus, char *err_string, const char *key,
...
@@ -1252,7 +1252,7 @@ void trustedEncryptKeyAES(int *errStatus, char *err_string, const char *key,
if
(
stat
!=
0
)
{
if
(
stat
!=
0
)
{
*
errStatus
=
stat
;
*
errStatus
=
stat
;
snprintf
(
err_string
,
BUF_LEN
,
":
decrypt_k
ey failed with status %d"
,
stat
);
snprintf
(
err_string
,
BUF_LEN
,
":
trustedDecryptK
ey failed with status %d"
,
stat
);
return
;
return
;
}
}
...
...
secure_enclave/secure_enclave.edl
View file @
c27a793d
...
@@ -44,14 +44,14 @@ enclave {
...
@@ -44,14 +44,14 @@ enclave {
[out, count = SMALL_BUF_SIZE] char * pub_key_x,
[out, count = SMALL_BUF_SIZE] char * pub_key_x,
[out, count = SMALL_BUF_SIZE] char * pub_key_y);
[out, count = SMALL_BUF_SIZE] char * pub_key_y);
public void
encrypt_k
ey (
public void
trustedEncryptK
ey (
[user_check] int *errStatus,
[user_check] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = SMALL_BUF_SIZE] char* key,
[in, count = SMALL_BUF_SIZE] char* key,
[out, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
[out, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
[user_check] uint32_t *enc_len);
[user_check] uint32_t *enc_len);
public void decrypt_k
ey (
public void trustedDecryptK
ey (
[user_check] int *errStatus,
[user_check] int *errStatus,
[out, count = SMALL_BUF_SIZE] char* err_string,
[out, count = SMALL_BUF_SIZE] char* err_string,
[in, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
[in, count = SMALL_BUF_SIZE] uint8_t* encrypted_key,
...
...
secure_enclave/secure_enclave.i
View file @
c27a793d
...
@@ -5469,8 +5469,8 @@ void trustedEMpzMul(mpz_t* c, mpz_t* a, mpz_t* b);
...
@@ -5469,8 +5469,8 @@ void trustedEMpzMul(mpz_t* c, mpz_t* a, mpz_t* b);
void trustedEMpzDiv(mpz_t* c, mpz_t* a, mpz_t* b);
void trustedEMpzDiv(mpz_t* c, mpz_t* a, mpz_t* b);
void trustedEMpfDiv(mpf_t* c, mpf_t* a, mpf_t* b);
void trustedEMpfDiv(mpf_t* c, mpf_t* a, mpf_t* b);
void trustedGenerateEcdsaKey(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t* enc_len, char* pub_key_x, char* pub_key_y);
void trustedGenerateEcdsaKey(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t* enc_len, char* pub_key_x, char* pub_key_y);
void
encrypt_k
ey(int* err_status, char* err_string, char* key, uint8_t* encrypted_key, uint32_t* enc_len);
void
trustedEncryptK
ey(int* err_status, char* err_string, char* key, uint8_t* encrypted_key, uint32_t* enc_len);
void
decrypt_k
ey(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t enc_len, char* key);
void
trustedDecryptK
ey(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t enc_len, char* key);
void trustedBlsSignMessage(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t enc_len, char* hashX, char* hashY, char* signature);
void trustedBlsSignMessage(int* err_status, char* err_string, uint8_t* encrypted_key, uint32_t enc_len, char* hashX, char* hashY, char* signature);
void trustedGenDkgSecret(int* err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint32_t* enc_len, size_t _t);
void trustedGenDkgSecret(int* err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint32_t* enc_len, size_t _t);
void trustedDecryptDkgSecret(int* err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint8_t* decrypted_dkg_secret, uint32_t enc_len);
void trustedDecryptDkgSecret(int* err_status, char* err_string, uint8_t* encrypted_dkg_secret, uint8_t* decrypted_dkg_secret, uint32_t enc_len);
...
@@ -6741,7 +6741,7 @@ void trustedGenerateEcdsaKey(int *err_status, char *err_string,
...
@@ -6741,7 +6741,7 @@ void trustedGenerateEcdsaKey(int *err_status, char *err_string,
}
}
void
encrypt_k
ey(int *err_status, char *err_string, char *key,
void
trustedEncryptK
ey(int *err_status, char *err_string, char *key,
uint8_t *encrypted_key, uint32_t *enc_len) {
uint8_t *encrypted_key, uint32_t *enc_len) {
init();
init();
...
@@ -6782,10 +6782,10 @@ void encrypt_key(int *err_status, char *err_string, char *key,
...
@@ -6782,10 +6782,10 @@ void encrypt_key(int *err_status, char *err_string, char *key,
char decryptedKey[1024];
char decryptedKey[1024];
memset(decryptedKey, 0, 1024);
memset(decryptedKey, 0, 1024);
decrypt_k
ey(err_status, err_string, encrypted_key, sealedLen, decryptedKey);
trustedDecryptK
ey(err_status, err_string, encrypted_key, sealedLen, decryptedKey);
if (*err_status != 0) {
if (*err_status != 0) {
snprintf(err_string + strlen(err_string), 1024, ":
decrypt_k
ey failed");
snprintf(err_string + strlen(err_string), 1024, ":
trustedDecryptK
ey failed");
return;
return;
}
}
...
@@ -6807,7 +6807,7 @@ void encrypt_key(int *err_status, char *err_string, char *key,
...
@@ -6807,7 +6807,7 @@ void encrypt_key(int *err_status, char *err_string, char *key,
*err_status = 0;
*err_status = 0;
}
}
void
decrypt_k
ey(int *err_status, char *err_string, uint8_t *encrypted_key,
void
trustedDecryptK
ey(int *err_status, char *err_string, uint8_t *encrypted_key,
uint32_t enc_len, char *key) {
uint32_t enc_len, char *key) {
init();
init();
...
@@ -6869,7 +6869,7 @@ void trustedBlsSignMessage(int *err_status, char *err_string, uint8_t *encrypted
...
@@ -6869,7 +6869,7 @@ void trustedBlsSignMessage(int *err_status, char *err_string, uint8_t *encrypted
init();
init();
decrypt_k
ey(err_status, err_string, encrypted_key, enc_len, key);
trustedDecryptK
ey(err_status, err_string, encrypted_key, enc_len, key);
if (*err_status != 0) {
if (*err_status != 0) {
return;
return;
...
...
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