OLD | NEW |
| (Empty) |
1 # | |
2 # OpenSSL/crypto/Makefile | |
3 # | |
4 | |
5 DIR= fips | |
6 TOP= .. | |
7 CC= cc | |
8 INCLUDE= -I. -I$(TOP) -I../include | |
9 # INCLUDES targets sudbirs! | |
10 INCLUDES= -I.. -I../.. -I../../include | |
11 CFLAG= -g | |
12 MAKEDEPPROG= makedepend | |
13 MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | |
14 MAKEFILE= Makefile | |
15 RM= rm -f | |
16 AR= ar r | |
17 ARD= ar d | |
18 TEST= fips_test_suite.c | |
19 FIPS_TVDIR= testvectors | |
20 FIPS_TVOK= $$HOME/fips/tv.ok | |
21 | |
22 FIPSCANLOC= $(FIPSLIBDIR)fipscanister.o | |
23 | |
24 RECURSIVE_MAKE= [ -n "$(FDIRS)" ] && for i in $(FDIRS) ; do \ | |
25 (cd $$i && echo "making $$target in $(DIR)/$$i..." && \ | |
26 $(MAKE) -e TOP=../.. DIR=$$i INCLUDES='${INCLUDES}' $$target
) || exit 1; \ | |
27 done; | |
28 | |
29 PEX_LIBS= | |
30 EX_LIBS= | |
31 | |
32 CFLAGS= $(INCLUDE) $(CFLAG) -DHMAC_EXT=\"$${HMAC_EXT:-sha1}\" | |
33 ASFLAGS= $(INCLUDE) $(ASFLAG) | |
34 AFLAGS=$(ASFLAGS) | |
35 | |
36 LIBS= | |
37 | |
38 FDIRS=sha rand des aes dsa rsa dh hmac | |
39 | |
40 GENERAL=Makefile README fips-lib.com install.com | |
41 | |
42 LIB= $(TOP)/libcrypto.a | |
43 SHARED_LIB= $(FIPSCANLIB)$(SHLIB_EXT) | |
44 LIBSRC=fips.c | |
45 LIBOBJ=fips.o | |
46 | |
47 FIPS_OBJ_LISTS=sha/lib hmac/lib rand/lib des/lib aes/lib dsa/lib rsa/lib dh/lib | |
48 | |
49 SRC= $(LIBSRC) | |
50 | |
51 EXHEADER=fips.h | |
52 HEADER=$(EXHEADER) fips_utl.h fips_locl.h | |
53 EXE=fipsld | |
54 | |
55 ALL= $(GENERAL) $(SRC) $(HEADER) | |
56 | |
57 top: | |
58 @(cd ..; $(MAKE) DIRS=$(DIR) all) | |
59 | |
60 testapps: | |
61 @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; f
i | |
62 | |
63 all: | |
64 @if [ -z "$(FIPSLIBDIR)" ]; then \ | |
65 $(MAKE) -e subdirs lib fips_premain_dso$(EXE_EXT); \ | |
66 else \ | |
67 $(MAKE) -e lib fips_premain_dso$(EXE_EXT) fips_standalone_sha1$(
EXE_EXT); \ | |
68 fi | |
69 | |
70 # Idea behind fipscanister.o is to "seize" the sequestered code between | |
71 # known symbols for fingerprinting purposes, which would be commonly | |
72 # done with ld -r start.o ... end.o. The latter however presents a minor | |
73 # challenge on multi-ABI platforms. As just implied, we'd rather use ld, | |
74 # but the trouble is that we don't generally know how ABI-selection | |
75 # compiler flag is translated to corresponding linker flag. All compiler | |
76 # drivers seem to recognize -r flag and pass it down to linker, but some | |
77 # of them, including gcc, erroneously add -lc, as well as run-time | |
78 # components, such as crt1.o and alike. Fortunately among those vendor | |
79 # compilers which were observed to misinterpret -r flag multi-ABI ones | |
80 # are equipped with smart linkers, which don't require any ABI-selection | |
81 # flag and simply assume that all objects are of the same type as first | |
82 # one in command line. So the idea is to identify gcc and deficient | |
83 # vendor compiler drivers... | |
84 | |
85 fipscanister.o: fips_start.o $(LIBOBJ) $(FIPS_OBJ_LISTS) fips_end.o | |
86 FIPS_ASM=""; \ | |
87 list="$(BN_ASM)"; for i in $$list; do FIPS_ASM="$$FIPS_ASM ../crypto/bn/
$$i" ; done; \ | |
88 list="$(AES_ASM_OBJ)"; for i in $$list; do FIPS_ASM="$$FIPS_ASM ../crypt
o/aes/$$i" ; done; \ | |
89 list="$(DES_ENC)"; for i in $$list; do FIPS_ASM="$$FIPS_ASM ../crypto/de
s/$$i" ; done; \ | |
90 list="$(SHA1_ASM_OBJ)"; for i in $$list; do FIPS_ASM="$$FIPS_ASM ../cryp
to/sha/$$i" ; done; \ | |
91 if [ -n "$(CPUID_OBJ)" ]; then \ | |
92 CPUID=../crypto/$(CPUID_OBJ) ; \ | |
93 else \ | |
94 CPUID="" ; \ | |
95 fi ; \ | |
96 objs="fips_start.o $(LIBOBJ) $(FIPS_EX_OBJ) $$CPUID $$FIPS_ASM"; \ | |
97 for i in $(FIPS_OBJ_LISTS); do \ | |
98 dir=`dirname $$i`; script="s|^|$$dir/|;s| | $$dir/|g"; \ | |
99 objs="$$objs `sed "$$script" $$i`"; \ | |
100 done; \ | |
101 objs="$$objs fips_end.o" ; \ | |
102 os="`(uname -s) 2>/dev/null`"; cflags="$(CFLAGS)"; \ | |
103 [ "$$os" = "AIX" ] && cflags="$$cflags -Wl,-bnoobjreorder"; \ | |
104 if [ -n "${FIPS_SITE_LD}" ]; then \ | |
105 set -x; ${FIPS_SITE_LD} -r -o $@ $$objs; \ | |
106 elif $(CC) -dumpversion >/dev/null 2>&1; then \ | |
107 set -x; $(CC) $$cflags -r -nostdlib -o $@ $$objs ; \ | |
108 else case "$$os" in \ | |
109 HP-UX|OSF1|SunOS) set -x; /usr/ccs/bin/ld -r -o $@ $$objs ;; \ | |
110 *) set -x; $(CC) $$cflags -r -o $@ $$objs ;; \ | |
111 esac fi | |
112 ./fips_standalone_sha1$(EXE_EXT) fipscanister.o > fipscanister.o.sha1 | |
113 | |
114 # If another exception is immediately required, assign approprite | |
115 # site-specific ld command to FIPS_SITE_LD environment variable. | |
116 | |
117 fips_start.o: fips_canister.c | |
118 $(CC) $(CFLAGS) -DFIPS_START -c -o $@ fips_canister.c | |
119 fips_end.o: fips_canister.c | |
120 $(CC) $(CFLAGS) -DFIPS_END -c -o $@ fips_canister.c | |
121 fips_premain_dso$(EXE_EXT): fips_premain.c | |
122 $(CC) $(CFLAGS) -DFINGERPRINT_PREMAIN_DSO_LOAD -o $@ fips_premain.c \ | |
123 $(FIPSLIBDIR)fipscanister.o ../libcrypto.a $(EX_LIBS) | |
124 # this is executed only when linking with external fipscanister.o | |
125 fips_standalone_sha1$(EXE_EXT): sha/fips_standalone_sha1.c | |
126 if [ -z "$(HOSTCC)" ] ; then \ | |
127 $(CC) $(CFLAGS) -DFIPSCANISTER_O -o $@ sha/fips_standalone_sha1.
c $(FIPSLIBDIR)fipscanister.o $(EX_LIBS) ; \ | |
128 else \ | |
129 $(HOSTCC) $(HOSTCFLAGS) -o $ $@ -I../include -I../crypto sha/fip
s_standalone_sha1.c ../crypto/sha/sha1dgst.c ; \ | |
130 fi | |
131 | |
132 subdirs: | |
133 @target=all; $(RECURSIVE_MAKE) | |
134 | |
135 files: | |
136 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | |
137 @target=files; $(RECURSIVE_MAKE) | |
138 | |
139 links: | |
140 @$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER) | |
141 @$(PERL) $(TOP)/util/mklink.pl ../test $(TEST) | |
142 @target=links; $(RECURSIVE_MAKE) | |
143 | |
144 # lib: and $(LIB): are splitted to avoid end-less loop | |
145 lib: $(LIB) | |
146 if [ "$(FIPSCANISTERINTERNAL)" = "n" -a -n "$(FIPSCANLOC)" ]; then $(AR)
../$(FIPSCANLIB).a $(FIPSCANLOC); fi | |
147 @touch lib | |
148 | |
149 $(LIB): $(FIPSLIBDIR)fipscanister.o | |
150 $(AR) $(LIB) $(FIPSLIBDIR)fipscanister.o | |
151 $(RANLIB) $(LIB) || echo Never mind. | |
152 | |
153 $(FIPSCANLIB): $(FIPSCANLOC) | |
154 $(AR) ../$(FIPSCANLIB).a $(FIPSCANLOC) | |
155 if [ "$(FIPSCANLIB)" = "libfips" ]; then \ | |
156 $(AR) $(LIB) $(FIPSCANLOC) ; \ | |
157 $(RANLIB) $(LIB) || echo Never Mind. ; \ | |
158 fi | |
159 $(RANLIB) ../$(FIPSCANLIB).a || echo Never mind. | |
160 @touch lib | |
161 | |
162 shared: lib subdirs fips_premain_dso$(EXE_EXT) | |
163 | |
164 libs: | |
165 @target=lib; $(RECURSIVE_MAKE) | |
166 | |
167 fips_test: top | |
168 @target=fips_test; $(RECURSIVE_MAKE) | |
169 | |
170 fips_test_diff: | |
171 @if diff -b -B -I '^\#' -cr -X fips-nodiff.txt $(FIPS_TVDIR) $(FIPS_TVOK
) ; then \ | |
172 echo "FIPS diff OK" ; \ | |
173 else \ | |
174 echo "***FIPS DIFF ERROR***" ; exit 1 ; \ | |
175 fi | |
176 | |
177 | |
178 install: | |
179 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | |
180 @headerlist="$(EXHEADER)"; for i in $$headerlist ;\ | |
181 do \ | |
182 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | |
183 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | |
184 done; | |
185 @target=install; $(RECURSIVE_MAKE) | |
186 for i in $(EXE) ; \ | |
187 do \ | |
188 echo "installing $$i"; \ | |
189 cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ | |
190 chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \ | |
191 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFI
X)$(INSTALLTOP)/bin/$$i; \ | |
192 done | |
193 cp -p -f $(FIPSLIBDIR)fipscanister.o $(FIPSLIBDIR)fipscanister.o.sha1 \ | |
194 $(FIPSLIBDIR)fips_premain.c $(FIPSLIBDIR)fips_premain.c.sha1 \ | |
195 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/; \ | |
196 chmod 0444 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/fips* | |
197 | |
198 lint: | |
199 @target=lint; $(RECURSIVE_MAKE) | |
200 | |
201 depend: | |
202 @[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) --
$(PROGS) $(LIBSRC) | |
203 @[ -z "$(THIS)" ] || (set -e; target=depend; $(RECURSIVE_MAKE) ) | |
204 @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; f
i | |
205 | |
206 clean: | |
207 rm -f fipscanister.o.sha1 fips_premain_dso$(EXE_EXT) fips_standalone_sha
1$(EXE_EXT) \ | |
208 *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | |
209 @target=clean; $(RECURSIVE_MAKE) | |
210 | |
211 dclean: | |
212 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKE
FILE) >Makefile.new | |
213 mv -f Makefile.new $(MAKEFILE) | |
214 @target=dclean; $(RECURSIVE_MAKE) | |
215 | |
216 # DO NOT DELETE THIS LINE -- make depend depends on it. | |
217 | |
218 fips.o: ../include/openssl/asn1.h ../include/openssl/bio.h | |
219 fips.o: ../include/openssl/crypto.h ../include/openssl/des.h | |
220 fips.o: ../include/openssl/des_old.h ../include/openssl/e_os2.h | |
221 fips.o: ../include/openssl/err.h ../include/openssl/evp.h | |
222 fips.o: ../include/openssl/fips.h ../include/openssl/fips_rand.h | |
223 fips.o: ../include/openssl/hmac.h ../include/openssl/lhash.h | |
224 fips.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h | |
225 fips.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | |
226 fips.o: ../include/openssl/ossl_typ.h ../include/openssl/rand.h | |
227 fips.o: ../include/openssl/rsa.h ../include/openssl/safestack.h | |
228 fips.o: ../include/openssl/stack.h ../include/openssl/symhacks.h | |
229 fips.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h fips.c | |
230 fips.o: fips_locl.h | |
OLD | NEW |