Received: by 10.223.164.221 with SMTP id h29csp4021549wrb; Tue, 31 Oct 2017 08:27:31 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QelPp8qd5s/itQd/qbKjeM59Zujx46ETXVvtp2rrkb+P5AfY+nNavKIPoVwIsWSkdWI5yJ X-Received: by 10.84.235.136 with SMTP id p8mr2152201plk.263.1509463651073; Tue, 31 Oct 2017 08:27:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509463651; cv=none; d=google.com; s=arc-20160816; b=uI4BvYBeXgKAdcGyrqagRxbGbDZDq+8+nghNaomoFlYOetsP/JluUowATGlgUWKCaS BTwtbpBTj3ZDGYKcUb9tFvKiFuwNtYrDAWhb5fvmnOkDWUvcGY2FW1v/Qfje+kqHUVJg bPUkC8T14PS/UrXIIM1V1iF4D6LjQzv90tVi21HzSYxNLodFUeog/P5gO45I0EcGa48b 5Svazr1/coXX+Ic4jqab+5y14lkZBlumFuzX9MvrYtMiA+DI/9faqTbiGAm5MopDKDY9 vru/rEwh2UxcxjAwcBq6/ktnXQ0B/1QMLvOSuvDDe9eJs0WIKRBDY3/96Fbw7f5TnsJp y6gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=xoTgm0bXz7B04RwEtYYzrFnGZ6ZFxkPRN5tV+hUf9ZE=; b=on+ZBhui3tLn9wy0XqAPjWLXwPzk2T/Bp2qqFZ3+5XjjR0RT0s1/9BaJPxqLByfIBG olwKM5tVL2+j7ZxUuAQRZ6XVULbQuwRqEEGa6LDY6geqi9fJhjifP14B/EE3El906JR1 PJnaHCU/Kminz9IXdyJZBer65gNbq2PJXf81Nz/sivnfi+7c177cvqGHBB5o78RUObpj aKdWnT+mmt++Dx1IwU4TrN9UphpCr4IVEuulS0rXW8/usTcMFlS6qA+V8Awg35lm1D4Q aiN4Jmi0AocDduLWtg8bUKOrRdaM2MSJg6sl190DzxPQlEdhYOH793uZUk1Kll46zeZU lYDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uovSqrHK; 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=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si1774424plk.751.2017.10.31.08.27.18; Tue, 31 Oct 2017 08:27:31 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=uovSqrHK; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753595AbdJaP02 (ORCPT + 99 others); Tue, 31 Oct 2017 11:26:28 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:47353 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751807AbdJaPZ7 (ORCPT ); Tue, 31 Oct 2017 11:25:59 -0400 Received: by mail-wr0-f194.google.com with SMTP id y39so16315580wrd.4; 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=fqg/fS2JFtc/BTjsyQSB9X4UF+8PIc8TcTPz/ye3lQZDCQVj/2RMANfXMmsB++cyMA /AaqQlRx7LBGKVzdmZ4t3EZcs2kbO0oUEqDTgCj46U4HoOISZTEY0oG1yxdj0iMLsiqE yUkWe4C3awKJae5a24plKtK2m0E15TASibz0WhOJUJOctK6e2OZJ9xc2qBowQY7oRTbk LVXm1CEuSLFTSopiiCkDQJOci3vWZD90H6wAm2fp2ld7cKs8runIbbyMc6aES1Ruytff zSyCO6LGSeRq1f4AbTGAKe8/Nm8GRzdNKUgr5pYJz3FL0Tv/D3v0tmQkaX/SSlpCMIYh jzBQ== X-Gm-Message-State: AMCzsaUIqSrpE/0uBfICrTwVmureaLKAtMTZ0pCTKnQmdrj+arK5lUhj w4qmiMBVDialZjuhg+XeXO4= 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 Cc: Nicolas Ferre , linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Romain Izard 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.14.1 From 1583359595749978207@xxx Mon Nov 06 23:03:00 +0000 2017 X-GM-THRID: 1583359595749978207 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread