################################################################################
# ASN.1 Support

leancrypto-$(CONFIG_LEANCRYPTO_BER_DECODER)				       \
				+= ../asn1/src/asn1_common.o		       \
				   ../asn1/src/asn1_decoder.o		       \
				   ../asn1/src/base64.o			       \
				   ../asn1/src/pem.o

leancrypto-$(CONFIG_LEANCRYPTO_BER_ENCODER)				       \
				+= ../asn1/src/asn1_encoder.o		       \
				   ../asn1/src/asn1_encoder_helper.o	       \
				   ../asn1/src/asn1_encoder_small.o

################################################################################
# X.509 Support

leancrypto-$(CONFIG_LEANCRYPTO_X509_PARSER)				       \
				+= ../asn1/src/x509_cert_parser.o	       \
				   ../asn1/src/x509_cert_parser_get_data.o     \
				   ../asn1/src/x509_policies.o		       \
				   ../asn1/src/x509_public_key.o	       \
				   ../asn1/src/asym_key.o		       \
				   ../asn1/src/asymmetric_type.o	       \
				   ../asn1/src/gmtime.o			       \
				   ../asn1/src/oid_registry.o		       \
				   ../asn1/src/x509_algorithm_mapper.o	       \
				   ../asn1/src/x509_asn1.o		       \
				   ../asn1/src/x509_akid_asn1.o		       \
				   ../asn1/src/x509_basic_constraints_asn1.o   \
				   ../asn1/src/x509_eku_asn1.o		       \
				   ../asn1/src/x509_keyusage_asn1.o	       \
				   ../asn1/src/x509_mldsa_privkey_asn1.o       \
				   ../asn1/src/x509_san_asn1.o		       \
				   ../asn1/src/x509_skid_asn1.o

ifdef CONFIG_LEANCRYPTO_SPHINCS
leancrypto-$(CONFIG_LEANCRYPTO_X509_PARSER)				       \
				+= ../asn1/src/asym_key_sphincs.o
else
leancrypto-$(CONFIG_LEANCRYPTO_X509_PARSER)				       \
				+= ../asn1/src/asym_key_sphincs_null.o
endif

ifdef CONFIG_LEANCRYPTO_DILITHIUM
leancrypto-$(CONFIG_LEANCRYPTO_X509_PARSER)				       \
				+= ../asn1/src/asym_key_dilithium.o
else
leancrypto-$(CONFIG_LEANCRYPTO_X509_PARSER)				       \
				+= ../asn1/src/asym_key_dilithium_null.o
endif

ifdef CONFIG_LEANCRYPTO_DILITHIUM_ED25519
leancrypto-$(CONFIG_LEANCRYPTO_X509_PARSER)				       \
				+= ../asn1/src/asym_key_dilithium_ed25519.o    \
				   ../asn1/src/asym_key_ed25519.o
else
leancrypto-$(CONFIG_LEANCRYPTO_X509_PARSER)				       \
				+= ../asn1/src/asym_key_dilithium_ed25519_null.o\
				   ../asn1/src/asym_key_ed25519_null.o
endif

ifdef CONFIG_LEANCRYPTO_DILITHIUM_ED448
leancrypto-$(CONFIG_LEANCRYPTO_X509_PARSER)				       \
				+= ../asn1/src/asym_key_dilithium_ed448.o      \
				   ../asn1/src/asym_key_ed448.o
else
leancrypto-$(CONFIG_LEANCRYPTO_X509_PARSER)				       \
				+= ../asn1/src/asym_key_dilithium_ed448_null.o \
				   ../asn1/src/asym_key_ed448_null.o
endif

leancrypto-$(CONFIG_LEANCRYPTO_ASN1_EDDSA)				       \
				+= ../asn1/src/eddsa_curve_private_key.o       \
				   ../asn1/src/eddsa_curve_private_key_asn1.o

ifndef CONFIG_LEANCRYPTO_X509_GENERATOR
leancrypto-$(CONFIG_LEANCRYPTO_X509_PARSER)				       \
				+= ../asn1/src/x509_cert_generator_null.o
endif

leancrypto-$(CONFIG_LEANCRYPTO_X509_GENERATOR)				       \
				+= ../asn1/src/x509_cert_generator.o	       \
				   ../asn1/src/x509_cert_generator_set_data.o

leancrypto-$(CONFIG_LEANCRYPTO_X509_CSR_PARSER)				       \
				+= ../asn1/src/x509_csr_asn1.o		       \
				   ../asn1/src/x509_csr_parser.o

leancrypto-$(CONFIG_LEANCRYPTO_X509_CSR_GENERATOR)			       \
				+= ../asn1/src/x509_csr_generator.o

ifndef CONFIG_LEANCRYPTO_X509_CSR_GENERATOR
leancrypto-$(CONFIG_LEANCRYPTO_X509_CSR_PARSER)				       \
				+= ../asn1/src/x509_csr_generator_null.o
endif

################################################################################
# PKCS7 Support

leancrypto-$(CONFIG_LEANCRYPTO_PKCS7_PARSER)				       \
				+= ../asn1/src/pkcs7_memory.o		       \
				   ../asn1/src/pkcs7_parser.o		       \
				   ../asn1/src/pkcs7_trust.o		       \
				   ../asn1/src/pkcs7_verify.o		       \
				   ../asn1/src/pkcs7_asn1.o		       \
				   ../asn1/src/pkcs7_aa_asn1.o

leancrypto-$(CONFIG_LEANCRYPTO_PKCS7_GENERATOR)				       \
				+= ../asn1/src/pkcs7_generator.o	       \
				   ../asn1/src/pkcs7_generator_set_data.o

ifndef CONFIG_LEANCRYPTO_PKCS7_GENERATOR
leancrypto-$(CONFIG_LEANCRYPTO_PKCS7_PARSER)				       \
				+= ../asn1/src/pkcs7_generator_null.o
endif

################################################################################
# PKCS8 Support

leancrypto-$(CONFIG_LEANCRYPTO_PKCS8_PARSER)				       \
				+= ../asn1/src/pkcs8_parser.o		       \
				   ../asn1/src/pkcs8_asn1.o

leancrypto-$(CONFIG_LEANCRYPTO_PKCS8_GENERATOR)				       \
				+= ../asn1/src/pkcs8_generator.o

ifndef CONFIG_LEANCRYPTO_PKCS8_GENERATOR
leancrypto-$(CONFIG_LEANCRYPTO_PKCS8_PARSER)				       \
				+= ../asn1/src/pkcs8_generator_null.o
endif
