Re: [PATCH 6/8] crypto: caam - Convert GCM to new AEAD interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 15, 2015 at 08:59:51PM +0800, Herbert Xu wrote:
> On Mon, Jun 15, 2015 at 03:33:20PM +0300, Horia Geantă wrote:
> > 
> > Testing on P2041RDB I see the following failures:
> > 
> > caam_jr ffe301000.jr: 40000f10: DECO: desc idx 15: Invalid Sequence
> > Command. A SEQ IN PTR OR SEQ OUT PTR Command is invalid or a SEQ KEY,
> > SEQ LOAD, SEQ FIFO LOAD, or SEQ FIFO STORE decremented the input or
> > output sequence length below 0. This error may result if a built-in
> > PROTOCOL Command has encountered a malformed PDU.
> > alg: aead: encryption failed on test 1 for rfc4106-gcm-aes-caam:
> > ret=-1073745680

OK I see a bug here where I used the wrong length so it's off by
authsize and that could explain the error.

> > caam_jr ffe301000.jr: 40000e10: DECO: desc idx 14: Invalid Sequence
> > Command. A SEQ IN PTR OR SEQ OUT PTR Command is invalid or a SEQ KEY,
> > SEQ LOAD, SEQ FIFO LOAD, or SEQ FIFO STORE decremented the input or
> > output sequence length below 0. This error may result if a built-in
> > PROTOCOL Command has encountered a malformed PDU.
> > alg: aead: encryption failed on test 1 for rfc4543-gcm-aes-caam:
> > ret=-1073745424

I still don't understand this one though.

Here's an incremental patch for rfc4106.

diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index ca8948e..066a488 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -986,10 +986,10 @@ static int rfc4106_set_sh_desc(struct crypto_aead *aead)
 			     FIFOLD_TYPE_AAD | FIFOLD_TYPE_FLUSH1);
 
 	/* cryptlen = seqoutlen - assoclen */
-	append_math_sub(desc, VARSEQOUTLEN, SEQOUTLEN, REG0, CAAM_CMD_SZ);
+	append_math_sub(desc, VARSEQOUTLEN, SEQINLEN, REG0, CAAM_CMD_SZ);
 
 	/* Will read cryptlen bytes */
-	append_math_add(desc, VARSEQINLEN, SEQOUTLEN, REG0, CAAM_CMD_SZ);
+	append_math_sub(desc, VARSEQINLEN, SEQINLEN, REG0, CAAM_CMD_SZ);
 
 	/* Write encrypted data */
 	append_seq_fifo_store(desc, 0, FIFOST_TYPE_MESSAGE_DATA | FIFOLDST_VLF);
@@ -1054,10 +1054,10 @@ static int rfc4106_set_sh_desc(struct crypto_aead *aead)
 			     FIFOLD_TYPE_AAD | FIFOLD_TYPE_FLUSH1);
 
 	/* Will write cryptlen bytes */
-	append_math_sub(desc, VARSEQOUTLEN, SEQINLEN, REG0, CAAM_CMD_SZ);
+	append_math_sub(desc, VARSEQOUTLEN, SEQOUTLEN, REG0, CAAM_CMD_SZ);
 
 	/* Will read cryptlen bytes */
-	append_math_sub(desc, VARSEQINLEN, SEQINLEN, REG0, CAAM_CMD_SZ);
+	append_math_sub(desc, VARSEQINLEN, SEQOUTLEN, REG0, CAAM_CMD_SZ);
 
 	/* Store payload data */
 	append_seq_fifo_store(desc, 0, FIFOST_TYPE_MESSAGE_DATA | FIFOLDST_VLF);

Thanks,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
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 linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux