1
2.PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp
3
4PACKAGE=	utilities
5LIB=	icp_rescue
6LIBADD=
7
8.if ${MACHINE_ARCH} == "amd64"
9ASM_SOURCES_C = asm-x86_64/aes/aeskey.c
10ASM_SOURCES_AS = \
11        asm-x86_64/aes/aes_amd64.S \
12        asm-x86_64/aes/aes_aesni.S \
13        asm-x86_64/modes/gcm_pclmulqdq.S \
14        asm-x86_64/modes/aesni-gcm-x86_64.S \
15        asm-x86_64/sha2/sha256-x86_64.S \
16        asm-x86_64/sha2/sha512-x86_64.S \
17        asm-x86_64/blake3/blake3_avx2.S \
18        asm-x86_64/blake3/blake3_avx512.S \
19        asm-x86_64/blake3/blake3_sse2.S \
20        asm-x86_64/blake3/blake3_sse41.S
21
22CFLAGS+= -D__amd64 -D_SYS_STACK_H
23.elif ${MACHINE_CPUARCH} == "arm"
24ASM_SOURCES_C =
25ASM_SOURCES_AS = \
26        asm-arm/sha2/sha256-armv7.S \
27        asm-arm/sha2/sha512-armv7.S
28.elif ${MACHINE_ARCH} == "aarch64"
29ASM_SOURCES_C =
30ASM_SOURCES_AS = \
31        asm-aarch64/blake3/b3_aarch64_sse2.S \
32        asm-aarch64/blake3/b3_aarch64_sse41.S \
33        asm-aarch64/sha2/sha256-armv8.S \
34        asm-aarch64/sha2/sha512-armv8.S
35.elif ${MACHINE_ARCH} == "powerpc64"
36ASM_SOURCES_C =
37ASM_SOURCES_AS = \
38        asm-ppc64/sha2/sha256-ppc.S \
39        asm-ppc64/sha2/sha512-ppc.S \
40        asm-ppc64/sha2/sha256-p8.S \
41        asm-ppc64/sha2/sha512-p8.S
42.elif ${MACHINE_ARCH} == "powerpc64le"
43ASM_SOURCES_C =
44ASM_SOURCES_AS = \
45        asm-ppc64/blake3/b3_ppc64le_sse2.S \
46        asm-ppc64/blake3/b3_ppc64le_sse41.S \
47        asm-ppc64/sha2/sha256-ppc.S \
48        asm-ppc64/sha2/sha512-ppc.S \
49        asm-ppc64/sha2/sha256-p8.S \
50        asm-ppc64/sha2/sha512-p8.S
51.else
52ASM_SOURCES_C =
53ASM_SOURCES_AS =
54.endif
55
56KERNEL_C = \
57        spi/kcf_spi.c \
58        api/kcf_ctxops.c \
59        api/kcf_cipher.c \
60        api/kcf_mac.c \
61        algs/aes/aes_impl_aesni.c \
62        algs/aes/aes_impl_generic.c \
63        algs/aes/aes_impl_x86-64.c \
64        algs/aes/aes_impl.c \
65        algs/aes/aes_modes.c \
66        algs/blake3/blake3.c \
67        algs/blake3/blake3_generic.c \
68        algs/blake3/blake3_impl.c \
69        algs/edonr/edonr.c \
70        algs/modes/modes.c \
71        algs/modes/cbc.c \
72        algs/modes/gcm_generic.c \
73        algs/modes/gcm_pclmulqdq.c \
74        algs/modes/gcm.c \
75        algs/modes/ctr.c \
76        algs/modes/ccm.c \
77        algs/modes/ecb.c \
78        algs/sha2/sha2_generic.c \
79        algs/sha2/sha256_impl.c \
80        algs/sha2/sha512_impl.c \
81        algs/skein/skein_block.c \
82        illumos-crypto.c \
83        io/aes.c \
84        io/sha2_mod.c \
85        io/skein_mod.c \
86        core/kcf_sched.c \
87        core/kcf_prov_lib.c \
88        core/kcf_callprov.c \
89        core/kcf_mech_tabs.c \
90        core/kcf_prov_tabs.c \
91        $(ASM_SOURCES_C)
92
93.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zfs
94KERNEL_C+=	zfs_impl.c
95
96SRCS= $(ASM_SOURCES_AS) $(KERNEL_C)
97
98WARNS?=	2
99SHLIB_MAJOR= 3
100CSTD=	c99
101CFLAGS+= -DIN_BASE
102CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
103CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
104CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
105CFLAGS+= -I${SRCTOP}/sys
106CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
107CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include
108CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
109CFLAGS+= -DHAVE_ISSETUGID -UHAVE_AVX -DRESCUE
110CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h
111
112CFLAGS.aes_amd64.S+= -DLOCORE
113CFLAGS.aes_aesni.S+= -DLOCORE
114CFLAGS.gcm_pclmulqdq.S+= -DLOCORE
115CFLAGS.aesni-gcm-x86_64.S+= -DLOCORE
116CFLAGS.ghash-x86_64.S+= -DLOCORE
117CFLAGS.sha256-x86_64.S+= -DLOCORE
118CFLAGS.sha512-x86_64.S+= -DLOCORE
119CFLAGS.gcm.c+= -UCAN_USE_GCM_ASM
120CFLAGS.blake3_avx2.S = -DLOCORE
121CFLAGS.blake3_avx512.S = -DLOCORE
122CFLAGS.blake3_sse2.S = -DLOCORE
123CFLAGS.blake3_sse41.S = -DLOCORE
124CFLAGS.b3_aarch64_sse2.S = -DLOCORE
125CFLAGS.b3_aarch64_sse41.S = -DLOCORE
126CFLAGS.sha256-armv7.S = -DLOCORE
127CFLAGS.sha512-armv7.S = -DLOCORE
128CFLAGS.sha256-armv8.S = -DLOCORE
129CFLAGS.sha512-armv8.S = -DLOCORE
130CFLAGS.b3_ppc64le_sse2.S = -DLOCORE
131CFLAGS.b3_ppc64le_sse41.S = -DLOCORE
132CFLAGS.sha256-ppc.S = -DLOCORE
133CFLAGS.sha256-p8.S = -DLOCORE
134CFLAGS.sha512-ppc.S = -DLOCORE
135CFLAGS.sha512-p8.S = -DLOCORE
136
137LDFLAGS.bfd+= -Wl,-znoexecstack
138
139.include <bsd.lib.mk>
140