Unverified Commit 052e94c2 authored by kladko's avatar kladko

SKALE-3228

parent a4274711
...@@ -20,7 +20,7 @@ add_executable(sgxwallet ...@@ -20,7 +20,7 @@ add_executable(sgxwallet
secure_enclave/DHDkg.h secure_enclave/DHDkg.h
secure_enclave/DKGUtils.cpp secure_enclave/DKGUtils.cpp
secure_enclave/DKGUtils.h secure_enclave/DKGUtils.h
secure_enclave/DomainParameters.c secure_enclave/DomainParameters.cpp
secure_enclave/DomainParameters.h secure_enclave/DomainParameters.h
secure_enclave/EnclaveConstants.h secure_enclave/EnclaveConstants.h
secure_enclave/NumberTheory.c secure_enclave/NumberTheory.c
......
#include "secure_enclave/Point.c" #include "secure_enclave/Point.c"
#include "secure_enclave/DomainParameters.c" #include "secure_enclave/DomainParameters.cpp"
#include "secure_enclave/NumberTheory.c" #include "secure_enclave/NumberTheory.c"
#include "secure_enclave/Signature.c" #include "secure_enclave/Signature.c"
#include "secure_enclave/Curves.c" #include "secure_enclave/Curves.c"
...@@ -163,7 +163,7 @@ void LevelDB::writeDataUnique(const string & name, const string &value) { ...@@ -163,7 +163,7 @@ void LevelDB::writeDataUnique(const string & name, const string &value) {
} }
writeString(key, value); writeString(key, value);
} }
......
...@@ -64,6 +64,7 @@ bin_PROGRAMS = sgxwallet testw cert_util ...@@ -64,6 +64,7 @@ bin_PROGRAMS = sgxwallet testw cert_util
## You can't use $(wildcard ...) with automake so all source files ## You can't use $(wildcard ...) with automake so all source files
## have to be explicitly listed. ## have to be explicitly listed.
## have to be explicitly listed
COMMON_SRC = InvalidStateException.cpp Exception.cpp InvalidArgumentException.cpp Log.cpp \ COMMON_SRC = InvalidStateException.cpp Exception.cpp InvalidArgumentException.cpp Log.cpp \
SGXWalletServer.cpp SGXRegistrationServer.cpp CSRManagerServer.cpp BLSCrypto.cpp \ SGXWalletServer.cpp SGXRegistrationServer.cpp CSRManagerServer.cpp BLSCrypto.cpp \
......
...@@ -31,10 +31,13 @@ ...@@ -31,10 +31,13 @@
#include <../tgmp-build/include/sgx_tgmp.h> #include <../tgmp-build/include/sgx_tgmp.h>
#endif #endif
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <string.h> #include <string.h>
#include "EnclaveCommon.h"
#include "Point.h" #include "Point.h"
#include "DomainParameters.h" #include "DomainParameters.h"
#define CHECK_ARG_ABORT(_EXPRESSION_) \ #define CHECK_ARG_ABORT(_EXPRESSION_) \
...@@ -48,12 +51,12 @@ domain_parameters domain_parameters_init() ...@@ -48,12 +51,12 @@ domain_parameters domain_parameters_init()
{ {
LOG_INFO("Allocating curver");
domain_parameters curve; domain_parameters curve;
curve = calloc(sizeof(struct domain_parameters_s),1); curve = (domain_parameters) calloc(sizeof(struct domain_parameters_s),1);
CHECK_ARG_ABORT(curve);
LOG_INFO("Initing members");
//Initialize all members //Initialize all members
mpz_init(curve->p); mpz_init(curve->p);
...@@ -62,10 +65,12 @@ domain_parameters domain_parameters_init() ...@@ -62,10 +65,12 @@ domain_parameters domain_parameters_init()
mpz_init(curve->n); mpz_init(curve->n);
mpz_init(curve->h); mpz_init(curve->h);
LOG_INFO("Initing point");
curve->G = point_init(); curve->G = point_init();
CHECK_ARG_ABORT(curve->G);
return curve; return curve;
} }
......
...@@ -352,19 +352,19 @@ void logMsg(log_level _level, const char *_msg) { ...@@ -352,19 +352,19 @@ void logMsg(log_level _level, const char *_msg) {
} }
EXTERNC void LOG_INFO(const char *_msg) { void LOG_INFO(const char *_msg) {
logMsg(L_INFO, _msg); logMsg(L_INFO, _msg);
}; };
EXTERNC void LOG_WARN(const char *_msg) { void LOG_WARN(const char *_msg) {
logMsg(L_WARNING, _msg); logMsg(L_WARNING, _msg);
}; };
EXTERNC void LOG_ERROR(const char *_msg) { void LOG_ERROR(const char *_msg) {
logMsg(L_ERROR, _msg); logMsg(L_ERROR, _msg);
}; };
EXTERNC void LOG_DEBUG(const char *_msg) { void LOG_DEBUG(const char *_msg) {
logMsg(L_DEBUG, _msg); logMsg(L_DEBUG, _msg);
}; };
EXTERNC void LOG_TRACE(const char *_msg) { void LOG_TRACE(const char *_msg) {
logMsg(L_TRACE, _msg); logMsg(L_TRACE, _msg);
}; };
...@@ -83,8 +83,8 @@ CLEANFILES+= secure_enclave_t.c secure_enclave_t.h ...@@ -83,8 +83,8 @@ CLEANFILES+= secure_enclave_t.c secure_enclave_t.h
secure_enclave_SOURCES = secure_enclave_t.c secure_enclave_t.h \ secure_enclave_SOURCES = secure_enclave_t.c secure_enclave_t.h \
secure_enclave.c \ secure_enclave.c \
Curves.c DomainParameters.c NumberTheory.c Point.c Signature.c DHDkg.c AESUtils.c \ Curves.c NumberTheory.c Point.c Signature.c DHDkg.c AESUtils.c \
DKGUtils.cpp EnclaveCommon.cpp ../third_party/SCIPR/libff/algebra/curves/alt_bn128/alt_bn128_init.cpp \ DKGUtils.cpp EnclaveCommon.cpp DomainParameters.cpp ../third_party/SCIPR/libff/algebra/curves/alt_bn128/alt_bn128_init.cpp \
../third_party/SCIPR/libff/algebra/curves/alt_bn128/alt_bn128_g2.cpp \ ../third_party/SCIPR/libff/algebra/curves/alt_bn128/alt_bn128_g2.cpp \
../third_party/SCIPR/libff/algebra/curves/alt_bn128/alt_bn128_g1.cpp $(ENCLAVE_KEY) $(ENCLAVE_CONFIG) ../third_party/SCIPR/libff/algebra/curves/alt_bn128/alt_bn128_g1.cpp $(ENCLAVE_KEY) $(ENCLAVE_CONFIG)
......
...@@ -108,9 +108,9 @@ PROGRAMS = $(libexec_PROGRAMS) ...@@ -108,9 +108,9 @@ PROGRAMS = $(libexec_PROGRAMS)
am__objects_1 = am__objects_1 =
am_secure_enclave_OBJECTS = secure_enclave_t.$(OBJEXT) \ am_secure_enclave_OBJECTS = secure_enclave_t.$(OBJEXT) \
secure_enclave.$(OBJEXT) Curves.$(OBJEXT) \ secure_enclave.$(OBJEXT) Curves.$(OBJEXT) \
DomainParameters.$(OBJEXT) NumberTheory.$(OBJEXT) \ NumberTheory.$(OBJEXT) Point.$(OBJEXT) Signature.$(OBJEXT) \
Point.$(OBJEXT) Signature.$(OBJEXT) DHDkg.$(OBJEXT) \ DHDkg.$(OBJEXT) AESUtils.$(OBJEXT) DKGUtils.$(OBJEXT) \
AESUtils.$(OBJEXT) DKGUtils.$(OBJEXT) EnclaveCommon.$(OBJEXT) \ EnclaveCommon.$(OBJEXT) DomainParameters.$(OBJEXT) \
alt_bn128_init.$(OBJEXT) alt_bn128_g2.$(OBJEXT) \ alt_bn128_init.$(OBJEXT) alt_bn128_g2.$(OBJEXT) \
alt_bn128_g1.$(OBJEXT) $(am__objects_1) $(am__objects_1) alt_bn128_g1.$(OBJEXT) $(am__objects_1) $(am__objects_1)
secure_enclave_OBJECTS = $(am_secure_enclave_OBJECTS) secure_enclave_OBJECTS = $(am_secure_enclave_OBJECTS)
...@@ -337,8 +337,8 @@ ENCLAVE_CONFIG = $(ENCLAVE).config.xml ...@@ -337,8 +337,8 @@ ENCLAVE_CONFIG = $(ENCLAVE).config.xml
ENCLAVE_KEY = test_insecure_private_key.pem #$(ENCLAVE)_private.pem ENCLAVE_KEY = test_insecure_private_key.pem #$(ENCLAVE)_private.pem
secure_enclave_SOURCES = secure_enclave_t.c secure_enclave_t.h \ secure_enclave_SOURCES = secure_enclave_t.c secure_enclave_t.h \
secure_enclave.c \ secure_enclave.c \
Curves.c DomainParameters.c NumberTheory.c Point.c Signature.c DHDkg.c AESUtils.c \ Curves.c NumberTheory.c Point.c Signature.c DHDkg.c AESUtils.c \
DKGUtils.cpp EnclaveCommon.cpp ../third_party/SCIPR/libff/algebra/curves/alt_bn128/alt_bn128_init.cpp \ DKGUtils.cpp EnclaveCommon.cpp DomainParameters.cpp ../third_party/SCIPR/libff/algebra/curves/alt_bn128/alt_bn128_init.cpp \
../third_party/SCIPR/libff/algebra/curves/alt_bn128/alt_bn128_g2.cpp \ ../third_party/SCIPR/libff/algebra/curves/alt_bn128/alt_bn128_g2.cpp \
../third_party/SCIPR/libff/algebra/curves/alt_bn128/alt_bn128_g1.cpp $(ENCLAVE_KEY) $(ENCLAVE_CONFIG) ../third_party/SCIPR/libff/algebra/curves/alt_bn128/alt_bn128_g1.cpp $(ENCLAVE_KEY) $(ENCLAVE_CONFIG)
......
...@@ -36,5 +36,5 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -36,5 +36,5 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "sgxwallet.h" #include "sgxwallet.h"
sgx_launch_token_t token = {0}; sgx_launch_token_t token = {0};
sgx_enclave_id_t eid; sgx_enclave_id_t eid = 0;
int updated; int updated = 0;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment