From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Thara Gopinath <thara.gopinath@linaro.org>
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
ebiggers@google.com, ardb@kernel.org, sivaprak@codeaurora.org,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/7] crypto: qce: common: Add MAC failed error checking
Date: Mon, 5 Apr 2021 12:36:00 -0500 [thread overview]
Message-ID: <20210405173600.GZ904837@yoga> (raw)
In-Reply-To: <20210225182716.1402449-2-thara.gopinath@linaro.org>
On Thu 25 Feb 12:27 CST 2021, Thara Gopinath wrote:
> MAC_FAILED gets set in the status register if authenthication fails
> for ccm algorithms(during decryption). Add support to catch and flag
> this error.
>
> Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
> ---
> drivers/crypto/qce/common.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/crypto/qce/common.c b/drivers/crypto/qce/common.c
> index dceb9579d87a..7c3cb483749e 100644
> --- a/drivers/crypto/qce/common.c
> +++ b/drivers/crypto/qce/common.c
> @@ -403,7 +403,8 @@ int qce_start(struct crypto_async_request *async_req, u32 type)
> }
>
> #define STATUS_ERRORS \
> - (BIT(SW_ERR_SHIFT) | BIT(AXI_ERR_SHIFT) | BIT(HSD_ERR_SHIFT))
> + (BIT(SW_ERR_SHIFT) | BIT(AXI_ERR_SHIFT) | \
> + BIT(HSD_ERR_SHIFT) | BIT(MAC_FAILED_SHIFT))
>
> int qce_check_status(struct qce_device *qce, u32 *status)
> {
> @@ -417,8 +418,12 @@ int qce_check_status(struct qce_device *qce, u32 *status)
> * use result_status from result dump the result_status needs to be byte
> * swapped, since we set the device to little endian.
> */
> - if (*status & STATUS_ERRORS || !(*status & BIT(OPERATION_DONE_SHIFT)))
> - ret = -ENXIO;
> + if (*status & STATUS_ERRORS || !(*status & BIT(OPERATION_DONE_SHIFT))) {
> + if (*status & BIT(MAC_FAILED_SHIFT))
Afaict MAC_FAILED indicates a different category of errors from the
others. So I would prefer that the conditionals are flattened.
Is OPERATION_DONE set when MAC_FAILED?
If so:
if (errors || !done)
return -ENXIO;
else if (*status & BIT(MAC_FAILED))
return -EBADMSG;
Would be cleaner in my opinion.
Regards,
Bjorn
> + ret = -EBADMSG;
> + else
> + ret = -ENXIO;
> + }
>
> return ret;
> }
> --
> 2.25.1
>
next prev parent reply other threads:[~2021-04-05 17:36 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-25 18:27 [PATCH 0/7] Add support for AEAD algorithms in Qualcomm Crypto Engine driver Thara Gopinath
2021-02-25 18:27 ` [PATCH 1/7] crypto: qce: common: Add MAC failed error checking Thara Gopinath
2021-04-05 17:36 ` Bjorn Andersson [this message]
2021-04-13 19:28 ` Thara Gopinath
2021-02-25 18:27 ` [PATCH 2/7] crypto: qce: common: Make result dump optional Thara Gopinath
2021-04-05 22:23 ` Bjorn Andersson
2021-02-25 18:27 ` [PATCH 3/7] crypto: qce: Add mode for rfc4309 Thara Gopinath
2021-04-05 22:32 ` Bjorn Andersson
2021-04-13 19:30 ` Thara Gopinath
2021-04-13 20:38 ` Bjorn Andersson
2021-02-25 18:27 ` [PATCH 4/7] crypto: qce: Add support for AEAD algorithms Thara Gopinath
2021-03-12 13:01 ` Herbert Xu
2021-03-17 2:09 ` Thara Gopinath
2021-02-25 18:27 ` [PATCH 5/7] crypto: qce: common: Clean up qce_auth_cfg Thara Gopinath
2021-02-25 18:27 ` [PATCH 6/7] crypto: qce: common: Add support for AEAD algorithms Thara Gopinath
2021-04-05 22:18 ` Bjorn Andersson
2021-04-13 21:31 ` Thara Gopinath
2021-04-13 22:20 ` Bjorn Andersson
2021-04-13 22:44 ` Thara Gopinath
2021-04-13 23:09 ` Bjorn Andersson
2021-04-17 13:31 ` Thara Gopinath
2021-04-13 22:27 ` Thara Gopinath
2021-04-13 22:33 ` Bjorn Andersson
2021-04-13 22:46 ` Thara Gopinath
2021-02-25 18:27 ` [PATCH 7/7] crypto: qce: aead: Schedule fallback algorithm Thara Gopinath
2021-03-04 5:30 ` [PATCH 0/7] Add support for AEAD algorithms in Qualcomm Crypto Engine driver Herbert Xu
2021-03-04 18:41 ` Thara Gopinath
2021-03-12 13:02 ` Herbert Xu
2021-03-17 2:08 ` 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=20210405173600.GZ904837@yoga \
--to=bjorn.andersson@linaro.org \
--cc=ardb@kernel.org \
--cc=davem@davemloft.net \
--cc=ebiggers@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sivaprak@codeaurora.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 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).