diff mbox series

[v3,1/6] Update Kconfig and Makefile.

Message ID 20230217161805.236319-2-dtsen@linux.ibm.com
State New
Headers show
Series crypto: Accelerated AES/GCM stitched implementation | expand

Commit Message

Danny Tsen Feb. 17, 2023, 4:18 p.m. UTC
Defined CRYPTO_P10_AES_GCM in Kconfig to support AES/GCM
stitched implementation for Power10+ CPU.

Added a new module driver p10-aes-gcm-crypto.

Signed-off-by: Danny Tsen <dtsen@linux.ibm.com>
---
 arch/powerpc/crypto/Kconfig  | 11 +++++++++++
 arch/powerpc/crypto/Makefile | 13 +++++++++++++
 2 files changed, 24 insertions(+)

Comments

Elliott, Robert (Servers) Feb. 17, 2023, 9:44 p.m. UTC | #1
> +config CRYPTO_P10_AES_GCM
> +	tristate "Stitched AES/GCM acceleration support on P10+ CPU (PPC)"
> +	depends on PPC64 && POWER10_CPU && CPU_LITTLE_ENDIAN
> +	select CRYPTO_LIB_AES
> +	select CRYPTO_ALGAPI
> +	select CRYPTO_AEAD
> +	default m
> +	help
> +	  Support for cryptographic acceleration instructions on Power10+ CPU.
> +	    This module supports stitched acceleration for AES/GCM in
> hardware.

Is "Power10+" a specific architecture or does that mean "Power10 or later"?

Please follow the newer wording conventions for the menu item and
help text, more like:

config CRYPTO_AES_GCM_PPC_P10
        tristate "AEAD cipher: AES in GCM mode (Power10)"

        help
          AEAD cipher: AES cipher algorithms (FIPS-197) with
	   GCM (Galois/Counter Mode) authenticated encryption mode (NIST SP800-38D)

          Architecture: powerpc64 using:
          - little-endian
          - Power10 features 

          [some description here]

Also, all the other powerpc cra_driver_names follow 
	alg-arch
not
	arch-alg

so 
	.base.cra_driver_name	= "p10_aes_gcm",
might be better as
	.base.cra_driver_name	= "aes-gcm-p10",

Patch 4 seems to have code for lots of other modes like CBC and XTS.
Does the perl script strip out all of that?
Danny Tsen Feb. 17, 2023, 10:20 p.m. UTC | #2
Hi Robert,

Power10+ means Power10 or later.  Other modes were not stripped by the 
perl script.

Thanks for the comments I will fix the suggestions.

-Danny

On 2/17/23 3:44 PM, Elliott, Robert (Servers) wrote:
>> +config CRYPTO_P10_AES_GCM
>> +	tristate "Stitched AES/GCM acceleration support on P10+ CPU (PPC)"
>> +	depends on PPC64 && POWER10_CPU && CPU_LITTLE_ENDIAN
>> +	select CRYPTO_LIB_AES
>> +	select CRYPTO_ALGAPI
>> +	select CRYPTO_AEAD
>> +	default m
>> +	help
>> +	  Support for cryptographic acceleration instructions on Power10+ CPU.
>> +	    This module supports stitched acceleration for AES/GCM in
>> hardware.
> Is "Power10+" a specific architecture or does that mean "Power10 or later"?
>
> Please follow the newer wording conventions for the menu item and
> help text, more like:
>
> config CRYPTO_AES_GCM_PPC_P10
>          tristate "AEAD cipher: AES in GCM mode (Power10)"
>
>          help
>            AEAD cipher: AES cipher algorithms (FIPS-197) with
> 	   GCM (Galois/Counter Mode) authenticated encryption mode (NIST SP800-38D)
>
>            Architecture: powerpc64 using:
>            - little-endian
>            - Power10 features
>
>            [some description here]
>
> Also, all the other powerpc cra_driver_names follow
> 	alg-arch
> not
> 	arch-alg
>
> so
> 	.base.cra_driver_name	= "p10_aes_gcm",
> might be better as
> 	.base.cra_driver_name	= "aes-gcm-p10",
>
> Patch 4 seems to have code for lots of other modes like CBC and XTS.
> Does the perl script strip out all of that?
>
>
>
diff mbox series

Patch

diff --git a/arch/powerpc/crypto/Kconfig b/arch/powerpc/crypto/Kconfig
index c1b964447401..3a403b7aad82 100644
--- a/arch/powerpc/crypto/Kconfig
+++ b/arch/powerpc/crypto/Kconfig
@@ -94,4 +94,15 @@  config CRYPTO_AES_PPC_SPE
 	  architecture specific assembler implementations that work on 1KB
 	  tables or 256 bytes S-boxes.
 
+config CRYPTO_P10_AES_GCM
+	tristate "Stitched AES/GCM acceleration support on P10+ CPU (PPC)"
+	depends on PPC64 && POWER10_CPU && CPU_LITTLE_ENDIAN
+	select CRYPTO_LIB_AES
+	select CRYPTO_ALGAPI
+	select CRYPTO_AEAD
+	default m
+	help
+	  Support for cryptographic acceleration instructions on Power10+ CPU.
+	    This module supports stitched acceleration for AES/GCM in hardware.
+
 endmenu
diff --git a/arch/powerpc/crypto/Makefile b/arch/powerpc/crypto/Makefile
index 4808d97fede5..36373a028f0e 100644
--- a/arch/powerpc/crypto/Makefile
+++ b/arch/powerpc/crypto/Makefile
@@ -13,6 +13,7 @@  obj-$(CONFIG_CRYPTO_SHA256_PPC_SPE) += sha256-ppc-spe.o
 obj-$(CONFIG_CRYPTO_CRC32C_VPMSUM) += crc32c-vpmsum.o
 obj-$(CONFIG_CRYPTO_CRCT10DIF_VPMSUM) += crct10dif-vpmsum.o
 obj-$(CONFIG_CRYPTO_VPMSUM_TESTER) += crc-vpmsum_test.o
+obj-$(CONFIG_CRYPTO_P10_AES_GCM) += p10-aes-gcm-crypto.o
 
 aes-ppc-spe-y := aes-spe-core.o aes-spe-keys.o aes-tab-4k.o aes-spe-modes.o aes-spe-glue.o
 md5-ppc-y := md5-asm.o md5-glue.o
@@ -21,3 +22,15 @@  sha1-ppc-spe-y := sha1-spe-asm.o sha1-spe-glue.o
 sha256-ppc-spe-y := sha256-spe-asm.o sha256-spe-glue.o
 crc32c-vpmsum-y := crc32c-vpmsum_asm.o crc32c-vpmsum_glue.o
 crct10dif-vpmsum-y := crct10dif-vpmsum_asm.o crct10dif-vpmsum_glue.o
+p10-aes-gcm-crypto-y := p10-aes-gcm-glue.o p10_aes_gcm.o ghashp8-ppc.o aesp8-ppc.o
+
+quiet_cmd_perl = PERL    $@
+      cmd_perl = $(PERL) $< $(if $(CONFIG_CPU_LITTLE_ENDIAN), linux-ppc64le, linux-ppc64) > $@
+
+targets += aesp8-ppc.S ghashp8-ppc.S
+
+$(obj)/aesp8-ppc.S $(obj)/ghashp8-ppc.S: $(obj)/%.S: $(src)/%.pl FORCE
+	$(call if_changed,perl)
+
+OBJECT_FILES_NON_STANDARD_aesp8-ppc.o := y
+OBJECT_FILES_NON_STANDARD_ghashp8-ppc.o := y