Commit cb3078f3 authored by Horia Geantă's avatar Horia Geantă Committed by Herbert Xu
Browse files

crypto: caam/qi - return -EBADMSG for ICV check failure



Crypto drivers are expected to return -EBADMSG in case of
ICV check (authentication) failure.

In this case it also makes sense to suppress the error message
in the QI dequeue callback.

Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent dc7bcef5
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -562,7 +562,17 @@ static void aead_done(struct caam_drv_req *drv_req, u32 status)
	qidev = caam_ctx->qidev;

	if (unlikely(status)) {
		u32 ssrc = status & JRSTA_SSRC_MASK;
		u8 err_id = status & JRSTA_CCBERR_ERRID_MASK;

		caam_jr_strstatus(qidev, status);
		/*
		 * verify hw auth check passed else return -EBADMSG
		 */
		if (ssrc == JRSTA_SSRC_CCB_ERROR &&
		    err_id == JRSTA_CCBERR_ERRID_ICVCHK)
			ecode = -EBADMSG;
		else
			ecode = -EIO;
	}

+9 −2
Original line number Diff line number Diff line
@@ -579,8 +579,15 @@ static enum qman_cb_dqrr_result caam_rsp_fq_dqrr_cb(struct qman_portal *p,

	fd = &dqrr->fd;
	status = be32_to_cpu(fd->status);
	if (unlikely(status))
		dev_err(qidev, "Error: %#x in CAAM response FD\n", status);
	if (unlikely(status)) {
		u32 ssrc = status & JRSTA_SSRC_MASK;
		u8 err_id = status & JRSTA_CCBERR_ERRID_MASK;

		if (ssrc != JRSTA_SSRC_CCB_ERROR ||
		    err_id != JRSTA_CCBERR_ERRID_ICVCHK)
			dev_err(qidev, "Error: %#x in CAAM response FD\n",
				status);
	}

	if (unlikely(qm_fd_get_format(fd) != qm_fd_compound)) {
		dev_err(qidev, "Non-compound FD from CAAM\n");