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
178b5ed5
Unverified
Commit
178b5ed5
authored
Sep 08, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3205
parent
3ca5236e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
26 deletions
+27
-26
BLSPrivateKeyShareSGX.cpp
BLSPrivateKeyShareSGX.cpp
+2
-3
DKGCrypto.cpp
DKGCrypto.cpp
+25
-23
No files found.
BLSPrivateKeyShareSGX.cpp
View file @
178b5ed5
...
@@ -26,15 +26,14 @@
...
@@ -26,15 +26,14 @@
#include "BLSutils.h"
#include "BLSutils.h"
#include "third_party/spdlog/spdlog.h"
#include "third_party/spdlog/spdlog.h"
#include "common.h"
#include "secure_enclave_u.h"
#include "secure_enclave_u.h"
#include "sgxwallet_common.h"
#include "sgxwallet_common.h"
#include "sgxwallet.h"
#include "sgxwallet.h"
#include "BLSCrypto.h"
#include "BLSCrypto.h"
#include "ServerInit.h"
#include "ServerInit.h"
#include "common.h"
#include "SEKManager.h"
#include "BLSPrivateKeyShareSGX.h"
#include "BLSPrivateKeyShareSGX.h"
string
*
stringFromFq
(
libff
::
alt_bn128_Fq
*
_fq
)
{
string
*
stringFromFq
(
libff
::
alt_bn128_Fq
*
_fq
)
{
...
...
DKGCrypto.cpp
View file @
178b5ed5
...
@@ -27,15 +27,14 @@
...
@@ -27,15 +27,14 @@
#include "third_party/spdlog/spdlog.h"
#include "third_party/spdlog/spdlog.h"
#include "common.h"
#include "sgxwallet.h"
#include "sgxwallet.h"
#include "SGXException.h"
#include "SGXException.h"
#include "common.h"
#include "SGXWalletServer.hpp"
#include "
DKGCrypto.h
"
#include "
SGXWalletServer.hpp
"
#include "BLSCrypto.h"
#include "BLSCrypto.h"
#include "SEKManager.h"
#include "DKGCrypto.h"
vector
<
string
>
splitString
(
const
char
*
coeffs
,
const
char
symbol
)
{
vector
<
string
>
splitString
(
const
char
*
coeffs
,
const
char
symbol
)
{
CHECK_STATE
(
coeffs
);
CHECK_STATE
(
coeffs
);
...
@@ -134,11 +133,12 @@ string gen_dkg_poly(int _t) {
...
@@ -134,11 +133,12 @@ string gen_dkg_poly(int _t) {
vector
<
uint8_t
>
encrypted_dkg_secret
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encrypted_dkg_secret
(
BUF_LEN
,
0
);
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
{
READ_LOCK
(
initMutex
);
RESTART_BEGIN
status
=
trustedGenDkgSecretAES
(
status
=
trustedGenDkgSecretAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
eid
,
&
errStatus
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
}
RESTART_END
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg
.
data
());
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg
.
data
());
...
@@ -173,11 +173,12 @@ vector <vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int
...
@@ -173,11 +173,12 @@ vector <vector<string>> get_verif_vect(const char *encryptedPolyHex, int t, int
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
{
READ_LOCK
(
initMutex
);
RESTART_BEGIN
status
=
trustedGetPublicSharesAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrDKGPoly
.
data
(),
encLen
,
status
=
trustedGetPublicSharesAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrDKGPoly
.
data
(),
encLen
,
pubShares
.
data
(),
t
,
n
);
pubShares
.
data
(),
t
,
n
);
}
RESTART_END
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg
.
data
());
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg
.
data
());
vector
<
string
>
g2Strings
=
splitString
(
pubShares
.
data
(),
','
);
vector
<
string
>
g2Strings
=
splitString
(
pubShares
.
data
(),
','
);
...
@@ -284,11 +285,12 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr
...
@@ -284,11 +285,12 @@ verifyShares(const char *publicShares, const char *encr_sshare, const char *encr
strncpy
(
pshares
,
publicShares
,
strlen
(
publicShares
));
strncpy
(
pshares
,
publicShares
,
strlen
(
publicShares
));
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
{
READ_LOCK
(
initMutex
);
RESTART_BEGIN
status
=
trustedDkgVerifyAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
pshares
,
encr_sshare
,
encr_key
,
decKeyLen
,
t
,
status
=
trustedDkgVerifyAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
pshares
,
encr_sshare
,
encr_key
,
decKeyLen
,
t
,
ind
,
&
result
);
ind
,
&
result
);
}
RESTART_END
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg
.
data
());
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg
.
data
());
if
(
result
==
2
)
{
if
(
result
==
2
)
{
...
@@ -315,11 +317,10 @@ bool createBLSShare(const string &blsKeyName, const char *s_shares, const char *
...
@@ -315,11 +317,10 @@ bool createBLSShare(const string &blsKeyName, const char *s_shares, const char *
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
{
RESTART_BEGIN
READ_LOCK
(
initMutex
);
status
=
trustedCreateBlsKeyAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
s_shares
,
encr_key
,
decKeyLen
,
encr_bls_key
,
status
=
trustedCreateBlsKeyAES
(
eid
,
&
errStatus
,
errMsg
.
data
(),
s_shares
,
encr_key
,
decKeyLen
,
encr_bls_key
,
&
enc_bls_len
);
&
enc_bls_len
);
}
RESTART_END
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg
.
data
());
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg
.
data
());
...
@@ -351,10 +352,11 @@ vector <string> getBLSPubKey(const char *encryptedKeyHex) {
...
@@ -351,10 +352,11 @@ vector <string> getBLSPubKey(const char *encryptedKeyHex) {
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
{
READ_LOCK
(
initMutex
);
RESTART_BEGIN
status
=
trustedGetBlsPubKeyAES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrKey
,
decKeyLen
,
pubKey
);
status
=
trustedGetBlsPubKeyAES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encrKey
,
decKeyLen
,
pubKey
);
}
RESTART_END
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg1
.
data
());
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg1
.
data
());
vector
<
string
>
pubKeyVect
=
splitString
(
pubKey
,
':'
);
vector
<
string
>
pubKeyVect
=
splitString
(
pubKey
,
':'
);
...
@@ -436,10 +438,10 @@ string decryptDHKey(const string &polyName, int ind) {
...
@@ -436,10 +438,10 @@ string decryptDHKey(const string &polyName, int ind) {
SAFE_CHAR_BUF
(
DHKey
,
ECDSA_SKEY_LEN
);
SAFE_CHAR_BUF
(
DHKey
,
ECDSA_SKEY_LEN
);
sgx_status_t
status
=
SGX_SUCCESS
;
sgx_status_t
status
=
SGX_SUCCESS
;
{
READ_LOCK
(
initMutex
);
RESTART_BEGIN
status
=
trustedDecryptKeyAES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDHKey
,
dhEncLen
,
DHKey
);
status
=
trustedDecryptKeyAES
(
eid
,
&
errStatus
,
errMsg1
.
data
(),
encryptedDHKey
,
dhEncLen
,
DHKey
);
}
RESTART_END
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg1
.
data
());
HANDLE_TRUSTED_FUNCTION_ERROR
(
status
,
errStatus
,
errMsg1
.
data
());
return
DHKey
;
return
DHKey
;
...
...
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