From patchwork Thu Oct 17 12:25:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 176578 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp847762ill; Thu, 17 Oct 2019 05:26:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/eHYBhNJ/6EiIqkrRlYB1OC4k9rQwjveYoHbk3yA/mS3rUEkxum8T5zQPf1/hFnOxBtOh X-Received: by 2002:a17:906:7e17:: with SMTP id e23mr3243567ejr.205.1571315183174; Thu, 17 Oct 2019 05:26:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571315183; cv=none; d=google.com; s=arc-20160816; b=UIYS6+AR2+D7FYO9oT4Ru9aBtT3G3GtHLgBNXxHtNYySGtPf/DYXh7hvPl4sNwoaCZ 5xNUssgsbaHC8Q6WXxyRT90nZKnex8ua0ylI44k9bX6gz1XL7HcbkmPYhL9pr9qKNQ22 VkfNm4iT2Ap3Z8gmgtMmr5WIzEzQAmYtq7+iv/uHj9vFtdFNqIO7QI4g1PJ66wEezw9A Y88RCZQhCq7nvrKknMA75bk5NSmJ+OP8wdn989Xz0BL3z9Ot9YMpGxH/8prvZJkG+DUg ka19eoHlKaycnA0B6GKsbFZp90fmFc8kIH2H+8/8+bWCehytwycKFbZyqQrJZ3/JbL53 1fBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=hmNAPQfmgr7QrBR8MmHXs44ME0uvJ0gm3L6xlCrIGdo=; b=hy/eqsmPNOFg2Gf+HA7mYlm4SlZfT8ER3LfMhX5H4aXZywnS9pxXnTvqGtF5hd26+m GKzM6c4u9q1Y0P1yNn/z4IEN7rd0fUsNKhFJ9DsIrzeBILKNvtZi51Tl2LRjeFx3lzET NJEg2V0tmXTCZQ9xqAQOi7j9FNHAGo+dHmlCIvs6+IBiZLp9J1LqC0Y7fTczfrXn3+qb 3+UUJMzFZWYcNUDeMHZO7Kp2b1Ny4b4UTCGRSTgV6XQeHjcTLtYOSK4CpsE6AZcLkvii pT7v2CsHLdsnSG/BPv1rHZmnEbc5aQBsD7C+cevTTWPgPeJwUI44DAan03VjQPaxR87X OQ7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Xb6bTmXF; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ot22si1288436ejb.153.2019.10.17.05.26.22; Thu, 17 Oct 2019 05:26:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-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=@ti.com header.s=ti-com-17Q1 header.b=Xb6bTmXF; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2409376AbfJQM0U (ORCPT + 5 others); Thu, 17 Oct 2019 08:26:20 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:47750 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728554AbfJQM0U (ORCPT ); Thu, 17 Oct 2019 08:26:20 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9HCQADT091680; Thu, 17 Oct 2019 07:26:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571315170; bh=hmNAPQfmgr7QrBR8MmHXs44ME0uvJ0gm3L6xlCrIGdo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Xb6bTmXFN96YtX1wBXHM58x7EkP8BS3eEkoRBIAqnF94m9joZ/waJnup2YrBmuAu5 SekTXOxsfBBhh3+Wof5+G6Z42pbD1ph5sU9YbtwvFzZ2mfalbl/7L2LG2pw4qZMA71 SqHZ4CNCM7JVAPYwCGm8z/sPrLOabsbtBaI22608= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9HCQA21117882; Thu, 17 Oct 2019 07:26:10 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 17 Oct 2019 07:26:10 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Thu, 17 Oct 2019 07:26:10 -0500 Received: from sokoban.bb.dnainternet.fi (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9HCPxNa073246; Thu, 17 Oct 2019 07:26:08 -0500 From: Tero Kristo To: , , , CC: , Subject: [PATCH 05/10] crypto: omap-aes: add IV output handling Date: Thu, 17 Oct 2019 15:25:44 +0300 Message-ID: <20191017122549.4634-6-t-kristo@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191017122549.4634-1-t-kristo@ti.com> References: <20191017122549.4634-1-t-kristo@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Currently omap-aes driver does not copy end result IV out at all. This is evident with the additional checks done at the crypto test manager. Fix by copying out the IV values from HW. Signed-off-by: Tero Kristo --- drivers/crypto/omap-aes.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.17.1 -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c index 38c750e83dbe..c40876353b19 100644 --- a/drivers/crypto/omap-aes.c +++ b/drivers/crypto/omap-aes.c @@ -479,6 +479,14 @@ static int omap_aes_crypt_req(struct crypto_engine *engine, return omap_aes_crypt_dma_start(dd); } +static void omap_aes_copy_ivout(struct omap_aes_dev *dd, u8 *ivbuf) +{ + int i; + + for (i = 0; i < 4; i++) + ((u32 *)ivbuf)[i] = omap_aes_read(dd, AES_REG_IV(dd, i)); +} + static void omap_aes_done_task(unsigned long data) { struct omap_aes_dev *dd = (struct omap_aes_dev *)data; @@ -500,6 +508,10 @@ static void omap_aes_done_task(unsigned long data) omap_crypto_cleanup(&dd->out_sgl, dd->orig_out, 0, dd->total_save, FLAGS_OUT_DATA_ST_SHIFT, dd->flags); + /* Update IV output */ + if (dd->flags & (FLAGS_CBC | FLAGS_CTR)) + omap_aes_copy_ivout(dd, dd->req->iv); + omap_aes_finish_req(dd, 0); pr_debug("exit\n");