From patchwork Thu Nov 14 10:58:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 179397 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp10888098ilf; Thu, 14 Nov 2019 02:58:20 -0800 (PST) X-Google-Smtp-Source: APXvYqzhJnFuo2iQ4tgm78pzInD7CPLRG2Iu0WTo1xdV5kMTCYx8ESxExZiFvI0E05vbqP6y79Y7 X-Received: by 2002:a05:6402:148d:: with SMTP id e13mr441150edv.290.1573729099939; Thu, 14 Nov 2019 02:58:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573729099; cv=none; d=google.com; s=arc-20160816; b=H4uE/F+SOZqrxj3R2eSIPdSM3O/VOjCh0cwU3tkp3TffR/1cIVoFCJdcOKSx2wrfon Ghtivxmy14fd03UI1hAAB3ZBR/09k/hjrBS2FIMO8gpG204zVrI2dgxYiSE04gu3Ghxg xw7VNseW9zHI8lWTXJmcmK7teiqPqhMJ5g/qFh4+05GxAL2orKXbpcpKYWOqhQ6i92hU bSiEwaaP/hG9nirSdppcWhB0eY0IPdzFxm9BZLDQycRoTE2SY3NO1ILrYckuHvGEJ3iY FVrY2AcIYncDpR1xWd/EBuiDb+GYQOIS/ACYgp6CPxsnFyrA4PxGaH6mB6vsJmaYj2iZ LzdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=lUDQmuDK49ImgwHVLgjE9X4paiR383d/ziyJit2HbDw=; b=NBO7lc2iXPhPF0UMNQl02eIgkQAzkVXHjQE7RqBTids6F+vo8XX8Cz6cBOgmnOMww0 sOMTdbnGv9tuhJzPBNk2b26yRWAJAPzhQsRV75KRoKVtoNUuhcoyG6bP4Z9VvlLBHFMK rSBX5By+SWe3Z/OIJeDgS2S6bUcmxoO3zjMWSObjQCLVxu7i/itktqHi1ljwH7PNnxcZ VzattukIzXH8ob8zPN/q1mQPmex7rynYBjoJwMMmtOvWRkF/MgVEPU8BoJg4HBRJLS+3 0i2seWYwqcPe7K6VqjPJmABuqs5r/p4IQqCI17VItgVmUl4RELwQKD2e31NWhTEFlV/D Yecg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uqr9FAH6; 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=NONE sp=QUARANTINE 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 j5si3904300edc.195.2019.11.14.02.58.19; Thu, 14 Nov 2019 02:58:19 -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=@gmail.com header.s=20161025 header.b=uqr9FAH6; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726179AbfKNK6T (ORCPT + 3 others); Thu, 14 Nov 2019 05:58:19 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:53447 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726139AbfKNK6T (ORCPT ); Thu, 14 Nov 2019 05:58:19 -0500 Received: by mail-wm1-f65.google.com with SMTP id u18so5185517wmc.3; Thu, 14 Nov 2019 02:58:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lUDQmuDK49ImgwHVLgjE9X4paiR383d/ziyJit2HbDw=; b=uqr9FAH6BQ7HESVl57/IfLRJbzZXTLbF2wXTTboVQw0KZFt3nmPkyWuA3rbJ3nFooJ GBBn1lAcHoEkVrUl1Px9R87ovisLn98BFe4cHyQ34IWaOOLj5kKONpgT9azV6sqf5AFQ 4FFwf1CDhdPxctlYTrdjZ/lpnmCyWz1nttXvgJv0E6Eunhni2s9RictuIk9p11tqoQeO oEYr7RwlqfStQXgig2bZblBaYoBp1nI+M3fNBihSPD7M41fLR2YhjQgiUsat7wFCW/Bd +FMoSMKrO40wztajwS1w9LAz1MXLTL15zc2Wh39+0AXmSNNtIHoWJjFSFaBz4EqHr/5L OFlQ== 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:mime-version :content-transfer-encoding; bh=lUDQmuDK49ImgwHVLgjE9X4paiR383d/ziyJit2HbDw=; b=gHtO3nLYUroTqeUO+LfXy3Zr/V4hFQcQvtnRlLXscaPbOhYgG74TerwPEy11uNojKb AGErRAYvl4DcNITYOGsoNrlttM/5vZiLlHUX3IDMaL/K/8WEl1q3TC4r3ErkxT8e77ak NFGOoscpomo/l9brapFu2WapzlJFLAuTL+LTgud5F0GQY/U20hVa1SVhjiE2CONPrvLA 6Tc9MjBqudqkGIxzgf+TVrqrGVbIbNj0ckoXKWnMpGwpnsmKwunfdXUYXw8avHNBW3yx ZZFEhYh8ysymcczW8M+FLb9CfANQoiwd1PZ9bWPUVs0Teu56nkKdIMjiQdwe6lCzXVwC RUNQ== X-Gm-Message-State: APjAAAWFFfXOJfm/H8jnJJB7Jc94ioGFLiJWmGo2YWM8jJsIeVNAaKNJ 0vKW//nvIgo/8dTT9d/PvSk= X-Received: by 2002:a7b:c24b:: with SMTP id b11mr7571066wmj.125.1573729096886; Thu, 14 Nov 2019 02:58:16 -0800 (PST) Received: from Red.localdomain ([2a01:cb1d:147:7200:2e56:dcff:fed2:c6d6]) by smtp.googlemail.com with ESMTPSA id b66sm6042770wmh.39.2019.11.14.02.58.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2019 02:58:16 -0800 (PST) From: Corentin Labbe To: davem@davemloft.net, herbert@gondor.apana.org.au, mripard@kernel.org, wens@csie.org Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Corentin Labbe Subject: [PATCH] crypto: sun4i-ss: use crypto_ahash_digestsize Date: Thu, 14 Nov 2019 11:58:13 +0100 Message-Id: <20191114105813.13171-1-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The size of the digest is different between MD5 and SHA1 so instead of using the higher value (5 words), let's use crypto_ahash_digestsize(). Signed-off-by: Corentin Labbe --- drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.23.0 diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c index ee518dcdba42..ec5d9ce24bb8 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c @@ -227,7 +227,7 @@ static int sun4i_hash(struct ahash_request *areq) */ if (op->byte_count) { ivmode = SS_IV_ARBITRARY; - for (i = 0; i < 5; i++) + for (i = 0; i < crypto_ahash_digestsize(tfm) / 4; i++) writel(op->hash[i], ss->base + SS_IV0 + i * 4); } /* Enable the device */