Added BLS on untrusted side

parent 87bbb8fd
//
// Created by kladko on 9/2/19.
//
#include "BLSCrypto.h"
#include "libff/algebra/curves/alt_bn128/alt_bn128_init.hpp"
#include "bls.h"
extern "C" void init_bls() {
libff::init_alt_bn128_params();
}
class BLSCrypto {
};
//
// Created by kladko on 9/2/19.
//
#ifndef SGXD_BLSCRYPTO_H
#define SGXD_BLSCRYPTO_H
#ifdef __cplusplus
#define EXTERNC extern "C"
#else
#define EXTERNC
#endif
EXTERNC void init_bls();
#endif //SGXD_BLSCRYPTO_H
......@@ -45,7 +45,7 @@ secure_enclave.edl: secure_enclave/secure_enclave.edl
## AM_CFLAGS =
## AM_CXXFLAGS =
AM_CPPFLAGS += -DSKALE_SGX=1 -DBINARY_OUTPUT=1 -Ilibff -fno-builtin-memset $(GMP_CPPFLAGS)
AM_CPPFLAGS += -DSKALE_SGX=1 -DBINARY_OUTPUT=1 -IlibBLS/bls -IlibBLS/libff -IlibBLS -fno-builtin-memset $(GMP_CPPFLAGS)
## Additional targets to remove with 'make clean'. You must list
## any edger8r generated files here.
......@@ -65,7 +65,7 @@ bin_PROGRAMS = sgxd
COMMON_SRC = sgx_stub.c sgx_detect_linux.c create_enclave.c oc_alloc.c
COMMON_ENCLAVE_SRC = secure_enclave_u.c secure_enclave_u.h
sgxd_SOURCES = sgxd.c $(COMMON_SRC)
sgxd_SOURCES = sgxd.c BLSCrypto.cpp $(COMMON_SRC)
nodist_sgxd_SOURCES = $(COMMON_ENCLAVE_SRC)
EXTRA_sgxd_DEPENDENCIES = secure_enclave.signed.so
......@@ -87,5 +87,5 @@ secure_enclave.signed.so: secure_enclave/secure_enclave.signed.so
## Use the variables, not the actual library names to ensure these
## targets work on simulation builds.
sgxd_LDADD=-l$(SGX_URTS_LIB) -lgmp -ldl -l:libsgx_capable.a -l:libsgx_tprotected_fs.a -lpthread
sgxd_LDADD=-l$(SGX_URTS_LIB) -LlibBLS/build/libff/libff -l:libff.a -lgmp -ldl -l:libsgx_capable.a -l:libsgx_tprotected_fs.a -lpthread
......@@ -40,6 +40,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdlib.h>
#include <unistd.h>
#include "BLSCrypto.h"
#define ENCLAVE_NAME "secure_enclave.signed.so"
int char2int(char _input) {
......@@ -165,8 +167,12 @@ int main(int argc, char *argv[]) {
if (argc != 0)
usage();
init_bls();
init_enclave();
const char *key = "4160780231445160889237664391382223604184857153814275770598"
"791864649971919844";
......
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