xref: /freebsd/sys/modules/crypto/Makefile (revision 43a5ec4eb41567cc92586503212743d89686d78f)
1# $FreeBSD$
2
3LIBSODIUM=${SRCTOP}/sys/contrib/libsodium/src/libsodium
4
5.PATH:	${SRCTOP}/sys/opencrypto
6.PATH:	${SRCTOP}/sys/crypto
7.PATH:	${SRCTOP}/sys/crypto/camellia
8.PATH:	${SRCTOP}/sys/crypto/des
9.PATH:	${SRCTOP}/sys/crypto/rijndael
10.PATH:	${SRCTOP}/sys/crypto/sha2
11.PATH:	${SRCTOP}/sys/crypto/siphash
12.PATH:	${SRCTOP}/sys/crypto/skein
13.PATH:	${SRCTOP}/sys/crypto/blake2
14.PATH:	${SRCTOP}/sys/crypto/chacha20
15.PATH:	${SRCTOP}/sys/contrib/libb2
16.PATH:	${LIBSODIUM}/crypto_onetimeauth/poly1305
17.PATH:	${LIBSODIUM}/crypto_onetimeauth/poly1305/donna
18.PATH:	${LIBSODIUM}/crypto_stream/chacha20
19.PATH:	${LIBSODIUM}/crypto_stream/chacha20/ref
20.PATH:	${LIBSODIUM}/crypto_verify/sodium
21.PATH:	${SRCTOP}/sys/crypto/libsodium
22
23KMOD	= crypto
24SRCS	= crypto.c cryptodev_if.c
25SRCS	+= criov.c cryptosoft.c xform.c
26SRCS	+= cryptodeflate.c rmd160.c rijndael-alg-fst.c rijndael-api.c rijndael-api-fst.c
27SRCS	+= camellia.c camellia-api.c
28SRCS	+= des_ecb.c des_enc.c des_setkey.c
29SRCS	+= sha1.c sha256c.c sha512c.c
30SRCS	+= skein.c skein_block.c
31# unroll the 256 and 512 loops, half unroll the 1024
32CFLAGS.skein_block.c	+= -DSKEIN_LOOP=995
33.if exists(${MACHINE_ARCH}/skein_block_asm.S)
34.PATH:	${SRCTOP}/sys/crypto/skein/${MACHINE_ARCH}
35SRCS	+= skein_block_asm.S
36CFLAGS	+= -DSKEIN_ASM -DSKEIN_USE_ASM=1792 # list of block functions to replace with assembly: 256+512+1024 = 1792
37ACFLAGS	+= -DELF -Wa,--noexecstack
38# Fully unroll all loops in the assembly optimized version
39ACFLAGS	+= -DSKEIN_LOOP=0
40# 20201002 Add explict Makefile dependency for reenabled assembly optimized
41# version. SKEIN_USE_ASM determines which routines should come from the assembly
42# vs C versions, and skein_block needs to be rebuilt if it changes.
43skein_block.o: Makefile
44.endif
45SRCS	+= siphash.c
46SRCS	+= gmac.c gfmult.c
47SRCS	+= blake2b-ref.c
48SRCS	+= blake2s-ref.c
49SRCS	+= blake2-sw.c
50CFLAGS.blake2b-ref.c	+= -I${SRCTOP}/sys/crypto/blake2 -DSUFFIX=_ref
51CFLAGS.blake2s-ref.c	+= -I${SRCTOP}/sys/crypto/blake2 -DSUFFIX=_ref
52CFLAGS.blake2-sw.c	+= -I${SRCTOP}/sys/crypto/blake2
53CWARNFLAGS.blake2b-ref.c	+= -Wno-cast-qual -Wno-unused-function
54CWARNFLAGS.blake2s-ref.c	+= -Wno-cast-qual -Wno-unused-function
55SRCS	+= chacha.c
56SRCS	+= chacha-sw.c
57
58LIBSODIUM_INC=${LIBSODIUM}/include
59LIBSODIUM_COMPAT=${SRCTOP}/sys/crypto/libsodium
60SRCS	+= xform_chacha20_poly1305.c
61CFLAGS.xform_chacha20_poly1305.c+= -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT}
62SRCS	+= xform_poly1305.c
63CFLAGS.xform_poly1305.c		+= -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT}
64SRCS	+= onetimeauth_poly1305.c
65CFLAGS.onetimeauth_poly1305.c	+= -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT}
66SRCS	+= poly1305_donna.c
67CFLAGS.poly1305_donna.c		+= -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT}
68SRCS	+= stream_chacha20.c
69CFLAGS.stream_chacha20.c	+= -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT}
70SRCS	+= chacha20_ref.c
71CFLAGS.chacha20_ref.c		+= -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT}
72SRCS	+= verify.c
73CFLAGS.verify.c			+= -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT}
74SRCS	+= randombytes.c
75CFLAGS.randombytes.c		+= -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT}
76SRCS	+= utils.c
77CFLAGS.utils.c			+= -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT}
78
79SRCS	+= opt_param.h cryptodev_if.h bus_if.h device_if.h
80SRCS	+= opt_compat.h
81SRCS	+= opt_ddb.h
82SRCS	+= cbc_mac.c
83SRCS	+= xform_cbc_mac.c
84
85.include <bsd.kmod.mk>
86