Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp200733yba; Wed, 15 May 2019 22:30:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqylewmeniwn/cDVXluTi9iQAKIUsK/h46iqydW4CZ5ECxGTOMA6bW1jQrR+dWnz6xlOZHa6 X-Received: by 2002:a63:2d41:: with SMTP id t62mr48884111pgt.113.1557984610929; Wed, 15 May 2019 22:30:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557984610; cv=none; d=google.com; s=arc-20160816; b=DkgQIZTv+d1mYKIFhRQ3jzoPKXl8ghhDsuY/WeYgw0fNtKkbWJYHrRPdHz2xLS1u0W TxDplTXgRVbVPpxYzzwaHUDJeY+2hCeZGx/p8x3c1bXYYW1GLoigz7XhLsRJ0n8iKsl5 6mHZAWkXE6S5bnmkAZoBzen/eVWEfyNB825ethMJUYElGv4jPao206Wyz7k2kyNR0Iy/ MmNK2xMOPMNHTEqUTD0DxPCvlN65pEC0kq+Uo+zn3NJOJXdPJLhBsWx99//qEsqad+TV piNQMNQIpZdKQCaFo6755yH4QvOXhlj9WHy/8ZA435aeR8kvRmTWny8tsM0yRezjahal GPPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=P6Om30hL1lPYEC7LolkN41RsDPGpD0LCsRqwi5B5jWE=; b=HAkWo/9UAKFa/B2/G70PXAjl6Pv3agdoKhDSSGQINaVuN+7Kxv3QW4FetH+IyVDj5O zC9ZGl8opQtCVhCBvqz0GkUYHklcWeqKkrvVZqiukYebMCadEsxr7Rv7QM1pWk6LTMj+ BEPGlZyByxXlQxImq3KE8ZM9NydBFAn8rs5DMF0UAaYYpsL5ByQPRn2SLk/lYq8Zgp/p mZc0xTKy0sLQfPo5fsLki9GrZ4cuh2IXAnairAXVcX9n83YoxVQsHZs3LQYPPBuyJnz/ ussgzZiPpp2McyaAa51HK0kZklvx6p8nbt+j6Joq/+sW9DStYyDycap0WM1Vz+ZQUxJK kKKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@axtens.net header.s=google header.b=K3yURH+N; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si3805387pgs.86.2019.05.15.22.29.45; Wed, 15 May 2019 22:30:10 -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=@axtens.net header.s=google header.b=K3yURH+N; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726257AbfEPF2z (ORCPT + 99 others); Thu, 16 May 2019 01:28:55 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42661 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725975AbfEPF2y (ORCPT ); Thu, 16 May 2019 01:28:54 -0400 Received: by mail-pf1-f194.google.com with SMTP id 13so1198682pfw.9 for ; Wed, 15 May 2019 22:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=P6Om30hL1lPYEC7LolkN41RsDPGpD0LCsRqwi5B5jWE=; b=K3yURH+NDfUWMqTOpua/7r5NCvFuqC9PK7/CLdehE8H9uPl3b4hdV6wANMC9dMh7Kt ewSjowvpr/e6nfdwlyRpAC5O7AyLsuuiu4rx2rQ5nhtfi4hYizA4ChwCcmFizAwm7owY BYmUC9ZZfXqOf2Cc6WEkvMwFhAWf1x22kK7Ew= 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:in-reply-to:references:date :message-id:mime-version; bh=P6Om30hL1lPYEC7LolkN41RsDPGpD0LCsRqwi5B5jWE=; b=KClLEaIG6zdmla+Kpa8i9Ma/jQTe1wx3m8wjDivFsyvGFpf5BKNmfLIttjJD4XCGa9 9uTyVC8Cd/YjUkG96NbssDYP0aIK6MhsZKv5GgvQEW0vRl5PQgD5ALYoasNbpGwrI0cn fy6D1ruQ2prZTphN0kXb9CHDphAC2BJ1SYPbfHYdnWdCsJbRHJELZeZz0H55qfkdcbkH pZDgSBM+Wuulh9pPzrEMPJu3u4YZ48diCUDtP4JWTg0Sp9Veorp4O64A10oZ3eupWmEw 6Qa3qc2LgcXGvJe+qhVnrAdDIh6cCcCvJFlycgXpuTUDNJZLlT6AUhWU0fA9NLCdEwz0 v5ng== X-Gm-Message-State: APjAAAWdt1wrioYQE30JoivsYegh/qMFsuBtQxNUB3ku+XEA7Lu7fpNf NxD7R7M2JbdxwmnB/C0WkMN8KQ== X-Received: by 2002:a63:6ac1:: with SMTP id f184mr49177523pgc.25.1557984533903; Wed, 15 May 2019 22:28:53 -0700 (PDT) Received: from localhost (dip-220-235-49-186.wa.westnet.com.au. [220.235.49.186]) by smtp.gmail.com with ESMTPSA id w12sm4259997pgp.51.2019.05.15.22.28.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2019 22:28:52 -0700 (PDT) From: Daniel Axtens To: Eric Biggers 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 In-Reply-To: <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> <20190516025603.GB23200@sol.localdomain> Date: Thu, 16 May 2019 15:28:48 +1000 Message-ID: <87y337ynlb.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Eric Biggers writes: > 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. Ah cool, I was just in the process of figuring this out for myself - always lovely to have my theory confirmed! > 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. This is very helpful, thank you. I guess I will do that then. Regards, Daniel > > - Eric