]> git.ipfire.org Git - thirdparty/openssl.git/blob - fips-1.0/Makefile
Create libfips.a if needed.
[thirdparty/openssl.git] / fips-1.0 / Makefile
1 #
2 # OpenSSL/fips-1.0/Makefile
3 #
4
5 DIR= fips-1.0
6 TOP= ..
7 CC= cc
8 INCLUDE= -I. -I$(TOP) -I../include
9 INCLUDES= -I.. -I../.. -I../../include
10 CFLAG= -g
11 INSTALL_PREFIX=
12 OPENSSLDIR= /usr/local/ssl
13 INSTALLTOP= /usr/local/ssl
14 MAKEFILE= Makefile
15 MAKEDEPPROG= makedepend
16 MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
17 PERL= perl
18 RM= rm -f
19 AR= ar r
20 ARD= ar d
21
22 FIPSCANLOC= $(FIPSLIBDIR)fipscanister.o
23
24 PEX_LIBS=
25 EX_LIBS=
26
27 CFLAGS= $(INCLUDE) $(CFLAG) -DHMAC_EXT=\"$${HMAC_EXT:-sha1}\"
28
29
30 LIBS=
31
32 FDIRS=sha rand des aes dsa rsa dh hmac
33
34 GENERAL=Makefile README fips-lib.com install.com
35
36 LIB= $(TOP)/libcrypto.a
37 SHARED_LIB= libcrypto$(SHLIB_EXT)
38 LIBSRC=fips.c fips_err_wrapper.c
39 LIBOBJ=fips.o fips_err_wrapper.o
40
41 FIPS_OBJ_LISTS=sha/lib hmac/lib rand/lib des/lib aes/lib dsa/lib rsa/lib dh/lib
42
43 SRC= $(LIBSRC)
44
45 EXHEADER=fips.h
46 HEADER=$(EXHEADER) fips_err.h
47 EXE=fipsld
48 TEST=fips_test_suite.c
49
50 ALL= $(GENERAL) $(SRC) $(HEADER)
51
52 top:
53 @(cd ..; $(MAKE) DIRS=$(DIR) all)
54
55 all:
56 @if egrep 'define OPENSSL_FIPS' $(TOP)/include/openssl/opensslconf.h > /dev/null; then \
57 $(MAKE) -e subdirs lib shared; \
58 fi
59
60 # Idea behind fipscanister.o is to "seize" the sequestered code between
61 # known symbols for fingerprinting purposes, which would be commonly
62 # done with ld -r start.o ... end.o. The latter however presents a minor
63 # challenge on multi-ABI platforms. As just implied, we'd rather use ld,
64 # but the trouble is that we don't generally know how ABI-selection
65 # compiler flag is translated to corresponding linker flag. All compiler
66 # drivers seem to recognize -r flag and pass it down to linker, but some
67 # of them, including gcc, erroneously add -lc, as well as run-time
68 # components, such as crt1.o and alike. Fortunately among those vendor
69 # compilers which were observed to misinterpret -r flag multi-ABI ones
70 # are equipped with smart linkers, which don't require any ABI-selection
71 # flag and simply assume that all objects are of the same type as first
72 # one in command line. So the idea is to identify gcc and deficient
73 # vendor compiler drivers...
74
75 fipscanister.o: fips_start.o $(LIBOBJ) $(FIPS_OBJ_LISTS) fips_end.o
76 @FIPS_BN_ASM=`for i in $(BN_ASM) ; do echo -n "../crypto/bn/$$i " ; done`; \
77 objs="fips_start.o $(LIBOBJ) $(FIPS_EX_OBJ) $$FIPS_BN_ASM"; \
78 for i in $(FIPS_OBJ_LISTS); do \
79 dir=`dirname $$i`; script="s|^|$$dir/|;s| | $$dir/|g"; \
80 objs="$$objs `sed "$$script" $$i`"; \
81 done; \
82 objs="$$objs fips_end.o" ; \
83 if [ -n "${FIPS_SITE_LD}" ]; then \
84 set -x; ${FIPS_SITE_LD} -r -o $@ $$objs; \
85 elif $(CC) -dumpversion >/dev/null 2>&1; then \
86 set -x; $(CC) $(CFLAGS) -r -nostdlib -o $@ $$objs ; \
87 else case "`(uname -s) 2>/dev/null`" in \
88 HP-UX|OSF1|SunOS) set -x; /usr/ccs/bin/ld -r -o $@ $$objs ;; \
89 *) set -x; $(CC) $(CFLAGS) -r -o $@ $$objs ;; \
90 esac fi
91 sha/fips_standalone_sha1 fipscanister.o > fipscanister.o.sha1
92
93 # If another exception is immediately required, assign approprite
94 # site-specific ld command to FIPS_SITE_LD environment variable.
95
96 fips_start.o: fips_canister.c
97 $(CC) $(CFLAGS) -DFIPS_START -c -o $@ fips_canister.c
98 fips_end.o: fips_canister.c
99 $(CC) $(CFLAGS) -DFIPS_END -c -o $@ fips_canister.c
100 fips_premain_dso$(EXE_EXT): fips_premain.c
101 $(CC) $(CFLAGS) -DFINGERPRINT_PREMAIN_DSO_LOAD -o $@ fips_premain.c \
102 ../libcrypto.a $(EX_LIBS)
103
104 subdirs:
105 @for i in $(FDIRS) ;\
106 do \
107 (cd $$i && echo "making all in fips/$$i..." && \
108 $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' FIPS_DES_ENC='${FIPS_DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' FIPS_SHA1_ASM_OBJ='${FIPS_SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' all ) || exit 1; \
109 done;
110
111 sub_target:
112 @for i in $(FDIRS) ;\
113 do \
114 (cd $$i && echo "making $(TARGET) in fips/$$i..." && \
115 $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' FIPS_DES_ENC='${FIPS_DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' FIPS_SHA1_ASM_OBJ='${FIPS_SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' $(TARGET) ) || exit 1; \
116 done;
117
118 files:
119 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
120 @for i in $(FDIRS) ;\
121 do \
122 (cd $$i && echo "making 'files' in fips/$$i..." && \
123 $(MAKE) PERL='${PERL}' files ); \
124 done;
125
126 links:
127 @$(PERL) $(TOP)/util/mklink.pl $(TOP)/include/openssl $(EXHEADER)
128 @$(PERL) $(TOP)/util/mklink.pl $(TOP)/test $(TEST)
129 @for i in $(FDIRS); do \
130 (cd $$i && echo "making links in fips/$$i..." && \
131 $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' FIPS_DES_ENC='${FIPS_DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' FIPS_SHA1_ASM_OBJ='${FIPS_SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PERL='${PERL}' links ); \
132 done;
133
134 lib: $(FIPSCANLOC) delexobj
135 $(AR) ../$(FIPSCANLIB).a $(FIPSCANLOC)
136 $(RANLIB) ../$(FIPSCANLIB).a || echo Never mind.
137 @touch lib
138
139 shared: fips_premain_dso$(EXE_EXT)
140 if [ -n "$(SHARED_LIBS)" -a "$(FIPSCANLIB)" != "libfips" ]; then \
141 (cd ..; $(MAKE) FIPSLD_CC=$(CC) FIPSLD=fips-1.0/fipsld $(SHARED_LIB)); \
142 fi
143
144 libs:
145 @for i in $(FDIRS) ;\
146 do \
147 (cd $$i && echo "making libs in fips/$$i..." && \
148 $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' AR='${AR}' lib ); \
149 done;
150
151 tests:
152 (cd ..; make DIRS=test)
153
154 fips_test: top tests
155 @for i in dsa sha aes des hmac rand rsa; \
156 do \
157 (cd $$i && echo "making fips_test in fips/$$i..." && $(MAKE) fips_test) \
158 done;
159
160 install:
161 @headerlist="$(EXHEADER)"; for i in $$headerlist ;\
162 do \
163 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
164 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
165 done;
166 @for i in $(FDIRS) ;\
167 do \
168 (cd $$i && echo "making install in fips/$$i..." && \
169 $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' install ); \
170 done;
171 @for i in $(EXE) ; \
172 do \
173 echo "installing $$i"; \
174 cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
175 chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
176 mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \
177 done
178 @cp -p -f fipscanister.o fipscanister.o.sha1 fips_premain.c \
179 fips_premain.c.sha1 \
180 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/; \
181 chmod 0444 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/fips*
182
183 lint:
184 @for i in $(FDIRS) ;\
185 do \
186 (cd $$i && echo "making lint in fips/$$i..." && \
187 $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' lint ); \
188 done;
189
190 depend:
191 if [ ! -f buildinf.h ]; then touch buildinf.h; fi # fake buildinf.h if it does not exist
192 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(SRC)
193 if [ ! -s buildinf.h ]; then rm buildinf.h; fi
194 @for i in $(FDIRS) ;\
195 do \
196 (cd $$i && echo "making depend in fips/$$i..." && \
197 $(MAKE) MAKEFILE='${MAKEFILE}' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' DEPFLAG='${DEPFLAG}' MAKEDEPPROG='${MAKEDEPPROG}' KRB5_INCLUDES='${KRB5_INCLUDES}' PERL='${PERL}' depend ); \
198 done;
199
200 clean:
201 rm -f buildinf.h *.o fipscanister.o.sha1 *.obj fips_premain_dso$(EXE_EXT) lib tags core .pure .nfs* *.old *.bak fluff
202 @for i in $(FDIRS) ;\
203 do \
204 (cd $$i && echo "making clean in fips/$$i..." && \
205 $(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' clean ); \
206 done;
207
208 dclean:
209 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
210 mv -f Makefile.new $(MAKEFILE)
211 @for i in $(FDIRS) ;\
212 do \
213 (cd $$i && echo "making dclean in fips/$$i..." && \
214 $(MAKE) PERL='${PERL}' CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' dclean ); \
215 done;
216
217 delexobj:
218 exdel=""; \
219 for i in $(FIPS_EX_OBJ) $(BN_ASM);\
220 do \
221 exdel="$$exdel "`basename $$i`""; \
222 done ; \
223 $(ARD) $(LIB) $$exdel
224
225 FIPS_EX_OBJ= ../crypto/aes/aes_cbc.o \
226 ../crypto/aes/aes_cfb.o \
227 ../crypto/aes/aes_ecb.o \
228 ../crypto/aes/aes_ofb.o \
229 ../crypto/bio/bio_lib.o \
230 ../crypto/bio/b_print.o \
231 ../crypto/bio/bss_file.o \
232 ../crypto/bn/bn_add.o \
233 ../crypto/bn/bn_blind.o \
234 ../crypto/bn/bn_ctx.o \
235 ../crypto/bn/bn_div.o \
236 ../crypto/bn/bn_exp2.o \
237 ../crypto/bn/bn_exp.o \
238 ../crypto/bn/bn_gcd.o \
239 ../crypto/bn/bn_lib.o \
240 ../crypto/bn/bn_mod.o \
241 ../crypto/bn/bn_mont.o \
242 ../crypto/bn/bn_mul.o \
243 ../crypto/bn/bn_prime.o \
244 ../crypto/bn/bn_print.o \
245 ../crypto/bn/bn_rand.o \
246 ../crypto/bn/bn_recp.o \
247 ../crypto/bn/bn_shift.o \
248 ../crypto/bn/bn_sqr.o \
249 ../crypto/bn/bn_word.o \
250 ../crypto/bn/bn_x931p.o \
251 ../crypto/buffer/buffer.o \
252 ../crypto/cryptlib.o \
253 ../crypto/des/cfb64ede.o \
254 ../crypto/des/cfb64enc.o \
255 ../crypto/des/cfb_enc.o \
256 ../crypto/des/des_enc.o \
257 ../crypto/des/ecb3_enc.o \
258 ../crypto/des/ecb_enc.o \
259 ../crypto/des/ofb64ede.o \
260 ../crypto/des/ofb64enc.o \
261 ../crypto/dh/dh_lib.o \
262 ../crypto/dsa/dsa_lib.o \
263 ../crypto/dsa/dsa_sign.o \
264 ../crypto/dsa/dsa_vrf.o \
265 ../crypto/engine/eng_init.o \
266 ../crypto/engine/eng_lib.o \
267 ../crypto/engine/eng_list.o \
268 ../crypto/engine/eng_table.o \
269 ../crypto/engine/tb_dh.o \
270 ../crypto/engine/tb_digest.o \
271 ../crypto/engine/tb_dsa.o \
272 ../crypto/engine/tb_rand.o \
273 ../crypto/engine/tb_rsa.o \
274 ../crypto/err/err.o \
275 ../crypto/err/err_prn.o \
276 ../crypto/evp/digest.o \
277 ../crypto/evp/m_sha1.o \
278 ../crypto/evp/p_sign.o \
279 ../crypto/evp/p_verify.o \
280 ../crypto/ex_data.o \
281 ../crypto/lhash/lhash.o \
282 ../crypto/mem_clr.o \
283 ../crypto/mem_dbg.o \
284 ../crypto/mem.o \
285 ../crypto/rand/md_rand.o \
286 ../crypto/rand/rand_egd.o \
287 ../crypto/rand/randfile.o \
288 ../crypto/rand/rand_lib.o \
289 ../crypto/rand/rand_os2.o \
290 ../crypto/rand/rand_unix.o \
291 ../crypto/rand/rand_win.o \
292 ../crypto/rsa/rsa_lib.o \
293 ../crypto/rsa/rsa_none.o \
294 ../crypto/rsa/rsa_oaep.o \
295 ../crypto/rsa/rsa_pk1.o \
296 ../crypto/rsa/rsa_pss.o \
297 ../crypto/rsa/rsa_ssl.o \
298 ../crypto/rsa/rsa_x931.o \
299 ../crypto/stack/stack.o \
300 ../crypto/uid.o \
301 ../crypto/x509v3/v3_hex.o
302
303 # DO NOT DELETE THIS LINE -- make depend depends on it.
304
305 fips.o: ../include/openssl/aes.h ../include/openssl/asn1.h
306 fips.o: ../include/openssl/bio.h ../include/openssl/blowfish.h
307 fips.o: ../include/openssl/bn.h ../include/openssl/cast.h
308 fips.o: ../include/openssl/crypto.h ../include/openssl/des.h
309 fips.o: ../include/openssl/des_old.h ../include/openssl/dh.h
310 fips.o: ../include/openssl/dsa.h ../include/openssl/e_os2.h
311 fips.o: ../include/openssl/err.h ../include/openssl/evp.h
312 fips.o: ../include/openssl/fips.h ../include/openssl/fips_rand.h
313 fips.o: ../include/openssl/hmac.h ../include/openssl/idea.h
314 fips.o: ../include/openssl/lhash.h ../include/openssl/md2.h
315 fips.o: ../include/openssl/md4.h ../include/openssl/md5.h
316 fips.o: ../include/openssl/mdc2.h ../include/openssl/obj_mac.h
317 fips.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
318 fips.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h
319 fips.o: ../include/openssl/rand.h ../include/openssl/rc2.h
320 fips.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
321 fips.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
322 fips.o: ../include/openssl/safestack.h ../include/openssl/sha.h
323 fips.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
324 fips.o: ../include/openssl/ui.h ../include/openssl/ui_compat.h fips.c
325 fips.o: fips_locl.h
326 fips_err_wrapper.o: ../include/openssl/opensslconf.h fips_err_wrapper.c