lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri,  1 May 2020 03:14:51 -0700
From:   Rajan Vaja <rajan.vaja@...inx.com>
To:     herbert@...dor.apana.org.au, davem@...emloft.net,
        gregkh@...uxfoundation.org, kalyani.akula@...inx.com
Cc:     michal.simek@...inx.com, jolly.shah@...inx.com,
        linux-crypto@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org, Rajan Vaja <rajan.vaja@...inx.com>
Subject: [PATCH char-misc-next] crypto: xilinx: Handle AES PM API return status

Fixes: bc86f9c54616 ("firmware: xilinx: Remove eemi ops for aes engine")

Return value of AES PM API is not handled which may result in
unexpected value of "status" in zynqmp_pm_aes_engine().

Consider "status" value as valid only if AES PM API is successful.

Signed-off-by: Rajan Vaja <rajan.vaja@...inx.com>
---
 drivers/crypto/xilinx/zynqmp-aes-gcm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/xilinx/zynqmp-aes-gcm.c b/drivers/crypto/xilinx/zynqmp-aes-gcm.c
index d0a0daf..a27e3550 100644
--- a/drivers/crypto/xilinx/zynqmp-aes-gcm.c
+++ b/drivers/crypto/xilinx/zynqmp-aes-gcm.c
@@ -85,6 +85,7 @@ static int zynqmp_aes_aead_cipher(struct aead_request *req)
 	dma_addr_t dma_addr_data, dma_addr_hw_req;
 	unsigned int data_size;
 	unsigned int status;
+	int ret;
 	size_t dma_size;
 	char *kbuf;
 	int err;
@@ -132,9 +133,12 @@ static int zynqmp_aes_aead_cipher(struct aead_request *req)
 		hwreq->key = 0;
 	}
 
-	zynqmp_pm_aes_engine(dma_addr_hw_req, &status);
+	ret = zynqmp_pm_aes_engine(dma_addr_hw_req, &status);
 
-	if (status) {
+	if (ret) {
+		dev_err(dev, "ERROR: AES PM API failed\n");
+		err = ret;
+	} else if (status) {
 		switch (status) {
 		case ZYNQMP_AES_GCM_TAG_MISMATCH_ERR:
 			dev_err(dev, "ERROR: Gcm Tag mismatch\n");
-- 
2.7.4

Powered by blists - more mailing lists