################################################################################
# Automated configuration
#
# This file is not meant for manually selecting options.
#

#
# The Curve25519 is not defined to be configurable as this is not PQC-resistant.
# It is only provided to allow a hybrid Dilithium / Kyber algorithm.
#
ifdef CONFIG_LEANCRYPTO_KEM_X25519
CONFIG_LEANCRYPTO_CURVE25519=y
endif
ifdef CONFIG_LEANCRYPTO_DILITHIUM_ED25519
CONFIG_LEANCRYPTO_CURVE25519=y
CONFIG_LEANCRYPTO_ASN1_EDDSA=y
endif

#
# The Curve448 is not defined to be configurable as this is not PQC-resistant.
# It is only provided to allow a hybrid Dilithium / Kyber algorithm.
#
ifdef CONFIG_LEANCRYPTO_KEM_X448
CONFIG_LEANCRYPTO_CURVE448=y
endif
ifdef CONFIG_LEANCRYPTO_DILITHIUM_ED448
CONFIG_LEANCRYPTO_CURVE448=y
CONFIG_LEANCRYPTO_ASN1_EDDSA=y
endif

#
# Automatically select the common Kyber code
#
ifdef CONFIG_LEANCRYPTO_KEM_KYBER_1024
CONFIG_LEANCRYPTO_KEM_KYBER=y
CONFIG_LEANCRYPTO_DRNG_TEST=y
endif
ifdef CONFIG_LEANCRYPTO_KEM_KYBER_768
CONFIG_LEANCRYPTO_KEM_KYBER=y
CONFIG_LEANCRYPTO_DRNG_TEST=y
endif
ifdef CONFIG_LEANCRYPTO_KEM_KYBER_512
CONFIG_LEANCRYPTO_KEM_KYBER=y
CONFIG_LEANCRYPTO_DRNG_TEST=y
endif

#
# Automatically select the common Dilithium code
#
ifdef CONFIG_LEANCRYPTO_DILITHIUM_87
CONFIG_LEANCRYPTO_DILITHIUM=y
CONFIG_LEANCRYPTO_SIG_SUPPORT=y
CONFIG_LEANCRYPTO_DRNG_TEST=y
endif
ifdef CONFIG_LEANCRYPTO_DILITHIUM_65
CONFIG_LEANCRYPTO_DILITHIUM=y
CONFIG_LEANCRYPTO_SIG_SUPPORT=y
CONFIG_LEANCRYPTO_DRNG_TEST=y
endif
ifdef CONFIG_LEANCRYPTO_DILITHIUM_44
CONFIG_LEANCRYPTO_DILITHIUM=y
CONFIG_LEANCRYPTO_SIG_SUPPORT=y
CONFIG_LEANCRYPTO_DRNG_TEST=y
endif

#
# Automatically select the common BIKE code
#
ifdef CONFIG_LEANCRYPTO_KEM_BIKE_5
CONFIG_LEANCRYPTO_KEM_BIKE=y
endif
ifdef CONFIG_LEANCRYPTO_KEM_BIKE_3
CONFIG_LEANCRYPTO_KEM_BIKE=y
endif
ifdef CONFIG_LEANCRYPTO_KEM_BIKE_1
CONFIG_LEANCRYPTO_KEM_BIKE=y
endif

#
# Automatically select the common HQC code
#
ifdef CONFIG_LEANCRYPTO_KEM_HQC_256
CONFIG_LEANCRYPTO_KEM_HQC=y
endif
ifdef CONFIG_LEANCRYPTO_KEM_HQC_192
CONFIG_LEANCRYPTO_KEM_HQC=y
endif
ifdef CONFIG_LEANCRYPTO_KEM_HQC_128
CONFIG_LEANCRYPTO_KEM_HQC=y
endif

#
# Automatically select the common Dilithium code
#
ifdef CONFIG_LEANCRYPTO_SPHINCS_256s
CONFIG_LEANCRYPTO_SPHINCS=y
CONFIG_LEANCRYPTO_SIG_SUPPORT=y
endif
ifdef CONFIG_LEANCRYPTO_SPHINCS_256f
CONFIG_LEANCRYPTO_SPHINCS=y
CONFIG_LEANCRYPTO_SIG_SUPPORT=y
endif
ifdef CONFIG_LEANCRYPTO_SPHINCS_192s
CONFIG_LEANCRYPTO_SPHINCS=y
CONFIG_LEANCRYPTO_SIG_SUPPORT=y
endif
ifdef CONFIG_LEANCRYPTO_SPHINCS_192f
CONFIG_LEANCRYPTO_SPHINCS=y
CONFIG_LEANCRYPTO_SIG_SUPPORT=y
endif
ifdef CONFIG_LEANCRYPTO_SPHINCS_128s
CONFIG_LEANCRYPTO_SPHINCS=y
CONFIG_LEANCRYPTO_SIG_SUPPORT=y
endif
ifdef CONFIG_LEANCRYPTO_SPHINCS_128f
CONFIG_LEANCRYPTO_SPHINCS=y
CONFIG_LEANCRYPTO_SIG_SUPPORT=y
endif

#
# Automatically select the common AEAD code
#
ifdef CONFIG_LEANCRYPTO_SYMHMAC_CRYPT
CONFIG_LEANCRYPTO_AEAD=y
endif
ifdef CONFIG_LEANCRYPTO_SYMKMAC_CRYPT
CONFIG_LEANCRYPTO_AEAD=y
endif
ifdef CONFIG_LEANCRYPTO_HASH_CRYPT
CONFIG_LEANCRYPTO_AEAD=y
endif
ifdef CONFIG_LEANCRYPTO_CSHAKE_CRYPT
CONFIG_LEANCRYPTO_AEAD=y
endif
ifdef CONFIG_LEANCRYPTO_KMAC_CRYPT
CONFIG_LEANCRYPTO_AEAD=y
endif
ifdef CONFIG_LEANCRYPTO_ASCON_CRYPT
CONFIG_LEANCRYPTO_AEAD=y
endif
ifdef CONFIG_LEANCRYPTO_CHACHA20_POLY1305
CONFIG_LEANCRYPTO_AEAD=y
endif
ifdef CONFIG_LEANCRYPTO_AES_GCM
CONFIG_LEANCRYPTO_AEAD=y
endif

#
# Enabled ciphers
#
ifdef CONFIG_LEANCRYPTO_AES
ccflags-y	+= -DLC_AES
endif
ifdef CONFIG_LEANCRYPTO_AES_CBC
ccflags-y	+= -DLC_AES_CBC
endif
ifdef CONFIG_LEANCRYPTO_AES_CTR
ccflags-y	+= -DLC_AES_CTR
endif
ifdef CONFIG_LEANCRYPTO_AES_XTS
ccflags-y	+= -DLC_AES_XTS
endif
ifdef CONFIG_LEANCRYPTO_AES_KW
ccflags-y	+= -DLC_AES_KW
endif
ifdef CONFIG_LEANCRYPTO_SHA2_256
ccflags-y	+= -DLC_SHA2_256
endif
ifdef CONFIG_LEANCRYPTO_SHA2_512
ccflags-y	+= -DLC_SHA2_512
endif
ifdef CONFIG_LEANCRYPTO_SHA3
ccflags-y	+= -DLC_SHA3
endif
ifdef CONFIG_LEANCRYPTO_KEM_KYBER
ccflags-y	+= -DLC_KYBER
endif
ifdef CONFIG_LEANCRYPTO_DILITHIUM
ccflags-y	+= -DLC_DILITHIUM
endif
ifdef CONFIG_LEANCRYPTO_DILITHIUM_ED25519
ccflags-y	+= -DLC_DILITHIUM_ED25519
endif
ifdef CONFIG_LEANCRYPTO_DILITHIUM_ED448
ccflags-y	+= -DLC_DILITHIUM_ED448
endif
ifdef CONFIG_LEANCRYPTO_SPHINCS
ccflags-y	+= -DLC_SPHINCS
endif
ifdef CONFIG_LEANCRYPTO_KEM_BIKE
ccflags-y	+= -DLC_BIKE
endif
ifdef CONFIG_LEANCRYPTO_KEM_HQC
ccflags-y	+= -DLC_HQC
endif
ifdef CONFIG_LEANCRYPTO_CURVE25519
ccflags-y	+= -DLC_CURVE25519
endif
ifdef CONFIG_LEANCRYPTO_CURVE448
ccflags-y	+= -DLC_CURVE448
endif
ifdef CONFIG_LEANCRYPTO_X509_GENERATOR
ccflags-y	+= -DLC_X509_GENERATOR
endif
ifdef CONFIG_LEANCRYPTO_CHACHA20 
ccflags-y	+= -DLC_CHACHA20
endif
ifdef CONFIG_LEANCRYPTO_CHACHA20_POLY1305
ccflags-y	+= -DLC_CHACHA20_POLY1305
endif
ifdef CONFIG_LEANCRYPTO_XDRBG_DRNG
ccflags-y	+= -DCONFIG_LEANCRYPTO_XDRBG_DRNG
endif
ifdef CONFIG_LEANCRYPTO_KMAC_DRNG
ccflags-y	+= -DCONFIG_LEANCRYPTO_KMAC_DRNG
endif
ifdef CONFIG_LEANCRYPTO_CSHAKE_DRNG
ccflags-y	+= -DCONFIG_LEANCRYPTO_CSHAKE_DRNG
endif
ifdef CONFIG_LEANCRYPTO_HASH_DRBG
ccflags-y	+= -DCONFIG_LEANCRYPTO_HASH_DRBG
endif
ifdef CONFIG_LEANCRYPTO_HMAC_DRBG
ccflags-y	+= -DCONFIG_LEANCRYPTO_HMAC_DRBG
endif
ifdef CONFIG_LEANCRYPTO_CTR_DRBG
ccflags-y	+= -DCONFIG_LEANCRYPTO_CTR_DRBG
endif

#
# Automatically select the BER decoder
#
ifdef CONFIG_LEANCRYPTO_X509_PARSER
CONFIG_LEANCRYPTO_BER_DECODER=y
endif
ifdef CONFIG_LEANCRYPTO_PKCS7_PARSER
CONFIG_LEANCRYPTO_BER_DECODER=y
endif
ifdef CONFIG_LEANCRYPTO_PKCS8_PARSER
CONFIG_LEANCRYPTO_BER_DECODER=y
endif

#
# Automatically select the BER encoder
#
ifdef CONFIG_LEANCRYPTO_X509_GENERATOR
CONFIG_LEANCRYPTO_BER_ENCODER=y
endif
ifdef CONFIG_LEANCRYPTO_PKCS7_GENERATOR
CONFIG_LEANCRYPTO_BER_ENCODER=y
endif
ifdef CONFIG_LEANCRYPTO_PKCS8_GENERATOR
CONFIG_LEANCRYPTO_BER_ENCODER=y
endif

#
# The seeded RNG is always present
#
ifdef CONFIG_LEANCRYPTO_XDRBG_DRNG
CONFIG_LEANCRYPTO_DRNG=y
endif
ifdef CONFIG_LEANCRYPTO_KMAC_DRNG
CONFIG_LEANCRYPTO_DRNG=y
endif
ifdef CONFIG_LEANCRYPTO_CSHAKE_DRNG
CONFIG_LEANCRYPTO_DRNG=y
endif
ifdef CONFIG_LEANCRYPTO_HASH_DRBG
CONFIG_LEANCRYPTO_DRNG=y
endif
ifdef CONFIG_LEANCRYPTO_HMAC_DRBG
CONFIG_LEANCRYPTO_DRNG=y
endif
ifdef CONFIG_LEANCRYPTO_CTR_DRBG
CONFIG_LEANCRYPTO_DRNG=y
endif
ifdef CONFIG_LEANCRYPTO_DRNG_TEST
CONFIG_LEANCRYPTO_DRNG=y
endif
ifdef CONFIG_LEANCRYPTO_DRNG
ccflags-y	+= -DLC_DRNG_PRESENT -DCONFIG_LEANCRYPTO_DRNG
endif
