OSDN Git Service

crypto: qce - Add MAC failed error checking
authorThara Gopinath <thara.gopinath@linaro.org>
Thu, 29 Apr 2021 15:07:01 +0000 (11:07 -0400)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 14 May 2021 11:07:55 +0000 (19:07 +0800)
MAC_FAILED gets set in the status register if authenthication fails
for ccm algorithms(during decryption). Add support to catch and flag
this error.

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qce/common.c

index dceb957..dd76175 100644 (file)
@@ -419,6 +419,8 @@ int qce_check_status(struct qce_device *qce, u32 *status)
         */
        if (*status & STATUS_ERRORS || !(*status & BIT(OPERATION_DONE_SHIFT)))
                ret = -ENXIO;
+       else if (*status & BIT(MAC_FAILED_SHIFT))
+               ret = -EBADMSG;
 
        return ret;
 }