All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: caam: do not register AES-XTS mode on LP units
@ 2016-11-04 23:17 Sven Ebenfeld
  2016-11-07  7:13 ` Horia Geanta Neag
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Ebenfeld @ 2016-11-04 23:17 UTC (permalink / raw)
  To: linux-crypto, linux-kernel
  Cc: herbert, davem, horia.geanta, cata.vasile, sven.ebenfeld

When using AES-XTS on a Wandboard, we receive a Mode error:
caam_jr 2102000.jr1: 20001311: CCB: desc idx 19: AES: Mode error.

Due to the Security Reference Manual, the Low Power AES units
of the i.MX6 do not support the XTS mode. Therefore we should
try to provide them them in the API.

Signed-off-by: Sven Ebenfeld <sven.ebenfeld@gmail.com>
---
 drivers/crypto/caam/caamalg.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index 156aad1..f5a63ba 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -4583,6 +4583,15 @@ static int __init caam_algapi_init(void)
 		if (!aes_inst && (alg_sel == OP_ALG_ALGSEL_AES))
 				continue;
 
+		/*
+		 * Check support for AES modes not available
+		 * on LP devices.
+		 */
+		if ((cha_vid & CHA_ID_LS_AES_MASK) == CHA_ID_LS_AES_LP)
+			if ((alg->class1_alg_type & OP_ALG_AAI_MASK) ==
+			     OP_ALG_AAI_XTS)
+				continue;
+
 		t_alg = caam_alg_alloc(alg);
 		if (IS_ERR(t_alg)) {
 			err = PTR_ERR(t_alg);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: caam: do not register AES-XTS mode on LP units
  2016-11-04 23:17 [PATCH] crypto: caam: do not register AES-XTS mode on LP units Sven Ebenfeld
@ 2016-11-07  7:13 ` Horia Geanta Neag
  2016-11-07 17:58   ` AW: " Sven Ebenfeld
  0 siblings, 1 reply; 3+ messages in thread
From: Horia Geanta Neag @ 2016-11-07  7:13 UTC (permalink / raw)
  To: Sven Ebenfeld, linux-crypto, linux-kernel; +Cc: herbert, davem, Cata Vasile

On 11/5/2016 1:17 AM, Sven Ebenfeld wrote:
> When using AES-XTS on a Wandboard, we receive a Mode error:
> caam_jr 2102000.jr1: 20001311: CCB: desc idx 19: AES: Mode error.
> 
> Due to the Security Reference Manual, the Low Power AES units
s/Due to/According to

> of the i.MX6 do not support the XTS mode. Therefore we should
> try to provide them them in the API.
> 
Rephrase: Therefore we mustn't register XTS implementations to Crypto
API in this case.

> Signed-off-by: Sven Ebenfeld <sven.ebenfeld@gmail.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>

Please send the patch to -stable and mention the offending commit:
Cc: <stable@vger.kernel.org> # 4.4+
Fixes: c6415a6016bf "crypto: caam - add support for acipher xts(aes)"

Thanks,
Horia

> ---
>  drivers/crypto/caam/caamalg.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
> index 156aad1..f5a63ba 100644
> --- a/drivers/crypto/caam/caamalg.c
> +++ b/drivers/crypto/caam/caamalg.c
> @@ -4583,6 +4583,15 @@ static int __init caam_algapi_init(void)
>  		if (!aes_inst && (alg_sel == OP_ALG_ALGSEL_AES))
>  				continue;
>  
> +		/*
> +		 * Check support for AES modes not available
> +		 * on LP devices.
> +		 */
> +		if ((cha_vid & CHA_ID_LS_AES_MASK) == CHA_ID_LS_AES_LP)
> +			if ((alg->class1_alg_type & OP_ALG_AAI_MASK) ==
> +			     OP_ALG_AAI_XTS)
> +				continue;
> +
>  		t_alg = caam_alg_alloc(alg);
>  		if (IS_ERR(t_alg)) {
>  			err = PTR_ERR(t_alg);
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* AW: [PATCH] crypto: caam: do not register AES-XTS mode on LP units
  2016-11-07  7:13 ` Horia Geanta Neag
@ 2016-11-07 17:58   ` Sven Ebenfeld
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Ebenfeld @ 2016-11-07 17:58 UTC (permalink / raw)
  To: 'Horia Geanta Neag', linux-crypto, linux-kernel
  Cc: herbert, davem, 'Cata Vasile'

[-- Attachment #1: Type: text/plain, Size: 1278 bytes --]

> -----Ursprüngliche Nachricht-----
> Von: Horia Geanta Neag [mailto:horia.geanta@nxp.com]
> Gesendet: Montag, 7. November 2016 08:14
> An: Sven Ebenfeld <sven.ebenfeld@gmail.com>; linux-
> crypto@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: herbert@gondor.apana.org.au; davem@davemloft.net; Cata Vasile
> <cata.vasile@nxp.com>
> Betreff: Re: [PATCH] crypto: caam: do not register AES-XTS mode on LP
units
> 
> On 11/5/2016 1:17 AM, Sven Ebenfeld wrote:
> > When using AES-XTS on a Wandboard, we receive a Mode error:
> > caam_jr 2102000.jr1: 20001311: CCB: desc idx 19: AES: Mode error.
> >
> > Due to the Security Reference Manual, the Low Power AES units
> s/Due to/According to
> 
> > of the i.MX6 do not support the XTS mode. Therefore we should try to
> > provide them them in the API.
> >
> Rephrase: Therefore we mustn't register XTS implementations to Crypto API
> in this case.
> 
> > Signed-off-by: Sven Ebenfeld <sven.ebenfeld@gmail.com>
> Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
> 
> Please send the patch to -stable and mention the offending commit:
> Cc: <stable@vger.kernel.org> # 4.4+
> Fixes: c6415a6016bf "crypto: caam - add support for acipher xts(aes)"
> 
> Thanks,
> Horia

Thanks, I've sent a v2.
Sven


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 6016 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-07 17:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-04 23:17 [PATCH] crypto: caam: do not register AES-XTS mode on LP units Sven Ebenfeld
2016-11-07  7:13 ` Horia Geanta Neag
2016-11-07 17:58   ` AW: " Sven Ebenfeld

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.