xref: /openbsd/lib/libcrypto/arch/amd64/Makefile.inc (revision 3bef86f7)
1# $OpenBSD: Makefile.inc,v 1.13 2023/04/15 18:23:54 tb Exp $
2
3# amd64-specific libcrypto build rules
4
5# all amd64 code generators use this
6EXTRA_PL =	${LCRYPTO_SRC}/perlasm/x86_64-xlate.pl
7
8# aes
9CFLAGS+= -DAES_ASM
10SSLASM+= aes aes-x86_64
11CFLAGS+= -DBSAES_ASM
12SSLASM+= aes bsaes-x86_64
13CFLAGS+= -DVPAES_ASM
14SSLASM+= aes vpaes-x86_64
15SSLASM+= aes aesni-x86_64
16SSLASM+= aes aesni-sha1-x86_64
17# bf
18SRCS+= bf_enc.c
19# bn
20CFLAGS+= -DOPENSSL_IA32_SSE2
21CFLAGS+= -DRSA_ASM
22SSLASM+= bn modexp512-x86_64
23CFLAGS+= -DOPENSSL_BN_ASM_MONT
24SSLASM+= bn x86_64-mont
25CFLAGS+= -DOPENSSL_BN_ASM_MONT5
26SSLASM+= bn x86_64-mont5
27
28# bn s2n-bignum
29SRCS += bn_arch.c
30SRCS += bignum_add.S
31SRCS += bignum_cmadd.S
32SRCS += bignum_cmul.S
33SRCS += bignum_mul.S
34SRCS += bignum_mul_4_8_alt.S
35SRCS += bignum_mul_8_16_alt.S
36SRCS += bignum_sqr.S
37SRCS += bignum_sqr_4_8_alt.S
38SRCS += bignum_sqr_8_16_alt.S
39SRCS += bignum_sub.S
40SRCS += word_clz.S
41
42# camellia
43SRCS+=	cmll_misc.c
44SSLASM+= camellia cmll-x86_64
45# des
46SRCS+= des_enc.c fcrypt_b.c
47# md5
48CFLAGS+= -DMD5_ASM
49SSLASM+= md5 md5-x86_64
50# modes
51CFLAGS+= -DGHASH_ASM
52SSLASM+= modes ghash-x86_64
53# rc4
54CFLAGS+= -DRC4_MD5_ASM
55SSLASM+= rc4 rc4-x86_64
56SSLASM+= rc4 rc4-md5-x86_64
57# ripemd
58# sha
59CFLAGS+= -DSHA1_ASM
60SSLASM+= sha sha1-x86_64
61CFLAGS+= -DSHA256_ASM
62SRCS+= sha256-x86_64.S
63GENERATED+= sha256-x86_64.S
64sha256-x86_64.S: ${LCRYPTO_SRC}/sha/asm/sha512-x86_64.pl ${EXTRA_PL}
65	cd ${LCRYPTO_SRC}/sha/asm ; \
66		/usr/bin/perl ./sha512-x86_64.pl ${.OBJDIR}/${.TARGET}
67CFLAGS+= -DSHA512_ASM
68SRCS+= sha512-x86_64.S
69GENERATED+= sha512-x86_64.S
70sha512-x86_64.S: ${LCRYPTO_SRC}/sha/asm/sha512-x86_64.pl ${EXTRA_PL}
71	cd ${LCRYPTO_SRC}/sha/asm ; \
72		/usr/bin/perl ./sha512-x86_64.pl ${.OBJDIR}/${.TARGET}
73# whrlpool
74CFLAGS+= -DWHIRLPOOL_ASM
75SSLASM+= whrlpool wp-x86_64
76
77.for dir f in ${SSLASM}
78SRCS+=	${f}.S
79GENERATED+=${f}.S
80${f}.S: ${LCRYPTO_SRC}/${dir}/asm/${f}.pl ${EXTRA_PL}
81	(cd ${LCRYPTO_SRC}/${dir} ; \
82		/usr/bin/perl ./asm/${f}.pl openbsd) > ${.TARGET}
83.endfor
84
85CFLAGS+= -DOPENSSL_CPUID_OBJ
86SRCS+=	x86_64cpuid.S
87GENERATED+=x86_64cpuid.S
88
89x86_64cpuid.S: ${LCRYPTO_SRC}/x86_64cpuid.pl ${EXTRA_PL}
90	(cd ${LCRYPTO_SRC}/${dir} ; \
91		/usr/bin/perl ./x86_64cpuid.pl) > ${.TARGET}
92