blob: 23e4c7f4376ccb190c1f104a636a418d82d36955 [file] [log] [blame]
jfigus8aa936e2014-11-06 10:16:35 -05001# Makefile for crypto test suite
Cullen Jennings235513a2005-09-21 22:51:36 +00002#
3# David A. McGrew
4# Cisco Systems, Inc.
5
Marcus Sundberg67a695d2005-09-29 14:10:05 +00006srcdir = @srcdir@
7top_srcdir = @top_srcdir@
8top_builddir = @top_builddir@
9VPATH = @srcdir@
10
11CC = @CC@
Joachim Bauch4cdf4672015-03-27 16:56:43 +010012INCDIR = -Iinclude -I$(srcdir)/include -I$(top_srcdir)/include
Marcus Sundberg67a695d2005-09-29 14:10:05 +000013DEFS = @DEFS@
14CPPFLAGS= @CPPFLAGS@
15CFLAGS = @CFLAGS@
16LIBS = @LIBS@
jfigus0d3a2682013-04-02 15:42:37 -040017LDFLAGS = @LDFLAGS@ -L. -L..
Marcus Sundberg67a695d2005-09-29 14:10:05 +000018COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS)
jfigusfe1f3ef2014-11-21 16:31:44 -050019CRYPTOLIB = -lsrtp2
Marcus Sundberg67a695d2005-09-29 14:10:05 +000020
21RANLIB = @RANLIB@
Cullen Jennings235513a2005-09-21 22:51:36 +000022
Marcus Sundbergaefd6842005-10-02 19:47:14 +000023# EXE defines the suffix on executables - it's .exe for cygwin, and
24# null on linux, bsd, and OS X and other OSes. we define this so that
25# `make clean` will work on the cygwin platform
26EXE = @EXE@
Marcus Sundberg5c714e42005-10-03 15:16:06 +000027# Random source.
jfigus0d3a2682013-04-02 15:42:37 -040028USE_OPENSSL = @USE_OPENSSL@
Marcus Sundbergaefd6842005-10-02 19:47:14 +000029
Cullen Jennings235513a2005-09-21 22:51:36 +000030ifdef ARCH
Marcus Sundberg67a695d2005-09-29 14:10:05 +000031 DEFS += -D$(ARCH)=1
Cullen Jennings235513a2005-09-21 22:51:36 +000032endif
33
34ifdef sysname
Marcus Sundberg67a695d2005-09-29 14:10:05 +000035 DEFS += -D$(sysname)=1
Cullen Jennings235513a2005-09-21 22:51:36 +000036endif
37
38.PHONY: dummy all runtest clean superclean
39
40dummy : all runtest
41
David McGrewb67061f2005-09-28 14:23:06 +000042# test applications
jfigus0d3a2682013-04-02 15:42:37 -040043ifneq (1, $(USE_OPENSSL))
44AES_CALC = test/aes_calc$(EXE)
45endif
David McGrewb67061f2005-09-28 14:23:06 +000046
Marcus Sundbergaefd6842005-10-02 19:47:14 +000047testapp = test/cipher_driver$(EXE) test/datatypes_driver$(EXE) \
48 test/stat_driver$(EXE) test/sha1_driver$(EXE) \
jfigus339b61d2014-11-04 15:36:15 -050049 test/kernel_driver$(EXE) $(AES_CALC) \
Marcus Sundbergaefd6842005-10-02 19:47:14 +000050 test/env$(EXE)
David McGrewb67061f2005-09-28 14:23:06 +000051
Jonathan Lennox5df951a2010-05-20 20:55:54 +000052# data values used to test the aes_calc application for AES-128
53k128=000102030405060708090a0b0c0d0e0f
54p128=00112233445566778899aabbccddeeff
55c128=69c4e0d86a7b0430d8cdb78070b4c55a
Cullen Jennings235513a2005-09-21 22:51:36 +000056
Jonathan Lennox5df951a2010-05-20 20:55:54 +000057
58# data values used to test the aes_calc application for AES-256
59k256=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
60p256=00112233445566778899aabbccddeeff
61c256=8ea2b7ca516745bfeafc49904b496089
62
Cullen Jennings235513a2005-09-21 22:51:36 +000063
jfigus0d3a2682013-04-02 15:42:37 -040064runtest: $(testapp)
Marcus Sundberg10050ee2005-10-02 19:51:45 +000065 test/env$(EXE) # print out information on the build environment
jfigus0d3a2682013-04-02 15:42:37 -040066 @echo "running crypto test applications..."
67ifneq (1, $(USE_OPENSSL))
Jonathan Lennox5df951a2010-05-20 20:55:54 +000068 test `test/aes_calc $(k128) $(p128)` = $(c128)
69 test `test/aes_calc $(k256) $(p256)` = $(c256)
jfigus0d3a2682013-04-02 15:42:37 -040070endif
Marcus Sundbergaefd6842005-10-02 19:47:14 +000071 test/cipher_driver$(EXE) -v >/dev/null
72 test/datatypes_driver$(EXE) -v >/dev/null
73 test/stat_driver$(EXE) >/dev/null
74 test/sha1_driver$(EXE) -v >/dev/null
75 test/kernel_driver$(EXE) -v >/dev/null
jfigus0d3a2682013-04-02 15:42:37 -040076 @echo "crypto test applications passed."
Cullen Jennings235513a2005-09-21 22:51:36 +000077
Cullen Jennings235513a2005-09-21 22:51:36 +000078
79# the rule for making object files and test apps
80
81%.o: %.c
Marcus Sundberg67a695d2005-09-29 14:10:05 +000082 $(COMPILE) -c $< -o $@
Cullen Jennings235513a2005-09-21 22:51:36 +000083
XIE Tianming6e70c612015-11-26 15:36:28 +080084%$(EXE): %.c $(srcdir)/../test/getopt_s.c
85 $(COMPILE) $(LDFLAGS) $< $(srcdir)/../test/getopt_s.c -o $@ $(CRYPTOLIB) $(LIBS)
Cullen Jennings235513a2005-09-21 22:51:36 +000086
jfigus0d3a2682013-04-02 15:42:37 -040087all: $(testapp)
Cullen Jennings235513a2005-09-21 22:51:36 +000088
Cullen Jennings235513a2005-09-21 22:51:36 +000089# housekeeping functions
90
91clean:
Cullen Jennings235513a2005-09-21 22:51:36 +000092 rm -f $(testapp) *.o */*.o
93 for a in * .* */*; do if [ -f "$$a~" ] ; then rm $$a~; fi; done;
94 rm -f `find . -name "*.[ch]~*~"`
95 rm -rf latex
96
97superclean: clean
98 rm -f *core TAGS ktrace.out
99
Cullen Jennings235513a2005-09-21 22:51:36 +0000100# EOF