All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Thara Gopinath <thara.gopinath@linaro.org>
Cc: agross@kernel.org, herbert@gondor.apana.org.au,
	davem@davemloft.net, robh+dt@kernel.org, sboyd@kernel.org,
	mturquette@baylibre.com, linux-arm-msm@vger.kernel.org,
	linux-crypto@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org
Subject: Re: [PATCH 4/6] drivers:crypto:qce: Fix SHA result buffer corruption issues.
Date: Tue, 17 Nov 2020 22:04:27 -0600	[thread overview]
Message-ID: <20201118040427.GD8532@builder.lan> (raw)
In-Reply-To: <20201117134714.3456446-5-thara.gopinath@linaro.org>

On Tue 17 Nov 07:47 CST 2020, Thara Gopinath wrote:

> Partial hash was being copied into the final result buffer without the
> entire message block processed. Depending on how the end user processes
> this result buffer, errors vary from result buffer corruption to result
> buffer poisoing. Fix this issue by ensuring that only the final hash value
> is copied into the result buffer.
> 

Looks reasonable to me

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
> ---
>  drivers/crypto/qce/sha.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c
> index 87be96a0b0bb..61c418c12345 100644
> --- a/drivers/crypto/qce/sha.c
> +++ b/drivers/crypto/qce/sha.c
> @@ -48,7 +48,7 @@ static void qce_ahash_done(void *data)
>  	dma_unmap_sg(qce->dev, &rctx->result_sg, 1, DMA_FROM_DEVICE);
>  
>  	memcpy(rctx->digest, result->auth_iv, digestsize);
> -	if (req->result)
> +	if (req->result && rctx->last_blk)
>  		memcpy(req->result, result->auth_iv, digestsize);
>  
>  	rctx->byte_count[0] = cpu_to_be32(result->auth_byte_count[0]);
> -- 
> 2.25.1
> 

  reply	other threads:[~2020-11-18  4:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17 13:47 [PATCH 0/6] Enable Qualcomm Crypto Engine on sdm845 Thara Gopinath
2020-11-17 13:47 ` [PATCH 1/6] dt-binding:clock: Add entry for crypto engine RPMH clock resource Thara Gopinath
2020-11-18  3:57   ` Bjorn Andersson
2020-11-17 13:47 ` [PATCH 2/6] clk:qcom:rpmh: Add CE clock on sdm845 Thara Gopinath
2020-11-18  3:59   ` Bjorn Andersson
2020-11-17 13:47 ` [PATCH 3/6] drivers:crypto:qce: Enable support for crypto engine " Thara Gopinath
2020-11-18  4:02   ` Bjorn Andersson
2020-11-17 13:47 ` [PATCH 4/6] drivers:crypto:qce: Fix SHA result buffer corruption issues Thara Gopinath
2020-11-18  4:04   ` Bjorn Andersson [this message]
2020-11-17 13:47 ` [PATCH 5/6] dts:qcom:sdm845: Add dt entries to support crypto engine Thara Gopinath
2020-11-18  4:10   ` Bjorn Andersson
2020-11-18 19:58     ` Thara Gopinath
2020-11-17 13:47 ` [PATCH 6/6] devicetree:bindings:crypto: Extend qcom-qce binding to add support for crypto engine version 5.4 Thara Gopinath
2020-11-18  4:08   ` Bjorn Andersson
2020-11-17 16:57 ` [PATCH 0/6] Enable Qualcomm Crypto Engine on sdm845 Eric Biggers
2020-11-17 18:07   ` Thara Gopinath

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=20201118040427.GD8532@builder.lan \
    --to=bjorn.andersson@linaro.org \
    --cc=agross@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=thara.gopinath@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.