Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp100234yba; Wed, 15 May 2019 19:57:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2401mWlstzooJgw/GnrAvIFoVkB56BPBj0A5CU4sE0Ov0CC1dCPsz7duaXW62bmAEuHGx X-Received: by 2002:a17:902:e785:: with SMTP id cp5mr28705412plb.167.1557975436037; Wed, 15 May 2019 19:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557975436; cv=none; d=google.com; s=arc-20160816; b=BA958EAvdj4fxllxxquh1MW7uFNgLGCVlfEEnsh+q+bwLg2aB56GIJIH0LFmqYBeat 7JQjl4yocEasH3tEaMQ0lTfDQfUS4KvvUqrtscuXysKhNZRuzistZ6e5ExULUwtOfpnh oy+kvViUry4OQUpB0VXGK2++j2zYsepwhmDt9ylyUlPuV6jg4pkHIaH6qHnJN7aLySlQ x7ZgKv6B3KU/Eiclh44KvvhBZjY0CkB0iCm3u4mwnZawV8KUJHDzi4i0DhRAUh66rnIs +JgHu6TG2Z/VH1++QI8X7hRnzgJ1uDBmVxOfsEd2CAB0ZOLzkSaLi5DauZuLCwzctSnH q7ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dXXQv0Zzx+fMAAUIqCE7+5lrXfI1WLZSFfutdcb26VQ=; b=a0xG1PJQyGl5CXbUtEpcV+ieWMWPqsD7rJCQLfOcEmX+k9oNSc8Snqreu24kUpwC/v LzLDds1gI17d+vXLLWxrrglimWQHC825vlU/BkSKffy8EeVPtkA5LQk4h+RE1z9B8NEb 2tPbk6MbOOaw96Wlr+e2oP8/stndMSY4hMK8TzUK+qDCNNZbA147vD54pfBCcrPHZgj+ yliyQNnuZEaVsIFhKLAs5toK/EhGCpynaUPN9WxBTsKfV5NAPlZzE4mF85RdjMx6+xv0 coyKc3R1TBQgJK7u35PPE+nGL5ZA/sUd/6GjHqhieFkAIjLh1lhN3fnJdwGQbFsUzUtK 7m8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f8xAWeto; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si3489674pgp.199.2019.05.15.19.56.52; Wed, 15 May 2019 19:57:16 -0700 (PDT) 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=@kernel.org header.s=default header.b=f8xAWeto; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726188AbfEPC4H (ORCPT + 99 others); Wed, 15 May 2019 22:56:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:56234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725977AbfEPC4H (ORCPT ); Wed, 15 May 2019 22:56:07 -0400 Received: from sol.localdomain (c-24-5-143-220.hsd1.ca.comcast.net [24.5.143.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6762520848; Thu, 16 May 2019 02:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557975366; bh=TQQOh+GWzjppP/yoefvWnQUIY57aNXLvaCVcxSM4Cos=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=f8xAWetoxViGqcLLrXE1ZBoxuj5LXHi+Y3NQ0zuqiKCzm80F58a3w5bUE5CJx6LM/ Y0mtyMb19YeFXtRsO8JaRBMX63pIyDl1Lel6Lft9oy7jwqcEVmsn3Gqe5+33Bx0APv 3NOCsjwtmxfPokAtzdTUsHHw+nKK0TIV0YFF5nc8= Date: Wed, 15 May 2019 19:56:04 -0700 From: Eric Biggers To: Daniel Axtens Cc: Herbert Xu , Michael Ellerman , Nayna , leo.barbosa@canonical.com, Stephan Mueller , nayna@linux.ibm.com, omosnacek@gmail.com, leitao@debian.org, pfsmorigo@gmail.com, linux-crypto@vger.kernel.org, marcelo.cerri@canonical.com, George Wilson , linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH] crypto: vmx - fix copy-paste error in CTR mode Message-ID: <20190516025603.GB23200@sol.localdomain> References: <87imvkwqdh.fsf@dja-thinkpad.axtens.net> <2c8b042f-c7df-cb8b-3fcd-15d6bb274d08@linux.vnet.ibm.com> <8736mmvafj.fsf@concordia.ellerman.id.au> <20190506155315.GA661@sol.localdomain> <20190513005901.tsop4lz26vusr6o4@gondor.apana.org.au> <87pnomtwgh.fsf@concordia.ellerman.id.au> <877eat0wi0.fsf@dja-thinkpad.axtens.net> <20190515035336.y42wzhs3wzqdpwzn@gondor.apana.org.au> <874l5w1axv.fsf@dja-thinkpad.axtens.net> <871s0z171b.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <871s0z171b.fsf@dja-thinkpad.axtens.net> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, May 16, 2019 at 12:12:48PM +1000, Daniel Axtens wrote: > > I'm also seeing issues with ghash with the extended tests: > > [ 7.582926] alg: hash: p8_ghash test failed (wrong result) on test vector 0, cfg="random: use_final src_divs=[9.72%@+39832, 18.2%@+65504, 45.57%@alignmask+18, 15.6%@+65496, 6.83%@+65514, 1.2%@+25, > It seems to happen when one of the source divisions has nosimd and the > final result uses the simd finaliser, so that's interesting. > The bug is that p8_ghash uses different shash_descs for the SIMD and no-SIMD cases. So if you start out doing the hash in SIMD context but then switch to no-SIMD context or vice versa, the digest will be wrong. Note that there can be an ->export() and ->import() in between, so it's not quite as obscure a case as one might think. To fix it I think you'll need to make p8_ghash use 'struct ghash_desc_ctx' just like ghash-generic so that the two code paths can share the same shash_desc. That's similar to what the various SHA hash algorithms do. - Eric