xref: /freebsd/secure/lib/libcrypto/Makefile.asm (revision 1da7f3f6f72b2245e458fc7195733268ae4a1136)
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
190CLEANFILES=	${ASM}
191.SUFFIXES:	.pl
192
193.pl.S:
194	env CC=cc perl ${.IMPSRC} linux32 ${.TARGET:R:S/$/.s/}
195	( echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
196	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
197
198.elif defined(ASM_i386)
199
200.PATH:	${LCRYPTO_SRC}/crypto \
201	${LCRYPTO_SRC}/crypto/aes/asm \
202	${LCRYPTO_SRC}/crypto/bf/asm \
203	${LCRYPTO_SRC}/crypto/bn/asm \
204	${LCRYPTO_SRC}/crypto/camellia/asm \
205	${LCRYPTO_SRC}/crypto/cast/asm \
206	${LCRYPTO_SRC}/crypto/chacha/asm \
207	${LCRYPTO_SRC}/crypto/des/asm \
208	${LCRYPTO_SRC}/crypto/ec/asm \
209	${LCRYPTO_SRC}/crypto/md5/asm \
210	${LCRYPTO_SRC}/crypto/modes/asm \
211	${LCRYPTO_SRC}/crypto/poly1305/asm \
212	${LCRYPTO_SRC}/crypto/rc4/asm \
213	${LCRYPTO_SRC}/crypto/rc5/asm \
214	${LCRYPTO_SRC}/crypto/ripemd/asm \
215	${LCRYPTO_SRC}/crypto/sha/asm \
216	${LCRYPTO_SRC}/crypto/whrlpool/asm \
217	${LCRYPTO_SRC}/engines/asm
218
219#PERLPATH=	-I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm
220CFLAGS=	-DOPENSSL_IA32_SSE2
221
222# cpuid
223SRCS=	x86cpuid.pl
224
225# aes
226SRCS+=	aes-586.pl aesni-x86.pl vpaes-x86.pl
227
228# blowfish
229SRCS+=	bf-586.pl
230
231# bn
232SRCS+=	bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl
233
234# camellia
235SRCS+=	cmll-x86.pl
236
237# cast
238SRCS+=	cast-586.pl
239
240# chacha
241SRCS+=	chacha-x86.pl
242
243# des
244SRCS+=	crypt586.pl des-586.pl
245
246# ec
247SRCS+=	ecp_nistz256-x86.pl
248
249# md5
250SRCS+=	md5-586.pl
251
252# modes
253SRCS+=	ghash-x86.pl
254
255# poly1305
256SRCS+=	poly1305-x86.pl
257
258# rc4
259SRCS+=	rc4-586.pl
260
261# rc5
262SRCS+=	rc5-586.pl
263
264# ripemd
265SRCS+=	rmd-586.pl
266
267# sha
268SRCS+=	sha1-586.pl sha256-586.pl sha512-586.pl
269
270# whrlpool
271SRCS+=	wp-mmx.pl
272
273# engines
274SRCS+=	e_padlock-x86.pl
275
276ASM=	${SRCS:R:S/$/.S/}
277
278all:	${ASM}
279
280CLEANFILES=	${ASM}
281.SUFFIXES:	.pl
282
283.pl.S:
284	( echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\
285	echo '#ifdef PIC' ;\
286	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic /dev/stdout ;\
287	echo '#else' ;\
288	env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} /dev/stdout ;\
289	echo '#endif' ) > ${.TARGET}
290
291.elif defined(ASM_powerpc)
292
293.PATH:	${LCRYPTO_SRC}/crypto \
294	${LCRYPTO_SRC}/crypto/aes/asm \
295	${LCRYPTO_SRC}/crypto/bn/asm \
296	${LCRYPTO_SRC}/crypto/chacha/asm \
297	${LCRYPTO_SRC}/crypto/modes/asm \
298	${LCRYPTO_SRC}/crypto/poly1305/asm \
299	${LCRYPTO_SRC}/crypto/sha/asm
300
301PERLPATH=	-I${LCRYPTO_SRC}/crypto/perlasm
302
303#cpuid
304SRCS=	ppccpuid.pl
305
306#bn
307SRCS+=	ppc.pl ppc-mont.pl
308
309#aes
310SRCS+=	aes-ppc.pl vpaes-ppc.pl aesp8-ppc.pl
311
312#sha1
313SRCS+=	sha1-ppc.pl sha512-ppc.pl sha512p8-ppc.pl
314
315#modes
316SRCS+=	ghashp8-ppc.pl
317
318#chacha
319SRCS+=	chacha-ppc.pl
320
321#poly1305
322SRCS+=	poly1305-ppc.pl poly1305-ppcfp.pl
323
324ASM=	${SRCS:R:S/$/.S/} bn-ppc.S sha256-ppc.S sha256p8-ppc.S
325
326all:	${ASM}
327	rm -f ${ASM:R:S/$/.s/}
328
329CLEANFILES=	${ASM}
330.SUFFIXES:	.pl
331
332bn-ppc.S:	ppc.pl
333	env CC=cc perl ${.ALLSRC} linux32 ${.TARGET:R:S/$/.s/}
334	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
335	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
336
337sha256-ppc.S:	sha512-ppc.pl
338	env CC=cc perl ${.ALLSRC} linux32 ${.TARGET:R:S/$/.s/}
339	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
340	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
341
342sha256p8-ppc.S:	sha512p8-ppc.pl
343	env CC=cc perl ${.ALLSRC} linux32 ${.TARGET:R:S/$/.s/}
344	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
345	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
346
347.pl.S:
348	env CC=cc perl ${.IMPSRC} linux32 ${.TARGET:R:S/$/.s/}
349	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
350	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
351
352.elif defined(ASM_powerpc64)
353
354.PATH:	${LCRYPTO_SRC}/crypto \
355	${LCRYPTO_SRC}/crypto/aes/asm \
356	${LCRYPTO_SRC}/crypto/bn/asm \
357	${LCRYPTO_SRC}/crypto/chacha/asm \
358	${LCRYPTO_SRC}/crypto/ec/asm \
359	${LCRYPTO_SRC}/crypto/modes/asm \
360	${LCRYPTO_SRC}/crypto/poly1305/asm \
361	${LCRYPTO_SRC}/crypto/sha/asm
362
363PERLPATH=	-I${LCRYPTO_SRC}/crypto/perlasm
364
365#cpuid
366SRCS=	ppccpuid.pl
367
368#bn
369SRCS+=	ppc.pl ppc-mont.pl
370
371#aes
372SRCS+=	aes-ppc.pl vpaes-ppc.pl aesp8-ppc.pl
373
374#sha1
375SRCS+=	sha1-ppc.pl sha512-ppc.pl sha512p8-ppc.pl
376
377#modes
378SRCS+=	ghashp8-ppc.pl
379
380#chacha
381SRCS+=	chacha-ppc.pl
382
383#poly1305
384SRCS+=	poly1305-ppc.pl poly1305-ppcfp.pl
385
386#ec
387SRCS+=	ecp_nistp521-ppc64.pl ecp_nistz256-ppc64.pl x25519-ppc64.pl
388
389#keccak1600
390SRCS+=	keccak1600-ppc64.pl
391
392ASM=	${SRCS:R:S/$/.S/} bn-ppc.S sha256-ppc.S sha256p8-ppc.S
393
394all:	${ASM}
395	rm -f ${ASM:R:S/$/.s/}
396
397CLEANFILES=	${ASM}
398.SUFFIXES:	.pl
399
400bn-ppc.S:	ppc.pl
401	env CC=cc perl ${.ALLSRC} linux64v2 ${.TARGET:R:S/$/.s/}
402	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
403	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
404
405sha256-ppc.S:	sha512-ppc.pl
406	env CC=cc perl ${.ALLSRC} linux64v2 ${.TARGET:R:S/$/.s/}
407	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
408	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
409
410sha256p8-ppc.S:	sha512p8-ppc.pl
411	env CC=cc perl ${.ALLSRC} linux64v2 ${.TARGET:R:S/$/.s/}
412	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
413	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
414
415.pl.S:
416	env CC=cc perl ${.IMPSRC} linux64v2 ${.TARGET:R:S/$/.s/}
417	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
418	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
419
420.elif defined(ASM_powerpc64le)
421
422.PATH:	${LCRYPTO_SRC}/crypto \
423	${LCRYPTO_SRC}/crypto/aes/asm \
424	${LCRYPTO_SRC}/crypto/bn/asm \
425	${LCRYPTO_SRC}/crypto/chacha/asm \
426	${LCRYPTO_SRC}/crypto/ec/asm \
427	${LCRYPTO_SRC}/crypto/modes/asm \
428	${LCRYPTO_SRC}/crypto/poly1305/asm \
429	${LCRYPTO_SRC}/crypto/sha/asm
430
431PERLPATH=	-I${LCRYPTO_SRC}/crypto/perlasm
432
433#cpuid
434SRCS=	ppccpuid.pl
435
436#bn
437SRCS+=	ppc.pl ppc-mont.pl
438
439#aes
440SRCS+=	aes-ppc.pl vpaes-ppc.pl aesp8-ppc.pl
441
442#sha1
443SRCS+=	sha1-ppc.pl sha512-ppc.pl sha512p8-ppc.pl
444
445#modes
446SRCS+=	ghashp8-ppc.pl
447
448#chacha
449SRCS+=	chacha-ppc.pl
450
451#poly1305
452SRCS+=	poly1305-ppc.pl poly1305-ppcfp.pl
453
454#ec
455SRCS+=	ecp_nistp521-ppc64.pl ecp_nistz256-ppc64.pl x25519-ppc64.pl
456
457#keccak1600
458SRCS+=	keccak1600-ppc64.pl
459
460ASM=	${SRCS:R:S/$/.S/} bn-ppc.S sha256-ppc.S sha256p8-ppc.S
461
462all:	${ASM}
463	rm -f ${ASM:R:S/$/.s/}
464
465CLEANFILES=	${ASM}
466.SUFFIXES:	.pl
467
468bn-ppc.S:	ppc.pl
469	env CC=cc perl ${.ALLSRC} linux64le ${.TARGET:R:S/$/.s/}
470	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
471	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
472
473sha256-ppc.S:	sha512-ppc.pl
474	env CC=cc perl ${.ALLSRC} linux64le ${.TARGET:R:S/$/.s/}
475	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
476	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
477
478sha256p8-ppc.S:	sha512p8-ppc.pl
479	env CC=cc perl ${.ALLSRC} linux64le ${.TARGET:R:S/$/.s/}
480	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
481	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
482
483.pl.S:
484	env CC=cc perl ${.IMPSRC} linux64le ${.TARGET:R:S/$/.s/}
485	( echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\
486	cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
487
488.endif
489
490.include <bsd.prog.mk>
491