xref: /freebsd/sys/modules/crypto/Makefile (revision dd74471e49fd927d5a3a16fcdf94243cdd34c3f3)
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_core/ed25519/ref10
17.PATH:	${LIBSODIUM}/crypto_core/hchacha20
18.PATH:	${LIBSODIUM}/crypto_onetimeauth/poly1305
19.PATH:	${LIBSODIUM}/crypto_onetimeauth/poly1305/donna
20.PATH:	${LIBSODIUM}/crypto_scalarmult/curve25519
21.PATH:	${LIBSODIUM}/crypto_scalarmult/curve25519/ref10
22.PATH:	${LIBSODIUM}/crypto_stream/chacha20
23.PATH:	${LIBSODIUM}/crypto_stream/chacha20/ref
24.PATH:	${LIBSODIUM}/crypto_verify/sodium
25.PATH:	${SRCTOP}/sys/crypto/libsodium
26
27KMOD	= crypto
28SRCS	= crypto.c cryptodev_if.c
29SRCS	+= criov.c cryptosoft.c
30SRCS	+= xform_aes_cbc.c xform_aes_icm.c xform_aes_xts.c xform_cml.c
31SRCS	+= xform_deflate.c xform_gmac.c xform_null.c xform_rmd160.c
32SRCS	+= xform_sha1.c xform_sha2.c
33SRCS	+= cryptodeflate.c rmd160.c rijndael-alg-fst.c rijndael-api.c rijndael-api-fst.c
34SRCS	+= camellia.c camellia-api.c
35SRCS	+= des_ecb.c des_enc.c des_setkey.c
36SRCS	+= sha1.c sha256c.c sha512c.c
37SRCS	+= skein.c skein_block.c
38# unroll the 256 and 512 loops, half unroll the 1024
39CFLAGS.skein_block.c	+= -DSKEIN_LOOP=995
40.if exists(${MACHINE_ARCH}/skein_block_asm.S)
41.PATH:	${SRCTOP}/sys/crypto/skein/${MACHINE_ARCH}
42SRCS	+= skein_block_asm.S
43CFLAGS	+= -DSKEIN_ASM -DSKEIN_USE_ASM=1792 # list of block functions to replace with assembly: 256+512+1024 = 1792
44ACFLAGS	+= -DELF -Wa,--noexecstack
45# Fully unroll all loops in the assembly optimized version
46ACFLAGS	+= -DSKEIN_LOOP=0
47# 20201002 Add explict Makefile dependency for reenabled assembly optimized
48# version. SKEIN_USE_ASM determines which routines should come from the assembly
49# vs C versions, and skein_block needs to be rebuilt if it changes.
50skein_block.o: Makefile
51.endif
52SRCS	+= siphash.c
53SRCS	+= gmac.c gfmult.c
54SRCS	+= blake2b-ref.c
55SRCS	+= blake2s-ref.c
56SRCS	+= blake2-sw.c
57CFLAGS.blake2b-ref.c	+= -I${SRCTOP}/sys/crypto/blake2 -DSUFFIX=_ref
58CFLAGS.blake2s-ref.c	+= -I${SRCTOP}/sys/crypto/blake2 -DSUFFIX=_ref
59CFLAGS.blake2-sw.c	+= -I${SRCTOP}/sys/crypto/blake2
60CWARNFLAGS.blake2b-ref.c	+= -Wno-cast-qual -Wno-unused-function
61CWARNFLAGS.blake2s-ref.c	+= -Wno-cast-qual -Wno-unused-function
62SRCS	+= chacha.c
63SRCS	+= chacha-sw.c
64SRCS	+= chacha20_poly1305.c
65
66LIBSODIUM_INC=${LIBSODIUM}/include
67LIBSODIUM_COMPAT=${SRCTOP}/sys/crypto/libsodium
68SRCS	+= xform_chacha20_poly1305.c
69CFLAGS.xform_chacha20_poly1305.c+= -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT}
70SRCS	+= xform_poly1305.c
71CFLAGS.xform_poly1305.c		+= -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT}
72SRCS	+= ed25519_ref10.c
73CFLAGS.ed25519_ref10.c		+= -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT}
74CWARNFLAGS.ed25519_ref10.c	+= -Wno-unused-function
75SRCS	+= core_hchacha20.c
76CFLAGS.core_hchacha20.c		+= -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT}
77SRCS	+= onetimeauth_poly1305.c
78CFLAGS.onetimeauth_poly1305.c	+= -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT}
79SRCS	+= poly1305_donna.c
80CFLAGS.poly1305_donna.c		+= -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT}
81SRCS	+= stream_chacha20.c
82CFLAGS.stream_chacha20.c	+= -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT}
83SRCS	+= chacha20_ref.c
84CFLAGS.chacha20_ref.c		+= -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT}
85SRCS	+= scalarmult_curve25519.c
86CFLAGS.scalarmult_curve25519.c	+= -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT}
87SRCS	+= x25519_ref10.c
88CFLAGS.x25519_ref10.c		+= -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT}
89CWARNFLAGS.x25519_ref10.c	+= -Wno-unused-function
90SRCS	+= verify.c
91CFLAGS.verify.c			+= -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT}
92SRCS	+= randombytes.c
93CFLAGS.randombytes.c		+= -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT}
94SRCS	+= utils.c
95CFLAGS.utils.c			+= -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT}
96
97SRCS	+= curve25519.c
98CFLAGS.curve25519.c		+= -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT}
99
100SRCS	+= opt_param.h cryptodev_if.h bus_if.h device_if.h
101SRCS	+= opt_compat.h
102SRCS	+= opt_ddb.h
103SRCS	+= cbc_mac.c
104SRCS	+= xform_cbc_mac.c
105
106.include <bsd.kmod.mk>
107