crypto: add driver for Axis ARTPEC crypto accelerator
Subsystems (3)
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.
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 | 3181 ++++++++++++++++++++ include/crypto/internal/hash.h | 2 + 8 files changed, 3252 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 · 6 lines
2.11.0 -- 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
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 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
@@ -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 · 6 lines
2.11.0 -- 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
PATCH 2/4 crypto: add crypto_(un)register_ahashes()
In reply to a message not in the archiveFrom: Rabin Vincent <[email protected]>
There are already helpers to (un)register multiple normal and AEAD algos. Add one for ahashes too.
--- crypto/ahash.c | 29 +++++++++++++++++++++++++++++ include/crypto/internal/hash.h | 2 ++ 2 files changed, 31 insertions(+)
crypto/ahash.c +29 -0
@@ -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
@@ -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 · 6 lines
2.11.0 -- 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
PATCH 4/4 MAINTAINERS: Add ARTPEC crypto maintainer
In reply to a message not in the archiveAssign the Axis kernel team as maintainer for crypto drivers under drivers/crypto/axis.
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -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 · 6 lines
2.11.0 -- 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
Lars Persson
maintainerPATCH 3/4 crypto: axis: add ARTPEC-6/7 crypto accelerator driver
In reply to Lars PerssonThis 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 | 3181 ++++++++++++++++++++++++++++++++++ 4 files changed, 3204 insertions(+) create mode 100644 drivers/crypto/axis/Makefile create mode 100644 drivers/crypto/axis/artpec6_crypto.c
drivers/crypto/Kconfig +21 -0
@@ -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
@@ -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
@@ -0,0 +1 @@ +obj-$(CONFIG_CRYPTO_DEV_ARTPEC6) := artpec6_crypto.o
drivers/crypto/axis/artpec6_crypto.c new file +3181 -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.
A message that is not in the archive (sent off-list or not yet received): b2d7ce4b0fecc4e811c12573f44bd7c45f0147e2.1500557664.git.larper-VrBV9hrLPhE@public.gmane.org
Re: [PATCH 3/4] crypto: axis: add ARTPEC-6/7 crypto accelerator driver
Am Donnerstag, 20. Juli 2017, 15:44:31 CEST schrieb Lars Persson:
Hi Lars,
Quoted 8 lines
(quoted diff) +2
-0+static int +artpec6_crypto_cipher_set_key(struct crypto_skcipher *cipher, const u8*key, + unsigned int keylen)
drivers/crypto/axis/artpec6_crypto.c new file +5
-0+{ +struct artpec6_cryptotfm_context *ctx = +crypto_skcipher_ctx (cipher); + +if (ctx->crypto_type ==ARTPEC6_CRYPTO_CIPHER_NULL )
drivers/crypto/axis/artpec6_crypto.c line 1630
Quoted 10 lines
drivers/crypto/axis/artpec6_crypto.c new file +10
-0+return 0 ; + +switch (keylen) { +case 16 : +case 24 : +case 32 : +break ; +case 48 : +case 64 : +if (ctx->crypto_type ==ARTPEC6_CRYPTO_CIPHER_AES_XTS )
Could you please add xts_check_key for XTS keys?
Ciao
Stephan
--
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
Lars Persson
maintainerRe: [PATCH 3/4] crypto: axis: add ARTPEC-6/7 crypto accelerator driver
Quoted 16 lines · Stephan Müller
Am Donnerstag, 20. Juli 2017, 15:44:31 CEST schrieb Lars Persson:
Hi Lars,
Quoted 12 lines
(quoted diff) +2
-0+static int +artpec6_crypto_cipher_set_key(struct crypto_skcipher *cipher, const u8*key, + unsigned int keylen)
drivers/crypto/axis/artpec6_crypto.c new file +9
-0+{ +struct artpec6_cryptotfm_context *ctx = +crypto_skcipher_ctx (cipher); + +if (ctx->crypto_type ==ARTPEC6_CRYPTO_CIPHER_NULL ) +return 0 ; + +switch (keylen) { +case 16 :
Quoted 9 lines
drivers/crypto/axis/artpec6_crypto.c line 1630
Quoted 6 lines
drivers/crypto/axis/artpec6_crypto.c new file +6
-0+case 24 : +case 32 : +break ; +case 48 : +case 64 : +if (ctx->crypto_type ==ARTPEC6_CRYPTO_CIPHER_AES_XTS )Could you please add
xts_check_keyfor XTS keys?
Sure, I will add this in v2.
Thanks,
Lars