Skip to content

Commit

Permalink
Improve the test program.
Browse files Browse the repository at this point in the history
Add command line options to individually evercise each of the library
functions. Including:

    * sha512 hash of file or string
    * generating public and private keys
    * signing files or sha512 hashes of files.
    * validating those same hashes.
    * running the key exchange function.
    * adding a scalar to public and private keys.
  • Loading branch information
rdebath committed May 1, 2017
1 parent 1f62be1 commit 0fcbd1e
Show file tree
Hide file tree
Showing 2 changed files with 494 additions and 13 deletions.
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

TARGET= ed25519
FLTO=-flto=8
CFLAGS=-Wall -Wextra -O3 -fwrapv $(FLTO) $(DEFS)
CC=gcc
AR=gcc-ar

LOBJECTS := $(patsubst %.c,%.o,$(wildcard src/*.c))

$(TARGET): test.c ed25519.a
$(CC) $(TARGET_ARCH) $(CFLAGS) $(LDFLAGS) -o $@ test.c ed25519.a $(LIBS)

ed25519.a: ed25519.a($(LOBJECTS))
touch $@

ed25519.a($(LOBJECTS)): $(wildcard src/*.h)

$(TARGET): license.h

license.h: license.txt
echo '#define LICENSE \' > license.h.tmp
sed 's/.*/"&\\n" \\/' < license.txt >> license.h.tmp
echo >> license.h.tmp
mv license.h.tmp license.h

clean:
-rm -f ${TARGET} license.h ed25519.a

test: $(TARGET)
set -x ;\
S=$$(./$(TARGET) -r) &&\
P=$$(./$(TARGET) -k $$S) &&\
V=$$(./$(TARGET) -hs $$S Makefile) &&\
./$(TARGET) -hvp $$V $$P Makefile &&\
V=$$(./$(TARGET) -s$$S Makefile) &&\
./$(TARGET) -v$$V -p$$P Makefile &&\
./$(TARGET) -t

Loading

0 comments on commit 0fcbd1e

Please sign in to comment.