jfigus | 8aa936e | 2014-11-06 10:16:35 -0500 | [diff] [blame] | 1 | # Makefile for crypto test suite |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 2 | # |
| 3 | # David A. McGrew |
| 4 | # Cisco Systems, Inc. |
| 5 | |
Marcus Sundberg | 67a695d | 2005-09-29 14:10:05 +0000 | [diff] [blame] | 6 | srcdir = @srcdir@ |
| 7 | top_srcdir = @top_srcdir@ |
| 8 | top_builddir = @top_builddir@ |
| 9 | VPATH = @srcdir@ |
| 10 | |
| 11 | CC = @CC@ |
Joachim Bauch | 4cdf467 | 2015-03-27 16:56:43 +0100 | [diff] [blame] | 12 | INCDIR = -Iinclude -I$(srcdir)/include -I$(top_srcdir)/include |
Marcus Sundberg | 67a695d | 2005-09-29 14:10:05 +0000 | [diff] [blame] | 13 | DEFS = @DEFS@ |
| 14 | CPPFLAGS= @CPPFLAGS@ |
| 15 | CFLAGS = @CFLAGS@ |
| 16 | LIBS = @LIBS@ |
jfigus | 0d3a268 | 2013-04-02 15:42:37 -0400 | [diff] [blame] | 17 | LDFLAGS = @LDFLAGS@ -L. -L.. |
Marcus Sundberg | 67a695d | 2005-09-29 14:10:05 +0000 | [diff] [blame] | 18 | COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS) |
jfigus | fe1f3ef | 2014-11-21 16:31:44 -0500 | [diff] [blame] | 19 | CRYPTOLIB = -lsrtp2 |
Marcus Sundberg | 67a695d | 2005-09-29 14:10:05 +0000 | [diff] [blame] | 20 | |
| 21 | RANLIB = @RANLIB@ |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 22 | |
Marcus Sundberg | aefd684 | 2005-10-02 19:47:14 +0000 | [diff] [blame] | 23 | # 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 |
| 26 | EXE = @EXE@ |
Marcus Sundberg | 5c714e4 | 2005-10-03 15:16:06 +0000 | [diff] [blame] | 27 | # Random source. |
jfigus | 0d3a268 | 2013-04-02 15:42:37 -0400 | [diff] [blame] | 28 | USE_OPENSSL = @USE_OPENSSL@ |
Marcus Sundberg | aefd684 | 2005-10-02 19:47:14 +0000 | [diff] [blame] | 29 | |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 30 | ifdef ARCH |
Marcus Sundberg | 67a695d | 2005-09-29 14:10:05 +0000 | [diff] [blame] | 31 | DEFS += -D$(ARCH)=1 |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 32 | endif |
| 33 | |
| 34 | ifdef sysname |
Marcus Sundberg | 67a695d | 2005-09-29 14:10:05 +0000 | [diff] [blame] | 35 | DEFS += -D$(sysname)=1 |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 36 | endif |
| 37 | |
| 38 | .PHONY: dummy all runtest clean superclean |
| 39 | |
| 40 | dummy : all runtest |
| 41 | |
David McGrew | b67061f | 2005-09-28 14:23:06 +0000 | [diff] [blame] | 42 | # test applications |
jfigus | 0d3a268 | 2013-04-02 15:42:37 -0400 | [diff] [blame] | 43 | ifneq (1, $(USE_OPENSSL)) |
| 44 | AES_CALC = test/aes_calc$(EXE) |
| 45 | endif |
David McGrew | b67061f | 2005-09-28 14:23:06 +0000 | [diff] [blame] | 46 | |
Marcus Sundberg | aefd684 | 2005-10-02 19:47:14 +0000 | [diff] [blame] | 47 | testapp = test/cipher_driver$(EXE) test/datatypes_driver$(EXE) \ |
| 48 | test/stat_driver$(EXE) test/sha1_driver$(EXE) \ |
jfigus | 339b61d | 2014-11-04 15:36:15 -0500 | [diff] [blame] | 49 | test/kernel_driver$(EXE) $(AES_CALC) \ |
Marcus Sundberg | aefd684 | 2005-10-02 19:47:14 +0000 | [diff] [blame] | 50 | test/env$(EXE) |
David McGrew | b67061f | 2005-09-28 14:23:06 +0000 | [diff] [blame] | 51 | |
Jonathan Lennox | 5df951a | 2010-05-20 20:55:54 +0000 | [diff] [blame] | 52 | # data values used to test the aes_calc application for AES-128 |
| 53 | k128=000102030405060708090a0b0c0d0e0f |
| 54 | p128=00112233445566778899aabbccddeeff |
| 55 | c128=69c4e0d86a7b0430d8cdb78070b4c55a |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 56 | |
Jonathan Lennox | 5df951a | 2010-05-20 20:55:54 +0000 | [diff] [blame] | 57 | |
| 58 | # data values used to test the aes_calc application for AES-256 |
| 59 | k256=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f |
| 60 | p256=00112233445566778899aabbccddeeff |
| 61 | c256=8ea2b7ca516745bfeafc49904b496089 |
| 62 | |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 63 | |
jfigus | 0d3a268 | 2013-04-02 15:42:37 -0400 | [diff] [blame] | 64 | runtest: $(testapp) |
Marcus Sundberg | 10050ee | 2005-10-02 19:51:45 +0000 | [diff] [blame] | 65 | test/env$(EXE) # print out information on the build environment |
jfigus | 0d3a268 | 2013-04-02 15:42:37 -0400 | [diff] [blame] | 66 | @echo "running crypto test applications..." |
| 67 | ifneq (1, $(USE_OPENSSL)) |
Jonathan Lennox | 5df951a | 2010-05-20 20:55:54 +0000 | [diff] [blame] | 68 | test `test/aes_calc $(k128) $(p128)` = $(c128) |
| 69 | test `test/aes_calc $(k256) $(p256)` = $(c256) |
jfigus | 0d3a268 | 2013-04-02 15:42:37 -0400 | [diff] [blame] | 70 | endif |
Marcus Sundberg | aefd684 | 2005-10-02 19:47:14 +0000 | [diff] [blame] | 71 | 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 |
jfigus | 0d3a268 | 2013-04-02 15:42:37 -0400 | [diff] [blame] | 76 | @echo "crypto test applications passed." |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 77 | |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 78 | |
| 79 | # the rule for making object files and test apps |
| 80 | |
| 81 | %.o: %.c |
Marcus Sundberg | 67a695d | 2005-09-29 14:10:05 +0000 | [diff] [blame] | 82 | $(COMPILE) -c $< -o $@ |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 83 | |
XIE Tianming | 6e70c61 | 2015-11-26 15:36:28 +0800 | [diff] [blame] | 84 | %$(EXE): %.c $(srcdir)/../test/getopt_s.c |
| 85 | $(COMPILE) $(LDFLAGS) $< $(srcdir)/../test/getopt_s.c -o $@ $(CRYPTOLIB) $(LIBS) |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 86 | |
jfigus | 0d3a268 | 2013-04-02 15:42:37 -0400 | [diff] [blame] | 87 | all: $(testapp) |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 88 | |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 89 | # housekeeping functions |
| 90 | |
| 91 | clean: |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 92 | 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 | |
| 97 | superclean: clean |
| 98 | rm -f *core TAGS ktrace.out |
| 99 | |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 100 | # EOF |