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
82824ef2
Unverified
Commit
82824ef2
authored
Jan 27, 2020
by
Stan Kladko
Committed by
GitHub
Jan 27, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #42 from skalenetwork/bug/change-naming
Bug/change naming
parents
0ec388d2
dcd5da17
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
221 additions
and
53 deletions
+221
-53
DKGCrypto.cpp
DKGCrypto.cpp
+10
-3
SGXWalletServer.cpp
SGXWalletServer.cpp
+16
-6
Makefile.in
secure_enclave/Makefile.in
+85
-37
secure_enclave.c
secure_enclave/secure_enclave.c
+47
-0
secure_enclave.edl
secure_enclave/secure_enclave.edl
+22
-0
spec.json
spec.json
+2
-2
testw.cpp
testw.cpp
+39
-5
No files found.
DKGCrypto.cpp
View file @
82824ef2
...
...
@@ -82,7 +82,10 @@ string gen_dkg_poly( int _t){
uint32_t
enc_len
=
0
;
status
=
gen_dkg_secret
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
if
(
!
is_aes
)
status
=
gen_dkg_secret
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
else
status
=
gen_dkg_secret_aes
(
eid
,
&
err_status
,
errMsg
.
data
(),
encrypted_dkg_secret
.
data
(),
&
enc_len
,
_t
);
if
(
err_status
!=
0
){
throw
RPCException
(
-
666
,
errMsg
.
data
()
)
;
}
...
...
@@ -168,8 +171,12 @@ string get_secret_shares(const string& polyName, const char* encryptedPolyHex, c
throw
RPCException
(
INVALID_HEX
,
"Invalid encryptedPolyHex"
);
}
status
=
set_encrypted_dkg_poly
(
eid
,
&
err_status
,
errMsg1
,
encr_dkg_poly
);
if
(
status
!=
SGX_SUCCESS
||
err_status
!=
0
){
if
(
!
is_aes
)
status
=
set_encrypted_dkg_poly
(
eid
,
&
err_status
,
errMsg1
,
encr_dkg_poly
);
else
status
=
set_encrypted_dkg_poly_aes
(
eid
,
&
err_status
,
errMsg1
,
encr_dkg_poly
,
&
enc_len
);
if
(
status
!=
SGX_SUCCESS
||
err_status
!=
0
){
throw
RPCException
(
-
666
,
errMsg1
);
}
...
...
SGXWalletServer.cpp
View file @
82824ef2
...
...
@@ -466,7 +466,7 @@ Json::Value getVerificationVectorImpl(const string& polyName, int t, int n) {
for
(
int
i
=
0
;
i
<
t
;
i
++
){
vector
<
string
>
cur_coef
=
verifVector
.
at
(
i
);
for
(
int
j
=
0
;
j
<
4
;
j
++
){
result
[
"
Verification
Vector"
][
i
][
j
]
=
cur_coef
.
at
(
j
);
result
[
"
verification
Vector"
][
i
][
j
]
=
cur_coef
.
at
(
j
);
}
}
...
...
@@ -474,7 +474,7 @@ Json::Value getVerificationVectorImpl(const string& polyName, int t, int n) {
cerr
<<
" err str "
<<
_e
.
errString
<<
endl
;
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
result
[
"
Verification
Vector"
]
=
""
;
result
[
"
verification
Vector"
]
=
""
;
}
return
result
;
...
...
@@ -640,7 +640,7 @@ Json::Value getBLSPublicKeyShareImpl(const string & blsKeyName){
}
vector
<
string
>
public_key_vect
=
GetBLSPubKey
(
encryptedKeyHex_ptr
->
c_str
());
for
(
uint8_t
i
=
0
;
i
<
4
;
i
++
)
{
result
[
"
BLS
PublicKeyShare"
][
i
]
=
public_key_vect
.
at
(
i
);
result
[
"
bls
PublicKeyShare"
][
i
]
=
public_key_vect
.
at
(
i
);
}
}
catch
(
RPCException
&
_e
)
{
...
...
@@ -668,7 +668,7 @@ Json::Value complaintResponseImpl(const string& polyName, int ind){
string
DHKey
=
decrypt_DHKey
(
polyName
,
ind
);
result
[
"share*G2"
]
=
*
shareG2_ptr
;
result
[
"
DH
Key"
]
=
DHKey
;
result
[
"
dh
Key"
]
=
DHKey
;
}
catch
(
RPCException
&
_e
)
{
cerr
<<
" err str "
<<
_e
.
errString
<<
endl
;
...
...
@@ -702,11 +702,21 @@ Json::Value multG2Impl(const string& x){
Json
::
Value
isPolyExistsImpl
(
const
string
&
polyName
){
Json
::
Value
result
;
s
hared_ptr
<
string
>
poly_str_ptr
=
LevelDB
::
getLevelDb
()
->
readString
(
polyName
);
try
{
s
td
::
shared_ptr
<
std
::
string
>
poly_str_ptr
=
LevelDB
::
getLevelDb
()
->
readString
(
polyName
);
result
[
"IsExist"
]
=
true
;
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
if
(
poly_str_ptr
==
nullptr
){
result
[
"IsExist"
]
=
false
;
result
[
"status"
]
=
0
;
result
[
"errorMessage"
]
=
""
;
}
}
catch
(
RPCException
&
_e
)
{
std
::
cerr
<<
" err str "
<<
_e
.
errString
<<
std
::
endl
;
result
[
"status"
]
=
_e
.
status
;
result
[
"errorMessage"
]
=
_e
.
errString
;
result
[
"IsExist"
]
=
false
;
}
return
result
;
...
...
secure_enclave/Makefile.in
View file @
82824ef2
# Makefile.in generated by automake 1.1
5
.1 from Makefile.am.
# Makefile.in generated by automake 1.1
6
.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-201
7
Free Software Foundation, Inc.
# Copyright (C) 1994-201
8
Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
...
...
@@ -137,7 +137,16 @@ am__v_at_0 = @
am__v_at_1
=
DEFAULT_INCLUDES
=
-I
.@am__isrc@
depcomp
=
$(SHELL)
$(top_srcdir)
/depcomp
am__depfiles_maybe
=
depfiles
am__maybe_remake_depfiles
=
depfiles
am__depfiles_remade
=
./
$(DEPDIR)
/AESUtils.Po
\
./
$(DEPDIR)
/BLSEnclave.Po ./
$(DEPDIR)
/DH_dkg.Po
\
./
$(DEPDIR)
/DKGUtils.Po ./
$(DEPDIR)
/alt_bn128_g1.Po
\
./
$(DEPDIR)
/alt_bn128_g2.Po ./
$(DEPDIR)
/alt_bn128_init.Po
\
./
$(DEPDIR)
/curves.Po ./
$(DEPDIR)
/domain_parameters.Po
\
./
$(DEPDIR)
/numbertheory.Po ./
$(DEPDIR)
/point.Po
\
./
$(DEPDIR)
/secure_enclave.Po ./
$(DEPDIR)
/secure_enclave_t.Po
\
./
$(DEPDIR)
/signature.Po ./
$(DEPDIR)
/signed_enclave_debug.Po
\
./
$(DEPDIR)
/signed_enclave_rel.Po
am__mv
=
mv
-f
COMPILE
=
$(CC)
$(DEFS)
$(DEFAULT_INCLUDES)
$(INCLUDES)
$(AM_CPPFLAGS)
\
$(CPPFLAGS)
$(AM_CFLAGS)
$(CFLAGS)
...
...
@@ -366,8 +375,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*
config.status
*
)
\
cd
$(top_builddir)
&&
$(MAKE)
$(AM_MAKEFLAGS)
am--refresh
;;
\
*
)
\
echo
' cd
$(top_builddir)
&&
$(SHELL)
./config.status
$(subdir)
/$@
$(am__
depfiles_maybe
)
'
;
\
cd
$(top_builddir)
&&
$(SHELL)
./config.status
$(subdir)
/
$@
$(am__
depfiles_maybe
)
;;
\
echo
' cd
$(top_builddir)
&&
$(SHELL)
./config.status
$(subdir)
/$@
$(am__
maybe_remake_depfiles
)
'
;
\
cd
$(top_builddir)
&&
$(SHELL)
./config.status
$(subdir)
/
$@
$(am__
maybe_remake_depfiles
)
;;
\
esac
;
$(top_srcdir)/build-aux/sgx_enclave.am $(am__empty)
:
...
...
@@ -432,22 +441,28 @@ mostlyclean-compile:
distclean-compile
:
-
rm
-f
*
.tab.c
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/AESUtils.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/BLSEnclave.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/DH_dkg.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/DKGUtils.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/alt_bn128_g1.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/alt_bn128_g2.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/alt_bn128_init.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/curves.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/domain_parameters.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/numbertheory.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/point.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/secure_enclave.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/secure_enclave_t.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/signature.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/signed_enclave_debug.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/signed_enclave_rel.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/AESUtils.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/BLSEnclave.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/DH_dkg.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/DKGUtils.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/alt_bn128_g1.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/alt_bn128_g2.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/alt_bn128_init.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/curves.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/domain_parameters.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/numbertheory.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/point.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/secure_enclave.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/secure_enclave_t.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/signature.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/signed_enclave_debug.Po@am__quote@
# am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/signed_enclave_rel.Po@am__quote@
# am--include-marker
$(am__depfiles_remade)
:
@
$(MKDIR_P)
$
(
@D
)
@
echo
'# dummy'
>
$@
-t
&&
$(am__mv)
$@
-t
$@
am--depfiles
:
$(am__depfiles_remade)
.c.o
:
@am__fastdepCC_TRUE@
$(AM_V_CC)$(COMPILE)
-MT
$@
-MD
-MP
-MF
$(DEPDIR)/$*.Tpo
-c
-o
$@
$<
...
...
@@ -571,7 +586,10 @@ cscopelist-am: $(am__tagged_files)
distclean-tags
:
-
rm
-f
TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir
:
$(DISTFILES)
distdir
:
$(BUILT_SOURCES)
$(MAKE)
$(AM_MAKEFLAGS)
distdir-am
distdir-am
:
$(DISTFILES)
@
srcdirstrip
=
`
echo
"
$(srcdir)
"
|
sed
's/[].[^$$\\*]/\\\\&/g'
`
;
\
topsrcdirstrip
=
`
echo
"
$(top_srcdir)
"
|
sed
's/[].[^$$\\*]/\\\\&/g'
`
;
\
list
=
'
$(DISTFILES)
'
;
\
...
...
@@ -644,7 +662,22 @@ clean: clean-am
clean-am
:
clean-generic clean-libexecPROGRAMS mostlyclean-am
distclean
:
distclean-am
-
rm
-rf
./
$(DEPDIR)
-
rm
-f
./
$(DEPDIR)
/AESUtils.Po
-
rm
-f
./
$(DEPDIR)
/BLSEnclave.Po
-
rm
-f
./
$(DEPDIR)
/DH_dkg.Po
-
rm
-f
./
$(DEPDIR)
/DKGUtils.Po
-
rm
-f
./
$(DEPDIR)
/alt_bn128_g1.Po
-
rm
-f
./
$(DEPDIR)
/alt_bn128_g2.Po
-
rm
-f
./
$(DEPDIR)
/alt_bn128_init.Po
-
rm
-f
./
$(DEPDIR)
/curves.Po
-
rm
-f
./
$(DEPDIR)
/domain_parameters.Po
-
rm
-f
./
$(DEPDIR)
/numbertheory.Po
-
rm
-f
./
$(DEPDIR)
/point.Po
-
rm
-f
./
$(DEPDIR)
/secure_enclave.Po
-
rm
-f
./
$(DEPDIR)
/secure_enclave_t.Po
-
rm
-f
./
$(DEPDIR)
/signature.Po
-
rm
-f
./
$(DEPDIR)
/signed_enclave_debug.Po
-
rm
-f
./
$(DEPDIR)
/signed_enclave_rel.Po
-
rm
-f
Makefile
distclean-am
:
clean-am distclean-compile distclean-generic
\
distclean-tags
...
...
@@ -690,7 +723,22 @@ install-ps-am:
installcheck-am
:
maintainer-clean
:
maintainer-clean-am
-
rm
-rf
./
$(DEPDIR)
-
rm
-f
./
$(DEPDIR)
/AESUtils.Po
-
rm
-f
./
$(DEPDIR)
/BLSEnclave.Po
-
rm
-f
./
$(DEPDIR)
/DH_dkg.Po
-
rm
-f
./
$(DEPDIR)
/DKGUtils.Po
-
rm
-f
./
$(DEPDIR)
/alt_bn128_g1.Po
-
rm
-f
./
$(DEPDIR)
/alt_bn128_g2.Po
-
rm
-f
./
$(DEPDIR)
/alt_bn128_init.Po
-
rm
-f
./
$(DEPDIR)
/curves.Po
-
rm
-f
./
$(DEPDIR)
/domain_parameters.Po
-
rm
-f
./
$(DEPDIR)
/numbertheory.Po
-
rm
-f
./
$(DEPDIR)
/point.Po
-
rm
-f
./
$(DEPDIR)
/secure_enclave.Po
-
rm
-f
./
$(DEPDIR)
/secure_enclave_t.Po
-
rm
-f
./
$(DEPDIR)
/signature.Po
-
rm
-f
./
$(DEPDIR)
/signed_enclave_debug.Po
-
rm
-f
./
$(DEPDIR)
/signed_enclave_rel.Po
-
rm
-f
Makefile
maintainer-clean-am
:
distclean-am maintainer-clean-generic
...
...
@@ -710,19 +758,19 @@ uninstall-am: uninstall-libexecPROGRAMS
.MAKE
:
install-am install-strip
.PHONY
:
CTAGS GTAGS TAGS all all-am
check check-am clean clean-generic
\
clean-
libexecPROGRAMS cscopelist-am ctags ctags-am distclean
\
distclean-compile distclean-generic distclean-tags distdir dvi
\
d
vi-am html html-am info info-am install install
-am
\
install
-data install-data-am install-dvi install-dvi-am
\
install-
exec install-exec-am install-html install-html-am
\
install-
info install-info-am install-libexecPROGRAMS
\
install-
man install-pdf install-pdf-am install-ps
\
install-ps
-am install-strip installcheck installcheck-am
\
install
dirs maintainer-clean maintainer-clean-generic
\
m
ostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am
\
ps ps-am tags tags-am uninstall uninstall-am
\
uninstall-libexecPROGRAMS
.PHONY
:
CTAGS GTAGS TAGS all all-am
am--depfiles check check-am clean
\
clean-
generic clean-libexecPROGRAMS cscopelist-am ctags
\
ctags-am distclean distclean-compile distclean-generic
\
d
istclean-tags distdir dvi dvi-am html html-am info info
-am
\
install
install-am install-data install-data-am install-dvi
\
install-
dvi-am install-exec install-exec-am install-html
\
install-
html-am install-info install-info-am
\
install-
libexecPROGRAMS install-man install-pdf install-pdf-am
\
install-ps
install-ps-am install-strip installcheck
\
install
check-am installdirs maintainer-clean
\
m
aintainer-clean-generic mostlyclean mostlyclean-compile
\
mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall
\
uninstall-
am uninstall-
libexecPROGRAMS
.PRECIOUS
:
Makefile
...
...
secure_enclave/secure_enclave.c
View file @
82824ef2
...
...
@@ -598,6 +598,7 @@ void set_encrypted_dkg_poly(int *err_status, char *err_string, uint8_t* encrypte
(
const
sgx_sealed_data_t
*
)
encrypted_poly
,
NULL
,
0
,
Decrypted_dkg_poly
,
&
decr_len
);
if
(
status
!=
SGX_SUCCESS
)
{
*
err_status
=
-
1
;
snprintf
(
err_string
,
BUF_LEN
,
"sgx_unseal_data - encrypted_poly failed with status %d"
,
status
);
return
;
}
...
...
@@ -1276,8 +1277,54 @@ void bls_sign_message_test(int *err_status, char *err_string, uint8_t *encrypted
*
err_status
=
-
1
;
return
;
}
}
void
gen_dkg_secret_aes
(
int
*
err_status
,
char
*
err_string
,
uint8_t
*
encrypted_dkg_secret
,
uint32_t
*
enc_len
,
size_t
_t
){
char
*
dkg_secret
=
(
char
*
)
calloc
(
DKG_BUFER_LENGTH
,
1
);
if
(
gen_dkg_poly
(
dkg_secret
,
_t
)
!=
0
){
*
err_status
=
-
1
;
return
;
}
snprintf
(
err_string
,
BUF_LEN
,
"poly is %s "
,
dkg_secret
);
int
status
=
AES_encrypt
(
dkg_secret
,
encrypted_dkg_secret
);
if
(
status
!=
SGX_SUCCESS
)
{
snprintf
(
err_string
,
BUF_LEN
,
"SGX AES encrypt DKG poly failed"
);
*
err_status
=
status
;
return
;
}
*
enc_len
=
strlen
(
dkg_secret
)
+
SGX_AESGCM_MAC_SIZE
+
SGX_AESGCM_IV_SIZE
;
free
(
dkg_secret
);
}
void
decrypt_dkg_secret_aes
(
int
*
err_status
,
char
*
err_string
,
uint8_t
*
encrypted_dkg_secret
,
uint8_t
*
decrypted_dkg_secret
,
uint32_t
*
dec_len
){
int
status
=
AES_decrypt
(
encrypted_dkg_secret
,
dec_len
,
decrypted_dkg_secret
);
if
(
status
!=
SGX_SUCCESS
)
{
snprintf
(
err_string
,
BUF_LEN
,
"aes decrypt data - encrypted_dkg_secret failed with status %d"
,
status
);
*
err_status
=
status
;
return
;
}
//*dec_len = decr_len;
}
void
set_encrypted_dkg_poly_aes
(
int
*
err_status
,
char
*
err_string
,
uint8_t
*
encrypted_poly
,
uint64_t
*
enc_len
){
uint32_t
decr_len
;
int
status
=
AES_decrypt
(
encrypted_poly
,
enc_len
,
Decrypted_dkg_poly
);
if
(
status
!=
SGX_SUCCESS
)
{
*
err_status
=
-
1
;
snprintf
(
err_string
,
BUF_LEN
,
"sgx_unseal_data - encrypted_poly failed with status %d"
,
status
);
return
;
}
}
secure_enclave/secure_enclave.edl
View file @
82824ef2
...
...
@@ -214,6 +214,28 @@ enclave {
[out, count = 1024] char* key );
public void gen_dkg_secret_aes (
[user_check] int *err_status,
[out, count = 1024] char* err_string,
[out, count = 3050] uint8_t* encrypted_dkg_secret,
[user_check] uint32_t * enc_len,
size_t _t);
public void decrypt_dkg_secret_aes (
[user_check] int *err_status,
[out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_dkg_secret,
[out, count = 2490] uint8_t* decrypted_dkg_secret,
[user_check] uint32_t* dec_len);
public void set_encrypted_dkg_poly_aes( [user_check] int *err_status,
[out, count = 1024] char* err_string,
[in, count = 3050] uint8_t* encrypted_poly,
[user_check] uint64_t* enc_len);
};
...
...
spec.json
View file @
82824ef2
...
...
@@ -176,7 +176,7 @@
"returns"
:
{
"status"
:
0
,
"errorMessage"
:
"12345"
,
"
BLS
PublicKeyShare"
:
[]
"
bls
PublicKeyShare"
:
[]
}
},
...
...
@@ -192,7 +192,7 @@
"status"
:
0
,
"errorMessage"
:
"12345"
,
"share*G2"
:
"123"
,
"
DH
Key"
:
"123"
"
dh
Key"
:
"123"
}
},
...
...
testw.cpp
View file @
82824ef2
...
...
@@ -789,7 +789,7 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") {
secretShares
[
i
]
=
c
.
getSecretShare
(
poly_names
[
i
],
pubEthKeys
,
t
,
n
);
for
(
uint8_t
k
=
0
;
k
<
t
;
k
++
)
{
for
(
uint8_t
j
=
0
;
j
<
4
;
j
++
)
{
string
pubShare
=
VerifVects
[
i
][
"
Verification
Vector"
][
k
][
j
].
asString
();
string
pubShare
=
VerifVects
[
i
][
"
verification
Vector"
][
k
][
j
].
asString
();
pubShares
[
i
]
+=
ConvertDecToHex
(
pubShare
);
}
}
...
...
@@ -799,7 +799,7 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") {
Json
::
Value
complaintResponse
=
c
.
complaintResponse
(
poly_names
[
1
],
0
);
cerr
<<
"share * G2 is "
<<
complaintResponse
[
"share*G2"
].
asString
();
cerr
<<
"DHKey is "
<<
complaintResponse
[
"
DH
Key"
].
asString
();
cerr
<<
"DHKey is "
<<
complaintResponse
[
"
dh
Key"
].
asString
();
int
k
=
0
;
...
...
@@ -856,7 +856,7 @@ TEST_CASE("BLS_DKG test", "[bls_dkg]") {
vector
<
string
>
pubKey_vect
;
for
(
uint8_t
j
=
0
;
j
<
4
;
j
++
){
pubKey_vect
.
push_back
(
pubBLSKeys
[
i
][
"
BLS
PublicKeyShare"
][
j
].
asString
());
pubKey_vect
.
push_back
(
pubBLSKeys
[
i
][
"
bls
PublicKeyShare"
][
j
].
asString
());
}
BLSPublicKeyShare
pubKey
(
make_shared
<
vector
<
string
>>
(
pubKey_vect
),
t
,
n
);
REQUIRE
(
pubKey
.
VerifySigWithHelper
(
hash_arr
,
make_shared
<
BLSSigShare
>
(
sig
)
,
t
,
n
));
...
...
@@ -1022,7 +1022,7 @@ void SendRPCRequest(){
secretShares
[
i
]
=
c
.
getSecretShare
(
poly_names
[
i
],
pubEthKeys
,
t
,
n
);
for
(
uint8_t
k
=
0
;
k
<
t
;
k
++
)
{
for
(
uint8_t
j
=
0
;
j
<
4
;
j
++
)
{
string
pubShare
=
VerifVects
[
i
][
"
Verification
Vector"
][
k
][
j
].
asString
();
string
pubShare
=
VerifVects
[
i
][
"
verification
Vector"
][
k
][
j
].
asString
();
pubShares
[
i
]
+=
ConvertDecToHex
(
pubShare
);
}
}
...
...
@@ -1072,7 +1072,7 @@ TEST_CASE("ManySimultaneousThreads", "[many_threads_test]") {
TEST_CASE
(
"ecdsa API test"
,
"[ecdsa_api_test]"
)
{
DEBUG_PRINT
=
1
;
is_sgx_https
=
0
;
is_aes
=
0
;
is_aes
=
1
;
cerr
<<
"ecdsa_api_test started"
<<
endl
;
init_all
(
false
,
false
);
...
...
@@ -1219,7 +1219,41 @@ TEST_CASE("isPolyExists test", "[is_poly_test]") {
cout
<<
polyDoesNotExist
<<
endl
;
REQUIRE
(
!
polyDoesNotExist
[
"IsExist"
].
asBool
());
}
TEST_CASE
(
"AES_DKG test"
,
"[aes_dkg]"
)
{
is_sgx_https
=
0
;
DEBUG_PRINT
=
1
;
is_aes
=
1
;
std
::
cerr
<<
"test started"
<<
std
::
endl
;
init_all
(
false
,
false
);
cerr
<<
"Server inited"
<<
endl
;
HttpClient
client
(
"http://localhost:1029"
);
StubClient
c
(
client
,
JSONRPC_CLIENT_V2
);
cerr
<<
"Client inited"
<<
endl
;
reset_db
();
int
n
=
4
,
t
=
4
;
Json
::
Value
EthKeys
[
n
];
Json
::
Value
VerifVects
[
n
];
Json
::
Value
pubEthKeys
;
Json
::
Value
secretShares
[
n
];
Json
::
Value
pubBLSKeys
[
n
];
Json
::
Value
BLSSigShares
[
n
];
std
::
vector
<
std
::
string
>
pubShares
(
n
);
std
::
vector
<
std
::
string
>
poly_names
(
n
);
for
(
uint8_t
i
=
0
;
i
<
n
;
i
++
)
{
EthKeys
[
i
]
=
c
.
generateECDSAKey
();
std
::
string
polyName
=
"POLY:SCHAIN_ID:1:NODE_ID:"
+
std
::
to_string
(
i
)
+
":DKG_ID:0"
;
cout
<<
c
.
generateDKGPoly
(
polyName
,
t
);
// poly_names[i] = polyName;
// VerifVects[i] = c.getVerificationVector(polyName, t, n);
// cout << "VV " << i << " " << VerifVects[i] << std::endl;
// pubEthKeys.append(EthKeys[i]["PublicKey"]);
}
}
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