diff mbox

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

Message ID 20150526062433.GA6025@gondor.apana.org.au
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Herbert Xu May 26, 2015, 6:24 a.m. UTC
On Mon, May 25, 2015 at 07:53:41PM +0800, Herbert Xu wrote:
> On Mon, May 25, 2015 at 01:50:55PM +0200, Stephan Mueller wrote:
> >
> > When you have my code local, simply execute libkcapi/test/kcapi -y twice or 
> > three times. That triggered the crash.
> 
> Aha that's what I was missing.  I'll look into the crash.

OK I forgot to initialise the SG list.  This patch fixes it for me.

Comments

Stephan Mueller May 26, 2015, 6:44 a.m. UTC | #1
Am Dienstag, 26. Mai 2015, 14:24:33 schrieb Herbert Xu:

Hi Herbert,

> On Mon, May 25, 2015 at 07:53:41PM +0800, Herbert Xu wrote:
> > On Mon, May 25, 2015 at 01:50:55PM +0200, Stephan Mueller wrote:
> > > When you have my code local, simply execute libkcapi/test/kcapi -y twice
> > > or
> > > three times. That triggered the crash.
> > 
> > Aha that's what I was missing.  I'll look into the crash.
> 
> OK I forgot to initialise the SG list.  This patch fixes it for me.

Confirmed. I see no more issues on the AF_ALG side.
Herbert Xu May 26, 2015, 7:36 a.m. UTC | #2
On Tue, May 26, 2015 at 08:44:29AM +0200, Stephan Mueller wrote:
>
> Confirmed. I see no more issues on the AF_ALG side.

OK it works but there is a more serious issue.  In particular, the
user-space interface only provides spaces for the AD in the source
and not in the destination.

That means if we need to modify the AD (e.g., to rearrange headers
for IPsec) then we'd have to copy it.

So what I'd like to do is to make the recvmsg also provide space
for the AD.  That way we can always copy the AD into that space
and modify it if necessary.

In order to allow this to be done I'm going to disable the AEAD
user-space interface in 4.1 so that we have time to fix it properly
for 4.2.

Cheers,
Stephan Mueller May 26, 2015, 7:57 a.m. UTC | #3
Am Dienstag, 26. Mai 2015, 15:36:05 schrieb Herbert Xu:

Hi Herbert,
>
>In order to allow this to be done I'm going to disable the AEAD
>user-space interface in 4.1 so that we have time to fix it properly
>for 4.2.

Ok. Would you look into that one or shall I do that?

Ciao
Stephan
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Herbert Xu May 26, 2015, 7:58 a.m. UTC | #4
On Tue, May 26, 2015 at 09:57:51AM +0200, Stephan Mueller wrote:
>
> Ok. Would you look into that one or shall I do that?

I'll reenable it immediately after the patch to convert it to
the new interface is merged.

Cheers,
diff mbox

Patch

diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c
index 1d08483..35556a6 100644
--- a/crypto/algif_aead.c
+++ b/crypto/algif_aead.c
@@ -454,6 +454,7 @@  static int aead_recvmsg(struct socket *sock, struct msghdr *msg, size_t ignored,
 	if (usedpages < outlen)
 		goto unlock;
 
+	sg_init_table(dstbuf, ALG_MAX_PAGES + 1);
 	sg_mark_end(sgl->sg + sgl->cur);
 	assoclen = ctx->aead_assoclen;
 	/*