11.11Snia#	$NetBSD: Makefile,v 1.11 2025/11/24 16:28:51 nia Exp $
21.1Sriastrad
31.1Sriastrad.include <bsd.own.mk>
41.1Sriastrad
51.1SriastradTESTSDIR=	${TESTSBASE}/sys/crypto/aes
61.1Sriastrad
71.1SriastradTESTS_C=	t_aes
81.1Sriastrad
91.3SriastradAFLAGS+=	-D_LOCORE
101.3Sriastrad
111.1Sriastrad.PATH:	${NETBSDSRCDIR}/sys/crypto/aes
121.1SriastradCPPFLAGS+=	-I${NETBSDSRCDIR}/sys
131.1Sriastrad
141.1SriastradSRCS.t_aes+=	t_aes.c
151.1Sriastrad
161.1SriastradSRCS.t_aes+=	aes_bear.c
171.1SriastradSRCS.t_aes+=	aes_ct.c
181.1SriastradSRCS.t_aes+=	aes_ct_dec.c
191.1SriastradSRCS.t_aes+=	aes_ct_enc.c
201.9Sriastrad
211.9SriastradSRCS.t_aes+=	aes_bear64.c
221.9SriastradSRCS.t_aes+=	aes_ct64.c
231.9SriastradSRCS.t_aes+=	aes_ct64_dec.c
241.9SriastradSRCS.t_aes+=	aes_ct64_enc.c
251.9Sriastrad
261.8SriastradSRCS.t_aes+=	aes_keysched.c
271.1SriastradSRCS.t_aes+=	aes_selftest.c
281.1Sriastrad
291.5Sriastrad.if !empty(MACHINE_ARCH:Mearmv7*) || !empty(MACHINE_ARCH:Maarch64*)
301.1Sriastrad
311.1Sriastrad.PATH:	${NETBSDSRCDIR}/sys/crypto/aes/arch/arm
321.1SriastradCPPFLAGS+=	-I${NETBSDSRCDIR}/sys/crypto/aes/arch/arm
331.1Sriastrad
341.1Sriastrad.if !empty(MACHINE_ARCH:Maarch64*)	# XXX no AESE/AESD in 32-bit mode yet
351.1SriastradSRCS.t_aes+=	aes_armv8.c
361.1SriastradSRCS.t_aes+=	aes_armv8_64.S
371.1Sriastrad.endif
381.1Sriastrad
391.6SjakllschCLANG_NO_NONPORTABLE_VECTOR_INITIALIZATION= ${${ACTIVE_CC} == "clang":? -Wno-nonportable-vector-initialization :}
401.6Sjakllsch
411.1SriastradSRCS.t_aes+=	aes_neon.c
421.6SjakllschCOPTS.aes_neon.c+=${CLANG_NO_NONPORTABLE_VECTOR_INITIALIZATION}
431.1SriastradSRCS.t_aes+=	aes_neon_impl.c
441.1SriastradSRCS.t_aes+=	aes_neon_subr.c
451.6SjakllschCOPTS.aes_neon_subr.c+=${CLANG_NO_NONPORTABLE_VECTOR_INITIALIZATION}
461.5Sriastrad.if !empty(MACHINE_ARCH:Mearmv7*)
471.1SriastradSRCS.t_aes+=	aes_neon_32.S
481.1Sriastrad.endif
491.1Sriastrad
501.5Sriastrad.if !empty(MACHINE_ARCH:Mearmv7*) && empty(MACHINE_ARCH:Mearmv7hf*)
511.5SriastradCOPTS.aes_neon.c+=	-mfloat-abi=softfp -mfpu=neon
521.5SriastradCOPTS.aes_neon_subr.c+=	-mfloat-abi=softfp -mfpu=neon
531.5SriastradAOPTS.aes_neon_32.S+=	-D__SOFTFP__
541.5Sriastrad.endif
551.5Sriastrad
561.1Sriastrad.endif				# earmv7/aarch64
571.1Sriastrad
581.1Sriastrad.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
591.1Sriastrad
601.1Sriastrad.PATH:	${NETBSDSRCDIR}/sys/crypto/aes/arch/x86
611.1SriastradCPPFLAGS+=	-I${NETBSDSRCDIR}/sys/crypto/aes/arch/x86
621.1Sriastrad
631.1Sriastrad.if ${MACHINE_ARCH} == "x86_64"		# XXX no AES-NI in 32-bit mode yet
641.1SriastradSRCS.t_aes+=	aes_ni.c
651.1SriastradSRCS.t_aes+=	aes_ni_64.S
661.1Sriastrad.endif
671.1Sriastrad
681.10SriastradSRCS.t_aes+=	aes_sse2_4x32.c
691.10SriastradSRCS.t_aes+=	aes_sse2_4x32_dec.c
701.10SriastradSRCS.t_aes+=	aes_sse2_4x32_enc.c
711.10SriastradSRCS.t_aes+=	aes_sse2_4x32_impl.c
721.10SriastradSRCS.t_aes+=	aes_sse2_4x32_subr.c
731.10SriastradCOPTS.aes_sse2_4x32.c+=		-msse -msse2
741.10SriastradCOPTS.aes_sse2_4x32_dec.c+=	-msse -msse2
751.10SriastradCOPTS.aes_sse2_4x32_enc.c+=	-msse -msse2
761.10SriastradCOPTS.aes_sse2_4x32_subr.c+=	-msse -msse2
771.1Sriastrad
781.1SriastradSRCS.t_aes+=	aes_ssse3.c
791.1SriastradSRCS.t_aes+=	aes_ssse3_impl.c
801.1SriastradSRCS.t_aes+=	aes_ssse3_subr.c
811.2SriastradCOPTS.aes_ssse3.c+=		-msse -msse2 -msse3 -mssse3
821.2SriastradCOPTS.aes_ssse3_subr.c+=	-msse -msse2 -msse3 -mssse3
831.1Sriastrad
841.1SriastradSRCS.t_aes+=	aes_via.c
851.1Sriastrad
861.1Sriastrad.endif				# x86
871.1Sriastrad
881.1SriastradWARNS=		5
891.1Sriastrad
901.7Smrg# Many of these are probably GCC bugs, see
911.7Smrg#   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110878
921.7SmrgCOPTS.aes_armv8.c+=	${CC_WNO_STRINGOP_OVERREAD} ${CC_WNO_STRINGOP_OVERFLOW}
931.7SmrgCOPTS.aes_bear.c+=	${CC_WNO_STRINGOP_OVERFLOW} ${CC_WNO_ARRAY_BOUNDS}
941.11SniaCOPTS.aes_bear64.c+=	${CC_WNO_STRINGOP_OVERFLOW} ${CC_WNO_ARRAY_BOUNDS} \
951.11Snia			${CC_WNO_STRINGOP_OVERREAD}
961.7SmrgCOPTS.aes_neon_subr.c+=	${CC_WNO_ARRAY_BOUNDS}
971.7Smrg
981.7SmrgCOPTS.aes_ni.c+=	${CC_WNO_STRINGOP_OVERREAD} ${CC_WNO_STRINGOP_OVERFLOW}
991.10SriastradCOPTS.aes_sse2_4x32_subr.c+=	${CC_WNO_ARRAY_BOUNDS}
1001.7SmrgCOPTS.aes_ssse3_subr.c+=${CC_WNO_ARRAY_BOUNDS}
1011.7SmrgCOPTS.aes_via.c+=	${CC_WNO_ARRAY_BOUNDS}
1021.7Smrg
1031.1Sriastrad.include <bsd.test.mk>
104