Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1030679pxk; Thu, 10 Sep 2020 05:26:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrhLadvWtqFxbaKAI7y9poW3u5eW/iJo6C5RnuJdbmVK3jrhI1MZWb5KwSDbXiDs/ZkRS7 X-Received: by 2002:a17:906:cc98:: with SMTP id oq24mr8369979ejb.106.1599740809794; Thu, 10 Sep 2020 05:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599740809; cv=none; d=google.com; s=arc-20160816; b=EZkqDeNUh83g/hPQ4Y1ToWEnWWrL82aQzqqW78fZMc2wumBlwvJVQAX9oHMhLJhJQ+ v17Xf+XTjF0INtpxyMa6hMjh2FuT2PVwsnhUEBijfMe+QxVZ0nYSNY90sHi8u0zC4zID l2bpnexG8OS3+cvd8VACm/A0i2I5ikHcYyQMNQR/itQvd04pMOtTQ0OrAfqYLUcxDDeW lO3PPo3/Ayc5cd7fP4kVJw4HzfST0LQhH7/AMbXkQzafK0LcPGmFjyCf+Z3GU5MaWe53 4fxMr9/OnhD7v7DUkwFUGgwqV/48mwFeeUdYEVX9rd4KqTOuXzpYuLdj3vUzRJC7LthB q8FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=wbR7SoxQBCfjqgUzYEK//K0pUx9xypcrfOp3M+Xlkkk=; b=qeDe8w3O1sfz/RB/A6bmL93UUH03Da9Qiu4f6rgpDpSuXPXHf1Qz+NxZNwUvM/FwLz W4xpvbtaKCXUkvAOcjzkRBJrf7XZmFJO/Y+PLl8k/4ZhxTsfFjCryh9hnc3zYr4NZ8f1 DrKada1Wc141h63vuLVs+M9TW/bSE8zk3zKoYMOMlzap1Yp9Pf0cuakiK9dvoo1gRrX8 lCqPbvsyLZdvxapqAmL5h4NlDb/wAr7Wm2xPdzbLZPbJyHazOTr1RdMIF2cyT6OueJwL BHHbPwAI5PFVUNHvwB2IgoJJYitaTaBiqvRcPe/T9F+Z/q2sj3ehWeuLEFgvg1rYXGzu Fr9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BXIYKiGp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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. [23.128.96.18]) by mx.google.com with ESMTP id l6si3328203ejg.212.2020.09.10.05.26.27; Thu, 10 Sep 2020 05:26:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BXIYKiGp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1730386AbgIJMZq (ORCPT + 99 others); Thu, 10 Sep 2020 08:25:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730665AbgIJMWw (ORCPT ); Thu, 10 Sep 2020 08:22:52 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AF40C061756; Thu, 10 Sep 2020 05:22:52 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id g4so6481897wrs.5; Thu, 10 Sep 2020 05:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wbR7SoxQBCfjqgUzYEK//K0pUx9xypcrfOp3M+Xlkkk=; b=BXIYKiGpUbcAZdgcVJHCCYYoWh8ku3rlrGTa7HWb520OhpwcV3vIS7yTGRo2QDZJ+8 3JG+b+MTgn+zh2YyfxY2fZU2Dbkn7WFzCDsBfFVUXpnFg/Ie0zObTKkbaxK+gUht53zG nEwOymmTyrKOmK0evHwpI0AY343wYXmPDCYeVdnRlLWhP1upH7SnOtj4mXPpNz4UVWWC 8ffY6rhUxJe6Po/XgwnDuYAwbfocPRD3aOshRiCRIHum3UTIx164Koq3aV+hsBOhG0K1 uYfRMeP2OqVXRurq9BLBRD3SgzYrW39TyQYUef3oSxM62i8YiL0sE/TmC2Qyn80zSsuc 4nkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wbR7SoxQBCfjqgUzYEK//K0pUx9xypcrfOp3M+Xlkkk=; b=IGmqL4giYbnUajeqozQRGbu1qDx1Q2VbgBkcRnSoZDjA7s4jP7UybqMQP18+/HxgMD 88zSsZ6n8y8Wd9U0fqGd9/G5MhNAEarR1ZCInit9ru99609ZYn7U1YVITxYX5a347l6P FjPiP/oWt3ZKJzQj713eI3JIScExMpiMY0d95kxc89989+0CT+j2eQ1fE1+wI9eQgBoI lp7xIrWQ692xu9jOQGkyaT0pyer7CoI8QTEiOIxuNOzxrfIjXHF5TGToeDb0B+FH33WL CkT+f3cvwE1Sfv8zMltK2prEd5o7Nt0bwttUn0B7iz7jdv1OsQEd7mzH/GvJRq5qczUt saig== X-Gm-Message-State: AOAM530Wp3qqZaeb3Mf/Q4iF3IPBsyjVdeLRsekE7IFjdIjf00xLqlDz nmzkSoaxqKjQ1EIIbPj3pAE= X-Received: by 2002:adf:f042:: with SMTP id t2mr8335938wro.385.1599740570516; Thu, 10 Sep 2020 05:22:50 -0700 (PDT) Received: from Red ([2a01:cb1d:3d5:a100:264b:feff:fe03:2806]) by smtp.googlemail.com with ESMTPSA id v3sm3428918wmh.6.2020.09.10.05.22.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 05:22:49 -0700 (PDT) Date: Thu, 10 Sep 2020 14:22:48 +0200 From: Corentin Labbe To: Herbert Xu Cc: kernel test robot , kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, Linux Crypto Mailing List Subject: Re: [v2 PATCH] crypto: sun4i-ss - Fix sparse endianness markers Message-ID: <20200910122248.GA22506@Red> References: <202009061621.J89kO43Q%lkp@intel.com> <20200907062400.GA15841@gondor.apana.org.au> <20200907160029.GC11894@Red> <20200908050036.GA19817@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200908050036.GA19817@gondor.apana.org.au> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 08, 2020 at 03:00:36PM +1000, Herbert Xu wrote: > On Mon, Sep 07, 2020 at 06:00:29PM +0200, Corentin Labbe wrote: > > > > The put_unaligned should be _le32. > > > > This fix the modprobe tcrypt fail. > > Thanks. Yes the original code was correct. > > ---8<--- > This patch also fixes the incorrect endianness markings in the > sun4i-ss driver. It should have no effect in the genereated code. > > Instead of using cpu_to_Xe32 followed by a memcpy, this patch > converts the final hash write to use put_unaligned_X instead. > > Reported-by: kernel test robot > Signed-off-by: Herbert Xu > > diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c > index dc35edd90034..1dff48558f53 100644 > --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c > +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c > @@ -9,6 +9,7 @@ > * You could find the datasheet in Documentation/arm/sunxi.rst > */ > #include "sun4i-ss.h" > +#include > #include > > /* This is a totally arbitrary value */ > @@ -196,7 +197,7 @@ static int sun4i_hash(struct ahash_request *areq) > struct sg_mapping_iter mi; > int in_r, err = 0; > size_t copied = 0; > - __le32 wb = 0; > + u32 wb = 0; > > dev_dbg(ss->dev, "%s %s bc=%llu len=%u mode=%x wl=%u h0=%0x", > __func__, crypto_tfm_alg_name(areq->base.tfm), > @@ -408,7 +409,7 @@ static int sun4i_hash(struct ahash_request *areq) > > nbw = op->len - 4 * nwait; > if (nbw) { > - wb = cpu_to_le32(*(u32 *)(op->buf + nwait * 4)); > + wb = le32_to_cpup((__le32 *)(op->buf + nwait * 4)); > wb &= GENMASK((nbw * 8) - 1, 0); > > op->byte_count += nbw; > @@ -417,7 +418,7 @@ static int sun4i_hash(struct ahash_request *areq) > > /* write the remaining bytes of the nbw buffer */ > wb |= ((1 << 7) << (nbw * 8)); > - bf[j++] = le32_to_cpu(wb); > + ((__le32 *)bf)[j++] = cpu_to_le32(wb); > > /* > * number of space to pad to obtain 64o minus 8(size) minus 4 (final 1) > @@ -479,16 +480,16 @@ static int sun4i_hash(struct ahash_request *areq) > /* Get the hash from the device */ > if (op->mode == SS_OP_SHA1) { > for (i = 0; i < 5; i++) { > + v = readl(ss->base + SS_MD0 + i * 4); > if (ss->variant->sha1_in_be) > - v = cpu_to_le32(readl(ss->base + SS_MD0 + i * 4)); > + put_unaligned_le32(v, areq->result + i * 4); > else > - v = cpu_to_be32(readl(ss->base + SS_MD0 + i * 4)); > - memcpy(areq->result + i * 4, &v, 4); > + put_unaligned_be32(v, areq->result + i * 4); > } > } else { > for (i = 0; i < 4; i++) { > - v = cpu_to_le32(readl(ss->base + SS_MD0 + i * 4)); > - memcpy(areq->result + i * 4, &v, 4); > + v = readl(ss->base + SS_MD0 + i * 4); > + put_unaligned_le32(v, areq->result + i * 4); > } > } > I get some md5 error on both A20+BE: alg: ahash: md5 test failed (wrong result) on test vector \"random: psize=129 ksize=0\", cfg=\"random: inplace use_finup nosimd src_divs=[85.99%@+3999, 5.85%@+30, 0.96%@+25, 5.9%@+2263, 2.11%@+1950] iv_offset=2 key_offset=43\" and A33+BE: [ 84.469045] alg: ahash: md5 test failed (wrong result) on test vector \"random: psize=322 ksize=0\", cfg=\"random: inplace may_sleep use_finup src_divs=[99.1%@+2668, 0.88%@alignmask+3630, 0.11%@+3403] iv_offset=33\" +[ 84.469074] need:35966fc8 b31ea266 2bf064e9 f20f40ad +[ 84.469084] have:e29e4491 f3b6effc fa366691 00e04bd9 Thoses errors are random. (1 boot out of 2) The ahash-md5-sun4i-ss is set as "selftest: passed" and I didnt see any failling/absent test in /proc/crypto So what is this md5 which fail ? I am still investigating and will try on more platform.