Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3093795pxb; Mon, 4 Apr 2022 07:39:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRZ2+YM0CazVDMQdaZFUxPxz83ZzU5SIiw8306THQCt71z1zwDY5K3Bkjo+f9r6HM8pSqf X-Received: by 2002:a05:6402:90c:b0:415:d340:4ae2 with SMTP id g12-20020a056402090c00b00415d3404ae2mr371008edz.331.1649083185392; Mon, 04 Apr 2022 07:39:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649083185; cv=none; d=google.com; s=arc-20160816; b=NNLCLBMBDo/mm3xVVQHIVEHIqoRTUfQdTAKXV9n2boKVju6+hgCdJXFacoqg9xkQrz 63rb++k5LDJ1cOTqWjtN8zo9wDL8EjN8Gb/r93zMTJtIJmDJAl46UDhdL4EDcVAMz3Lu sZvNKK68eetHUyB59IKDL+ovn6qm/BGkRaCZgw4R1fRJWTZsOhraiSL//fctwG/HQ5Pm PEokDZb1IU2SenyqvZXjRWfpFAk5PbKEREXsXdtUaOA2gHumPeCPr0bZdgrtkywLbdxa enrfwrTlJPsP70HgHjhWydxRAxycB+aJQ9nSE3CG5ThSEG2IJ0rNqqXYYYXhXSSdDC/a eq4A== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=g+Na3FfqSbBs+NfGy8udHP+G0PkiZ0hNm5glhWAuBtw=; b=ca1Lbvby6GNK+MXI5fXhQoLN1ts0zFlatOPnI4jWR4WFsdHF2Kn58gcfPGXGXBflJ9 yK7xEQ+Y+pU06qG4ygTpbPqs2ExXS3xd0EsYwx0Pqs5mn/shakbYGRSrQxPX+EO2+2tk 1Yp/w2K7BaT134bx78IuomSzio4ty2n+mWNPKV6YPcHyElhBR2x1noLRoJUzMrLK7bIk Lbw0FiUxjMnlFyf92BXgKHqeFyvww3ceLK46bKo5rYOdVsss1k9dMw+9dNhvQIMTEyXN C13sPwJrmWy1qggN7Xkj4qTAvDOuIsqCHShGJi6mHn3wozsvLRkx7AeVlg9QiYbYPwx8 nrQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@metanate.com header.s=stronger header.b="b8g/9mY+"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=metanate.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q15-20020a1709060f8f00b006df7e05c59csi6530472ejj.912.2022.04.04.07.39.10; Mon, 04 Apr 2022 07:39:45 -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 (test mode) header.i=@metanate.com header.s=stronger header.b="b8g/9mY+"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=metanate.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359582AbiDDLdO (ORCPT + 99 others); Mon, 4 Apr 2022 07:33:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359555AbiDDLdM (ORCPT ); Mon, 4 Apr 2022 07:33:12 -0400 Received: from metanate.com (unknown [IPv6:2001:8b0:1628:5005::111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C14E3C732; Mon, 4 Apr 2022 04:31:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metanate.com; s=stronger; h=In-Reply-To:Content-Type:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=g+Na3FfqSbBs+NfGy8udHP+G0PkiZ0hNm5glhWAuBtw=; b=b8g/9 mY+QVzpPzjxxdP2dH/gVChi9dXExZcQzbGEr6id4eHIu733ysAaJZ/FxXSceFhCf536aHA13rR3Yz U/QTqOfxh0WlNPwOqaoCrczym16P+qOmWQAI79Lkx+9Fa413PvawThzreFuTUQqwxyiXB1kC0Fpc3 0BrjD898MnrqjY4brIAoQGPWPEf54jyN34iem6Sjn93XVeILkET1QHxiZvFCdYqE2yjwG2KHQucQf xuTvKf7lR3eAi+OlgrMqhZsYiaIGyzh/GetT5kKSA3gUyNFIViUZCF03pqwyr07+LhxMLq/0QdVhr kMaI4C44AlRYQSuhpg5qRt/gjXHYg==; Received: from [81.174.171.191] (helo=donbot) by email.metanate.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nbKvQ-00051Q-N6; Mon, 04 Apr 2022 12:31:12 +0100 Date: Mon, 4 Apr 2022 12:31:11 +0100 From: John Keeping To: Corentin Labbe 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=us-ascii Content-Disposition: inline In-Reply-To: <20220401201804.2867154-9-clabbe@baylibre.com> X-Authenticated: YES X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RDNS_NONE,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 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.)