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 117033b937SEric Biggersobj-$(CONFIG_CRYPTO_LIB_UTILS) += libcryptoutils.o 126e78ad0bSEric Biggerslibcryptoutils-y := memneq.o utils.o 137033b937SEric Biggers 145fb8ef25SArd Biesheuvel# chacha is used by the /dev/random driver which is always builtin 155fb8ef25SArd Biesheuvelobj-y += chacha.o 165fb8ef25SArd Biesheuvelobj-$(CONFIG_CRYPTO_LIB_CHACHA_GENERIC) += libchacha.o 175fb8ef25SArd Biesheuvel 18e59c1c98SArd Biesheuvelobj-$(CONFIG_CRYPTO_LIB_AES) += libaes.o 19e59c1c98SArd Biesheuvellibaes-y := aes.o 20e59c1c98SArd Biesheuvel 21f1354404SArd Biesheuvelobj-$(CONFIG_CRYPTO_LIB_AESCFB) += libaescfb.o 22f1354404SArd Biesheuvellibaescfb-y := aescfb.o 23f1354404SArd Biesheuvel 24520af5daSArd Biesheuvelobj-$(CONFIG_CRYPTO_LIB_AESGCM) += libaesgcm.o 25520af5daSArd Biesheuvellibaesgcm-y := aesgcm.o 26520af5daSArd Biesheuvel 27dc51f257SArd Biesheuvelobj-$(CONFIG_CRYPTO_LIB_ARC4) += libarc4.o 28dc51f257SArd Biesheuvellibarc4-y := arc4.o 2904007b0eSArd Biesheuvel 3061c581a4SArd Biesheuvelobj-$(CONFIG_CRYPTO_LIB_GF128MUL) += gf128mul.o 3161c581a4SArd Biesheuvel 326048fdccSJason A. Donenfeld# blake2s is used by the /dev/random driver which is always builtin 336048fdccSJason A. Donenfeldobj-y += libblake2s.o 346048fdccSJason A. Donenfeldlibblake2s-y := blake2s.o 356048fdccSJason A. Donenfeldlibblake2s-$(CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC) += blake2s-generic.o 3640b99697SEric Biggerslibblake2s-$(CONFIG_CRYPTO_SELFTESTS) += blake2s-selftest.o 3766d7fb94SJason A. Donenfeld 38ed20078bSArd Biesheuvelobj-$(CONFIG_CRYPTO_LIB_CHACHA20POLY1305) += libchacha20poly1305.o 39ed20078bSArd Biesheuvellibchacha20poly1305-y += chacha20poly1305.o 4040b99697SEric Biggerslibchacha20poly1305-$(CONFIG_CRYPTO_SELFTESTS) += chacha20poly1305-selftest.o 41ed20078bSArd Biesheuvel 42a8bdf2c4SHerbert Xuobj-$(CONFIG_CRYPTO_LIB_CURVE25519_GENERIC) += libcurve25519-generic.o 43a8bdf2c4SHerbert Xulibcurve25519-generic-y := curve25519-fiat32.o 44a8bdf2c4SHerbert Xulibcurve25519-generic-$(CONFIG_ARCH_SUPPORTS_INT128) := curve25519-hacl64.o 45a8bdf2c4SHerbert Xulibcurve25519-generic-y += curve25519-generic.o 462f13daeeSNathan Chancellor# clang versions prior to 18 may blow out the stack with KASAN 472f13daeeSNathan Chancellorifeq ($(call clang-min-version, 180000),) 482f13daeeSNathan ChancellorKASAN_SANITIZE_curve25519-hacl64.o := n 492f13daeeSNathan Chancellorendif 50a8bdf2c4SHerbert Xu 51a8bdf2c4SHerbert Xuobj-$(CONFIG_CRYPTO_LIB_CURVE25519) += libcurve25519.o 520ed42a6fSJason A. Donenfeldlibcurve25519-y += curve25519.o 5340b99697SEric Biggerslibcurve25519-$(CONFIG_CRYPTO_SELFTESTS) += curve25519-selftest.o 540ed42a6fSJason A. Donenfeld 5504007b0eSArd Biesheuvelobj-$(CONFIG_CRYPTO_LIB_DES) += libdes.o 5604007b0eSArd Biesheuvellibdes-y := des.o 5701d3aee8SHans de Goede 589b9d4ef0SHerbert Xuobj-$(CONFIG_CRYPTO_LIB_POLY1305) += libpoly1305.o 591c08a104SJason A. Donenfeldlibpoly1305-y += poly1305.o 6048ea8c6eSArd Biesheuvel 619b9d4ef0SHerbert Xuobj-$(CONFIG_CRYPTO_LIB_POLY1305_GENERIC) += libpoly1305-generic.o 629b9d4ef0SHerbert Xulibpoly1305-generic-y := poly1305-donna32.o 639b9d4ef0SHerbert Xulibpoly1305-generic-$(CONFIG_ARCH_SUPPORTS_INT128) := poly1305-donna64.o 649b9d4ef0SHerbert Xulibpoly1305-generic-y += poly1305-generic.o 659b9d4ef0SHerbert Xu 66ec8f7f48SEric Biggersobj-$(CONFIG_CRYPTO_LIB_SHA1) += libsha1.o 67ec8f7f48SEric Biggerslibsha1-y := sha1.o 68463f7408SEric Biggers 6901d3aee8SHans de Goedeobj-$(CONFIG_CRYPTO_LIB_SHA256) += libsha256.o 7001d3aee8SHans de Goedelibsha256-y := sha256.o 7166d7fb94SJason A. Donenfeld 72950e5c84SEric Biggersobj-$(CONFIG_CRYPTO_LIB_SHA256_GENERIC) += libsha256-generic.o 73950e5c84SEric Biggerslibsha256-generic-y := sha256-generic.o 74950e5c84SEric Biggers 75b693c703SEric Biggersobj-$(CONFIG_CRYPTO_LIB_SHA512) += libsha512.o 76b693c703SEric Biggerslibsha512-y := sha512.o 77b693c703SEric Biggersifeq ($(CONFIG_CRYPTO_LIB_SHA512_ARCH),y) 78b693c703SEric BiggersCFLAGS_sha512.o += -I$(src)/$(SRCARCH) 7924c91b62SEric Biggers 8024c91b62SEric Biggersifeq ($(CONFIG_ARM),y) 8124c91b62SEric Biggerslibsha512-y += arm/sha512-core.o 8224c91b62SEric Biggers$(obj)/arm/sha512-core.S: $(src)/arm/sha512-armv4.pl 8324c91b62SEric Biggers $(call cmd,perlasm) 8424c91b62SEric Biggersclean-files += arm/sha512-core.S 8524c91b62SEric BiggersAFLAGS_arm/sha512-core.o += $(aflags-thumb2-y) 8624c91b62SEric Biggersendif 8724c91b62SEric Biggers 8860e3f1e9SEric Biggersifeq ($(CONFIG_ARM64),y) 8960e3f1e9SEric Biggerslibsha512-y += arm64/sha512-core.o 9061f86c70SEric Biggers$(obj)/arm64/sha512-core.S: $(src)/arm64/sha2-armv8.pl 9160e3f1e9SEric Biggers $(call cmd,perlasm_with_args) 9260e3f1e9SEric Biggersclean-files += arm64/sha512-core.S 9360e3f1e9SEric Biggerslibsha512-$(CONFIG_KERNEL_MODE_NEON) += arm64/sha512-ce-core.o 9460e3f1e9SEric Biggersendif 95b59059a2SEric Biggers 96b59059a2SEric Biggerslibsha512-$(CONFIG_RISCV) += riscv/sha512-riscv64-zvknhb-zvkb.o 9702b35babSEric Biggerslibsha512-$(CONFIG_SPARC) += sparc/sha512_asm.o 98484c1811SEric Biggerslibsha512-$(CONFIG_X86) += x86/sha512-ssse3-asm.o \ 99484c1811SEric Biggers x86/sha512-avx-asm.o \ 100484c1811SEric Biggers x86/sha512-avx2-asm.o 101b693c703SEric Biggersendif # CONFIG_CRYPTO_LIB_SHA512_ARCH 102b693c703SEric Biggers 1032a598d0bSHerbert Xuobj-$(CONFIG_MPILIB) += mpi/ 1044964a1d9SEric Biggers 105ac90aad0SEric Biggersobj-$(CONFIG_CRYPTO_SELFTESTS_FULL) += simd.o 106f4065b2fSHerbert Xu 107f4065b2fSHerbert Xuobj-$(CONFIG_CRYPTO_LIB_SM3) += libsm3.o 108f4065b2fSHerbert Xulibsm3-y := sm3.o 1094a32e5dcSEric Biggers 1104a32e5dcSEric Biggersobj-$(CONFIG_ARM) += arm/ 11161f86c70SEric Biggersobj-$(CONFIG_ARM64) += arm64/ 1127e54e993SEric Biggersobj-$(CONFIG_MIPS) += mips/ 113*676d45abSEric Biggersobj-$(CONFIG_PPC) += powerpc/ 114