Re: [v2 PATCH 13/13] crypto: algif_aead - Switch to new AEAD interface

Herbert Xu
2015-05-24T03:34:20Z

On Sat, May 23, 2015 at 08:04:19PM +0200, Stephan Mueller wrote:
> Am Freitag, 22. Mai 2015, 16:31:04 schrieb Herbert Xu:
>
> Hi Herbert,
>
> > This patch makes use of the new AEAD interface which uses a single
> > SG list instead of separate lists for the AD and plain text.
>
> After applying your additional patch, the "normal" AEAD operation works.
>
> But with long messages (16 filled pages), I get the following. To test, simply
> use [1], cd libkcapi/test, compile and execute ./kcapi -y

Thanks for testing!

Does this patch help?

diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c
index a483a6f..1d08483 100644
--- a/crypto/algif_aead.c
+++ b/crypto/algif_aead.c
@@ -494,11 +494,11 @@ static int aead_recvmsg(struct socket *sock, struct msghdr *msg, size_t ignored,
else if (outlen)
/* AD size is non-zero */
scatterwalk_crypto_chain(
- dst, ctx->rsgl[0].sg,
+ dst + i - 1, ctx->rsgl[0].sg,
sg_page(ctx->rsgl[0].sg) == sg_page(dst + i - 1) &&
ctx->rsgl[0].sg[0].offset == dst[i - 1].offset +
dst[i - 1].length,
- i + 1);
+ 2);
else
/* AD only */
sg_mark_end(dst + i);

Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt