Received: by 2002:a05:6a10:87d6:0:0:0:0 with SMTP id g22csp604033pxr; Mon, 11 Apr 2022 02:19:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXo6u55LxoVf15zWoeh34ohNT8CVjtwRmugLid1osaptMmhIS25oeSE3CS0J8xLnHfhgdk X-Received: by 2002:a17:907:96a1:b0:6e8:9dce:c3bc with SMTP id hd33-20020a17090796a100b006e89dcec3bcmr1067278ejc.589.1649668754392; Mon, 11 Apr 2022 02:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649668754; cv=none; d=google.com; s=arc-20160816; b=c9FriEO+dHluYA9Im+PmoXu5nOLZUC3OPWnNEjpjx2unb5bthtGY92SwBrCUvZFQyt bnONvRd38zHJ+eOgWGh3DVni8W6oWIEQ5DepA8WN5sE2OakgAQM8nbc2kYDszNYjeTRo tbTi8MC3kUqIh/vep7uZBnuKDycumQgOGWpnQBaJZc054txc+oNDLPPv8IzdqQju/oHE bOqZQVtKj432kTuodcKV7wGYOJ8nYY7sGZfPiK43LZnYN8D63EsdbnrLcdlH70f/Tr4w kEQEO6z2+VXGFx8oVmi81k0TDpb26WgpsJRUb1L1zjK0Eo+unghTclwQW7XAeQyg1aMW WQ0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=IXFXkZ/zIPR/vpj7KNO5NDwB6CMm+azUma0NGH5YVgU=; b=Pa55LC1ETEPz16mr8gGmNT9YWkSrRoSBm/roWekMruiCuz7H3UF4SKdJ/1UG6PqyxG 7KZo0xmJId4MC4lAbjhEdJCx4Yu6gOsb0nqhrzVerM2jOLslqrHjzEzCOSHDhyaFucOp /BhK7DWiwBnW0XFW0Ftp4ri7ADG9J2SDDniRlykZtA4kk61Ecaj2hs7oRwKzIYrWi/aR K6NiM1anFQXoJKj87RZK8D55Wfm4HOFR2T3Ig1fUBKezKz5gJuKcVlNw1t8cI9TIY7dJ 535ZdGjLGd3DONDrIXmM8aCqezYvWif/OcXoDMgKHYvQHcik4oER66NDDPd+QyyiCXPO 95qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=DU1x7RrL; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a056402190600b0041d17d22f0asi6537619edz.296.2022.04.11.02.18.48; Mon, 11 Apr 2022 02:19:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=DU1x7RrL; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243461AbiDKIx5 (ORCPT + 99 others); Mon, 11 Apr 2022 04:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243913AbiDKIx4 (ORCPT ); Mon, 11 Apr 2022 04:53:56 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E17CB3EABB for ; Mon, 11 Apr 2022 01:51:41 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id w4so21865309wrg.12 for ; Mon, 11 Apr 2022 01:51:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=IXFXkZ/zIPR/vpj7KNO5NDwB6CMm+azUma0NGH5YVgU=; b=DU1x7RrLRqhM32z2qCQqJ8a/bsJ1Es12ZQaw54KzV/aumf31lk1TLA1cpv4cZI8Ml0 I+PBZQ513P+Kl+A/cS98JJNei9ccl78hSmxjsg7XW11/rh3t9Ybra6WILnO2jHnWVw03 d99k42th8WeHxcw1YDHY+O1+QzALwhvy3AH1pZW142gprxVanbAPJMWDcfOlCMCwxITt 0bDMQgwZrIbdNbhNstZ0ncbZD4ArqB/X32ZlX0JK3qVtYtPbKZ7UwF7Z7vjQOIhIkgsF hcglTWYerpYvHtIhiNnQjyVGp4qBPBlKNsdrpzUAw6LdVPJPh8vkURTvWG+uDP3P+36m kpSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=IXFXkZ/zIPR/vpj7KNO5NDwB6CMm+azUma0NGH5YVgU=; b=hLIinaO76IPOlsfR8CfUExoUBbe4mPNbBfZaAY4RkqXfiz1PmlsByHy/h71c856iXJ X8GEledb36Ru2/l/z0ltJ7Qv5508t3oGFmIHVMjAdIUxeU9dZzxFfA2cie6uViAAjYKw RSrItGoZsWak/rpdmIIkqA49weGeoZkGdhPZR5wuSJ1gUqc32bREioqQM6TKM3Wpb2yU zUZTyDsMuVzKJOPcOvUGVqLo5Stots0CdgKN+dm2go8J5v8CxeWItB8Yt9irp+/KWO1l XR3ihJKxite0G1RRCGpT5mjzLH7+8tF45kaKS7kmvDekukzRyPq7NCArJHv8ue8rIXk6 mXhA== X-Gm-Message-State: AOAM530WzCK0OaP0X+4JNUyLBQo0Hagap4CooGL2keXV24cKWsjc6TL2 A8i/iSBT1886Ir+RZRNEj5/DOw== X-Received: by 2002:a05:6000:15cb:b0:207:97e4:e445 with SMTP id y11-20020a05600015cb00b0020797e4e445mr11520814wry.672.1649667100481; Mon, 11 Apr 2022 01:51:40 -0700 (PDT) Received: from Red ([2a01:cb1d:3d5:a100:264b:feff:fe03:2806]) by smtp.googlemail.com with ESMTPSA id y15-20020a056000168f00b002057a9f9f5csm30881650wrd.31.2022.04.11.01.51.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Apr 2022 01:51:39 -0700 (PDT) Date: Mon, 11 Apr 2022 10:51:38 +0200 From: LABBE Corentin To: John Keeping Cc: heiko@sntech.de, herbert@gondor.apana.org.au, krzk+dt@kernel.org, robh+dt@kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org Subject: Re: [PATCH v4 08/33] crypto: rockchip: better handle cipher key Message-ID: References: <20220401201804.2867154-1-clabbe@baylibre.com> <20220401201804.2867154-9-clabbe@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Le Mon, Apr 04, 2022 at 12:31:11PM +0100, John Keeping a ?crit : > On Fri, Apr 01, 2022 at 08:17:39PM +0000, Corentin Labbe wrote: > > The key should not be set in hardware too much in advance, this will > > fail it 2 TFM with different keys generate alternative requests. > > The key should be stored and used just before doing cipher operations. > > > > Fixes: ce0183cb6464b ("crypto: rockchip - switch to skcipher API") > > Signed-off-by: Corentin Labbe > > --- > > drivers/crypto/rockchip/rk3288_crypto.h | 1 + > > drivers/crypto/rockchip/rk3288_crypto_skcipher.c | 10 +++++++--- > > 2 files changed, 8 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/crypto/rockchip/rk3288_crypto.h b/drivers/crypto/rockchip/rk3288_crypto.h > > index 8b1e15d8ddc6..826508e4a0c3 100644 > > --- a/drivers/crypto/rockchip/rk3288_crypto.h > > +++ b/drivers/crypto/rockchip/rk3288_crypto.h > > @@ -245,6 +245,7 @@ struct rk_ahash_rctx { > > struct rk_cipher_ctx { > > struct rk_crypto_info *dev; > > unsigned int keylen; > > + u32 key[AES_MAX_KEY_SIZE / 4]; > > Should this be u8? It's only ever memcpy'd so the fact the registers > are 32-bit is irrelevant. > > (Also a very minor nit: this should probably be aligned in the same was > as the above two variables.) Yes, it could be u8 and I will fix the alignement. Regards