LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Stephan Mueller <smueller@chronox.de>
Cc: "'Quentin Gouchet'" <quentin.gouchet@gmail.com>,
	Daniel Borkmann <dborkman@redhat.com>,
	linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
	linux-crypto@vger.kernel.org
Subject: Re: [PATCH v8 1/2] crypto: AF_ALG: add AEAD support
Date: Thu, 8 Jan 2015 22:09:31 +1100	[thread overview]
Message-ID: <20150108110931.GA8568@gondor.apana.org.au> (raw)
In-Reply-To: <6260799.4x68Msg3Li@tachyon.chronox.de>

On Wed, Jan 07, 2015 at 04:51:38PM +0100, Stephan Mueller wrote:
>
> +		if (!aead_writable(sk)) {
> +			/*
> +			 * If there is more data to be expected, but we cannot
> +			 * write more data, forcefully define that we do not
> +			 * expect more data to invoke the AEAD operation. This
> +			 * prevents a deadlock in user space.
> +			 */
> +			ctx->more = 0;

We should return EMSGSIZE here.  Also we should clear out the
existing data so that the socket may be reused again.

> +	ctx->more = msg->msg_flags & MSG_MORE;
> +	if (!ctx->more && !aead_sufficient_data(ctx))
> +		err = -EINVAL;

Ditto, we should discard the data that's queued up.  Also perhaps
use EBADMSG instead of EINVAL.

> +	/*
> +	 * Require exactly one IOV block as the AEAD operation is a one shot
> +	 * due to the authentication tag.
> +	 */
> +	if (msg->msg_iter.nr_segs != 1)
> +		return -ENOMSG;

Why does the receive buffer have to be contiguous?

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

  reply	other threads:[~2015-01-08 11:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07 15:51 [PATCH v8 0/2] crypto: AF_ALG: add AEAD and RNG support Stephan Mueller
2015-01-07 15:51 ` [PATCH v8 1/2] crypto: AF_ALG: add AEAD support Stephan Mueller
2015-01-08 11:09   ` Herbert Xu [this message]
2015-01-09  3:30     ` Stephan Mueller
2015-01-20  3:00       ` Herbert Xu
2015-01-20  3:08         ` Stephan Mueller
2015-01-07 15:52 ` [PATCH v8 2/2] crypto: AF_ALG: enable AEAD interface compilation Stephan Mueller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150108110931.GA8568@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=dborkman@redhat.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quentin.gouchet@gmail.com \
    --cc=smueller@chronox.de \
    --subject='Re: [PATCH v8 1/2] crypto: AF_ALG: add AEAD support' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).