Skip to contentSkip to conversation

crypto: add driver for Axis ARTPEC crypto accelerator

PATCH In review Lars Persson 2 participants 7 messages Aug 10, 2017 – Aug 22, 2017

Subsystems (3)
lore
Share & tools
lore

Lars Persson

author maintainer
#0 lore raw

v4 cover crypto: add driver for Axis ARTPEC crypto accelerator

This series adds a driver for the crypto accelerator in the ARTPEC series of SoCs from Axis Communications AB.

Changelog v4:
- The skcipher conversion had a mistake where the algos were registered instead of unregistered at module unloading.

Changelog v3:
- The patch author added his Signed-off-by on patch 2.

Changelog v2:
- Use xts_check_key() for xts keys.
- Use CRYPTO_ALG_TYPE_SKCIPHER instead of CRYPTO_ALG_TYPE_ABLKCIPHER in cra_flags.

Lars Persson (3):
dt-bindings: crypto: add ARTPEC crypto
crypto: axis: add ARTPEC-6/7 crypto accelerator driver
MAINTAINERS: Add ARTPEC crypto maintainer

Rabin Vincent (1):
crypto: add crypto_(un)register_ahashes()

 .../devicetree/bindings/crypto/artpec6-crypto.txt  |   16 +
 MAINTAINERS                                        |    1 +
 crypto/ahash.c                                     |   29 +
 drivers/crypto/Kconfig                             |   21 +
 drivers/crypto/Makefile                            |    1 +
 drivers/crypto/axis/Makefile                       |    1 +
 drivers/crypto/axis/artpec6_crypto.c               | 3192 ++++++++++++++++++++
 include/crypto/internal/hash.h                     |    2 +
 8 files changed, 3263 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/artpec6-crypto.txt
 create mode 100644 drivers/crypto/axis/Makefile
 create mode 100644 drivers/crypto/axis/artpec6_crypto.c
Signature · 1 line
2.11.0
author maintainer
#1 lore raw

PATCH v4 1/4 dt-bindings: crypto: add ARTPEC crypto

Document the device tree bindings for the ARTPEC crypto accelerator on ARTPEC-6 and ARTPEC-7 SoCs.

---
 .../devicetree/bindings/crypto/artpec6-crypto.txt        | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/artpec6-crypto.txt
Documentation/devicetree/bindings/crypto/artpec6-crypto.txt new file +16 -0
new file mode 100644
index 000000000000..d9cca4875bd6
@@ -0,0 +1,16 @@
+Axis crypto engine with PDMA interface.
+
+Required properties:
+- compatible : Should be one of the following strings:
+	"axis,artpec6-crypto" for the version in the Axis ARTPEC-6 SoC
+	"axis,artpec7-crypto" for the version in the Axis ARTPEC-7 SoC.
+- reg: Base address and size for the PDMA register area.
+- interrupts: Interrupt handle for the PDMA interrupt line.
+
+Example:
+
+crypto@f4264000 {
+	compatible = "axis,artpec6-crypto";
+	reg = <0xf4264000 0x1000>;
+	interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
+};
Signature · 1 line
2.11.0
author maintainer
#2 lore raw

PATCH v4 2/4 crypto: add crypto_(un)register_ahashes()

In reply to Lars Persson

From: Rabin Vincent <[email protected]>

There are already helpers to (un)register multiple normal and AEAD algos. Add one for ahashes too.

---
v4: crypto_register_skciphers was used where crypto_unregister_skciphers
was intended.

 crypto/ahash.c                 | 29 +++++++++++++++++++++++++++++
 include/crypto/internal/hash.h |  2 ++
 2 files changed, 31 insertions(+)
crypto/ahash.c +29 -0
index 826cd7ab4d4a..5e8666e6ccae 100644
@@ -588,6 +588,35 @@ int crypto_unregister_ahash(struct ahash_alg *alg)
 }
 EXPORT_SYMBOL_GPL(crypto_unregister_ahash);
 
+int crypto_register_ahashes(struct ahash_alg *algs, int count)
+{
+	int i, ret;
+
+	for (i = 0; i < count; i++) {
+		ret = crypto_register_ahash(&algs[i]);
+		if (ret)
+			goto err;
+	}
+
+	return 0;
+
+err:
+	for (--i; i >= 0; --i)
+		crypto_unregister_ahash(&algs[i]);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(crypto_register_ahashes);
+
+void crypto_unregister_ahashes(struct ahash_alg *algs, int count)
+{
+	int i;
+
+	for (i = count - 1; i >= 0; --i)
+		crypto_unregister_ahash(&algs[i]);
+}
+EXPORT_SYMBOL_GPL(crypto_unregister_ahashes);
+
 int ahash_register_instance(struct crypto_template *tmpl,
 			    struct ahash_instance *inst)
 {
include/crypto/internal/hash.h +2 -0
index f6d9af3efa45..f0b44c16e88f 100644
@@ -76,6 +76,8 @@ static inline int crypto_ahash_walk_last(struct crypto_hash_walk *walk)
 
 int crypto_register_ahash(struct ahash_alg *alg);
 int crypto_unregister_ahash(struct ahash_alg *alg);
+int crypto_register_ahashes(struct ahash_alg *algs, int count);
+void crypto_unregister_ahashes(struct ahash_alg *algs, int count);
 int ahash_register_instance(struct crypto_template *tmpl,
 			    struct ahash_instance *inst);
 void ahash_free_instance(struct crypto_instance *inst);
Signature · 1 line
2.11.0
author maintainer
#3 lore raw

Re: [PATCH v4 2/4] crypto: add crypto_(un)register_ahashes()

Quoted 11 lines · Lars Persson

From: Rabin Vincent <[email protected]>

There are already helpers to (un)register multiple normal and AEAD algos. Add one for ahashes too.

---
v4: crypto_register_skciphers was used where crypto_unregister_skciphers
was intended.

The v4 change comment above in fact belongs to patch 3/4 of this series. Sorry for the confusion.

BR,
Lars
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#4 lore raw

PATCH v4 3/4 crypto: axis: add ARTPEC-6/7 crypto accelerator driver

In reply to Lars Persson

This is an asynchronous crypto API driver for the accelerator present in the ARTPEC-6 and -7 SoCs from Axis Communications AB.

The driver supports AES in ECB/CTR/CBC/XTS/GCM modes and SHA1/2 hash standards.

---
 drivers/crypto/Kconfig               |   21 +
 drivers/crypto/Makefile              |    1 +
 drivers/crypto/axis/Makefile         |    1 +
 drivers/crypto/axis/artpec6_crypto.c | 3192 ++++++++++++++++++++++++++++++++++
 4 files changed, 3215 insertions(+)
 create mode 100644 drivers/crypto/axis/Makefile
 create mode 100644 drivers/crypto/axis/artpec6_crypto.c
drivers/crypto/Kconfig +21 -0
index 5b5393f1b87a..fe33c199fc1a 100644
@@ -708,4 +708,25 @@ config CRYPTO_DEV_SAFEXCEL
 	  chain mode, AES cipher mode and SHA1/SHA224/SHA256/SHA512 hash
 	  algorithms.
 
+config CRYPTO_DEV_ARTPEC6
+	tristate "Support for Axis ARTPEC-6/7 hardware crypto acceleration."
+	depends on ARM && (ARCH_ARTPEC || COMPILE_TEST)
+	depends on HAS_DMA
+	depends on OF
+	select CRYPTO_AEAD
+	select CRYPTO_AES
+	select CRYPTO_ALGAPI
+	select CRYPTO_BLKCIPHER
+	select CRYPTO_CTR
+	select CRYPTO_HASH
+	select CRYPTO_SHA1
+	select CRYPTO_SHA256
+	select CRYPTO_SHA384
+	select CRYPTO_SHA512
+	help
+	  Enables the driver for the on-chip crypto accelerator
+	  of Axis ARTPEC SoCs.
+
+	  To compile this driver as a module, choose M here.
+
 endif # CRYPTO_HW
drivers/crypto/Makefile +1 -0
index de629165fde7..7bf0997eae25 100644
@@ -44,3 +44,4 @@ obj-$(CONFIG_CRYPTO_DEV_VIRTIO) += virtio/
 obj-$(CONFIG_CRYPTO_DEV_VMX) += vmx/
 obj-$(CONFIG_CRYPTO_DEV_BCM_SPU) += bcm/
 obj-$(CONFIG_CRYPTO_DEV_SAFEXCEL) += inside-secure/
+obj-$(CONFIG_CRYPTO_DEV_ARTPEC6) += axis/
drivers/crypto/axis/Makefile new file +1 -0
new file mode 100644
index 000000000000..be9a84a4b667
@@ -0,0 +1 @@
+obj-$(CONFIG_CRYPTO_DEV_ARTPEC6) := artpec6_crypto.o
drivers/crypto/axis/artpec6_crypto.c new file +3192 -0

2,970 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.11.0

Part of the diff is not shown here. View the raw message.

author maintainer
#5 lore raw

PATCH v4 4/4 MAINTAINERS: Add ARTPEC crypto maintainer

In reply to Lars Persson

Assign the Axis kernel team as maintainer for crypto drivers under drivers/crypto/axis.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index d5b6c71e783e..72186cf9820d 100644
@@ -1129,6 +1129,7 @@ L:	[email protected]
 F:	arch/arm/mach-artpec
 F:	arch/arm/boot/dts/artpec6*
 F:	drivers/clk/axis
+F:	drivers/crypto/axis
 F:	drivers/pinctrl/pinctrl-artpec*
 F:	Documentation/devicetree/bindings/pinctrl/axis,artpec6-pinctrl.txt
 
Signature · 1 line
2.11.0
maintainer
#6 lore raw
In reply to Lars Persson
Quoted 6 lines · Lars Persson

This series adds a driver for the crypto accelerator in the ARTPEC series of SoCs from Axis Communications AB.

Changelog v4:
- The skcipher conversion had a mistake where the algos were registered instead of unregistered at module unloading.

All applied. Thanks.

Signature · 7 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html