################################################################################
# Hash implementation: Ascon

ifndef CONFIG_LEANCRYPTO_ASCON_HASH
leancrypto-y			+= ../hash/src/ascon_null.o
endif

leancrypto-$(CONFIG_LEANCRYPTO_ASCON_HASH)				       \
				+= ../hash/src/ascon_c.o		       \
				   ../hash/src/ascon_hash_common.o	       \
				   ../hash/src/ascon_selector.o		       \
				   ../hash/src/ascon_selftest.o		       \
				   leancrypto_kernel_ascon.o

ifdef CONFIG_X86_64
ccflags-$(CONFIG_LEANCRYPTO_ASCON_HASH)					       \
				+= -I$(src)/../hash/src -DLINUX_KERNEL
leancrypto-$(CONFIG_LEANCRYPTO_ASCON_HASH)				       \
				+= ../hash/src/ascon_avx512.o
CFLAGS_../hash/src/ascon_avx512.o					       \
				= -mavx512f
else
leancrypto-$(CONFIG_LEANCRYPTO_ASCON_HASH)				       \
				+= ../hash/src/ascon_avx512_null.o
endif

ifdef CONFIG_ARM
asflags-$(CONFIG_LEANCRYPTO_ASCON_HASH)					       \
				+= -mfpu=neon-vfpv4			       \
				   -mthumb				       \
				   -march=armv7-a+vfpv4			       \
				   -mfloat-abi=softfp			       \
				   -funsafe-math-optimizations
leancrypto-$(CONFIG_LEANCRYPTO_ASCON_HASH)				       \
				+= ../hash/src/ascon_arm_neon.o
else
leancrypto-$(CONFIG_LEANCRYPTO_ASCON_HASH)				       \
				+= ../hash/src/ascon_arm_neon_null.o
endif

ifdef CONFIG_LEANCRYPTO_ASCON_HASH
ccflags-y			+= -DCONFIG_LEANCRYPTO_ASCON_HASH
obj-$(CONFIG_LEANCRYPTO_TEST_MODULES)	+= leancrypto_kernel_ascon_tester.o
leancrypto_kernel_ascon_tester-y+= ../hash/tests/leancrypto_kernel_ascon_tester.o

obj-$(CONFIG_LEANCRYPTO_TEST_MODULES)	+= ascon_256_tester.o
obj-$(CONFIG_LEANCRYPTO_TEST_MODULES)	+= ascon_xof_tester.o

ascon_256_tester-y		+= ../hash/tests/ascon_256_tester.o
ascon_xof_tester-y		+= ../hash/tests/ascon_xof_tester.o
endif
