Unverified Commit 228cb221 authored by kladko's avatar kladko

SKALE-1880-fix-ecdsa

parent 7acee1a7
#include "secure_enclave/Point.c"
#include "secure_enclave/DomainParameters.c"
#include "secure_enclave/NumberTheory.c"
#include "secure_enclave/Signature.c"
#include "secure_enclave/Curves.c"
\ No newline at end of file
...@@ -45,7 +45,7 @@ secure_enclave.edl: secure_enclave/secure_enclave.edl ...@@ -45,7 +45,7 @@ secure_enclave.edl: secure_enclave/secure_enclave.edl
#AM_CPPFLAGS += -g -Og #AM_CPPFLAGS += -g -Og
AM_CFLAGS = -g -Og -rdynamic -Wl,--no-as-needed -lSegFault AM_CFLAGS = -DUSER_SPACE -g -Og -rdynamic -Wl,--no-as-needed -lSegFault
AM_CXXFLAGS = ${AM_CPPFLAGS} -rdynamic -Wl,--no-as-needed -lSegFault AM_CXXFLAGS = ${AM_CPPFLAGS} -rdynamic -Wl,--no-as-needed -lSegFault
...@@ -68,11 +68,10 @@ bin_PROGRAMS = sgxwallet testw cert_util ...@@ -68,11 +68,10 @@ bin_PROGRAMS = sgxwallet testw cert_util
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 RPCException.cpp BLSCrypto.cpp \ SGXWalletServer.cpp SGXRegistrationServer.cpp CSRManagerServer.cpp RPCException.cpp BLSCrypto.cpp \
secure_enclave/DomainParameters.c ECDSACrypto.cpp \ ECDSACrypto.cpp \
DKGCrypto.cpp ServerInit.cpp BLSPrivateKeyShareSGX.cpp LevelDB.cpp ServerDataChecker.cpp SEKManager.cpp \ DKGCrypto.cpp ServerInit.cpp BLSPrivateKeyShareSGX.cpp LevelDB.cpp ServerDataChecker.cpp SEKManager.cpp \
sgx_stub.c sgx_detect_linux.c create_enclave.c oc_alloc.c \ sgx_stub.c sgx_detect_linux.c create_enclave.c oc_alloc.c \
secure_enclave/NumberTheory.c secure_enclave/Signature.c \ ECDSAImpl.c
secure_enclave/Curves.c secure_enclave/Point.c
COMMON_ENCLAVE_SRC = secure_enclave_u.c secure_enclave_u.h COMMON_ENCLAVE_SRC = secure_enclave_u.c secure_enclave_u.h
sgxwallet_SOURCES = sgxwallet.c $(COMMON_SRC) sgxwallet_SOURCES = sgxwallet.c $(COMMON_SRC)
......
...@@ -33,7 +33,7 @@ using namespace std; ...@@ -33,7 +33,7 @@ using namespace std;
#include <memory> #include <memory>
#define USER_SPACE
#include <gmp.h> #include <gmp.h>
#include "secure_enclave/Verify.h" #include "secure_enclave/Verify.h"
#include "InvalidStateException.h" #include "InvalidStateException.h"
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#endif #endif
#ifdef USER_SPACE #ifdef USER_SPACE
#include <gmp.h> #include <gmp.h>
#else #else
#include <../tgmp-build/include/sgx_tgmp.h> #include <../tgmp-build/include/sgx_tgmp.h>
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#ifdef USER_SPACE #ifdef USER_SPACE
#include <gmp.h> #include <gmp.h>
#else #else
#include <../tgmp-build/include/sgx_tgmp.h> #include <../tgmp-build/include/sgx_tgmp.h>
#endif #endif
...@@ -90,6 +92,7 @@ void signature_extract_public_key(point public_key, mpz_t private_key, domain_pa ...@@ -90,6 +92,7 @@ void signature_extract_public_key(point public_key, mpz_t private_key, domain_pa
point_multiplication(public_key, private_key, curve->G, curve); point_multiplication(public_key, private_key, curve->G, curve);
} }
#ifndef USER_SPACE
/*Generate signature for a message*/ /*Generate signature for a message*/
void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_parameters curve) { void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_parameters curve) {
//message must not have a bit length longer than that of n //message must not have a bit length longer than that of n
...@@ -177,7 +180,7 @@ void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_para ...@@ -177,7 +180,7 @@ void signature_sign(signature sig, mpz_t message, mpz_t private_key, domain_para
} }
#endif
/*Release signature*/ /*Release signature*/
void signature_free(signature sig) { void signature_free(signature sig) {
......
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
*/ */
#ifndef SGXWALLET_VERIFY_H #ifndef SGXWALLET_VERIFY_H
#define SGXWALLET_VERIFY_H #define SGXWALLET_VERIFY_H
#define USER_SPACE 1
#include "secure_enclave/Point.h" #include "secure_enclave/Point.h"
#include "secure_enclave/DomainParameters.h" #include "secure_enclave/DomainParameters.h"
#include "secure_enclave/NumberTheory.h" #include "secure_enclave/NumberTheory.h"
......
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