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
d4e4ee6b
Unverified
Commit
d4e4ee6b
authored
Aug 16, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3039-whitelist
parent
c99f41c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
secure_enclave.c
secure_enclave/secure_enclave.c
+26
-3
No files found.
secure_enclave/secure_enclave.c
View file @
d4e4ee6b
...
@@ -45,6 +45,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
...
@@ -45,6 +45,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sgx_tgmp.h>
#include <sgx_tgmp.h>
#include <sgx_trts.h>
#include <sgx_trts.h>
#include <sgx_key.h>
#include "Point.h"
#include "Point.h"
#include "DomainParameters.h"
#include "DomainParameters.h"
...
@@ -207,7 +209,14 @@ void trustedGenerateSEK(int *errStatus, char *errString,
...
@@ -207,7 +209,14 @@ void trustedGenerateSEK(int *errStatus, char *errString,
AES_key
[
i
]
=
SEK_raw
[
i
];
AES_key
[
i
]
=
SEK_raw
[
i
];
}
}
sgx_status_t
status
=
sgx_seal_data
(
0
,
NULL
,
hex_aes_key_length
+
1
,
(
uint8_t
*
)
SEK_hex
,
sealedLen
,
sgx_attributes_t
attribute_mask
;
attribute_mask
.
flags
=
0xfffffffffffffff3
;
attribute_mask
.
xfrm
=
0x0
;
sgx_misc_select_t
misc
=
0xF0000000
;
sgx_status_t
status
=
sgx_seal_data_ex
(
SGX_KEYPOLICY_MRENCLAVE
,
attribute_mask
,
misc
,
0
,
NULL
,
hex_aes_key_length
+
1
,
(
uint8_t
*
)
SEK_hex
,
sealedLen
,
(
sgx_sealed_data_t
*
)
encrypted_SEK
);
(
sgx_sealed_data_t
*
)
encrypted_SEK
);
CHECK_STATUS
(
"seal SEK failed"
);
CHECK_STATUS
(
"seal SEK failed"
);
...
@@ -256,7 +265,15 @@ void trustedSetSEK_backup(int *errStatus, char *errString,
...
@@ -256,7 +265,15 @@ void trustedSetSEK_backup(int *errStatus, char *errString,
uint32_t
sealedLen
=
sgx_calc_sealed_data_size
(
0
,
strlen
(
SEK_hex
)
+
1
);
uint32_t
sealedLen
=
sgx_calc_sealed_data_size
(
0
,
strlen
(
SEK_hex
)
+
1
);
sgx_status_t
status
=
sgx_seal_data
(
0
,
NULL
,
strlen
(
SEK_hex
)
+
1
,
(
uint8_t
*
)
SEK_hex
,
sealedLen
,
sgx_attributes_t
attribute_mask
;
attribute_mask
.
flags
=
0xfffffffffffffff3
;
attribute_mask
.
xfrm
=
0x0
;
sgx_misc_select_t
misc
=
0xF0000000
;
sgx_status_t
status
=
sgx_seal_data_ex
(
SGX_KEYPOLICY_MRENCLAVE
,
attribute_mask
,
misc
,
0
,
NULL
,
strlen
(
SEK_hex
)
+
1
,
(
uint8_t
*
)
SEK_hex
,
sealedLen
,
(
sgx_sealed_data_t
*
)
encrypted_SEK
);
(
sgx_sealed_data_t
*
)
encrypted_SEK
);
CHECK_STATUS2
(
"seal SEK failed with status %d"
)
CHECK_STATUS2
(
"seal SEK failed with status %d"
)
...
@@ -446,7 +463,13 @@ void trustedEcdsaSignAES(int *errStatus, char *errString, uint8_t *encryptedPriv
...
@@ -446,7 +463,13 @@ void trustedEcdsaSignAES(int *errStatus, char *errString, uint8_t *encryptedPriv
goto
clean
;
goto
clean
;
}
}
signature_sign
(
sign
,
msgMpz
,
privateKeyMpz
,
curve
);
LOG_ERROR
(
"signing"
);
for
(
int
i
=
0
;
i
<
10000
;
i
++
)
{
signature_sign
(
sign
,
msgMpz
,
privateKeyMpz
,
curve
);
}
LOG_ERROR
(
"signed"
);
sigCounter
++
;
sigCounter
++
;
...
...
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