mbox series

[0/4] Add spacc crypto driver support

Message ID 20240305112831.3380896-1-pavitrakumarm@vayavyalabs.com (mailing list archive)
Headers show
Series Add spacc crypto driver support | expand

Message

Pavitrakumar Managutte March 5, 2024, 11:28 a.m. UTC
Add the driver for SPAcc(Security Protocol Accelerator), which is a
crypto acceleration IP from Synopsys. The SPAcc supports many cipher,
hash, aead algorithms and various modes.The driver currently supports
below,

aead:
- ccm(sm4)
- ccm(aes)
- gcm(sm4)
- gcm(aes)
- rfc8998(gcm(sm4))
- rfc7539(chacha20,poly1305)

cipher:
- cbc(sm4)
- ecb(sm4)
- ofb(sm4)
- cfb(sm4)
- ctr(sm4)
- cbc(aes)
- ecb(aes)
- ctr(aes)
- xts(aes)
- cts(cbc(aes))
- cbc(des)
- ecb(des)
- cbc(des3_ede)
- ecb(des3_ede)
- chacha20
- xts(sm4)
- cts(cbc(sm4))
- ecb(kasumi)
- f8(kasumi)
- snow3g_uea2
- cs1(cbc(aes))
- cs2(cbc(aes))
- cs1(cbc(sm4))
- cs2(cbc(sm4))
- f8(sm4)

hash:
- michael_mic
- sm3
- hmac(sm3)
- sha3-512
- sha3-384
- sha3-256
- sha3-224
- hmac(sha512)
- hmac(sha384)
- hmac(sha256)
- hmac(sha224)
- sha512
- sha384
- sha256
- sha224
- sha1
- hmac(sha1)
- md5
- hmac(md5)
- cmac(sm4)
- xcbc(aes)
- cmac(aes)
- xcbc(sm4) 
- sha512-224
- hmac(sha512-224)
- sha512-256
- hmac(sha512-256)
- mac(kasumi_f9)
- mac(snow3g)
- mac(zuc)
- sslmac(sha1)
- shake128
- shake256
- cshake128
- cshake256
- kcmac128
- kcmac256
- kcmacxof128
- kcmacxof256
- sslmac(md5)

Pavitrakumar M (4):
  Add SPAcc driver to Linux kernel
  Add SPACC Kconfig and Makefile
  Add SPAcc dts overlay
  Enable Driver compilation in crypto Kconfig and Makefile file

 arch/arm64/boot/dts/xilinx/Makefile           |    3 +
 .../arm64/boot/dts/xilinx/snps-dwc-spacc.dtso |   35 +
 drivers/crypto/Kconfig                        |    1 +
 drivers/crypto/Makefile                       |    1 +
 drivers/crypto/dwc-spacc/Kconfig              |   95 +
 drivers/crypto/dwc-spacc/Makefile             |   16 +
 drivers/crypto/dwc-spacc/spacc_aead.c         | 1386 ++++++++
 drivers/crypto/dwc-spacc/spacc_ahash.c        | 1216 +++++++
 drivers/crypto/dwc-spacc/spacc_core.c         | 3046 +++++++++++++++++
 drivers/crypto/dwc-spacc/spacc_core.h         |  833 +++++
 drivers/crypto/dwc-spacc/spacc_device.c       |  323 ++
 drivers/crypto/dwc-spacc/spacc_device.h       |  236 ++
 drivers/crypto/dwc-spacc/spacc_hal.c          |  365 ++
 drivers/crypto/dwc-spacc/spacc_hal.h          |  113 +
 drivers/crypto/dwc-spacc/spacc_interrupt.c    |  205 ++
 drivers/crypto/dwc-spacc/spacc_manager.c      |  670 ++++
 drivers/crypto/dwc-spacc/spacc_skcipher.c     |  781 +++++
 17 files changed, 9325 insertions(+)
 create mode 100644 arch/arm64/boot/dts/xilinx/snps-dwc-spacc.dtso
 create mode 100644 drivers/crypto/dwc-spacc/Kconfig
 create mode 100644 drivers/crypto/dwc-spacc/Makefile
 create mode 100644 drivers/crypto/dwc-spacc/spacc_aead.c
 create mode 100644 drivers/crypto/dwc-spacc/spacc_ahash.c
 create mode 100644 drivers/crypto/dwc-spacc/spacc_core.c
 create mode 100644 drivers/crypto/dwc-spacc/spacc_core.h
 create mode 100644 drivers/crypto/dwc-spacc/spacc_device.c
 create mode 100644 drivers/crypto/dwc-spacc/spacc_device.h
 create mode 100644 drivers/crypto/dwc-spacc/spacc_hal.c
 create mode 100644 drivers/crypto/dwc-spacc/spacc_hal.h
 create mode 100644 drivers/crypto/dwc-spacc/spacc_interrupt.c
 create mode 100644 drivers/crypto/dwc-spacc/spacc_manager.c
 create mode 100644 drivers/crypto/dwc-spacc/spacc_skcipher.c

Comments

Eric Biggers March 5, 2024, 9:13 p.m. UTC | #1
On Tue, Mar 05, 2024 at 04:58:27PM +0530, Pavitrakumar M wrote:
> Add the driver for SPAcc(Security Protocol Accelerator), which is a
> crypto acceleration IP from Synopsys. The SPAcc supports many cipher,
> hash, aead algorithms and various modes.The driver currently supports
> below,

Has this been tested with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y?

> aead:
> - ccm(sm4)
> - ccm(aes)
> - gcm(sm4)
> - gcm(aes)
> - rfc8998(gcm(sm4))
> - rfc7539(chacha20,poly1305)
> 
> cipher:
> - cbc(sm4)
> - ecb(sm4)
> - ofb(sm4)
> - cfb(sm4)
> - ctr(sm4)
> - cbc(aes)
> - ecb(aes)
> - ctr(aes)
> - xts(aes)
> - cts(cbc(aes))
> - cbc(des)
> - ecb(des)
> - cbc(des3_ede)
> - ecb(des3_ede)
> - chacha20
> - xts(sm4)
> - cts(cbc(sm4))
> - ecb(kasumi)
> - f8(kasumi)
> - snow3g_uea2
> - cs1(cbc(aes))
> - cs2(cbc(aes))
> - cs1(cbc(sm4))
> - cs2(cbc(sm4))
> - f8(sm4)
> 
> hash:
> - michael_mic
> - sm3
> - hmac(sm3)
> - sha3-512
> - sha3-384
> - sha3-256
> - sha3-224
> - hmac(sha512)
> - hmac(sha384)
> - hmac(sha256)
> - hmac(sha224)
> - sha512
> - sha384
> - sha256
> - sha224
> - sha1
> - hmac(sha1)
> - md5
> - hmac(md5)
> - cmac(sm4)
> - xcbc(aes)
> - cmac(aes)
> - xcbc(sm4) 
> - sha512-224
> - hmac(sha512-224)
> - sha512-256
> - hmac(sha512-256)
> - mac(kasumi_f9)
> - mac(snow3g)
> - mac(zuc)
> - sslmac(sha1)
> - shake128
> - shake256
> - cshake128
> - cshake256
> - kcmac128
> - kcmac256
> - kcmacxof128
> - kcmacxof256
> - sslmac(md5)

Algorithms that don't have a generic implementation shouldn't be included.

- Eric
Pavitrakumar Managutte March 6, 2024, 3:46 a.m. UTC | #2
Hi Eric,
  Yes we have tested this with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y

  Also is it fine if those additional algos stay inside that disabled
CONFIG. SPAcc hardware
  does support those algos.

- PK


On Wed, Mar 6, 2024 at 2:43 AM Eric Biggers <ebiggers@kernel.org> wrote:
>
> On Tue, Mar 05, 2024 at 04:58:27PM +0530, Pavitrakumar M wrote:
> > Add the driver for SPAcc(Security Protocol Accelerator), which is a
> > crypto acceleration IP from Synopsys. The SPAcc supports many cipher,
> > hash, aead algorithms and various modes.The driver currently supports
> > below,
>
> Has this been tested with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y?
>
> > aead:
> > - ccm(sm4)
> > - ccm(aes)
> > - gcm(sm4)
> > - gcm(aes)
> > - rfc8998(gcm(sm4))
> > - rfc7539(chacha20,poly1305)
> >
> > cipher:
> > - cbc(sm4)
> > - ecb(sm4)
> > - ofb(sm4)
> > - cfb(sm4)
> > - ctr(sm4)
> > - cbc(aes)
> > - ecb(aes)
> > - ctr(aes)
> > - xts(aes)
> > - cts(cbc(aes))
> > - cbc(des)
> > - ecb(des)
> > - cbc(des3_ede)
> > - ecb(des3_ede)
> > - chacha20
> > - xts(sm4)
> > - cts(cbc(sm4))
> > - ecb(kasumi)
> > - f8(kasumi)
> > - snow3g_uea2
> > - cs1(cbc(aes))
> > - cs2(cbc(aes))
> > - cs1(cbc(sm4))
> > - cs2(cbc(sm4))
> > - f8(sm4)
> >
> > hash:
> > - michael_mic
> > - sm3
> > - hmac(sm3)
> > - sha3-512
> > - sha3-384
> > - sha3-256
> > - sha3-224
> > - hmac(sha512)
> > - hmac(sha384)
> > - hmac(sha256)
> > - hmac(sha224)
> > - sha512
> > - sha384
> > - sha256
> > - sha224
> > - sha1
> > - hmac(sha1)
> > - md5
> > - hmac(md5)
> > - cmac(sm4)
> > - xcbc(aes)
> > - cmac(aes)
> > - xcbc(sm4)
> > - sha512-224
> > - hmac(sha512-224)
> > - sha512-256
> > - hmac(sha512-256)
> > - mac(kasumi_f9)
> > - mac(snow3g)
> > - mac(zuc)
> > - sslmac(sha1)
> > - shake128
> > - shake256
> > - cshake128
> > - cshake256
> > - kcmac128
> > - kcmac256
> > - kcmacxof128
> > - kcmacxof256
> > - sslmac(md5)
>
> Algorithms that don't have a generic implementation shouldn't be included.
>
> - Eric
Eric Biggers March 6, 2024, 4 a.m. UTC | #3
On Wed, Mar 06, 2024 at 09:16:31AM +0530, Pavitrakumar Managutte wrote:
> > Algorithms that don't have a generic implementation shouldn't be included.
> >
> Hi Eric,
>   Yes we have tested this with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y
> 
>   Also is it fine if those additional algos stay inside that disabled
> CONFIG. SPAcc hardware
>   does support those algos.
> 
> - PK
> 

If you provide an option to build them into the driver, that still counts as
them being there.  I think they should just be left out entirely for now.

- Eric
Pavitrakumar Managutte March 6, 2024, 5:07 a.m. UTC | #4
Sure Eric,
   I will remove them from the driver, clean up all the build errors and
   submit v1 of this patchset.

- PK


On Wed, Mar 6, 2024 at 9:30 AM Eric Biggers <ebiggers@kernel.org> wrote:
>
> On Wed, Mar 06, 2024 at 09:16:31AM +0530, Pavitrakumar Managutte wrote:
> > > Algorithms that don't have a generic implementation shouldn't be included.
> > >
> > Hi Eric,
> >   Yes we have tested this with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y
> >
> >   Also is it fine if those additional algos stay inside that disabled
> > CONFIG. SPAcc hardware
> >   does support those algos.
> >
> > - PK
> >
>
> If you provide an option to build them into the driver, that still counts as
> them being there.  I think they should just be left out entirely for now.
>
> - Eric