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
64bb9335
Unverified
Commit
64bb9335
authored
Aug 15, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3079-cleanup
parent
6942d96f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
11 deletions
+11
-11
SEKManager.cpp
SEKManager.cpp
+1
-1
EnclaveCommon.cpp
secure_enclave/EnclaveCommon.cpp
+1
-1
Signature.c
secure_enclave/Signature.c
+1
-2
secure_enclave.c
secure_enclave/secure_enclave.c
+7
-5
secure_enclave.edl
secure_enclave/secure_enclave.edl
+1
-2
No files found.
SEKManager.cpp
View file @
64bb9335
...
@@ -180,7 +180,7 @@ void trustedSetSEK(std::shared_ptr<std::string> hex_encr_SEK) {
...
@@ -180,7 +180,7 @@ void trustedSetSEK(std::shared_ptr<std::string> hex_encr_SEK) {
throw
SGXException
(
INVALID_HEX
,
"Invalid encrypted SEK Hex"
);
throw
SGXException
(
INVALID_HEX
,
"Invalid encrypted SEK Hex"
);
}
}
status
=
trustedSetSEK
(
eid
,
&
err_status
,
errMsg
.
data
(),
encr_SEK
,
len
);
status
=
trustedSetSEK
(
eid
,
&
err_status
,
errMsg
.
data
(),
encr_SEK
);
if
(
status
!=
SGX_SUCCESS
)
{
if
(
status
!=
SGX_SUCCESS
)
{
cerr
<<
"RPCException thrown"
<<
endl
;
cerr
<<
"RPCException thrown"
<<
endl
;
throw
SGXException
(
status
,
errMsg
.
data
())
;
throw
SGXException
(
status
,
errMsg
.
data
())
;
...
...
secure_enclave/EnclaveCommon.cpp
View file @
64bb9335
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
@date 2019
@date 2019
*/
*/
#define GMP_WITH_SGX
#define GMP_WITH_SGX
1
#include <string.h>
#include <string.h>
#include <cstdint>
#include <cstdint>
...
...
secure_enclave/Signature.c
View file @
64bb9335
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdbool.h>
#include <assert.h>
#include <assert.h>
#include <string.h>
#define SAFE_FREE(__X__) if (__X__) {free(__X__); __X__ = NULL;}
#define SAFE_FREE(__X__) if (__X__) {free(__X__); __X__ = NULL;}
#define SAFE_DELETE(__X__) if (__X__) {delete(__X__); __X__ = NULL;}
#define SAFE_DELETE(__X__) if (__X__) {delete(__X__); __X__ = NULL;}
...
@@ -179,8 +180,6 @@ void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_para
...
@@ -179,8 +180,6 @@ void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_para
mpz_set
(
sig
->
r
,
r
);
mpz_set
(
sig
->
r
,
r
);
mpz_set
(
sig
->
s
,
s
);
mpz_set
(
sig
->
s
,
s
);
clean:
point_clear
(
Q
);
point_clear
(
Q
);
...
...
secure_enclave/secure_enclave.c
View file @
64bb9335
...
@@ -181,8 +181,7 @@ void get_global_random(unsigned char *_randBuff, uint64_t _size) {
...
@@ -181,8 +181,7 @@ void get_global_random(unsigned char *_randBuff, uint64_t _size) {
CHECK_STATE
(
sgx_sha256_init
(
&
shaStateHandle
)
==
SGX_SUCCESS
);
CHECK_STATE
(
sgx_sha256_init
(
&
shaStateHandle
)
==
SGX_SUCCESS
);
CHECK_STATE
(
sgx_sha256_update
(
globalRandom
,
32
,
shaStateHandle
)
==
SGX_SUCCESS
);
CHECK_STATE
(
sgx_sha256_update
(
globalRandom
,
32
,
shaStateHandle
)
==
SGX_SUCCESS
);
CHECK_STATE
(
sgx_sha256_get_hash
(
shaStateHandle
,
globalRandom
)
==
SGX_SUCCESS
);
CHECK_STATE
(
sgx_sha256_get_hash
(
shaStateHandle
,
(
sgx_sha256_hash_t
*
)
globalRandom
)
==
SGX_SUCCESS
);
CHECK_STATE
(
sgx_sha256_get_hash
(
shaStateHandle
,
globalRandom
)
==
SGX_SUCCESS
);
CHECK_STATE
(
sgx_sha256_close
(
shaStateHandle
)
==
SGX_SUCCESS
);
CHECK_STATE
(
sgx_sha256_close
(
shaStateHandle
)
==
SGX_SUCCESS
);
memcpy
(
_randBuff
,
globalRandom
,
_size
);
memcpy
(
_randBuff
,
globalRandom
,
_size
);
...
@@ -201,7 +200,7 @@ void trustedGenerateSEK(int *errStatus, char *errString,
...
@@ -201,7 +200,7 @@ void trustedGenerateSEK(int *errStatus, char *errString,
SAFE_CHAR_BUF
(
SEK_raw
,
SGX_AESGCM_KEY_SIZE
);;
SAFE_CHAR_BUF
(
SEK_raw
,
SGX_AESGCM_KEY_SIZE
);;
uint32_t
hex_aes_key_length
=
SGX_AESGCM_KEY_SIZE
*
2
;
uint32_t
hex_aes_key_length
=
SGX_AESGCM_KEY_SIZE
*
2
;
carray2Hex
(
SEK_raw
,
SGX_AESGCM_KEY_SIZE
,
SEK_hex
);
carray2Hex
(
(
uint8_t
*
)
SEK_raw
,
SGX_AESGCM_KEY_SIZE
,
SEK_hex
);
uint32_t
sealedLen
=
sgx_calc_sealed_data_size
(
0
,
hex_aes_key_length
+
1
);
uint32_t
sealedLen
=
sgx_calc_sealed_data_size
(
0
,
hex_aes_key_length
+
1
);
...
@@ -220,14 +219,17 @@ void trustedGenerateSEK(int *errStatus, char *errString,
...
@@ -220,14 +219,17 @@ void trustedGenerateSEK(int *errStatus, char *errString,
;
;
}
}
void
trustedSetSEK
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_SEK
,
uint64_t
encr_len
)
{
void
trustedSetSEK
(
int
*
errStatus
,
char
*
errString
,
uint8_t
*
encrypted_SEK
)
{
LOG_INFO
(
__FUNCTION__
);
LOG_INFO
(
__FUNCTION__
);
INIT_ERROR_STATE
INIT_ERROR_STATE
CHECK_STATE
(
encrypted_SEK
);
CHECK_STATE
(
encrypted_SEK
);
SAFE_CHAR_BUF
(
aes_key_hex
,
BUF_LEN
);
SAFE_CHAR_BUF
(
aes_key_hex
,
BUF_LEN
);
uint32_t
dec_len
;
sgx_status_t
status
=
sgx_unseal_data
(
sgx_status_t
status
=
sgx_unseal_data
(
(
const
sgx_sealed_data_t
*
)
encrypted_SEK
,
NULL
,
0
,
aes_key_hex
,
&
encr_len
);
(
const
sgx_sealed_data_t
*
)
encrypted_SEK
,
NULL
,
0
,
(
uint8_t
*
)
aes_key_hex
,
&
dec_len
);
CHECK_STATUS2
(
"sgx unseal SEK failed with status %d"
);
CHECK_STATUS2
(
"sgx unseal SEK failed with status %d"
);
...
...
secure_enclave/secure_enclave.edl
View file @
64bb9335
...
@@ -23,8 +23,7 @@ enclave {
...
@@ -23,8 +23,7 @@ enclave {
public void trustedSetSEK(
public void trustedSetSEK(
[out] int *errStatus,
[out] 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_SEK,
[in, count = SMALL_BUF_SIZE] uint8_t *encrypted_SEK);
uint64_t encr_len);
public void trustedSetSEK_backup(
public void trustedSetSEK_backup(
[out] int *errStatus,
[out] int *errStatus,
...
...
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