From 89556667eeffb3aa0456d6a1493d1f1b7762b6a8 Mon Sep 17 00:00:00 2001 From: findeton Date: Wed, 24 Dec 2014 19:58:02 +0100 Subject: [PATCH] updating readme to add gui doc and updating makefile to prepare for windows --- README.md | 10 +++++++++- src/Makefile | 32 +++++++++++++++++++++++++++----- src/Random.cpp | 2 +- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d21f989..0fa3641 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Now we can audit the ballot. On another console, execute the following command f ./agora-airgap download-audit ../example/ballot.json -As we mentioned earlier, you can also do the audit process in two steps. First to download the public key files, execute the following from the agora-airgap/src/x64. +As we mentioned earlier, you can also do the audit procedure in two steps. First to download the public key files, execute the following from the agora-airgap/src/x64. ./agora-airgap download ../example/ballot.json pk.file election_data.file @@ -71,3 +71,11 @@ Afterwards, you can run the following command without the need of having the htt In this case we will encrypt a plaintext ballot without the need of an internet connection. For that we need the public keys and the plaintext ballot files. The following command will encrypt the ballot and save it into the file encrypted_ballot.json. Execute it from the agora-airgap/src/x64 folder: ./agora-airgap encrypt ../example/votes.json ../example/pk_1 encrypted_ballot.json + +## Graphic interface + +There is a graphic interface for the audit procedure, available for linux 64 bits. Compile it executing the following command from the agora-airgap/src folder: + + make gui + +The audit graphic interface will be available in agora-airgap/src/x64/interface . If you want to move the program somewhere else don't forget to also copy/move the picture agora-airgap/src/x64/screen.png to the same folder. \ No newline at end of file diff --git a/src/Makefile b/src/Makefile index c5d0585..2869dfa 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,33 +1,43 @@ OUTPUT := x64 +OUTPUTW64 := w64 -#INCSPATH := -Ilibjson -INCSPATH := +INCSPATH := -I/usr/include/ -I/home/felix/workspace/libgmp/gmp-6.0.0/ LIBSPATH := -#LIBS := -lgmpxx -lgmp -ljson +#LIBS := -lgmpxx -lgmp -ljson -I/usr/share/mingw-w64/include/ LIBS := -lgmpxx -lgmp -lcurl OBJS := sha256.o ElGamal.o Random.o encrypt.o +WXX32 := i686-w64-mingw32-g++ +WXX64 := x86_64-w64-mingw32-g++ + all: build build: $(OUTPUT) $(OBJS) $(CXX) -DNDEBUG -g $(OUTPUT)/*.o main.cpp -o $(OUTPUT)/agora-airgap $(INCSPATH) $(LIBSPATH) $(LIBS) -.PHONY: build clean all run gui +.PHONY: build clean all run gui xcompile OBJSW64 clean: rm -Rf $(OUTPUT) %.o: %.cpp - $(CXX) -DNDEBUG -g -c $^ $(INCSPATH) + $(CXX) -DNDEBUG -g -c $^ $(INCSPATH) $(LIBSPATH) $(LIBS) mv $@ $(OUTPUT) $(OUTPUT): mkdir -p $@ + +$(OUTPUTW64): + mkdir -p $@ $(OUTPUT)/screen.png: cp screen.png $(OUTPUT) + +$(OUTPUTW64)/screen.png: + cp screen.png $(OUTPUTW64) + run: cd example && python -m SimpleHTTPServer & echo "$$!" > pid sleep 1 @@ -38,4 +48,16 @@ run: gui: $(OUTPUT) $(OUTPUT)/screen.png $(OBJS) # `wx-config --libs` `wx-config --cxxflags` $(CXX) -DNDEBUG -g $(OUTPUT)/*.o interface.cpp `wx-config --cxxflags --libs` -o $(OUTPUT)/interface $(INCSPATH) $(LIBSPATH) $(LIBS) + + +OBJSW64: + $(WXX64) -DNDEBUG -g -c sha256.cpp $(INCSPATH) $(LIBSPATH) $(LIBS) + $(WXX64) -DNDEBUG -g -c ElGamal.cpp $(INCSPATH) $(LIBSPATH) $(LIBS) + $(WXX64) -DNDEBUG -g -c Random.cpp $(INCSPATH) $(LIBSPATH) $(LIBS) + $(WXX64) -DNDEBUG -g -c encrypt.cpp $(INCSPATH) $(LIBSPATH) $(LIBS) + mv *.o $(OUTPUTW64) + +xcompile: $(OUTPUTW64) $(OUTPUTW64)/screen.png OBJSW64 + $(WXX64) $(XCOMPILEFLAGS) -DNDEBUG -g $(OUTPUTW64)/*.o interface.cpp `wx-config --cxxflags --libs` -o $(OUTPUTW64)/interface $(INCSPATH) $(LIBSPATH) $(LIBS) + \ No newline at end of file diff --git a/src/Random.cpp b/src/Random.cpp index 668418e..a8c3e6d 100644 --- a/src/Random.cpp +++ b/src/Random.cpp @@ -16,7 +16,7 @@ using namespace std; #if defined(_WIN32) || defined(WIN32) #include #include - #include + #include #endif void Random::initState() {