linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kamil Konieczny <k.konieczny@partner.samsung.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>, linux-crypto@vger.kernel.org
Cc: herbert@gondor.apana.org.au,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Vladimir Zapolskiy <vz@mleia.com>,
	linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH 1/2] crypto: s5p - deal gracefully with bogus input sizes
Date: Tue, 20 Aug 2019 11:51:15 +0200	[thread overview]
Message-ID: <e0eec29e-d869-0d58-75d9-1e2118b649ef@partner.samsung.com> (raw)
In-Reply-To: <20190819142226.1703-2-ard.biesheuvel@linaro.org>



On 19.08.2019 16:22, Ard Biesheuvel wrote:
> The s5p skcipher driver returns -EINVAL for zero length inputs, which
> deviates from the behavior of the generic ECB template, and causes fuzz
> tests to fail. In cases where the input is not a multiple of the AES
> block size (and the chaining mode is not CTR), it prints an error to
> the kernel log, which is a thing we usually try to avoid in response
> to situations that can be triggered by unprivileged users.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  drivers/crypto/s5p-sss.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
> index 9ef25230c199..ef90c58edb1f 100644
> --- a/drivers/crypto/s5p-sss.c
> +++ b/drivers/crypto/s5p-sss.c
> @@ -2056,9 +2056,12 @@ static int s5p_aes_crypt(struct ablkcipher_request *req, unsigned long mode)
>  	struct s5p_aes_ctx *ctx = crypto_ablkcipher_ctx(tfm);
>  	struct s5p_aes_dev *dev = ctx->dev;
>  
> +	if (!req->nbytes)
> +		return 0;
> +
>  	if (!IS_ALIGNED(req->nbytes, AES_BLOCK_SIZE) &&
>  			((mode & FLAGS_AES_MODE_MASK) != FLAGS_AES_CTR)) {
> -		dev_err(dev->dev, "request size is not exact amount of AES blocks\n");
> +		dev_dbg(dev->dev, "request size is not exact amount of AES blocks\n");
>  		return -EINVAL;
>  	}

Acked-by: Kamil Konieczny <k.konieczny@partner.samsung.com>

-- 
Best regards,
Kamil Konieczny
Samsung R&D Institute Poland


  reply	other threads:[~2019-08-20  9:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 14:22 [PATCH 0/2] drivers/crypto - s5p fixes Ard Biesheuvel
2019-08-19 14:22 ` [PATCH 1/2] crypto: s5p - deal gracefully with bogus input sizes Ard Biesheuvel
2019-08-20  9:51   ` Kamil Konieczny [this message]
2019-08-20 10:07   ` Krzysztof Kozlowski
2019-08-19 14:22 ` [PATCH 2/2] crypto: s5p - use correct block size of 1 for ctr(aes) Ard Biesheuvel
2019-08-20  9:51   ` Kamil Konieczny
2019-08-20 10:24   ` Krzysztof Kozlowski
2019-08-20 10:57     ` Ard Biesheuvel
2019-08-20 11:23       ` Krzysztof Kozlowski
2019-08-20 11:39     ` Kamil Konieczny
2019-08-20 11:48       ` Krzysztof Kozlowski
2019-08-20 12:28         ` Kamil Konieczny
2019-08-30  8:19 ` [PATCH 0/2] drivers/crypto - s5p fixes Herbert Xu

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=e0eec29e-d869-0d58-75d9-1e2118b649ef@partner.samsung.com \
    --to=k.konieczny@partner.samsung.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=krzk@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=vz@mleia.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).