1 # Makefile for crypto test suite
7 top_srcdir = @top_srcdir@
8 top_builddir = @top_builddir@
12 INCDIR = -Iinclude -I$(srcdir)/include -I$(top_srcdir)/include
17 LDFLAGS = @LDFLAGS@ -L. -L..
18 COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS)
20 CRYPTO_LIBDIR = @CRYPTO_LIBDIR@
24 # Specify how tests should find shared libraries on macOS and Linux
26 # macOS purges DYLD_LIBRARY_PATH when spawning subprocesses, so it's
27 # not possible to pass this in from the outside; we have to specify
28 # it for any subprocesses we call. No support for dynamic linked
30 ifneq ($(strip $(CRYPTO_LIBDIR)),)
31 ifneq ($(OS),Windows_NT)
32 UNAME_S = $(shell uname -s)
33 ifeq ($(UNAME_S),Linux)
34 FIND_LIBRARIES = LD_LIBRARY_PATH=$(CRYPTO_LIBDIR)
36 ifeq ($(UNAME_S),Darwin)
37 FIND_LIBRARIES = DYLD_LIBRARY_PATH=$(CRYPTO_LIBDIR)
42 # EXE defines the suffix on executables - it's .exe for cygwin, and
43 # null on linux, bsd, and OS X and other OSes. we define this so that
44 # `make clean` will work on the cygwin platform
47 USE_EXTERNAL_CRYPTO = @USE_EXTERNAL_CRYPTO@
54 DEFS += -D$(sysname)=1
57 .PHONY: dummy all runtest clean superclean
62 ifneq (1, $(USE_EXTERNAL_CRYPTO))
63 AES_CALC = test/aes_calc$(EXE)
66 testapp = test/cipher_driver$(EXE) test/datatypes_driver$(EXE) \
67 test/stat_driver$(EXE) test/sha1_driver$(EXE) \
68 test/kernel_driver$(EXE) $(AES_CALC) \
71 # data values used to test the aes_calc application for AES-128
72 k128=000102030405060708090a0b0c0d0e0f
73 p128=00112233445566778899aabbccddeeff
74 c128=69c4e0d86a7b0430d8cdb78070b4c55a
77 # data values used to test the aes_calc application for AES-256
78 k256=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
79 p256=00112233445566778899aabbccddeeff
80 c256=8ea2b7ca516745bfeafc49904b496089
84 $(FIND_LIBRARIES) test/env$(EXE) # print out information on the build environment
85 @echo "running crypto test applications..."
86 ifneq (1, $(USE_EXTERNAL_CRYPTO))
87 $(FIND_LIBRARIES) test `test/aes_calc $(k128) $(p128)` = $(c128)
88 $(FIND_LIBRARIES) test `test/aes_calc $(k256) $(p256)` = $(c256)
90 $(FIND_LIBRARIES) test/cipher_driver$(EXE) -v >/dev/null
91 $(FIND_LIBRARIES) test/datatypes_driver$(EXE) -v >/dev/null
92 $(FIND_LIBRARIES) test/stat_driver$(EXE) >/dev/null
93 $(FIND_LIBRARIES) test/sha1_driver$(EXE) -v >/dev/null
94 $(FIND_LIBRARIES) test/kernel_driver$(EXE) -v >/dev/null
95 @echo "crypto test applications passed."
98 # the rule for making object files and test apps
101 $(COMPILE) -c $< -o $@
103 %$(EXE): %.c $(srcdir)/../test/getopt_s.c
104 $(COMPILE) $(LDFLAGS) $< $(srcdir)/../test/getopt_s.c -o $@ $(CRYPTOLIB) $(LIBS)
108 # housekeeping functions
111 rm -f $(testapp) *.o */*.o
112 for a in * .* */*; do if [ -f "$$a~" ] ; then rm $$a~; fi; done;
113 rm -f `find . -name "*.[ch]~*~"`
117 rm -f *core TAGS ktrace.out