From patchwork Tue Nov 5 14:00:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 178503 Delivered-To: patch@linaro.org Received: by 2002:ac9:3c86:0:0:0:0:0 with SMTP id w6csp709542ocf; Tue, 5 Nov 2019 06:01:44 -0800 (PST) X-Google-Smtp-Source: APXvYqzs8kw9Rtx5P/C6l4p93Q3R+ypmSHd/dbJnYXsnEHa8/C2FDvKmiaBp8VEZEfZlFXVWCWJi X-Received: by 2002:a17:906:945:: with SMTP id j5mr22880940ejd.211.1572962503958; Tue, 05 Nov 2019 06:01:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572962503; cv=none; d=google.com; s=arc-20160816; b=TEnUZlRVc0HCT0NqaO3EBYzWLLBXVYblj15mvMlqFK12bg7km3nciURbZFOszHE3VJ vZoHSC+IsW/Y7gQ1Uq1UrTYX5cZcUTs7e3YUcmdzAYrDbpRwldTNoepw3eA8a4TDJsP5 /TR0QvGZ3Rc5oftG+7lr1iZbxKntyZ/jVXY2ArMCWI3HHqD0fIdHaf915crTwVRvg3my 3hFJSdTeU6bHXsWlzB8T178z8IJvde1pQClbdDOfHgbdCLJCbtY/K/GKXn7r0WB+5eds dFv/x/Na0z+MymhO69C+is9KBbhPcC7dMj3EC7GtIb1NPOeHaCDIsrg8c8tGtDTCxViG o6Ug== 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=nrw79wvcWzgTlVnIkkp/iAS37hs/nXQ21HoyDm5EaZw=; b=YvHlmv4SFHCEUajQZHWTyjsA+vbaW588Q3ZL3GeEFRnrXjqMlUBvwDHR0vCmobqHie nA2L1EVJCflclbFD9FN+gLKfrXQl3KqSS/0/QZAamXaDJDfLtFanvyCHDnppbGDeiSJt +q9ojQxSMa6jpJ+0vR7DOYavfPxq7aUYseIRBv0Yy5UneP2jb+sXPbEuHtu87/vmC8lR b8cp4qQEr5mQ5UoJeOWUMNmYU2VV4SGpFpTrw4o7l+UNToOjQmT/8+dxw5tEfLlgbMjB WJm8NbXYMtXAAH+ECv5ZUq/rveFawx1cOSFJL9vfX31rXQFnWDvPEN27ckBr0z+vJ5cx hEHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=UEpdwjcS; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 dk11si13340421ejb.97.2019.11.05.06.01.43; Tue, 05 Nov 2019 06:01:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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=UEpdwjcS; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 S2389373AbfKEOBm (ORCPT + 3 others); Tue, 5 Nov 2019 09:01:42 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:43946 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388605AbfKEOBl (ORCPT ); Tue, 5 Nov 2019 09:01:41 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id xA5E1YiD071523; Tue, 5 Nov 2019 08:01:34 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1572962494; bh=nrw79wvcWzgTlVnIkkp/iAS37hs/nXQ21HoyDm5EaZw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=UEpdwjcSm3zYxT4I5hz9VKQY5oMDKbUc8ISIIQ+wgvprL+yn4kdaD569OcKhf9Yfp tuQCnI2yA2Ka49e04Sd+Weq9RpBUC9jCk9hSdEq0blSQgGawggTQBxwHY1VYZVkjOU TsTqNQEc68JNtFOQ3iBOR6C/xcIHMWHMCWfpcZho= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id xA5E1YOL084579; Tue, 5 Nov 2019 08:01:34 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Tue, 5 Nov 2019 08:01:17 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Tue, 5 Nov 2019 08:01:17 -0600 Received: from sokoban.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id xA5E1FFi068289; Tue, 5 Nov 2019 08:01:27 -0600 From: Tero Kristo To: , , CC: , Subject: [PATCHv2 05/22] crypto: omap-aes: add IV output handling Date: Tue, 5 Nov 2019 16:00:54 +0200 Message-ID: <20191105140111.20285-6-t-kristo@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191105140111.20285-1-t-kristo@ti.com> References: <20191105140111.20285-1-t-kristo@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@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..e3f2ed0184f8 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");