[PATCH] powerpc/crypto: Fix aes-gcm-p10 link errors

Vishal Chourasia isomorphik.ibm at gmail.com
Tue May 30 15:07:36 AEST 2023


On 5/25/23 20:35, Michael Ellerman wrote:
> The recently added P10 AES/GCM code added some files containing
> CRYPTOGAMS perl-asm code which are near duplicates of the p8 files
> found in drivers/crypto/vmx.
>
> In particular the newly added files produce functions with identical
> names to the existing code.
>
> When the kernel is built with CONFIG_CRYPTO_AES_GCM_P10=y and
> CONFIG_CRYPTO_DEV_VMX_ENCRYPT=y that leads to link errors, eg:
>
>    ld: drivers/crypto/vmx/aesp8-ppc.o: in function `aes_p8_set_encrypt_key':
>    (.text+0xa0): multiple definition of `aes_p8_set_encrypt_key'; arch/powerpc/crypto/aesp8-ppc.o:(.text+0xa0): first defined here
>    ...
>    ld: drivers/crypto/vmx/ghashp8-ppc.o: in function `gcm_ghash_p8':
>    (.text+0x140): multiple definition of `gcm_ghash_p8'; arch/powerpc/crypto/ghashp8-ppc.o:(.text+0x2e4): first defined here
>
> Fix it for now by renaming the newly added files and functions to use
> "p10" instead of "p8" in the names.
>
> Fixes: 45a4672b9a6e ("crypto: p10-aes-gcm - Update Kconfig and Makefile")
> Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
> ---
>   arch/powerpc/crypto/Makefile                   | 10 +++++-----
>   arch/powerpc/crypto/aes-gcm-p10-glue.c         | 18 +++++++++---------
>   .../crypto/{aesp8-ppc.pl => aesp10-ppc.pl}     |  2 +-
>   .../crypto/{ghashp8-ppc.pl => ghashp10-ppc.pl} | 12 ++++++------
>   4 files changed, 21 insertions(+), 21 deletions(-)
>   rename arch/powerpc/crypto/{aesp8-ppc.pl => aesp10-ppc.pl} (99%)
>   rename arch/powerpc/crypto/{ghashp8-ppc.pl => ghashp10-ppc.pl} (97%)

I missed adding tested-by in previous reply.

After applying the patch, I was able to successfully build the Linux 
kernel v6.4-rc4.

I encountered no errors during the build process. The issue pertaining 
to multiple
definitions of certain functions appears to be resolved.

λ grep -i CRYPTO_AES_GCM_P10 .config
CONFIG_CRYPTO_AES_GCM_P10=y

λ grep -i CRYPTO_DEV_VMX_ENCRYPT .config
CONFIG_CRYPTO_DEV_VMX_ENCRYPT=y

  + make O=${BUILD_DIR} CC=clang ARCH=powerpc
CROSS_COMPILE=powerpc64le-linux-gnu- -j16 -s vmlinux modules

Thank you for the well-detailed fix.

Tested-by: Vishal Chourasia <vishalc at linux.ibm.com>



More information about the Linuxppc-dev mailing list