Re: [PATCH] crypto: aes - Fix conditions for selecting MAC dependencies

From: Eric Biggers

Date: Sun Jul 12 2026 - 22:15:45 EST


On Wed, Jul 08, 2026 at 10:29:54PM -0400, Eric Biggers wrote:
> Starting in commit 7137cbf2b5c9 ("crypto: aes - Add cmac, xcbc, and
> cbcmac algorithms using library"), the aes module (CRYPTO_AES) supports
> CBC based MACs using the corresponding library functions.
>
> To avoid including unneeded functionality, that support honors the
> existing CRYPTO_CMAC, CRYPTO_XCBC, and CRYPTO_CCM kconfig options. The
> dependencies are selected if at least one of those is enabled.
>
> However, the select statements don't correctly handle the case where
> CRYPTO_AES=y and (for example) CRYPTO_CMAC=m. In that case the
> dependencies get selected at level 'm', due to how the kconfig language
> works. That causes a linker error.
>
> Fix this by changing the selection conditions to use '!= n'.
>
> A similar issue also exists for CRYPTO_LIB_AES's conditional selection
> of CRYPTO_LIB_UTILS. The same '!= n' would work, but instead just make
> CRYPTO_LIB_AES always select CRYPTO_LIB_UTILS. CRYPTO_LIB_UTILS is
> lightweight, and it's needed by most AES modes and many other things.
>
> Fixes: 7137cbf2b5c9 ("crypto: aes - Add cmac, xcbc, and cbcmac algorithms using library")
> Fixes: 309a7e514da7 ("lib/crypto: aes: Add support for CBC-based MACs")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
> ---
>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=libcrypto-fixes

- Eric