xref: /linux/crypto/Makefile (revision c06983f853bc58eafe05f75dfd7e8bdafba3cd8c)
1# SPDX-License-Identifier: GPL-2.0
2#
3# Cryptographic API
4#
5
6obj-$(CONFIG_CRYPTO) += crypto.o
7crypto-y := api.o cipher.o compress.o
8
9obj-$(CONFIG_CRYPTO_ENGINE) += crypto_engine.o
10obj-$(CONFIG_CRYPTO_FIPS) += fips.o
11
12crypto_algapi-$(CONFIG_PROC_FS) += proc.o
13crypto_algapi-y := algapi.o scatterwalk.o $(crypto_algapi-y)
14obj-$(CONFIG_CRYPTO_ALGAPI2) += crypto_algapi.o
15
16obj-$(CONFIG_CRYPTO_AEAD2) += aead.o
17obj-$(CONFIG_CRYPTO_GENIV) += geniv.o
18
19crypto_skcipher-y += lskcipher.o
20crypto_skcipher-y += skcipher.o
21
22obj-$(CONFIG_CRYPTO_SKCIPHER2) += crypto_skcipher.o
23
24obj-$(CONFIG_CRYPTO_SEQIV) += seqiv.o
25obj-$(CONFIG_CRYPTO_ECHAINIV) += echainiv.o
26
27crypto_hash-y += ahash.o
28crypto_hash-y += shash.o
29obj-$(CONFIG_CRYPTO_HASH2) += crypto_hash.o
30
31obj-$(CONFIG_CRYPTO_AKCIPHER2) += akcipher.o
32obj-$(CONFIG_CRYPTO_SIG2) += sig.o
33obj-$(CONFIG_CRYPTO_KPP2) += kpp.o
34
35dh_generic-y := dh.o
36dh_generic-y += dh_helper.o
37obj-$(CONFIG_CRYPTO_DH) += dh_generic.o
38
39$(obj)/rsapubkey.asn1.o: $(obj)/rsapubkey.asn1.c $(obj)/rsapubkey.asn1.h
40$(obj)/rsaprivkey.asn1.o: $(obj)/rsaprivkey.asn1.c $(obj)/rsaprivkey.asn1.h
41$(obj)/rsa_helper.o: $(obj)/rsapubkey.asn1.h $(obj)/rsaprivkey.asn1.h
42
43rsa_generic-y := rsapubkey.asn1.o
44rsa_generic-y += rsaprivkey.asn1.o
45rsa_generic-y += rsa.o
46rsa_generic-y += rsa_helper.o
47rsa_generic-y += rsa-pkcs1pad.o
48obj-$(CONFIG_CRYPTO_RSA) += rsa_generic.o
49
50$(obj)/sm2signature.asn1.o: $(obj)/sm2signature.asn1.c $(obj)/sm2signature.asn1.h
51$(obj)/sm2.o: $(obj)/sm2signature.asn1.h
52
53sm2_generic-y += sm2signature.asn1.o
54sm2_generic-y += sm2.o
55
56obj-$(CONFIG_CRYPTO_SM2) += sm2_generic.o
57
58$(obj)/ecdsasignature.asn1.o: $(obj)/ecdsasignature.asn1.c $(obj)/ecdsasignature.asn1.h
59$(obj)/ecdsa.o: $(obj)/ecdsasignature.asn1.h
60ecdsa_generic-y += ecdsa.o
61ecdsa_generic-y += ecdsasignature.asn1.o
62obj-$(CONFIG_CRYPTO_ECDSA) += ecdsa_generic.o
63
64crypto_acompress-y := acompress.o
65crypto_acompress-y += scompress.o
66obj-$(CONFIG_CRYPTO_ACOMP2) += crypto_acompress.o
67
68cryptomgr-y := algboss.o testmgr.o
69
70obj-$(CONFIG_CRYPTO_MANAGER2) += cryptomgr.o
71obj-$(CONFIG_CRYPTO_USER) += crypto_user.o
72crypto_user-y := crypto_user_base.o
73crypto_user-$(CONFIG_CRYPTO_STATS) += crypto_user_stat.o
74obj-$(CONFIG_CRYPTO_CMAC) += cmac.o
75obj-$(CONFIG_CRYPTO_HMAC) += hmac.o
76obj-$(CONFIG_CRYPTO_VMAC) += vmac.o
77obj-$(CONFIG_CRYPTO_XCBC) += xcbc.o
78obj-$(CONFIG_CRYPTO_NULL2) += crypto_null.o
79obj-$(CONFIG_CRYPTO_MD4) += md4.o
80obj-$(CONFIG_CRYPTO_MD5) += md5.o
81obj-$(CONFIG_CRYPTO_RMD160) += rmd160.o
82obj-$(CONFIG_CRYPTO_SHA1) += sha1_generic.o
83obj-$(CONFIG_CRYPTO_SHA256) += sha256_generic.o
84obj-$(CONFIG_CRYPTO_SHA512) += sha512_generic.o
85obj-$(CONFIG_CRYPTO_SHA3) += sha3_generic.o
86obj-$(CONFIG_CRYPTO_SM3) += sm3.o
87obj-$(CONFIG_CRYPTO_SM3_GENERIC) += sm3_generic.o
88obj-$(CONFIG_CRYPTO_STREEBOG) += streebog_generic.o
89obj-$(CONFIG_CRYPTO_WP512) += wp512.o
90CFLAGS_wp512.o := $(call cc-option,-fno-schedule-insns)  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
91obj-$(CONFIG_CRYPTO_BLAKE2B) += blake2b_generic.o
92CFLAGS_blake2b_generic.o := -Wframe-larger-than=4096 #  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105930
93obj-$(CONFIG_CRYPTO_ECB) += ecb.o
94obj-$(CONFIG_CRYPTO_CBC) += cbc.o
95obj-$(CONFIG_CRYPTO_PCBC) += pcbc.o
96obj-$(CONFIG_CRYPTO_CTS) += cts.o
97obj-$(CONFIG_CRYPTO_LRW) += lrw.o
98obj-$(CONFIG_CRYPTO_XTS) += xts.o
99obj-$(CONFIG_CRYPTO_CTR) += ctr.o
100obj-$(CONFIG_CRYPTO_XCTR) += xctr.o
101obj-$(CONFIG_CRYPTO_HCTR2) += hctr2.o
102obj-$(CONFIG_CRYPTO_KEYWRAP) += keywrap.o
103obj-$(CONFIG_CRYPTO_ADIANTUM) += adiantum.o
104obj-$(CONFIG_CRYPTO_NHPOLY1305) += nhpoly1305.o
105obj-$(CONFIG_CRYPTO_GCM) += gcm.o
106obj-$(CONFIG_CRYPTO_CCM) += ccm.o
107obj-$(CONFIG_CRYPTO_CHACHA20POLY1305) += chacha20poly1305.o
108obj-$(CONFIG_CRYPTO_AEGIS128) += aegis128.o
109aegis128-y := aegis128-core.o
110
111ifeq ($(ARCH),arm)
112CFLAGS_aegis128-neon-inner.o += -ffreestanding -march=armv8-a -mfloat-abi=softfp
113CFLAGS_aegis128-neon-inner.o += -mfpu=crypto-neon-fp-armv8
114aegis128-$(CONFIG_CRYPTO_AEGIS128_SIMD) += aegis128-neon.o aegis128-neon-inner.o
115endif
116ifeq ($(ARCH),arm64)
117aegis128-cflags-y := -ffreestanding -mcpu=generic+crypto
118aegis128-cflags-$(CONFIG_CC_IS_GCC) += -ffixed-q16 -ffixed-q17 -ffixed-q18 \
119				       -ffixed-q19 -ffixed-q20 -ffixed-q21 \
120				       -ffixed-q22 -ffixed-q23 -ffixed-q24 \
121				       -ffixed-q25 -ffixed-q26 -ffixed-q27 \
122				       -ffixed-q28 -ffixed-q29 -ffixed-q30 \
123				       -ffixed-q31
124CFLAGS_aegis128-neon-inner.o += $(aegis128-cflags-y)
125CFLAGS_REMOVE_aegis128-neon-inner.o += -mgeneral-regs-only
126aegis128-$(CONFIG_CRYPTO_AEGIS128_SIMD) += aegis128-neon.o aegis128-neon-inner.o
127endif
128# Enable <arm_neon.h>
129CFLAGS_aegis128-neon-inner.o += -isystem $(shell $(CC) -print-file-name=include)
130
131obj-$(CONFIG_CRYPTO_PCRYPT) += pcrypt.o
132obj-$(CONFIG_CRYPTO_CRYPTD) += cryptd.o
133obj-$(CONFIG_CRYPTO_DES) += des_generic.o
134obj-$(CONFIG_CRYPTO_FCRYPT) += fcrypt.o
135obj-$(CONFIG_CRYPTO_BLOWFISH) += blowfish_generic.o
136obj-$(CONFIG_CRYPTO_BLOWFISH_COMMON) += blowfish_common.o
137obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o
138obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o
139obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o
140CFLAGS_serpent_generic.o := $(call cc-option,-fsched-pressure)  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
141obj-$(CONFIG_CRYPTO_AES) += aes_generic.o
142CFLAGS_aes_generic.o := $(call cc-option,-fno-code-hoisting) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83356
143obj-$(CONFIG_CRYPTO_SM4) += sm4.o
144obj-$(CONFIG_CRYPTO_SM4_GENERIC) += sm4_generic.o
145obj-$(CONFIG_CRYPTO_AES_TI) += aes_ti.o
146obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o
147obj-$(CONFIG_CRYPTO_CAST_COMMON) += cast_common.o
148obj-$(CONFIG_CRYPTO_CAST5) += cast5_generic.o
149obj-$(CONFIG_CRYPTO_CAST6) += cast6_generic.o
150obj-$(CONFIG_CRYPTO_ARC4) += arc4.o
151obj-$(CONFIG_CRYPTO_TEA) += tea.o
152obj-$(CONFIG_CRYPTO_KHAZAD) += khazad.o
153obj-$(CONFIG_CRYPTO_ANUBIS) += anubis.o
154obj-$(CONFIG_CRYPTO_SEED) += seed.o
155obj-$(CONFIG_CRYPTO_ARIA) += aria_generic.o
156obj-$(CONFIG_CRYPTO_CHACHA20) += chacha_generic.o
157obj-$(CONFIG_CRYPTO_POLY1305) += poly1305_generic.o
158obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o
159obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o
160obj-$(CONFIG_CRYPTO_CRC32C) += crc32c_generic.o
161obj-$(CONFIG_CRYPTO_CRC32) += crc32_generic.o
162obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif_common.o crct10dif_generic.o
163obj-$(CONFIG_CRYPTO_CRC64_ROCKSOFT) += crc64_rocksoft_generic.o
164obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o
165obj-$(CONFIG_CRYPTO_LZO) += lzo.o lzo-rle.o
166obj-$(CONFIG_CRYPTO_LZ4) += lz4.o
167obj-$(CONFIG_CRYPTO_LZ4HC) += lz4hc.o
168obj-$(CONFIG_CRYPTO_XXHASH) += xxhash_generic.o
169obj-$(CONFIG_CRYPTO_842) += 842.o
170obj-$(CONFIG_CRYPTO_RNG2) += rng.o
171obj-$(CONFIG_CRYPTO_ANSI_CPRNG) += ansi_cprng.o
172obj-$(CONFIG_CRYPTO_DRBG) += drbg.o
173obj-$(CONFIG_CRYPTO_JITTERENTROPY) += jitterentropy_rng.o
174CFLAGS_jitterentropy.o = -O0
175KASAN_SANITIZE_jitterentropy.o = n
176UBSAN_SANITIZE_jitterentropy.o = n
177jitterentropy_rng-y := jitterentropy.o jitterentropy-kcapi.o
178obj-$(CONFIG_CRYPTO_JITTERENTROPY_TESTINTERFACE) += jitterentropy-testing.o
179obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o
180obj-$(CONFIG_CRYPTO_GHASH) += ghash-generic.o
181obj-$(CONFIG_CRYPTO_POLYVAL) += polyval-generic.o
182obj-$(CONFIG_CRYPTO_USER_API) += af_alg.o
183obj-$(CONFIG_CRYPTO_USER_API_HASH) += algif_hash.o
184obj-$(CONFIG_CRYPTO_USER_API_SKCIPHER) += algif_skcipher.o
185obj-$(CONFIG_CRYPTO_USER_API_RNG) += algif_rng.o
186obj-$(CONFIG_CRYPTO_USER_API_AEAD) += algif_aead.o
187obj-$(CONFIG_CRYPTO_ZSTD) += zstd.o
188obj-$(CONFIG_CRYPTO_ECC) += ecc.o
189obj-$(CONFIG_CRYPTO_ESSIV) += essiv.o
190obj-$(CONFIG_CRYPTO_CURVE25519) += curve25519-generic.o
191
192ecdh_generic-y += ecdh.o
193ecdh_generic-y += ecdh_helper.o
194obj-$(CONFIG_CRYPTO_ECDH) += ecdh_generic.o
195
196$(obj)/ecrdsa_params.asn1.o: $(obj)/ecrdsa_params.asn1.c $(obj)/ecrdsa_params.asn1.h
197$(obj)/ecrdsa_pub_key.asn1.o: $(obj)/ecrdsa_pub_key.asn1.c $(obj)/ecrdsa_pub_key.asn1.h
198$(obj)/ecrdsa.o: $(obj)/ecrdsa_params.asn1.h $(obj)/ecrdsa_pub_key.asn1.h
199ecrdsa_generic-y += ecrdsa.o
200ecrdsa_generic-y += ecrdsa_params.asn1.o
201ecrdsa_generic-y += ecrdsa_pub_key.asn1.o
202obj-$(CONFIG_CRYPTO_ECRDSA) += ecrdsa_generic.o
203
204#
205# generic algorithms and the async_tx api
206#
207obj-$(CONFIG_XOR_BLOCKS) += xor.o
208obj-$(CONFIG_ASYNC_CORE) += async_tx/
209obj-$(CONFIG_ASYMMETRIC_KEY_TYPE) += asymmetric_keys/
210obj-$(CONFIG_CRYPTO_HASH_INFO) += hash_info.o
211crypto_simd-y := simd.o
212obj-$(CONFIG_CRYPTO_SIMD) += crypto_simd.o
213
214#
215# Key derivation function
216#
217obj-$(CONFIG_CRYPTO_KDF800108_CTR) += kdf_sp800108.o
218