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
615056d8
Unverified
Commit
615056d8
authored
Jul 20, 2020
by
Oleh Nikolaiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-2830 small improvements
parent
7fa76e24
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
12 additions
and
2423 deletions
+12
-2423
DKGCrypto.cpp
DKGCrypto.cpp
+1
-4
DockerfileBase
DockerfileBase
+1
-1
ECDSACrypto.cpp
ECDSACrypto.cpp
+3
-3
ServerInit.cpp
ServerInit.cpp
+0
-1
VERSION
VERSION
+1
-1
EnclaveConstants.h
secure_enclave/EnclaveConstants.h
+1
-1
Signature.c
secure_enclave/Signature.c
+1
-9
sgx_tgmp.h
sgx_tgmp.h
+0
-2395
testw.cpp
testw.cpp
+4
-8
No files found.
DKGCrypto.cpp
View file @
615056d8
...
@@ -35,8 +35,6 @@
...
@@ -35,8 +35,6 @@
#include "third_party/spdlog/spdlog.h"
#include "third_party/spdlog/spdlog.h"
#include "common.h"
#include "common.h"
#define DKG_MAX_SEALED_LEN 3100
vector
<
string
>
splitString
(
const
char
*
coeffs
,
const
char
symbol
)
{
vector
<
string
>
splitString
(
const
char
*
coeffs
,
const
char
symbol
)
{
string
str
(
coeffs
);
string
str
(
coeffs
);
string
delim
;
string
delim
;
...
@@ -95,8 +93,7 @@ string gen_dkg_poly(int _t) {
...
@@ -95,8 +93,7 @@ string gen_dkg_poly(int _t) {
throw
SGXException
(
-
666
,
errMsg
.
data
());
throw
SGXException
(
-
666
,
errMsg
.
data
());
}
}
uint64_t
length
=
DKG_MAX_SEALED_LEN
;
uint64_t
length
=
enc_len
;;
length
=
enc_len
;
vector
<
char
>
hexEncrPoly
(
2
*
length
+
1
,
0
);
vector
<
char
>
hexEncrPoly
(
2
*
length
+
1
,
0
);
CHECK_STATE
(
encrypted_dkg_secret
.
size
()
>=
length
);
CHECK_STATE
(
encrypted_dkg_secret
.
size
()
>=
length
);
...
...
DockerfileBase
View file @
615056d8
...
@@ -37,5 +37,5 @@ RUN apt update && \
...
@@ -37,5 +37,5 @@ RUN apt update && \
cd .. && rm -rf dynamic-application-loader-host-interface-072d233296c15d0dcd1fb4570694d0244729f87b && \
cd .. && rm -rf dynamic-application-loader-host-interface-072d233296c15d0dcd1fb4570694d0244729f87b && \
cd /usr/src/sdk && \
cd /usr/src/sdk && \
./autoconf.bash && \
./autoconf.bash && \
./configure && \
./configure && \
bash -c "make -j$(nproc)"
bash -c "make -j$(nproc)"
ECDSACrypto.cpp
View file @
615056d8
...
@@ -89,7 +89,7 @@ string getECDSAPubKey(const char *_encryptedKeyHex) {
...
@@ -89,7 +89,7 @@ string getECDSAPubKey(const char *_encryptedKeyHex) {
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
vector
<
char
>
errMsg
(
BUF_LEN
,
0
);
vector
<
char
>
pubKeyX
(
BUF_LEN
,
0
);
vector
<
char
>
pubKeyX
(
BUF_LEN
,
0
);
vector
<
char
>
pubKeyY
(
BUF_LEN
,
0
);
vector
<
char
>
pubKeyY
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encrPrKey
(
BUF_LEN
,
0
);
vector
<
uint8_t
>
encrPrKey
(
BUF_LEN
,
0
);
int
errStatus
=
0
;
int
errStatus
=
0
;
uint64_t
enc_len
=
0
;
uint64_t
enc_len
=
0
;
...
@@ -102,6 +102,7 @@ string getECDSAPubKey(const char *_encryptedKeyHex) {
...
@@ -102,6 +102,7 @@ string getECDSAPubKey(const char *_encryptedKeyHex) {
errMsg
.
data
(),
encrPrKey
.
data
(),
enc_len
,
pubKeyX
.
data
(),
pubKeyY
.
data
());
errMsg
.
data
(),
encrPrKey
.
data
(),
enc_len
,
pubKeyX
.
data
(),
pubKeyY
.
data
());
if
(
errStatus
!=
0
)
{
if
(
errStatus
!=
0
)
{
spdlog
::
error
(
"failed to get ECDSA public key {}"
,
status
);
throw
SGXException
(
-
666
,
errMsg
.
data
());
throw
SGXException
(
-
666
,
errMsg
.
data
());
}
}
...
@@ -109,8 +110,7 @@ string getECDSAPubKey(const char *_encryptedKeyHex) {
...
@@ -109,8 +110,7 @@ string getECDSAPubKey(const char *_encryptedKeyHex) {
spdlog
::
error
(
"failed to get ECDSA public key {}"
,
status
);
spdlog
::
error
(
"failed to get ECDSA public key {}"
,
status
);
throw
SGXException
(
666
,
"failed to get ECDSA public key"
);
throw
SGXException
(
666
,
"failed to get ECDSA public key"
);
}
}
string
pubKey
=
string
(
pubKeyX
.
data
())
+
string
(
pubKeyY
.
data
());
//concatPubKeyWith0x(pub_key_x, pub_key_y);//
string
pubKey
=
string
(
pubKeyX
.
data
())
+
string
(
pubKeyY
.
data
());
if
(
pubKey
.
size
()
!=
128
)
{
if
(
pubKey
.
size
()
!=
128
)
{
spdlog
::
error
(
"Incorrect pub key size"
,
status
);
spdlog
::
error
(
"Incorrect pub key size"
,
status
);
...
...
ServerInit.cpp
View file @
615056d8
...
@@ -59,7 +59,6 @@
...
@@ -59,7 +59,6 @@
void
initUserSpace
()
{
void
initUserSpace
()
{
libff
::
inhibit_profiling_counters
=
true
;
libff
::
inhibit_profiling_counters
=
true
;
libff
::
inhibit_profiling_info
=
true
;
libff
::
init_alt_bn128_params
();
libff
::
init_alt_bn128_params
();
...
...
VERSION
View file @
615056d8
1.5
3
.0
1.5
4
.0
secure_enclave/EnclaveConstants.h
View file @
615056d8
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
#define ADD_ENTROPY_SIZE 32
#define ADD_ENTROPY_SIZE 32
#define DKG_BUFER_LENGTH 249
0
//3060
#define DKG_BUFER_LENGTH 249
6
//3060
#define DKG_MAX_SEALED_LEN 3100
#define DKG_MAX_SEALED_LEN 3100
#define SECRET_SHARE_NUM_BYTES 96
#define SECRET_SHARE_NUM_BYTES 96
...
...
secure_enclave/Signature.c
View file @
615056d8
...
@@ -93,8 +93,7 @@ void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_para
...
@@ -93,8 +93,7 @@ void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_para
//message must not have a bit length longer than that of n
//message must not have a bit length longer than that of n
//see: Guide to Elliptic Curve Cryptography, section 4.4.1.
//see: Guide to Elliptic Curve Cryptography, section 4.4.1.
for
(
int
i
=
0
;
i
<
1
;
i
++
)
{
{
assert
(
mpz_sizeinbase
(
message
,
2
)
<=
mpz_sizeinbase
(
curve
->
n
,
2
));
assert
(
mpz_sizeinbase
(
message
,
2
)
<=
mpz_sizeinbase
(
curve
->
n
,
2
));
point
Q
=
point_init
();
point
Q
=
point_init
();
...
@@ -119,8 +118,6 @@ void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_para
...
@@ -119,8 +118,6 @@ void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_para
get_global_random
(
rand_char
,
32
);
get_global_random
(
rand_char
,
32
);
gmp_randstate_t
r_state
;
signature_sign_start:
signature_sign_start:
...
@@ -130,10 +127,6 @@ void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_para
...
@@ -130,10 +127,6 @@ void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_para
mpz_mod
(
k
,
seed
,
curve
->
p
);
mpz_mod
(
k
,
seed
,
curve
->
p
);
//mpz_set_str(k, "49a0d7b786ec9cde0d0721d72804befd06571c974b191efb42ecf322ba9ddd9a", 16);
// mpz_set_str(k, "DC87789C4C1A09C97FF4DE72C0D0351F261F10A2B9009C80AEE70DDEC77201A0", 16);
//mpz_set_str(k,"29932781130098090011281004827843485745127563886526054275935615017309884975795",10);
//Calculate x
//Calculate x
point_multiplication
(
Q
,
k
,
curve
->
G
,
curve
);
point_multiplication
(
Q
,
k
,
curve
->
G
,
curve
);
mpz_set
(
x
,
Q
->
x
);
mpz_set
(
x
,
Q
->
x
);
...
@@ -195,7 +188,6 @@ void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_para
...
@@ -195,7 +188,6 @@ void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_para
mpz_clear
(
seed
);
mpz_clear
(
seed
);
mpz_clear
(
n_div_2
);
mpz_clear
(
n_div_2
);
mpz_clear
(
s_mul_2
);
mpz_clear
(
s_mul_2
);
}
}
}
}
...
...
sgx_tgmp.h
deleted
100644 → 0
View file @
7fa76e24
This diff is collapsed.
Click to expand it.
testw.cpp
View file @
615056d8
...
@@ -111,13 +111,10 @@ TEST_CASE_METHOD(TestFixture, "ECDSA keygen and signature test", "[ecdsa-key-sig
...
@@ -111,13 +111,10 @@ TEST_CASE_METHOD(TestFixture, "ECDSA keygen and signature test", "[ecdsa-key-sig
vector
<
char
>
signatureS
(
BUF_LEN
,
0
);
vector
<
char
>
signatureS
(
BUF_LEN
,
0
);
uint8_t
signatureV
=
0
;
uint8_t
signatureV
=
0
;
status
=
trustedEcdsaSign
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrivKey
.
data
(),
encLen
,
(
unsigned
char
*
)
hex
.
data
(),
signatureR
.
data
(),
status
=
trustedEcdsaSign
(
eid
,
&
errStatus
,
errMsg
.
data
(),
encrPrivKey
.
data
(),
encLen
,
signatureS
.
data
(),
&
signatureV
,
16
);
(
unsigned
char
*
)
hex
.
data
(),
signatureR
.
data
(),
signatureS
.
data
(),
&
signatureV
,
16
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
...
@@ -138,7 +135,6 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES keygen and signature test", "[ecdsa-aes
...
@@ -138,7 +135,6 @@ TEST_CASE_METHOD(TestFixture, "ECDSA AES keygen and signature test", "[ecdsa-aes
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
status
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
REQUIRE
(
errStatus
==
SGX_SUCCESS
);
string
hex
=
SAMPLE_HEX_HASH
;
string
hex
=
SAMPLE_HEX_HASH
;
vector
<
char
>
signatureR
(
BUF_LEN
,
0
);
vector
<
char
>
signatureR
(
BUF_LEN
,
0
);
vector
<
char
>
signatureS
(
BUF_LEN
,
0
);
vector
<
char
>
signatureS
(
BUF_LEN
,
0
);
...
...
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