xref: /freebsd/secure/lib/libcrypto/Makefile.asm (revision f126890ac5386406dadf7c4cfa9566cbb56537c5)
1# Use this to help generate the asm *.S files after an import.  It is not
2# perfect by any means, but does what is needed.
3# Do a 'make -f Makefile.asm all' and it will generate *.S.  Move them
4# to the arch subdir, and correct any exposed paths.
5
6.include "Makefile.inc"
7
8.if defined(ASM_aarch64)
9
10.PATH:	${LCRYPTO_SRC}/crypto \
11	${LCRYPTO_SRC}/crypto/aes/asm \
12	${LCRYPTO_SRC}/crypto/bn/asm \
13	${LCRYPTO_SRC}/crypto/chacha/asm \
14	${LCRYPTO_SRC}/crypto/ec/asm \
15	${LCRYPTO_SRC}/crypto/modes/asm \
16	${LCRYPTO_SRC}/crypto/poly1305/asm \
17	${LCRYPTO_SRC}/crypto/sha/asm
18
19PERLPATH=	-I${LCRYPTO_SRC}/crypto/perlasm
20
21# cpuid
22SRCS=	arm64cpuid.pl
23
24# aes
25SRCS+=	aesv8-armx.pl vpaes-armv8.pl
26
27# bn
28SRCS+=	armv8-mont.pl
29
30# chacha
31SRCS+=	chacha-armv8.pl
32
33# ec
34SRCS+=	ecp_nistz256-armv8.pl
35
36# modes
37SRCS+=	ghashv8-armx.pl aes-gcm-armv8_64.S
38
39# poly1305
40SRCS+=	poly1305-armv8.pl
41
42# sha
43SRCS+=	keccak1600-armv8.pl sha1-armv8.pl sha512-armv8.pl
44
45ASM=	${SRCS:R:S/$/.S/} sha256-armv8.S
46
47all:	${ASM}
48	rm -f ${ASM:R:S/$/.s/}
49	${CP} ${LCRYPTO_SRC}/crypto/arm_arch.h ../arm_arch.h
50
51CLEANFILES=	${ASM}
52.SUFFIXES:	.pl
53
54sha256-armv8.S:	sha512-armv8.pl
55	env CC=cc perl ${.ALLSRC} linux64 ${.TARGET:R:S/$/.s/}
56	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
57	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
58
59.pl.S:
60	env CC=cc perl ${.IMPSRC} linux64 ${.TARGET:R:S/$/.s/}
61	( echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
62	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
63
64.elif defined(ASM_amd64)
65
66.PATH:	${LCRYPTO_SRC}/crypto \
67	${LCRYPTO_SRC}/crypto/aes/asm \
68	${LCRYPTO_SRC}/crypto/bn/asm \
69	${LCRYPTO_SRC}/crypto/camellia/asm \
70	${LCRYPTO_SRC}/crypto/chacha/asm \
71	${LCRYPTO_SRC}/crypto/ec/asm \
72	${LCRYPTO_SRC}/crypto/md5/asm \
73	${LCRYPTO_SRC}/crypto/modes/asm \
74	${LCRYPTO_SRC}/crypto/poly1305/asm \
75	${LCRYPTO_SRC}/crypto/rc4/asm \
76	${LCRYPTO_SRC}/crypto/sha/asm \
77	${LCRYPTO_SRC}/crypto/whrlpool/asm \
78	${LCRYPTO_SRC}/engines/asm
79
80# cpuid
81SRCS=	x86_64cpuid.pl
82
83# aes
84SRCS+=	aes-x86_64.pl \
85	aesni-mb-x86_64.pl aesni-sha1-x86_64.pl aesni-sha256-x86_64.pl \
86	aesni-x86_64.pl bsaes-x86_64.pl vpaes-x86_64.pl
87
88# bn
89SRCS+=	rsaz-avx2.pl rsaz-avx512.pl rsaz-x86_64.pl x86_64-gf2m.pl \
90	x86_64-mont.pl x86_64-mont5.pl
91
92# camellia
93SRCS+=	cmll-x86_64.pl
94
95# chacha
96SRCS+=	chacha-x86_64.pl
97
98# ec
99SRCS+=	ecp_nistz256-x86_64.pl x25519-x86_64.pl
100
101# md5
102SRCS+=	md5-x86_64.pl
103
104# modes
105SRCS+=	aesni-gcm-x86_64.pl ghash-x86_64.pl
106
107# poly1305
108SRCS+=	poly1305-x86_64.pl
109
110# rc4
111SRCS+=	rc4-md5-x86_64.pl rc4-x86_64.pl
112
113# sha
114SRCS+=	keccak1600-x86_64.pl sha1-mb-x86_64.pl sha1-x86_64.pl \
115	sha256-mb-x86_64.pl
116
117# whrlpool
118SRCS+=	wp-x86_64.pl
119
120# engines
121SRCS+=	e_padlock-x86_64.pl
122
123SHA_ASM=	sha256-x86_64 sha512-x86_64
124SHA_SRC=	sha512-x86_64.pl
125SHA_TMP=	${SHA_ASM:S/$/.s/}
126
127ASM=	${SRCS:R:S/$/.S/} ${SHA_ASM:S/$/.S/}
128
129all:	${ASM}
130	rm -f ${SHA_TMP}
131
132CLEANFILES=	${ASM}
133.SUFFIXES:	.pl
134
135.pl.S:
136	( echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
137	env CC=cc perl ${.IMPSRC} elf ) > ${.TARGET}
138
139${SHA_TMP}: ${SHA_SRC}
140	env CC=cc perl ${.ALLSRC} elf ${.TARGET}
141
142.for s in ${SHA_ASM}
143${s}.S: ${s}.s
144	( echo '/* Do not modify. This file is auto-generated from ${SHA_SRC}. */' ;\
145	cat ${s}.s ) > ${.TARGET}
146.endfor
147
148.elif defined(ASM_arm)
149
150.PATH:	${LCRYPTO_SRC}/crypto \
151	${LCRYPTO_SRC}/crypto/aes/asm \
152	${LCRYPTO_SRC}/crypto/bn/asm \
153	${LCRYPTO_SRC}/crypto/chacha/asm \
154	${LCRYPTO_SRC}/crypto/ec/asm \
155	${LCRYPTO_SRC}/crypto/modes/asm \
156	${LCRYPTO_SRC}/crypto/poly1305/asm \
157	${LCRYPTO_SRC}/crypto/sha/asm
158
159PERLPATH=	-I${LCRYPTO_SRC}/crypto/perlasm
160
161# cpuid
162SRCS=	armv4cpuid.pl
163
164# aes
165SRCS+=	aes-armv4.pl aesv8-armx.pl bsaes-armv7.pl
166
167# bn
168SRCS+=	armv4-mont.pl armv4-gf2m.pl
169
170# chacha
171SRCS+=	chacha-armv4.pl
172
173# ec
174SRCS+=	ecp_nistz256-armv4.pl
175
176# modes
177SRCS+=	ghash-armv4.pl ghashv8-armx.pl
178
179# poly1305
180SRCS+=	poly1305-armv4.pl
181
182# sha
183SRCS+=	keccak1600-armv4.pl sha1-armv4-large.pl sha256-armv4.pl sha512-armv4.pl
184
185ASM=	${SRCS:R:S/$/.S/}
186
187all:	${ASM}
188	rm -f ${ASM:R:S/$/.s/}
189	${CP} ${LCRYPTO_SRC}/crypto/arm_arch.h ../arm_arch.h
190
191CLEANFILES=	${ASM}
192.SUFFIXES:	.pl
193
194.pl.S:
195	env CC=cc perl ${.IMPSRC} linux32 ${.TARGET:R:S/$/.s/}
196	( echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
197	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
198
199.elif defined(ASM_i386)
200
201.PATH:	${LCRYPTO_SRC}/crypto \
202	${LCRYPTO_SRC}/crypto/aes/asm \
203	${LCRYPTO_SRC}/crypto/bf/asm \
204	${LCRYPTO_SRC}/crypto/bn/asm \
205	${LCRYPTO_SRC}/crypto/camellia/asm \
206	${LCRYPTO_SRC}/crypto/cast/asm \
207	${LCRYPTO_SRC}/crypto/chacha/asm \
208	${LCRYPTO_SRC}/crypto/des/asm \
209	${LCRYPTO_SRC}/crypto/ec/asm \
210	${LCRYPTO_SRC}/crypto/md5/asm \
211	${LCRYPTO_SRC}/crypto/modes/asm \
212	${LCRYPTO_SRC}/crypto/poly1305/asm \
213	${LCRYPTO_SRC}/crypto/rc4/asm \
214	${LCRYPTO_SRC}/crypto/rc5/asm \
215	${LCRYPTO_SRC}/crypto/ripemd/asm \
216	${LCRYPTO_SRC}/crypto/sha/asm \
217	${LCRYPTO_SRC}/crypto/whrlpool/asm \
218	${LCRYPTO_SRC}/engines/asm
219
220#PERLPATH=	-I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm
221CFLAGS=	-DOPENSSL_IA32_SSE2
222
223# cpuid
224SRCS=	x86cpuid.pl
225
226# aes
227SRCS+=	aes-586.pl aesni-x86.pl vpaes-x86.pl
228
229# blowfish
230SRCS+=	bf-586.pl
231
232# bn
233SRCS+=	bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl
234
235# camellia
236SRCS+=	cmll-x86.pl
237
238# cast
239SRCS+=	cast-586.pl
240
241# chacha
242SRCS+=	chacha-x86.pl
243
244# des
245SRCS+=	crypt586.pl des-586.pl
246
247# ec
248SRCS+=	ecp_nistz256-x86.pl
249
250# md5
251SRCS+=	md5-586.pl
252
253# modes
254SRCS+=	ghash-x86.pl
255
256# poly1305
257SRCS+=	poly1305-x86.pl
258
259# rc4
260SRCS+=	rc4-586.pl
261
262# rc5
263SRCS+=	rc5-586.pl
264
265# ripemd
266SRCS+=	rmd-586.pl
267
268# sha
269SRCS+=	sha1-586.pl sha256-586.pl sha512-586.pl
270
271# whrlpool
272SRCS+=	wp-mmx.pl
273
274# engines
275SRCS+=	e_padlock-x86.pl
276
277ASM=	${SRCS:R:S/$/.S/}
278
279all:	${ASM}
280
281CLEANFILES=	${ASM}
282.SUFFIXES:	.pl
283
284.pl.S:
285	( echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
286	echo '#ifdef PIC' ;\
287	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic /dev/stdout ;\
288	echo '#else' ;\
289	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} /dev/stdout ;\
290	echo '#endif' ) > ${.TARGET}
291
292.elif defined(ASM_powerpc)
293
294.PATH:	${LCRYPTO_SRC}/crypto \
295	${LCRYPTO_SRC}/crypto/aes/asm \
296	${LCRYPTO_SRC}/crypto/bn/asm \
297	${LCRYPTO_SRC}/crypto/chacha/asm \
298	${LCRYPTO_SRC}/crypto/modes/asm \
299	${LCRYPTO_SRC}/crypto/poly1305/asm \
300	${LCRYPTO_SRC}/crypto/sha/asm
301
302PERLPATH=	-I${LCRYPTO_SRC}/crypto/perlasm
303
304#cpuid
305SRCS=	ppccpuid.pl
306
307#bn
308SRCS+=	ppc.pl ppc-mont.pl
309
310#aes
311SRCS+=	aes-ppc.pl vpaes-ppc.pl aesp8-ppc.pl
312
313#sha1
314SRCS+=	sha1-ppc.pl sha512-ppc.pl sha512p8-ppc.pl
315
316#modes
317SRCS+=	ghashp8-ppc.pl
318
319#chacha
320SRCS+=	chacha-ppc.pl
321
322#poly1305
323SRCS+=	poly1305-ppc.pl poly1305-ppcfp.pl
324
325ASM=	${SRCS:R:S/$/.S/} bn-ppc.S sha256-ppc.S sha256p8-ppc.S
326
327all:	${ASM}
328	rm -f ${ASM:R:S/$/.s/}
329
330CLEANFILES=	${ASM}
331.SUFFIXES:	.pl
332
333bn-ppc.S:	ppc.pl
334	env CC=cc perl ${.ALLSRC} linux32 ${.TARGET:R:S/$/.s/}
335	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
336	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
337
338sha256-ppc.S:	sha512-ppc.pl
339	env CC=cc perl ${.ALLSRC} linux32 ${.TARGET:R:S/$/.s/}
340	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
341	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
342
343sha256p8-ppc.S:	sha512p8-ppc.pl
344	env CC=cc perl ${.ALLSRC} linux32 ${.TARGET:R:S/$/.s/}
345	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
346	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
347
348.pl.S:
349	env CC=cc perl ${.IMPSRC} linux32 ${.TARGET:R:S/$/.s/}
350	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
351	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
352
353.elif defined(ASM_powerpc64)
354
355.PATH:	${LCRYPTO_SRC}/crypto \
356	${LCRYPTO_SRC}/crypto/aes/asm \
357	${LCRYPTO_SRC}/crypto/bn/asm \
358	${LCRYPTO_SRC}/crypto/chacha/asm \
359	${LCRYPTO_SRC}/crypto/ec/asm \
360	${LCRYPTO_SRC}/crypto/modes/asm \
361	${LCRYPTO_SRC}/crypto/poly1305/asm \
362	${LCRYPTO_SRC}/crypto/sha/asm
363
364PERLPATH=	-I${LCRYPTO_SRC}/crypto/perlasm
365
366#cpuid
367SRCS=	ppccpuid.pl
368
369#bn
370SRCS+=	ppc.pl ppc-mont.pl
371
372#aes
373SRCS+=	aes-ppc.pl vpaes-ppc.pl aesp8-ppc.pl
374
375#sha1
376SRCS+=	sha1-ppc.pl sha512-ppc.pl sha512p8-ppc.pl
377
378#modes
379SRCS+=	ghashp8-ppc.pl
380
381#chacha
382SRCS+=	chacha-ppc.pl
383
384#poly1305
385SRCS+=	poly1305-ppc.pl poly1305-ppcfp.pl
386
387#ec
388SRCS+=	ecp_nistp521-ppc64.pl ecp_nistz256-ppc64.pl x25519-ppc64.pl
389
390#keccak1600
391SRCS+=	keccak1600-ppc64.pl
392
393ASM=	${SRCS:R:S/$/.S/} bn-ppc.S sha256-ppc.S sha256p8-ppc.S
394
395all:	${ASM}
396	rm -f ${ASM:R:S/$/.s/}
397
398CLEANFILES=	${ASM}
399.SUFFIXES:	.pl
400
401bn-ppc.S:	ppc.pl
402	env CC=cc perl ${.ALLSRC} linux64v2 ${.TARGET:R:S/$/.s/}
403	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
404	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
405
406sha256-ppc.S:	sha512-ppc.pl
407	env CC=cc perl ${.ALLSRC} linux64v2 ${.TARGET:R:S/$/.s/}
408	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
409	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
410
411sha256p8-ppc.S:	sha512p8-ppc.pl
412	env CC=cc perl ${.ALLSRC} linux64v2 ${.TARGET:R:S/$/.s/}
413	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
414	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
415
416.pl.S:
417	env CC=cc perl ${.IMPSRC} linux64v2 ${.TARGET:R:S/$/.s/}
418	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
419	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
420
421.elif defined(ASM_powerpc64le)
422
423.PATH:	${LCRYPTO_SRC}/crypto \
424	${LCRYPTO_SRC}/crypto/aes/asm \
425	${LCRYPTO_SRC}/crypto/bn/asm \
426	${LCRYPTO_SRC}/crypto/chacha/asm \
427	${LCRYPTO_SRC}/crypto/ec/asm \
428	${LCRYPTO_SRC}/crypto/modes/asm \
429	${LCRYPTO_SRC}/crypto/poly1305/asm \
430	${LCRYPTO_SRC}/crypto/sha/asm
431
432PERLPATH=	-I${LCRYPTO_SRC}/crypto/perlasm
433
434#cpuid
435SRCS=	ppccpuid.pl
436
437#bn
438SRCS+=	ppc.pl ppc-mont.pl
439
440#aes
441SRCS+=	aes-ppc.pl vpaes-ppc.pl aesp8-ppc.pl
442
443#sha1
444SRCS+=	sha1-ppc.pl sha512-ppc.pl sha512p8-ppc.pl
445
446#modes
447SRCS+=	ghashp8-ppc.pl
448
449#chacha
450SRCS+=	chacha-ppc.pl
451
452#poly1305
453SRCS+=	poly1305-ppc.pl poly1305-ppcfp.pl
454
455#ec
456SRCS+=	ecp_nistp521-ppc64.pl ecp_nistz256-ppc64.pl x25519-ppc64.pl
457
458#keccak1600
459SRCS+=	keccak1600-ppc64.pl
460
461ASM=	${SRCS:R:S/$/.S/} bn-ppc.S sha256-ppc.S sha256p8-ppc.S
462
463all:	${ASM}
464	rm -f ${ASM:R:S/$/.s/}
465
466CLEANFILES=	${ASM}
467.SUFFIXES:	.pl
468
469bn-ppc.S:	ppc.pl
470	env CC=cc perl ${.ALLSRC} linux64le ${.TARGET:R:S/$/.s/}
471	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
472	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
473
474sha256-ppc.S:	sha512-ppc.pl
475	env CC=cc perl ${.ALLSRC} linux64le ${.TARGET:R:S/$/.s/}
476	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
477	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
478
479sha256p8-ppc.S:	sha512p8-ppc.pl
480	env CC=cc perl ${.ALLSRC} linux64le ${.TARGET:R:S/$/.s/}
481	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
482	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
483
484.pl.S:
485	env CC=cc perl ${.IMPSRC} linux64le ${.TARGET:R:S/$/.s/}
486	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
487	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
488
489.endif
490
491.include <bsd.prog.mk>
492