OLD | NEW |
1 # Makefile for libcryptomodule.a | 1 # Makefile for libcryptomodule.a |
2 # | 2 # |
3 # David A. McGrew | 3 # David A. McGrew |
4 # Cisco Systems, Inc. | 4 # Cisco Systems, Inc. |
5 | 5 |
6 srcdir = @srcdir@ | 6 srcdir = @srcdir@ |
7 top_srcdir = @top_srcdir@ | 7 top_srcdir = @top_srcdir@ |
8 top_builddir = @top_builddir@ | 8 top_builddir = @top_builddir@ |
9 VPATH = @srcdir@ | 9 VPATH = @srcdir@ |
10 | 10 |
11 CC = @CC@ | 11 CC = @CC@ |
12 INCDIR = -Iinclude -I$(srcdir)/include | 12 INCDIR = -Iinclude -I$(srcdir)/include |
13 DEFS = @DEFS@ | 13 DEFS = @DEFS@ |
14 CPPFLAGS= @CPPFLAGS@ | 14 CPPFLAGS= @CPPFLAGS@ |
15 CFLAGS = @CFLAGS@ | 15 CFLAGS = @CFLAGS@ |
16 LIBS = @LIBS@ | 16 LIBS = @LIBS@ |
17 LDFLAGS»= @LDFLAGS@ -L. | 17 LDFLAGS»= @LDFLAGS@ -L. -L.. |
18 COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS) | 18 COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS) |
19 CRYPTOLIB = -lcryptomodule | 19 CRYPTOLIB = -lsrtp |
20 | 20 |
21 RANLIB = @RANLIB@ | 21 RANLIB = @RANLIB@ |
22 | 22 |
23 # EXE defines the suffix on executables - it's .exe for cygwin, and | 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 | 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 | 25 # `make clean` will work on the cygwin platform |
26 EXE = @EXE@ | 26 EXE = @EXE@ |
27 # Random source. | 27 # Random source. |
28 RNG_OBJS = @RNG_OBJS@ | 28 USE_OPENSSL = @USE_OPENSSL@ |
29 | 29 |
30 ifdef ARCH | 30 ifdef ARCH |
31 DEFS += -D$(ARCH)=1 | 31 DEFS += -D$(ARCH)=1 |
32 endif | 32 endif |
33 | 33 |
34 ifdef sysname | 34 ifdef sysname |
35 DEFS += -D$(sysname)=1 | 35 DEFS += -D$(sysname)=1 |
36 endif | 36 endif |
37 | 37 |
38 .PHONY: dummy all runtest clean superclean | 38 .PHONY: dummy all runtest clean superclean |
39 | 39 |
40 dummy : all runtest | 40 dummy : all runtest |
41 | 41 |
42 # test applications | 42 # test applications |
| 43 ifneq (1, $(USE_OPENSSL)) |
| 44 AES_CALC = test/aes_calc$(EXE) |
| 45 endif |
43 | 46 |
44 testapp = test/cipher_driver$(EXE) test/datatypes_driver$(EXE) \ | 47 testapp = test/cipher_driver$(EXE) test/datatypes_driver$(EXE) \ |
45 test/stat_driver$(EXE) test/sha1_driver$(EXE) \ | 48 test/stat_driver$(EXE) test/sha1_driver$(EXE) \ |
46 » test/kernel_driver$(EXE) test/aes_calc$(EXE) test/rand_gen$(EXE) \ | 49 » test/kernel_driver$(EXE) $(AES_CALC) test/rand_gen$(EXE) \ |
47 test/env$(EXE) | 50 test/env$(EXE) |
48 | 51 |
49 # data values used to test the aes_calc application for AES-128 | 52 # data values used to test the aes_calc application for AES-128 |
50 k128=000102030405060708090a0b0c0d0e0f | 53 k128=000102030405060708090a0b0c0d0e0f |
51 p128=00112233445566778899aabbccddeeff | 54 p128=00112233445566778899aabbccddeeff |
52 c128=69c4e0d86a7b0430d8cdb78070b4c55a | 55 c128=69c4e0d86a7b0430d8cdb78070b4c55a |
53 | 56 |
54 | 57 |
55 # data values used to test the aes_calc application for AES-256 | 58 # data values used to test the aes_calc application for AES-256 |
56 k256=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f | 59 k256=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f |
57 p256=00112233445566778899aabbccddeeff | 60 p256=00112233445566778899aabbccddeeff |
58 c256=8ea2b7ca516745bfeafc49904b496089 | 61 c256=8ea2b7ca516745bfeafc49904b496089 |
59 | 62 |
60 | 63 |
61 runtest: libcryptomodule.a $(testapp) | 64 runtest: $(testapp) |
62 test/env$(EXE) # print out information on the build environment | 65 test/env$(EXE) # print out information on the build environment |
63 » @echo "running libcryptomodule test applications..." | 66 » @echo "running crypto test applications..." |
| 67 ifneq (1, $(USE_OPENSSL)) |
64 test `test/aes_calc $(k128) $(p128)` = $(c128) | 68 test `test/aes_calc $(k128) $(p128)` = $(c128) |
65 test `test/aes_calc $(k256) $(p256)` = $(c256) | 69 test `test/aes_calc $(k256) $(p256)` = $(c256) |
| 70 endif |
66 test/cipher_driver$(EXE) -v >/dev/null | 71 test/cipher_driver$(EXE) -v >/dev/null |
67 test/datatypes_driver$(EXE) -v >/dev/null | 72 test/datatypes_driver$(EXE) -v >/dev/null |
68 test/stat_driver$(EXE) >/dev/null | 73 test/stat_driver$(EXE) >/dev/null |
69 test/sha1_driver$(EXE) -v >/dev/null | 74 test/sha1_driver$(EXE) -v >/dev/null |
70 test/kernel_driver$(EXE) -v >/dev/null | 75 test/kernel_driver$(EXE) -v >/dev/null |
71 test/rand_gen$(EXE) -n 256 >/dev/null | 76 test/rand_gen$(EXE) -n 256 >/dev/null |
72 » @echo "libcryptomodule test applications passed." | 77 » @echo "crypto test applications passed." |
73 | 78 |
74 # libcryptomodule.a (the crypto engine) | |
75 | |
76 ciphers = cipher/cipher.o cipher/null_cipher.o \ | |
77 cipher/aes.o cipher/aes_icm.o \ | |
78 cipher/aes_cbc.o | |
79 | |
80 hashes = hash/null_auth.o hash/sha1.o \ | |
81 hash/hmac.o hash/auth.o | |
82 | |
83 math = math/datatypes.o math/stat.o | |
84 | |
85 rng = rng/$(RNG_OBJS) rng/rand_source.o rng/prng.o rng/ctr_prng.o | |
86 | |
87 err = kernel/err.o | |
88 | |
89 kernel = kernel/crypto_kernel.o kernel/alloc.o \ | |
90 kernel/key.o $(rng) $(err) | |
91 | |
92 xfm = ae_xfm/xfm.o | |
93 | |
94 cryptobj = $(ciphers) $(hashes) $(math) $(stat) $(kernel) $(xfm) | |
95 | 79 |
96 # the rule for making object files and test apps | 80 # the rule for making object files and test apps |
97 | 81 |
98 %.o: %.c | 82 %.o: %.c |
99 $(COMPILE) -c $< -o $@ | 83 $(COMPILE) -c $< -o $@ |
100 | 84 |
101 %$(EXE): %.c libcryptomodule.a | 85 %$(EXE): %.c |
102 $(COMPILE) $(LDFLAGS) $< -o $@ $(CRYPTOLIB) $(LIBS) | 86 $(COMPILE) $(LDFLAGS) $< -o $@ $(CRYPTOLIB) $(LIBS) |
103 | 87 |
104 ifndef AR | 88 all: $(testapp) |
105 AR=ar | |
106 endif | |
107 | |
108 # and the crypto module library itself | |
109 | |
110 libcryptomodule.a: $(cryptobj) | |
111 » $(AR) cr libcryptomodule.a $(cryptobj) | |
112 » $(RANLIB) libcryptomodule.a | |
113 | |
114 all: libcryptomodule.a $(testapp) | |
115 | 89 |
116 # housekeeping functions | 90 # housekeeping functions |
117 | 91 |
118 clean: | 92 clean: |
119 rm -f libcryptomodule.a | 93 rm -f libcryptomodule.a |
120 rm -f $(testapp) *.o */*.o | 94 rm -f $(testapp) *.o */*.o |
121 for a in * .* */*; do if [ -f "$$a~" ] ; then rm $$a~; fi; done; | 95 for a in * .* */*; do if [ -f "$$a~" ] ; then rm $$a~; fi; done; |
122 rm -f `find . -name "*.[ch]~*~"` | 96 rm -f `find . -name "*.[ch]~*~"` |
123 rm -rf latex | 97 rm -rf latex |
124 | 98 |
125 superclean: clean | 99 superclean: clean |
126 rm -f *core TAGS ktrace.out | 100 rm -f *core TAGS ktrace.out |
127 | 101 |
128 | 102 |
129 # the target 'package' builds a compressed tar archive of the source code | 103 # the target 'package' builds a compressed tar archive of the source code |
130 | 104 |
131 distname = crypto-$(shell cat VERSION) | 105 distname = crypto-$(shell cat VERSION) |
132 | 106 |
133 package: superclean | 107 package: superclean |
134 cd ..; tar cvzf $(distname).tgz crypto/ | 108 cd ..; tar cvzf $(distname).tgz crypto/ |
135 | 109 |
136 | 110 |
137 # EOF | 111 # EOF |
OLD | NEW |