Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2717650imj; Mon, 18 Feb 2019 10:50:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IaqhUZr8yDupvFp128ICXccSVs8Lk77YxxPws88i5b9rny2n3gCLwuaGuOK0bXpx6KSYjMt X-Received: by 2002:a63:4384:: with SMTP id q126mr19934360pga.160.1550515856859; Mon, 18 Feb 2019 10:50:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550515856; cv=none; d=google.com; s=arc-20160816; b=SJIdqHtHoEUUxuN2bI+hhEruxrTFYI4kHVyMQ8ysg5FaBosqIV4U1HmlaJjZs8Kgxo UyK0Dd2nbthgTw9bVsd0vtZ4kBNKG579KL2wh5QbHjqEuEsDmvkc0eIV3/uxdLJVJphr sg3xZlwfE3gg+5xOA6JPiWAaODOK9klJz+l8qQzzFutKwqgXs7qDgYaZAsMZrUqe88aM 9Mk1+W7ph05eaNb1KHmiaUkG9rvoakF+99qrGUYgBYA8W6YeY6E9zz/1ccAz3y4RkQn5 orYC+jCWItCjECNqDMm86m4fMhXaJZfHCnTBHn/PCe8SI01zvWG3u5j9B6UcosPXLPn3 n2CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature:dkim-filter; bh=C3YyHPasrjcj0odMLNMtMAQKA6Z2cWZ4yPrw/Bg1liI=; b=J5omMjk3RwMmvcc+dT7RD0Oqt9XuRksoY8Nau4srhT4kuUMC8MT3pfXAZNJlDVYN8J HS0/NJzoBMggItNAlcnvcI1onaXzUAvu2U1JbJeEI0cXVFinhksmDf/oZQy73RbDTliG jvFnt2gdYff8KW7wKLprk1soXx//X8nmlMnARTO/qYJm+NiADB3ZEIGa3+eq+FPH3TRW fj57RpeF/tCmaKkqz/zAGHTUuHiID18PWa8ZfK/U2tOitFgWyd9GcjRgCZnS/ImvydfV 0Osm+C2MFNQ6JV94xfJsws+R2697g1BTtIeHZeSiu6uqhcHygUUfOUxzwCSd6nstiE1Z lMMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=WEZCFADl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si13396707pgk.56.2019.02.18.10.50.41; Mon, 18 Feb 2019 10:50:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=WEZCFADl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388238AbfBRQBR (ORCPT + 99 others); Mon, 18 Feb 2019 11:01:17 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:35545 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731775AbfBRQBR (ORCPT ); Mon, 18 Feb 2019 11:01:17 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190218160115euoutp029aae0c513a954925d9f01ba00154d4b7~EgLJYt7_C3104031040euoutp02p for ; Mon, 18 Feb 2019 16:01:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190218160115euoutp029aae0c513a954925d9f01ba00154d4b7~EgLJYt7_C3104031040euoutp02p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1550505675; bh=C3YyHPasrjcj0odMLNMtMAQKA6Z2cWZ4yPrw/Bg1liI=; h=From:To:Cc:Subject:Date:References:From; b=WEZCFADld8dZP+8be56ZMjB+nFcqjraTdpgqidO5FafE0f7m15lHWuh0T8a+RZxi6 oL2OJijAysNcexsXXDKe4eYa6WLjLEwiO+hM6yLv96SvvjjwY3UxHD6HiIyL+uNR4Z 2usTlVG9eKVCuGzSDMKx6Qi8TXcuSJ95WGY9N4KM= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190218160114eucas1p12717be44f704370acb706727dee55e8b~EgLImCN1Q0407604076eucas1p1F; Mon, 18 Feb 2019 16:01:14 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id B3.E2.04806.9C6DA6C5; Mon, 18 Feb 2019 16:01:14 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20190218160113eucas1p2183a3620f8322ee33273d3bfe5f06486~EgLHutM-R2967929679eucas1p2Q; Mon, 18 Feb 2019 16:01:13 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190218160113eusmtrp100faad93c013dcd712bc460d407787c9~EgLHf2omU1405614056eusmtrp1o; Mon, 18 Feb 2019 16:01:13 +0000 (GMT) X-AuditID: cbfec7f5-79db79c0000012c6-bd-5c6ad6c9c59b Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id EC.DE.04128.9C6DA6C5; Mon, 18 Feb 2019 16:01:13 +0000 (GMT) Received: from AMDC3218.DIGITAL.local (unknown [106.120.51.18]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190218160112eusmtip201413564294153aa6434868d50ea1af6~EgLHDcaN50380003800eusmtip2s; Mon, 18 Feb 2019 16:01:12 +0000 (GMT) From: Kamil Konieczny To: k.konieczny@partner.samsung.com Cc: Krzysztof Kozlowski , Vladimir Zapolskiy , Herbert Xu , "David S. Miller" , Eric Biggers , linux-crypto@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: s5p: update iv after AES op end Date: Mon, 18 Feb 2019 17:00:46 +0100 Message-Id: <20190218160046.6387-1-k.konieczny@partner.samsung.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNKsWRmVeSWpSXmKPExsWy7djP87qnrmXFGPR8ZrSYc76FxWLtnj/M Ft2vZCz69v1ntDh/fgO7xf17P5ksLu+aw2Yx4/w+Jov/v5qZHTg9tqy8yeSx7YCqx6ZVnWwe /xZOYfE4+G4Pk8fnTXIBbFFcNimpOZllqUX6dglcGQs2H2Qq2MFV8eXTSpYGxkccXYycHBIC JhL3ni1k62Lk4hASWMEosX3Oa2YI5wujxIbHHYwQzmdGiRtnF7DDtMxoXARVtZxR4vC+x2xw Ld3PprKAVLEJmEs82n6GCcQWEVCWmHxvOlgHs8AqJomNV36DJYQFLCR27foHNpZFQFXi2fIn YHFeAWeJ3o/zGCHWyUuc713HDhEXlDg58wnYAmagePPW2WBDJQTa2SXufFoIdZ+LxI45j6Bs YYlXx7dA2TISpyf3sEDY5RK7tz5jh2huYZSYO3kRE0TCWuLw8YusXYwcQBs0Jdbv0ocIO0pc WriUDSQsIcAnceOtIMQNfBKTtoE8BhLmlehoE4Ko1pWY9/8MK4QtLdH1fx0rRImHxK1FwiCm kECsxKKNihMYFWYh+WsWkr9mIVywgJF5FaN4amlxbnpqsXFearlecWJucWleul5yfu4mRmAS Ov3v+NcdjPv+JB1iFOBgVOLhXbA8K0aINbG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7sv1N+uXOPnZF62bIvlNw6b4 /N/eZ+8sHf1fThI/Ixp7KuuT5cazu5VYijMSDbWYi4oTAaONEleWAgAA X-CMS-MailID: 20190218160113eucas1p2183a3620f8322ee33273d3bfe5f06486 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190218160113eucas1p2183a3620f8322ee33273d3bfe5f06486 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190218160113eucas1p2183a3620f8322ee33273d3bfe5f06486 References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix bug "s5p-sss crypto driver doesn't set next AES-CBC IV". This should also fix AES-CTR mode. Tested on Odroid U3 with Eric Biggers branch "iv-out-testing". Signed-off-by: Kamil Konieczny --- drivers/crypto/s5p-sss.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c index 0064be0e3941..3ea058addad3 100644 --- a/drivers/crypto/s5p-sss.c +++ b/drivers/crypto/s5p-sss.c @@ -463,6 +463,9 @@ static void s5p_sg_copy_buf(void *buf, struct scatterlist *sg, static void s5p_sg_done(struct s5p_aes_dev *dev) { + struct ablkcipher_request *req = dev->req; + struct s5p_aes_reqctx *reqctx = ablkcipher_request_ctx(req); + if (dev->sg_dst_cpy) { dev_dbg(dev->dev, "Copying %d bytes of output data back to original place\n", @@ -472,6 +475,11 @@ static void s5p_sg_done(struct s5p_aes_dev *dev) } s5p_free_sg_cpy(dev, &dev->sg_src_cpy); s5p_free_sg_cpy(dev, &dev->sg_dst_cpy); + if (reqctx->mode & FLAGS_AES_CBC) + memcpy_fromio(req->info, dev->aes_ioaddr + SSS_REG_AES_IV_DATA(0), 0x10); + + if (reqctx->mode & FLAGS_AES_CTR) + memcpy_fromio(req->info, dev->aes_ioaddr + SSS_REG_AES_CNT_DATA(0), 0x10); } /* Calls the completion. Cannot be called with dev->lock hold. */ -- 2.20.1