blob: d76bff8d0ffd9c816401948b37dbb692847d9e2e [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#
3# Cryptographic API
4#
5
Sebastian Siewiorc3715cb92008-03-30 16:36:09 +08006obj-$(CONFIG_CRYPTO) += crypto.o
James Yonan6bf37e52013-09-26 02:20:39 -06007crypto-y := api.o cipher.o compress.o memneq.o
Linus Torvalds1da177e2005-04-16 15:20:36 -07008
Baolin Wang735d37b2016-01-26 20:25:39 +08009obj-$(CONFIG_CRYPTO_ENGINE) += crypto_engine.o
Neil Hormanccb778e2008-08-05 14:13:08 +080010obj-$(CONFIG_CRYPTO_FIPS) += fips.o
11
Herbert Xucce9e062006-08-21 21:08:13 +100012crypto_algapi-$(CONFIG_PROC_FS) += proc.o
Tracey Dent21ea28a2010-11-27 16:32:57 +080013crypto_algapi-y := algapi.o scatterwalk.o $(crypto_algapi-y)
Herbert Xu6a0fcbb2008-12-10 23:29:44 +110014obj-$(CONFIG_CRYPTO_ALGAPI2) += crypto_algapi.o
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
Herbert Xu6a0fcbb2008-12-10 23:29:44 +110016obj-$(CONFIG_CRYPTO_AEAD2) += aead.o
Herbert Xu20cc01b2019-11-08 18:41:58 +080017obj-$(CONFIG_CRYPTO_AEAD2) += geniv.o
Herbert Xu653ebd9c2007-11-27 19:48:27 +080018
Ard Biesheuveld63007e2019-11-09 18:09:53 +010019obj-$(CONFIG_CRYPTO_SKCIPHER2) += skcipher.o
Herbert Xu0a270322007-11-30 21:38:37 +110020obj-$(CONFIG_CRYPTO_SEQIV) += seqiv.o
Herbert Xua10f5542015-05-21 15:11:15 +080021obj-$(CONFIG_CRYPTO_ECHAINIV) += echainiv.o
Herbert Xu5cde0af2006-08-22 00:07:53 +100022
Tracey Dent21ea28a2010-11-27 16:32:57 +080023crypto_hash-y += ahash.o
24crypto_hash-y += shash.o
Herbert Xu6a0fcbb2008-12-10 23:29:44 +110025obj-$(CONFIG_CRYPTO_HASH2) += crypto_hash.o
Herbert Xu055bcee2006-08-19 22:24:23 +100026
Tadeusz Struk3c339ab2015-06-16 10:30:55 -070027obj-$(CONFIG_CRYPTO_AKCIPHER2) += akcipher.o
Salvatore Benedetto4e5f2c42016-06-22 17:49:13 +010028obj-$(CONFIG_CRYPTO_KPP2) += kpp.o
Geert Uytterhoevena1d2f092009-03-04 15:05:33 +080029
Salvatore Benedetto802c7f12016-06-22 17:49:14 +010030dh_generic-y := dh.o
31dh_generic-y += dh_helper.o
32obj-$(CONFIG_CRYPTO_DH) += dh_generic.o
33
Masahiro Yamada4fa8bc92018-03-23 22:04:37 +090034$(obj)/rsapubkey.asn1.o: $(obj)/rsapubkey.asn1.c $(obj)/rsapubkey.asn1.h
35$(obj)/rsaprivkey.asn1.o: $(obj)/rsaprivkey.asn1.c $(obj)/rsaprivkey.asn1.h
36$(obj)/rsa_helper.o: $(obj)/rsapubkey.asn1.h $(obj)/rsaprivkey.asn1.h
Tadeusz Strukcfc2bb32015-06-16 10:31:01 -070037
Masahiro Yamada4fa8bc92018-03-23 22:04:37 +090038rsa_generic-y := rsapubkey.asn1.o
39rsa_generic-y += rsaprivkey.asn1.o
Tadeusz Strukcfc2bb32015-06-16 10:31:01 -070040rsa_generic-y += rsa.o
41rsa_generic-y += rsa_helper.o
Andrzej Zaborowski3d5b1ec2015-12-05 17:09:34 +010042rsa_generic-y += rsa-pkcs1pad.o
Tadeusz Strukcfc2bb32015-06-16 10:31:01 -070043obj-$(CONFIG_CRYPTO_RSA) += rsa_generic.o
44
Tianjia Zhangea7ecb62020-09-21 00:20:57 +080045$(obj)/sm2signature.asn1.o: $(obj)/sm2signature.asn1.c $(obj)/sm2signature.asn1.h
46$(obj)/sm2.o: $(obj)/sm2signature.asn1.h
47
48sm2_generic-y += sm2signature.asn1.o
49sm2_generic-y += sm2.o
50
51obj-$(CONFIG_CRYPTO_SM2) += sm2_generic.o
52
Stefan Berger4e660292021-03-16 17:07:32 -040053$(obj)/ecdsasignature.asn1.o: $(obj)/ecdsasignature.asn1.c $(obj)/ecdsasignature.asn1.h
54$(obj)/ecdsa.o: $(obj)/ecdsasignature.asn1.h
55ecdsa_generic-y += ecdsa.o
56ecdsa_generic-y += ecdsasignature.asn1.o
57obj-$(CONFIG_CRYPTO_ECDSA) += ecdsa_generic.o
58
Giovanni Cabiddu6c0f4002016-10-26 10:56:45 +010059crypto_acompress-y := acompress.o
60crypto_acompress-y += scompress.o
61obj-$(CONFIG_CRYPTO_ACOMP2) += crypto_acompress.o
Giovanni Cabiddu2ebda742016-10-21 13:19:47 +010062
Tracey Dent21ea28a2010-11-27 16:32:57 +080063cryptomgr-y := algboss.o testmgr.o
Herbert Xuda7f0332008-07-31 17:08:25 +080064
Herbert Xu6a0fcbb2008-12-10 23:29:44 +110065obj-$(CONFIG_CRYPTO_MANAGER2) += cryptomgr.o
Steffen Klasserta38f7902011-09-27 07:23:50 +020066obj-$(CONFIG_CRYPTO_USER) += crypto_user.o
Corentin Labbe2ced2602018-11-29 14:42:16 +000067crypto_user-y := crypto_user_base.o
68crypto_user-$(CONFIG_CRYPTO_STATS) += crypto_user_stat.o
Jussi Kivilinna93b5e862013-04-08 10:48:44 +030069obj-$(CONFIG_CRYPTO_CMAC) += cmac.o
Linus Torvalds1da177e2005-04-16 15:20:36 -070070obj-$(CONFIG_CRYPTO_HMAC) += hmac.o
Shane Wangf1939f72009-09-02 20:05:22 +100071obj-$(CONFIG_CRYPTO_VMAC) += vmac.o
Kazunori MIYAZAWA333b0d72006-10-28 13:15:24 +100072obj-$(CONFIG_CRYPTO_XCBC) += xcbc.o
Herbert Xua26bcb02015-08-17 17:45:27 +080073obj-$(CONFIG_CRYPTO_NULL2) += crypto_null.o
Linus Torvalds1da177e2005-04-16 15:20:36 -070074obj-$(CONFIG_CRYPTO_MD4) += md4.o
75obj-$(CONFIG_CRYPTO_MD5) += md5.o
Adrian-Ken Rueegseggerc6580eb2008-05-07 22:14:10 +080076obj-$(CONFIG_CRYPTO_RMD160) += rmd160.o
Sebastian Siewiorad5d2782007-10-08 11:45:10 +080077obj-$(CONFIG_CRYPTO_SHA1) += sha1_generic.o
78obj-$(CONFIG_CRYPTO_SHA256) += sha256_generic.o
Jan Glauber78f8b3a2008-03-06 19:55:38 +080079obj-$(CONFIG_CRYPTO_SHA512) += sha512_generic.o
Jeff Garzik53964b92016-06-17 10:30:35 +053080obj-$(CONFIG_CRYPTO_SHA3) += sha3_generic.o
Gilad Ben-Yossef4f0fc162017-08-21 13:51:28 +030081obj-$(CONFIG_CRYPTO_SM3) += sm3_generic.o
Vitaly Chikunovfe189572018-11-07 00:00:01 +030082obj-$(CONFIG_CRYPTO_STREEBOG) += streebog_generic.o
Linus Torvalds1da177e2005-04-16 15:20:36 -070083obj-$(CONFIG_CRYPTO_WP512) += wp512.o
Arnd Bergmann7d6e9102017-02-03 23:33:23 +010084CFLAGS_wp512.o := $(call cc-option,-fno-schedule-insns) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
David Sterba91d68932019-10-24 18:28:31 +020085obj-$(CONFIG_CRYPTO_BLAKE2B) += blake2b_generic.o
Ard Biesheuvel7f9b0882019-11-08 13:22:30 +010086obj-$(CONFIG_CRYPTO_BLAKE2S) += blake2s_generic.o
Rik Snelc494e072006-11-29 18:59:44 +110087obj-$(CONFIG_CRYPTO_GF128MUL) += gf128mul.o
Herbert Xudb131ef2006-09-21 11:44:08 +100088obj-$(CONFIG_CRYPTO_ECB) += ecb.o
89obj-$(CONFIG_CRYPTO_CBC) += cbc.o
James Bottomleya7d85e02018-03-01 14:36:17 -080090obj-$(CONFIG_CRYPTO_CFB) += cfb.o
David Howells91652be2006-12-16 12:09:02 +110091obj-$(CONFIG_CRYPTO_PCBC) += pcbc.o
Kevin Coffman76cb9522008-03-24 21:26:16 +080092obj-$(CONFIG_CRYPTO_CTS) += cts.o
Rik Snel64470f12006-11-26 09:43:10 +110093obj-$(CONFIG_CRYPTO_LRW) += lrw.o
Rik Snelf19f5112007-09-19 20:23:13 +080094obj-$(CONFIG_CRYPTO_XTS) += xts.o
Joy Latten23e353c2007-10-23 08:50:32 +080095obj-$(CONFIG_CRYPTO_CTR) += ctr.o
Stephan Mueller1c49678e2015-09-21 20:58:56 +020096obj-$(CONFIG_CRYPTO_KEYWRAP) += keywrap.o
Eric Biggers059c2a42018-11-16 17:26:31 -080097obj-$(CONFIG_CRYPTO_ADIANTUM) += adiantum.o
Eric Biggers26609a22018-11-16 17:26:29 -080098obj-$(CONFIG_CRYPTO_NHPOLY1305) += nhpoly1305.o
Mikko Herranen28db8e32007-11-26 22:24:11 +080099obj-$(CONFIG_CRYPTO_GCM) += gcm.o
Joy Latten4a49b492007-12-12 20:25:13 +0800100obj-$(CONFIG_CRYPTO_CCM) += ccm.o
Martin Willi71ebc4d2015-06-01 13:44:00 +0200101obj-$(CONFIG_CRYPTO_CHACHA20POLY1305) += chacha20poly1305.o
Ondrej Mosnacekf606a882018-05-11 14:12:49 +0200102obj-$(CONFIG_CRYPTO_AEGIS128) += aegis128.o
Ard Biesheuvelcf3d41a2019-08-12 01:59:10 +0300103aegis128-y := aegis128-core.o
Ard Biesheuvela4397632019-08-12 01:59:11 +0300104
105ifeq ($(ARCH),arm)
Ard Biesheuvel2eb2d192019-09-13 19:36:18 +0100106CFLAGS_aegis128-neon-inner.o += -ffreestanding -march=armv8-a -mfloat-abi=softfp
Ard Biesheuvela4397632019-08-12 01:59:11 +0300107CFLAGS_aegis128-neon-inner.o += -mfpu=crypto-neon-fp-armv8
108aegis128-$(CONFIG_CRYPTO_AEGIS128_SIMD) += aegis128-neon.o aegis128-neon-inner.o
109endif
110ifeq ($(ARCH),arm64)
Ard Biesheuvel19842962019-08-12 01:59:12 +0300111aegis128-cflags-y := -ffreestanding -mcpu=generic+crypto
112aegis128-cflags-$(CONFIG_CC_IS_GCC) += -ffixed-q16 -ffixed-q17 -ffixed-q18 \
113 -ffixed-q19 -ffixed-q20 -ffixed-q21 \
114 -ffixed-q22 -ffixed-q23 -ffixed-q24 \
115 -ffixed-q25 -ffixed-q26 -ffixed-q27 \
116 -ffixed-q28 -ffixed-q29 -ffixed-q30 \
117 -ffixed-q31
118CFLAGS_aegis128-neon-inner.o += $(aegis128-cflags-y)
Ard Biesheuvela4397632019-08-12 01:59:11 +0300119CFLAGS_REMOVE_aegis128-neon-inner.o += -mgeneral-regs-only
120aegis128-$(CONFIG_CRYPTO_AEGIS128_SIMD) += aegis128-neon.o aegis128-neon-inner.o
121endif
Alexey Dobriyan04e85bb2021-08-02 23:43:15 +0300122# Enable <arm_neon.h>
123CFLAGS_aegis128-neon-inner.o += -isystem $(shell $(CC) -print-file-name=include)
Ard Biesheuvela4397632019-08-12 01:59:11 +0300124
Steffen Klassert5068c7a2010-01-07 15:57:19 +1100125obj-$(CONFIG_CRYPTO_PCRYPT) += pcrypt.o
Herbert Xu124b53d2007-04-16 20:49:20 +1000126obj-$(CONFIG_CRYPTO_CRYPTD) += cryptd.o
Sebastian Siewiorc5a511f2007-10-05 16:42:03 +0800127obj-$(CONFIG_CRYPTO_DES) += des_generic.o
David Howells90831632006-12-16 12:13:14 +1100128obj-$(CONFIG_CRYPTO_FCRYPT) += fcrypt.o
Jussi Kivilinna3f2a5d22011-09-02 01:45:12 +0300129obj-$(CONFIG_CRYPTO_BLOWFISH) += blowfish_generic.o
Jussi Kivilinna52ba8672011-09-02 01:45:07 +0300130obj-$(CONFIG_CRYPTO_BLOWFISH_COMMON) += blowfish_common.o
Joachim Fritschi5b04fc12010-06-03 21:02:51 +1000131obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o
Joachim Fritschi2729bb42006-06-20 20:37:23 +1000132obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o
Jussi Kivilinnadd6eec22011-10-18 00:03:13 +0300133obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o
Arnd Bergmann7d6e9102017-02-03 23:33:23 +0100134CFLAGS_serpent_generic.o := $(call cc-option,-fsched-pressure) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
Sebastian Siewiorf8246af2007-10-05 16:52:01 +0800135obj-$(CONFIG_CRYPTO_AES) += aes_generic.o
Arnd Bergmann6e367192018-01-15 17:07:22 +0100136CFLAGS_aes_generic.o := $(call cc-option,-fno-code-hoisting) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83356
Gilad Ben-Yossef747c8ce2018-03-06 09:44:42 +0000137obj-$(CONFIG_CRYPTO_SM4) += sm4_generic.o
Ard Biesheuvelb5e0b032017-02-02 16:37:40 +0000138obj-$(CONFIG_CRYPTO_AES_TI) += aes_ti.o
Jussi Kivilinna075e39d2012-03-05 20:26:32 +0200139obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o
Jussi Kivilinna044ab522012-11-13 11:43:14 +0200140obj-$(CONFIG_CRYPTO_CAST_COMMON) += cast_common.o
Johannes Goetzfried270b0c62012-07-11 19:37:04 +0200141obj-$(CONFIG_CRYPTO_CAST5) += cast5_generic.o
Johannes Goetzfried2b49b902012-07-11 19:38:12 +0200142obj-$(CONFIG_CRYPTO_CAST6) += cast6_generic.o
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143obj-$(CONFIG_CRYPTO_ARC4) += arc4.o
144obj-$(CONFIG_CRYPTO_TEA) += tea.o
145obj-$(CONFIG_CRYPTO_KHAZAD) += khazad.o
146obj-$(CONFIG_CRYPTO_ANUBIS) += anubis.o
Hye-Shik Change2ee95b2007-08-21 20:01:03 +0800147obj-$(CONFIG_CRYPTO_SEED) += seed.o
Eric Biggers1ca1b912018-11-16 17:26:21 -0800148obj-$(CONFIG_CRYPTO_CHACHA20) += chacha_generic.o
Martin Willif979e012015-06-01 13:43:58 +0200149obj-$(CONFIG_CRYPTO_POLY1305) += poly1305_generic.o
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o
151obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o
Tim Chen06e5a1f2014-01-23 03:25:47 -0800152obj-$(CONFIG_CRYPTO_CRC32C) += crc32c_generic.o
Herbert Xua7c58ac2016-01-29 18:20:17 +0800153obj-$(CONFIG_CRYPTO_CRC32) += crc32_generic.o
Herbert Xu26052f92013-09-12 15:31:34 +1000154obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif_common.o crct10dif_generic.o
Steffen Klasserta5079d02011-03-08 00:04:58 +0000155obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o
Dave Rodgman45ec9752019-03-07 16:30:44 -0800156obj-$(CONFIG_CRYPTO_LZO) += lzo.o lzo-rle.o
Chanho Min0ea85302013-07-08 16:01:51 -0700157obj-$(CONFIG_CRYPTO_LZ4) += lz4.o
158obj-$(CONFIG_CRYPTO_LZ4HC) += lz4hc.o
Nikolay Borisov67882e72019-05-30 09:52:57 +0300159obj-$(CONFIG_CRYPTO_XXHASH) += xxhash_generic.o
Seth Jennings35a1fc12012-07-19 09:42:41 -0500160obj-$(CONFIG_CRYPTO_842) += 842.o
Herbert Xu6a0fcbb2008-12-10 23:29:44 +1100161obj-$(CONFIG_CRYPTO_RNG2) += rng.o
Neil Horman17f0f4a2008-08-14 22:15:52 +1000162obj-$(CONFIG_CRYPTO_ANSI_CPRNG) += ansi_cprng.o
Herbert Xuf2c89a12014-07-04 22:15:08 +0800163obj-$(CONFIG_CRYPTO_DRBG) += drbg.o
Stephan Muellerdfc9fa92015-06-23 16:18:54 +0200164obj-$(CONFIG_CRYPTO_JITTERENTROPY) += jitterentropy_rng.o
165CFLAGS_jitterentropy.o = -O0
Arnd Bergmanndec0fb32019-07-24 20:51:55 +0200166KASAN_SANITIZE_jitterentropy.o = n
167UBSAN_SANITIZE_jitterentropy.o = n
Stephan Muellerdfc9fa92015-06-23 16:18:54 +0200168jitterentropy_rng-y := jitterentropy.o jitterentropy-kcapi.o
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o
Huang Ying2cdc6892009-08-06 15:32:38 +1000170obj-$(CONFIG_CRYPTO_GHASH) += ghash-generic.o
Herbert Xu03c8efc2010-10-19 21:12:39 +0800171obj-$(CONFIG_CRYPTO_USER_API) += af_alg.o
Herbert Xufe869cd2010-10-19 21:23:00 +0800172obj-$(CONFIG_CRYPTO_USER_API_HASH) += algif_hash.o
Herbert Xu8ff59092010-10-19 21:31:55 +0800173obj-$(CONFIG_CRYPTO_USER_API_SKCIPHER) += algif_skcipher.o
Stephan Mueller2f3755382014-12-25 23:00:39 +0100174obj-$(CONFIG_CRYPTO_USER_API_RNG) += algif_rng.o
Stephan Mueller44cac4f2015-02-28 20:50:40 +0100175obj-$(CONFIG_CRYPTO_USER_API_AEAD) += algif_aead.o
Nick Terrelld28fc3d2018-03-30 12:14:53 -0700176obj-$(CONFIG_CRYPTO_ZSTD) += zstd.o
Gilad Ben-Yossefe497c512018-09-20 14:18:39 +0100177obj-$(CONFIG_CRYPTO_OFB) += ofb.o
Vitaly Chikunov4a2289d2019-04-11 18:51:19 +0300178obj-$(CONFIG_CRYPTO_ECC) += ecc.o
Ard Biesheuvelbe1eb7f2019-08-19 17:17:33 +0300179obj-$(CONFIG_CRYPTO_ESSIV) += essiv.o
Ard Biesheuvelee772cb2019-11-08 13:22:34 +0100180obj-$(CONFIG_CRYPTO_CURVE25519) += curve25519-generic.o
Dan Williams685784a2007-07-09 11:56:42 -0700181
Tudor-Dan Ambarus6755fd22017-05-30 17:52:48 +0300182ecdh_generic-y += ecdh.o
183ecdh_generic-y += ecdh_helper.o
184obj-$(CONFIG_CRYPTO_ECDH) += ecdh_generic.o
185
Vitaly Chikunov0d7a7862019-04-11 18:51:20 +0300186$(obj)/ecrdsa_params.asn1.o: $(obj)/ecrdsa_params.asn1.c $(obj)/ecrdsa_params.asn1.h
187$(obj)/ecrdsa_pub_key.asn1.o: $(obj)/ecrdsa_pub_key.asn1.c $(obj)/ecrdsa_pub_key.asn1.h
188$(obj)/ecrdsa.o: $(obj)/ecrdsa_params.asn1.h $(obj)/ecrdsa_pub_key.asn1.h
189ecrdsa_generic-y += ecrdsa.o
190ecrdsa_generic-y += ecrdsa_params.asn1.o
191ecrdsa_generic-y += ecrdsa_pub_key.asn1.o
192obj-$(CONFIG_CRYPTO_ECRDSA) += ecrdsa_generic.o
193
Dan Williams685784a2007-07-09 11:56:42 -0700194#
195# generic algorithms and the async_tx api
196#
197obj-$(CONFIG_XOR_BLOCKS) += xor.o
Dan Williams9bc89cd2007-01-02 11:10:44 -0700198obj-$(CONFIG_ASYNC_CORE) += async_tx/
David Howells964f3b32012-09-13 15:17:21 +0100199obj-$(CONFIG_ASYMMETRIC_KEY_TYPE) += asymmetric_keys/
Dmitry Kasatkinee089972013-05-06 15:40:01 +0300200obj-$(CONFIG_CRYPTO_HASH_INFO) += hash_info.o
Herbert Xu266d0512016-11-22 20:08:25 +0800201crypto_simd-y := simd.o
202obj-$(CONFIG_CRYPTO_SIMD) += crypto_simd.o
Stephan Müller026a7332021-11-19 07:55:58 +0100203
204#
205# Key derivation function
206#
207obj-$(CONFIG_CRYPTO_KDF800108_CTR) += kdf_sp800108.o