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