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
8b9dcb3b
Unverified
Commit
8b9dcb3b
authored
Sep 08, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-3205
parent
eaa8c60a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
61 deletions
+42
-61
AESUtils.c
secure_enclave/AESUtils.c
+5
-22
AESUtils.h
secure_enclave/AESUtils.h
+4
-6
secure_enclave.c
secure_enclave/secure_enclave.c
+33
-33
No files found.
secure_enclave/AESUtils.c
View file @
8b9dcb3b
...
@@ -37,7 +37,7 @@ sgx_aes_gcm_128bit_key_t AES_DH_key;
...
@@ -37,7 +37,7 @@ sgx_aes_gcm_128bit_key_t AES_DH_key;
#define SAFE_CHAR_BUF(__X__, __Y__) ;char __X__ [ __Y__ ]; memset(__X__, 0, __Y__);
#define SAFE_CHAR_BUF(__X__, __Y__) ;char __X__ [ __Y__ ]; memset(__X__, 0, __Y__);
int
AES_encrypt
(
char
*
message
,
uint8_t
*
encr_message
,
uint64_t
encrBufLen
,
unsigned
char
type
,
int
AES_encrypt
(
char
*
message
,
uint8_t
*
encr_message
,
uint64_t
encrBufLen
,
unsigned
char
type
,
unsigned
char
decryp
table
,
uint64_t
*
resultLen
)
{
unsigned
char
expor
table
,
uint64_t
*
resultLen
)
{
...
@@ -66,7 +66,7 @@ int AES_encrypt(char *message, uint8_t *encr_message, uint64_t encrBufLen, unsig
...
@@ -66,7 +66,7 @@ int AES_encrypt(char *message, uint8_t *encr_message, uint64_t encrBufLen, unsig
SAFE_CHAR_BUF
(
fullMessage
,
len
+
2
);
SAFE_CHAR_BUF
(
fullMessage
,
len
+
2
);
fullMessage
[
0
]
=
type
;
fullMessage
[
0
]
=
type
;
fullMessage
[
1
]
=
decryp
table
;
fullMessage
[
1
]
=
expor
table
;
strncpy
(
fullMessage
+
2
,
message
,
len
);
strncpy
(
fullMessage
+
2
,
message
,
len
);
...
@@ -87,7 +87,7 @@ int AES_encrypt(char *message, uint8_t *encr_message, uint64_t encrBufLen, unsig
...
@@ -87,7 +87,7 @@ int AES_encrypt(char *message, uint8_t *encr_message, uint64_t encrBufLen, unsig
}
}
int
AES_decrypt
(
uint8_t
*
encr_message
,
uint64_t
length
,
char
*
message
,
uint64_t
msgLen
,
int
AES_decrypt
(
uint8_t
*
encr_message
,
uint64_t
length
,
char
*
message
,
uint64_t
msgLen
,
uint8_t
*
type
,
uint8_t
*
decryp
table
){
uint8_t
*
type
,
uint8_t
*
expor
table
){
if
(
!
message
)
{
if
(
!
message
)
{
LOG_ERROR
(
"Null message in AES_encrypt"
);
LOG_ERROR
(
"Null message in AES_encrypt"
);
...
@@ -105,7 +105,7 @@ int AES_decrypt(uint8_t *encr_message, uint64_t length, char *message, uint64_t
...
@@ -105,7 +105,7 @@ int AES_decrypt(uint8_t *encr_message, uint64_t length, char *message, uint64_t
}
}
if
(
!
encr_message
)
{
if
(
!
encr_message
)
{
LOG_ERROR
(
"Null
decryp
table in AES_encrypt"
);
LOG_ERROR
(
"Null
expor
table in AES_encrypt"
);
return
-
4
;
return
-
4
;
}
}
...
@@ -132,27 +132,10 @@ int AES_decrypt(uint8_t *encr_message, uint64_t length, char *message, uint64_t
...
@@ -132,27 +132,10 @@ int AES_decrypt(uint8_t *encr_message, uint64_t length, char *message, uint64_t
(
sgx_aes_gcm_128bit_tag_t
*
)
encr_message
);
(
sgx_aes_gcm_128bit_tag_t
*
)
encr_message
);
*
type
=
message
[
0
];
*
type
=
message
[
0
];
*
decryp
table
=
message
[
1
];
*
expor
table
=
message
[
1
];
for
(
int
i
=
2
;
i
<
strlen
(
message
)
+
1
;
i
++
)
{
for
(
int
i
=
2
;
i
<
strlen
(
message
)
+
1
;
i
++
)
{
message
[
i
-
2
]
=
message
[
i
];
message
[
i
-
2
]
=
message
[
i
];
}
}
return
status
;
return
status
;
}
}
void
derive_DH_Key
()
{
memcpy
(
AES_DH_key
,
AES_key
,
SGX_AESGCM_KEY_SIZE
);
/*AES_DH_key[1] = 1;AES_DH_key[2] = 2;*/
}
secure_enclave/AESUtils.h
View file @
8b9dcb3b
...
@@ -25,22 +25,20 @@
...
@@ -25,22 +25,20 @@
#define SGXD_AESUTILS_H
#define SGXD_AESUTILS_H
extern
sgx_aes_gcm_128bit_key_t
AES_key
;
extern
sgx_aes_gcm_128bit_key_t
AES_key
;
extern
sgx_aes_gcm_128bit_key_t
AES_DH_key
;
int
AES_encrypt
(
char
*
message
,
uint8_t
*
encr_message
,
uint64_t
encrLen
,
int
AES_encrypt
(
char
*
message
,
uint8_t
*
encr_message
,
uint64_t
encrLen
,
unsigned
char
type
,
unsigned
char
decryp
table
,
uint64_t
*
resultLen
);
unsigned
char
type
,
unsigned
char
expor
table
,
uint64_t
*
resultLen
);
int
AES_decrypt
(
uint8_t
*
encr_message
,
uint64_t
length
,
char
*
message
,
uint64_t
msgLen
,
int
AES_decrypt
(
uint8_t
*
encr_message
,
uint64_t
length
,
char
*
message
,
uint64_t
msgLen
,
uint8_t
*
type
,
uint8_t
*
decryp
table
)
;
uint8_t
*
type
,
uint8_t
*
expor
table
)
;
void
derive_DH_Key
();
#define ECDSA '1'
#define ECDSA '1'
#define BLS '2'
#define BLS '2'
#define DKG '3'
#define DKG '3'
#define
DECRYP
TABLE '1'
#define
EXPOR
TABLE '1'
#define NON_
DECRYP
TABLE '2'
#define NON_
EXPOR
TABLE '2'
...
...
secure_enclave/secure_enclave.c
View file @
8b9dcb3b
...
@@ -421,13 +421,13 @@ void trustedGenerateEcdsaKeyAES(int *errStatus, char *errString,
...
@@ -421,13 +421,13 @@ void trustedGenerateEcdsaKeyAES(int *errStatus, char *errString,
snprintf
(
errString
,
BUF_LEN
,
"skey len is %d
\n
"
,
(
int
)
strlen
(
skey_str
));
snprintf
(
errString
,
BUF_LEN
,
"skey len is %d
\n
"
,
(
int
)
strlen
(
skey_str
));
int
status
=
AES_encrypt
((
char
*
)
skey_str
,
encryptedPrivateKey
,
BUF_LEN
,
int
status
=
AES_encrypt
((
char
*
)
skey_str
,
encryptedPrivateKey
,
BUF_LEN
,
ECDSA
,
NON_
DECRYP
TABLE
,
enc_len
);
ECDSA
,
NON_
EXPOR
TABLE
,
enc_len
);
CHECK_STATUS
(
"ecdsa private key encryption failed"
);
CHECK_STATUS
(
"ecdsa private key encryption failed"
);
uint8_t
type
=
0
;
uint8_t
type
=
0
;
uint8_t
decryp
table
=
0
;
uint8_t
expor
table
=
0
;
status
=
AES_decrypt
(
encryptedPrivateKey
,
*
enc_len
,
skey_str
,
BUF_LEN
,
&
type
,
&
decryp
table
);
status
=
AES_decrypt
(
encryptedPrivateKey
,
*
enc_len
,
skey_str
,
BUF_LEN
,
&
type
,
&
expor
table
);
CHECK_STATUS2
(
"ecdsa private key decr failed with status %d"
);
CHECK_STATUS2
(
"ecdsa private key decr failed with status %d"
);
...
@@ -458,10 +458,10 @@ void trustedGetPublicEcdsaKeyAES(int *errStatus, char *errString,
...
@@ -458,10 +458,10 @@ void trustedGetPublicEcdsaKeyAES(int *errStatus, char *errString,
CHECK_STATE
(
pub_key_y
);
CHECK_STATE
(
pub_key_y
);
uint8_t
type
=
0
;
uint8_t
type
=
0
;
uint8_t
decryp
table
=
0
;
uint8_t
expor
table
=
0
;
int
status
=
AES_decrypt
(
encryptedPrivateKey
,
enc_len
,
skey
,
BUF_LEN
,
int
status
=
AES_decrypt
(
encryptedPrivateKey
,
enc_len
,
skey
,
BUF_LEN
,
&
type
,
&
decryp
table
);
&
type
,
&
expor
table
);
CHECK_STATUS2
(
"AES_decrypt failed with status %d"
);
CHECK_STATUS2
(
"AES_decrypt failed with status %d"
);
skey
[
enc_len
-
SGX_AESGCM_MAC_SIZE
-
SGX_AESGCM_IV_SIZE
]
=
'\0'
;
skey
[
enc_len
-
SGX_AESGCM_MAC_SIZE
-
SGX_AESGCM_IV_SIZE
]
=
'\0'
;
...
@@ -541,11 +541,11 @@ void trustedEcdsaSignAES(int *errStatus, char *errString, uint8_t *encryptedPriv
...
@@ -541,11 +541,11 @@ void trustedEcdsaSignAES(int *errStatus, char *errString, uint8_t *encryptedPriv
signature
sign
=
signature_init
();
signature
sign
=
signature_init
();
uint8_t
type
=
0
;
uint8_t
type
=
0
;
uint8_t
decryp
table
=
0
;
uint8_t
expor
table
=
0
;
int
status
=
AES_decrypt
(
encryptedPrivateKey
,
enc_len
,
skey
,
BUF_LEN
,
int
status
=
AES_decrypt
(
encryptedPrivateKey
,
enc_len
,
skey
,
BUF_LEN
,
&
type
,
&
decryp
table
);
&
type
,
&
expor
table
);
CHECK_STATUS2
(
"aes decrypt failed with status %d"
);
CHECK_STATUS2
(
"aes decrypt failed with status %d"
);
...
@@ -622,12 +622,12 @@ void trustedDecryptKeyAES(int *errStatus, char *errString, uint8_t *encryptedPri
...
@@ -622,12 +622,12 @@ void trustedDecryptKeyAES(int *errStatus, char *errString, uint8_t *encryptedPri
*
errStatus
=
-
9
;
*
errStatus
=
-
9
;
uint8_t
type
=
0
;
uint8_t
type
=
0
;
uint8_t
decryp
table
=
0
;
uint8_t
expor
table
=
0
;
int
status
=
AES_decrypt
(
encryptedPrivateKey
,
enc_len
,
key
,
3072
,
int
status
=
AES_decrypt
(
encryptedPrivateKey
,
enc_len
,
key
,
3072
,
&
type
,
&
decryp
table
);
&
type
,
&
expor
table
);
if
(
decryptable
!=
DECRYP
TABLE
)
{
if
(
exportable
!=
EXPOR
TABLE
)
{
*
errStatus
=
-
11
;
*
errStatus
=
-
11
;
snprintf
(
errString
,
BUF_LEN
,
"Key is not exportable"
);
snprintf
(
errString
,
BUF_LEN
,
"Key is not exportable"
);
}
}
...
@@ -668,17 +668,17 @@ void trustedEncryptKeyAES(int *errStatus, char *errString, const char *key,
...
@@ -668,17 +668,17 @@ void trustedEncryptKeyAES(int *errStatus, char *errString, const char *key,
*
errStatus
=
UNKNOWN_ERROR
;
*
errStatus
=
UNKNOWN_ERROR
;
int
status
=
AES_encrypt
((
char
*
)
key
,
encryptedPrivateKey
,
BUF_LEN
,
int
status
=
AES_encrypt
((
char
*
)
key
,
encryptedPrivateKey
,
BUF_LEN
,
DKG
,
DECRYP
TABLE
,
enc_len
);
DKG
,
EXPOR
TABLE
,
enc_len
);
CHECK_STATUS2
(
"AES encrypt failed with status %d"
);
CHECK_STATUS2
(
"AES encrypt failed with status %d"
);
SAFE_CHAR_BUF
(
decryptedKey
,
BUF_LEN
);
SAFE_CHAR_BUF
(
decryptedKey
,
BUF_LEN
);
uint8_t
type
=
0
;
uint8_t
type
=
0
;
uint8_t
decryp
table
=
0
;
uint8_t
expor
table
=
0
;
status
=
AES_decrypt
(
encryptedPrivateKey
,
*
enc_len
,
decryptedKey
,
BUF_LEN
,
status
=
AES_decrypt
(
encryptedPrivateKey
,
*
enc_len
,
decryptedKey
,
BUF_LEN
,
&
type
,
&
decryp
table
);
&
type
,
&
expor
table
);
CHECK_STATUS2
(
"trustedDecryptKey failed with status %d"
);
CHECK_STATUS2
(
"trustedDecryptKey failed with status %d"
);
...
@@ -722,9 +722,9 @@ void trustedBlsSignMessageAES(int *errStatus, char *errString, uint8_t *encrypte
...
@@ -722,9 +722,9 @@ void trustedBlsSignMessageAES(int *errStatus, char *errString, uint8_t *encrypte
SAFE_CHAR_BUF
(
key
,
BUF_LEN
);
SAFE_CHAR_BUF
(
sig
,
BUF_LEN
);
SAFE_CHAR_BUF
(
key
,
BUF_LEN
);
SAFE_CHAR_BUF
(
sig
,
BUF_LEN
);
uint8_t
type
=
0
;
uint8_t
type
=
0
;
uint8_t
decryp
table
=
0
;
uint8_t
expor
table
=
0
;
int
status
=
AES_decrypt
(
encryptedPrivateKey
,
enc_len
,
key
,
BUF_LEN
,
&
type
,
&
decryp
table
);
int
status
=
AES_decrypt
(
encryptedPrivateKey
,
enc_len
,
key
,
BUF_LEN
,
&
type
,
&
expor
table
);
CHECK_STATUS
(
"AES decrypt failed"
)
CHECK_STATUS
(
"AES decrypt failed"
)
...
@@ -767,7 +767,7 @@ trustedGenDkgSecretAES(int *errStatus, char *errString, uint8_t *encrypted_dkg_s
...
@@ -767,7 +767,7 @@ trustedGenDkgSecretAES(int *errStatus, char *errString, uint8_t *encrypted_dkg_s
CHECK_STATUS
(
"gen_dkg_poly failed"
)
CHECK_STATUS
(
"gen_dkg_poly failed"
)
status
=
AES_encrypt
(
dkg_secret
,
encrypted_dkg_secret
,
3
*
BUF_LEN
,
status
=
AES_encrypt
(
dkg_secret
,
encrypted_dkg_secret
,
3
*
BUF_LEN
,
DKG
,
DECRYP
TABLE
,
enc_len
);
DKG
,
EXPOR
TABLE
,
enc_len
);
CHECK_STATUS
(
"SGX AES encrypt DKG poly failed"
);
CHECK_STATUS
(
"SGX AES encrypt DKG poly failed"
);
...
@@ -776,10 +776,10 @@ trustedGenDkgSecretAES(int *errStatus, char *errString, uint8_t *encrypted_dkg_s
...
@@ -776,10 +776,10 @@ trustedGenDkgSecretAES(int *errStatus, char *errString, uint8_t *encrypted_dkg_s
SAFE_CHAR_BUF
(
decr_dkg_secret
,
DKG_BUFER_LENGTH
);
SAFE_CHAR_BUF
(
decr_dkg_secret
,
DKG_BUFER_LENGTH
);
uint8_t
type
=
0
;
uint8_t
type
=
0
;
uint8_t
decryp
table
=
0
;
uint8_t
expor
table
=
0
;
status
=
AES_decrypt
(
encrypted_dkg_secret
,
*
enc_len
,
decr_dkg_secret
,
status
=
AES_decrypt
(
encrypted_dkg_secret
,
*
enc_len
,
decr_dkg_secret
,
DKG_BUFER_LENGTH
,
&
type
,
&
decryp
table
);
DKG_BUFER_LENGTH
,
&
type
,
&
expor
table
);
CHECK_STATUS
(
"aes decrypt dkg poly failed"
);
CHECK_STATUS
(
"aes decrypt dkg poly failed"
);
...
@@ -809,10 +809,10 @@ trustedDecryptDkgSecretAES(int *errStatus, char *errString, uint8_t *encrypted_d
...
@@ -809,10 +809,10 @@ trustedDecryptDkgSecretAES(int *errStatus, char *errString, uint8_t *encrypted_d
CHECK_STATE
(
decrypted_dkg_secret
);
CHECK_STATE
(
decrypted_dkg_secret
);
uint8_t
type
;
uint8_t
type
;
uint8_t
decryp
table
;
uint8_t
expor
table
;
int
status
=
AES_decrypt
(
encrypted_dkg_secret
,
enc_len
,
(
char
*
)
decrypted_dkg_secret
,
int
status
=
AES_decrypt
(
encrypted_dkg_secret
,
enc_len
,
(
char
*
)
decrypted_dkg_secret
,
3072
,
&
type
,
&
decryp
table
);
3072
,
&
type
,
&
expor
table
);
CHECK_STATUS2
(
"aes decrypt data - encrypted_dkg_secret failed with status %d"
)
CHECK_STATUS2
(
"aes decrypt data - encrypted_dkg_secret failed with status %d"
)
...
@@ -834,10 +834,10 @@ void trustedSetEncryptedDkgPolyAES(int *errStatus, char *errString, uint8_t *enc
...
@@ -834,10 +834,10 @@ void trustedSetEncryptedDkgPolyAES(int *errStatus, char *errString, uint8_t *enc
memset
(
getThreadLocalDecryptedDkgPoly
(),
0
,
DKG_BUFER_LENGTH
);
memset
(
getThreadLocalDecryptedDkgPoly
(),
0
,
DKG_BUFER_LENGTH
);
uint8_t
type
=
0
;
uint8_t
type
=
0
;
uint8_t
decryp
table
=
0
;
uint8_t
expor
table
=
0
;
int
status
=
AES_decrypt
(
encrypted_poly
,
enc_len
,
(
char
*
)
getThreadLocalDecryptedDkgPoly
(),
int
status
=
AES_decrypt
(
encrypted_poly
,
enc_len
,
(
char
*
)
getThreadLocalDecryptedDkgPoly
(),
DKG_BUFER_LENGTH
,
&
type
,
&
decryp
table
);
DKG_BUFER_LENGTH
,
&
type
,
&
expor
table
);
CHECK_STATUS2
(
"sgx_unseal_data - encrypted_poly failed with status %d"
)
CHECK_STATUS2
(
"sgx_unseal_data - encrypted_poly failed with status %d"
)
...
@@ -874,9 +874,9 @@ void trustedGetEncryptedSecretShareAES(int *errStatus, char *errString, uint8_t
...
@@ -874,9 +874,9 @@ void trustedGetEncryptedSecretShareAES(int *errStatus, char *errString, uint8_t
CHECK_STATUS
(
"trustedGenerateEcdsaKeyAES failed"
);
CHECK_STATUS
(
"trustedGenerateEcdsaKeyAES failed"
);
uint8_t
type
=
0
;
uint8_t
type
=
0
;
uint8_t
decryp
table
=
0
;
uint8_t
expor
table
=
0
;
status
=
AES_decrypt
(
encrypted_skey
,
enc_len
,
skey
,
BUF_LEN
,
&
type
,
&
decryp
table
);
status
=
AES_decrypt
(
encrypted_skey
,
enc_len
,
skey
,
BUF_LEN
,
&
type
,
&
expor
table
);
skey
[
ECDSA_SKEY_LEN
-
1
]
=
0
;
skey
[
ECDSA_SKEY_LEN
-
1
]
=
0
;
...
@@ -930,10 +930,10 @@ void trustedGetPublicSharesAES(int *errStatus, char *errString, uint8_t *encrypt
...
@@ -930,10 +930,10 @@ void trustedGetPublicSharesAES(int *errStatus, char *errString, uint8_t *encrypt
SAFE_CHAR_BUF
(
decrypted_dkg_secret
,
DKG_MAX_SEALED_LEN
);
SAFE_CHAR_BUF
(
decrypted_dkg_secret
,
DKG_MAX_SEALED_LEN
);
uint8_t
type
=
0
;
uint8_t
type
=
0
;
uint8_t
decryp
table
=
0
;
uint8_t
expor
table
=
0
;
int
status
=
AES_decrypt
(
encrypted_dkg_secret
,
enc_len
,
decrypted_dkg_secret
,
int
status
=
AES_decrypt
(
encrypted_dkg_secret
,
enc_len
,
decrypted_dkg_secret
,
DKG_MAX_SEALED_LEN
,
&
type
,
&
decryp
table
);
DKG_MAX_SEALED_LEN
,
&
type
,
&
expor
table
);
CHECK_STATUS2
(
"aes decrypt data - encrypted_dkg_secret failed with status %d"
);
CHECK_STATUS2
(
"aes decrypt data - encrypted_dkg_secret failed with status %d"
);
...
@@ -963,10 +963,10 @@ void trustedDkgVerifyAES(int *errStatus, char *errString, const char *public_sha
...
@@ -963,10 +963,10 @@ void trustedDkgVerifyAES(int *errStatus, char *errString, const char *public_sha
mpz_init
(
s
);
mpz_init
(
s
);
uint8_t
type
=
0
;
uint8_t
type
=
0
;
uint8_t
decryp
table
=
0
;
uint8_t
expor
table
=
0
;
int
status
=
AES_decrypt
(
encryptedPrivateKey
,
enc_len
,
skey
,
BUF_LEN
,
int
status
=
AES_decrypt
(
encryptedPrivateKey
,
enc_len
,
skey
,
BUF_LEN
,
&
type
,
&
decryp
table
);
&
type
,
&
expor
table
);
CHECK_STATUS2
(
"AES_decrypt failed (in trustedDkgVerifyAES) with status %d"
);
CHECK_STATUS2
(
"AES_decrypt failed (in trustedDkgVerifyAES) with status %d"
);
...
@@ -1026,11 +1026,11 @@ void trustedCreateBlsKeyAES(int *errStatus, char *errString, const char *s_share
...
@@ -1026,11 +1026,11 @@ void trustedCreateBlsKeyAES(int *errStatus, char *errString, const char *s_share
mpz_init
(
bls_key
);
mpz_init
(
bls_key
);
uint8_t
type
=
0
;
uint8_t
type
=
0
;
uint8_t
decryp
table
=
0
;
uint8_t
expor
table
=
0
;
int
status
=
AES_decrypt
(
encryptedPrivateKey
,
key_len
,
skey
,
BUF_LEN
,
int
status
=
AES_decrypt
(
encryptedPrivateKey
,
key_len
,
skey
,
BUF_LEN
,
&
type
,
&
decryp
table
);
&
type
,
&
expor
table
);
CHECK_STATUS2
(
"aes decrypt failed with status %d"
);
CHECK_STATUS2
(
"aes decrypt failed with status %d"
);
skey
[
ECDSA_SKEY_LEN
-
1
]
=
0
;
skey
[
ECDSA_SKEY_LEN
-
1
]
=
0
;
...
@@ -1090,7 +1090,7 @@ void trustedCreateBlsKeyAES(int *errStatus, char *errString, const char *s_share
...
@@ -1090,7 +1090,7 @@ void trustedCreateBlsKeyAES(int *errStatus, char *errString, const char *s_share
strncpy
(
key_share
+
n_zeroes
,
arr_skey_str
,
65
-
n_zeroes
);
strncpy
(
key_share
+
n_zeroes
,
arr_skey_str
,
65
-
n_zeroes
);
key_share
[
BLS_KEY_LENGTH
-
1
]
=
0
;
key_share
[
BLS_KEY_LENGTH
-
1
]
=
0
;
status
=
AES_encrypt
(
key_share
,
encr_bls_key
,
BUF_LEN
,
BLS
,
DECRYP
TABLE
,
enc_bls_key_len
);
status
=
AES_encrypt
(
key_share
,
encr_bls_key
,
BUF_LEN
,
BLS
,
NON_EXPOR
TABLE
,
enc_bls_key_len
);
CHECK_STATUS2
(
"aes encrypt bls private key failed with status %d "
);
CHECK_STATUS2
(
"aes encrypt bls private key failed with status %d "
);
...
@@ -1117,12 +1117,12 @@ trustedGetBlsPubKeyAES(int *errStatus, char *errString, uint8_t *encryptedPrivat
...
@@ -1117,12 +1117,12 @@ trustedGetBlsPubKeyAES(int *errStatus, char *errString, uint8_t *encryptedPrivat
SAFE_CHAR_BUF
(
skey_hex
,
BUF_LEN
);
SAFE_CHAR_BUF
(
skey_hex
,
BUF_LEN
);
uint8_t
type
=
0
;
uint8_t
type
=
0
;
uint8_t
decryp
table
=
0
;
uint8_t
expor
table
=
0
;
int
status
=
AES_decrypt
(
encryptedPrivateKey
,
key_len
,
skey_hex
,
BUF_LEN
,
int
status
=
AES_decrypt
(
encryptedPrivateKey
,
key_len
,
skey_hex
,
BUF_LEN
,
&
type
,
&
decryp
table
);
&
type
,
&
expor
table
);
CHECK_STATUS2
(
"AES decrypt failed %d"
);
CHECK_STATUS2
(
"AES decrypt failed %d"
);
...
...
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