1dc51f257SArd Biesheuvel# SPDX-License-Identifier: GPL-2.0 2dc51f257SArd Biesheuvel 324c91b62SEric Biggersaflags-thumb2-$(CONFIG_THUMB2_KERNEL) := -U__thumb2__ -D__thumb2__=1 424c91b62SEric Biggers 524c91b62SEric Biggersquiet_cmd_perlasm = PERLASM $@ 624c91b62SEric Biggers cmd_perlasm = $(PERL) $(<) > $(@) 724c91b62SEric Biggers 860e3f1e9SEric Biggersquiet_cmd_perlasm_with_args = PERLASM $@ 960e3f1e9SEric Biggers cmd_perlasm_with_args = $(PERL) $(<) void $(@) 1060e3f1e9SEric Biggers 1173f315c1SEric Biggersppc64-perlasm-flavour-y := linux-ppc64 1273f315c1SEric Biggersppc64-perlasm-flavour-$(CONFIG_PPC64_ELF_ABI_V2) := linux-ppc64-elfv2 1373f315c1SEric Biggersppc64-perlasm-flavour-$(CONFIG_CPU_LITTLE_ENDIAN) := linux-ppc64le 1473f315c1SEric Biggers 154dcf6cadSEric Biggersobj-$(CONFIG_KUNIT) += tests/ 164dcf6cadSEric Biggers 17aacb37f5SEric Biggersobj-$(CONFIG_CRYPTO_HASH_INFO) += hash_info.o 18aacb37f5SEric Biggers 197033b937SEric Biggersobj-$(CONFIG_CRYPTO_LIB_UTILS) += libcryptoutils.o 206e78ad0bSEric Biggerslibcryptoutils-y := memneq.o utils.o 217033b937SEric Biggers 22a22fd0e3SEric Biggers################################################################################ 23a22fd0e3SEric Biggers 24e59c1c98SArd Biesheuvelobj-$(CONFIG_CRYPTO_LIB_AES) += libaes.o 25e59c1c98SArd Biesheuvellibaes-y := aes.o 26a22fd0e3SEric Biggersifeq ($(CONFIG_CRYPTO_LIB_AES_ARCH),y) 27a22fd0e3SEric BiggersCFLAGS_aes.o += -I$(src)/$(SRCARCH) 28fa229775SEric Biggers 29fa229775SEric Biggerslibaes-$(CONFIG_ARM) += arm/aes-cipher-core.o 30c2db2288SEric Biggerslibaes-$(CONFIG_ARM64) += arm64/aes-cipher-core.o \ 31c2db2288SEric Biggers arm64/aes-ce-core.o \ 324b908403SEric Biggers arm64/aes-ce.o \ 334b908403SEric Biggers arm64/aes-neon.o 342b1ef7aeSEric Biggers 350892c91bSEric Biggersifeq ($(CONFIG_PPC),y) 360892c91bSEric Biggersifeq ($(CONFIG_SPE),y) 370892c91bSEric Biggerslibaes-y += powerpc/aes-spe-core.o \ 380892c91bSEric Biggers powerpc/aes-spe-keys.o \ 390892c91bSEric Biggers powerpc/aes-spe-modes.o \ 400892c91bSEric Biggers powerpc/aes-tab-4k.o 417cf2082eSEric Biggerselse 427cf2082eSEric Biggerslibaes-y += powerpc/aesp8-ppc.o 437cf2082eSEric Biggersquiet_cmd_perlasm_aes = PERLASM $@ 4473f315c1SEric Biggers cmd_perlasm_aes = $(PERL) $< $(ppc64-perlasm-flavour-y) $@ 457cf2082eSEric Biggers# Use if_changed instead of cmd, in case the flavour changed. 467cf2082eSEric Biggers$(obj)/powerpc/aesp8-ppc.S: $(src)/powerpc/aesp8-ppc.pl FORCE 477cf2082eSEric Biggers $(call if_changed,perlasm_aes) 487cf2082eSEric Biggerstargets += powerpc/aesp8-ppc.S 497cf2082eSEric BiggersOBJECT_FILES_NON_STANDARD_powerpc/aesp8-ppc.o := y 507cf2082eSEric Biggersendif # !CONFIG_SPE 510892c91bSEric Biggersendif # CONFIG_PPC 520892c91bSEric Biggers 53a4e573dbSEric Biggerslibaes-$(CONFIG_RISCV) += riscv/aes-riscv64-zvkned.o 54f083f8deSEric Biggersifneq ($(CONFIG_CRYPTO_LIB_AES_CTR),) 55f083f8deSEric Biggerslibaes-$(CONFIG_RISCV) += riscv/aes-riscv64-zvkned-zvkb.o 56f083f8deSEric Biggersendif 5769897f5eSEric Biggersifneq ($(CONFIG_CRYPTO_LIB_AES_XTS),) 5869897f5eSEric Biggerslibaes-$(CONFIG_RISCV) += riscv/aes-riscv64-zvkned-zvbb-zvkg.o 5969897f5eSEric Biggersendif 60f083f8deSEric Biggers 61293c7cd5SEric Biggerslibaes-$(CONFIG_SPARC) += sparc/aes_asm.o 627e58d75bSEric Biggers 6324eb22d8SEric Biggerslibaes-$(CONFIG_X86) += x86/aes-aesni.o 647e58d75bSEric Biggersifneq ($(CONFIG_CRYPTO_LIB_AES_CTR),) 657e58d75bSEric Biggerslibaes-$(CONFIG_X86_64) += x86/aes-ctr-avx-x86_64.o 667e58d75bSEric Biggersendif 672bd68888SEric Biggersifneq ($(CONFIG_CRYPTO_LIB_AES_XTS),) 682bd68888SEric Biggerslibaes-$(CONFIG_X86_64) += x86/aes-xts-avx-x86_64.o 692bd68888SEric Biggersendif 70a22fd0e3SEric Biggersendif # CONFIG_CRYPTO_LIB_AES_ARCH 71a22fd0e3SEric Biggers 72d5b66179SEric Biggers# clean-files must be defined unconditionally 73d5b66179SEric Biggersclean-files += powerpc/aesp8-ppc.S 74d5b66179SEric Biggers 75a22fd0e3SEric Biggers################################################################################ 76e59c1c98SArd Biesheuvel 77f1354404SArd Biesheuvelobj-$(CONFIG_CRYPTO_LIB_AESCFB) += libaescfb.o 78f1354404SArd Biesheuvellibaescfb-y := aescfb.o 79f1354404SArd Biesheuvel 80dc51f257SArd Biesheuvelobj-$(CONFIG_CRYPTO_LIB_ARC4) += libarc4.o 81dc51f257SArd Biesheuvellibarc4-y := arc4.o 8204007b0eSArd Biesheuvel 8361c581a4SArd Biesheuvelobj-$(CONFIG_CRYPTO_LIB_GF128MUL) += gf128mul.o 8461c581a4SArd Biesheuvel 8539ee3970SEric Biggers################################################################################ 8639ee3970SEric Biggers 8723a16c95SEric Biggersobj-$(CONFIG_CRYPTO_LIB_BLAKE2B) += libblake2b.o 8823a16c95SEric Biggerslibblake2b-y := blake2b.o 8923a16c95SEric Biggersifeq ($(CONFIG_CRYPTO_LIB_BLAKE2B_ARCH),y) 9023a16c95SEric BiggersCFLAGS_blake2b.o += -I$(src)/$(SRCARCH) 91ba6617bdSEric Biggerslibblake2b-$(CONFIG_ARM) += arm/blake2b-neon-core.o 9223a16c95SEric Biggersendif # CONFIG_CRYPTO_LIB_BLAKE2B_ARCH 9323a16c95SEric Biggers 9423a16c95SEric Biggers################################################################################ 9523a16c95SEric Biggers 966048fdccSJason A. Donenfeld# blake2s is used by the /dev/random driver which is always builtin 9739ee3970SEric Biggersobj-y += blake2s.o 9839ee3970SEric Biggersifeq ($(CONFIG_CRYPTO_LIB_BLAKE2S_ARCH),y) 9939ee3970SEric BiggersCFLAGS_blake2s.o += -I$(src)/$(SRCARCH) 10039ee3970SEric Biggersobj-$(CONFIG_ARM) += arm/blake2s-core.o 10139ee3970SEric Biggersobj-$(CONFIG_X86) += x86/blake2s-core.o 10239ee3970SEric Biggersendif 10366d7fb94SJason A. Donenfeld 10413cecc52SEric Biggers################################################################################ 10513cecc52SEric Biggers 10613cecc52SEric Biggers# chacha20_block() is used by the /dev/random driver which is always builtin 10713cecc52SEric Biggersobj-y += chacha-block-generic.o 10813cecc52SEric Biggers 10913cecc52SEric Biggersobj-$(CONFIG_CRYPTO_LIB_CHACHA) += libchacha.o 11013cecc52SEric Biggerslibchacha-y := chacha.o 11113cecc52SEric Biggers 11213cecc52SEric Biggersifeq ($(CONFIG_CRYPTO_LIB_CHACHA_ARCH),y) 11313cecc52SEric BiggersCFLAGS_chacha.o += -I$(src)/$(SRCARCH) 11413cecc52SEric Biggers 11513cecc52SEric Biggersifeq ($(CONFIG_ARM),y) 11613cecc52SEric Biggerslibchacha-y += arm/chacha-scalar-core.o 11713cecc52SEric Biggerslibchacha-$(CONFIG_KERNEL_MODE_NEON) += arm/chacha-neon-core.o 11813cecc52SEric Biggersendif 11913cecc52SEric Biggers 12013cecc52SEric Biggerslibchacha-$(CONFIG_ARM64) += arm64/chacha-neon-core.o 12113cecc52SEric Biggers 12213cecc52SEric Biggersifeq ($(CONFIG_MIPS),y) 12313cecc52SEric Biggerslibchacha-y += mips/chacha-core.o 12413cecc52SEric BiggersAFLAGS_mips/chacha-core.o += -O2 # needed to fill branch delay slots 12513cecc52SEric Biggersendif 12613cecc52SEric Biggers 12713cecc52SEric Biggerslibchacha-$(CONFIG_PPC) += powerpc/chacha-p10le-8x.o 12813cecc52SEric Biggerslibchacha-$(CONFIG_RISCV) += riscv/chacha-riscv64-zvkb.o 12913cecc52SEric Biggerslibchacha-$(CONFIG_S390) += s390/chacha-s390.o 13013cecc52SEric Biggerslibchacha-$(CONFIG_X86) += x86/chacha-ssse3-x86_64.o \ 13113cecc52SEric Biggers x86/chacha-avx2-x86_64.o \ 13213cecc52SEric Biggers x86/chacha-avx512vl-x86_64.o 13313cecc52SEric Biggersendif # CONFIG_CRYPTO_LIB_CHACHA_ARCH 13413cecc52SEric Biggers 13513cecc52SEric Biggers################################################################################ 13613cecc52SEric Biggers 137ed20078bSArd Biesheuvelobj-$(CONFIG_CRYPTO_LIB_CHACHA20POLY1305) += libchacha20poly1305.o 138ed20078bSArd Biesheuvellibchacha20poly1305-y += chacha20poly1305.o 139ed20078bSArd Biesheuvel 14068546e56SEric Biggers################################################################################ 14168546e56SEric Biggers 14268546e56SEric Biggersobj-$(CONFIG_CRYPTO_LIB_CURVE25519) += libcurve25519.o 14368546e56SEric Biggerslibcurve25519-y := curve25519.o 14468546e56SEric Biggers 14568546e56SEric Biggers# Disable GCOV in odd or sensitive code 14668546e56SEric BiggersGCOV_PROFILE_curve25519.o := n 14768546e56SEric Biggers 14868546e56SEric Biggersifeq ($(CONFIG_ARCH_SUPPORTS_INT128),y) 14968546e56SEric Biggerslibcurve25519-$(CONFIG_CRYPTO_LIB_CURVE25519_GENERIC) += curve25519-hacl64.o 15068546e56SEric Biggerselse 15168546e56SEric Biggerslibcurve25519-$(CONFIG_CRYPTO_LIB_CURVE25519_GENERIC) += curve25519-fiat32.o 15268546e56SEric Biggersendif 1532f13daeeSNathan Chancellor# clang versions prior to 18 may blow out the stack with KASAN 1542b81082aSNathan Chancellorifeq ($(CONFIG_CC_IS_CLANG)_$(call clang-min-version, 180000),y_) 1552f13daeeSNathan ChancellorKASAN_SANITIZE_curve25519-hacl64.o := n 1562f13daeeSNathan Chancellorendif 157a8bdf2c4SHerbert Xu 15868546e56SEric Biggersifeq ($(CONFIG_CRYPTO_LIB_CURVE25519_ARCH),y) 15968546e56SEric BiggersCFLAGS_curve25519.o += -I$(src)/$(SRCARCH) 16068546e56SEric Biggerslibcurve25519-$(CONFIG_ARM) += arm/curve25519-core.o 16168546e56SEric Biggerslibcurve25519-$(CONFIG_PPC) += powerpc/curve25519-ppc64le_asm.o 16268546e56SEric Biggersendif 16368546e56SEric Biggers 16468546e56SEric Biggers################################################################################ 1650ed42a6fSJason A. Donenfeld 16604007b0eSArd Biesheuvelobj-$(CONFIG_CRYPTO_LIB_DES) += libdes.o 16704007b0eSArd Biesheuvellibdes-y := des.o 16801d3aee8SHans de Goede 169e1644613SEric Biggers################################################################################ 170e1644613SEric Biggers 17161f66c52SEric Biggersobj-$(CONFIG_CRYPTO_LIB_GF128HASH) += libgf128hash.o 17261f66c52SEric Biggerslibgf128hash-y := gf128hash.o 17361f66c52SEric Biggersifeq ($(CONFIG_CRYPTO_LIB_GF128HASH_ARCH),y) 17461f66c52SEric BiggersCFLAGS_gf128hash.o += -I$(src)/$(SRCARCH) 17571e59795SEric Biggerslibgf128hash-$(CONFIG_ARM) += arm/ghash-neon-core.o 176a336c01fSEric Biggerslibgf128hash-$(CONFIG_ARM64) += arm64/ghash-neon-core.o \ 177a336c01fSEric Biggers arm64/polyval-ce-core.o 17873f315c1SEric Biggers 17973f315c1SEric Biggersifeq ($(CONFIG_PPC),y) 18073f315c1SEric Biggerslibgf128hash-y += powerpc/ghashp8-ppc.o 18173f315c1SEric Biggersquiet_cmd_perlasm_ghash = PERLASM $@ 18273f315c1SEric Biggers cmd_perlasm_ghash = $(PERL) $< $(ppc64-perlasm-flavour-y) $@ 18373f315c1SEric Biggers$(obj)/powerpc/ghashp8-ppc.S: $(src)/powerpc/ghashp8-ppc.pl FORCE 18473f315c1SEric Biggers $(call if_changed,perlasm_ghash) 18573f315c1SEric Biggerstargets += powerpc/ghashp8-ppc.S 18673f315c1SEric BiggersOBJECT_FILES_NON_STANDARD_powerpc/ghashp8-ppc.o := y 18761f66c52SEric Biggersendif 18861f66c52SEric Biggers 189af413d71SEric Biggerslibgf128hash-$(CONFIG_RISCV) += riscv/ghash-riscv64-zvkg.o 1903e79c8ecSEric Biggerslibgf128hash-$(CONFIG_X86) += x86/ghash-pclmul.o \ 1913e79c8ecSEric Biggers x86/polyval-pclmul-avx.o 19273f315c1SEric Biggersendif # CONFIG_CRYPTO_LIB_GF128HASH_ARCH 19373f315c1SEric Biggers 19473f315c1SEric Biggers# clean-files must be defined unconditionally 19573f315c1SEric Biggersclean-files += powerpc/ghashp8-ppc.S 19673f315c1SEric Biggers 19761f66c52SEric Biggers################################################################################ 19861f66c52SEric Biggers 199e1644613SEric Biggersobj-$(CONFIG_CRYPTO_LIB_MD5) += libmd5.o 200e1644613SEric Biggerslibmd5-y := md5.o 201e1644613SEric Biggers 202e1644613SEric Biggers################################################################################ 203e1644613SEric Biggers 20464edcceaSEric Biggersobj-$(CONFIG_CRYPTO_LIB_MLDSA) += libmldsa.o 20564edcceaSEric Biggerslibmldsa-y := mldsa.o 20664edcceaSEric Biggers 20764edcceaSEric Biggers################################################################################ 20864edcceaSEric Biggers 20914e15c71SEric Biggersobj-$(CONFIG_CRYPTO_LIB_NH) += libnh.o 21014e15c71SEric Biggerslibnh-y := nh.o 21114e15c71SEric Biggersifeq ($(CONFIG_CRYPTO_LIB_NH_ARCH),y) 21214e15c71SEric BiggersCFLAGS_nh.o += -I$(src)/$(SRCARCH) 21329e39a11SEric Biggerslibnh-$(CONFIG_ARM) += arm/nh-neon-core.o 214b4a8528dSEric Biggerslibnh-$(CONFIG_ARM64) += arm64/nh-neon-core.o 215a229d832SEric Biggerslibnh-$(CONFIG_X86) += x86/nh-sse2.o x86/nh-avx2.o 21614e15c71SEric Biggersendif 21714e15c71SEric Biggers 21814e15c71SEric Biggers################################################################################ 21914e15c71SEric Biggers 2209b9d4ef0SHerbert Xuobj-$(CONFIG_CRYPTO_LIB_POLY1305) += libpoly1305.o 221b646b782SEric Biggerslibpoly1305-y := poly1305.o 222b646b782SEric Biggersifeq ($(CONFIG_ARCH_SUPPORTS_INT128),y) 223b646b782SEric Biggerslibpoly1305-$(CONFIG_CRYPTO_LIB_POLY1305_GENERIC) += poly1305-donna64.o 224b646b782SEric Biggerselse 225b646b782SEric Biggerslibpoly1305-$(CONFIG_CRYPTO_LIB_POLY1305_GENERIC) += poly1305-donna32.o 226b646b782SEric Biggersendif 22748ea8c6eSArd Biesheuvel 228b646b782SEric Biggersifeq ($(CONFIG_CRYPTO_LIB_POLY1305_ARCH),y) 229b646b782SEric BiggersCFLAGS_poly1305.o += -I$(src)/$(SRCARCH) 230b646b782SEric Biggers 231b646b782SEric Biggersifeq ($(CONFIG_ARM),y) 232b646b782SEric Biggerslibpoly1305-y += arm/poly1305-core.o 233b646b782SEric Biggers$(obj)/arm/poly1305-core.S: $(src)/arm/poly1305-armv4.pl 234b646b782SEric Biggers $(call cmd,perlasm) 235b646b782SEric Biggers# massage the perlasm code a bit so we only get the NEON routine if we need it 236b646b782SEric Biggerspoly1305-aflags-$(CONFIG_CPU_V7) := -U__LINUX_ARM_ARCH__ -D__LINUX_ARM_ARCH__=5 237b646b782SEric Biggerspoly1305-aflags-$(CONFIG_KERNEL_MODE_NEON) := -U__LINUX_ARM_ARCH__ -D__LINUX_ARM_ARCH__=7 238b646b782SEric BiggersAFLAGS_arm/poly1305-core.o += $(poly1305-aflags-y) $(aflags-thumb2-y) 239b646b782SEric Biggersendif 240b646b782SEric Biggers 241b646b782SEric Biggersifeq ($(CONFIG_ARM64),y) 242b646b782SEric Biggerslibpoly1305-y += arm64/poly1305-core.o 243b646b782SEric Biggers$(obj)/arm64/poly1305-core.S: $(src)/arm64/poly1305-armv8.pl 244b646b782SEric Biggers $(call cmd,perlasm_with_args) 245b646b782SEric Biggersendif 246b646b782SEric Biggers 247b646b782SEric Biggersifeq ($(CONFIG_MIPS),y) 248b646b782SEric Biggerslibpoly1305-y += mips/poly1305-core.o 249b646b782SEric Biggerspoly1305-perlasm-flavour-$(CONFIG_32BIT) := o32 250b646b782SEric Biggerspoly1305-perlasm-flavour-$(CONFIG_64BIT) := 64 251b646b782SEric Biggersquiet_cmd_perlasm_poly1305 = PERLASM $@ 252b646b782SEric Biggers cmd_perlasm_poly1305 = $(PERL) $< $(poly1305-perlasm-flavour-y) $@ 253b646b782SEric Biggers# Use if_changed instead of cmd, in case the flavour changed. 254b646b782SEric Biggers$(obj)/mips/poly1305-core.S: $(src)/mips/poly1305-mips.pl FORCE 255b646b782SEric Biggers $(call if_changed,perlasm_poly1305) 256b646b782SEric Biggerstargets += mips/poly1305-core.S 257b646b782SEric Biggersendif 258b646b782SEric Biggers 259b646b782SEric Biggerslibpoly1305-$(CONFIG_PPC) += powerpc/poly1305-p10le_64.o 260b646b782SEric Biggers 261bef9c755SZhihang Shaoifeq ($(CONFIG_RISCV),y) 262bef9c755SZhihang Shaolibpoly1305-y += riscv/poly1305-core.o 263bef9c755SZhihang Shaopoly1305-perlasm-flavour-$(CONFIG_32BIT) := 32 264bef9c755SZhihang Shaopoly1305-perlasm-flavour-$(CONFIG_64BIT) := 64 265bef9c755SZhihang Shaoquiet_cmd_perlasm_poly1305 = PERLASM $@ 266bef9c755SZhihang Shao cmd_perlasm_poly1305 = $(PERL) $< $(poly1305-perlasm-flavour-y) $@ 267bef9c755SZhihang Shao# Use if_changed instead of cmd, in case the flavour changed. 268bef9c755SZhihang Shao$(obj)/riscv/poly1305-core.S: $(src)/riscv/poly1305-riscv.pl FORCE 269bef9c755SZhihang Shao $(call if_changed,perlasm_poly1305) 270bef9c755SZhihang Shaotargets += riscv/poly1305-core.S 271bef9c755SZhihang ShaoAFLAGS_riscv/poly1305-core.o += -Dpoly1305_init=poly1305_block_init 272bef9c755SZhihang Shaoendif 273bef9c755SZhihang Shao 274b646b782SEric Biggersifeq ($(CONFIG_X86),y) 275b646b782SEric Biggerslibpoly1305-y += x86/poly1305-x86_64-cryptogams.o 276b646b782SEric Biggers$(obj)/x86/poly1305-x86_64-cryptogams.S: $(src)/x86/poly1305-x86_64-cryptogams.pl 277b646b782SEric Biggers $(call cmd,perlasm) 278b646b782SEric Biggersendif 279b646b782SEric Biggers 280b646b782SEric Biggersendif # CONFIG_CRYPTO_LIB_POLY1305_ARCH 281b646b782SEric Biggers 282b646b782SEric Biggers# clean-files must be defined unconditionally 283b646b782SEric Biggersclean-files += arm/poly1305-core.S \ 284b646b782SEric Biggers arm64/poly1305-core.S \ 285b646b782SEric Biggers mips/poly1305-core.S \ 286bef9c755SZhihang Shao riscv/poly1305-core.S \ 287b646b782SEric Biggers x86/poly1305-x86_64-cryptogams.S 2889b9d4ef0SHerbert Xu 28990860aefSEric Biggers################################################################################ 29090860aefSEric Biggers 291ec8f7f48SEric Biggersobj-$(CONFIG_CRYPTO_LIB_SHA1) += libsha1.o 292ec8f7f48SEric Biggerslibsha1-y := sha1.o 29390860aefSEric Biggersifeq ($(CONFIG_CRYPTO_LIB_SHA1_ARCH),y) 29490860aefSEric BiggersCFLAGS_sha1.o += -I$(src)/$(SRCARCH) 29570cb6ca5SEric Biggersifeq ($(CONFIG_ARM),y) 29670cb6ca5SEric Biggerslibsha1-y += arm/sha1-armv4-large.o 29770cb6ca5SEric Biggerslibsha1-$(CONFIG_KERNEL_MODE_NEON) += arm/sha1-armv7-neon.o \ 29870cb6ca5SEric Biggers arm/sha1-ce-core.o 29970cb6ca5SEric Biggersendif 30000d549bbSEric Biggerslibsha1-$(CONFIG_ARM64) += arm64/sha1-ce-core.o 3016b9ae8cfSEric Biggersifeq ($(CONFIG_PPC),y) 3026b9ae8cfSEric Biggerslibsha1-y += powerpc/sha1-powerpc-asm.o 3036b9ae8cfSEric Biggerslibsha1-$(CONFIG_SPE) += powerpc/sha1-spe-asm.o 3046b9ae8cfSEric Biggersendif 305c7510599SEric Biggerslibsha1-$(CONFIG_SPARC) += sparc/sha1_asm.o 306f3d6cb3dSEric Biggerslibsha1-$(CONFIG_X86) += x86/sha1-ssse3-and-avx.o \ 307f3d6cb3dSEric Biggers x86/sha1-avx2-asm.o \ 308f3d6cb3dSEric Biggers x86/sha1-ni-asm.o 30990860aefSEric Biggersendif # CONFIG_CRYPTO_LIB_SHA1_ARCH 310463f7408SEric Biggers 311e96cb950SEric Biggers################################################################################ 312e96cb950SEric Biggers 31301d3aee8SHans de Goedeobj-$(CONFIG_CRYPTO_LIB_SHA256) += libsha256.o 31401d3aee8SHans de Goedelibsha256-y := sha256.o 315e96cb950SEric Biggersifeq ($(CONFIG_CRYPTO_LIB_SHA256_ARCH),y) 316e96cb950SEric BiggersCFLAGS_sha256.o += -I$(src)/$(SRCARCH) 31766d7fb94SJason A. Donenfeld 318e96cb950SEric Biggersifeq ($(CONFIG_ARM),y) 319e96cb950SEric Biggerslibsha256-y += arm/sha256-ce.o arm/sha256-core.o 320e96cb950SEric Biggers$(obj)/arm/sha256-core.S: $(src)/arm/sha256-armv4.pl 321e96cb950SEric Biggers $(call cmd,perlasm) 322e96cb950SEric BiggersAFLAGS_arm/sha256-core.o += $(aflags-thumb2-y) 323e96cb950SEric Biggersendif 324e96cb950SEric Biggers 325e96cb950SEric Biggersifeq ($(CONFIG_ARM64),y) 326c2db2288SEric Biggerslibsha256-y += arm64/sha256-ce.o arm64/sha256-core.o 327e96cb950SEric Biggers$(obj)/arm64/sha256-core.S: $(src)/arm64/sha2-armv8.pl 328e96cb950SEric Biggers $(call cmd,perlasm_with_args) 329e96cb950SEric Biggersendif 330e96cb950SEric Biggers 331e96cb950SEric Biggerslibsha256-$(CONFIG_PPC) += powerpc/sha256-spe-asm.o 332e96cb950SEric Biggerslibsha256-$(CONFIG_RISCV) += riscv/sha256-riscv64-zvknha_or_zvknhb-zvkb.o 333e96cb950SEric Biggerslibsha256-$(CONFIG_SPARC) += sparc/sha256_asm.o 334e96cb950SEric Biggerslibsha256-$(CONFIG_X86) += x86/sha256-ssse3-asm.o \ 335e96cb950SEric Biggers x86/sha256-avx-asm.o \ 336e96cb950SEric Biggers x86/sha256-avx2-asm.o \ 337e96cb950SEric Biggers x86/sha256-ni-asm.o 338e96cb950SEric Biggersendif # CONFIG_CRYPTO_LIB_SHA256_ARCH 339e96cb950SEric Biggers 340e96cb950SEric Biggers################################################################################ 341950e5c84SEric Biggers 342b693c703SEric Biggersobj-$(CONFIG_CRYPTO_LIB_SHA512) += libsha512.o 343b693c703SEric Biggerslibsha512-y := sha512.o 344b693c703SEric Biggersifeq ($(CONFIG_CRYPTO_LIB_SHA512_ARCH),y) 345b693c703SEric BiggersCFLAGS_sha512.o += -I$(src)/$(SRCARCH) 34624c91b62SEric Biggers 34724c91b62SEric Biggersifeq ($(CONFIG_ARM),y) 34824c91b62SEric Biggerslibsha512-y += arm/sha512-core.o 34924c91b62SEric Biggers$(obj)/arm/sha512-core.S: $(src)/arm/sha512-armv4.pl 35024c91b62SEric Biggers $(call cmd,perlasm) 35124c91b62SEric BiggersAFLAGS_arm/sha512-core.o += $(aflags-thumb2-y) 35224c91b62SEric Biggersendif 35324c91b62SEric Biggers 35460e3f1e9SEric Biggersifeq ($(CONFIG_ARM64),y) 355c2db2288SEric Biggerslibsha512-y += arm64/sha512-ce-core.o arm64/sha512-core.o 35661f86c70SEric Biggers$(obj)/arm64/sha512-core.S: $(src)/arm64/sha2-armv8.pl 35760e3f1e9SEric Biggers $(call cmd,perlasm_with_args) 35860e3f1e9SEric Biggersendif 359b59059a2SEric Biggers 360b59059a2SEric Biggerslibsha512-$(CONFIG_RISCV) += riscv/sha512-riscv64-zvknhb-zvkb.o 36102b35babSEric Biggerslibsha512-$(CONFIG_SPARC) += sparc/sha512_asm.o 362484c1811SEric Biggerslibsha512-$(CONFIG_X86) += x86/sha512-ssse3-asm.o \ 363484c1811SEric Biggers x86/sha512-avx-asm.o \ 364484c1811SEric Biggers x86/sha512-avx2-asm.o 365b693c703SEric Biggersendif # CONFIG_CRYPTO_LIB_SHA512_ARCH 366b693c703SEric Biggers 367e96cb950SEric Biggers################################################################################ 368e96cb950SEric Biggers 36905934472SDavid Howellsobj-$(CONFIG_CRYPTO_LIB_SHA3) += libsha3.o 37005934472SDavid Howellslibsha3-y := sha3.o 37105934472SDavid Howells 3721e29a750SEric Biggersifeq ($(CONFIG_CRYPTO_LIB_SHA3_ARCH),y) 3731e29a750SEric BiggersCFLAGS_sha3.o += -I$(src)/$(SRCARCH) 3741e29a750SEric Biggerslibsha3-$(CONFIG_ARM64) += arm64/sha3-ce-core.o 3751e29a750SEric Biggersendif # CONFIG_CRYPTO_LIB_SHA3_ARCH 3761e29a750SEric Biggers 37705934472SDavid Howells################################################################################ 37805934472SDavid Howells 379*b73abee3SEric Biggers# SipHash support is always built-in because it's used by core components such 380*b73abee3SEric Biggers# as printk (for pointer hashing) and networking. 381*b73abee3SEric Biggersobj-y += siphash.o 382*b73abee3SEric Biggers 383*b73abee3SEric Biggers################################################################################ 384*b73abee3SEric Biggers 3859f69f52bSEric Biggersobj-$(CONFIG_CRYPTO_LIB_SM3) += libsm3.o 3869f69f52bSEric Biggerslibsm3-y := sm3.o 3879f69f52bSEric Biggersifeq ($(CONFIG_CRYPTO_LIB_SM3_ARCH),y) 3889f69f52bSEric BiggersCFLAGS_sm3.o += -I$(src)/$(SRCARCH) 3899f69f52bSEric Biggerslibsm3-$(CONFIG_ARM64) += arm64/sm3-ce-core.o \ 3909f69f52bSEric Biggers arm64/sm3-neon-core.o 3915f6bbba5SEric Biggerslibsm3-$(CONFIG_RISCV) += riscv/sm3-riscv64-zvksh-zvkb.o 39217ba6108SEric Biggerslibsm3-$(CONFIG_X86) += x86/sm3-avx-asm_64.o 3939f69f52bSEric Biggersendif # CONFIG_CRYPTO_LIB_SM3_ARCH 3949f69f52bSEric Biggers 3959f69f52bSEric Biggers################################################################################ 3969f69f52bSEric Biggers 3972a598d0bSHerbert Xuobj-$(CONFIG_MPILIB) += mpi/ 3984964a1d9SEric Biggers 399ac90aad0SEric Biggersobj-$(CONFIG_CRYPTO_SELFTESTS_FULL) += simd.o 400f4065b2fSHerbert Xu 401fd7e5de4STal Zussman# clean-files must be defined unconditionally 402fd7e5de4STal Zussmanclean-files += arm/sha256-core.S arm/sha512-core.S 403fd7e5de4STal Zussmanclean-files += arm64/sha256-core.S arm64/sha512-core.S 404