| CFLAGS := -Wall -Wextra |
| |
| opt ?= 2 |
| |
| ifneq ($(opt),) |
| CFLAGS += -O$(opt) |
| endif |
| |
| dbg ?= no |
| |
| ifneq ($(dbg),no) |
| CFLAGS += -g |
| endif |
| |
| src := ecc.c hex.c tool.c |
| obj := $(src:.c=.o) |
| asm := $(src:.c=.o) |
| |
| ecies-tool: ecies-tool.o ecc.o |
| $(LINK.o) $^ -o $@ |
| |
| ecies-chacha20-tool: ecies-chacha20-tool.o ecc.o ecies-chacha20.o chacha20_simple.o |
| $(LINK.o) $^ -o $@ |
| |
| %.o: %.c |
| $(CC) $(CFLAGS) -o $@ -c $< |
| |
| %.s: %.c |
| $(CC) $(CFLAGS) -o $@ -S $< |
| |
| ecies-chacha20-tool.o: ecies-tool.c |
| $(CC) $(CFLAGS) -DCHACHA20 -c $^ -o $@ |
| |
| clean: |
| rm -f *.o *.s ecies-tool |
| rm -rf doc |
| |
| test: ecies-tool |
| @./$< k 1234567890 && echo "key generation pass" || echo "key generation fail" |
| @echo "This secret demo message will be ECIES encrypted" > $@.source |
| @./$< e publickey < $@.source > $@.encrypted && echo "encryption pass" || echo "encryption fail" |
| @./$< d privatekey < $@.encrypted > $@.decrypted && echo "decription pass" || echo "decryption fail" |
| @diff $@.source $@.decrypted && echo "test pass" || echo "test fail" |
| @rm -f $@.keys $@.source $@.encrypted $@.decrypted |
| @rm -f privatekey publickey |
| |
| doc: |
| doxygen |
| |
| .PHONY: doc |