Commit b20d11d9 authored by Gerard Ryan's avatar Gerard Ryan

Public Release v1.0

parent 6054755a
# Ignore everything in this directory
*~
*.o
bin/
build/
test/build
test/bin
output.txt
apidoc_warning_logfile.txt
third-party/distros/gmp-6.1.1
third-party/distros/gmp-6.1.2
third-party/distros/ntl-10.3.0
third-party/include
third-party/lib
third-party/share
gmon.out
.gitattributes
# Except this file
!.gitignore
output.txt
bin
test/bin
test/build
.idea
*/**/*.gch
*.a
*.class
## for the moment
.cproject
.metadata/
.project
.settings/
RemoteSystemTempFiles/
.classpath
.externalToolBuilders/
/Default/
.DS_Store
# Ignore intellij project files/cmake files
CMakeLists.txt
.idea/
src/circuit/lib/scan.cpp
src/circuit/lib/parse.cpp
src/circuit/lib/parse.hpp
src/circuit/lib/*.hh
PALISADE TPOC:
--------------
palisade@njit.edu
Project PI:
-----------
Kurt Rohloff, rohloff@njit.edu
\ No newline at end of file
Contributors
============
Technical POC
-------------
PALISADE Project: palisade@njit.edu
Project Lead, Kurt Rohloff: rohloff@njit.edu
Members of the following organizations are or have been contributors to the PALISADE library:
* [NJIT (New Jersey Institute of Technology)](http://www.njit.edu)
* [MIT (Massachusetts Institute of Technology)](http://www.mit.edu)
* [Raytheon BBN Technologies](http://www.bbn.com)
* [UCSD (University of California San Diego)](https://ucsd.edu/)
* [Applied Communication Sciences (ACS) / Vencore Labs](http://www.appcomsci.com/)
* [LGS Innovations (Lucent Government Systems)](http://www.lgsinnovations.com/)
* [Galois, Inc.](https://galois.com/)
Thanks to Our Sponsors
----------------------
PALISADE is being developed with the generous support of our sponsors on the following projects:
* [DARPA SAFEWARE](http://www.darpa.mil/program/safeware) (2015-present) : Sponsored by the Defense Advanced Research Projects Agency (DARPA) and the Army Research Laboratory (ARL) under Contract Numbers W911NF-15-C-0226 and W911NF-15-C-0233. The views expressed are those of the authors and do not necessarily reflect the official policy or position of the Department of Defense or the U.S. Government.
* [NSA CAE](https://www.nsa.gov/resources/educators/centers-academic-excellence/cyber-defense/) (2015-2016) : Project sponsored by the National Security Agency under Grant H98230-15-1-0274. The United States Government is authorized to reproduce and distribute reprints notwithstanding any copyright notice herein.
* Simons Foundation
* IARPA RAMPARTS (2016-present) : This research is based upon work supported in part by the Office of the Director of National Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA). The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies, either express or implied, of ODNI, IARPA, or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for governmental purposes notwithstanding any copyright annotation therein.
* Sloan Foundation
License Information
-------------------
Copyright (c) 2017, New Jersey Institute of Technology (NJIT)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
#Multi OS makefile
ifeq ($(OS),Windows_NT)
# ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
# CCFLAGS += -D AMD64
# endif
# ifeq ($(PROCESSOR_ARCHITECTURE),x86)
# CCFLAGS += -D IA32
# endif
include Makefile.mingw64
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
#CCFLAGS += -D LINUX
include Makefile.lin
endif
ifeq ($(UNAME_S),Darwin)
#CCFLAGS += -D OSX
include Makefile.mac
endif
ifeq ($(UNAME_S),CYGWIN_NT-6.1)
#CCFLAGS += -D CYGWIN
include Makefile.mingw
endif
# UNAME_P := $(shell uname -p)
# ifeq ($(UNAME_P),x86_64)
# CCFLAGS += -D AMD64
# endif
# ifneq ($(filter %86,$(UNAME_P)),)
# CCFLAGS += -D IA32
# endif
# ifneq ($(filter arm%,$(UNAME_P)),)
# CCFLAGS += -D ARM
# endif
endif
include Makefile.common
#
#Copyright (c) 2015, New Jersey Institute of Technology (NJIT)
#All rights reserved.
#Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
#met:
#1. Redistributions of source code must retain the above copyright
#notice, this list of conditions and the following disclaimer.
#2. Redistributions in binary form must reproduce the above copyright
#notice, this list of conditions and the following disclaimer in the
#documentation and/or other materials provided with the distribution.
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
#IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
#TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
#PARTICULAR PURPOSE ARE DISCLAIMED.
#IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
#ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
#OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
#HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
#STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
#IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
#POSSIBILITY OF SUCH DAMAGE.
#
BM_SRCDIR = google/benchmark-master/src
BM_IFLAGS = -I$(BM_SRCDIR)/../include
BM_SRC = $(wildcard $(BM_SRCDIR)/*.cc)
BM_OBJ = $(BM_SRC:.cc=.o)
#this defines the benchmark library archive
BM_LIB = $(BM_SRCDIR)/libbenchmark.a
REGEX_FLAG := -DHAVE_STD_REGEX #note does not work for g++ <version 4.9
#### this warning flag should NOT be used with clang
WARNING_FLAG := -Wno-unused-but-set-variable
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
WARNING_FLAG :=
endif
LIBBENCHMARK_FLAGS = $(REGEX_FLAG) -DHAVE_STEADY_CLOCK -DNDEBUG $(WARNING_FLAG) -Wno-unused-variable ##-Wextra -Wshadow -pedantic -pedantic-errors -Wfloat-equal -Wzero-as-null-pointer-constant -fstrict-aliasing -Wstrict-aliasing -Wno-nested-anon-types
benchmark: libbenchmark benchmarktargets
# this builds objects from sources for benchmark library
$(BM_SRCDIR)/%.o: $(BM_SRCDIR)/%.cc
$(CC) $(CPPFLAGS) $(LIBBENCHMARK_FLAGS) $(BM_IFLAGS) -o $@ -c $<
$(BM_LIB) : $(BM_OBJ)
ar cr $(BM_LIB) $(BM_OBJ)
ranlib $(BM_LIB)
libbenchmark: $(BM_LIB)
# this is where the benchmark library code lives
BM_LIBSRCDIR = google/benchmark-master/include
########### PALISADE BENCHMARKS BUILD HERE
# this defines the source, build (obj) and binary directories
BENCHMARK_SRC_DIR = benchmark/src
BENCHMARK_BIN_DIR = benchmark/bin
BENCHMARK_BUILD_DIR = benchmark/build
#define list of source files (all files with .cc in the BENCHMARK_SRC_DIR
BENCHMARK_SRC = $(wildcard $(BENCHMARK_SRC_DIR)/*.cpp)
BENCHMARK_OBJ = $(BENCHMARK_SRC:$(BENCHMARK_SRC_DIR)%.cpp=$(BENCHMARK_BUILD_DIR)%.o)
-include $(BENCHMARK_OBJ:.o=.d)
#define list of executables (1:1 substituion of .cc --> no extention in all .cc files)
#and puts executables in _BIN_DIR
BENCHMARK_BIN = $(BENCHMARK_SRC:$(BENCHMARK_SRC_DIR)%.cpp=$(BENCHMARK_BIN_DIR)%$(EXESUFFIX))
#this is is the Include directive for the palisade code being benchmarked
#BENCHMARK_INC = -Isrc/core/lib -Isrc/pke/lib $(BM_IFLAGS)
#DBC included NTL and GMP
BENCHMARK_INC = -Isrc/core/lib -Isrc/pke/lib $(BM_IFLAGS) $(NTLINCLUDE) $(GMPINCLUDE)
# this builds objects from sources for benchmarks
$(BENCHMARK_BUILD_DIR)/%.o: $(BENCHMARK_SRC_DIR)/%.cpp
@mkdir -p $(BENCHMARK_BUILD_DIR)
$(CC) $(CPPFLAGS) $(BENCHMARK_INC) $(LIBBENCHMARK_FLAGS) $(BENCHMARK_INCLUDES) -c -g $< -o $@
@$(CC) -MM $(CPPFLAGS) $(BENCHMARK_INC) $(LIBBENCHMARK_FLAGS) $(BENCHMARK_INCLUDES) $< > $(patsubst %.o,%.d,$@)
@mv -f $(patsubst %.o,%.d,$@) $(patsubst %.o,%.d.tmp,$@)
@sed -e 's|.*\.o:|$@:|' < $(patsubst %.o,%.d.tmp,$@) > $(patsubst %.o,%.d,$@)
@rm -f $(patsubst %.o,%.d.tmp,$@)
# this builds executables from objects for benchmarks
$(BENCHMARK_BIN_DIR)/%$(EXESUFFIX): $(BENCHMARK_BUILD_DIR)/%.o $(BM_LIB) $(EXTLIBDIR)/$(PALISADETRAPDOORLIB) $(EXTLIBDIR)/$(PALISADEPKELIB) $(EXTLIBDIR)/$(PALISADECORELIB)
@mkdir -p $(BENCHMARK_BIN_DIR)
$(CC) $(BENCHMARK_INC) $(LIBBENCHMARK_FLAGS) $< -o $@ $(EXTLIBDIR)/$(PALISADETRAPDOORLIB) $(EXTLIBDIR)/$(PALISADEPKELIB) $(EXTLIBDIR)/$(PALISADECORELIB) $(RDYNAMIC) $(BM_LIB) $(EXTLIB) $(MINGWREGEX)
# this is the target that makes the actual benchmarks
.PHONY:benchmarktargets
benchmarktargets: $(BENCHMARK_BIN)
#this target is usesd to cleanup, it is called from the top Makefile
.PHONEY: cleanbenchmark
cleanbenchmark:
@echo " Cleaning Benchmarks...";
$(RM) -r $(BENCHMARK_BIN_DIR) $(BENCHMARK_BUILD_DIR) $(BM_OBJ) $(BM_LIB)
#
#Copyright (c) 2015, New Jersey Institute of Technology (NJIT)
#All rights reserved.
#Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
#met:
#1. Redistributions of source code must retain the above copyright
#notice, this list of conditions and the following disclaimer.
#2. Redistributions in binary form must reproduce the above copyright
#notice, this list of conditions and the following disclaimer in the
#documentation and/or other materials provided with the distribution.
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
#IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
#TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
#PARTICULAR PURPOSE ARE DISCLAIMED.
#IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
#ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
#OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
#HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
#STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
#IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
#POSSIBILITY OF SUCH DAMAGE.
#
################
# Makefile.circuit-disable ; no actual build
################
allcircuit:
allcircuitdemos:
cleancircuit:
testcircuit:
#
#Copyright (c) 2015, New Jersey Institute of Technology (NJIT)
#All rights reserved.
#Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
#met:
#1. Redistributions of source code must retain the above copyright
#notice, this list of conditions and the following disclaimer.
#2. Redistributions in binary form must reproduce the above copyright
#notice, this list of conditions and the following disclaimer in the
#documentation and/or other materials provided with the distribution.
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
#IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
#TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
#PARTICULAR PURPOSE ARE DISCLAIMED.
#IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
#ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
#OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
#HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
#STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
#IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
#POSSIBILITY OF SUCH DAMAGE.
#
################
# Makefile contains core definitions and then includes build instructions
# for making all the palisade components
################
# NOTE select the appropriate set of CPPFLAGS
# most code is checked into git with the first line active
#CPPFLAGS += -Wall -w -g ## undefine for single thread debug NO OPTIMIZATION operation
#CPPFLAGS += -Wall -Ofast -w #-g #undefine for single thread debug operation
#CPPFLAGS += -Wall -Ofast -w -fopenmp -g ##undefine for parallel debug operation
#CPPFLAGS += -Wall -O3 -w -DNDEBUG -pg ##undefine for single thread best performance operation with gprof profiling
#main best performance configuration for parallel operation - cross-platform
CPPFLAGS += -g -Wall -Werror -O3 -fopenmp $(COMPTHREADFLAG) ##undefine for parallel best performance operation with debug
#CPPFLAGS += -Wall -O3 -w -fopenmp -m64 -DNDEBUG ##undefine for parallel best performance operation with no debug
#THE OPTIONS BELOW SHOULD BE USED WITH CARE AS THEY USE A LOT OF AGGRESSIVE OPTIMIZATION OPTIONS
#CPPFLAGS += -Wall -w -DNDEBUG -m64 -Ofast -flto -march=native -funroll-loops ##undefine for single thread best performance operation
#CPPFLAGS += -Wall -w -DNDEBUG -m64 -Ofast -flto -march=native -funroll-loops -fopenmp ##undefine for multithread really best performance operation
#CPPFLAGS += -Wall -w -m64 -Ofast -flto -march=native -funroll-loops -fopenmp -DNDEBUG ##undefine for multithread really best performance operation
#CPPFLAGS += -Wall -w -m64 -Ofast -flto -march=native -funroll-loops -fopenmp ##undefine for multithread really best performance operation
TEST_LIB := $(LOADTHREADFLAG) -fopenmp $(NTLLIB) $(GMPLIB) -lgomp
#build directory
BUILDDIR := build
#bin directory
BINDIR := bin
#sources for palisade library
EXTLIBDIR := bin/lib
EXTTESTDIR := bin/unittest
EXTDEMODIR := bin/demo
# extentions for source and header files
SRCEXT := cpp
HDREXT := h
$(objects) : %.o : %.cpp
NTLINCLUDE := -I third-party/include
GMPINCLUDE := -I third-party/include
#DBC added NTL and GML lubraries and turn off profiling
#EXTLIB := -L$(EXTLIBDIR) $(TEST_LIB) -pg #-lmongoclient -L lib -lboost_thread-mt -lboost_filesystem-mt -lboost_system-mt ## include profiling
EXTLIB := -L$(EXTLIBDIR) $(NTLLIB) $(GMPLIB) $(TEST_LIB) #no profiling
INC := -I src/core/lib -I src/pke/lib -I src/trapdoor/lib -I src/circuit/lib -I test $(OMPINCLUDE) $(NTLINCLUDE) $(GMPINCLUDE)
#the name of the shared object library for palisade objects.
PALISADECORELIB := libPALISADEcore$(LIBSUFFIX)
PALISADEPKELIB := libPALISADEpke$(LIBSUFFIX)
PALISADETRAPDOORLIB := libPALISADEtrapdoor$(LIBSUFFIX)
PALISADECIRCUITLIB := libPALISADEcircuit$(LIBSUFFIX)
PALISADEPYLIB := pycrypto$(LIBSUFFIX)
# run make for all components. you can run any individual component separately
# by invoking "make alltargets" for example
# each corresponding makefile will make the allxxxx target
all: allcore allpke alltrapdoor allcircuit
docs: apidocs
alljava: allcore allpke jwrapper
allpython: allcore allpke alltrapdoor pywrapper
alldemos: allcoredemos allpkedemos alltrapdoordemos allcircuitdemos
testall: testcore testpke testtrapdoor testcircuit
# clean up all components. you can clean any individual compoenent separately
# by invoking "make cleantargets" for example
# each corresponding makefile will make the cleanxxxx target
.PHONEY: clean
clean: cleancore cleanpke cleantrapdoor cleancircuit cleandocs cleanbenchmark
@echo 'Cleaning top level autogenerated directories'
$(RM) -f test/include/gtest/gtest-all.o
$(RM) -rf bin
include Makefile.core
include Makefile.pke
include Makefile.trapdoor
include Makefile.circuit
include Makefile.wrapper
include Makefile.benchmark #builds the benchmark framework
include Makefile.docs #populates doxgen documentation
test/include/gtest/gtest-all.o: test/include/gtest/gtest-all.cc
$(CC) -c $(CPPFLAGS) -o $@ $<
#
#Copyright (c) 2015, New Jersey Institute of Technology (NJIT)
#All rights reserved.
#Redistribution and use in source and binary forms, with or without