# SPDX-License-Identifier: GPL-2.0
#
# Cryptographic API
#
obj-$([31mCONFIG_CRYPTO[0m) += crypto.o
crypto-y := api.o cipher.o compress.o memneq.o
obj-$([31mCONFIG_CRYPTO_ENGINE[0m) += crypto_engine.o
obj-$([31mCONFIG_CRYPTO_FIPS[0m) += fips.o
crypto_algapi-$([31mCONFIG_PROC_FS[0m) += proc.o
crypto_algapi-y := algapi.o scatterwalk.o $(crypto_algapi-y)
obj-$([31mCONFIG_CRYPTO_ALGAPI2[0m) += crypto_algapi.o
obj-$([31mCONFIG_CRYPTO_AEAD2[0m) += aead.o
crypto_blkcipher-y := ablkcipher.o
crypto_blkcipher-y += blkcipher.o
crypto_blkcipher-y += skcipher.o
obj-$([31mCONFIG_CRYPTO_BLKCIPHER2[0m) += crypto_blkcipher.o
obj-$([31mCONFIG_CRYPTO_SEQIV[0m) += seqiv.o
obj-$([31mCONFIG_CRYPTO_ECHAINIV[0m) += echainiv.o
crypto_hash-y += ahash.o
crypto_hash-y += shash.o
obj-$([31mCONFIG_CRYPTO_HASH2[0m) += crypto_hash.o
obj-$([31mCONFIG_CRYPTO_AKCIPHER2[0m) += akcipher.o
obj-$([31mCONFIG_CRYPTO_KPP2[0m) += kpp.o
dh_generic-y := dh.o
dh_generic-y += dh_helper.o
obj-$([31mCONFIG_CRYPTO_DH[0m) += dh_generic.o
$(obj)/rsapubkey.asn1.o: $(obj)/rsapubkey.asn1.c $(obj)/rsapubkey.asn1.h
$(obj)/rsaprivkey.asn1.o: $(obj)/rsaprivkey.asn1.c $(obj)/rsaprivkey.asn1.h
$(obj)/rsa_helper.o: $(obj)/rsapubkey.asn1.h $(obj)/rsaprivkey.asn1.h
rsa_generic-y := rsapubkey.asn1.o
rsa_generic-y += rsaprivkey.asn1.o
rsa_generic-y += rsa.o
rsa_generic-y += rsa_helper.o
rsa_generic-y += rsa-pkcs1pad.o
obj-$([31mCONFIG_CRYPTO_RSA[0m) += rsa_generic.o
crypto_acompress-y := acompress.o
crypto_acompress-y += scompress.o
obj-$([31mCONFIG_CRYPTO_ACOMP2[0m) += crypto_acompress.o
cryptomgr-y := algboss.o testmgr.o
obj-$([31mCONFIG_CRYPTO_MANAGER2[0m) += cryptomgr.o
obj-$([31mCONFIG_CRYPTO_USER[0m) += crypto_user.o
crypto_user-y := crypto_user_base.o
crypto_user-$([31mCONFIG_CRYPTO_STATS[0m) += crypto_user_stat.o
obj-$([31mCONFIG_CRYPTO_CMAC[0m) += cmac.o
obj-$([31mCONFIG_CRYPTO_HMAC[0m) += hmac.o
obj-$([31mCONFIG_CRYPTO_VMAC[0m) += vmac.o
obj-$([31mCONFIG_CRYPTO_XCBC[0m) += xcbc.o
obj-$([31mCONFIG_CRYPTO_NULL2[0m) += crypto_null.o
obj-$([31mCONFIG_CRYPTO_MD4[0m) += md4.o
obj-$([31mCONFIG_CRYPTO_MD5[0m) += md5.o
obj-$([31mCONFIG_CRYPTO_RMD128[0m) += rmd128.o
obj-$([31mCONFIG_CRYPTO_RMD160[0m) += rmd160.o
obj-$([31mCONFIG_CRYPTO_RMD256[0m) += rmd256.o
obj-$([31mCONFIG_CRYPTO_RMD320[0m) += rmd320.o
obj-$([31mCONFIG_CRYPTO_SHA1[0m) += sha1_generic.o
obj-$([31mCONFIG_CRYPTO_SHA256[0m) += sha256_generic.o
obj-$([31mCONFIG_CRYPTO_SHA512[0m) += sha512_generic.o
obj-$([31mCONFIG_CRYPTO_SHA3[0m) += sha3_generic.o
obj-$([31mCONFIG_CRYPTO_SM3[0m) += sm3_generic.o
obj-$([31mCONFIG_CRYPTO_STREEBOG[0m) += streebog_generic.o
obj-$([31mCONFIG_CRYPTO_WP512[0m) += wp512.o
CFLAGS_wp512.o := $(call cc-option,-fno-schedule-insns) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
obj-$([31mCONFIG_CRYPTO_TGR192[0m) += tgr192.o
obj-$([31mCONFIG_CRYPTO_GF128MUL[0m) += gf128mul.o
obj-$([31mCONFIG_CRYPTO_ECB[0m) += ecb.o
obj-$([31mCONFIG_CRYPTO_CBC[0m) += cbc.o
obj-$([31mCONFIG_CRYPTO_CFB[0m) += cfb.o
obj-$([31mCONFIG_CRYPTO_PCBC[0m) += pcbc.o
obj-$([31mCONFIG_CRYPTO_CTS[0m) += cts.o
obj-$([31mCONFIG_CRYPTO_LRW[0m) += lrw.o
obj-$([31mCONFIG_CRYPTO_XTS[0m) += xts.o
obj-$([31mCONFIG_CRYPTO_CTR[0m) += ctr.o
obj-$([31mCONFIG_CRYPTO_KEYWRAP[0m) += keywrap.o
obj-$([31mCONFIG_CRYPTO_ADIANTUM[0m) += adiantum.o
obj-$([31mCONFIG_CRYPTO_NHPOLY1305[0m) += nhpoly1305.o
obj-$([31mCONFIG_CRYPTO_GCM[0m) += gcm.o
obj-$([31mCONFIG_CRYPTO_CCM[0m) += ccm.o
obj-$([31mCONFIG_CRYPTO_CHACHA20POLY1305[0m) += chacha20poly1305.o
obj-$([31mCONFIG_CRYPTO_AEGIS128[0m) += aegis128.o
aegis128-y := aegis128-core.o
ifeq ($(ARCH),arm)
CFLAGS_aegis128-neon-inner.o += -ffreestanding -march=armv7-a -mfloat-abi=softfp
CFLAGS_aegis128-neon-inner.o += -mfpu=crypto-neon-fp-armv8
aegis128-$([31mCONFIG_CRYPTO_AEGIS128_SIMD[0m) += aegis128-neon.o aegis128-neon-inner.o
endif
ifeq ($(ARCH),arm64)
aegis128-cflags-y := -ffreestanding -mcpu=generic+crypto
aegis128-cflags-$([31mCONFIG_CC_IS_GCC[0m) += -ffixed-q16 -ffixed-q17 -ffixed-q18 \
-ffixed-q19 -ffixed-q20 -ffixed-q21 \
-ffixed-q22 -ffixed-q23 -ffixed-q24 \
-ffixed-q25 -ffixed-q26 -ffixed-q27 \
-ffixed-q28 -ffixed-q29 -ffixed-q30 \
-ffixed-q31
CFLAGS_aegis128-neon-inner.o += $(aegis128-cflags-y)
CFLAGS_REMOVE_aegis128-neon-inner.o += -mgeneral-regs-only
aegis128-$([31mCONFIG_CRYPTO_AEGIS128_SIMD[0m) += aegis128-neon.o aegis128-neon-inner.o
endif
obj-$([31mCONFIG_CRYPTO_PCRYPT[0m) += pcrypt.o
obj-$([31mCONFIG_CRYPTO_CRYPTD[0m) += cryptd.o
obj-$([31mCONFIG_CRYPTO_DES[0m) += des_generic.o
obj-$([31mCONFIG_CRYPTO_FCRYPT[0m) += fcrypt.o
obj-$([31mCONFIG_CRYPTO_BLOWFISH[0m) += blowfish_generic.o
obj-$([31mCONFIG_CRYPTO_BLOWFISH_COMMON[0m) += blowfish_common.o
obj-$([31mCONFIG_CRYPTO_TWOFISH[0m) += twofish_generic.o
obj-$([31mCONFIG_CRYPTO_TWOFISH_COMMON[0m) += twofish_common.o
obj-$([31mCONFIG_CRYPTO_SERPENT[0m) += serpent_generic.o
CFLAGS_serpent_generic.o := $(call cc-option,-fsched-pressure) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
obj-$([31mCONFIG_CRYPTO_AES[0m) += aes_generic.o
CFLAGS_aes_generic.o := $(call cc-option,-fno-code-hoisting) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83356
obj-$([31mCONFIG_CRYPTO_SM4[0m) += sm4_generic.o
obj-$([31mCONFIG_CRYPTO_AES_TI[0m) += aes_ti.o
obj-$([31mCONFIG_CRYPTO_CAMELLIA[0m) += camellia_generic.o
obj-$([31mCONFIG_CRYPTO_CAST_COMMON[0m) += cast_common.o
obj-$([31mCONFIG_CRYPTO_CAST5[0m) += cast5_generic.o
obj-$([31mCONFIG_CRYPTO_CAST6[0m) += cast6_generic.o
obj-$([31mCONFIG_CRYPTO_ARC4[0m) += arc4.o
obj-$([31mCONFIG_CRYPTO_TEA[0m) += tea.o
obj-$([31mCONFIG_CRYPTO_KHAZAD[0m) += khazad.o
obj-$([31mCONFIG_CRYPTO_ANUBIS[0m) += anubis.o
obj-$([31mCONFIG_CRYPTO_SEED[0m) += seed.o
obj-$([31mCONFIG_CRYPTO_SALSA20[0m) += salsa20_generic.o
obj-$([31mCONFIG_CRYPTO_CHACHA20[0m) += chacha_generic.o
obj-$([31mCONFIG_CRYPTO_POLY1305[0m) += poly1305_generic.o
obj-$([31mCONFIG_CRYPTO_DEFLATE[0m) += deflate.o
obj-$([31mCONFIG_CRYPTO_MICHAEL_MIC[0m) += michael_mic.o
obj-$([31mCONFIG_CRYPTO_CRC32C[0m) += crc32c_generic.o
obj-$([31mCONFIG_CRYPTO_CRC32[0m) += crc32_generic.o
obj-$([31mCONFIG_CRYPTO_CRCT10DIF[0m) += crct10dif_common.o crct10dif_generic.o
obj-$([31mCONFIG_CRYPTO_AUTHENC[0m) += authenc.o authencesn.o
obj-$([31mCONFIG_CRYPTO_LZO[0m) += lzo.o lzo-rle.o
obj-$([31mCONFIG_CRYPTO_LZ4[0m) += lz4.o
obj-$([31mCONFIG_CRYPTO_LZ4HC[0m) += lz4hc.o
obj-$([31mCONFIG_CRYPTO_XXHASH[0m) += xxhash_generic.o
obj-$([31mCONFIG_CRYPTO_842[0m) += 842.o
obj-$([31mCONFIG_CRYPTO_RNG2[0m) += rng.o
obj-$([31mCONFIG_CRYPTO_ANSI_CPRNG[0m) += ansi_cprng.o
obj-$([31mCONFIG_CRYPTO_DRBG[0m) += drbg.o
obj-$([31mCONFIG_CRYPTO_JITTERENTROPY[0m) += jitterentropy_rng.o
CFLAGS_jitterentropy.o = -O0
KASAN_SANITIZE_jitterentropy.o = n
UBSAN_SANITIZE_jitterentropy.o = n
jitterentropy_rng-y := jitterentropy.o jitterentropy-kcapi.o
obj-$([31mCONFIG_CRYPTO_TEST[0m) += tcrypt.o
obj-$([31mCONFIG_CRYPTO_GHASH[0m) += ghash-generic.o
obj-$([31mCONFIG_CRYPTO_USER_API[0m) += af_alg.o
obj-$([31mCONFIG_CRYPTO_USER_API_HASH[0m) += algif_hash.o
obj-$([31mCONFIG_CRYPTO_USER_API_SKCIPHER[0m) += algif_skcipher.o
obj-$([31mCONFIG_CRYPTO_USER_API_RNG[0m) += algif_rng.o
obj-$([31mCONFIG_CRYPTO_USER_API_AEAD[0m) += algif_aead.o
obj-$([31mCONFIG_CRYPTO_ZSTD[0m) += zstd.o
obj-$([31mCONFIG_CRYPTO_OFB[0m) += ofb.o
obj-$([31mCONFIG_CRYPTO_ECC[0m) += ecc.o
obj-$([31mCONFIG_CRYPTO_ESSIV[0m) += essiv.o
ecdh_generic-y += ecdh.o
ecdh_generic-y += ecdh_helper.o
obj-$([31mCONFIG_CRYPTO_ECDH[0m) += ecdh_generic.o
$(obj)/ecrdsa_params.asn1.o: $(obj)/ecrdsa_params.asn1.c $(obj)/ecrdsa_params.asn1.h
$(obj)/ecrdsa_pub_key.asn1.o: $(obj)/ecrdsa_pub_key.asn1.c $(obj)/ecrdsa_pub_key.asn1.h
$(obj)/ecrdsa.o: $(obj)/ecrdsa_params.asn1.h $(obj)/ecrdsa_pub_key.asn1.h
ecrdsa_generic-y += ecrdsa.o
ecrdsa_generic-y += ecrdsa_params.asn1.o
ecrdsa_generic-y += ecrdsa_pub_key.asn1.o
obj-$([31mCONFIG_CRYPTO_ECRDSA[0m) += ecrdsa_generic.o
#
# generic algorithms and the async_tx api
#
obj-$([31mCONFIG_XOR_BLOCKS[0m) += xor.o
obj-$([31mCONFIG_ASYNC_CORE[0m) += async_tx/
obj-$([31mCONFIG_ASYMMETRIC_KEY_TYPE[0m) += asymmetric_keys/
obj-$([31mCONFIG_CRYPTO_HASH_INFO[0m) += hash_info.o
crypto_simd-y := simd.o
obj-$([31mCONFIG_CRYPTO_SIMD[0m) += crypto_simd.o