From patchwork Tue Oct 31 15:25:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Izard X-Patchwork-Id: 10034771 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 82F7F602B9 for ; Tue, 31 Oct 2017 15:27:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7385428712 for ; Tue, 31 Oct 2017 15:27:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 683DD28948; Tue, 31 Oct 2017 15:27:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0239A28821 for ; Tue, 31 Oct 2017 15:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=z0emMRKd8Eow65rfhxLbvRnpmMStUjntMhxmD9OPFh0=; b=JszTo7gUiiks0hSD63lAK6tehj oichvCs3Mtg6K9W1XzMVSaGd9hQ4/H9fSqA82EnxF7XgJrBAo4gwS4VoHlHtJZWJL+PUz+3iEpdjC YOg9/onX/8okqfrJ2A7eUKU02Cre0Yp4NdooaonHFmFxKPBTThrRbQpyCBHeFQbO+UJThAxNP5BVd fLhe6cMMEihFI3f+bJio9E7Hsm33Pr0rDu4m/WdVtrqdKBqzjhKCUrfZaejM7qMXkySwQ51RNP9MD 9evFZ+ZoEwlAz9AcoFyc3meo4dHEmHWCvz9vGgmTPBycFOofssgHM/zlRAsdU5b95WQtRb1mtZM+X ESu88Ceg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e9YRV-0006Bv-K9; Tue, 31 Oct 2017 15:27:05 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e9YQn-0005U1-Ok for linux-arm-kernel@lists.infradead.org; Tue, 31 Oct 2017 15:26:25 +0000 Received: by mail-wr0-x242.google.com with SMTP id o44so16277236wrf.11 for ; Tue, 31 Oct 2017 08:25:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xoTgm0bXz7B04RwEtYYzrFnGZ6ZFxkPRN5tV+hUf9ZE=; b=uovSqrHKSYMjXG5kbK65th1j6n8fO574DRodKZ/RZqFVw/9Hi0eRNgsZTkJznFCLE/ IaRBeUwGg9kH81bZaMDTY9Lc1Rry23O0immt/MwbToVa1QijQLCpHecgOyLw9+vWLZVI sjbrOd1KanJXUW8lxccRT9b7UKMeXUYaO8jn6eNvIN0ZiXOtAuIv/5/0HQ4d4NkCDtnc qDTTbvp91HqbieaOfILS8+U7GKyQURsc2Kf+Cp5JhgUC2iSE/ce2SSxs4N/0JAIrcDJF 1/MTfvjqzQvGto8UrDu8jhq+GNfn0zbduQr7031IU1FG0uGpmOmEjDn8K6f47CN/6qvV EJCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xoTgm0bXz7B04RwEtYYzrFnGZ6ZFxkPRN5tV+hUf9ZE=; b=irzmb56+jGyXZxYLr7H6WpfRGMOh7Z15YW0TxfhfnSSN/u7m0HqX2PfCysZu4Kb07s DG0zTxlmE0XmZZdF+Yp0VAuFsrguIB/LnXeartMj7XTjhmR4h1L2LH1pYDRG88DYhhGG 3L0OG3NDG7R+A8H+Rf7mSnrXDKG/RUnq0r193Yi4JbS0aIHmyzUugVnEaE7PYcxELni5 7O6UdFNrWcRJ6YSmujb7ug005lbY5PSOy9uCBsoPxMrQXvOyoJ04xCQ2n0r3kf6pmtNE Yo1d2pAzBHKany/BDe+/Ir97OEclXWAHhPlpg3Ijexc64IKLlRel6aYE3jUeKnGoBkh8 XXPw== X-Gm-Message-State: AMCzsaXfmYF6LBUDi/l+BI38z8ZBczAznHkJsKv7EBWpz8AGN7o0MHBs GA071X+HzBb5g9vHaQ5myOs= X-Google-Smtp-Source: ABhQp+TC3elkSfa5XDpOzjkCPltwEQy7RPpbWuEXup5iRzjI1jexMF3AfY7jbLWz4Q7mBMqL2SkujQ== X-Received: by 10.223.176.115 with SMTP id g48mr2354554wra.177.1509463558568; Tue, 31 Oct 2017 08:25:58 -0700 (PDT) Received: from localhost.localdomain (146.187.3.109.rev.sfr.net. [109.3.187.146]) by smtp.gmail.com with ESMTPSA id p23sm3764358wrb.76.2017.10.31.08.25.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Oct 2017 08:25:57 -0700 (PDT) From: Romain Izard To: Herbert Xu , "David S . Miller" , Tudor Ambarus Subject: [PATCH 2/2] crypto: atmel-aes - Reset the controller before each use Date: Tue, 31 Oct 2017 16:25:24 +0100 Message-Id: <20171031152524.25216-3-romain.izard.pro@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171031152524.25216-1-romain.izard.pro@gmail.com> References: <20171031152524.25216-1-romain.izard.pro@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171031_082622_097116_5CE6CD56 X-CRM114-Status: GOOD ( 11.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, Romain Izard , linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When using the rfc4543(gcm(aes))) mode, the registers of the hardware engine are not empty after use. If the engine is not reset before its next use, the following results will be invalid. Always reset the hardware engine. Signed-off-by: Romain Izard --- drivers/crypto/atmel-aes.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c index 53432ab97d7e..024914e82734 100644 --- a/drivers/crypto/atmel-aes.c +++ b/drivers/crypto/atmel-aes.c @@ -76,12 +76,11 @@ AES_FLAGS_ENCRYPT | \ AES_FLAGS_GTAGEN) -#define AES_FLAGS_INIT BIT(2) #define AES_FLAGS_BUSY BIT(3) #define AES_FLAGS_DUMP_REG BIT(4) #define AES_FLAGS_OWN_SHA BIT(5) -#define AES_FLAGS_PERSISTENT (AES_FLAGS_INIT | AES_FLAGS_BUSY) +#define AES_FLAGS_PERSISTENT AES_FLAGS_BUSY #define ATMEL_AES_QUEUE_LENGTH 50 @@ -450,11 +449,8 @@ static int atmel_aes_hw_init(struct atmel_aes_dev *dd) if (err) return err; - if (!(dd->flags & AES_FLAGS_INIT)) { - atmel_aes_write(dd, AES_CR, AES_CR_SWRST); - atmel_aes_write(dd, AES_MR, 0xE << AES_MR_CKEY_OFFSET); - dd->flags |= AES_FLAGS_INIT; - } + atmel_aes_write(dd, AES_CR, AES_CR_SWRST); + atmel_aes_write(dd, AES_MR, 0xE << AES_MR_CKEY_OFFSET); return 0; }